claude-mpm 3.9.11__py3-none-any.whl → 4.0.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.
- claude_mpm/VERSION +1 -1
- claude_mpm/__init__.py +2 -2
- claude_mpm/__main__.py +3 -2
- claude_mpm/agents/__init__.py +85 -79
- claude_mpm/agents/agent_loader.py +464 -1003
- claude_mpm/agents/agent_loader_integration.py +45 -45
- claude_mpm/agents/agents_metadata.py +29 -30
- claude_mpm/agents/async_agent_loader.py +156 -138
- claude_mpm/agents/base_agent.json +1 -1
- claude_mpm/agents/base_agent_loader.py +179 -151
- claude_mpm/agents/frontmatter_validator.py +229 -130
- claude_mpm/agents/schema/agent_schema.json +1 -1
- claude_mpm/agents/system_agent_config.py +213 -147
- claude_mpm/agents/templates/__init__.py +13 -13
- claude_mpm/agents/templates/code_analyzer.json +2 -2
- claude_mpm/agents/templates/data_engineer.json +1 -1
- claude_mpm/agents/templates/documentation.json +23 -11
- claude_mpm/agents/templates/engineer.json +22 -6
- claude_mpm/agents/templates/memory_manager.json +1 -1
- claude_mpm/agents/templates/ops.json +2 -2
- claude_mpm/agents/templates/project_organizer.json +1 -1
- claude_mpm/agents/templates/qa.json +1 -1
- claude_mpm/agents/templates/refactoring_engineer.json +222 -0
- claude_mpm/agents/templates/research.json +20 -14
- claude_mpm/agents/templates/security.json +1 -1
- claude_mpm/agents/templates/ticketing.json +2 -2
- claude_mpm/agents/templates/version_control.json +1 -1
- claude_mpm/agents/templates/web_qa.json +3 -1
- claude_mpm/agents/templates/web_ui.json +2 -2
- claude_mpm/cli/__init__.py +79 -51
- claude_mpm/cli/__main__.py +3 -2
- claude_mpm/cli/commands/__init__.py +20 -20
- claude_mpm/cli/commands/agents.py +279 -247
- claude_mpm/cli/commands/aggregate.py +138 -157
- claude_mpm/cli/commands/cleanup.py +147 -147
- claude_mpm/cli/commands/config.py +93 -76
- claude_mpm/cli/commands/info.py +17 -16
- claude_mpm/cli/commands/mcp.py +140 -905
- claude_mpm/cli/commands/mcp_command_router.py +139 -0
- claude_mpm/cli/commands/mcp_config_commands.py +20 -0
- claude_mpm/cli/commands/mcp_install_commands.py +20 -0
- claude_mpm/cli/commands/mcp_server_commands.py +175 -0
- claude_mpm/cli/commands/mcp_tool_commands.py +34 -0
- claude_mpm/cli/commands/memory.py +239 -203
- claude_mpm/cli/commands/monitor.py +330 -86
- claude_mpm/cli/commands/run.py +380 -429
- claude_mpm/cli/commands/run_config_checker.py +160 -0
- claude_mpm/cli/commands/socketio_monitor.py +235 -0
- claude_mpm/cli/commands/tickets.py +363 -220
- claude_mpm/cli/parser.py +24 -1156
- claude_mpm/cli/parsers/__init__.py +29 -0
- claude_mpm/cli/parsers/agents_parser.py +136 -0
- claude_mpm/cli/parsers/base_parser.py +331 -0
- claude_mpm/cli/parsers/config_parser.py +85 -0
- claude_mpm/cli/parsers/mcp_parser.py +152 -0
- claude_mpm/cli/parsers/memory_parser.py +138 -0
- claude_mpm/cli/parsers/monitor_parser.py +124 -0
- claude_mpm/cli/parsers/run_parser.py +147 -0
- claude_mpm/cli/parsers/tickets_parser.py +203 -0
- claude_mpm/cli/ticket_cli.py +7 -3
- claude_mpm/cli/utils.py +55 -37
- claude_mpm/cli_module/__init__.py +6 -6
- claude_mpm/cli_module/args.py +188 -140
- claude_mpm/cli_module/commands.py +79 -70
- claude_mpm/cli_module/migration_example.py +38 -60
- claude_mpm/config/__init__.py +32 -25
- claude_mpm/config/agent_config.py +151 -119
- claude_mpm/config/experimental_features.py +71 -73
- claude_mpm/config/paths.py +94 -208
- claude_mpm/config/socketio_config.py +84 -73
- claude_mpm/constants.py +35 -18
- claude_mpm/core/__init__.py +9 -6
- claude_mpm/core/agent_name_normalizer.py +68 -71
- claude_mpm/core/agent_registry.py +372 -521
- claude_mpm/core/agent_session_manager.py +74 -63
- claude_mpm/core/base_service.py +116 -87
- claude_mpm/core/cache.py +119 -153
- claude_mpm/core/claude_runner.py +425 -1120
- claude_mpm/core/config.py +263 -168
- claude_mpm/core/config_aliases.py +69 -61
- claude_mpm/core/config_constants.py +292 -0
- claude_mpm/core/constants.py +57 -99
- claude_mpm/core/container.py +211 -178
- claude_mpm/core/exceptions.py +233 -89
- claude_mpm/core/factories.py +92 -54
- claude_mpm/core/framework_loader.py +378 -220
- claude_mpm/core/hook_manager.py +198 -83
- claude_mpm/core/hook_performance_config.py +136 -0
- claude_mpm/core/injectable_service.py +61 -55
- claude_mpm/core/interactive_session.py +165 -155
- claude_mpm/core/interfaces.py +221 -195
- claude_mpm/core/lazy.py +96 -96
- claude_mpm/core/logger.py +133 -107
- claude_mpm/core/logging_config.py +185 -157
- claude_mpm/core/minimal_framework_loader.py +20 -15
- claude_mpm/core/mixins.py +30 -29
- claude_mpm/core/oneshot_session.py +215 -181
- claude_mpm/core/optimized_agent_loader.py +134 -138
- claude_mpm/core/optimized_startup.py +159 -157
- claude_mpm/core/pm_hook_interceptor.py +85 -72
- claude_mpm/core/service_registry.py +103 -101
- claude_mpm/core/session_manager.py +97 -87
- claude_mpm/core/socketio_pool.py +212 -158
- claude_mpm/core/tool_access_control.py +58 -51
- claude_mpm/core/types.py +46 -24
- claude_mpm/core/typing_utils.py +166 -82
- claude_mpm/core/unified_agent_registry.py +721 -0
- claude_mpm/core/unified_config.py +550 -0
- claude_mpm/core/unified_paths.py +549 -0
- claude_mpm/dashboard/index.html +1 -1
- claude_mpm/dashboard/open_dashboard.py +51 -17
- claude_mpm/dashboard/static/built/components/agent-inference.js +2 -0
- claude_mpm/dashboard/static/built/components/event-processor.js +2 -0
- claude_mpm/dashboard/static/built/components/event-viewer.js +2 -0
- claude_mpm/dashboard/static/built/components/export-manager.js +2 -0
- claude_mpm/dashboard/static/built/components/file-tool-tracker.js +2 -0
- claude_mpm/dashboard/static/built/components/hud-library-loader.js +2 -0
- claude_mpm/dashboard/static/built/components/hud-manager.js +2 -0
- claude_mpm/dashboard/static/built/components/hud-visualizer.js +2 -0
- claude_mpm/dashboard/static/built/components/module-viewer.js +2 -0
- claude_mpm/dashboard/static/built/components/session-manager.js +2 -0
- claude_mpm/dashboard/static/built/components/socket-manager.js +2 -0
- claude_mpm/dashboard/static/built/components/ui-state-manager.js +2 -0
- claude_mpm/dashboard/static/built/components/working-directory.js +2 -0
- claude_mpm/dashboard/static/built/dashboard.js +2 -0
- claude_mpm/dashboard/static/built/socket-client.js +2 -0
- claude_mpm/dashboard/static/css/dashboard.css +27 -8
- claude_mpm/dashboard/static/dist/components/agent-inference.js +2 -0
- claude_mpm/dashboard/static/dist/components/event-processor.js +2 -0
- claude_mpm/dashboard/static/dist/components/event-viewer.js +2 -0
- claude_mpm/dashboard/static/dist/components/export-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/file-tool-tracker.js +2 -0
- claude_mpm/dashboard/static/dist/components/hud-library-loader.js +2 -0
- claude_mpm/dashboard/static/dist/components/hud-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/hud-visualizer.js +2 -0
- claude_mpm/dashboard/static/dist/components/module-viewer.js +2 -0
- claude_mpm/dashboard/static/dist/components/session-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/socket-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/ui-state-manager.js +2 -0
- claude_mpm/dashboard/static/dist/components/working-directory.js +2 -0
- claude_mpm/dashboard/static/dist/dashboard.js +2 -0
- claude_mpm/dashboard/static/dist/socket-client.js +2 -0
- claude_mpm/dashboard/static/js/components/agent-inference.js +80 -76
- claude_mpm/dashboard/static/js/components/event-processor.js +71 -67
- claude_mpm/dashboard/static/js/components/event-viewer.js +93 -72
- claude_mpm/dashboard/static/js/components/export-manager.js +31 -28
- claude_mpm/dashboard/static/js/components/file-tool-tracker.js +110 -96
- claude_mpm/dashboard/static/js/components/hud-library-loader.js +11 -11
- claude_mpm/dashboard/static/js/components/hud-manager.js +73 -73
- claude_mpm/dashboard/static/js/components/hud-visualizer.js +163 -163
- claude_mpm/dashboard/static/js/components/module-viewer.js +305 -233
- claude_mpm/dashboard/static/js/components/session-manager.js +32 -29
- claude_mpm/dashboard/static/js/components/socket-manager.js +27 -20
- claude_mpm/dashboard/static/js/components/ui-state-manager.js +21 -18
- claude_mpm/dashboard/static/js/components/working-directory.js +74 -71
- claude_mpm/dashboard/static/js/dashboard.js +178 -453
- claude_mpm/dashboard/static/js/extension-error-handler.js +164 -0
- claude_mpm/dashboard/static/js/socket-client.js +133 -53
- claude_mpm/dashboard/templates/index.html +40 -50
- claude_mpm/experimental/cli_enhancements.py +60 -58
- claude_mpm/generators/__init__.py +1 -1
- claude_mpm/generators/agent_profile_generator.py +75 -65
- claude_mpm/hooks/__init__.py +1 -1
- claude_mpm/hooks/base_hook.py +33 -28
- claude_mpm/hooks/claude_hooks/__init__.py +1 -1
- claude_mpm/hooks/claude_hooks/connection_pool.py +120 -0
- claude_mpm/hooks/claude_hooks/event_handlers.py +743 -0
- claude_mpm/hooks/claude_hooks/hook_handler.py +415 -1331
- claude_mpm/hooks/claude_hooks/hook_wrapper.sh +4 -4
- claude_mpm/hooks/claude_hooks/memory_integration.py +221 -0
- claude_mpm/hooks/claude_hooks/response_tracking.py +348 -0
- claude_mpm/hooks/claude_hooks/tool_analysis.py +230 -0
- claude_mpm/hooks/memory_integration_hook.py +140 -100
- claude_mpm/hooks/tool_call_interceptor.py +89 -76
- claude_mpm/hooks/validation_hooks.py +57 -49
- claude_mpm/init.py +145 -121
- claude_mpm/models/__init__.py +9 -9
- claude_mpm/models/agent_definition.py +33 -23
- claude_mpm/models/agent_session.py +228 -200
- claude_mpm/scripts/__init__.py +1 -1
- claude_mpm/scripts/socketio_daemon.py +192 -75
- claude_mpm/scripts/socketio_server_manager.py +328 -0
- claude_mpm/scripts/start_activity_logging.py +25 -22
- claude_mpm/services/__init__.py +68 -43
- claude_mpm/services/agent_capabilities_service.py +271 -0
- claude_mpm/services/agents/__init__.py +23 -32
- claude_mpm/services/agents/deployment/__init__.py +3 -3
- claude_mpm/services/agents/deployment/agent_config_provider.py +310 -0
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +359 -0
- claude_mpm/services/agents/deployment/agent_definition_factory.py +84 -0
- claude_mpm/services/agents/deployment/agent_deployment.py +415 -2113
- claude_mpm/services/agents/deployment/agent_discovery_service.py +387 -0
- claude_mpm/services/agents/deployment/agent_environment_manager.py +293 -0
- claude_mpm/services/agents/deployment/agent_filesystem_manager.py +387 -0
- claude_mpm/services/agents/deployment/agent_format_converter.py +453 -0
- claude_mpm/services/agents/deployment/agent_frontmatter_validator.py +161 -0
- claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +345 -495
- claude_mpm/services/agents/deployment/agent_metrics_collector.py +279 -0
- claude_mpm/services/agents/deployment/agent_restore_handler.py +88 -0
- claude_mpm/services/agents/deployment/agent_template_builder.py +406 -0
- claude_mpm/services/agents/deployment/agent_validator.py +352 -0
- claude_mpm/services/agents/deployment/agent_version_manager.py +313 -0
- claude_mpm/services/agents/deployment/agent_versioning.py +6 -9
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +79 -0
- claude_mpm/services/agents/deployment/async_agent_deployment.py +298 -234
- claude_mpm/services/agents/deployment/config/__init__.py +13 -0
- claude_mpm/services/agents/deployment/config/deployment_config.py +182 -0
- claude_mpm/services/agents/deployment/config/deployment_config_manager.py +200 -0
- claude_mpm/services/agents/deployment/deployment_config_loader.py +54 -0
- claude_mpm/services/agents/deployment/deployment_type_detector.py +124 -0
- claude_mpm/services/agents/deployment/facade/__init__.py +18 -0
- claude_mpm/services/agents/deployment/facade/async_deployment_executor.py +159 -0
- claude_mpm/services/agents/deployment/facade/deployment_executor.py +73 -0
- claude_mpm/services/agents/deployment/facade/deployment_facade.py +270 -0
- claude_mpm/services/agents/deployment/facade/sync_deployment_executor.py +178 -0
- claude_mpm/services/agents/deployment/interface_adapter.py +227 -0
- claude_mpm/services/agents/deployment/lifecycle_health_checker.py +85 -0
- claude_mpm/services/agents/deployment/lifecycle_performance_tracker.py +100 -0
- claude_mpm/services/agents/deployment/pipeline/__init__.py +32 -0
- claude_mpm/services/agents/deployment/pipeline/pipeline_builder.py +158 -0
- claude_mpm/services/agents/deployment/pipeline/pipeline_context.py +159 -0
- claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +169 -0
- claude_mpm/services/agents/deployment/pipeline/steps/__init__.py +19 -0
- claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +195 -0
- claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +119 -0
- claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +79 -0
- claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +90 -0
- claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +100 -0
- claude_mpm/services/agents/deployment/processors/__init__.py +15 -0
- claude_mpm/services/agents/deployment/processors/agent_deployment_context.py +98 -0
- claude_mpm/services/agents/deployment/processors/agent_deployment_result.py +235 -0
- claude_mpm/services/agents/deployment/processors/agent_processor.py +258 -0
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +318 -0
- claude_mpm/services/agents/deployment/results/__init__.py +13 -0
- claude_mpm/services/agents/deployment/results/deployment_metrics.py +200 -0
- claude_mpm/services/agents/deployment/results/deployment_result_builder.py +249 -0
- claude_mpm/services/agents/deployment/strategies/__init__.py +25 -0
- claude_mpm/services/agents/deployment/strategies/base_strategy.py +119 -0
- claude_mpm/services/agents/deployment/strategies/project_strategy.py +150 -0
- claude_mpm/services/agents/deployment/strategies/strategy_selector.py +117 -0
- claude_mpm/services/agents/deployment/strategies/system_strategy.py +116 -0
- claude_mpm/services/agents/deployment/strategies/user_strategy.py +137 -0
- claude_mpm/services/agents/deployment/system_instructions_deployer.py +108 -0
- claude_mpm/services/agents/deployment/validation/__init__.py +19 -0
- claude_mpm/services/agents/deployment/validation/agent_validator.py +323 -0
- claude_mpm/services/agents/deployment/validation/deployment_validator.py +238 -0
- claude_mpm/services/agents/deployment/validation/template_validator.py +299 -0
- claude_mpm/services/agents/deployment/validation/validation_result.py +226 -0
- claude_mpm/services/agents/loading/__init__.py +2 -2
- claude_mpm/services/agents/loading/agent_profile_loader.py +259 -229
- claude_mpm/services/agents/loading/base_agent_manager.py +90 -81
- claude_mpm/services/agents/loading/framework_agent_loader.py +154 -129
- claude_mpm/services/agents/management/__init__.py +2 -2
- claude_mpm/services/agents/management/agent_capabilities_generator.py +72 -58
- claude_mpm/services/agents/management/agent_management_service.py +209 -156
- claude_mpm/services/agents/memory/__init__.py +9 -6
- claude_mpm/services/agents/memory/agent_memory_manager.py +218 -1152
- claude_mpm/services/agents/memory/agent_persistence_service.py +20 -16
- claude_mpm/services/agents/memory/analyzer.py +430 -0
- claude_mpm/services/agents/memory/content_manager.py +376 -0
- claude_mpm/services/agents/memory/template_generator.py +468 -0
- claude_mpm/services/agents/registry/__init__.py +7 -10
- claude_mpm/services/agents/registry/deployed_agent_discovery.py +122 -97
- claude_mpm/services/agents/registry/modification_tracker.py +351 -285
- claude_mpm/services/async_session_logger.py +187 -153
- claude_mpm/services/claude_session_logger.py +87 -72
- claude_mpm/services/command_handler_service.py +217 -0
- claude_mpm/services/communication/__init__.py +3 -2
- claude_mpm/services/core/__init__.py +50 -97
- claude_mpm/services/core/base.py +60 -53
- claude_mpm/services/core/interfaces/__init__.py +188 -0
- claude_mpm/services/core/interfaces/agent.py +351 -0
- claude_mpm/services/core/interfaces/communication.py +343 -0
- claude_mpm/services/core/interfaces/infrastructure.py +413 -0
- claude_mpm/services/core/interfaces/service.py +434 -0
- claude_mpm/services/core/interfaces.py +19 -944
- claude_mpm/services/event_aggregator.py +208 -170
- claude_mpm/services/exceptions.py +387 -308
- claude_mpm/services/framework_claude_md_generator/__init__.py +75 -79
- claude_mpm/services/framework_claude_md_generator/content_assembler.py +69 -60
- claude_mpm/services/framework_claude_md_generator/content_validator.py +65 -61
- claude_mpm/services/framework_claude_md_generator/deployment_manager.py +68 -49
- claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +34 -34
- claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +25 -22
- claude_mpm/services/framework_claude_md_generator/section_generators/claude_pm_init.py +10 -10
- claude_mpm/services/framework_claude_md_generator/section_generators/core_responsibilities.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/delegation_constraints.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/environment_config.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/footer.py +6 -5
- claude_mpm/services/framework_claude_md_generator/section_generators/header.py +8 -7
- claude_mpm/services/framework_claude_md_generator/section_generators/orchestration_principles.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/role_designation.py +6 -5
- claude_mpm/services/framework_claude_md_generator/section_generators/subprocess_validation.py +9 -8
- claude_mpm/services/framework_claude_md_generator/section_generators/todo_task_tools.py +4 -3
- claude_mpm/services/framework_claude_md_generator/section_generators/troubleshooting.py +5 -4
- claude_mpm/services/framework_claude_md_generator/section_manager.py +28 -27
- claude_mpm/services/framework_claude_md_generator/version_manager.py +30 -28
- claude_mpm/services/hook_service.py +106 -114
- claude_mpm/services/infrastructure/__init__.py +7 -5
- claude_mpm/services/infrastructure/context_preservation.py +233 -199
- claude_mpm/services/infrastructure/daemon_manager.py +279 -0
- claude_mpm/services/infrastructure/logging.py +83 -76
- claude_mpm/services/infrastructure/monitoring.py +547 -404
- claude_mpm/services/mcp_gateway/__init__.py +30 -13
- claude_mpm/services/mcp_gateway/config/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/config/config_loader.py +61 -56
- claude_mpm/services/mcp_gateway/config/config_schema.py +50 -41
- claude_mpm/services/mcp_gateway/config/configuration.py +82 -75
- claude_mpm/services/mcp_gateway/core/__init__.py +13 -20
- claude_mpm/services/mcp_gateway/core/base.py +80 -67
- claude_mpm/services/mcp_gateway/core/exceptions.py +60 -46
- claude_mpm/services/mcp_gateway/core/interfaces.py +87 -84
- claude_mpm/services/mcp_gateway/main.py +287 -137
- claude_mpm/services/mcp_gateway/registry/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/registry/service_registry.py +97 -94
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +135 -126
- claude_mpm/services/mcp_gateway/server/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/server/mcp_gateway.py +105 -110
- claude_mpm/services/mcp_gateway/server/stdio_handler.py +105 -107
- claude_mpm/services/mcp_gateway/server/stdio_server.py +691 -0
- claude_mpm/services/mcp_gateway/tools/__init__.py +4 -2
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +109 -119
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +283 -215
- claude_mpm/services/mcp_gateway/tools/hello_world.py +122 -120
- claude_mpm/services/mcp_gateway/tools/ticket_tools.py +652 -0
- claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +606 -0
- claude_mpm/services/memory/__init__.py +2 -2
- claude_mpm/services/memory/builder.py +451 -362
- claude_mpm/services/memory/cache/__init__.py +2 -2
- claude_mpm/services/memory/cache/shared_prompt_cache.py +232 -194
- claude_mpm/services/memory/cache/simple_cache.py +107 -93
- claude_mpm/services/memory/indexed_memory.py +195 -193
- claude_mpm/services/memory/optimizer.py +267 -234
- claude_mpm/services/memory/router.py +571 -263
- claude_mpm/services/memory_hook_service.py +237 -0
- claude_mpm/services/port_manager.py +575 -0
- claude_mpm/services/project/__init__.py +3 -3
- claude_mpm/services/project/analyzer.py +451 -305
- claude_mpm/services/project/registry.py +262 -240
- claude_mpm/services/recovery_manager.py +287 -231
- claude_mpm/services/response_tracker.py +87 -67
- claude_mpm/services/runner_configuration_service.py +587 -0
- claude_mpm/services/session_management_service.py +304 -0
- claude_mpm/services/socketio/__init__.py +4 -4
- claude_mpm/services/socketio/client_proxy.py +174 -0
- claude_mpm/services/socketio/handlers/__init__.py +3 -3
- claude_mpm/services/socketio/handlers/base.py +44 -30
- claude_mpm/services/socketio/handlers/connection.py +166 -64
- claude_mpm/services/socketio/handlers/file.py +123 -108
- claude_mpm/services/socketio/handlers/git.py +607 -373
- claude_mpm/services/socketio/handlers/hook.py +185 -0
- claude_mpm/services/socketio/handlers/memory.py +4 -4
- claude_mpm/services/socketio/handlers/project.py +4 -4
- claude_mpm/services/socketio/handlers/registry.py +53 -38
- claude_mpm/services/socketio/server/__init__.py +18 -0
- claude_mpm/services/socketio/server/broadcaster.py +252 -0
- claude_mpm/services/socketio/server/core.py +399 -0
- claude_mpm/services/socketio/server/main.py +323 -0
- claude_mpm/services/socketio_client_manager.py +160 -133
- claude_mpm/services/socketio_server.py +36 -1885
- claude_mpm/services/subprocess_launcher_service.py +316 -0
- claude_mpm/services/system_instructions_service.py +258 -0
- claude_mpm/services/ticket_manager.py +19 -533
- claude_mpm/services/utility_service.py +285 -0
- claude_mpm/services/version_control/__init__.py +18 -21
- claude_mpm/services/version_control/branch_strategy.py +20 -10
- claude_mpm/services/version_control/conflict_resolution.py +37 -13
- claude_mpm/services/version_control/git_operations.py +52 -21
- claude_mpm/services/version_control/semantic_versioning.py +92 -53
- claude_mpm/services/version_control/version_parser.py +145 -125
- claude_mpm/services/version_service.py +270 -0
- claude_mpm/storage/__init__.py +2 -2
- claude_mpm/storage/state_storage.py +177 -181
- claude_mpm/ticket_wrapper.py +2 -2
- claude_mpm/utils/__init__.py +2 -2
- claude_mpm/utils/agent_dependency_loader.py +453 -243
- claude_mpm/utils/config_manager.py +157 -118
- claude_mpm/utils/console.py +1 -1
- claude_mpm/utils/dependency_cache.py +102 -107
- claude_mpm/utils/dependency_manager.py +52 -47
- claude_mpm/utils/dependency_strategies.py +131 -96
- claude_mpm/utils/environment_context.py +110 -102
- claude_mpm/utils/error_handler.py +75 -55
- claude_mpm/utils/file_utils.py +80 -67
- claude_mpm/utils/framework_detection.py +12 -11
- claude_mpm/utils/import_migration_example.py +12 -60
- claude_mpm/utils/imports.py +48 -45
- claude_mpm/utils/path_operations.py +100 -93
- claude_mpm/utils/robust_installer.py +172 -164
- claude_mpm/utils/session_logging.py +30 -23
- claude_mpm/utils/subprocess_utils.py +99 -61
- claude_mpm/validation/__init__.py +1 -1
- claude_mpm/validation/agent_validator.py +151 -111
- claude_mpm/validation/frontmatter_validator.py +92 -71
- {claude_mpm-3.9.11.dist-info → claude_mpm-4.0.4.dist-info}/METADATA +90 -22
- claude_mpm-4.0.4.dist-info/RECORD +417 -0
- {claude_mpm-3.9.11.dist-info → claude_mpm-4.0.4.dist-info}/entry_points.txt +1 -0
- {claude_mpm-3.9.11.dist-info → claude_mpm-4.0.4.dist-info}/licenses/LICENSE +1 -1
- claude_mpm/cli/commands/run_guarded.py +0 -511
- claude_mpm/config/memory_guardian_config.py +0 -325
- claude_mpm/config/memory_guardian_yaml.py +0 -335
- claude_mpm/core/config_paths.py +0 -150
- claude_mpm/core/memory_aware_runner.py +0 -353
- claude_mpm/dashboard/static/js/dashboard-original.js +0 -4134
- claude_mpm/deployment_paths.py +0 -261
- claude_mpm/hooks/claude_hooks/hook_handler_fixed.py +0 -454
- claude_mpm/models/state_models.py +0 -433
- claude_mpm/services/agent/__init__.py +0 -24
- claude_mpm/services/agent/deployment.py +0 -2548
- claude_mpm/services/agent/management.py +0 -598
- claude_mpm/services/agent/registry.py +0 -813
- claude_mpm/services/agents/registry/agent_registry.py +0 -813
- claude_mpm/services/communication/socketio.py +0 -1935
- claude_mpm/services/communication/websocket.py +0 -479
- claude_mpm/services/framework_claude_md_generator.py +0 -624
- claude_mpm/services/health_monitor.py +0 -893
- claude_mpm/services/infrastructure/graceful_degradation.py +0 -616
- claude_mpm/services/infrastructure/health_monitor.py +0 -775
- claude_mpm/services/infrastructure/memory_dashboard.py +0 -479
- claude_mpm/services/infrastructure/memory_guardian.py +0 -944
- claude_mpm/services/infrastructure/restart_protection.py +0 -642
- claude_mpm/services/infrastructure/state_manager.py +0 -774
- claude_mpm/services/mcp_gateway/manager.py +0 -334
- claude_mpm/services/optimized_hook_service.py +0 -542
- claude_mpm/services/project_analyzer.py +0 -864
- claude_mpm/services/project_registry.py +0 -608
- claude_mpm/services/standalone_socketio_server.py +0 -1300
- claude_mpm/services/ticket_manager_di.py +0 -318
- claude_mpm/services/ticketing_service_original.py +0 -510
- claude_mpm/utils/paths.py +0 -395
- claude_mpm/utils/platform_memory.py +0 -524
- claude_mpm-3.9.11.dist-info/RECORD +0 -306
- {claude_mpm-3.9.11.dist-info → claude_mpm-4.0.4.dist-info}/WHEEL +0 -0
- {claude_mpm-3.9.11.dist-info → claude_mpm-4.0.4.dist-info}/top_level.txt +0 -0
| @@ -1,951 +1,26 @@ | |
| 1 1 | 
             
            """
         | 
| 2 | 
            -
            Core Service Interfaces for Claude  | 
| 3 | 
            -
             | 
| 2 | 
            +
            Core Service Interfaces for Claude MPM Framework
         | 
| 3 | 
            +
            ===============================================
         | 
| 4 4 |  | 
| 5 | 
            -
            This module  | 
| 6 | 
            -
             | 
| 5 | 
            +
            WHY: This module provides backward compatibility for the modular interface
         | 
| 6 | 
            +
            structure. The original 1,437-line monolithic file has been split into
         | 
| 7 | 
            +
            focused modules in the interfaces/ package.
         | 
| 7 8 |  | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
            - IAgentRegistry: Agent discovery and management
         | 
| 11 | 
            -
            - IPromptCache: Performance-critical caching 
         | 
| 12 | 
            -
            - IHealthMonitor: Service health monitoring
         | 
| 13 | 
            -
            - IConfigurationManager: Configuration management
         | 
| 14 | 
            -
            - ITemplateManager: Template processing and rendering
         | 
| 15 | 
            -
            - IServiceFactory: Service creation patterns
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            These interfaces reduce cyclomatic complexity and establish clean separation of concerns.
         | 
| 18 | 
            -
            """
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            from abc import ABC, abstractmethod
         | 
