empathy-framework 5.3.0__py3-none-any.whl → 5.4.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 (458) hide show
  1. empathy_framework-5.4.0.dist-info/METADATA +47 -0
  2. empathy_framework-5.4.0.dist-info/RECORD +8 -0
  3. {empathy_framework-5.3.0.dist-info → empathy_framework-5.4.0.dist-info}/top_level.txt +0 -1
  4. empathy_healthcare_plugin/__init__.py +12 -11
  5. empathy_llm_toolkit/__init__.py +12 -26
  6. empathy_os/__init__.py +12 -356
  7. empathy_software_plugin/__init__.py +12 -11
  8. empathy_framework-5.3.0.dist-info/METADATA +0 -1026
  9. empathy_framework-5.3.0.dist-info/RECORD +0 -456
  10. empathy_framework-5.3.0.dist-info/entry_points.txt +0 -26
  11. empathy_framework-5.3.0.dist-info/licenses/LICENSE +0 -201
  12. empathy_framework-5.3.0.dist-info/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md +0 -101
  13. empathy_healthcare_plugin/monitors/__init__.py +0 -9
  14. empathy_healthcare_plugin/monitors/clinical_protocol_monitor.py +0 -315
  15. empathy_healthcare_plugin/monitors/monitoring/__init__.py +0 -44
  16. empathy_healthcare_plugin/monitors/monitoring/protocol_checker.py +0 -300
  17. empathy_healthcare_plugin/monitors/monitoring/protocol_loader.py +0 -214
  18. empathy_healthcare_plugin/monitors/monitoring/sensor_parsers.py +0 -306
  19. empathy_healthcare_plugin/monitors/monitoring/trajectory_analyzer.py +0 -389
  20. empathy_healthcare_plugin/protocols/cardiac.json +0 -93
  21. empathy_healthcare_plugin/protocols/post_operative.json +0 -92
  22. empathy_healthcare_plugin/protocols/respiratory.json +0 -92
  23. empathy_healthcare_plugin/protocols/sepsis.json +0 -141
  24. empathy_llm_toolkit/README.md +0 -553
  25. empathy_llm_toolkit/agent_factory/__init__.py +0 -53
  26. empathy_llm_toolkit/agent_factory/adapters/__init__.py +0 -85
  27. empathy_llm_toolkit/agent_factory/adapters/autogen_adapter.py +0 -312
  28. empathy_llm_toolkit/agent_factory/adapters/crewai_adapter.py +0 -483
  29. empathy_llm_toolkit/agent_factory/adapters/haystack_adapter.py +0 -298
  30. empathy_llm_toolkit/agent_factory/adapters/langchain_adapter.py +0 -362
  31. empathy_llm_toolkit/agent_factory/adapters/langgraph_adapter.py +0 -333
  32. empathy_llm_toolkit/agent_factory/adapters/native.py +0 -228
  33. empathy_llm_toolkit/agent_factory/adapters/wizard_adapter.py +0 -423
  34. empathy_llm_toolkit/agent_factory/base.py +0 -305
  35. empathy_llm_toolkit/agent_factory/crews/__init__.py +0 -67
  36. empathy_llm_toolkit/agent_factory/crews/code_review.py +0 -1113
  37. empathy_llm_toolkit/agent_factory/crews/health_check.py +0 -1262
  38. empathy_llm_toolkit/agent_factory/crews/refactoring.py +0 -1128
  39. empathy_llm_toolkit/agent_factory/crews/security_audit.py +0 -1018
  40. empathy_llm_toolkit/agent_factory/decorators.py +0 -287
  41. empathy_llm_toolkit/agent_factory/factory.py +0 -558
  42. empathy_llm_toolkit/agent_factory/framework.py +0 -193
  43. empathy_llm_toolkit/agent_factory/memory_integration.py +0 -328
  44. empathy_llm_toolkit/agent_factory/resilient.py +0 -320
  45. empathy_llm_toolkit/agents_md/__init__.py +0 -22
  46. empathy_llm_toolkit/agents_md/loader.py +0 -218
  47. empathy_llm_toolkit/agents_md/parser.py +0 -271
  48. empathy_llm_toolkit/agents_md/registry.py +0 -307
  49. empathy_llm_toolkit/claude_memory.py +0 -466
  50. empathy_llm_toolkit/cli/__init__.py +0 -8
  51. empathy_llm_toolkit/cli/sync_claude.py +0 -487
  52. empathy_llm_toolkit/code_health.py +0 -1313
  53. empathy_llm_toolkit/commands/__init__.py +0 -51
  54. empathy_llm_toolkit/commands/context.py +0 -375
  55. empathy_llm_toolkit/commands/loader.py +0 -301
  56. empathy_llm_toolkit/commands/models.py +0 -231
  57. empathy_llm_toolkit/commands/parser.py +0 -371
  58. empathy_llm_toolkit/commands/registry.py +0 -429
  59. empathy_llm_toolkit/config/__init__.py +0 -29
  60. empathy_llm_toolkit/config/unified.py +0 -291
  61. empathy_llm_toolkit/context/__init__.py +0 -22
  62. empathy_llm_toolkit/context/compaction.py +0 -455
  63. empathy_llm_toolkit/context/manager.py +0 -434
  64. empathy_llm_toolkit/contextual_patterns.py +0 -361
  65. empathy_llm_toolkit/core.py +0 -907
  66. empathy_llm_toolkit/git_pattern_extractor.py +0 -435
  67. empathy_llm_toolkit/hooks/__init__.py +0 -24
  68. empathy_llm_toolkit/hooks/config.py +0 -306
  69. empathy_llm_toolkit/hooks/executor.py +0 -289
  70. empathy_llm_toolkit/hooks/registry.py +0 -302
  71. empathy_llm_toolkit/hooks/scripts/__init__.py +0 -39
  72. empathy_llm_toolkit/hooks/scripts/evaluate_session.py +0 -201
  73. empathy_llm_toolkit/hooks/scripts/first_time_init.py +0 -285
  74. empathy_llm_toolkit/hooks/scripts/pre_compact.py +0 -207
  75. empathy_llm_toolkit/hooks/scripts/session_end.py +0 -183
  76. empathy_llm_toolkit/hooks/scripts/session_start.py +0 -163
  77. empathy_llm_toolkit/hooks/scripts/suggest_compact.py +0 -225
  78. empathy_llm_toolkit/learning/__init__.py +0 -30
  79. empathy_llm_toolkit/learning/evaluator.py +0 -438
  80. empathy_llm_toolkit/learning/extractor.py +0 -514
  81. empathy_llm_toolkit/learning/storage.py +0 -560
  82. empathy_llm_toolkit/levels.py +0 -227
  83. empathy_llm_toolkit/pattern_confidence.py +0 -414
  84. empathy_llm_toolkit/pattern_resolver.py +0 -272
  85. empathy_llm_toolkit/pattern_summary.py +0 -350
  86. empathy_llm_toolkit/providers.py +0 -967
  87. empathy_llm_toolkit/routing/__init__.py +0 -32
  88. empathy_llm_toolkit/routing/model_router.py +0 -362
  89. empathy_llm_toolkit/security/IMPLEMENTATION_SUMMARY.md +0 -413
  90. empathy_llm_toolkit/security/PHASE2_COMPLETE.md +0 -384
  91. empathy_llm_toolkit/security/PHASE2_SECRETS_DETECTOR_COMPLETE.md +0 -271
  92. empathy_llm_toolkit/security/QUICK_REFERENCE.md +0 -316
  93. empathy_llm_toolkit/security/README.md +0 -262
  94. empathy_llm_toolkit/security/__init__.py +0 -62
  95. empathy_llm_toolkit/security/audit_logger.py +0 -929
  96. empathy_llm_toolkit/security/audit_logger_example.py +0 -152
  97. empathy_llm_toolkit/security/pii_scrubber.py +0 -640
  98. empathy_llm_toolkit/security/secrets_detector.py +0 -678
  99. empathy_llm_toolkit/security/secrets_detector_example.py +0 -304
  100. empathy_llm_toolkit/security/secure_memdocs.py +0 -1192
  101. empathy_llm_toolkit/security/secure_memdocs_example.py +0 -278
  102. empathy_llm_toolkit/session_status.py +0 -745
  103. empathy_llm_toolkit/state.py +0 -246
  104. empathy_llm_toolkit/utils/__init__.py +0 -5
  105. empathy_llm_toolkit/utils/tokens.py +0 -349
  106. empathy_os/adaptive/__init__.py +0 -13
  107. empathy_os/adaptive/task_complexity.py +0 -127
  108. empathy_os/agent_monitoring.py +0 -414
  109. empathy_os/cache/__init__.py +0 -117
  110. empathy_os/cache/base.py +0 -166
  111. empathy_os/cache/dependency_manager.py +0 -256
  112. empathy_os/cache/hash_only.py +0 -251
  113. empathy_os/cache/hybrid.py +0 -457
  114. empathy_os/cache/storage.py +0 -285
  115. empathy_os/cache_monitor.py +0 -356
  116. empathy_os/cache_stats.py +0 -298
  117. empathy_os/cli/__init__.py +0 -152
  118. empathy_os/cli/__main__.py +0 -12
  119. empathy_os/cli/commands/__init__.py +0 -1
  120. empathy_os/cli/commands/batch.py +0 -264
  121. empathy_os/cli/commands/cache.py +0 -248
  122. empathy_os/cli/commands/help.py +0 -331
  123. empathy_os/cli/commands/info.py +0 -140
  124. empathy_os/cli/commands/inspect.py +0 -436
  125. empathy_os/cli/commands/inspection.py +0 -57
  126. empathy_os/cli/commands/memory.py +0 -48
  127. empathy_os/cli/commands/metrics.py +0 -92
  128. empathy_os/cli/commands/orchestrate.py +0 -184
  129. empathy_os/cli/commands/patterns.py +0 -207
  130. empathy_os/cli/commands/profiling.py +0 -202
  131. empathy_os/cli/commands/provider.py +0 -98
  132. empathy_os/cli/commands/routing.py +0 -285
  133. empathy_os/cli/commands/setup.py +0 -96
  134. empathy_os/cli/commands/status.py +0 -235
  135. empathy_os/cli/commands/sync.py +0 -166
  136. empathy_os/cli/commands/tier.py +0 -121
  137. empathy_os/cli/commands/utilities.py +0 -114
  138. empathy_os/cli/commands/workflow.py +0 -579
  139. empathy_os/cli/core.py +0 -32
  140. empathy_os/cli/parsers/__init__.py +0 -68
  141. empathy_os/cli/parsers/batch.py +0 -118
  142. empathy_os/cli/parsers/cache.py +0 -65
  143. empathy_os/cli/parsers/help.py +0 -41
  144. empathy_os/cli/parsers/info.py +0 -26
  145. empathy_os/cli/parsers/inspect.py +0 -66
  146. empathy_os/cli/parsers/metrics.py +0 -42
  147. empathy_os/cli/parsers/orchestrate.py +0 -61
  148. empathy_os/cli/parsers/patterns.py +0 -54
  149. empathy_os/cli/parsers/provider.py +0 -40
  150. empathy_os/cli/parsers/routing.py +0 -110
  151. empathy_os/cli/parsers/setup.py +0 -42
  152. empathy_os/cli/parsers/status.py +0 -47
  153. empathy_os/cli/parsers/sync.py +0 -31
  154. empathy_os/cli/parsers/tier.py +0 -33
  155. empathy_os/cli/parsers/workflow.py +0 -77
  156. empathy_os/cli/utils/__init__.py +0 -1
  157. empathy_os/cli/utils/data.py +0 -242
  158. empathy_os/cli/utils/helpers.py +0 -68
  159. empathy_os/cli_legacy.py +0 -3957
  160. empathy_os/cli_minimal.py +0 -1159
  161. empathy_os/cli_router.py +0 -437
  162. empathy_os/cli_unified.py +0 -814
  163. empathy_os/config/__init__.py +0 -66
  164. empathy_os/config/xml_config.py +0 -286
  165. empathy_os/config.py +0 -545
  166. empathy_os/coordination.py +0 -870
  167. empathy_os/core.py +0 -1511
  168. empathy_os/core_modules/__init__.py +0 -15
  169. empathy_os/cost_tracker.py +0 -626
  170. empathy_os/dashboard/__init__.py +0 -41
  171. empathy_os/dashboard/app.py +0 -512
  172. empathy_os/dashboard/simple_server.py +0 -435
  173. empathy_os/dashboard/standalone_server.py +0 -547
  174. empathy_os/discovery.py +0 -306
  175. empathy_os/emergence.py +0 -306
  176. empathy_os/exceptions.py +0 -123
  177. empathy_os/feedback_loops.py +0 -373
  178. empathy_os/hot_reload/README.md +0 -473
  179. empathy_os/hot_reload/__init__.py +0 -62
  180. empathy_os/hot_reload/config.py +0 -83
  181. empathy_os/hot_reload/integration.py +0 -229
  182. empathy_os/hot_reload/reloader.py +0 -298
  183. empathy_os/hot_reload/watcher.py +0 -183
  184. empathy_os/hot_reload/websocket.py +0 -177
  185. empathy_os/levels.py +0 -577
  186. empathy_os/leverage_points.py +0 -441
  187. empathy_os/logging_config.py +0 -261
  188. empathy_os/mcp/__init__.py +0 -10
  189. empathy_os/mcp/server.py +0 -506
  190. empathy_os/memory/__init__.py +0 -237
  191. empathy_os/memory/claude_memory.py +0 -469
  192. empathy_os/memory/config.py +0 -224
  193. empathy_os/memory/control_panel.py +0 -1290
  194. empathy_os/memory/control_panel_support.py +0 -145
  195. empathy_os/memory/cross_session.py +0 -845
  196. empathy_os/memory/edges.py +0 -179
  197. empathy_os/memory/encryption.py +0 -159
  198. empathy_os/memory/file_session.py +0 -770
  199. empathy_os/memory/graph.py +0 -570
  200. empathy_os/memory/long_term.py +0 -913
  201. empathy_os/memory/long_term_types.py +0 -99
  202. empathy_os/memory/mixins/__init__.py +0 -25
  203. empathy_os/memory/mixins/backend_init_mixin.py +0 -249
  204. empathy_os/memory/mixins/capabilities_mixin.py +0 -208
  205. empathy_os/memory/mixins/handoff_mixin.py +0 -208
  206. empathy_os/memory/mixins/lifecycle_mixin.py +0 -49
  207. empathy_os/memory/mixins/long_term_mixin.py +0 -352
  208. empathy_os/memory/mixins/promotion_mixin.py +0 -109
  209. empathy_os/memory/mixins/short_term_mixin.py +0 -182
  210. empathy_os/memory/nodes.py +0 -179
  211. empathy_os/memory/redis_bootstrap.py +0 -540
  212. empathy_os/memory/security/__init__.py +0 -31
  213. empathy_os/memory/security/audit_logger.py +0 -932
  214. empathy_os/memory/security/pii_scrubber.py +0 -640
  215. empathy_os/memory/security/secrets_detector.py +0 -678
  216. empathy_os/memory/short_term.py +0 -2192
  217. empathy_os/memory/simple_storage.py +0 -302
  218. empathy_os/memory/storage/__init__.py +0 -15
  219. empathy_os/memory/storage_backend.py +0 -167
  220. empathy_os/memory/summary_index.py +0 -583
  221. empathy_os/memory/types.py +0 -446
  222. empathy_os/memory/unified.py +0 -182
  223. empathy_os/meta_workflows/__init__.py +0 -74
  224. empathy_os/meta_workflows/agent_creator.py +0 -248
  225. empathy_os/meta_workflows/builtin_templates.py +0 -567
  226. empathy_os/meta_workflows/cli_commands/__init__.py +0 -56
  227. empathy_os/meta_workflows/cli_commands/agent_commands.py +0 -321
  228. empathy_os/meta_workflows/cli_commands/analytics_commands.py +0 -442
  229. empathy_os/meta_workflows/cli_commands/config_commands.py +0 -232
  230. empathy_os/meta_workflows/cli_commands/memory_commands.py +0 -182
  231. empathy_os/meta_workflows/cli_commands/template_commands.py +0 -354
  232. empathy_os/meta_workflows/cli_commands/workflow_commands.py +0 -382
  233. empathy_os/meta_workflows/cli_meta_workflows.py +0 -59
  234. empathy_os/meta_workflows/form_engine.py +0 -292
  235. empathy_os/meta_workflows/intent_detector.py +0 -409
  236. empathy_os/meta_workflows/models.py +0 -569
  237. empathy_os/meta_workflows/pattern_learner.py +0 -738
  238. empathy_os/meta_workflows/plan_generator.py +0 -384
  239. empathy_os/meta_workflows/session_context.py +0 -397
  240. empathy_os/meta_workflows/template_registry.py +0 -229
  241. empathy_os/meta_workflows/workflow.py +0 -984
  242. empathy_os/metrics/__init__.py +0 -12
  243. empathy_os/metrics/collector.py +0 -31
  244. empathy_os/metrics/prompt_metrics.py +0 -194
  245. empathy_os/models/__init__.py +0 -172
  246. empathy_os/models/__main__.py +0 -13
  247. empathy_os/models/adaptive_routing.py +0 -437
  248. empathy_os/models/auth_cli.py +0 -444
  249. empathy_os/models/auth_strategy.py +0 -450
  250. empathy_os/models/cli.py +0 -655
  251. empathy_os/models/empathy_executor.py +0 -354
  252. empathy_os/models/executor.py +0 -257
  253. empathy_os/models/fallback.py +0 -762
  254. empathy_os/models/provider_config.py +0 -282
  255. empathy_os/models/registry.py +0 -472
  256. empathy_os/models/tasks.py +0 -359
  257. empathy_os/models/telemetry/__init__.py +0 -71
  258. empathy_os/models/telemetry/analytics.py +0 -594
  259. empathy_os/models/telemetry/backend.py +0 -196
  260. empathy_os/models/telemetry/data_models.py +0 -431
  261. empathy_os/models/telemetry/storage.py +0 -489
  262. empathy_os/models/token_estimator.py +0 -420
  263. empathy_os/models/validation.py +0 -280
  264. empathy_os/monitoring/__init__.py +0 -52
  265. empathy_os/monitoring/alerts.py +0 -946
  266. empathy_os/monitoring/alerts_cli.py +0 -448
  267. empathy_os/monitoring/multi_backend.py +0 -271
  268. empathy_os/monitoring/otel_backend.py +0 -362
  269. empathy_os/optimization/__init__.py +0 -19
  270. empathy_os/optimization/context_optimizer.py +0 -272
  271. empathy_os/orchestration/__init__.py +0 -67
  272. empathy_os/orchestration/agent_templates.py +0 -707
  273. empathy_os/orchestration/config_store.py +0 -499
  274. empathy_os/orchestration/execution_strategies.py +0 -2111
  275. empathy_os/orchestration/meta_orchestrator.py +0 -1168
  276. empathy_os/orchestration/pattern_learner.py +0 -696
  277. empathy_os/orchestration/real_tools.py +0 -931
  278. empathy_os/pattern_cache.py +0 -187
  279. empathy_os/pattern_library.py +0 -542
  280. empathy_os/patterns/debugging/all_patterns.json +0 -81
  281. empathy_os/patterns/debugging/workflow_20260107_1770825e.json +0 -77
  282. empathy_os/patterns/refactoring_memory.json +0 -89
  283. empathy_os/persistence.py +0 -564
  284. empathy_os/platform_utils.py +0 -265
  285. empathy_os/plugins/__init__.py +0 -28
  286. empathy_os/plugins/base.py +0 -361
  287. empathy_os/plugins/registry.py +0 -268
  288. empathy_os/project_index/__init__.py +0 -32
  289. empathy_os/project_index/cli.py +0 -335
  290. empathy_os/project_index/index.py +0 -667
  291. empathy_os/project_index/models.py +0 -504
  292. empathy_os/project_index/reports.py +0 -474
  293. empathy_os/project_index/scanner.py +0 -777
  294. empathy_os/project_index/scanner_parallel.py +0 -291
  295. empathy_os/prompts/__init__.py +0 -61
  296. empathy_os/prompts/config.py +0 -77
  297. empathy_os/prompts/context.py +0 -177
  298. empathy_os/prompts/parser.py +0 -285
  299. empathy_os/prompts/registry.py +0 -313
  300. empathy_os/prompts/templates.py +0 -208
  301. empathy_os/redis_config.py +0 -302
  302. empathy_os/redis_memory.py +0 -799
  303. empathy_os/resilience/__init__.py +0 -56
  304. empathy_os/resilience/circuit_breaker.py +0 -256
  305. empathy_os/resilience/fallback.py +0 -179
  306. empathy_os/resilience/health.py +0 -300
  307. empathy_os/resilience/retry.py +0 -209
  308. empathy_os/resilience/timeout.py +0 -135
  309. empathy_os/routing/__init__.py +0 -43
  310. empathy_os/routing/chain_executor.py +0 -433
  311. empathy_os/routing/classifier.py +0 -217
  312. empathy_os/routing/smart_router.py +0 -234
  313. empathy_os/routing/workflow_registry.py +0 -343
  314. empathy_os/scaffolding/README.md +0 -589
  315. empathy_os/scaffolding/__init__.py +0 -35
  316. empathy_os/scaffolding/__main__.py +0 -14
  317. empathy_os/scaffolding/cli.py +0 -240
  318. empathy_os/socratic/__init__.py +0 -256
  319. empathy_os/socratic/ab_testing.py +0 -958
  320. empathy_os/socratic/blueprint.py +0 -533
  321. empathy_os/socratic/cli.py +0 -703
  322. empathy_os/socratic/collaboration.py +0 -1114
  323. empathy_os/socratic/domain_templates.py +0 -924
  324. empathy_os/socratic/embeddings.py +0 -738
  325. empathy_os/socratic/engine.py +0 -794
  326. empathy_os/socratic/explainer.py +0 -682
  327. empathy_os/socratic/feedback.py +0 -772
  328. empathy_os/socratic/forms.py +0 -629
  329. empathy_os/socratic/generator.py +0 -732
  330. empathy_os/socratic/llm_analyzer.py +0 -637
  331. empathy_os/socratic/mcp_server.py +0 -702
  332. empathy_os/socratic/session.py +0 -312
  333. empathy_os/socratic/storage.py +0 -667
  334. empathy_os/socratic/success.py +0 -730
  335. empathy_os/socratic/visual_editor.py +0 -860
  336. empathy_os/socratic/web_ui.py +0 -958
  337. empathy_os/telemetry/__init__.py +0 -39
  338. empathy_os/telemetry/agent_coordination.py +0 -475
  339. empathy_os/telemetry/agent_tracking.py +0 -367
  340. empathy_os/telemetry/approval_gates.py +0 -545
  341. empathy_os/telemetry/cli.py +0 -1231
  342. empathy_os/telemetry/commands/__init__.py +0 -14
  343. empathy_os/telemetry/commands/dashboard_commands.py +0 -696
  344. empathy_os/telemetry/event_streaming.py +0 -409
  345. empathy_os/telemetry/feedback_loop.py +0 -567
  346. empathy_os/telemetry/usage_tracker.py +0 -591
  347. empathy_os/templates.py +0 -754
  348. empathy_os/test_generator/__init__.py +0 -38
  349. empathy_os/test_generator/__main__.py +0 -14
  350. empathy_os/test_generator/cli.py +0 -234
  351. empathy_os/test_generator/generator.py +0 -355
  352. empathy_os/test_generator/risk_analyzer.py +0 -216
  353. empathy_os/tier_recommender.py +0 -384
  354. empathy_os/tools.py +0 -183
  355. empathy_os/trust/__init__.py +0 -28
  356. empathy_os/trust/circuit_breaker.py +0 -579
  357. empathy_os/trust_building.py +0 -527
  358. empathy_os/validation/__init__.py +0 -19
  359. empathy_os/validation/xml_validator.py +0 -281
  360. empathy_os/vscode_bridge.py +0 -173
  361. empathy_os/workflow_commands.py +0 -780
  362. empathy_os/workflow_patterns/__init__.py +0 -33
  363. empathy_os/workflow_patterns/behavior.py +0 -249
  364. empathy_os/workflow_patterns/core.py +0 -76
  365. empathy_os/workflow_patterns/output.py +0 -99
  366. empathy_os/workflow_patterns/registry.py +0 -255
  367. empathy_os/workflow_patterns/structural.py +0 -288
  368. empathy_os/workflows/__init__.py +0 -539
  369. empathy_os/workflows/autonomous_test_gen.py +0 -1268
  370. empathy_os/workflows/base.py +0 -2667
  371. empathy_os/workflows/batch_processing.py +0 -342
  372. empathy_os/workflows/bug_predict.py +0 -1084
  373. empathy_os/workflows/builder.py +0 -273
  374. empathy_os/workflows/caching.py +0 -253
  375. empathy_os/workflows/code_review.py +0 -1048
  376. empathy_os/workflows/code_review_adapters.py +0 -312
  377. empathy_os/workflows/code_review_pipeline.py +0 -722
  378. empathy_os/workflows/config.py +0 -645
  379. empathy_os/workflows/dependency_check.py +0 -644
  380. empathy_os/workflows/document_gen/__init__.py +0 -25
  381. empathy_os/workflows/document_gen/config.py +0 -30
  382. empathy_os/workflows/document_gen/report_formatter.py +0 -162
  383. empathy_os/workflows/document_gen/workflow.py +0 -1426
  384. empathy_os/workflows/document_manager.py +0 -216
  385. empathy_os/workflows/document_manager_README.md +0 -134
  386. empathy_os/workflows/documentation_orchestrator.py +0 -1205
  387. empathy_os/workflows/history.py +0 -510
  388. empathy_os/workflows/keyboard_shortcuts/__init__.py +0 -39
  389. empathy_os/workflows/keyboard_shortcuts/generators.py +0 -391
  390. empathy_os/workflows/keyboard_shortcuts/parsers.py +0 -416
  391. empathy_os/workflows/keyboard_shortcuts/prompts.py +0 -295
  392. empathy_os/workflows/keyboard_shortcuts/schema.py +0 -193
  393. empathy_os/workflows/keyboard_shortcuts/workflow.py +0 -509
  394. empathy_os/workflows/llm_base.py +0 -363
  395. empathy_os/workflows/manage_docs.py +0 -87
  396. empathy_os/workflows/manage_docs_README.md +0 -134
  397. empathy_os/workflows/manage_documentation.py +0 -821
  398. empathy_os/workflows/new_sample_workflow1.py +0 -149
  399. empathy_os/workflows/new_sample_workflow1_README.md +0 -150
  400. empathy_os/workflows/orchestrated_health_check.py +0 -849
  401. empathy_os/workflows/orchestrated_release_prep.py +0 -600
  402. empathy_os/workflows/output.py +0 -413
  403. empathy_os/workflows/perf_audit.py +0 -863
  404. empathy_os/workflows/pr_review.py +0 -762
  405. empathy_os/workflows/progress.py +0 -785
  406. empathy_os/workflows/progress_server.py +0 -322
  407. empathy_os/workflows/progressive/README 2.md +0 -454
  408. empathy_os/workflows/progressive/README.md +0 -454
  409. empathy_os/workflows/progressive/__init__.py +0 -82
  410. empathy_os/workflows/progressive/cli.py +0 -219
  411. empathy_os/workflows/progressive/core.py +0 -488
  412. empathy_os/workflows/progressive/orchestrator.py +0 -723
  413. empathy_os/workflows/progressive/reports.py +0 -520
  414. empathy_os/workflows/progressive/telemetry.py +0 -274
  415. empathy_os/workflows/progressive/test_gen.py +0 -495
  416. empathy_os/workflows/progressive/workflow.py +0 -589
  417. empathy_os/workflows/refactor_plan.py +0 -694
  418. empathy_os/workflows/release_prep.py +0 -895
  419. empathy_os/workflows/release_prep_crew.py +0 -969
  420. empathy_os/workflows/research_synthesis.py +0 -404
  421. empathy_os/workflows/routing.py +0 -168
  422. empathy_os/workflows/secure_release.py +0 -593
  423. empathy_os/workflows/security_adapters.py +0 -297
  424. empathy_os/workflows/security_audit.py +0 -1329
  425. empathy_os/workflows/security_audit_phase3.py +0 -355
  426. empathy_os/workflows/seo_optimization.py +0 -633
  427. empathy_os/workflows/step_config.py +0 -234
  428. empathy_os/workflows/telemetry_mixin.py +0 -269
  429. empathy_os/workflows/test5.py +0 -125
  430. empathy_os/workflows/test5_README.md +0 -158
  431. empathy_os/workflows/test_coverage_boost_crew.py +0 -849
  432. empathy_os/workflows/test_gen/__init__.py +0 -52
  433. empathy_os/workflows/test_gen/ast_analyzer.py +0 -249
  434. empathy_os/workflows/test_gen/config.py +0 -88
  435. empathy_os/workflows/test_gen/data_models.py +0 -38
  436. empathy_os/workflows/test_gen/report_formatter.py +0 -289
  437. empathy_os/workflows/test_gen/test_templates.py +0 -381
  438. empathy_os/workflows/test_gen/workflow.py +0 -655
  439. empathy_os/workflows/test_gen.py +0 -54
  440. empathy_os/workflows/test_gen_behavioral.py +0 -477
  441. empathy_os/workflows/test_gen_parallel.py +0 -341
  442. empathy_os/workflows/test_lifecycle.py +0 -526
  443. empathy_os/workflows/test_maintenance.py +0 -627
  444. empathy_os/workflows/test_maintenance_cli.py +0 -590
  445. empathy_os/workflows/test_maintenance_crew.py +0 -840
  446. empathy_os/workflows/test_runner.py +0 -622
  447. empathy_os/workflows/tier_tracking.py +0 -531
  448. empathy_os/workflows/xml_enhanced_crew.py +0 -285
  449. empathy_software_plugin/SOFTWARE_PLUGIN_README.md +0 -57
  450. empathy_software_plugin/cli/__init__.py +0 -120
  451. empathy_software_plugin/cli/inspect.py +0 -362
  452. empathy_software_plugin/cli.py +0 -574
  453. empathy_software_plugin/plugin.py +0 -188
  454. workflow_scaffolding/__init__.py +0 -11
  455. workflow_scaffolding/__main__.py +0 -12
  456. workflow_scaffolding/cli.py +0 -206
  457. workflow_scaffolding/generator.py +0 -265
  458. {empathy_framework-5.3.0.dist-info → empathy_framework-5.4.0.dist-info}/WHEEL +0 -0
