claude-mpm 3.9.9__py3-none-any.whl → 4.0.3__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 +155 -0
- 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 +1 -1
- 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 +90 -49
- claude_mpm/cli/__main__.py +3 -2
- claude_mpm/cli/commands/__init__.py +21 -18
- 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 +143 -762
- 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 +203 -81
- 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 +305 -197
- claude_mpm/cli/parser.py +24 -1150
- 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 +104 -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 +217 -0
- claude_mpm/config/paths.py +94 -208
- claude_mpm/config/socketio_config.py +84 -73
- claude_mpm/constants.py +36 -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/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 +74 -70
- claude_mpm/dashboard/static/js/components/export-manager.js +31 -28
- claude_mpm/dashboard/static/js/components/file-tool-tracker.js +106 -92
- 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 +120 -54
- 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 +571 -0
- 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 +40 -23
- 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 +14 -21
- 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 +97 -93
- claude_mpm/services/mcp_gateway/main.py +307 -127
- claude_mpm/services/mcp_gateway/registry/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/registry/service_registry.py +100 -101
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +135 -126
- claude_mpm/services/mcp_gateway/server/__init__.py +4 -4
- claude_mpm/services/mcp_gateway/server/{mcp_server.py → mcp_gateway.py} +149 -153
- 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 +110 -121
- 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 +223 -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 +145 -65
- 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 +170 -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 +20 -534
- 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 +9 -0
- claude_mpm/storage/state_storage.py +552 -0
- 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.9.dist-info → claude_mpm-4.0.3.dist-info}/METADATA +51 -2
- claude_mpm-4.0.3.dist-info/RECORD +402 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/entry_points.txt +1 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/licenses/LICENSE +1 -1
- claude_mpm/config/memory_guardian_config.py +0 -325
- claude_mpm/core/config_paths.py +0 -150
- 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/memory_guardian.py +0 -770
- claude_mpm/services/mcp_gateway/server/mcp_server_simple.py +0 -444
- 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.9.dist-info/RECORD +0 -293
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/WHEEL +0 -0
- {claude_mpm-3.9.9.dist-info → claude_mpm-4.0.3.dist-info}/top_level.txt +0 -0
| @@ -0,0 +1,550 @@ | |
| 1 | 
            +
            """
         | 
| 2 | 
            +
            Unified Configuration Service for Claude MPM.
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            This module provides a centralized, type-safe configuration management system
         | 
| 5 | 
            +
            using Pydantic models for validation and dependency injection for service access.
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Design Principles:
         | 
| 8 | 
            +
            1. Single source of truth for all configuration
         | 
| 9 | 
            +
            2. Type safety with Pydantic models
         | 
| 10 | 
            +
            3. Environment variable support with validation
         | 
| 11 | 
            +
            4. Hierarchical configuration with defaults
         | 
| 12 | 
            +
            5. Injectable service for dependency injection
         | 
| 13 | 
            +
            6. Backward compatibility with existing config systems
         | 
| 14 | 
            +
            """
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            import os
         | 
| 17 | 
            +
            from pathlib import Path
         | 
| 18 | 
            +
            from typing import Any, Dict, List, Optional, Union
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            from pydantic import BaseModel, Field, validator
         | 
| 21 | 
            +
            from pydantic_settings import BaseSettings
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            from .exceptions import ConfigurationError
         | 
| 24 | 
            +
             | 
| 25 | 
            +
             | 
| 26 | 
            +
            class NetworkConfig(BaseModel):
         | 
| 27 | 
            +
                """Network and connection configuration."""
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                socketio_host: str = Field(default="localhost", description="SocketIO server host")
         | 
| 30 | 
            +
                socketio_port: int = Field(
         | 
| 31 | 
            +
                    default=8765, ge=1024, le=65535, description="SocketIO server port"
         | 
| 32 | 
            +
                )
         | 
| 33 | 
            +
                socketio_port_range: List[int] = Field(
         | 
| 34 | 
            +
                    default=[8765, 8775], description="Port range for SocketIO"
         | 
| 35 | 
            +
                )
         | 
| 36 | 
            +
                connection_timeout: int = Field(
         | 
| 37 | 
            +
                    default=30, ge=1, description="Connection timeout in seconds"
         | 
| 38 | 
            +
                )
         | 
| 39 | 
            +
                max_retries: int = Field(default=3, ge=0, description="Maximum connection retries")
         | 
| 40 | 
            +
             | 
| 41 | 
            +
             | 
| 42 | 
            +
            class LoggingConfig(BaseModel):
         | 
| 43 | 
            +
                """Logging configuration."""
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                level: str = Field(default="INFO", description="Log level")
         | 
| 46 | 
            +
                max_size_mb: int = Field(
         | 
| 47 | 
            +
                    default=100, ge=1, description="Maximum log file size in MB"
         | 
| 48 | 
            +
                )
         | 