| 21 | 
            -
            from typing import Any, Dict, List, Optional, Set, Tuple, Union, TypeVar, Generic
         | 
| 22 | 
            -
            from dataclasses import dataclass
         | 
| 23 | 
            -
            from datetime import datetime
         | 
| 24 | 
            -
            from pathlib import Path
         | 
| 25 | 
            -
            import asyncio
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            # Type variables for generic interfaces
         | 
| 28 | 
            -
            T = TypeVar('T')
         | 
| 29 | 
            -
            ServiceType = TypeVar('ServiceType')
         | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
            # Core dependency injection interfaces
         | 
| 33 | 
            -
            class IServiceContainer(ABC):
         | 
| 34 | 
            -
                """Service container interface for dependency injection"""
         | 
| 35 | 
            -
                
         | 
| 36 | 
            -
                @abstractmethod
         | 
| 37 | 
            -
                def register(self, service_type: type, implementation: type, singleton: bool = True) -> None:
         | 
| 38 | 
            -
                    """Register a service implementation"""
         | 
| 39 | 
            -
                    pass
         | 
| 40 | 
            -
                
         | 
| 41 | 
            -
                @abstractmethod
         | 
| 42 | 
            -
                def register_instance(self, service_type: type, instance: Any) -> None:
         | 
| 43 | 
            -
                    """Register a service instance"""
         | 