@@ -1,969 +0,0 @@
1
- """Release Preparation Crew - Multi-Agent Workflow
2
-
3
- .. deprecated:: 4.3.0
4
- This workflow is deprecated in favor of the meta-workflow system.
5
- Use ``empathy meta-workflow run release-prep`` instead.
6
- See docs/CREWAI_MIGRATION.md for migration guide.
7
-
8
- Comprehensive release readiness assessment using a multi-agent crew.
9
-
10
- Pattern: Crew
11
- - Multiple specialized AI agents collaborate on the task
12
- - Process Type: parallel (agents run simultaneously)
13
- - Agents: 4
14
-
15
- Agents:
16
- - Security Agent: Vulnerability scanning and security audit
17
- - Testing Agent: Test coverage analysis and quality validation
18
- - Quality Agent: Code quality review and best practices check
19
- - Documentation Agent: Documentation completeness verification
20
-
21
- Copyright 2025 Smart-AI-Memory
22
- Licensed under Fair Source License 0.9
23
- """
24
-
25
- import asyncio
26
- import os
27
- import warnings
28
- from dataclasses import dataclass, field
29
- from datetime import datetime
30
- from typing import Any
31
-
32
- # Try to import the LLM executor for actual AI calls
33
- EmpathyLLMExecutor = None
34
- ExecutionContext = None
35
- HAS_EXECUTOR = False
36
-
37
- try:
38
- from empathy_os.models import ExecutionContext as _ExecutionContext
39
- from empathy_os.models.empathy_executor import EmpathyLLMExecutor as _EmpathyLLMExecutor
40
-
41
- EmpathyLLMExecutor = _EmpathyLLMExecutor
42
- ExecutionContext = _ExecutionContext
43
- HAS_EXECUTOR = True
44
- except ImportError:
45
- pass
46
-
47
- # Try to import the ProjectIndex for file tracking
48
- ProjectIndex = None
49
- HAS_PROJECT_INDEX = False
50
-
51
- try:
52
- from empathy_os.project_index import ProjectIndex as _ProjectIndex
53
-
54
- ProjectIndex = _ProjectIndex
55
- HAS_PROJECT_INDEX = True
56
- except ImportError:
57
- pass
58
-
59
-
60
- @dataclass
61
- class QualityGate:
62
- """Quality gate threshold for release readiness."""
63
-
64
- name: str
65
- threshold: float
66
- actual: float = 0.0
67
- passed: bool = False
68
- critical: bool = True
69
- message: str = ""
70
-
71
- def __post_init__(self):
72
- """Generate message if not provided."""
73
- if not self.message:
74
- status = "✅ PASS" if self.passed else "❌ FAIL"
75
- self.message = (
76
- f"{self.name}: {status} "
77
- f"(actual: {self.actual:.1f}, threshold: {self.threshold:.1f})"
78
- )
79
-
80
-
81
- @dataclass
82
- class ReleasePreparationCrewResult:
83
- """Result from ReleasePreparationCrew execution."""
84
-
85
- success: bool
86
- approved: bool # Overall release approval
87
- confidence: str # "high", "medium", "low"
88
-
89
- # Quality gates
90
- quality_gates: list[QualityGate] = field(default_factory=list)
91
-
92
- # Agent findings
93
- security_findings: dict = field(default_factory=dict)
94
- testing_findings: dict = field(default_factory=dict)
95
- quality_findings: dict = field(default_factory=dict)
96
- documentation_findings: dict = field(default_factory=dict)
97
-
98
- # Aggregate metrics
99
- blockers: list[str] = field(default_factory=list)
100
- warnings: list[str] = field(default_factory=list)
101
- recommendations: list[str] = field(default_factory=list)
102
-
103
- # Cost tracking
104
- cost: float = 0.0
105
- duration_ms: int = 0
106
- timestamp: str = field(default_factory=lambda: datetime.now().isoformat())
107
-
108
- def to_dict(self) -> dict:
109
- """Convert result to dictionary."""
110
- return {
111
- "success": self.success,
112
- "approved": self.approved,
113
- "confidence": self.confidence,
114
- "quality_gates": [
115
- {
116
- "name": gate.name,
117
- "threshold": gate.threshold,
118
- "actual": gate.actual,
119
- "passed": gate.passed,
120
- "critical": gate.critical,
121
- "message": gate.message,
122
- }
123
- for gate in self.quality_gates
124
- ],
125
- "security_findings": self.security_findings,
126
- "testing_findings": self.testing_findings,
127
- "quality_findings": self.quality_findings,
128
- "documentation_findings": self.documentation_findings,
129
- "blockers": self.blockers,
130
- "warnings": self.warnings,
131
- "recommendations": self.recommendations,
132
- "cost": self.cost,
133
- "duration_ms": self.duration_ms,
134
- "timestamp": self.timestamp,
135
- }
136
-
137
- @property
138
- def formatted_report(self) -> str:
139
- """Generate human-readable formatted report."""
140
- return format_release_prep_report(self)
141
-
142
-
143
- @dataclass
144
- class Agent:
145
- """Agent configuration for the crew with XML-enhanced prompting."""
146
-
147
- role: str
148
- goal: str
149
- backstory: str
150
- expertise_level: str = "expert"
151
- use_xml_structure: bool = True
152
-
153
- def get_system_prompt(self) -> str:
154
- """Generate XML-enhanced system prompt for this agent."""
155
- return f"""<agent_role>
156
- You are a {self.role} with {self.expertise_level}-level expertise.
157
- </agent_role>
158
-
159
- <agent_goal>
160
- {self.goal}
161
- </agent_goal>
162
-
163
- <agent_backstory>
164
- {self.backstory}
165
- </agent_backstory>
166
-
167
- <instructions>
168
- 1. Carefully review all provided context data
169
- 2. Think through your analysis step-by-step
170
- 3. Provide thorough, actionable analysis
171
- 4. Be specific and cite file paths when relevant
172
- 5. Structure your output according to the requested format
173
- </instructions>
174
-
175
- <output_structure>
176
- Always structure your response as:
177
-
178
- <thinking>
179
- [Your step-by-step reasoning process]
180
- - What you observe in the context
181
- - How you analyze the situation
182
- - What conclusions you draw
183
- </thinking>
184
-
185
- <answer>
186
- [Your final output in the requested format]
187
- </answer>
188
- </output_structure>"""
189
-
190
-
191
- @dataclass
192
- class Task:
193
- """Task configuration for the crew with XML-enhanced prompting."""
194
-
195
- description: str
196
- expected_output: str
197
- agent: Agent
198
-
199
- def get_user_prompt(self, context: dict) -> str:
200
- """Generate XML-enhanced user prompt for this task with context."""
201
- # Build structured context with proper XML tags
202
- context_sections = []
203
- for key, value in context.items():
204
- if value:
205
- # Use underscores for tag names
206
- tag_name = key.replace(" ", "_").replace("-", "_").lower()
207
- # Wrap in appropriate tags
208
- context_sections.append(f"<{tag_name}>\n{value}\n</{tag_name}>")
209
-
210
- context_xml = "\n".join(context_sections)
211
-
212
- return f"""<task_description>
213
- {self.description}
214
- </task_description>
215
-
216
- <context>
217
- {context_xml}
218
- </context>
219
-
220
- <expected_output>
221
- {self.expected_output}
222
- </expected_output>
223
-
224
- <instructions>
225
- 1. Review all context data in the <context> tags above
226
- 2. Structure your response using <thinking> and <answer> tags as defined in your system prompt
227
- 3. Match the expected output format exactly
228
- 4. Be thorough and specific in your analysis
229
- </instructions>"""
230
-
231
-
232
- def parse_xml_response(response: str) -> dict:
233
- """Parse XML-structured agent response.
234
-
235
- Args:
236
- response: Raw agent response potentially containing XML tags
237
-
238
- Returns:
239
- Dict with 'thinking' and 'answer' sections (if found) or raw response
240
- """
241
- result = {
242
- "thinking": "",
243
- "answer": "",
244
- "raw": response,
245
- "has_xml_structure": False,
246
- }
247
-
248
- # Try to extract thinking section
249
- thinking_start = response.find("<thinking>")
250
- thinking_end = response.find("</thinking>")
251
- if thinking_start != -1 and thinking_end != -1:
252
- result["thinking"] = response[thinking_start + 10 : thinking_end].strip()
253
- result["has_xml_structure"] = True
254
-
255
- # Try to extract answer section
256
- answer_start = response.find("<answer>")
257
- answer_end = response.find("</answer>")
258
- if answer_start != -1 and answer_end != -1:
259
- result["answer"] = response[answer_start + 8 : answer_end].strip()
260
- result["has_xml_structure"] = True
261
-
262
- # If no XML structure found, use full response as answer
263
- if not result["has_xml_structure"]:
264
- result["answer"] = response
265
-
266
- return result
267
-
268
-
269
- def format_release_prep_report(result: ReleasePreparationCrewResult) -> str:
270
- """Format release preparation result as human-readable text."""
271
- lines = []
272
-
273
- # Header
274
- lines.append("=" * 70)
275
- lines.append("RELEASE READINESS REPORT (CrewAI Multi-Agent)")
276
- lines.append("=" * 70)
277
- lines.append("")
278
-
279
- # Status
280
- status_icon = "✅" if result.approved else "❌"
281
- status_text = "APPROVED FOR RELEASE" if result.approved else "NOT READY FOR RELEASE"
282
- lines.append(f"Status: {status_icon} {status_text}")
283
- lines.append(f"Confidence: {result.confidence.upper()}")
284
- lines.append(f"Generated: {result.timestamp}")
285
- lines.append(f"Duration: {result.duration_ms}ms ({result.duration_ms / 1000:.1f}s)")
286
- lines.append(f"Cost: ${result.cost:.4f}")
287
- lines.append("")
288
-
289
- # Quality Gates
290
- if result.quality_gates:
291
- lines.append("-" * 70)
292
- lines.append("QUALITY GATES")
293
- lines.append("-" * 70)
294
- for gate in result.quality_gates:
295
- icon = "✅" if gate.passed else ("🔴" if gate.critical else "⚠️")
296
- lines.append(f"{icon} {gate.message}")
297
- lines.append("")
298
-
299
- # Blockers
300
- if result.blockers:
301
- lines.append("-" * 70)
302
- lines.append("🚫 RELEASE BLOCKERS")
303
- lines.append("-" * 70)
304
- for blocker in result.blockers:
305
- lines.append(f" • {blocker}")
306
- lines.append("")
307
-
308
- # Warnings
309
- if result.warnings:
310
- lines.append("-" * 70)
311
- lines.append("⚠️ WARNINGS")
312
- lines.append("-" * 70)
313
- for warning in result.warnings:
314
- lines.append(f" • {warning}")
315
- lines.append("")
316
-
317
- # Recommendations
318
- if result.recommendations:
319
- lines.append("-" * 70)
320
- lines.append("💡 RECOMMENDATIONS")
321
- lines.append("-" * 70)
322
- for i, rec in enumerate(result.recommendations, 1):
323
- lines.append(f"{i}. {rec}")
324
- lines.append("")
325
-
326
- # Agent Findings Summary
327
- lines.append("-" * 70)
328
- lines.append("AGENT FINDINGS")
329
- lines.append("-" * 70)
330
-
331
- if result.security_findings:
332
- lines.append("\n🔒 Security Agent:")
333
- lines.append(f" {result.security_findings.get('summary', 'No summary available')}")
334
-
335
- if result.testing_findings:
336
- lines.append("\n🧪 Testing Agent:")
337
- lines.append(f" {result.testing_findings.get('summary', 'No summary available')}")
338
-
339
- if result.quality_findings:
340
- lines.append("\n⚡ Quality Agent:")
341
- lines.append(f" {result.quality_findings.get('summary', 'No summary available')}")
342
-
343
- if result.documentation_findings:
344
- lines.append("\n📝 Documentation Agent:")
345
- lines.append(f" {result.documentation_findings.get('summary', 'No summary available')}")
346
-
347
- lines.append("")
348
-
349
- # Footer
350
- lines.append("=" * 70)
351
- if result.approved:
352
- lines.append("✅ Release preparation complete - ready to ship")
353
- else:
354
- lines.append("❌ Release blocked - address issues above before shipping")
355
- lines.append("=" * 70)
356
-
357
- return "\n".join(lines)
358
-
359
-
360
- class ReleasePreparationCrew:
361
- """Release Preparation Crew - Multi-agent release readiness assessment.
362
-
363
- Uses 4 specialized agents running in parallel to comprehensively
364
- evaluate release readiness across security, testing, quality, and documentation.
365
-
366
- Process Type: parallel
367
-
368
- Agents:
369
- - Security Agent: Vulnerability scanning and security audit
370
- - Testing Agent: Test coverage analysis and quality validation
371
- - Quality Agent: Code quality review and best practices check
372
- - Documentation Agent: Documentation completeness verification
373
-
374
- Usage:
375
- crew = ReleasePreparationCrew()
376
- result = await crew.execute(path="./src")
377
-
378
- if result.approved:
379
- print("✅ Ready for release!")
380
- else:
381
- for blocker in result.blockers:
382
- print(f"BLOCKER: {blocker}")
383
- """
384
-
385
- name = "Release_Preparation_Crew"
386
- description = "Comprehensive release readiness assessment using multi-agent crew"
387
- process_type = "parallel"
388
-
389
- def __init__(
390
- self, project_root: str = ".", quality_gates: dict[str, float] | None = None, **kwargs: Any
391
- ):
392
- """Initialize the crew with configured agents.
393
-
394
- .. deprecated:: 4.3.0
395
- Use meta-workflow system instead: ``empathy meta-workflow run release-prep``
396
-
397
- Args:
398
- project_root: Root directory of project to analyze
399
- quality_gates: Optional quality gate thresholds
400
- - security: 0 critical issues (default)
401
- - coverage: 80% test coverage (default)
402
- - quality: 7.0 quality score (default)
403
- - documentation: 100% doc coverage (default)
404
- **kwargs: Additional configuration
405
- """
406
- warnings.warn(
407
- "ReleasePreparationCrew is deprecated since v4.3.0. "
408
- "Use meta-workflow system instead: empathy meta-workflow run release-prep. "
409
- "See docs/CREWAI_MIGRATION.md for migration guide.",
410
- DeprecationWarning,
411
- stacklevel=2,
412
- )
413
- self.config = kwargs
414
- self.project_root = project_root
415
- self._executor = None
416
- self._project_index = None
417
- self._total_cost = 0.0
418
- self._total_input_tokens = 0
419
- self._total_output_tokens = 0
420
-
421
- # Set default quality gates
422
- self.quality_gates = {
423
- "security": 0.0, # No critical issues
424
- "coverage": 80.0, # 80% test coverage
425
- "quality": 7.0, # Quality score ≥ 7
426
- "documentation": 100.0, # 100% doc coverage
427
- }
428
- if quality_gates:
429
- self.quality_gates.update(quality_gates)
430
-
431
- # Initialize executor if available
432
- if HAS_EXECUTOR and EmpathyLLMExecutor is not None:
433
- api_key = os.getenv("ANTHROPIC_API_KEY")
434
- if api_key:
435
- try:
436
- self._executor = EmpathyLLMExecutor(
437
- provider="anthropic",
438
- api_key=api_key,
439
- )
440
- except Exception:
441
- pass
442
-
443
- # Initialize ProjectIndex if available
444
- if HAS_PROJECT_INDEX and ProjectIndex is not None:
445
- try:
446
- self._project_index = ProjectIndex(project_root)
447
- if not self._project_index.load():
448
- # Index doesn't exist or is stale, refresh it
449
- print(" [ProjectIndex] Building index (first run)...")
450
- self._project_index.refresh()
451
- except Exception as e:
452
- print(f" [ProjectIndex] Warning: Could not load index: {e}")
453
-
454
- # Define agents
455
- self.security_agent = Agent(
456
- role="Security Auditor",
457
- goal="Perform comprehensive security audit and vulnerability scan",
458
- backstory="Expert security auditor specializing in OWASP Top 10 vulnerabilities, dependency security, and security best practices. Skilled at identifying critical security issues that would block release.",
459
- expertise_level="expert",
460
- )
461
-
462
- self.testing_agent = Agent(
463
- role="Test Coverage Analyst",
464
- goal="Analyze test coverage and validate testing quality",
465
- backstory="Testing expert focused on test coverage metrics, test quality, and identifying critical gaps. Ensures adequate testing before release.",
466
- expertise_level="expert",
467
- )
468
-
469
- self.quality_agent = Agent(
470
- role="Code Quality Reviewer",
471
- goal="Review code quality and adherence to best practices",
472
- backstory="Senior code reviewer focused on code maintainability, complexity, and best practices. Identifies code quality issues that impact long-term project health.",
473
- expertise_level="expert",
474
- )
475
-
476
- self.documentation_agent = Agent(
477
- role="Documentation Specialist",
478
- goal="Verify documentation completeness and accuracy",
479
- backstory="Technical writer and documentation expert. Ensures all code is properly documented, README is up-to-date, and API docs are complete.",
480
- expertise_level="expert",
481
- )
482
-
483
- # Store all agents
484
- self.agents = [
485
- self.security_agent,
486
- self.testing_agent,
487
- self.quality_agent,
488
- self.documentation_agent,
489
- ]
490
-
491
- def define_tasks(self) -> list[Task]:
492
- """Define the tasks for this crew."""
493
- return [
494
- Task(
495
- description=f"Perform security audit: 1) Scan for OWASP Top 10 vulnerabilities, 2) Check dependency security, 3) Review authentication/authorization, 4) Identify critical security issues. Quality gate: ≤{self.quality_gates['security']} critical issues",
496
- expected_output="JSON with: critical_issues_count, high_issues_count, findings (list of issues with severity/details), recommendation (GO/NO_GO)",
497
- agent=self.security_agent,
498
- ),
499
- Task(
500
- description=f"Analyze test coverage: 1) Calculate current test coverage percentage, 2) Identify critical gaps in coverage, 3) Assess test quality, 4) Verify tests pass. Quality gate: ≥{self.quality_gates['coverage']}% coverage",
501
- expected_output="JSON with: coverage_percentage, critical_gaps_count, tests_passing (true/false), recommendation (GO/NO_GO)",
502
- agent=self.testing_agent,
503
- ),
504
- Task(
505
- description=f"Review code quality: 1) Calculate code quality score (0-10), 2) Check for code smells and anti-patterns, 3) Verify linting passes, 4) Assess maintainability. Quality gate: ≥{self.quality_gates['quality']} quality score",
506
- expected_output="JSON with: quality_score, complexity_issues, linting_errors, recommendation (GO/NO_GO)",
507
- agent=self.quality_agent,
508
- ),
509
- Task(
510
- description=f"Verify documentation: 1) Check docstring coverage, 2) Verify README is current, 3) Validate API documentation, 4) Check for missing docs. Quality gate: ≥{self.quality_gates['documentation']}% doc coverage",
511
- expected_output="JSON with: docstring_coverage_percentage, readme_current (true/false), missing_docs_count, recommendation (GO/NO_GO)",
512
- agent=self.documentation_agent,
513
- ),
514
- ]
515
-
516
- async def _call_llm(
517
- self,
518
- agent: Agent,
519
- task: Task,
520
- context: dict,
521
- task_type: str = "release_validation",
522
- ) -> tuple[str, int, int, float]:
523
- """Call the LLM with agent/task configuration.
524
-
525
- Returns: (response_text, input_tokens, output_tokens, cost)
526
- """
527
- system_prompt = agent.get_system_prompt()
528
- user_prompt = task.get_user_prompt(context)
529
-
530
- if self._executor is None:
531
- # Fallback: return mock response
532
- return await self._mock_llm_call(agent, task)
533
-
534
- try:
535
- # Create execution context
536
- exec_context = ExecutionContext(
537
- task_type=task_type,
538
- workflow_name="release-prep",
539
- step_name=agent.role,
540
- )
541
-
542
- # Execute with timeout using correct LLMExecutor API
543
- result = await asyncio.wait_for(
544
- self._executor.run(
545
- task_type=task_type,
546
- prompt=user_prompt,
547
- system=system_prompt,
548
- context=exec_context,
549
- ),
550
- timeout=120.0, # 2 minute timeout
551
- )
552
-
553
- response = result.content
554
- input_tokens = result.input_tokens
555
- output_tokens = result.output_tokens
556
- cost = result.cost
557
-
558
- # Track totals
559
- self._total_cost += cost
560
- self._total_input_tokens += input_tokens
561
- self._total_output_tokens += output_tokens
562
-
563
- return (response, input_tokens, output_tokens, cost)
564
-
565
- except asyncio.TimeoutError:
566
- print(f" [LLM] Timeout calling {agent.role}")
567
- return await self._mock_llm_call(agent, task, reason="Timeout")
568
- except Exception as e:
569
- print(f" [LLM] Error calling {agent.role}: {e}")
570
- return await self._mock_llm_call(agent, task, reason=str(e))
571
-
572
- async def _mock_llm_call(
573
- self, agent: Agent, task: Task, reason: str = "No API key"
574
- ) -> tuple[str, int, int, float]:
575
- """Generate mock response when LLM is unavailable."""
576
- # Simulate brief delay
577
- await asyncio.sleep(0.1)
578
-
579
- mock_findings = {
580
- "Security Auditor": f"""[Mock Security Audit - {reason}]
581
-
582
- <thinking>
583
- Performing security audit of the codebase...
584
- - Scanning for OWASP Top 10 vulnerabilities
585
- - Checking dependency versions
586
- - Reviewing authentication mechanisms
587
- </thinking>
588
-
589
- <answer>
590
- {{
591
- "critical_issues_count": 0,
592
- "high_issues_count": 2,
593
- "findings": [
594
- {{"severity": "high", "details": "Outdated dependency: requests 2.25.0 (CVE-2024-XXXX)"}},
595
- {{"severity": "medium", "details": "Missing rate limiting on API endpoints"}}
596
- ],
597
- "recommendation": "GO (no critical blockers, address high issues post-release)"
598
- }}
599
- </answer>
600
-
601
- Note: This is a mock response. Configure ANTHROPIC_API_KEY for real analysis.""",
602
- "Test Coverage Analyst": f"""[Mock Coverage Analysis - {reason}]
603
-
604
- <thinking>
605
- Analyzing test coverage across the codebase...
606
- - Running coverage tools
607
- - Identifying critical gaps
608
- - Verifying tests pass
609
- </thinking>
610
-
611
- <answer>
612
- {{
613
- "coverage_percentage": 75.5,
614
- "critical_gaps_count": 3,
615
- "tests_passing": true,
616
- "recommendation": "NO_GO (coverage below 80% threshold)"
617
- }}
618
- </answer>
619
-
620
- Note: This is a mock response. Configure ANTHROPIC_API_KEY for real analysis.""",
621
- "Code Quality Reviewer": f"""[Mock Quality Review - {reason}]
622
-
623
- <thinking>
624
- Reviewing code quality metrics...
625
- - Calculating complexity scores
626
- - Checking linting status
627
- - Assessing maintainability
628
- </thinking>
629
-
630
- <answer>
631
- {{
632
- "quality_score": 8.2,
633
- "complexity_issues": 2,
634
- "linting_errors": 0,
635
- "recommendation": "GO (quality score above threshold)"
636
- }}
637
- </answer>
638
-
639
- Note: This is a mock response. Configure ANTHROPIC_API_KEY for real analysis.""",
640
- "Documentation Specialist": f"""[Mock Documentation Check - {reason}]
641
-
642
- <thinking>
643
- Verifying documentation completeness...
644
- - Checking docstring coverage
645
- - Reviewing README currency
646
- - Validating API docs
647
- </thinking>
648
-
649
- <answer>
650
- {{
651
- "docstring_coverage_percentage": 92.0,
652
- "readme_current": false,
653
- "missing_docs_count": 5,
654
- "recommendation": "CONDITIONAL (README needs update)"
655
- }}
656
- </answer>
657
-
658
- Note: This is a mock response. Configure ANTHROPIC_API_KEY for real analysis.""",
659
- }
660
-
661
- response = mock_findings.get(agent.role, f"Mock response for {agent.role}")
662
- return (response, 0, 0, 0.0)
663
-
664
- def _get_index_context(self) -> dict[str, Any]:
665
- """Get release validation context from ProjectIndex if available."""
666
- if self._project_index is None:
667
- return {}
668
-
669
- try:
670
- return self._project_index.get_context_for_workflow("release_prep")
671
- except Exception as e:
672
- print(f" [ProjectIndex] Warning: Could not get context: {e}")
673
- return {}
674
-
675
- async def execute(
676
- self,
677
- path: str = ".",
678
- context: dict | None = None,
679
- **kwargs: Any,
680
- ) -> ReleasePreparationCrewResult:
681
- """Execute the release preparation crew.
682
-
683
- Args:
684
- path: Path to analyze for release readiness
685
- context: Additional context for agents
686
- **kwargs: Additional arguments
687
-
688
- Returns:
689
- ReleasePreparationCrewResult with approval status and findings
690
- """
691
- started_at = datetime.now()
692
- context = context or {}
693
-
694
- print("\n" + "=" * 70)
695
- print(" RELEASE PREPARATION CREW (CrewAI)")
696
- print("=" * 70)
697
- print(f"\n Project Path: {path}")
698
- print(f" Agents: {len(self.agents)} (running in parallel)")
699
- print("")
700
-
701
- # Try to get rich context from ProjectIndex
702
- index_context = self._get_index_context()
703
-
704
- if index_context:
705
- print(" [ProjectIndex] Using indexed project data")
706
- agent_context = {
707
- "path": path,
708
- **index_context,
709
- **context,
710
- }
711
- else:
712
- # Fallback: basic context
713
- agent_context = {
714
- "path": path,
715
- "quality_gates": self.quality_gates,
716
- **context,
717
- }
718
-
719
- # Define tasks
720
- tasks = self.define_tasks()
721
-
722
- # Execute all agents in parallel
723
- print(" 🚀 Executing agents in parallel...\n")
724
-
725
- agent_tasks = []
726
- for agent, task in zip(self.agents, tasks, strict=False):
727
- print(f" • {agent.role}")
728
- agent_tasks.append(self._call_llm(agent, task, agent_context))
729
-
730
- # Wait for all agents to complete
731
- results = await asyncio.gather(*agent_tasks)
732
-
733
- print("\n ✓ All agents completed\n")
734
-
735
- # Parse agent responses
736
- agent_findings = []
737
- for agent, _, (response, input_tokens, output_tokens, cost) in zip(
738
- self.agents, tasks, results, strict=False
739
- ):
740
- parsed = parse_xml_response(response)
741
- agent_findings.append(
742
- {
743
- "agent": agent.role,
744
- "response": response,
745
- "thinking": parsed["thinking"],
746
- "answer": parsed["answer"],
747
- "has_xml_structure": parsed["has_xml_structure"],
748
- "cost": cost,
749
- "input_tokens": input_tokens,
750
- "output_tokens": output_tokens,
751
- }
752
- )
753
-
754
- # Extract structured findings from each agent
755
- security_findings = self._extract_security_findings(agent_findings[0])
756
- testing_findings = self._extract_testing_findings(agent_findings[1])
757
- quality_findings = self._extract_quality_findings(agent_findings[2])
758
- documentation_findings = self._extract_documentation_findings(agent_findings[3])
759
-
760
- # Evaluate quality gates
761
- quality_gates = self._evaluate_quality_gates(
762
- security_findings, testing_findings, quality_findings, documentation_findings
763
- )
764
-
765
- # Determine approval status
766
- blockers = []
767
- warnings = []
768
- recommendations = []
769
-
770
- for gate in quality_gates:
771
- if not gate.passed:
772
- if gate.critical:
773
- blockers.append(f"{gate.name} failed: {gate.message}")
774
- else:
775
- warnings.append(f"{gate.name} below threshold: {gate.message}")
776
-
777
- approved = len(blockers) == 0
778
- confidence = (
779
- "high" if approved and len(warnings) == 0 else ("medium" if approved else "low")
780
- )
781
-
782
- # Calculate duration
783
- duration_ms = int((datetime.now() - started_at).total_seconds() * 1000)
784
-
785
- # Build result
786
- result = ReleasePreparationCrewResult(
787
- success=True,
788
- approved=approved,
789
- confidence=confidence,
790
- quality_gates=quality_gates,
791
- security_findings=security_findings,
792
- testing_findings=testing_findings,
793
- quality_findings=quality_findings,
794
- documentation_findings=documentation_findings,
795
- blockers=blockers,
796
- warnings=warnings,
797
- recommendations=recommendations,
798
- cost=self._total_cost,
799
- duration_ms=duration_ms,
800
- )
801
-
802
- # Add formatted report
803
- print(result.formatted_report)
804
-
805
- return result
806
-
807
- def _parse_json_answer(self, answer: str) -> dict | None:
808
- """Parse JSON from agent answer, handling markdown code blocks.
809
-
810
- Args:
811
- answer: Agent answer text (may contain ```json...```)
812
-
813
- Returns:
814
- Parsed JSON dict or None if parsing fails
815
- """
816
- import json
817
- import re
818
-
819
- try:
820
- # Remove markdown code blocks if present
821
- answer_cleaned = re.sub(r"```json\s*", "", answer)
822
- answer_cleaned = re.sub(r"```\s*$", "", answer_cleaned)
823
- answer_cleaned = answer_cleaned.strip()
824
-
825
- # Parse as JSON
826
- return json.loads(answer_cleaned)
827
- except Exception:
828
- return None
829
-
830
- def _extract_security_findings(self, agent_finding: dict) -> dict:
831
- """Extract structured security findings from agent response."""
832
- answer = agent_finding.get("answer", "")
833
- data = self._parse_json_answer(answer)
834
-
835
- if data:
836
- return {
837
- "critical_count": data.get("critical_issues_count", 0),
838
- "high_count": data.get("high_issues_count", 0),
839
- "findings": data.get("findings", []),
840
- "recommendation": data.get("recommendation", "UNKNOWN"),
841
- "summary": f"{data.get('critical_issues_count', 0)} critical, {data.get('high_issues_count', 0)} high issues found",
842
- }
843
-
844
- # Fallback
845
- return {
846
- "critical_count": 0,
847
- "high_count": 0,
848
- "findings": [],
849
- "recommendation": "UNKNOWN",
850
- "summary": "Could not parse security findings",
851
- }
852
-
853
- def _extract_testing_findings(self, agent_finding: dict) -> dict:
854
- """Extract structured testing findings from agent response."""
855
- answer = agent_finding.get("answer", "")
856
- data = self._parse_json_answer(answer)
857
-
858
- if data:
859
- return {
860
- "coverage": data.get("coverage_percentage", 0.0),
861
- "gaps_count": data.get("critical_gaps_count", 0),
862
- "tests_passing": data.get("tests_passing", False),
863
- "recommendation": data.get("recommendation", "UNKNOWN"),
864
- "summary": f"{data.get('coverage_percentage', 0)}% coverage, {data.get('critical_gaps_count', 0)} critical gaps",
865
- }
866
-
867
- return {
868
- "coverage": 0.0,
869
- "gaps_count": 0,
870
- "tests_passing": False,
871
- "recommendation": "UNKNOWN",
872
- "summary": "Could not parse testing findings",
873
- }
874
-
875
- def _extract_quality_findings(self, agent_finding: dict) -> dict:
876
- """Extract structured quality findings from agent response."""
877
- answer = agent_finding.get("answer", "")
878
- data = self._parse_json_answer(answer)
879
-
880
- if data:
881
- return {
882
- "quality_score": data.get("quality_score", 0.0),
883
- "complexity_issues": data.get("complexity_issues", 0),
884
- "linting_errors": data.get("linting_errors", 0),
885
- "recommendation": data.get("recommendation", "UNKNOWN"),
886
- "summary": f"Quality score: {data.get('quality_score', 0)}/10, {data.get('complexity_issues', 0)} complexity issues",
887
- }
888
-
889
- return {
890
- "quality_score": 0.0,
891
- "complexity_issues": 0,
892
- "linting_errors": 0,
893
- "recommendation": "UNKNOWN",
894
- "summary": "Could not parse quality findings",
895
- }
896
-
897
- def _extract_documentation_findings(self, agent_finding: dict) -> dict:
898
- """Extract structured documentation findings from agent response."""
899
- answer = agent_finding.get("answer", "")
900
- data = self._parse_json_answer(answer)
901
-
902
- if data:
903
- return {
904
- "docstring_coverage": data.get("docstring_coverage_percentage", 0.0),
905
- "readme_current": data.get("readme_current", False),
906
- "missing_docs_count": data.get("missing_docs_count", 0),
907
- "recommendation": data.get("recommendation", "UNKNOWN"),
908
- "summary": f"{data.get('docstring_coverage_percentage', 0)}% docstring coverage, README {'current' if data.get('readme_current') else 'needs update'}",
909
- }
910
-
911
- return {
912
- "docstring_coverage": 0.0,
913
- "readme_current": False,
914
- "missing_docs_count": 0,
915
- "recommendation": "UNKNOWN",
916
- "summary": "Could not parse documentation findings",
917
- }
918
-
919
- def _evaluate_quality_gates(
920
- self,
921
- security_findings: dict,
922
- testing_findings: dict,
923
- quality_findings: dict,
924
- documentation_findings: dict,
925
- ) -> list[QualityGate]:
926
- """Evaluate quality gates based on agent findings."""
927
- gates = []
928
-
929
- # Security gate: no critical issues
930
- sec_gate = QualityGate(
931
- name="Security",
932
- threshold=self.quality_gates["security"],
933
- actual=float(security_findings.get("critical_count", 0)),
934
- critical=True,
935
- )
936
- sec_gate.passed = sec_gate.actual <= sec_gate.threshold
937
- gates.append(sec_gate)
938
-
939
- # Test coverage gate
940
- cov_gate = QualityGate(
941
- name="Test Coverage",
942
- threshold=self.quality_gates["coverage"],
943
- actual=testing_findings.get("coverage", 0.0),
944
- critical=True,
945
- )
946
- cov_gate.passed = cov_gate.actual >= cov_gate.threshold
947
- gates.append(cov_gate)
948
-
949
- # Code quality gate
950
- qual_gate = QualityGate(
951
- name="Code Quality",
952
- threshold=self.quality_gates["quality"],
953
- actual=quality_findings.get("quality_score", 0.0),
954
- critical=True,
955
- )
956
- qual_gate.passed = qual_gate.actual >= qual_gate.threshold
957
- gates.append(qual_gate)
958
-
959
- # Documentation gate
960
- doc_gate = QualityGate(
961
- name="Documentation",
962
- threshold=self.quality_gates["documentation"],
963
- actual=documentation_findings.get("docstring_coverage", 0.0),
964
- critical=False, # Non-critical warning
965
- )
966
- doc_gate.passed = doc_gate.actual >= doc_gate.threshold
967
- gates.append(doc_gate)
968
-
969
- return gates