| 49 | 
            +
                retention_days: int = Field(
         | 
| 50 | 
            +
                    default=30, ge=1, description="Log retention period in days"
         | 
| 51 | 
            +
                )
         | 
| 52 | 
            +
                format: str = Field(default="json", description="Log format (json, text)")
         | 
| 53 | 
            +
                enable_file_logging: bool = Field(default=True, description="Enable file logging")
         | 
| 54 | 
            +
                enable_console_logging: bool = Field(
         | 
| 55 | 
            +
                    default=True, description="Enable console logging"
         | 
| 56 | 
            +
                )
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                @validator("level")
         | 
| 59 | 
            +
                def validate_log_level(cls, v):
         | 
| 60 | 
            +
                    valid_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
         | 
| 61 | 
            +
                    if v.upper() not in valid_levels:
         | 
| 62 | 
            +
                        raise ValueError(f"Invalid log level. Must be one of: {valid_levels}")
         | 
| 63 | 
            +
                    return v.upper()
         | 
| 64 | 
            +
             | 
| 65 | 
            +
             | 
| 66 | 
            +
            class AgentConfig(BaseModel):
         | 
| 67 | 
            +
                """Agent system configuration."""
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                auto_discover: bool = Field(
         | 
| 70 | 
            +
                    default=True, description="Enable automatic agent discovery"
         | 
| 71 | 
            +
                )
         | 
| 72 | 
            +
                precedence: List[str] = Field(
         | 
| 73 | 
            +
                    default=["project", "user", "system"], description="Agent precedence order"
         | 
| 74 | 
            +
                )
         | 
| 75 | 
            +
                enable_hot_reload: bool = Field(
         | 
| 76 | 
            +
                    default=True, description="Enable hot reloading of agents"
         | 
| 77 | 
            +
                )
         | 
| 78 | 
            +
                cache_ttl_seconds: int = Field(
         | 
| 79 | 
            +
                    default=3600, ge=0, description="Agent cache TTL in seconds"
         | 
| 80 | 
            +
                )
         | 
| 81 | 
            +
                validate_on_load: bool = Field(default=True, description="Validate agents on load")
         | 
| 82 | 
            +
                strict_validation: bool = Field(
         | 
| 83 | 
            +
                    default=False, description="Enable strict validation"
         | 
| 84 | 
            +
                )
         | 
| 85 | 
            +
                max_concurrent_operations: int = Field(
         | 
| 86 | 
            +
                    default=10, ge=1, description="Max concurrent agent operations"
         | 
| 87 | 
            +
                )
         | 
| 88 | 
            +
             | 
| 89 | 
            +
             | 
| 90 | 
            +
            class MemoryConfig(BaseModel):
         | 
| 91 | 
            +
                """Memory management configuration."""
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                enabled: bool = Field(default=True, description="Enable memory system")
         | 
| 94 | 
            +
                auto_learning: bool = Field(
         | 
| 95 | 
            +
                    default=True, description="Enable automatic learning extraction"
         | 
| 96 | 
            +
                )
         | 
| 97 | 
            +
                default_size_kb: int = Field(
         | 
| 98 | 
            +
                    default=80, ge=1, description="Default memory file size limit in KB"
         | 
| 99 | 
            +
                )
         | 
| 100 | 
            +
                max_sections: int = Field(
         | 
| 101 | 
            +
                    default=10, ge=1, description="Maximum sections per memory file"
         | 
| 102 | 
            +
                )
         | 
| 103 | 
            +
                max_items_per_section: int = Field(
         | 
| 104 | 
            +
                    default=15, ge=1, description="Maximum items per section"
         | 
| 105 | 
            +
                )
         | 
| 106 | 
            +
                max_line_length: int = Field(default=120, ge=1, description="Maximum line length")
         | 
| 107 | 
            +
                claude_json_warning_threshold_kb: int = Field(
         | 
| 108 | 
            +
                    default=500, ge=1, description="Warning threshold for Claude JSON size"
         | 
| 109 | 
            +
                )
         | 
| 110 | 
            +
             | 
| 111 | 
            +
             | 
| 112 | 
            +
            class SecurityConfig(BaseModel):
         | 
| 113 | 
            +
                """Security and validation configuration."""
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                enable_path_validation: bool = Field(
         | 
| 116 | 
            +
                    default=True, description="Enable path traversal protection"
         | 
| 117 | 
            +
                )
         | 
| 118 | 
            +
                max_file_size_mb: int = Field(
         | 
| 119 | 
            +
                    default=10, ge=1, description="Maximum file size for operations"
         | 
| 120 | 
            +
                )
         | 