| 44 | 
            -
                    pass
         | 
| 45 | 
            -
                
         | 
| 46 | 
            -
                @abstractmethod
         | 
| 47 | 
            -
                def resolve(self, service_type: type) -> Any:
         | 
| 48 | 
            -
                    """Resolve a service by type"""
         | 
| 49 | 
            -
                    pass
         | 
| 50 | 
            -
                
         | 
| 51 | 
            -
                @abstractmethod
         | 
| 52 | 
            -
                def resolve_all(self, service_type: type) -> List[Any]:
         | 
| 53 | 
            -
                    """Resolve all implementations of a service type"""
         | 
| 54 | 
            -
                    pass
         | 
| 55 | 
            -
                
         | 
| 56 | 
            -
                @abstractmethod
         | 
| 57 | 
            -
                def is_registered(self, service_type: type) -> bool:
         | 
| 58 | 
            -
                    """Check if a service type is registered"""
         | 
| 59 | 
            -
                    pass
         | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
            # Configuration management interfaces
         | 
| 63 | 
            -
            class IConfigurationService(ABC):
         | 
| 64 | 
            -
                """Interface for configuration service (legacy compatibility)"""
         | 
| 65 | 
            -
                
         | 
| 66 | 
            -
                @abstractmethod
         | 
| 67 | 
            -
                def get(self, key: str, default: Any = None) -> Any:
         | 
