crackerjack 0.30.3__py3-none-any.whl → 0.31.4__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.
Potentially problematic release.
This version of crackerjack might be problematic. Click here for more details.
- crackerjack/CLAUDE.md +1005 -0
- crackerjack/RULES.md +380 -0
- crackerjack/__init__.py +42 -13
- crackerjack/__main__.py +225 -299
- crackerjack/agents/__init__.py +41 -0
- crackerjack/agents/architect_agent.py +281 -0
- crackerjack/agents/base.py +169 -0
- crackerjack/agents/coordinator.py +512 -0
- crackerjack/agents/documentation_agent.py +498 -0
- crackerjack/agents/dry_agent.py +388 -0
- crackerjack/agents/formatting_agent.py +245 -0
- crackerjack/agents/import_optimization_agent.py +281 -0
- crackerjack/agents/performance_agent.py +669 -0
- crackerjack/agents/proactive_agent.py +104 -0
- crackerjack/agents/refactoring_agent.py +788 -0
- crackerjack/agents/security_agent.py +529 -0
- crackerjack/agents/test_creation_agent.py +652 -0
- crackerjack/agents/test_specialist_agent.py +486 -0
- crackerjack/agents/tracker.py +212 -0
- crackerjack/api.py +560 -0
- crackerjack/cli/__init__.py +24 -0
- crackerjack/cli/facade.py +104 -0
- crackerjack/cli/handlers.py +267 -0
- crackerjack/cli/interactive.py +471 -0
- crackerjack/cli/options.py +401 -0
- crackerjack/cli/utils.py +18 -0
- crackerjack/code_cleaner.py +618 -928
- crackerjack/config/__init__.py +19 -0
- crackerjack/config/hooks.py +218 -0
- crackerjack/core/__init__.py +0 -0
- crackerjack/core/async_workflow_orchestrator.py +406 -0
- crackerjack/core/autofix_coordinator.py +200 -0
- crackerjack/core/container.py +104 -0
- crackerjack/core/enhanced_container.py +542 -0
- crackerjack/core/performance.py +243 -0
- crackerjack/core/phase_coordinator.py +561 -0
- crackerjack/core/proactive_workflow.py +316 -0
- crackerjack/core/session_coordinator.py +289 -0
- crackerjack/core/workflow_orchestrator.py +640 -0
- crackerjack/dynamic_config.py +94 -103
- crackerjack/errors.py +263 -41
- crackerjack/executors/__init__.py +11 -0
- crackerjack/executors/async_hook_executor.py +431 -0
- crackerjack/executors/cached_hook_executor.py +242 -0
- crackerjack/executors/hook_executor.py +345 -0
- crackerjack/executors/individual_hook_executor.py +669 -0
- crackerjack/intelligence/__init__.py +44 -0
- crackerjack/intelligence/adaptive_learning.py +751 -0
- crackerjack/intelligence/agent_orchestrator.py +551 -0
- crackerjack/intelligence/agent_registry.py +414 -0
- crackerjack/intelligence/agent_selector.py +502 -0
- crackerjack/intelligence/integration.py +290 -0
- crackerjack/interactive.py +576 -315
- crackerjack/managers/__init__.py +11 -0
- crackerjack/managers/async_hook_manager.py +135 -0
- crackerjack/managers/hook_manager.py +137 -0
- crackerjack/managers/publish_manager.py +411 -0
- crackerjack/managers/test_command_builder.py +151 -0
- crackerjack/managers/test_executor.py +435 -0
- crackerjack/managers/test_manager.py +258 -0
- crackerjack/managers/test_manager_backup.py +1124 -0
- crackerjack/managers/test_progress.py +144 -0
- crackerjack/mcp/__init__.py +0 -0
- crackerjack/mcp/cache.py +336 -0
- crackerjack/mcp/client_runner.py +104 -0
- crackerjack/mcp/context.py +615 -0
- crackerjack/mcp/dashboard.py +636 -0
- crackerjack/mcp/enhanced_progress_monitor.py +479 -0
- crackerjack/mcp/file_monitor.py +336 -0
- crackerjack/mcp/progress_components.py +569 -0
- crackerjack/mcp/progress_monitor.py +949 -0
- crackerjack/mcp/rate_limiter.py +332 -0
- crackerjack/mcp/server.py +22 -0
- crackerjack/mcp/server_core.py +244 -0
- crackerjack/mcp/service_watchdog.py +501 -0
- crackerjack/mcp/state.py +395 -0
- crackerjack/mcp/task_manager.py +257 -0
- crackerjack/mcp/tools/__init__.py +17 -0
- crackerjack/mcp/tools/core_tools.py +249 -0
- crackerjack/mcp/tools/error_analyzer.py +308 -0
- crackerjack/mcp/tools/execution_tools.py +370 -0
- crackerjack/mcp/tools/execution_tools_backup.py +1097 -0
- crackerjack/mcp/tools/intelligence_tool_registry.py +80 -0
- crackerjack/mcp/tools/intelligence_tools.py +314 -0
- crackerjack/mcp/tools/monitoring_tools.py +502 -0
- crackerjack/mcp/tools/proactive_tools.py +384 -0
- crackerjack/mcp/tools/progress_tools.py +141 -0
- crackerjack/mcp/tools/utility_tools.py +341 -0
- crackerjack/mcp/tools/workflow_executor.py +360 -0
- crackerjack/mcp/websocket/__init__.py +14 -0
- crackerjack/mcp/websocket/app.py +39 -0
- crackerjack/mcp/websocket/endpoints.py +559 -0
- crackerjack/mcp/websocket/jobs.py +253 -0
- crackerjack/mcp/websocket/server.py +116 -0
- crackerjack/mcp/websocket/websocket_handler.py +78 -0
- crackerjack/mcp/websocket_server.py +10 -0
- crackerjack/models/__init__.py +31 -0
- crackerjack/models/config.py +93 -0
- crackerjack/models/config_adapter.py +230 -0
- crackerjack/models/protocols.py +118 -0
- crackerjack/models/task.py +154 -0
- crackerjack/monitoring/ai_agent_watchdog.py +450 -0
- crackerjack/monitoring/regression_prevention.py +638 -0
- crackerjack/orchestration/__init__.py +0 -0
- crackerjack/orchestration/advanced_orchestrator.py +970 -0
- crackerjack/orchestration/execution_strategies.py +341 -0
- crackerjack/orchestration/test_progress_streamer.py +636 -0
- crackerjack/plugins/__init__.py +15 -0
- crackerjack/plugins/base.py +200 -0
- crackerjack/plugins/hooks.py +246 -0
- crackerjack/plugins/loader.py +335 -0
- crackerjack/plugins/managers.py +259 -0
- crackerjack/py313.py +8 -3
- crackerjack/services/__init__.py +22 -0
- crackerjack/services/cache.py +314 -0
- crackerjack/services/config.py +347 -0
- crackerjack/services/config_integrity.py +99 -0
- crackerjack/services/contextual_ai_assistant.py +516 -0
- crackerjack/services/coverage_ratchet.py +347 -0
- crackerjack/services/debug.py +736 -0
- crackerjack/services/dependency_monitor.py +617 -0
- crackerjack/services/enhanced_filesystem.py +439 -0
- crackerjack/services/file_hasher.py +151 -0
- crackerjack/services/filesystem.py +395 -0
- crackerjack/services/git.py +165 -0
- crackerjack/services/health_metrics.py +611 -0
- crackerjack/services/initialization.py +847 -0
- crackerjack/services/log_manager.py +286 -0
- crackerjack/services/logging.py +174 -0
- crackerjack/services/metrics.py +578 -0
- crackerjack/services/pattern_cache.py +362 -0
- crackerjack/services/pattern_detector.py +515 -0
- crackerjack/services/performance_benchmarks.py +653 -0
- crackerjack/services/security.py +163 -0
- crackerjack/services/server_manager.py +234 -0
- crackerjack/services/smart_scheduling.py +144 -0
- crackerjack/services/tool_version_service.py +61 -0
- crackerjack/services/unified_config.py +437 -0
- crackerjack/services/version_checker.py +248 -0
- crackerjack/slash_commands/__init__.py +14 -0
- crackerjack/slash_commands/init.md +122 -0
- crackerjack/slash_commands/run.md +163 -0
- crackerjack/slash_commands/status.md +127 -0
- crackerjack-0.31.4.dist-info/METADATA +742 -0
- crackerjack-0.31.4.dist-info/RECORD +148 -0
- crackerjack-0.31.4.dist-info/entry_points.txt +2 -0
- crackerjack/.gitignore +0 -34
- crackerjack/.libcst.codemod.yaml +0 -18
- crackerjack/.pdm.toml +0 -1
- crackerjack/crackerjack.py +0 -3805
- crackerjack/pyproject.toml +0 -286
- crackerjack-0.30.3.dist-info/METADATA +0 -1290
- crackerjack-0.30.3.dist-info/RECORD +0 -16
- {crackerjack-0.30.3.dist-info → crackerjack-0.31.4.dist-info}/WHEEL +0 -0
- {crackerjack-0.30.3.dist-info → crackerjack-0.31.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Intelligence tool registry for MCP server."""
|
|
2
|
+
|
|
3
|
+
from .intelligence_tools import (
|
|
4
|
+
analyze_agent_performance,
|
|
5
|
+
execute_smart_agent_task,
|
|
6
|
+
get_intelligence_system_status,
|
|
7
|
+
get_smart_agent_recommendation,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def register_intelligence_tools(mcp_app) -> None:
|
|
12
|
+
"""Register intelligence system tools with the MCP server."""
|
|
13
|
+
|
|
14
|
+
@mcp_app.tool()
|
|
15
|
+
async def execute_smart_task(
|
|
16
|
+
task_description: str,
|
|
17
|
+
context_type: str = "general",
|
|
18
|
+
strategy: str = "single_best",
|
|
19
|
+
max_agents: int = 3,
|
|
20
|
+
use_learning: bool = True,
|
|
21
|
+
):
|
|
22
|
+
"""Execute a task using intelligent agent selection.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
task_description: Description of the task to execute
|
|
26
|
+
context_type: Type of task context (architecture, refactoring, testing, etc.)
|
|
27
|
+
strategy: Execution strategy (single_best, parallel, sequential, consensus)
|
|
28
|
+
max_agents: Maximum number of agents to consider
|
|
29
|
+
use_learning: Whether to apply adaptive learning
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
Dictionary with execution results and metadata
|
|
33
|
+
"""
|
|
34
|
+
return await execute_smart_agent_task(
|
|
35
|
+
task_description,
|
|
36
|
+
context_type,
|
|
37
|
+
strategy,
|
|
38
|
+
max_agents,
|
|
39
|
+
use_learning,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
@mcp_app.tool()
|
|
43
|
+
async def get_agent_recommendation(
|
|
44
|
+
task_description: str,
|
|
45
|
+
context_type: str = "general",
|
|
46
|
+
include_analysis: bool = True,
|
|
47
|
+
):
|
|
48
|
+
"""Get intelligent agent recommendation for a task without executing it.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
task_description: Description of the task
|
|
52
|
+
context_type: Type of task context
|
|
53
|
+
include_analysis: Whether to include complexity analysis
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Dictionary with recommendation details
|
|
57
|
+
"""
|
|
58
|
+
return await get_smart_agent_recommendation(
|
|
59
|
+
task_description,
|
|
60
|
+
context_type,
|
|
61
|
+
include_analysis,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
@mcp_app.tool()
|
|
65
|
+
async def intelligence_system_status():
|
|
66
|
+
"""Get comprehensive status of the intelligent agent system.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
Dictionary with system status and statistics
|
|
70
|
+
"""
|
|
71
|
+
return await get_intelligence_system_status()
|
|
72
|
+
|
|
73
|
+
@mcp_app.tool()
|
|
74
|
+
async def agent_performance_analysis():
|
|
75
|
+
"""Analyze agent performance and learning insights.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Dictionary with performance analysis and insights
|
|
79
|
+
"""
|
|
80
|
+
return await analyze_agent_performance()
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"""MCP tools for the Intelligent Agent Selection System."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import logging
|
|
5
|
+
import typing as t
|
|
6
|
+
|
|
7
|
+
from crackerjack.intelligence import ExecutionStrategy, TaskContext
|
|
8
|
+
from crackerjack.intelligence.integration import get_intelligent_agent_system
|
|
9
|
+
from crackerjack.mcp.context import get_context
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def execute_smart_agent_task(
|
|
13
|
+
task_description: str,
|
|
14
|
+
context_type: str = "general",
|
|
15
|
+
strategy: str = "single_best",
|
|
16
|
+
max_agents: int = 3,
|
|
17
|
+
use_learning: bool = True,
|
|
18
|
+
) -> dict[str, t.Any]:
|
|
19
|
+
"""Execute a task using intelligent agent selection.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
task_description: Description of the task to execute
|
|
23
|
+
context_type: Type of task context (architecture, refactoring, testing, etc.)
|
|
24
|
+
strategy: Execution strategy (single_best, parallel, sequential, consensus)
|
|
25
|
+
max_agents: Maximum number of agents to consider
|
|
26
|
+
use_learning: Whether to apply adaptive learning
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
Dictionary with execution results and metadata
|
|
30
|
+
"""
|
|
31
|
+
get_context()
|
|
32
|
+
logger = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
# Parse context type
|
|
36
|
+
task_context = None
|
|
37
|
+
context_map = {
|
|
38
|
+
"architecture": TaskContext.ARCHITECTURE,
|
|
39
|
+
"refactoring": TaskContext.REFACTORING,
|
|
40
|
+
"testing": TaskContext.TESTING,
|
|
41
|
+
"security": TaskContext.SECURITY,
|
|
42
|
+
"performance": TaskContext.PERFORMANCE,
|
|
43
|
+
"documentation": TaskContext.DOCUMENTATION,
|
|
44
|
+
"code_quality": TaskContext.CODE_QUALITY,
|
|
45
|
+
"debugging": TaskContext.DEBUGGING,
|
|
46
|
+
"project_setup": TaskContext.PROJECT_SETUP,
|
|
47
|
+
"general": TaskContext.GENERAL,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if context_type.lower() in context_map:
|
|
51
|
+
task_context = context_map[context_type.lower()]
|
|
52
|
+
|
|
53
|
+
# Parse strategy
|
|
54
|
+
strategy_map = {
|
|
55
|
+
"single_best": ExecutionStrategy.SINGLE_BEST,
|
|
56
|
+
"parallel": ExecutionStrategy.PARALLEL,
|
|
57
|
+
"sequential": ExecutionStrategy.SEQUENTIAL,
|
|
58
|
+
"consensus": ExecutionStrategy.CONSENSUS,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
execution_strategy = strategy_map.get(
|
|
62
|
+
strategy.lower(), ExecutionStrategy.SINGLE_BEST
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Get intelligent agent system
|
|
66
|
+
system = await get_intelligent_agent_system()
|
|
67
|
+
|
|
68
|
+
logger.info(
|
|
69
|
+
f"Executing smart task: '{task_description[:50]}...' "
|
|
70
|
+
f"(context: {context_type}, strategy: {strategy})"
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Execute task
|
|
74
|
+
result = await system.execute_smart_task(
|
|
75
|
+
description=task_description,
|
|
76
|
+
context=task_context,
|
|
77
|
+
strategy=execution_strategy,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Prepare response
|
|
81
|
+
response = {
|
|
82
|
+
"success": result.success,
|
|
83
|
+
"agents_used": result.agents_used,
|
|
84
|
+
"execution_time": result.execution_time,
|
|
85
|
+
"confidence": result.confidence,
|
|
86
|
+
"recommendations": result.recommendations,
|
|
87
|
+
"learning_applied": result.learning_applied,
|
|
88
|
+
"task_description": task_description,
|
|
89
|
+
"context_type": context_type,
|
|
90
|
+
"strategy_used": strategy,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Add result based on type
|
|
94
|
+
if hasattr(result.result, "__dict__"):
|
|
95
|
+
# Complex object - convert to dict
|
|
96
|
+
try:
|
|
97
|
+
if hasattr(result.result, "success"):
|
|
98
|
+
# Looks like FixResult
|
|
99
|
+
response["fix_result"] = {
|
|
100
|
+
"success": getattr(result.result, "success", False),
|
|
101
|
+
"confidence": getattr(result.result, "confidence", 0.0),
|
|
102
|
+
"fixes_applied": getattr(result.result, "fixes_applied", []),
|
|
103
|
+
"remaining_issues": getattr(
|
|
104
|
+
result.result, "remaining_issues", []
|
|
105
|
+
),
|
|
106
|
+
"recommendations": getattr(
|
|
107
|
+
result.result, "recommendations", []
|
|
108
|
+
),
|
|
109
|
+
"files_modified": getattr(result.result, "files_modified", []),
|
|
110
|
+
}
|
|
111
|
+
else:
|
|
112
|
+
response["result"] = str(result.result)
|
|
113
|
+
except Exception:
|
|
114
|
+
response["result"] = str(result.result)
|
|
115
|
+
else:
|
|
116
|
+
response["result"] = result.result
|
|
117
|
+
|
|
118
|
+
if result.success:
|
|
119
|
+
logger.info(
|
|
120
|
+
f"Smart task completed successfully using {len(result.agents_used)} agents "
|
|
121
|
+
f"in {result.execution_time:.2f}s"
|
|
122
|
+
)
|
|
123
|
+
else:
|
|
124
|
+
logger.warning(f"Smart task failed: {result.recommendations}")
|
|
125
|
+
|
|
126
|
+
return response
|
|
127
|
+
|
|
128
|
+
except Exception as e:
|
|
129
|
+
logger.exception(f"Error in smart agent execution: {e}")
|
|
130
|
+
return {
|
|
131
|
+
"success": False,
|
|
132
|
+
"error": str(e),
|
|
133
|
+
"task_description": task_description,
|
|
134
|
+
"context_type": context_type,
|
|
135
|
+
"strategy_used": strategy,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
async def get_smart_agent_recommendation(
|
|
140
|
+
task_description: str,
|
|
141
|
+
context_type: str = "general",
|
|
142
|
+
include_analysis: bool = True,
|
|
143
|
+
) -> dict[str, t.Any]:
|
|
144
|
+
"""Get agent recommendation for a task without executing it.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
task_description: Description of the task
|
|
148
|
+
context_type: Type of task context
|
|
149
|
+
include_analysis: Whether to include complexity analysis
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
Dictionary with recommendation details
|
|
153
|
+
"""
|
|
154
|
+
logger = logging.getLogger(__name__)
|
|
155
|
+
|
|
156
|
+
try:
|
|
157
|
+
# Parse context type
|
|
158
|
+
task_context = None
|
|
159
|
+
context_map = {
|
|
160
|
+
"architecture": TaskContext.ARCHITECTURE,
|
|
161
|
+
"refactoring": TaskContext.REFACTORING,
|
|
162
|
+
"testing": TaskContext.TESTING,
|
|
163
|
+
"security": TaskContext.SECURITY,
|
|
164
|
+
"performance": TaskContext.PERFORMANCE,
|
|
165
|
+
"documentation": TaskContext.DOCUMENTATION,
|
|
166
|
+
"code_quality": TaskContext.CODE_QUALITY,
|
|
167
|
+
"debugging": TaskContext.DEBUGGING,
|
|
168
|
+
"project_setup": TaskContext.PROJECT_SETUP,
|
|
169
|
+
"general": TaskContext.GENERAL,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if context_type.lower() in context_map:
|
|
173
|
+
task_context = context_map[context_type.lower()]
|
|
174
|
+
|
|
175
|
+
# Get intelligent agent system
|
|
176
|
+
system = await get_intelligent_agent_system()
|
|
177
|
+
|
|
178
|
+
# Get recommendation
|
|
179
|
+
recommendation = await system.get_best_agent_for_task(
|
|
180
|
+
description=task_description,
|
|
181
|
+
context=task_context,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
response = {
|
|
185
|
+
"task_description": task_description,
|
|
186
|
+
"context_type": context_type,
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if recommendation:
|
|
190
|
+
agent_name, confidence = recommendation
|
|
191
|
+
response.update(
|
|
192
|
+
{
|
|
193
|
+
"recommended_agent": agent_name,
|
|
194
|
+
"confidence": confidence,
|
|
195
|
+
"has_recommendation": True,
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
else:
|
|
199
|
+
response.update(
|
|
200
|
+
{
|
|
201
|
+
"recommended_agent": None,
|
|
202
|
+
"confidence": 0.0,
|
|
203
|
+
"has_recommendation": False,
|
|
204
|
+
"message": "No suitable agent found for this task",
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
# Add complexity analysis if requested
|
|
209
|
+
if include_analysis:
|
|
210
|
+
try:
|
|
211
|
+
analysis = await system.analyze_task_complexity(task_description)
|
|
212
|
+
response["complexity_analysis"] = analysis
|
|
213
|
+
except Exception as e:
|
|
214
|
+
logger.warning(f"Failed to analyze task complexity: {e}")
|
|
215
|
+
response["complexity_analysis"] = {"error": str(e)}
|
|
216
|
+
|
|
217
|
+
logger.debug(f"Generated recommendation for task: {task_description[:50]}...")
|
|
218
|
+
return response
|
|
219
|
+
|
|
220
|
+
except Exception as e:
|
|
221
|
+
logger.exception(f"Error getting smart recommendation: {e}")
|
|
222
|
+
return {
|
|
223
|
+
"task_description": task_description,
|
|
224
|
+
"context_type": context_type,
|
|
225
|
+
"error": str(e),
|
|
226
|
+
"has_recommendation": False,
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
async def get_intelligence_system_status() -> dict[str, t.Any]:
|
|
231
|
+
"""Get comprehensive status of the intelligent agent system.
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
Dictionary with system status and statistics
|
|
235
|
+
"""
|
|
236
|
+
logger = logging.getLogger(__name__)
|
|
237
|
+
|
|
238
|
+
try:
|
|
239
|
+
system = await get_intelligent_agent_system()
|
|
240
|
+
status = await system.get_system_status()
|
|
241
|
+
|
|
242
|
+
# Add additional runtime information
|
|
243
|
+
status["runtime_info"] = {
|
|
244
|
+
"system_initialized": system._initialized,
|
|
245
|
+
"components_loaded": {
|
|
246
|
+
"registry": system.registry is not None,
|
|
247
|
+
"orchestrator": system.orchestrator is not None,
|
|
248
|
+
"learning_system": system.learning_system is not None,
|
|
249
|
+
},
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
logger.debug("Generated intelligence system status")
|
|
253
|
+
return status
|
|
254
|
+
|
|
255
|
+
except Exception as e:
|
|
256
|
+
logger.exception(f"Error getting intelligence system status: {e}")
|
|
257
|
+
return {
|
|
258
|
+
"error": str(e),
|
|
259
|
+
"initialized": False,
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
async def analyze_agent_performance() -> dict[str, t.Any]:
|
|
264
|
+
"""Analyze agent performance and learning insights.
|
|
265
|
+
|
|
266
|
+
Returns:
|
|
267
|
+
Dictionary with performance analysis and insights
|
|
268
|
+
"""
|
|
269
|
+
logger = logging.getLogger(__name__)
|
|
270
|
+
|
|
271
|
+
try:
|
|
272
|
+
system = await get_intelligent_agent_system()
|
|
273
|
+
await system.initialize()
|
|
274
|
+
|
|
275
|
+
# Get learning summary
|
|
276
|
+
learning_summary = system.learning_system.get_learning_summary()
|
|
277
|
+
|
|
278
|
+
# Get orchestrator stats
|
|
279
|
+
orchestration_stats = system.orchestrator.get_execution_stats()
|
|
280
|
+
|
|
281
|
+
# Get agent capabilities overview
|
|
282
|
+
registry_stats = system.registry.get_agent_stats()
|
|
283
|
+
|
|
284
|
+
performance_analysis = {
|
|
285
|
+
"learning_summary": learning_summary,
|
|
286
|
+
"orchestration_stats": orchestration_stats,
|
|
287
|
+
"registry_overview": registry_stats,
|
|
288
|
+
"analysis_timestamp": asyncio.get_event_loop().time(),
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
# Add insights if available
|
|
292
|
+
if hasattr(system.learning_system, "_learning_insights"):
|
|
293
|
+
recent_insights = [
|
|
294
|
+
{
|
|
295
|
+
"type": insight.insight_type,
|
|
296
|
+
"agent": insight.agent_name,
|
|
297
|
+
"confidence": insight.confidence,
|
|
298
|
+
"description": insight.description,
|
|
299
|
+
}
|
|
300
|
+
for insight in system.learning_system._learning_insights[
|
|
301
|
+
-10:
|
|
302
|
+
] # Last 10 insights
|
|
303
|
+
]
|
|
304
|
+
performance_analysis["recent_insights"] = recent_insights
|
|
305
|
+
|
|
306
|
+
logger.debug("Generated agent performance analysis")
|
|
307
|
+
return performance_analysis
|
|
308
|
+
|
|
309
|
+
except Exception as e:
|
|
310
|
+
logger.exception(f"Error analyzing agent performance: {e}")
|
|
311
|
+
return {
|
|
312
|
+
"error": str(e),
|
|
313
|
+
"analysis_available": False,
|
|
314
|
+
}
|