| 121 | 
            +
                allowed_file_extensions: List[str] = Field(
         | 
| 122 | 
            +
                    default=[".md", ".txt", ".json", ".yaml", ".yml", ".py"],
         | 
| 123 | 
            +
                    description="Allowed file extensions",
         | 
| 124 | 
            +
                )
         | 
| 125 | 
            +
                enable_sandbox_mode: bool = Field(
         | 
| 126 | 
            +
                    default=False, description="Enable sandbox mode for agents"
         | 
| 127 | 
            +
                )
         | 
| 128 | 
            +
             | 
| 129 | 
            +
             | 
| 130 | 
            +
            class PerformanceConfig(BaseModel):
         | 
| 131 | 
            +
                """Performance and resource configuration."""
         | 
| 132 | 
            +
             | 
| 133 | 
            +
                startup_timeout: int = Field(
         | 
| 134 | 
            +
                    default=60, ge=1, description="Service startup timeout in seconds"
         | 
| 135 | 
            +
                )
         | 
| 136 | 
            +
                graceful_shutdown_timeout: int = Field(
         | 
| 137 | 
            +
                    default=30, ge=1, description="Graceful shutdown timeout"
         | 
| 138 | 
            +
                )
         | 
| 139 | 
            +
                max_memory_usage_mb: int = Field(
         | 
| 140 | 
            +
                    default=1024, ge=128, description="Maximum memory usage in MB"
         | 
| 141 | 
            +
                )
         | 
| 142 | 
            +
                enable_metrics: bool = Field(
         | 
| 143 | 
            +
                    default=True, description="Enable performance metrics collection"
         | 
| 144 | 
            +
                )
         | 
| 145 | 
            +
                metrics_interval_seconds: int = Field(
         | 
| 146 | 
            +
                    default=60, ge=1, description="Metrics collection interval"
         | 
| 147 | 
            +
                )
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                # Timeout configurations
         | 
| 150 | 
            +
                hook_timeout_seconds: int = Field(
         | 
| 151 | 
            +
                    default=5, ge=1, description="Hook execution timeout"
         | 
| 152 | 
            +
                )
         | 
| 153 | 
            +
                session_timeout_seconds: int = Field(
         | 
| 154 | 
            +
                    default=30, ge=1, description="Session timeout"
         | 
| 155 | 
            +
                )
         | 
| 156 | 
            +
                agent_load_timeout_seconds: int = Field(
         | 
| 157 | 
            +
                    default=10, ge=1, description="Agent loading timeout"
         | 
| 158 | 
            +
                )
         | 
| 159 | 
            +
             | 
| 160 | 
            +
                # Retry and recovery settings
         | 
| 161 | 
            +
                max_restarts: int = Field(default=3, ge=0, description="Maximum service restarts")
         | 
| 162 | 
            +
                max_recovery_attempts: int = Field(
         | 
| 163 | 
            +
                    default=3, ge=0, description="Maximum recovery attempts"
         | 
| 164 | 
            +
                )
         | 
| 165 | 
            +
             | 
| 166 | 
            +
                # Cache settings
         | 
| 167 | 
            +
                cache_max_size_mb: float = Field(
         | 
| 168 | 
            +
                    default=100, ge=1, description="Cache maximum size in MB"
         | 
| 169 | 
            +
                )
         | 
| 170 | 
            +
                cache_max_entries: int = Field(
         | 
| 171 | 
            +
                    default=10000, ge=1, description="Cache maximum entries"
         | 
| 172 | 
            +
                )
         | 
| 173 | 
            +
                cache_default_ttl_seconds: int = Field(
         | 
| 174 | 
            +
                    default=300, ge=1, description="Cache default TTL"
         | 
| 175 | 
            +
                )
         | 
| 176 | 
            +
             | 
| 177 | 
            +
                # Sleep and polling intervals
         | 
| 178 | 
            +
                health_check_interval_seconds: float = Field(
         | 
| 179 | 
            +
                    default=0.1, ge=0.01, description="Health check interval"
         | 
| 180 | 
            +
                )
         | 
| 181 | 
            +
                batch_window_ms: int = Field(
         | 
| 182 | 
            +
                    default=100, ge=1, description="Batch processing window in milliseconds"
         | 
| 183 | 
            +
                )
         | 
| 184 | 
            +
                polling_interval_seconds: float = Field(
         | 
| 185 | 
            +
                    default=1.0, ge=0.1, description="General polling interval"
         | 
| 186 | 
            +
                )
         | 
| 187 | 
            +
             | 
| 188 | 
            +
             | 
| 189 | 
            +
            class SessionConfig(BaseModel):
         | 
| 190 | 
            +
                """Session management configuration."""
         | 
| 191 | 
            +
             | 