| 68 | 
            -
                    """Get configuration value by key"""
         | 
| 69 | 
            -
                    pass
         | 
| 70 | 
            -
                
         | 
| 71 | 
            -
                @abstractmethod
         | 
| 72 | 
            -
                def set(self, key: str, value: Any) -> None:
         | 
| 73 | 
            -
                    """Set configuration value"""
         | 
| 74 | 
            -
                    pass
         | 
| 75 | 
            -
                
         | 
| 76 | 
            -
                @abstractmethod
         | 
| 77 | 
            -
                def initialize(self) -> bool:
         | 
| 78 | 
            -
                    """Initialize configuration service"""
         | 
| 79 | 
            -
                    pass
         | 
| 80 | 
            -
                
         | 
| 81 | 
            -
                @abstractmethod
         | 
| 82 | 
            -
                def shutdown(self) -> None:
         | 
| 83 | 
            -
                    """Shutdown configuration service"""
         | 
| 84 | 
            -
                    pass
         | 
| 85 | 
            -
             | 
| 86 | 
            -
            class IConfigurationManager(ABC):
         | 
| 87 | 
            -
                """Interface for configuration management and validation"""
         | 
| 88 | 
            -
                
         | 
| 89 | 
            -
                @abstractmethod
         | 
| 90 | 
            -
                def get(self, key: str, default: Any = None) -> Any:
         | 
| 91 | 
            -
                    """Get configuration value by key"""
         | 
| 92 | 
            -
                    pass
         | 
| 93 | 
            -
                
         | 
| 94 | 
            -
                @abstractmethod
         | 
| 95 | 
            -
                def set(self, key: str, value: Any) -> None:
         | 
| 96 | 
            -
                    """Set configuration value"""
         | 
| 97 | 
            -
                    pass
         | 
| 98 | 
            -
                
         | 
| 99 | 
            -
                @abstractmethod
         | 
| 100 | 
            -
                def get_section(self, section: str) -> Dict[str, Any]:
         | 
| 101 | 
            -
                    """Get entire configuration section"""
         | 
| 102 | 
            -
                    pass
         | 
| 103 | 
            -
                
         | 
| 104 | 
            -
                @abstractmethod
         | 
| 105 | 
            -
                def validate_schema(self, schema: Dict[str, Any]) -> bool:
         | 
| 106 | 
            -
                    """Validate configuration against schema"""
         | 
| 107 | 
            -
                    pass
         | 
| 108 | 
            -
                
         | 
| 109 | 
            -
                @abstractmethod
         | 
| 110 | 
            -
                def reload(self) -> None:
         | 
| 111 | 
            -
                    """Reload configuration from sources"""
         | 
| 112 | 
            -
                    pass
         | 
| 113 | 
            -
                
         | 
| 114 | 
            -
                @abstractmethod
         | 
| 115 | 
            -
                def watch_changes(self, callback: callable) -> None:
         | 
| 116 | 
            -
                    """Watch for configuration changes"""
         | 
| 117 | 
            -
                    pass
         | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
            # Cache service interface
         | 
| 121 | 
            -
            class ICacheService(ABC):
         | 
| 122 | 
            -
                """Interface for cache service operations"""
         | 
| 123 | 
            -
                
         | 
| 124 | 
            -
                @abstractmethod
         | 
| 125 | 
            -
                def get(self, key: str) -> Any:
         | 
| 126 | 
            -
                    """Get value from cache"""
         | 
| 127 | 
            -
                    pass
         | 
| 128 | 
            -
                
         | 
| 129 | 
            -
                @abstractmethod
         | 
| 130 | 
            -
                def set(self, key: str, value: Any, ttl: Optional[int] = None) -> None:
         | 
| 131 | 
            -
                    """Set value in cache with optional TTL"""
         | 
| 132 | 
            -
                    pass
         | 
| 133 | 
            -
                
         | 
| 134 | 
            -
                @abstractmethod
         | 
| 135 | 
            -
                def delete(self, key: str) -> bool:
         | 
| 136 | 
            -
                    """Delete key from cache"""
         | 
| 137 | 
            -
                    pass
         | 
| 138 | 
            -
                
         | 
| 139 | 
            -
                @abstractmethod
         | 
| 140 | 
            -
                def invalidate(self, pattern: str) -> int:
         | 
| 141 | 
            -
                    """Invalidate keys matching pattern"""
         | 
| 142 | 
            -
                    pass
         | 
| 143 | 
            -
                
         | 
| 144 | 
            -
                @abstractmethod
         | 
| 145 | 
            -
                def clear(self) -> None:
         | 
| 146 | 
            -
                    """Clear all cache entries"""
         | 
| 147 | 
            -
                    pass
         | 
| 148 | 
            -
                
         | 
| 149 | 
            -
                @abstractmethod
         | 
| 150 | 
            -
                def get_cache_metrics(self) -> Dict[str, Any]:
         | 
| 151 | 
            -
                    """Get cache performance metrics"""
         | 
| 152 | 
            -
                    pass
         | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 155 | 
            -
            # Health monitoring interface
         | 
| 156 | 
            -
            @dataclass
         | 
| 157 | 
            -
            class HealthStatus:
         | 
| 158 | 
            -
                """Health status data structure"""
         | 
| 159 | 
            -
                status: str  # healthy, degraded, unhealthy, unknown
         | 
| 160 | 
            -
                message: str
         | 
| 161 | 
            -
                timestamp: datetime
         | 
| 162 | 
            -
                checks: Dict[str, bool]
         | 
| 163 | 
            -
                metrics: Dict[str, Any]
         | 
| 164 | 
            -
             | 
| 165 | 
            -
             | 
| 166 | 
            -
            class IHealthMonitor(ABC):
         | 
| 167 | 
            -
                """Interface for service health monitoring"""
         | 
| 168 | 
            -
                
         | 
| 169 | 
            -
                @abstractmethod
         | 
| 170 | 
            -
                async def check_health(self, service_name: str) -> HealthStatus:
         | 
| 171 | 
            -
                    """Check health of a specific service"""
         | 
| 172 | 
            -
                    pass
         | 
| 173 | 
            -
                
         | 
| 174 | 
            -
                @abstractmethod
         | 
| 175 | 
            -
                async def get_system_health(self) -> HealthStatus:
         | 
| 176 | 
            -
                    """Get overall system health"""
         | 
| 177 | 
            -
                    pass
         | 
| 178 | 
            -
                
         | 
| 179 | 
            -
                @abstractmethod
         | 
| 180 | 
            -
                def register_health_check(self, service_name: str, check_func: callable) -> None:
         | 
| 181 | 
            -
                    """Register a health check function"""
         | 
| 182 | 
            -
                    pass
         | 
| 183 | 
            -
                
         | 
| 184 | 
            -
                @abstractmethod
         | 
| 185 | 
            -
                async def start_monitoring(self) -> None:
         | 
| 186 | 
            -
                    """Start health monitoring"""
         | 
| 187 | 
            -
                    pass
         | 
| 188 | 
            -
                
         | 
| 189 | 
            -
                @abstractmethod
         | 
| 190 | 
            -
                async def stop_monitoring(self) -> None:
         | 
| 191 | 
            -
                    """Stop health monitoring"""
         | 
| 192 | 
            -
                    pass
         | 
| 193 | 
            -
             | 
| 194 | 
            -
             | 
| 195 | 
            -
            # Agent registry interface
         | 
| 196 | 
            -
            @dataclass
         | 
| 197 | 
            -
            class AgentMetadata:
         | 
| 198 | 
            -
                """Enhanced agent metadata with specialization and model configuration support"""
         | 
| 199 | 
            -
                name: str
         | 
| 200 | 
            -
                type: str
         | 
| 201 | 
            -
                path: str
         | 
| 202 | 
            -
                tier: str
         | 
| 203 | 
            -
                description: Optional[str] = None
         | 
| 204 | 
            -
                version: Optional[str] = None
         | 
| 205 | 
            -
                capabilities: List[str] = None
         | 
| 206 | 
            -
                specializations: List[str] = None
         | 
| 207 | 
            -
                frameworks: List[str] = None
         | 
| 208 | 
            -
                domains: List[str] = None
         | 
| 209 | 
            -
                roles: List[str] = None
         | 
| 210 | 
            -
                is_hybrid: bool = False
         | 
| 211 | 
            -
                validation_score: float = 0.0
         | 
| 212 | 
            -
                last_modified: Optional[float] = None
         | 
| 213 | 
            -
                # Model configuration fields
         | 
| 214 | 
            -
                preferred_model: Optional[str] = None
         | 
| 215 | 
            -
                model_config: Optional[Dict[str, Any]] = None
         | 
| 216 | 
            -
                
         | 
| 217 | 
            -
                def __post_init__(self):
         | 
| 218 | 
            -
                    """Initialize default values for list fields"""
         | 
| 219 | 
            -
                    if self.capabilities is None:
         | 
| 220 | 
            -
                        self.capabilities = []
         | 
| 221 | 
            -
                    if self.specializations is None:
         | 
| 222 | 
            -
                        self.specializations = []
         | 
| 223 | 
            -
                    if self.frameworks is None:
         | 
| 224 | 
            -
                        self.frameworks = []
         | 
| 225 | 
            -
                    if self.domains is None:
         | 
| 226 | 
            -
                        self.domains = []
         | 
| 227 | 
            -
                    if self.roles is None:
         | 
| 228 | 
            -
                        self.roles = []
         | 
| 229 | 
            -
                    if self.model_config is None:
         | 
| 230 | 
            -
                        self.model_config = {}
         | 
| 231 | 
            -
             | 
| 232 | 
            -
             | 
| 233 | 
            -
            class IAgentRegistry(ABC):
         | 
| 234 | 
            -
                """Interface for agent discovery and management"""
         | 
| 235 | 
            -
                
         | 
| 236 | 
            -
                @abstractmethod
         | 
| 237 | 
            -
                async def discover_agents(self, force_refresh: bool = False) -> Dict[str, AgentMetadata]:
         | 
| 238 | 
            -
                    """Discover all available agents"""
         | 
| 239 | 
            -
                    pass
         | 
| 240 | 
            -
                
         | 
| 241 | 
            -
                @abstractmethod
         | 
| 242 | 
            -
                async def get_agent(self, agent_name: str) -> Optional[AgentMetadata]:
         | 
| 243 | 
            -
                    """Get specific agent metadata"""
         | 
| 244 | 
            -
                    pass
         | 
| 245 | 
            -
                
         | 
| 246 | 
            -
                @abstractmethod
         | 
| 247 | 
            -
                async def list_agents(self, agent_type: Optional[str] = None, tier: Optional[str] = None) -> List[AgentMetadata]:
         | 