| 192 | 
            +
                max_age_minutes: int = Field(
         | 
| 193 | 
            +
                    default=30, ge=1, description="Session maximum age in minutes"
         | 
| 194 | 
            +
                )
         | 
| 195 | 
            +
                cleanup_max_age_hours: int = Field(
         | 
| 196 | 
            +
                    default=24, ge=1, description="Session cleanup age in hours"
         | 
| 197 | 
            +
                )
         | 
| 198 | 
            +
                archive_old_sessions: bool = Field(
         | 
| 199 | 
            +
                    default=True, description="Archive old sessions before cleanup"
         | 
| 200 | 
            +
                )
         | 
| 201 | 
            +
                session_timeout_minutes: int = Field(
         | 
| 202 | 
            +
                    default=60, ge=1, description="Session timeout in minutes"
         | 
| 203 | 
            +
                )
         | 
| 204 | 
            +
             | 
| 205 | 
            +
             | 
| 206 | 
            +
            class DevelopmentConfig(BaseModel):
         | 
| 207 | 
            +
                """Development and debugging configuration."""
         | 
| 208 | 
            +
             | 
| 209 | 
            +
                debug: bool = Field(default=False, description="Enable debug mode")
         | 
| 210 | 
            +
                verbose: bool = Field(default=False, description="Enable verbose logging")
         | 
| 211 | 
            +
                enable_profiling: bool = Field(
         | 
| 212 | 
            +
                    default=False, description="Enable performance profiling"
         | 
| 213 | 
            +
                )
         | 
| 214 | 
            +
                hot_reload_enabled: bool = Field(
         | 
| 215 | 
            +
                    default=True, description="Enable hot reloading in development"
         | 
| 216 | 
            +
                )
         | 
| 217 | 
            +
                mock_external_services: bool = Field(
         | 
| 218 | 
            +
                    default=False, description="Mock external services for testing"
         | 
| 219 | 
            +
                )
         | 
| 220 | 
            +
             | 
| 221 | 
            +
             | 
| 222 | 
            +
            class UnifiedConfig(BaseSettings):
         | 
| 223 | 
            +
                """
         | 
| 224 | 
            +
                Unified configuration model for Claude MPM.
         | 
| 225 | 
            +
             | 
| 226 | 
            +
                This class combines all configuration sections into a single, type-safe model
         | 
| 227 | 
            +
                with environment variable support and validation.
         | 
| 228 | 
            +
                """
         | 
| 229 | 
            +
             | 
| 230 | 
            +
                # Configuration metadata
         | 
| 231 | 
            +
                version: str = Field(default="1.0", description="Configuration version")
         | 
| 232 | 
            +
                environment: str = Field(
         | 
| 233 | 
            +
                    default="production",
         | 
| 234 | 
            +
                    description="Environment (development, testing, production)",
         | 
| 235 | 
            +
                )
         | 
| 236 | 
            +
             | 
| 237 | 
            +
                # Configuration sections
         | 
| 238 | 
            +
                network: NetworkConfig = Field(default_factory=NetworkConfig)
         | 
| 239 | 
            +
                logging: LoggingConfig = Field(default_factory=LoggingConfig)
         | 
| 240 | 
            +
                agents: AgentConfig = Field(default_factory=AgentConfig)
         | 
| 241 | 
            +
                memory: MemoryConfig = Field(default_factory=MemoryConfig)
         | 
| 242 | 
            +
                security: SecurityConfig = Field(default_factory=SecurityConfig)
         | 
| 243 | 
            +
                performance: PerformanceConfig = Field(default_factory=PerformanceConfig)
         | 
| 244 | 
            +
                sessions: SessionConfig = Field(default_factory=SessionConfig)
         | 
| 245 | 
            +
                development: DevelopmentConfig = Field(default_factory=DevelopmentConfig)
         | 
| 246 | 
            +
             | 
| 247 | 
            +
                # Path configuration
         | 
| 248 | 
            +
                base_path: Optional[Path] = Field(
         | 
| 249 | 
            +
                    default=None, description="Base path for Claude MPM"
         | 
| 250 | 
            +
                )
         | 
| 251 | 
            +
                config_path: Optional[Path] = Field(
         | 
| 252 | 
            +
                    default=None, description="Configuration file path"
         | 
| 253 | 
            +
                )
         | 
| 254 | 
            +
             | 
| 255 | 
            +
                # Additional settings for backward compatibility
         | 
| 256 | 
            +
                extra_settings: Dict[str, Any] = Field(
         | 
| 257 | 
            +
                    default_factory=dict, description="Additional settings"
         | 
| 258 | 
            +
                )
         | 
| 259 | 
            +
             | 
| 260 | 
            +
                class Config:
         | 
| 261 | 
            +
                    """Pydantic configuration."""
         | 
| 262 | 
            +
             | 