| 248 | 
            -
                    """List agents with optional filtering"""
         | 
| 249 | 
            -
                    pass
         | 
| 250 | 
            -
                
         | 
| 251 | 
            -
                @abstractmethod
         | 
| 252 | 
            -
                async def get_specialized_agents(self, agent_type: str) -> List[AgentMetadata]:
         | 
| 253 | 
            -
                    """Get agents of a specific specialized type"""
         | 
| 254 | 
            -
                    pass
         | 
| 255 | 
            -
                
         | 
| 256 | 
            -
                @abstractmethod
         | 
| 257 | 
            -
                async def search_by_capability(self, capability: str) -> List[AgentMetadata]:
         | 
| 258 | 
            -
                    """Search agents by capability"""
         | 
| 259 | 
            -
                    pass
         | 
| 260 | 
            -
                
         | 
| 261 | 
            -
                @abstractmethod
         | 
| 262 | 
            -
                async def get_registry_stats(self) -> Dict[str, Any]:
         | 
| 263 | 
            -
                    """Get registry statistics"""
         | 
| 264 | 
            -
                    pass
         | 
| 265 | 
            -
             | 
| 266 | 
            -
             | 
| 267 | 
            -
            # Prompt cache interface
         | 
| 268 | 
            -
            @dataclass
         | 
| 269 | 
            -
            class CacheEntry:
         | 
| 270 | 
            -
                """Cache entry with metadata"""
         | 
| 271 | 
            -
                key: str
         | 
| 272 | 
            -
                value: Any
         | 
| 273 | 
            -
                created_at: float
         | 
| 274 | 
            -
                ttl: Optional[float] = None
         | 
| 275 | 
            -
                access_count: int = 0
         | 
| 276 | 
            -
                last_accessed: float = 0.0
         | 
| 277 | 
            -
                size_bytes: int = 0
         | 
| 278 | 
            -
                metadata: Dict[str, Any] = None
         | 
| 279 | 
            -
                
         | 
| 280 | 
            -
                def __post_init__(self):
         | 
| 281 | 
            -
                    if self.metadata is None:
         | 
| 282 | 
            -
                        self.metadata = {}
         | 
| 283 | 
            -
             | 
| 284 | 
            -
             | 
| 285 | 
            -
            class IPromptCache(ABC):
         | 
| 286 | 
            -
                """Interface for high-performance prompt caching"""
         | 
| 287 | 
            -
                
         | 
| 288 | 
            -
                @abstractmethod
         | 
| 289 | 
            -
                def get(self, key: str) -> Optional[Any]:
         | 
| 290 | 
            -
                    """Get cached value by key"""
         | 
| 291 | 
            -
                    pass
         | 
| 292 | 
            -
                
         | 
| 293 | 
            -
                @abstractmethod
         | 
| 294 | 
            -
                def set(self, key: str, value: Any, ttl: Optional[float] = None, metadata: Optional[Dict[str, Any]] = None) -> bool:
         | 
| 295 | 
            -
                    """Set cached value with optional TTL"""
         | 
| 296 | 
            -
                    pass
         | 
| 297 | 
            -
                
         | 
| 298 | 
            -
                @abstractmethod
         | 
| 299 | 
            -
                def delete(self, key: str) -> bool:
         | 
| 300 | 
            -
                    """Delete cached value"""
         | 
| 301 | 
            -
                    pass
         | 
| 302 | 
            -
                
         | 
| 303 | 
            -
                @abstractmethod
         | 
| 304 | 
            -
                def invalidate(self, pattern: str) -> int:
         | 
| 305 | 
            -
                    """Invalidate cached values matching pattern"""
         | 
| 306 | 
            -
                    pass
         | 
| 307 | 
            -
                
         | 
| 308 | 
            -
                @abstractmethod
         | 
| 309 | 
            -
                def clear(self) -> None:
         | 
| 310 | 
            -
                    """Clear all cached values"""
         | 
| 311 | 
            -
                    pass
         | 
| 312 | 
            -
                
         | 
| 313 | 
            -
                @abstractmethod
         | 
| 314 | 
            -
                def get_metrics(self) -> Dict[str, Any]:
         | 
| 315 | 
            -
                    """Get cache performance metrics"""
         | 
| 316 | 
            -
                    pass
         | 
| 317 | 
            -
             | 
| 318 | 
            -
             | 
| 319 | 
            -
            # Template management interface
         | 
| 320 | 
            -
            @dataclass
         | 
| 321 | 
            -
            class TemplateRenderContext:
         | 
| 322 | 
            -
                """Context for template rendering"""
         | 
| 323 | 
            -
                variables: Dict[str, Any]
         | 
| 324 | 
            -
                metadata: Dict[str, Any]
         | 
| 325 | 
            -
                target_path: Optional[Path] = None
         | 
| 326 | 
            -
                template_id: Optional[str] = None
         | 
| 9 | 
            +
            DESIGN DECISION: We maintain this file for backward compatibility while the actual
         | 
| 10 | 
            +
            interface definitions have been moved to interfaces/ modules for better organization.
         | 
| 327 11 |  | 
| 12 | 
            +
            REFACTORING NOTE: The original interfaces.py file has been split into:
         | 
| 13 | 
            +
            - interfaces/infrastructure.py: Core framework services (DI, config, caching, health)
         | 
| 14 | 
            +
            - interfaces/agent.py: Agent management, deployment, and capabilities
         | 
| 15 | 
            +
            - interfaces/service.py: Business services (memory, hooks, utilities)
         | 
| 16 | 
            +
            - interfaces/communication.py: External communication (WebSocket, project analysis, tickets)
         | 
| 328 17 |  | 
| 329 | 
            -
             | 
| 330 | 
            -
             | 
| 331 | 
            -
             | 
| 332 | 
            -
                @abstractmethod
         | 
| 333 | 
            -
                async def render_template(self, template_content: str, context: TemplateRenderContext) -> str:
         | 
| 334 | 
            -
                    """Render template with given context"""
         | 
| 335 | 
            -
                    pass
         | 
| 336 | 
            -
                
         | 
| 337 | 
            -
                @abstractmethod
         | 
| 338 | 
            -
                async def load_template(self, template_id: str) -> Optional[str]:
         | 
| 339 | 
            -
                    """Load template by ID"""
         | 
| 340 | 
            -
                    pass
         | 
| 341 | 
            -
                
         | 
| 342 | 
            -
                @abstractmethod
         | 
| 343 | 
            -
                async def validate_template(self, template_content: str) -> Tuple[bool, List[str]]:
         | 
| 344 | 
            -
                    """Validate template syntax and variables"""
         | 
| 345 | 
            -
                    pass
         | 
| 346 | 
            -
                
         | 
| 347 | 
            -
                @abstractmethod
         | 
| 348 | 
            -
                def register_template_function(self, name: str, func: callable) -> None:
         | 
| 349 | 
            -
                    """Register custom template function"""
         | 
| 350 | 
            -
                    pass
         | 
| 351 | 
            -
             | 
| 352 | 
            -
             | 
| 353 | 
            -
            # Service factory interface
         | 
| 354 | 
            -
            class IServiceFactory(Generic[ServiceType], ABC):
         | 
| 355 | 
            -
                """Generic interface for service factories"""
         | 
| 356 | 
            -
                
         | 
| 357 | 
            -
                @abstractmethod
         | 
| 358 | 
            -
                def create(self, **kwargs) -> ServiceType:
         | 
| 359 | 
            -
                    """Create service instance"""
         | 
| 360 | 
            -
                    pass
         | 
| 361 | 
            -
                
         | 
| 362 | 
            -
                @abstractmethod
         | 
| 363 | 
            -
                def create_with_config(self, config: Dict[str, Any]) -> ServiceType:
         | 
| 364 | 
            -
                    """Create service instance with configuration"""
         | 
| 365 | 
            -
                    pass
         | 
| 366 | 
            -
                
         | 
| 367 | 
            -
                @abstractmethod
         | 
| 368 | 
            -
                def supports_type(self, service_type: type) -> bool:
         | 
| 369 | 
            -
                    """Check if factory supports service type"""
         | 
| 370 | 
            -
                    pass
         | 
| 371 | 
            -
             | 
| 372 | 
            -
             | 
| 373 | 
            -
            # Logging interface
         | 
| 374 | 
            -
            class IStructuredLogger(ABC):
         | 
| 375 | 
            -
                """Interface for structured logging"""
         | 
| 376 | 
            -
                
         | 
| 377 | 
            -
                @abstractmethod
         | 
| 378 | 
            -
                def debug(self, message: str, **kwargs) -> None:
         | 
| 379 | 
            -
                    """Log debug message with structured data"""
         | 
| 380 | 
            -
                    pass
         | 
| 381 | 
            -
                
         | 
| 382 | 
            -
                @abstractmethod
         | 
| 383 | 
            -
                def info(self, message: str, **kwargs) -> None:
         | 
| 384 | 
            -
                    """Log info message with structured data"""
         | 
| 385 | 
            -
                    pass
         | 
| 386 | 
            -
                
         | 
| 387 | 
            -
                @abstractmethod
         | 
| 388 | 
            -
                def warning(self, message: str, **kwargs) -> None:
         | 
| 389 | 
            -
                    """Log warning message with structured data"""
         | 
| 390 | 
            -
                    pass
         | 
| 391 | 
            -
                
         | 
| 392 | 
            -
                @abstractmethod
         | 
| 393 | 
            -
                def error(self, message: str, **kwargs) -> None:
         | 
| 394 | 
            -
                    """Log error message with structured data"""
         | 
| 395 | 
            -
                    pass
         | 
| 396 | 
            -
                
         | 
| 397 | 
            -
                @abstractmethod
         | 
| 398 | 
            -
                def critical(self, message: str, **kwargs) -> None:
         | 
| 399 | 
            -
                    """Log critical message with structured data"""
         | 
| 400 | 
            -
                    pass
         | 
| 401 | 
            -
                
         | 
| 402 | 
            -
                @abstractmethod
         | 
| 403 | 
            -
                def set_context(self, **kwargs) -> None:
         | 
| 404 | 
            -
                    """Set logging context for all subsequent messages"""
         | 
| 405 | 
            -
                    pass
         | 
| 406 | 
            -
             | 
| 407 | 
            -
             | 
| 408 | 
            -
            # Service lifecycle interface
         | 
| 409 | 
            -
            class IServiceLifecycle(ABC):
         | 
| 410 | 
            -
                """Interface for service lifecycle management"""
         | 
| 411 | 
            -
                
         | 
| 412 | 
            -
                @abstractmethod
         | 
| 413 | 
            -
                async def initialize(self) -> None:
         | 
| 414 | 
            -
                    """Initialize the service"""
         | 
| 415 | 
            -
                    pass
         | 
| 416 | 
            -
                
         | 
| 417 | 
            -
                @abstractmethod
         | 
| 418 | 
            -
                async def start(self) -> None:
         | 
| 419 | 
            -
                    """Start the service"""
         | 
| 420 | 
            -
                    pass
         | 
| 421 | 
            -
                
         | 
| 422 | 
            -
                @abstractmethod
         | 
| 423 | 
            -
                async def stop(self) -> None:
         | 
| 424 | 
            -
                    """Stop the service"""
         | 
| 425 | 
            -
                    pass
         | 
| 426 | 
            -
                
         | 
| 427 | 
            -
                @abstractmethod
         | 
| 428 | 
            -
                async def restart(self) -> None:
         | 
| 429 | 
            -
                    """Restart the service"""
         | 
| 430 | 
            -
                    pass
         | 
| 431 | 
            -
                
         | 
| 432 | 
            -
                @abstractmethod
         | 
| 433 | 
            -
                def is_running(self) -> bool:
         | 
| 434 | 
            -
                    """Check if service is running"""
         | 
| 435 | 
            -
                    pass
         | 
| 436 | 
            -
             | 
| 437 | 
            -
             | 
| 438 | 
            -
            # Error handling interface
         | 
| 439 | 
            -
            class IErrorHandler(ABC):
         | 
| 440 | 
            -
                """Interface for centralized error handling"""
         | 
| 441 | 
            -
                
         | 
| 442 | 
            -
                @abstractmethod
         | 
| 443 | 
            -
                def handle_error(self, error: Exception, context: Dict[str, Any]) -> None:
         | 
| 444 | 
            -
                    """Handle error with context"""
         | 
| 445 | 
            -
                    pass
         | 
| 446 | 
            -
                
         | 
| 447 | 
            -
                @abstractmethod
         | 
| 448 | 
            -
                def register_error_handler(self, error_type: type, handler: callable) -> None:
         | 
| 449 | 
            -
                    """Register error handler for specific error type"""
         | 
| 450 | 
            -
                    pass
         | 
| 451 | 
            -
                
         | 
| 452 | 
            -
                @abstractmethod
         | 
| 453 | 
            -
                def get_error_stats(self) -> Dict[str, Any]:
         | 
| 454 | 
            -
                    """Get error statistics"""
         | 
| 455 | 
            -
                    pass
         | 
| 456 | 
            -
             | 
| 457 | 
            -
             | 
| 458 | 
            -
            # Performance monitoring interface
         | 
| 459 | 
            -
            class IPerformanceMonitor(ABC):
         | 
| 460 | 
            -
                """Interface for performance monitoring"""
         | 
| 461 | 
            -
                
         | 
| 462 | 
            -
                @abstractmethod
         | 
| 463 | 
            -
                def start_timer(self, operation: str) -> str:
         | 
| 464 | 
            -
                    """Start timing an operation"""
         | 
| 465 | 
            -
                    pass
         | 
| 466 | 
            -
                
         | 
| 467 | 
            -
                @abstractmethod
         | 
| 468 | 
            -
                def stop_timer(self, timer_id: str) -> float:
         | 
| 469 | 
            -
                    """Stop timing and return duration"""
         | 
| 470 | 
            -
                    pass
         | 
| 471 | 
            -
                
         | 
| 472 | 
            -
                @abstractmethod
         | 
| 473 | 
            -
                def record_metric(self, name: str, value: float, tags: Optional[Dict[str, str]] = None) -> None:
         | 
| 474 | 
            -
                    """Record a performance metric"""
         | 
| 475 | 
            -
                    pass
         | 
| 476 | 
            -
                
         | 
| 477 | 
            -
                @abstractmethod
         | 
| 478 | 
            -
                def get_metrics(self) -> Dict[str, Any]:
         | 
| 479 | 
            -
                    """Get performance metrics"""
         | 
| 480 | 
            -
                    pass
         | 
| 481 | 
            -
             | 
| 482 | 
            -
             | 
| 483 | 
            -
            # Event system interface
         | 
| 484 | 
            -
            class IEventBus(ABC):
         | 
| 485 | 
            -
                """Interface for event-driven communication"""
         | 
| 486 | 
            -
                
         | 
| 487 | 
            -
                @abstractmethod
         | 
| 488 | 
            -
                def publish(self, event_type: str, data: Any) -> None:
         | 
| 489 | 
            -
                    """Publish an event"""
         | 
| 490 | 
            -
                    pass
         | 
| 491 | 
            -
                
         | 
| 492 | 
            -
                @abstractmethod
         | 
| 493 | 
            -
                def subscribe(self, event_type: str, handler: callable) -> str:
         | 
| 494 | 
            -
                    """Subscribe to events"""
         | 
| 495 | 
            -
                    pass
         | 
| 496 | 
            -
                
         | 
| 497 | 
            -
                @abstractmethod
         | 
| 498 | 
            -
                def unsubscribe(self, subscription_id: str) -> None:
         | 
| 499 | 
            -
                    """Unsubscribe from events"""
         | 
| 500 | 
            -
                    pass
         | 
| 501 | 
            -
                
         | 
| 502 | 
            -
                @abstractmethod
         | 
| 503 | 
            -
                async def publish_async(self, event_type: str, data: Any) -> None:
         | 
| 504 | 
            -
                    """Publish an event asynchronously"""
         | 
| 505 | 
            -
                    pass
         | 
| 506 | 
            -
             | 
| 507 | 
            -
             | 
| 508 | 
            -
            # Agent deployment interface
         | 
| 509 | 
            -
            class AgentDeploymentInterface(ABC):
         | 
| 510 | 
            -
                """Interface for agent deployment operations.
         | 
| 511 | 
            -
                
         | 
| 512 | 
            -
                WHY: Agent deployment needs to be decoupled from concrete implementations
         | 
| 513 | 
            -
                to enable different deployment strategies (local, remote, containerized).
         | 
| 514 | 
            -
                This interface ensures consistency across different deployment backends.
         | 
| 515 | 
            -
                
         | 
| 516 | 
            -
                DESIGN DECISION: Methods return deployment status/results to enable
         | 
| 517 | 
            -
                proper error handling and rollback operations when deployments fail.
         | 
| 518 | 
            -
                """
         | 
| 519 | 
            -
                
         | 
| 520 | 
            -
                @abstractmethod
         | 
| 521 | 
            -
                def deploy_agents(self, force: bool = False, include_all: bool = False) -> Dict[str, Any]:
         | 
| 522 | 
            -
                    """Deploy agents to target environment.
         | 
| 523 | 
            -
                    
         | 
| 524 | 
            -
                    Args:
         | 
| 525 | 
            -
                        force: Force deployment even if agents already exist
         | 
| 526 | 
            -
                        include_all: Include all agents, ignoring exclusion lists
         | 
| 527 | 
            -
                        
         | 
| 528 | 
            -
                    Returns:
         | 
| 529 | 
            -
                        Dictionary with deployment results and status
         | 
| 530 | 
            -
                    """
         | 
| 531 | 
            -
                    pass
         | 
| 532 | 
            -
                
         | 
| 533 | 
            -
                @abstractmethod
         | 
| 534 | 
            -
                def validate_agent(self, agent_path: Path) -> Tuple[bool, List[str]]:
         | 
| 535 | 
            -
                    """Validate agent configuration and structure.
         | 
| 536 | 
            -
                    
         | 
| 537 | 
            -
                    Args:
         | 
| 538 | 
            -
                        agent_path: Path to agent configuration file
         | 
| 539 | 
            -
                        
         | 
| 540 | 
            -
                    Returns:
         | 
| 541 | 
            -
                        Tuple of (is_valid, list_of_errors)
         | 
| 542 | 
            -
                    """
         | 
| 543 | 
            -
                    pass
         | 
| 544 | 
            -
                
         | 
| 545 | 
            -
                @abstractmethod
         | 
| 546 | 
            -
                def clean_deployment(self, preserve_user_agents: bool = True) -> bool:
         | 
| 547 | 
            -
                    """Clean up deployed agents.
         | 
| 548 | 
            -
                    
         | 
| 549 | 
            -
                    Args:
         | 
| 550 | 
            -
                        preserve_user_agents: Whether to keep user-created agents
         | 
| 551 | 
            -
                        
         | 
| 552 | 
            -
                    Returns:
         | 
| 553 | 
            -
                        True if cleanup successful
         | 
| 554 | 
            -
                    """
         | 
| 555 | 
            -
                    pass
         | 
| 556 | 
            -
                
         | 
| 557 | 
            -
                @abstractmethod
         | 
| 558 | 
            -
                def get_deployment_status(self) -> Dict[str, Any]:
         | 
| 559 | 
            -
                    """Get current deployment status and metrics.
         | 
| 560 | 
            -
                    
         | 
| 561 | 
            -
                    Returns:
         | 
| 562 | 
            -
                        Dictionary with deployment status information
         | 
| 563 | 
            -
                    """
         | 
| 564 | 
            -
                    pass
         | 
| 565 | 
            -
             | 
| 566 | 
            -
             | 
| 567 | 
            -
            # Memory service interface
         | 
| 568 | 
            -
            class MemoryServiceInterface(ABC):
         | 
| 569 | 
            -
                """Interface for memory management operations.
         | 
| 570 | 
            -
                
         | 
| 571 | 
            -
                WHY: Memory management is crucial for agent learning and context retention.
         | 
| 572 | 
            -
                This interface abstracts memory storage, retrieval, and optimization to
         | 
| 573 | 
            -
                enable different backends (file-based, database, distributed cache).
         | 
| 574 | 
            -
                
         | 
| 575 | 
            -
                DESIGN DECISION: Memory operations return success/failure status to enable
         | 
| 576 | 
            -
                proper error handling and fallback strategies when memory is unavailable.
         | 
| 577 | 
            -
                """
         | 
| 578 | 
            -
                
         | 
| 579 | 
            -
                @abstractmethod
         | 
| 580 | 
            -
                def load_memory(self, agent_id: str) -> Optional[str]:
         | 
| 581 | 
            -
                    """Load memory for a specific agent.
         | 
| 582 | 
            -
                    
         | 
| 583 | 
            -
                    Args:
         | 
| 584 | 
            -
                        agent_id: Identifier of the agent
         | 
| 585 | 
            -
                        
         | 
| 586 | 
            -
                    Returns:
         | 
| 587 | 
            -
                        Memory content as string or None if not found
         | 
| 588 | 
            -
                    """
         | 
| 589 | 
            -
                    pass
         | 
| 590 | 
            -
                
         | 
| 591 | 
            -
                @abstractmethod
         | 
| 592 | 
            -
                def save_memory(self, agent_id: str, content: str) -> bool:
         | 