| 263 | 
            +
                    env_prefix = "CLAUDE_MPM_"
         | 
| 264 | 
            +
                    env_nested_delimiter = "__"
         | 
| 265 | 
            +
                    case_sensitive = False
         | 
| 266 | 
            +
                    validate_assignment = True
         | 
| 267 | 
            +
                    extra = "allow"  # Allow extra fields for backward compatibility
         | 
| 268 | 
            +
             | 
| 269 | 
            +
                @validator("environment")
         | 
| 270 | 
            +
                def validate_environment(cls, v):
         | 
| 271 | 
            +
                    valid_envs = ["development", "testing", "production"]
         | 
| 272 | 
            +
                    if v not in valid_envs:
         | 
| 273 | 
            +
                        raise ValueError(f"Invalid environment. Must be one of: {valid_envs}")
         | 
| 274 | 
            +
                    return v
         | 
| 275 | 
            +
             | 
| 276 | 
            +
                def is_development(self) -> bool:
         | 
| 277 | 
            +
                    """Check if running in development mode."""
         | 
| 278 | 
            +
                    return self.environment == "development"
         | 
| 279 | 
            +
             | 
| 280 | 
            +
                def is_production(self) -> bool:
         | 
| 281 | 
            +
                    """Check if running in production mode."""
         | 
| 282 | 
            +
                    return self.environment == "production"
         | 
| 283 | 
            +
             | 
| 284 | 
            +
                def get_nested(self, key: str, default: Any = None) -> Any:
         | 
| 285 | 
            +
                    """
         | 
| 286 | 
            +
                    Get nested configuration value using dot notation.
         | 
| 287 | 
            +
             | 
| 288 | 
            +
                    Args:
         | 
| 289 | 
            +
                        key: Dot-separated key (e.g., "network.socketio_port")
         | 
| 290 | 
            +
                        default: Default value if key not found
         | 
| 291 | 
            +
             | 
| 292 | 
            +
                    Returns:
         | 
| 293 | 
            +
                        Configuration value or default
         | 
| 294 | 
            +
                    """
         | 
| 295 | 
            +
                    try:
         | 
| 296 | 
            +
                        keys = key.split(".")
         | 
| 297 | 
            +
                        value = self
         | 
| 298 | 
            +
                        for k in keys:
         | 
| 299 | 
            +
                            if hasattr(value, k):
         | 
| 300 | 
            +
                                value = getattr(value, k)
         | 
| 301 | 
            +
                            elif (
         | 
| 302 | 
            +
                                hasattr(value, "__getitem__")
         | 
| 303 | 
            +
                                and hasattr(value, "__contains__")
         | 
| 304 | 
            +
                                and k in value
         | 
| 305 | 
            +
                            ):
         | 
| 306 | 
            +
                                value = value[k]
         | 
| 307 | 
            +
                            else:
         | 
| 308 | 
            +
                                return default
         | 
| 309 | 
            +
                        return value
         | 
| 310 | 
            +
                    except (AttributeError, KeyError, TypeError):
         | 
| 311 | 
            +
                        return default
         | 
| 312 | 
            +
             | 
| 313 | 
            +
                def set_nested(self, key: str, value: Any) -> None:
         | 
| 314 | 
            +
                    """
         | 
| 315 | 
            +
                    Set nested configuration value using dot notation.
         | 
| 316 | 
            +
             | 
| 317 | 
            +
                    Args:
         | 
| 318 | 
            +
                        key: Dot-separated key (e.g., "network.socketio_port")
         | 
| 319 | 
            +
                        value: Value to set
         | 
| 320 | 
            +
                    """
         | 
| 321 | 
            +
                    keys = key.split(".")
         | 
| 322 | 
            +
                    if len(keys) == 1:
         | 
| 323 | 
            +
                        setattr(self, keys[0], value)
         | 
| 324 | 
            +
                        return
         | 
| 325 | 
            +
             | 
| 326 | 
            +
                    # Navigate to the parent object
         | 
| 327 | 
            +
                    obj = self
         | 
| 328 | 
            +
                    for k in keys[:-1]:
         | 
| 329 | 
            +
                        if hasattr(obj, k):
         | 
| 330 | 
            +
                            obj = getattr(obj, k)
         | 
| 331 | 
            +
                        else:
         | 
| 332 | 
            +
                            raise ConfigurationError(f"Invalid configuration path: {key}")
         | 
| 333 | 
            +
             | 
| 334 | 
            +
                    # Set the final value
         | 
| 335 | 
            +
                    if hasattr(obj, keys[-1]):
         | 
| 336 | 
            +
                        setattr(obj, keys[-1], value)
         | 
| 337 | 
            +
                    else:
         | 
| 338 | 
            +
                        raise ConfigurationError(f"Invalid configuration key: {keys[-1]}")
         | 