| 593 | 
            -
                    """Save memory for a specific agent.
         | 
| 594 | 
            -
                    
         | 
| 595 | 
            -
                    Args:
         | 
| 596 | 
            -
                        agent_id: Identifier of the agent
         | 
| 597 | 
            -
                        content: Memory content to save
         | 
| 598 | 
            -
                        
         | 
| 599 | 
            -
                    Returns:
         | 
| 600 | 
            -
                        True if save successful
         | 
| 601 | 
            -
                    """
         | 
| 602 | 
            -
                    pass
         | 
| 603 | 
            -
                
         | 
| 604 | 
            -
                @abstractmethod
         | 
| 605 | 
            -
                def validate_memory_size(self, content: str) -> Tuple[bool, Optional[str]]:
         | 
| 606 | 
            -
                    """Validate memory content size and structure.
         | 
| 607 | 
            -
                    
         | 
| 608 | 
            -
                    Args:
         | 
| 609 | 
            -
                        content: Memory content to validate
         | 
| 610 | 
            -
                        
         | 
| 611 | 
            -
                    Returns:
         | 
| 612 | 
            -
                        Tuple of (is_valid, error_message)
         | 
| 613 | 
            -
                    """
         | 
| 614 | 
            -
                    pass
         | 
| 615 | 
            -
                
         | 
| 616 | 
            -
                @abstractmethod
         | 
| 617 | 
            -
                def optimize_memory(self, agent_id: str) -> bool:
         | 
| 618 | 
            -
                    """Optimize memory by removing duplicates and consolidating entries.
         | 
| 619 | 
            -
                    
         | 
| 620 | 
            -
                    Args:
         | 
| 621 | 
            -
                        agent_id: Identifier of the agent
         | 
| 622 | 
            -
                        
         | 
| 623 | 
            -
                    Returns:
         | 
| 624 | 
            -
                        True if optimization successful
         | 
| 625 | 
            -
                    """
         | 
| 626 | 
            -
                    pass
         | 
| 627 | 
            -
                
         | 
| 628 | 
            -
                @abstractmethod
         | 
| 629 | 
            -
                def get_memory_metrics(self, agent_id: Optional[str] = None) -> Dict[str, Any]:
         | 
| 630 | 
            -
                    """Get memory usage metrics.
         | 
| 631 | 
            -
                    
         | 
| 632 | 
            -
                    Args:
         | 
| 633 | 
            -
                        agent_id: Optional specific agent ID, or None for all
         | 
| 634 | 
            -
                        
         | 
| 635 | 
            -
                    Returns:
         | 
| 636 | 
            -
                        Dictionary with memory metrics
         | 
| 637 | 
            -
                    """
         | 
| 638 | 
            -
                    pass
         | 
| 639 | 
            -
             | 
| 640 | 
            -
             | 
| 641 | 
            -
            # Hook service interface
         | 
| 642 | 
            -
            class HookServiceInterface(ABC):
         | 
| 643 | 
            -
                """Interface for hook execution operations.
         | 
| 644 | 
            -
                
         | 
| 645 | 
            -
                WHY: Hooks provide extensibility points for the framework, allowing plugins
         | 
| 646 | 
            -
                and extensions to modify behavior. This interface ensures consistent hook
         | 
| 647 | 
            -
                registration, priority handling, and execution across different hook systems.
         | 
| 648 | 
            -
                
         | 
| 649 | 
            -
                DESIGN DECISION: Separate pre/post delegation methods for clarity and
         | 
| 650 | 
            -
                performance - no runtime type checking needed during execution.
         | 
| 651 | 
            -
                """
         | 
| 652 | 
            -
                
         | 
| 653 | 
            -
                @abstractmethod
         | 
| 654 | 
            -
                def register_hook(self, hook: Any) -> bool:
         | 
| 655 | 
            -
                    """Register a hook with the service.
         | 
| 656 | 
            -
                    
         | 
| 657 | 
            -
                    Args:
         | 
| 658 | 
            -
                        hook: Hook instance to register
         | 
| 659 | 
            -
                        
         | 
| 660 | 
            -
                    Returns:
         | 
| 661 | 
            -
                        True if registration successful
         | 
| 662 | 
            -
                    """
         | 
| 663 | 
            -
                    pass
         | 
| 664 | 
            -
                
         | 
| 665 | 
            -
                @abstractmethod
         | 
| 666 | 
            -
                def execute_pre_delegation_hooks(self, context: Any) -> Any:
         | 
| 667 | 
            -
                    """Execute all pre-delegation hooks.
         | 
| 668 | 
            -
                    
         | 
| 669 | 
            -
                    Args:
         | 
| 670 | 
            -
                        context: Hook execution context
         | 
| 671 | 
            -
                        
         | 
| 672 | 
            -
                    Returns:
         | 
| 673 | 
            -
                        Hook execution result
         | 
| 674 | 
            -
                    """
         | 
| 675 | 
            -
                    pass
         | 
| 676 | 
            -
                
         | 
| 677 | 
            -
                @abstractmethod
         | 
| 678 | 
            -
                def execute_post_delegation_hooks(self, context: Any) -> Any:
         | 
| 679 | 
            -
                    """Execute all post-delegation hooks.
         | 
| 680 | 
            -
                    
         | 
| 681 | 
            -
                    Args:
         | 
| 682 | 
            -
                        context: Hook execution context
         | 
| 683 | 
            -
                        
         | 
| 684 | 
            -
                    Returns:
         | 
| 685 | 
            -
                        Hook execution result
         | 
| 686 | 
            -
                    """
         | 
| 687 | 
            -
                    pass
         | 
| 688 | 
            -
                
         | 
| 689 | 
            -
                @abstractmethod
         | 
| 690 | 
            -
                def get_registered_hooks(self) -> Dict[str, List[Any]]:
         | 
| 691 | 
            -
                    """Get all registered hooks by type.
         | 
| 692 | 
            -
                    
         | 
| 693 | 
            -
                    Returns:
         | 
| 694 | 
            -
                        Dictionary mapping hook types to lists of hooks
         | 
| 695 | 
            -
                    """
         | 
| 696 | 
            -
                    pass
         | 
| 697 | 
            -
                
         | 
| 698 | 
            -
                @abstractmethod
         | 
| 699 | 
            -
                def clear_hooks(self, hook_type: Optional[str] = None) -> None:
         | 
| 700 | 
            -
                    """Clear registered hooks.
         | 
| 701 | 
            -
                    
         | 
| 702 | 
            -
                    Args:
         | 
| 703 | 
            -
                        hook_type: Optional specific hook type to clear, or None for all
         | 
| 704 | 
            -
                    """
         | 
| 705 | 
            -
                    pass
         | 
| 706 | 
            -
             | 
| 707 | 
            -
             | 
| 708 | 
            -
            # WebSocket/SocketIO service interface
         | 
| 709 | 
            -
            class SocketIOServiceInterface(ABC):
         | 
| 710 | 
            -
                """Interface for WebSocket communication.
         | 
| 711 | 
            -
                
         | 
| 712 | 
            -
                WHY: Real-time communication is essential for monitoring and interactive
         | 
| 713 | 
            -
                features. This interface abstracts WebSocket/SocketIO implementation to
         | 
| 714 | 
            -
                enable different transport mechanisms and fallback strategies.
         | 
| 715 | 
            -
                
         | 
| 716 | 
            -
                DESIGN DECISION: Async methods for non-blocking I/O operations, with
         | 
| 717 | 
            -
                support for both broadcast and targeted messaging.
         | 
| 718 | 
            -
                """
         | 
| 719 | 
            -
                
         | 
| 720 | 
            -
                @abstractmethod
         | 
| 721 | 
            -
                async def start(self, host: str = "localhost", port: int = 8765) -> None:
         | 
| 722 | 
            -
                    """Start the WebSocket server.
         | 
| 723 | 
            -
                    
         | 
| 724 | 
            -
                    Args:
         | 
| 725 | 
            -
                        host: Host to bind to
         | 
| 726 | 
            -
                        port: Port to listen on
         | 
| 727 | 
            -
                    """
         | 
| 728 | 
            -
                    pass
         | 
| 729 | 
            -
                
         | 
| 730 | 
            -
                @abstractmethod
         | 
| 731 | 
            -
                async def stop(self) -> None:
         | 
| 732 | 
            -
                    """Stop the WebSocket server."""
         | 
| 733 | 
            -
                    pass
         | 
| 734 | 
            -
                
         | 
| 735 | 
            -
                @abstractmethod
         | 
| 736 | 
            -
                async def emit(self, event: str, data: Any, room: Optional[str] = None) -> None:
         | 
| 737 | 
            -
                    """Emit an event to connected clients.
         | 
| 738 | 
            -
                    
         | 
| 739 | 
            -
                    Args:
         | 
| 740 | 
            -
                        event: Event name
         | 
| 741 | 
            -
                        data: Event data
         | 
| 742 | 
            -
                        room: Optional room to target
         | 
| 743 | 
            -
                    """
         | 
| 744 | 
            -
                    pass
         | 
| 745 | 
            -
                
         | 
| 746 | 
            -
                @abstractmethod
         | 
| 747 | 
            -
                async def broadcast(self, event: str, data: Any) -> None:
         | 
| 748 | 
            -
                    """Broadcast event to all connected clients.
         | 
| 749 | 
            -
                    
         | 
| 750 | 
            -
                    Args:
         | 
| 751 | 
            -
                        event: Event name
         | 
| 752 | 
            -
                        data: Event data
         | 
| 753 | 
            -
                    """
         | 
| 754 | 
            -
                    pass
         | 
| 755 | 
            -
                
         | 
| 756 | 
            -
                @abstractmethod
         | 
| 757 | 
            -
                def get_connection_count(self) -> int:
         | 
| 758 | 
            -
                    """Get number of connected clients.
         | 
| 759 | 
            -
                    
         | 
| 760 | 
            -
                    Returns:
         | 
| 761 | 
            -
                        Number of active connections
         | 
| 762 | 
            -
                    """
         | 
| 763 | 
            -
                    pass
         | 
| 764 | 
            -
                
         | 
| 765 | 
            -
                @abstractmethod
         | 
| 766 | 
            -
                def is_running(self) -> bool:
         | 
| 767 | 
            -
                    """Check if server is running.
         | 
| 768 | 
            -
                    
         | 
| 769 | 
            -
                    Returns:
         | 
| 770 | 
            -
                        True if server is active
         | 
| 771 | 
            -
                    """
         | 
| 772 | 
            -
                    pass
         | 
| 773 | 
            -
             | 
| 774 | 
            -
             | 
| 775 | 
            -
            # Project analyzer interface
         | 
| 776 | 
            -
            class ProjectAnalyzerInterface(ABC):
         | 
| 777 | 
            -
                """Interface for project analysis operations.
         | 
| 778 | 
            -
                
         | 
| 779 | 
            -
                WHY: Understanding project structure and characteristics is essential for
         | 
| 780 | 
            -
                context-aware agent behavior. This interface abstracts project analysis
         | 
| 781 | 
            -
                to support different project types and structures.
         | 
| 782 | 
            -
                
         | 
| 783 | 
            -
                DESIGN DECISION: Returns structured data classes for type safety and
         | 
| 784 | 
            -
                clear contracts between analysis and consumption components.
         | 
| 785 | 
            -
                """
         | 
| 786 | 
            -
                
         | 
| 787 | 
            -
                @abstractmethod
         | 
| 788 | 
            -
                def analyze_project(self, project_path: Optional[Path] = None) -> Any:
         | 
| 789 | 
            -
                    """Analyze project characteristics.
         | 
| 790 | 
            -
                    
         | 
| 791 | 
            -
                    Args:
         | 
| 792 | 
            -
                        project_path: Optional path to project, defaults to current
         | 
| 793 | 
            -
                        
         | 
| 794 | 
            -
                    Returns:
         | 
| 795 | 
            -
                        ProjectCharacteristics or similar structured data
         | 
| 796 | 
            -
                    """
         | 
| 797 | 
            -
                    pass
         | 
| 798 | 
            -
                
         | 
| 799 | 
            -
                @abstractmethod
         | 
| 800 | 
            -
                def detect_technology_stack(self) -> List[str]:
         | 
| 801 | 
            -
                    """Detect technologies used in the project.
         | 
| 802 | 
            -
                    
         | 
| 803 | 
            -
                    Returns:
         | 
| 804 | 
            -
                        List of detected technologies
         | 
| 805 | 
            -
                    """
         | 
| 806 | 
            -
                    pass
         | 
| 807 | 
            -
                
         | 
| 808 | 
            -
                @abstractmethod
         | 
| 809 | 
            -
                def analyze_code_patterns(self) -> Dict[str, Any]:
         | 
| 810 | 
            -
                    """Analyze code patterns and conventions.
         | 
| 811 | 
            -
                    
         | 
| 812 | 
            -
                    Returns:
         | 
| 813 | 
            -
                        Dictionary of pattern analysis results
         | 
| 814 | 
            -
                    """
         | 
| 815 | 
            -
                    pass
         | 
| 816 | 
            -
                
         | 
| 817 | 
            -
                @abstractmethod
         | 
| 818 | 
            -
                def get_project_structure(self) -> Dict[str, Any]:
         | 
| 819 | 
            -
                    """Get project directory structure analysis.
         | 
| 820 | 
            -
                    
         | 
| 821 | 
            -
                    Returns:
         | 
| 822 | 
            -
                        Dictionary representing project structure
         | 
| 823 | 
            -
                    """
         | 
| 824 | 
            -
                    pass
         | 
| 825 | 
            -
                
         | 
| 826 | 
            -
                @abstractmethod
         | 
| 827 | 
            -
                def identify_entry_points(self) -> List[Path]:
         | 
| 828 | 
            -
                    """Identify project entry points.
         | 
| 829 | 
            -
                    
         | 
| 830 | 
            -
                    Returns:
         | 
| 831 | 
            -
                        List of entry point paths
         | 
| 832 | 
            -
                    """
         | 
| 833 | 
            -
                    pass
         | 
| 834 | 
            -
             | 
| 835 | 
            -
             | 
| 836 | 
            -
            # Ticket manager interface
         | 
| 837 | 
            -
            class TicketManagerInterface(ABC):
         | 
| 838 | 
            -
                """Interface for ticket management operations.
         | 
| 839 | 
            -
                
         | 
| 840 | 
            -
                WHY: Ticket management provides work tracking and organization. This
         | 
| 841 | 
            -
                interface abstracts ticket operations to support different backend
         | 
| 842 | 
            -
                systems (file-based, API-based, database).
         | 
| 843 | 
            -
                
         | 
| 844 | 
            -
                DESIGN DECISION: Uses string IDs for flexibility across different
         | 
| 845 | 
            -
                ticketing systems, with structured data returns for consistency.
         | 
| 846 | 
            -
                """
         | 
| 847 | 
            -
                
         | 
| 848 | 
            -
                @abstractmethod
         | 
| 849 | 
            -
                def create_task(self, title: str, description: str, **kwargs) -> Optional[str]:
         | 
| 850 | 
            -
                    """Create a new task ticket.
         | 
| 851 | 
            -
                    
         | 
| 852 | 
            -
                    Args:
         | 
| 853 | 
            -
                        title: Task title
         | 
| 854 | 
            -
                        description: Task description
         | 
| 855 | 
            -
                        **kwargs: Additional task properties
         | 
| 856 | 
            -
                        
         | 
| 857 | 
            -
                    Returns:
         | 
| 858 | 
            -
                        Task ID if created successfully, None otherwise
         | 
| 859 | 
            -
                    """
         | 
| 860 | 
            -
                    pass
         | 
| 861 | 
            -
                
         | 
| 862 | 
            -
                @abstractmethod
         | 
| 863 | 
            -
                def update_task(self, task_id: str, **updates) -> bool:
         | 
| 864 | 
            -
                    """Update an existing task.
         | 
| 865 | 
            -
                    
         | 
| 866 | 
            -
                    Args:
         | 
| 867 | 
            -
                        task_id: ID of task to update
         | 
| 868 | 
            -
                        **updates: Fields to update
         | 
| 869 | 
            -
                        
         | 
| 870 | 
            -
                    Returns:
         | 
| 871 | 
            -
                        True if update successful
         | 
| 872 | 
            -
                    """
         | 
| 873 | 
            -
                    pass
         | 
| 874 | 
            -
                
         | 
| 875 | 
            -
                @abstractmethod
         | 
| 876 | 
            -
                def get_task(self, task_id: str) -> Optional[Dict[str, Any]]:
         | 
| 877 | 
            -
                    """Get task details.
         | 
| 878 | 
            -
                    
         | 
| 879 | 
            -
                    Args:
         | 
| 880 | 
            -
                        task_id: ID of task to retrieve
         | 
| 881 | 
            -
                        
         | 
| 882 | 
            -
                    Returns:
         | 
| 883 | 
            -
                        Task data dictionary or None if not found
         | 
| 884 | 
            -
                    """
         | 
| 885 | 
            -
                    pass
         | 
| 886 | 
            -
                
         | 
| 887 | 
            -
                @abstractmethod
         | 
| 888 | 
            -
                def list_tasks(self, status: Optional[str] = None, **filters) -> List[Dict[str, Any]]:
         | 
| 889 | 
            -
                    """List tasks with optional filtering.
         | 
| 890 | 
            -
                    
         | 
| 891 | 
            -
                    Args:
         | 
| 892 | 
            -
                        status: Optional status filter
         | 
| 893 | 
            -
                        **filters: Additional filter criteria
         | 
| 894 | 
            -
                        
         | 
| 895 | 
            -
                    Returns:
         | 
| 896 | 
            -
                        List of task dictionaries
         | 
| 897 | 
            -
                    """
         | 
| 898 | 
            -
                    pass
         | 
| 899 | 
            -
                
         | 
| 900 | 
            -
                @abstractmethod
         | 
| 901 | 
            -
                def close_task(self, task_id: str, resolution: Optional[str] = None) -> bool:
         | 
| 902 | 
            -
                    """Close a task.
         | 
| 903 | 
            -
                    
         | 
| 904 | 
            -
                    Args:
         | 
| 905 | 
            -
                        task_id: ID of task to close
         | 
| 906 | 
            -
                        resolution: Optional resolution description
         | 
| 907 | 
            -
                        
         | 
| 908 | 
            -
                    Returns:
         | 
| 909 | 
            -
                        True if close successful
         | 
| 910 | 
            -
                    """
         | 
| 911 | 
            -
                    pass
         | 
| 18 | 
            +
            IMPACT: Reduced from 1,437 lines to ~50 lines, with functionality split across
         | 
| 19 | 
            +
            focused modules for better maintainability and testing.
         | 
| 20 | 
            +
            """
         | 
| 912 21 |  | 
| 22 | 
            +
            # Re-export everything from the new modular structure for backward compatibility
         | 
| 23 | 
            +
            from .interfaces import *
         | 
| 913 24 |  | 
| 914 | 
            -
            #  | 
| 915 | 
            -
             | 
| 916 | 
            -
                """Registry of all core interfaces for dependency injection"""
         | 
| 917 | 
            -
                
         | 
| 918 | 
            -
                _interfaces = {
         | 
| 919 | 
            -
                    'service_container': IServiceContainer,
         | 
| 920 | 
            -
                    'configuration_manager': IConfigurationManager,
         | 
| 921 | 
            -
                    'health_monitor': IHealthMonitor,
         | 
| 922 | 
            -
                    'agent_registry': IAgentRegistry,
         | 
| 923 | 
            -
                    'prompt_cache': IPromptCache,
         | 
| 924 | 
            -
                    'template_manager': ITemplateManager,
         | 
| 925 | 
            -
                    'structured_logger': IStructuredLogger,
         | 
| 926 | 
            -
                    'service_lifecycle': IServiceLifecycle,
         | 
| 927 | 
            -
                    'error_handler': IErrorHandler,
         | 
| 928 | 
            -
                    'performance_monitor': IPerformanceMonitor,
         | 
| 929 | 
            -
                    'event_bus': IEventBus,
         | 
| 930 | 
            -
                    'agent_deployment': AgentDeploymentInterface,
         | 
| 931 | 
            -
                    'memory_service': MemoryServiceInterface,
         | 
| 932 | 
            -
                    'hook_service': HookServiceInterface,
         | 
| 933 | 
            -
                    'socketio_service': SocketIOServiceInterface,
         | 
| 934 | 
            -
                    'project_analyzer': ProjectAnalyzerInterface,
         | 
| 935 | 
            -
                    'ticket_manager': TicketManagerInterface,
         | 
| 936 | 
            -
                }
         | 
| 937 | 
            -
                
         | 
| 938 | 
            -
                @classmethod
         | 
| 939 | 
            -
                def get_interface(cls, name: str) -> Optional[type]:
         | 
| 940 | 
            -
                    """Get interface by name"""
         | 
| 941 | 
            -
                    return cls._interfaces.get(name)
         | 
| 942 | 
            -
                
         | 
| 943 | 
            -
                @classmethod
         | 
| 944 | 
            -
                def get_all_interfaces(cls) -> Dict[str, type]:
         | 
| 945 | 
            -
                    """Get all registered interfaces"""
         | 
| 946 | 
            -
                    return cls._interfaces.copy()
         | 
| 947 | 
            -
                
         | 
| 948 | 
            -
                @classmethod
         | 
| 949 | 
            -
                def register_interface(cls, name: str, interface: type) -> None:
         | 
| 950 | 
            -
                    """Register a new interface"""
         | 
| 951 | 
            -
                    cls._interfaces[name] = interface
         | 
| 25 | 
            +
            # All interface definitions have been moved to the interfaces/ package
         | 
| 26 | 
            +
            # This file now serves as a compatibility layer that delegates to the modular structure
         |