| 339 | 
            +
             | 
| 340 | 
            +
                def to_legacy_dict(self) -> Dict[str, Any]:
         | 
| 341 | 
            +
                    """
         | 
| 342 | 
            +
                    Convert to legacy dictionary format for backward compatibility.
         | 
| 343 | 
            +
             | 
| 344 | 
            +
                    Returns:
         | 
| 345 | 
            +
                        Dictionary representation compatible with old Config class
         | 
| 346 | 
            +
                    """
         | 
| 347 | 
            +
                    return {
         | 
| 348 | 
            +
                        # Network settings
         | 
| 349 | 
            +
                        "socketio_host": self.network.socketio_host,
         | 
| 350 | 
            +
                        "socketio_port": self.network.socketio_port,
         | 
| 351 | 
            +
                        "socketio_port_range": self.network.socketio_port_range,
         | 
| 352 | 
            +
                        "connection_timeout": self.network.connection_timeout,
         | 
| 353 | 
            +
                        # Logging settings
         | 
| 354 | 
            +
                        "log_level": self.logging.level,
         | 
| 355 | 
            +
                        "logging": {
         | 
| 356 | 
            +
                            "level": self.logging.level,
         | 
| 357 | 
            +
                            "max_size_mb": self.logging.max_size_mb,
         | 
| 358 | 
            +
                            "retention_days": self.logging.retention_days,
         | 
| 359 | 
            +
                            "format": self.logging.format,
         | 
| 360 | 
            +
                        },
         | 
| 361 | 
            +
                        # Agent settings
         | 
| 362 | 
            +
                        "agents": {
         | 
| 363 | 
            +
                            "auto_discover": self.agents.auto_discover,
         | 
| 364 | 
            +
                            "precedence": self.agents.precedence,
         | 
| 365 | 
            +
                            "enable_hot_reload": self.agents.enable_hot_reload,
         | 
| 366 | 
            +
                            "cache_ttl_seconds": self.agents.cache_ttl_seconds,
         | 
| 367 | 
            +
                        },
         | 
| 368 | 
            +
                        # Memory settings
         | 
| 369 | 
            +
                        "memory": {
         | 
| 370 | 
            +
                            "enabled": self.memory.enabled,
         | 
| 371 | 
            +
                            "auto_learning": self.memory.auto_learning,
         | 
| 372 | 
            +
                            "limits": {
         | 
| 373 | 
            +
                                "default_size_kb": self.memory.default_size_kb,
         | 
| 374 | 
            +
                                "max_sections": self.memory.max_sections,
         | 
| 375 | 
            +
                                "max_items_per_section": self.memory.max_items_per_section,
         | 
| 376 | 
            +
                                "max_line_length": self.memory.max_line_length,
         | 
| 377 | 
            +
                            },
         | 
| 378 | 
            +
                            "claude_json_warning_threshold_kb": self.memory.claude_json_warning_threshold_kb,
         | 
| 379 | 
            +
                        },
         | 
| 380 | 
            +
                        # Performance settings
         | 
| 381 | 
            +
                        "startup_timeout": self.performance.startup_timeout,
         | 
| 382 | 
            +
                        "graceful_shutdown_timeout": self.performance.graceful_shutdown_timeout,
         | 
| 383 | 
            +
                        "max_concurrent_operations": self.agents.max_concurrent_operations,
         | 
| 384 | 
            +
                        "hook_timeout_seconds": self.performance.hook_timeout_seconds,
         | 
| 385 | 
            +
                        "session_timeout_seconds": self.performance.session_timeout_seconds,
         | 
| 386 | 
            +
                        "agent_load_timeout_seconds": self.performance.agent_load_timeout_seconds,
         | 
| 387 | 
            +
                        "max_restarts": self.performance.max_restarts,
         | 
| 388 | 
            +
                        "max_recovery_attempts": self.performance.max_recovery_attempts,
         | 
| 389 | 
            +
                        # Cache settings
         | 
| 390 | 
            +
                        "cache_max_size_mb": self.performance.cache_max_size_mb,
         | 
| 391 | 
            +
                        "cache_max_entries": self.performance.cache_max_entries,
         | 
| 392 | 
            +
                        "cache_default_ttl_seconds": self.performance.cache_default_ttl_seconds,
         | 
| 393 | 
            +
                        # Session settings
         | 
| 394 | 
            +
                        "session_max_age_minutes": self.sessions.max_age_minutes,
         | 
| 395 | 
            +
                        "session_cleanup_max_age_hours": self.sessions.cleanup_max_age_hours,
         | 
| 396 | 
            +
                        "session_archive_old": self.sessions.archive_old_sessions,
         | 
| 397 | 
            +
                        # Development settings
         | 
| 398 | 
            +
                        "debug": self.development.debug,
         | 
| 399 | 
            +
                        "verbose": self.development.verbose,
         | 
| 400 | 
            +
                        "environment": self.environment,
         | 
| 401 | 
            +
                        # Additional settings
         | 
| 402 | 
            +
                        **self.extra_settings,
         | 
| 403 | 
            +
                    }
         | 
| 404 | 
            +
             | 
| 405 | 
            +
             | 
| 406 | 
            +
            class ConfigurationService:
         | 
| 407 | 
            +
                """
         | 
| 408 | 
            +
                Injectable configuration service for dependency injection.
         | 
| 409 | 
            +
             | 
| 410 | 
            +
                This service provides a centralized way to access configuration throughout
         | 
| 411 | 
            +
                the application while maintaining backward compatibility with existing code.
         | 
| 412 | 
            +
                """
         | 
| 413 | 
            +
             | 
| 414 | 
            +
                def __init__(self, config: Optional[UnifiedConfig] = None):
         | 
| 415 | 
            +
                    """
         | 
| 416 | 
            +
                    Initialize configuration service.
         | 
| 417 | 
            +
             | 
| 418 | 
            +
                    Args:
         | 
| 419 | 
            +
                        config: Optional pre-configured UnifiedConfig instance
         | 
| 420 | 
            +
                    """
         | 
| 421 | 
            +
                    self._config = config or self._load_default_config()
         | 
| 422 | 
            +
                    self._legacy_config: Optional[Any] = None
         | 
| 423 | 
            +
             | 
| 424 | 
            +
                def _load_default_config(self) -> UnifiedConfig:
         | 
| 425 | 
            +
                    """Load configuration from environment and default files."""
         | 
| 426 | 
            +
                    try:
         | 
| 427 | 
            +
                        # Try to load from standard configuration files
         | 
| 428 | 
            +
                        config_paths = [
         | 
| 429 | 
            +
                            Path.cwd() / ".claude-mpm" / "configuration.yaml",
         | 
| 430 | 
            +
                            Path.cwd() / ".claude-mpm" / "configuration.yml",
         | 
| 431 | 
            +
                            Path.home() / ".claude-mpm" / "configuration.yaml",
         | 
| 432 | 
            +
                            Path.home() / ".claude-mpm" / "configuration.yml",
         | 
| 433 | 
            +
                        ]
         | 
| 434 | 
            +
             | 
| 435 | 
            +
                        config_data: Dict[str, Any] = {}
         | 
| 436 | 
            +
                        for config_path in config_paths:
         | 
| 437 | 
            +
                            if config_path.exists():
         | 
| 438 | 
            +
                                import yaml
         | 
| 439 | 
            +
             | 
| 440 | 
            +
                                with open(config_path, "r") as f:
         | 
| 441 | 
            +
                                    file_config = yaml.safe_load(f) or {}
         | 
| 442 | 
            +
                                config_data.update(file_config)
         | 
| 443 | 
            +
                                break
         | 
| 444 | 
            +
             | 
| 445 | 
            +
                        # Create unified config with environment variable support
         | 
| 446 | 
            +
                        return UnifiedConfig(**config_data)
         | 
| 447 | 
            +
             | 
| 448 | 
            +
                    except Exception as e:
         | 
| 449 | 
            +
                        raise ConfigurationError(
         | 
| 450 | 
            +
                            f"Failed to load configuration: {e}",
         | 
| 451 | 
            +
                            context={"error_type": type(e).__name__},
         | 
| 452 | 
            +
                        )
         | 
| 453 | 
            +
             | 
| 454 | 
            +
                @property
         | 
| 455 | 
            +
                def config(self) -> UnifiedConfig:
         | 
| 456 | 
            +
                    """Get the unified configuration."""
         | 
| 457 | 
            +
                    return self._config
         | 
| 458 | 
            +
             | 
| 459 | 
            +
                def get_legacy_config(self):
         | 
| 460 | 
            +
                    """
         | 
| 461 | 
            +
                    Get legacy Config instance for backward compatibility.
         | 
| 462 | 
            +
             | 
| 463 | 
            +
                    Returns:
         | 
| 464 | 
            +
                        Legacy Config instance that wraps the unified configuration
         | 
| 465 | 
            +
                    """
         | 
| 466 | 
            +
                    if self._legacy_config is None:
         | 
| 467 | 
            +
                        from .config import Config
         | 
| 468 | 
            +
             | 
| 469 | 
            +
                        legacy_dict = self._config.to_legacy_dict()
         | 
| 470 | 
            +
                        self._legacy_config = Config(config=legacy_dict)
         | 
| 471 | 
            +
                    return self._legacy_config
         | 
| 472 | 
            +
             | 
| 473 | 
            +
                def get(self, key: str, default: Any = None) -> Any:
         | 
| 474 | 
            +
                    """
         | 
| 475 | 
            +
                    Get configuration value using dot notation.
         | 
| 476 | 
            +
             | 
| 477 | 
            +
                    Args:
         | 
| 478 | 
            +
                        key: Configuration key (supports dot notation)
         | 
| 479 | 
            +
                        default: Default value if key not found
         | 
| 480 | 
            +
             | 
| 481 | 
            +
                    Returns:
         | 
| 482 | 
            +
                        Configuration value
         | 
| 483 | 
            +
                    """
         | 
| 484 | 
            +
                    return self._config.get_nested(key, default)
         | 
| 485 | 
            +
             | 
| 486 | 
            +
                def set(self, key: str, value: Any) -> None:
         | 
| 487 | 
            +
                    """
         | 
| 488 | 
            +
                    Set configuration value using dot notation.
         | 
| 489 | 
            +
             | 
| 490 | 
            +
                    Args:
         | 
| 491 | 
            +
                        key: Configuration key (supports dot notation)
         | 
| 492 | 
            +
                        value: Value to set
         | 
| 493 | 
            +
                    """
         | 
| 494 | 
            +
                    self._config.set_nested(key, value)
         | 
| 495 | 
            +
                    # Invalidate legacy config cache
         | 
| 496 | 
            +
                    self._legacy_config = None
         | 
| 497 | 
            +
             | 
| 498 | 
            +
                def reload(self) -> None:
         | 
| 499 | 
            +
                    """Reload configuration from sources."""
         | 
| 500 | 
            +
                    self._config = self._load_default_config()
         | 
| 501 | 
            +
                    self._legacy_config = None
         | 
| 502 | 
            +
             | 
| 503 | 
            +
                def validate(self) -> bool:
         | 
| 504 | 
            +
                    """
         | 
| 505 | 
            +
                    Validate the current configuration.
         | 
| 506 | 
            +
             | 
| 507 | 
            +
                    Returns:
         | 
| 508 | 
            +
                        True if configuration is valid
         | 
| 509 | 
            +
             | 
| 510 | 
            +
                    Raises:
         | 
| 511 | 
            +
                        ConfigurationError: If configuration is invalid
         | 
| 512 | 
            +
                    """
         | 
| 513 | 
            +
                    try:
         | 
| 514 | 
            +
                        # Pydantic validation happens automatically, but we can add custom validation here
         | 
| 515 | 
            +
                        if self._config.network.socketio_port in range(1024, 65536):
         | 
| 516 | 
            +
                            return True
         | 
| 517 | 
            +
                        else:
         | 
| 518 | 
            +
                            raise ConfigurationError("Invalid SocketIO port range")
         | 
| 519 | 
            +
                    except Exception as e:
         | 
| 520 | 
            +
                        raise ConfigurationError(f"Configuration validation failed: {e}")
         | 
| 521 | 
            +
             | 
| 522 | 
            +
                def export_to_file(self, file_path: Union[str, Path], format: str = "yaml") -> None:
         | 
| 523 | 
            +
                    """
         | 
| 524 | 
            +
                    Export configuration to file.
         | 
| 525 | 
            +
             | 
| 526 | 
            +
                    Args:
         | 
| 527 | 
            +
                        file_path: Path to export file
         | 
| 528 | 
            +
                        format: Export format (yaml, json)
         | 
| 529 | 
            +
                    """
         | 
| 530 | 
            +
                    file_path = Path(file_path)
         | 
| 531 | 
            +
             | 
| 532 | 
            +
                    try:
         | 
| 533 | 
            +
                        if format.lower() == "yaml":
         | 
| 534 | 
            +
                            import yaml
         | 
| 535 | 
            +
             | 
| 536 | 
            +
                            with open(file_path, "w") as f:
         | 
| 537 | 
            +
                                yaml.dump(self._config.dict(), f, default_flow_style=False)
         | 
| 538 | 
            +
                        elif format.lower() == "json":
         | 
| 539 | 
            +
                            import json
         | 
| 540 | 
            +
             | 
| 541 | 
            +
                            with open(file_path, "w") as f:
         | 
| 542 | 
            +
                                json.dump(self._config.dict(), f, indent=2)
         | 
| 543 | 
            +
                        else:
         | 
| 544 | 
            +
                            raise ConfigurationError(f"Unsupported export format: {format}")
         | 
| 545 | 
            +
             | 
| 546 | 
            +
                    except Exception as e:
         | 
| 547 | 
            +
                        raise ConfigurationError(
         | 
| 548 | 
            +
                            f"Failed to export configuration: {e}",
         | 
| 549 | 
            +
                            context={"file_path": str(file_path), "format": format},
         | 
| 550 | 
            +
                        )
         |