claude-mpm 4.14.6__py3-none-any.whl → 4.21.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/BASE_ENGINEER.md +286 -0
- claude_mpm/agents/BASE_PM.md +272 -23
- claude_mpm/agents/OUTPUT_STYLE.md +48 -3
- claude_mpm/agents/PM_INSTRUCTIONS.md +49 -0
- claude_mpm/agents/agent_loader.py +17 -5
- claude_mpm/agents/frontmatter_validator.py +284 -253
- claude_mpm/agents/templates/agentic-coder-optimizer.json +9 -2
- claude_mpm/agents/templates/api_qa.json +7 -1
- claude_mpm/agents/templates/clerk-ops.json +8 -1
- claude_mpm/agents/templates/code_analyzer.json +4 -1
- claude_mpm/agents/templates/dart_engineer.json +11 -1
- claude_mpm/agents/templates/data_engineer.json +11 -1
- claude_mpm/agents/templates/documentation.json +6 -1
- claude_mpm/agents/templates/engineer.json +18 -1
- claude_mpm/agents/templates/gcp_ops_agent.json +8 -1
- claude_mpm/agents/templates/golang_engineer.json +11 -1
- claude_mpm/agents/templates/java_engineer.json +12 -2
- claude_mpm/agents/templates/local_ops_agent.json +216 -37
- claude_mpm/agents/templates/nextjs_engineer.json +11 -1
- claude_mpm/agents/templates/ops.json +8 -1
- claude_mpm/agents/templates/php-engineer.json +20 -4
- claude_mpm/agents/templates/project_organizer.json +10 -3
- claude_mpm/agents/templates/prompt-engineer.json +5 -1
- claude_mpm/agents/templates/python_engineer.json +19 -4
- claude_mpm/agents/templates/qa.json +7 -1
- claude_mpm/agents/templates/react_engineer.json +11 -1
- claude_mpm/agents/templates/refactoring_engineer.json +8 -1
- claude_mpm/agents/templates/research.json +4 -1
- claude_mpm/agents/templates/ruby-engineer.json +11 -1
- claude_mpm/agents/templates/rust_engineer.json +23 -8
- claude_mpm/agents/templates/security.json +6 -1
- claude_mpm/agents/templates/svelte-engineer.json +225 -0
- claude_mpm/agents/templates/ticketing.json +6 -1
- claude_mpm/agents/templates/typescript_engineer.json +11 -1
- claude_mpm/agents/templates/vercel_ops_agent.json +8 -1
- claude_mpm/agents/templates/version_control.json +8 -1
- claude_mpm/agents/templates/web_qa.json +7 -1
- claude_mpm/agents/templates/web_ui.json +11 -1
- claude_mpm/cli/__init__.py +34 -740
- claude_mpm/cli/commands/__init__.py +2 -0
- claude_mpm/cli/commands/agent_manager.py +25 -12
- claude_mpm/cli/commands/agent_state_manager.py +186 -0
- claude_mpm/cli/commands/agents.py +204 -148
- claude_mpm/cli/commands/aggregate.py +7 -3
- claude_mpm/cli/commands/analyze.py +9 -4
- claude_mpm/cli/commands/analyze_code.py +7 -2
- claude_mpm/cli/commands/auto_configure.py +7 -9
- claude_mpm/cli/commands/config.py +47 -13
- claude_mpm/cli/commands/configure.py +294 -1788
- claude_mpm/cli/commands/configure_agent_display.py +261 -0
- claude_mpm/cli/commands/configure_behavior_manager.py +204 -0
- claude_mpm/cli/commands/configure_hook_manager.py +225 -0
- claude_mpm/cli/commands/configure_models.py +18 -0
- claude_mpm/cli/commands/configure_navigation.py +167 -0
- claude_mpm/cli/commands/configure_paths.py +104 -0
- claude_mpm/cli/commands/configure_persistence.py +254 -0
- claude_mpm/cli/commands/configure_startup_manager.py +646 -0
- claude_mpm/cli/commands/configure_template_editor.py +497 -0
- claude_mpm/cli/commands/configure_validators.py +73 -0
- claude_mpm/cli/commands/local_deploy.py +3 -2
- claude_mpm/cli/commands/memory.py +54 -20
- claude_mpm/cli/commands/mpm_init/__init__.py +73 -0
- claude_mpm/cli/commands/mpm_init/core.py +525 -0
- claude_mpm/cli/commands/mpm_init/display.py +341 -0
- claude_mpm/cli/commands/mpm_init/git_activity.py +427 -0
- claude_mpm/cli/commands/mpm_init/modes.py +397 -0
- claude_mpm/cli/commands/mpm_init/prompts.py +442 -0
- claude_mpm/cli/commands/mpm_init_cli.py +396 -0
- claude_mpm/cli/commands/mpm_init_handler.py +75 -4
- claude_mpm/cli/commands/skills.py +488 -0
- claude_mpm/cli/executor.py +204 -0
- claude_mpm/cli/helpers.py +105 -0
- claude_mpm/cli/interactive/__init__.py +3 -0
- claude_mpm/cli/interactive/skills_wizard.py +491 -0
- claude_mpm/cli/parsers/base_parser.py +7 -0
- claude_mpm/cli/parsers/mpm_init_parser.py +42 -0
- claude_mpm/cli/parsers/skills_parser.py +137 -0
- claude_mpm/cli/shared/output_formatters.py +28 -19
- claude_mpm/cli/startup.py +538 -0
- claude_mpm/commands/mpm-auto-configure.md +52 -0
- claude_mpm/commands/mpm-help.md +3 -0
- claude_mpm/commands/mpm-init.md +112 -6
- claude_mpm/commands/mpm-version.md +113 -0
- claude_mpm/commands/mpm.md +1 -0
- claude_mpm/config/agent_config.py +2 -2
- claude_mpm/constants.py +12 -0
- claude_mpm/core/base_service.py +13 -12
- claude_mpm/core/config.py +42 -0
- claude_mpm/core/enums.py +452 -0
- claude_mpm/core/factories.py +1 -1
- claude_mpm/core/instruction_reinforcement_hook.py +2 -1
- claude_mpm/core/interactive_session.py +6 -3
- claude_mpm/core/interfaces.py +56 -1
- claude_mpm/core/logging_config.py +6 -2
- claude_mpm/core/oneshot_session.py +8 -4
- claude_mpm/core/optimized_agent_loader.py +3 -3
- claude_mpm/core/output_style_manager.py +12 -192
- claude_mpm/core/service_registry.py +5 -1
- claude_mpm/core/types.py +2 -9
- claude_mpm/core/typing_utils.py +7 -6
- claude_mpm/dashboard/static/js/dashboard.js +0 -14
- claude_mpm/dashboard/templates/index.html +3 -41
- claude_mpm/hooks/__init__.py +8 -0
- claude_mpm/hooks/claude_hooks/response_tracking.py +35 -1
- claude_mpm/hooks/instruction_reinforcement.py +7 -2
- claude_mpm/hooks/session_resume_hook.py +121 -0
- claude_mpm/models/resume_log.py +340 -0
- claude_mpm/services/agents/auto_config_manager.py +10 -11
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +1 -1
- claude_mpm/services/agents/deployment/agent_record_service.py +1 -1
- claude_mpm/services/agents/deployment/agent_validator.py +17 -1
- claude_mpm/services/agents/deployment/async_agent_deployment.py +1 -1
- claude_mpm/services/agents/deployment/interface_adapter.py +3 -2
- claude_mpm/services/agents/deployment/local_template_deployment.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +7 -6
- claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +7 -16
- claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +4 -3
- claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +5 -3
- claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +6 -5
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +9 -6
- claude_mpm/services/agents/deployment/validation/__init__.py +3 -1
- claude_mpm/services/agents/deployment/validation/validation_result.py +1 -9
- claude_mpm/services/agents/local_template_manager.py +1 -1
- claude_mpm/services/agents/memory/agent_memory_manager.py +5 -2
- claude_mpm/services/agents/recommender.py +47 -0
- claude_mpm/services/agents/registry/modification_tracker.py +5 -2
- claude_mpm/services/cli/resume_service.py +617 -0
- claude_mpm/services/cli/session_manager.py +87 -0
- claude_mpm/services/cli/session_pause_manager.py +504 -0
- claude_mpm/services/cli/session_resume_helper.py +372 -0
- claude_mpm/services/command_handler_service.py +11 -5
- claude_mpm/services/core/interfaces/process.py +6 -6
- claude_mpm/services/core/interfaces.py +56 -1
- claude_mpm/services/core/models/__init__.py +0 -2
- claude_mpm/services/core/models/agent_config.py +15 -28
- claude_mpm/services/core/models/health.py +1 -28
- claude_mpm/services/core/models/process.py +22 -41
- claude_mpm/services/core/path_resolver.py +1 -1
- claude_mpm/services/diagnostics/__init__.py +2 -2
- claude_mpm/services/diagnostics/checks/agent_check.py +25 -24
- claude_mpm/services/diagnostics/checks/claude_code_check.py +24 -23
- claude_mpm/services/diagnostics/checks/common_issues_check.py +25 -24
- claude_mpm/services/diagnostics/checks/configuration_check.py +24 -23
- claude_mpm/services/diagnostics/checks/filesystem_check.py +18 -17
- claude_mpm/services/diagnostics/checks/installation_check.py +30 -29
- claude_mpm/services/diagnostics/checks/instructions_check.py +20 -19
- claude_mpm/services/diagnostics/checks/mcp_check.py +50 -36
- claude_mpm/services/diagnostics/checks/mcp_services_check.py +36 -31
- claude_mpm/services/diagnostics/checks/monitor_check.py +23 -22
- claude_mpm/services/diagnostics/checks/startup_log_check.py +9 -8
- claude_mpm/services/diagnostics/diagnostic_runner.py +6 -5
- claude_mpm/services/diagnostics/doctor_reporter.py +28 -25
- claude_mpm/services/diagnostics/models.py +37 -21
- claude_mpm/services/infrastructure/monitoring/__init__.py +1 -1
- claude_mpm/services/infrastructure/monitoring/aggregator.py +12 -12
- claude_mpm/services/infrastructure/monitoring/base.py +5 -13
- claude_mpm/services/infrastructure/monitoring/network.py +7 -6
- claude_mpm/services/infrastructure/monitoring/process.py +13 -12
- claude_mpm/services/infrastructure/monitoring/resources.py +7 -6
- claude_mpm/services/infrastructure/monitoring/service.py +16 -15
- claude_mpm/services/infrastructure/resume_log_generator.py +439 -0
- claude_mpm/services/local_ops/__init__.py +5 -3
- claude_mpm/services/local_ops/crash_detector.py +1 -1
- claude_mpm/services/local_ops/health_checks/http_check.py +2 -1
- claude_mpm/services/local_ops/health_checks/process_check.py +2 -1
- claude_mpm/services/local_ops/health_checks/resource_check.py +2 -1
- claude_mpm/services/local_ops/health_manager.py +1 -1
- claude_mpm/services/local_ops/process_manager.py +12 -12
- claude_mpm/services/local_ops/restart_manager.py +1 -1
- claude_mpm/services/local_ops/state_manager.py +6 -5
- claude_mpm/services/local_ops/unified_manager.py +2 -2
- claude_mpm/services/mcp_config_manager.py +7 -126
- claude_mpm/services/mcp_gateway/auto_configure.py +31 -25
- claude_mpm/services/mcp_gateway/core/__init__.py +1 -2
- claude_mpm/services/mcp_gateway/core/base.py +18 -31
- claude_mpm/services/mcp_gateway/core/process_pool.py +19 -10
- claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +97 -45
- claude_mpm/services/mcp_gateway/tools/health_check_tool.py +30 -28
- claude_mpm/services/memory_hook_service.py +4 -1
- claude_mpm/services/monitor/daemon_manager.py +3 -2
- claude_mpm/services/monitor/handlers/dashboard.py +2 -1
- claude_mpm/services/monitor/handlers/hooks.py +2 -1
- claude_mpm/services/monitor/management/lifecycle.py +3 -2
- claude_mpm/services/monitor/server.py +2 -1
- claude_mpm/services/session_management_service.py +3 -2
- claude_mpm/services/session_manager.py +205 -1
- claude_mpm/services/shared/async_service_base.py +16 -27
- claude_mpm/services/shared/lifecycle_service_base.py +1 -14
- claude_mpm/services/socketio/handlers/__init__.py +5 -2
- claude_mpm/services/socketio/handlers/hook.py +13 -2
- claude_mpm/services/socketio/handlers/registry.py +4 -2
- claude_mpm/services/socketio/server/main.py +10 -8
- claude_mpm/services/subprocess_launcher_service.py +14 -5
- claude_mpm/services/unified/analyzer_strategies/code_analyzer.py +8 -7
- claude_mpm/services/unified/analyzer_strategies/dependency_analyzer.py +6 -5
- claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +8 -7
- claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +7 -6
- claude_mpm/services/unified/analyzer_strategies/structure_analyzer.py +5 -4
- claude_mpm/services/unified/config_strategies/validation_strategy.py +13 -9
- claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +10 -3
- claude_mpm/services/unified/deployment_strategies/local.py +6 -5
- claude_mpm/services/unified/deployment_strategies/utils.py +6 -5
- claude_mpm/services/unified/deployment_strategies/vercel.py +7 -6
- claude_mpm/services/unified/interfaces.py +3 -1
- claude_mpm/services/unified/unified_analyzer.py +14 -10
- claude_mpm/services/unified/unified_config.py +2 -1
- claude_mpm/services/unified/unified_deployment.py +9 -4
- claude_mpm/services/version_service.py +104 -1
- claude_mpm/skills/__init__.py +42 -0
- claude_mpm/skills/agent_skills_injector.py +324 -0
- claude_mpm/skills/bundled/LICENSE_ATTRIBUTIONS.md +79 -0
- claude_mpm/skills/bundled/__init__.py +6 -0
- claude_mpm/skills/bundled/api-documentation.md +393 -0
- claude_mpm/skills/bundled/async-testing.md +571 -0
- claude_mpm/skills/bundled/code-review.md +143 -0
- claude_mpm/skills/bundled/collaboration/brainstorming/SKILL.md +79 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/SKILL.md +178 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/agent-prompts.md +577 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/coordination-patterns.md +467 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/examples.md +537 -0
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/troubleshooting.md +730 -0
- claude_mpm/skills/bundled/collaboration/requesting-code-review/SKILL.md +112 -0
- claude_mpm/skills/bundled/collaboration/requesting-code-review/references/code-reviewer-template.md +146 -0
- claude_mpm/skills/bundled/collaboration/requesting-code-review/references/review-examples.md +412 -0
- claude_mpm/skills/bundled/collaboration/writing-plans/SKILL.md +81 -0
- claude_mpm/skills/bundled/collaboration/writing-plans/references/best-practices.md +362 -0
- claude_mpm/skills/bundled/collaboration/writing-plans/references/plan-structure-templates.md +312 -0
- claude_mpm/skills/bundled/database-migration.md +199 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/SKILL.md +152 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/advanced-techniques.md +668 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/examples.md +587 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/integration.md +438 -0
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/tracing-techniques.md +391 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/CREATION-LOG.md +119 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/SKILL.md +148 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/anti-patterns.md +483 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/examples.md +452 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/troubleshooting.md +449 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/workflow.md +411 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-academic.md +14 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-1.md +58 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-2.md +68 -0
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-3.md +69 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/SKILL.md +131 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/gate-function.md +325 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/integration-and-workflows.md +490 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/red-flags-and-failures.md +425 -0
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/verification-patterns.md +499 -0
- claude_mpm/skills/bundled/docker-containerization.md +194 -0
- claude_mpm/skills/bundled/express-local-dev.md +1429 -0
- claude_mpm/skills/bundled/fastapi-local-dev.md +1199 -0
- claude_mpm/skills/bundled/git-workflow.md +414 -0
- claude_mpm/skills/bundled/imagemagick.md +204 -0
- claude_mpm/skills/bundled/json-data-handling.md +223 -0
- claude_mpm/skills/bundled/main/artifacts-builder/SKILL.md +86 -0
- claude_mpm/skills/bundled/main/internal-comms/SKILL.md +43 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/3p-updates.md +47 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/company-newsletter.md +65 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/faq-answers.md +30 -0
- claude_mpm/skills/bundled/main/internal-comms/examples/general-comms.md +16 -0
- claude_mpm/skills/bundled/main/mcp-builder/SKILL.md +160 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/design_principles.md +412 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/evaluation.md +602 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/mcp_best_practices.md +915 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/node_mcp_server.md +916 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/python_mcp_server.md +752 -0
- claude_mpm/skills/bundled/main/mcp-builder/reference/workflow.md +1237 -0
- claude_mpm/skills/bundled/main/mcp-builder/scripts/connections.py +157 -0
- claude_mpm/skills/bundled/main/mcp-builder/scripts/evaluation.py +425 -0
- claude_mpm/skills/bundled/main/skill-creator/SKILL.md +189 -0
- claude_mpm/skills/bundled/main/skill-creator/references/best-practices.md +500 -0
- claude_mpm/skills/bundled/main/skill-creator/references/creation-workflow.md +464 -0
- claude_mpm/skills/bundled/main/skill-creator/references/examples.md +619 -0
- claude_mpm/skills/bundled/main/skill-creator/references/progressive-disclosure.md +437 -0
- claude_mpm/skills/bundled/main/skill-creator/references/skill-structure.md +231 -0
- claude_mpm/skills/bundled/main/skill-creator/scripts/init_skill.py +303 -0
- claude_mpm/skills/bundled/main/skill-creator/scripts/package_skill.py +113 -0
- claude_mpm/skills/bundled/main/skill-creator/scripts/quick_validate.py +72 -0
- claude_mpm/skills/bundled/nextjs-local-dev.md +807 -0
- claude_mpm/skills/bundled/pdf.md +141 -0
- claude_mpm/skills/bundled/performance-profiling.md +567 -0
- claude_mpm/skills/bundled/php/espocrm-development/SKILL.md +170 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/architecture.md +602 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/common-tasks.md +821 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/development-workflow.md +742 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/frontend-customization.md +726 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/hooks-and-services.md +764 -0
- claude_mpm/skills/bundled/php/espocrm-development/references/testing-debugging.md +831 -0
- claude_mpm/skills/bundled/refactoring-patterns.md +180 -0
- claude_mpm/skills/bundled/rust/desktop-applications/SKILL.md +226 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/architecture-patterns.md +901 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/native-gui-frameworks.md +901 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/platform-integration.md +775 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/state-management.md +937 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/tauri-framework.md +770 -0
- claude_mpm/skills/bundled/rust/desktop-applications/references/testing-deployment.md +961 -0
- claude_mpm/skills/bundled/security-scanning.md +327 -0
- claude_mpm/skills/bundled/systematic-debugging.md +473 -0
- claude_mpm/skills/bundled/test-driven-development.md +378 -0
- claude_mpm/skills/bundled/testing/condition-based-waiting/SKILL.md +119 -0
- claude_mpm/skills/bundled/testing/condition-based-waiting/references/patterns-and-implementation.md +253 -0
- claude_mpm/skills/bundled/testing/test-driven-development/SKILL.md +145 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/anti-patterns.md +543 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/examples.md +741 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/integration.md +470 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/philosophy.md +458 -0
- claude_mpm/skills/bundled/testing/test-driven-development/references/workflow.md +639 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/SKILL.md +140 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/completeness-anti-patterns.md +572 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/core-anti-patterns.md +411 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/detection-guide.md +569 -0
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/tdd-connection.md +695 -0
- claude_mpm/skills/bundled/testing/webapp-testing/SKILL.md +184 -0
- claude_mpm/skills/bundled/testing/webapp-testing/decision-tree.md +459 -0
- claude_mpm/skills/bundled/testing/webapp-testing/examples/console_logging.py +35 -0
- claude_mpm/skills/bundled/testing/webapp-testing/examples/element_discovery.py +44 -0
- claude_mpm/skills/bundled/testing/webapp-testing/examples/static_html_automation.py +34 -0
- claude_mpm/skills/bundled/testing/webapp-testing/playwright-patterns.md +479 -0
- claude_mpm/skills/bundled/testing/webapp-testing/reconnaissance-pattern.md +687 -0
- claude_mpm/skills/bundled/testing/webapp-testing/scripts/with_server.py +129 -0
- claude_mpm/skills/bundled/testing/webapp-testing/server-management.md +758 -0
- claude_mpm/skills/bundled/testing/webapp-testing/troubleshooting.md +868 -0
- claude_mpm/skills/bundled/vite-local-dev.md +1061 -0
- claude_mpm/skills/bundled/web-performance-optimization.md +2305 -0
- claude_mpm/skills/bundled/xlsx.md +157 -0
- claude_mpm/skills/registry.py +286 -0
- claude_mpm/skills/skill_manager.py +310 -0
- claude_mpm/skills/skills_registry.py +348 -0
- claude_mpm/skills/skills_service.py +739 -0
- claude_mpm/tools/code_tree_analyzer.py +177 -141
- claude_mpm/tools/code_tree_events.py +4 -2
- claude_mpm/utils/agent_dependency_loader.py +2 -2
- {claude_mpm-4.14.6.dist-info → claude_mpm-4.21.0.dist-info}/METADATA +211 -33
- {claude_mpm-4.14.6.dist-info → claude_mpm-4.21.0.dist-info}/RECORD +339 -199
- claude_mpm/agents/INSTRUCTIONS_OLD_DEPRECATED.md +0 -602
- claude_mpm/cli/commands/mpm_init.py +0 -1994
- claude_mpm/dashboard/static/css/code-tree.css +0 -1639
- claude_mpm/dashboard/static/js/components/code-tree/tree-breadcrumb.js +0 -353
- claude_mpm/dashboard/static/js/components/code-tree/tree-constants.js +0 -235
- claude_mpm/dashboard/static/js/components/code-tree/tree-search.js +0 -409
- claude_mpm/dashboard/static/js/components/code-tree/tree-utils.js +0 -435
- claude_mpm/dashboard/static/js/components/code-tree.js +0 -5869
- claude_mpm/dashboard/static/js/components/code-viewer.js +0 -1386
- claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +0 -425
- claude_mpm/hooks/claude_hooks/hook_handler_original.py +0 -1041
- claude_mpm/hooks/claude_hooks/hook_handler_refactored.py +0 -347
- claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +0 -575
- claude_mpm/services/project/analyzer_refactored.py +0 -450
- {claude_mpm-4.14.6.dist-info → claude_mpm-4.21.0.dist-info}/WHEEL +0 -0
- {claude_mpm-4.14.6.dist-info → claude_mpm-4.21.0.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.14.6.dist-info → claude_mpm-4.21.0.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.14.6.dist-info → claude_mpm-4.21.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
"""Resume Log Generator Service.
|
|
2
|
+
|
|
3
|
+
Automatically generates session resume logs when approaching or hitting token limits.
|
|
4
|
+
Integrates with session management and response tracking infrastructure.
|
|
5
|
+
|
|
6
|
+
Triggers:
|
|
7
|
+
- model_context_window_exceeded (stop_reason)
|
|
8
|
+
- Manual pause command
|
|
9
|
+
- 95% token threshold reached
|
|
10
|
+
- Session end with high token usage (>85%)
|
|
11
|
+
|
|
12
|
+
Design Principles:
|
|
13
|
+
- Atomic file operations (via state_storage)
|
|
14
|
+
- Non-blocking generation
|
|
15
|
+
- Graceful degradation if generation fails
|
|
16
|
+
- Integration with existing session state
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from datetime import datetime, timezone
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import Any, Dict, List, Optional
|
|
22
|
+
|
|
23
|
+
from claude_mpm.core.logging_utils import get_logger
|
|
24
|
+
from claude_mpm.models.resume_log import ContextMetrics, ResumeLog
|
|
25
|
+
from claude_mpm.storage.state_storage import StateStorage
|
|
26
|
+
|
|
27
|
+
logger = get_logger(__name__)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ResumeLogGenerator:
|
|
31
|
+
"""Service for generating session resume logs."""
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
storage_dir: Optional[Path] = None,
|
|
36
|
+
config: Optional[Dict[str, Any]] = None,
|
|
37
|
+
):
|
|
38
|
+
"""Initialize resume log generator.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
storage_dir: Directory for resume logs (default: .claude-mpm/resume-logs)
|
|
42
|
+
config: Configuration dictionary
|
|
43
|
+
"""
|
|
44
|
+
self.storage_dir = storage_dir or Path.home() / ".claude-mpm" / "resume-logs"
|
|
45
|
+
self.storage_dir.mkdir(parents=True, exist_ok=True)
|
|
46
|
+
|
|
47
|
+
# State storage for atomic writes
|
|
48
|
+
self.state_storage = StateStorage(
|
|
49
|
+
storage_dir=self.storage_dir.parent / "storage"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Configuration
|
|
53
|
+
self.config = config or {}
|
|
54
|
+
self.enabled = (
|
|
55
|
+
self.config.get("context_management", {})
|
|
56
|
+
.get("resume_logs", {})
|
|
57
|
+
.get("enabled", True)
|
|
58
|
+
)
|
|
59
|
+
self.auto_generate = (
|
|
60
|
+
self.config.get("context_management", {})
|
|
61
|
+
.get("resume_logs", {})
|
|
62
|
+
.get("auto_generate", True)
|
|
63
|
+
)
|
|
64
|
+
self.max_tokens = (
|
|
65
|
+
self.config.get("context_management", {})
|
|
66
|
+
.get("resume_logs", {})
|
|
67
|
+
.get("max_tokens", 10000)
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Trigger thresholds
|
|
71
|
+
thresholds = self.config.get("context_management", {}).get("thresholds", {})
|
|
72
|
+
self.threshold_caution = thresholds.get("caution", 0.70)
|
|
73
|
+
self.threshold_warning = thresholds.get("warning", 0.85)
|
|
74
|
+
self.threshold_critical = thresholds.get("critical", 0.95)
|
|
75
|
+
|
|
76
|
+
logger.info(
|
|
77
|
+
f"ResumeLogGenerator initialized (enabled={self.enabled}, auto_generate={self.auto_generate})"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def should_generate(
|
|
81
|
+
self,
|
|
82
|
+
stop_reason: Optional[str] = None,
|
|
83
|
+
token_usage_pct: Optional[float] = None,
|
|
84
|
+
manual_trigger: bool = False,
|
|
85
|
+
) -> bool:
|
|
86
|
+
"""Determine if resume log should be generated.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
stop_reason: Claude API stop_reason
|
|
90
|
+
token_usage_pct: Current token usage percentage (0.0-1.0)
|
|
91
|
+
manual_trigger: Manual pause/stop command
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
True if resume log should be generated
|
|
95
|
+
"""
|
|
96
|
+
if not self.enabled or not self.auto_generate:
|
|
97
|
+
return manual_trigger # Only generate on manual trigger if auto is disabled
|
|
98
|
+
|
|
99
|
+
# Trigger conditions
|
|
100
|
+
triggers = [
|
|
101
|
+
stop_reason == "max_tokens",
|
|
102
|
+
stop_reason == "model_context_window_exceeded",
|
|
103
|
+
manual_trigger,
|
|
104
|
+
token_usage_pct and token_usage_pct >= self.threshold_critical,
|
|
105
|
+
token_usage_pct
|
|
106
|
+
and token_usage_pct >= self.threshold_warning, # Generate at 85% too
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
should_gen = any(triggers)
|
|
110
|
+
|
|
111
|
+
if should_gen:
|
|
112
|
+
reason = "unknown"
|
|
113
|
+
if stop_reason:
|
|
114
|
+
reason = f"stop_reason={stop_reason}"
|
|
115
|
+
elif manual_trigger:
|
|
116
|
+
reason = "manual_trigger"
|
|
117
|
+
elif token_usage_pct:
|
|
118
|
+
reason = f"token_usage={token_usage_pct:.1%}"
|
|
119
|
+
|
|
120
|
+
logger.info(f"Resume log generation triggered: {reason}")
|
|
121
|
+
|
|
122
|
+
return should_gen
|
|
123
|
+
|
|
124
|
+
def generate_from_session_state(
|
|
125
|
+
self,
|
|
126
|
+
session_id: str,
|
|
127
|
+
session_state: Dict[str, Any],
|
|
128
|
+
stop_reason: Optional[str] = None,
|
|
129
|
+
) -> Optional[ResumeLog]:
|
|
130
|
+
"""Generate resume log from session state data.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
session_id: Current session ID
|
|
134
|
+
session_state: Session state dictionary
|
|
135
|
+
stop_reason: Claude API stop_reason
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Generated ResumeLog or None if generation failed
|
|
139
|
+
"""
|
|
140
|
+
try:
|
|
141
|
+
# Extract context metrics
|
|
142
|
+
context_data = session_state.get("context_metrics", {})
|
|
143
|
+
context_metrics = ContextMetrics(
|
|
144
|
+
total_budget=context_data.get("total_budget", 200000),
|
|
145
|
+
used_tokens=context_data.get("used_tokens", 0),
|
|
146
|
+
remaining_tokens=context_data.get("remaining_tokens", 0),
|
|
147
|
+
percentage_used=context_data.get("percentage_used", 0.0),
|
|
148
|
+
stop_reason=stop_reason or context_data.get("stop_reason"),
|
|
149
|
+
model=context_data.get("model", "claude-sonnet-4.5"),
|
|
150
|
+
session_id=session_id,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# Extract content from session state
|
|
154
|
+
mission_summary = session_state.get("mission_summary", "")
|
|
155
|
+
accomplishments = session_state.get("accomplishments", [])
|
|
156
|
+
key_findings = session_state.get("key_findings", [])
|
|
157
|
+
decisions_made = session_state.get("decisions_made", [])
|
|
158
|
+
next_steps = session_state.get("next_steps", [])
|
|
159
|
+
critical_context = session_state.get("critical_context", {})
|
|
160
|
+
|
|
161
|
+
# Extract metadata
|
|
162
|
+
files_modified = session_state.get("files_modified", [])
|
|
163
|
+
agents_used = session_state.get("agents_used", {})
|
|
164
|
+
errors_encountered = session_state.get("errors_encountered", [])
|
|
165
|
+
warnings = session_state.get("warnings", [])
|
|
166
|
+
|
|
167
|
+
# Create resume log
|
|
168
|
+
resume_log = ResumeLog(
|
|
169
|
+
session_id=session_id,
|
|
170
|
+
previous_session_id=session_state.get("previous_session_id"),
|
|
171
|
+
context_metrics=context_metrics,
|
|
172
|
+
mission_summary=mission_summary,
|
|
173
|
+
accomplishments=accomplishments,
|
|
174
|
+
key_findings=key_findings,
|
|
175
|
+
decisions_made=decisions_made,
|
|
176
|
+
next_steps=next_steps,
|
|
177
|
+
critical_context=critical_context,
|
|
178
|
+
files_modified=files_modified,
|
|
179
|
+
agents_used=agents_used,
|
|
180
|
+
errors_encountered=errors_encountered,
|
|
181
|
+
warnings=warnings,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
logger.info(f"Generated resume log for session {session_id}")
|
|
185
|
+
return resume_log
|
|
186
|
+
|
|
187
|
+
except Exception as e:
|
|
188
|
+
logger.error(
|
|
189
|
+
f"Failed to generate resume log from session state: {e}", exc_info=True
|
|
190
|
+
)
|
|
191
|
+
return None
|
|
192
|
+
|
|
193
|
+
def generate_from_todo_list(
|
|
194
|
+
self,
|
|
195
|
+
session_id: str,
|
|
196
|
+
todos: List[Dict[str, Any]],
|
|
197
|
+
context_metrics: Optional[ContextMetrics] = None,
|
|
198
|
+
) -> Optional[ResumeLog]:
|
|
199
|
+
"""Generate resume log from TODO list.
|
|
200
|
+
|
|
201
|
+
Useful when session state is minimal but TODO list has rich information.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
session_id: Current session ID
|
|
205
|
+
todos: TODO list items
|
|
206
|
+
context_metrics: Context metrics (optional)
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
Generated ResumeLog or None if generation failed
|
|
210
|
+
"""
|
|
211
|
+
try:
|
|
212
|
+
# Categorize todos
|
|
213
|
+
completed = [t for t in todos if t.get("status") == "completed"]
|
|
214
|
+
in_progress = [t for t in todos if t.get("status") == "in_progress"]
|
|
215
|
+
pending = [t for t in todos if t.get("status") == "pending"]
|
|
216
|
+
|
|
217
|
+
# Build accomplishments from completed tasks
|
|
218
|
+
accomplishments = [f"✓ {task['content']}" for task in completed]
|
|
219
|
+
|
|
220
|
+
# Build next steps from in-progress and pending
|
|
221
|
+
next_steps = []
|
|
222
|
+
for task in in_progress:
|
|
223
|
+
next_steps.append(f"[IN PROGRESS] {task['content']}")
|
|
224
|
+
for task in pending:
|
|
225
|
+
next_steps.append(f"[PENDING] {task['content']}")
|
|
226
|
+
|
|
227
|
+
# Create mission summary
|
|
228
|
+
mission_summary = f"Working on {len(todos)} tasks: {len(completed)} completed, {len(in_progress)} in progress, {len(pending)} pending."
|
|
229
|
+
|
|
230
|
+
# Use provided context metrics or create default
|
|
231
|
+
if context_metrics is None:
|
|
232
|
+
context_metrics = ContextMetrics(session_id=session_id)
|
|
233
|
+
|
|
234
|
+
# Create resume log
|
|
235
|
+
resume_log = ResumeLog(
|
|
236
|
+
session_id=session_id,
|
|
237
|
+
context_metrics=context_metrics,
|
|
238
|
+
mission_summary=mission_summary,
|
|
239
|
+
accomplishments=accomplishments,
|
|
240
|
+
next_steps=next_steps,
|
|
241
|
+
critical_context={
|
|
242
|
+
"total_tasks": len(todos),
|
|
243
|
+
"completed_tasks": len(completed),
|
|
244
|
+
"in_progress_tasks": len(in_progress),
|
|
245
|
+
"pending_tasks": len(pending),
|
|
246
|
+
},
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
logger.info(f"Generated resume log from TODO list for session {session_id}")
|
|
250
|
+
return resume_log
|
|
251
|
+
|
|
252
|
+
except Exception as e:
|
|
253
|
+
logger.error(
|
|
254
|
+
f"Failed to generate resume log from TODO list: {e}", exc_info=True
|
|
255
|
+
)
|
|
256
|
+
return None
|
|
257
|
+
|
|
258
|
+
def save_resume_log(self, resume_log: ResumeLog) -> Optional[Path]:
|
|
259
|
+
"""Save resume log to storage.
|
|
260
|
+
|
|
261
|
+
Args:
|
|
262
|
+
resume_log: ResumeLog instance to save
|
|
263
|
+
|
|
264
|
+
Returns:
|
|
265
|
+
Path to saved file or None if save failed
|
|
266
|
+
"""
|
|
267
|
+
try:
|
|
268
|
+
# Save as markdown (primary format)
|
|
269
|
+
md_path = resume_log.save(storage_dir=self.storage_dir)
|
|
270
|
+
|
|
271
|
+
# Also save as JSON for programmatic access
|
|
272
|
+
json_path = self.storage_dir / f"session-{resume_log.session_id}.json"
|
|
273
|
+
self.state_storage.write_json(
|
|
274
|
+
data=resume_log.to_dict(),
|
|
275
|
+
file_path=json_path,
|
|
276
|
+
atomic=True,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
logger.info(f"Resume log saved: {md_path}")
|
|
280
|
+
return md_path
|
|
281
|
+
|
|
282
|
+
except Exception as e:
|
|
283
|
+
logger.error(f"Failed to save resume log: {e}", exc_info=True)
|
|
284
|
+
return None
|
|
285
|
+
|
|
286
|
+
def load_resume_log(self, session_id: str) -> Optional[str]:
|
|
287
|
+
"""Load resume log markdown content.
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
session_id: Session ID to load
|
|
291
|
+
|
|
292
|
+
Returns:
|
|
293
|
+
Markdown content or None if not found
|
|
294
|
+
"""
|
|
295
|
+
try:
|
|
296
|
+
md_path = self.storage_dir / f"session-{session_id}.md"
|
|
297
|
+
|
|
298
|
+
if not md_path.exists():
|
|
299
|
+
logger.debug(f"Resume log not found for session {session_id}")
|
|
300
|
+
return None
|
|
301
|
+
|
|
302
|
+
content = md_path.read_text(encoding="utf-8")
|
|
303
|
+
logger.info(f"Loaded resume log for session {session_id}")
|
|
304
|
+
return content
|
|
305
|
+
|
|
306
|
+
except Exception as e:
|
|
307
|
+
logger.error(f"Failed to load resume log: {e}", exc_info=True)
|
|
308
|
+
return None
|
|
309
|
+
|
|
310
|
+
def list_resume_logs(self) -> List[Dict[str, Any]]:
|
|
311
|
+
"""List all available resume logs.
|
|
312
|
+
|
|
313
|
+
Returns:
|
|
314
|
+
List of resume log metadata
|
|
315
|
+
"""
|
|
316
|
+
try:
|
|
317
|
+
logs = []
|
|
318
|
+
|
|
319
|
+
for md_file in self.storage_dir.glob("session-*.md"):
|
|
320
|
+
# Extract session ID from filename
|
|
321
|
+
session_id = md_file.stem.replace("session-", "")
|
|
322
|
+
|
|
323
|
+
# Check if JSON metadata exists
|
|
324
|
+
json_file = md_file.with_suffix(".json")
|
|
325
|
+
metadata = {}
|
|
326
|
+
if json_file.exists():
|
|
327
|
+
json_data = self.state_storage.read_json(json_file)
|
|
328
|
+
if json_data:
|
|
329
|
+
metadata = {
|
|
330
|
+
"session_id": session_id,
|
|
331
|
+
"created_at": json_data.get("created_at"),
|
|
332
|
+
"previous_session_id": json_data.get("previous_session_id"),
|
|
333
|
+
"context_metrics": json_data.get("context_metrics", {}),
|
|
334
|
+
"file_path": str(md_file),
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if metadata:
|
|
338
|
+
logs.append(metadata)
|
|
339
|
+
else:
|
|
340
|
+
# Fallback to file metadata
|
|
341
|
+
logs.append(
|
|
342
|
+
{
|
|
343
|
+
"session_id": session_id,
|
|
344
|
+
"file_path": str(md_file),
|
|
345
|
+
"modified_at": datetime.fromtimestamp(
|
|
346
|
+
md_file.stat().st_mtime, tz=timezone.utc
|
|
347
|
+
).isoformat(),
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
# Sort by creation time (newest first)
|
|
352
|
+
logs.sort(
|
|
353
|
+
key=lambda x: x.get("created_at", x.get("modified_at", "")),
|
|
354
|
+
reverse=True,
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
logger.debug(f"Found {len(logs)} resume logs")
|
|
358
|
+
return logs
|
|
359
|
+
|
|
360
|
+
except Exception as e:
|
|
361
|
+
logger.error(f"Failed to list resume logs: {e}", exc_info=True)
|
|
362
|
+
return []
|
|
363
|
+
|
|
364
|
+
def cleanup_old_logs(self, keep_count: int = 10) -> int:
|
|
365
|
+
"""Clean up old resume logs, keeping only the most recent.
|
|
366
|
+
|
|
367
|
+
Args:
|
|
368
|
+
keep_count: Number of logs to keep
|
|
369
|
+
|
|
370
|
+
Returns:
|
|
371
|
+
Number of logs deleted
|
|
372
|
+
"""
|
|
373
|
+
try:
|
|
374
|
+
logs = self.list_resume_logs()
|
|
375
|
+
|
|
376
|
+
if len(logs) <= keep_count:
|
|
377
|
+
logger.debug(
|
|
378
|
+
f"No cleanup needed ({len(logs)} logs <= {keep_count} keep)"
|
|
379
|
+
)
|
|
380
|
+
return 0
|
|
381
|
+
|
|
382
|
+
# Delete old logs
|
|
383
|
+
deleted = 0
|
|
384
|
+
for log in logs[keep_count:]:
|
|
385
|
+
try:
|
|
386
|
+
md_path = Path(log["file_path"])
|
|
387
|
+
json_path = md_path.with_suffix(".json")
|
|
388
|
+
|
|
389
|
+
if md_path.exists():
|
|
390
|
+
md_path.unlink()
|
|
391
|
+
deleted += 1
|
|
392
|
+
|
|
393
|
+
if json_path.exists():
|
|
394
|
+
json_path.unlink()
|
|
395
|
+
|
|
396
|
+
except Exception as e:
|
|
397
|
+
logger.warning(f"Failed to delete log {log['session_id']}: {e}")
|
|
398
|
+
|
|
399
|
+
logger.info(f"Cleaned up {deleted} old resume logs (kept {keep_count})")
|
|
400
|
+
return deleted
|
|
401
|
+
|
|
402
|
+
except Exception as e:
|
|
403
|
+
logger.error(f"Failed to cleanup old logs: {e}", exc_info=True)
|
|
404
|
+
return 0
|
|
405
|
+
|
|
406
|
+
def get_stats(self) -> Dict[str, Any]:
|
|
407
|
+
"""Get resume log statistics.
|
|
408
|
+
|
|
409
|
+
Returns:
|
|
410
|
+
Dictionary with statistics
|
|
411
|
+
"""
|
|
412
|
+
try:
|
|
413
|
+
logs = self.list_resume_logs()
|
|
414
|
+
|
|
415
|
+
total_size = 0
|
|
416
|
+
for log in logs:
|
|
417
|
+
path = Path(log["file_path"])
|
|
418
|
+
if path.exists():
|
|
419
|
+
total_size += path.stat().st_size
|
|
420
|
+
|
|
421
|
+
return {
|
|
422
|
+
"enabled": self.enabled,
|
|
423
|
+
"auto_generate": self.auto_generate,
|
|
424
|
+
"total_logs": len(logs),
|
|
425
|
+
"storage_dir": str(self.storage_dir),
|
|
426
|
+
"total_size_kb": round(total_size / 1024, 2),
|
|
427
|
+
"thresholds": {
|
|
428
|
+
"caution": f"{self.threshold_caution:.0%}",
|
|
429
|
+
"warning": f"{self.threshold_warning:.0%}",
|
|
430
|
+
"critical": f"{self.threshold_critical:.0%}",
|
|
431
|
+
},
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
except Exception as e:
|
|
435
|
+
logger.error(f"Failed to get stats: {e}", exc_info=True)
|
|
436
|
+
return {
|
|
437
|
+
"enabled": self.enabled,
|
|
438
|
+
"error": str(e),
|
|
439
|
+
}
|
|
@@ -32,9 +32,9 @@ USAGE:
|
|
|
32
32
|
DeploymentStateManager,
|
|
33
33
|
HealthCheckManager,
|
|
34
34
|
StartConfig,
|
|
35
|
-
ProcessStatus,
|
|
36
35
|
HealthStatus,
|
|
37
36
|
)
|
|
37
|
+
from claude_mpm.core.enums import ServiceState
|
|
38
38
|
|
|
39
39
|
# Initialize managers
|
|
40
40
|
state_manager = DeploymentStateManager(".claude-mpm/deployment-state.json")
|
|
@@ -54,9 +54,12 @@ USAGE:
|
|
|
54
54
|
|
|
55
55
|
# Start background monitoring
|
|
56
56
|
health_manager.start_monitoring()
|
|
57
|
+
|
|
58
|
+
Note: ProcessStatus has been consolidated into ServiceState (core.enums) as of Phase 3A Batch 24.
|
|
57
59
|
"""
|
|
58
60
|
|
|
59
61
|
# Re-export data models and interfaces for convenience
|
|
62
|
+
from claude_mpm.core.enums import HealthStatus
|
|
60
63
|
from claude_mpm.services.core.interfaces.health import (
|
|
61
64
|
IHealthCheck,
|
|
62
65
|
IHealthCheckManager,
|
|
@@ -78,7 +81,6 @@ from claude_mpm.services.core.interfaces.stability import (
|
|
|
78
81
|
from claude_mpm.services.core.models.health import (
|
|
79
82
|
DeploymentHealth,
|
|
80
83
|
HealthCheckResult,
|
|
81
|
-
HealthStatus,
|
|
82
84
|
)
|
|
83
85
|
from claude_mpm.services.core.models.process import (
|
|
84
86
|
PROTECTED_PORT_RANGES,
|
|
@@ -146,8 +148,8 @@ __all__ = [
|
|
|
146
148
|
"PortConflictError",
|
|
147
149
|
"ProcessInfo",
|
|
148
150
|
"ProcessSpawnError",
|
|
149
|
-
# Data models - Process
|
|
150
151
|
"ProcessStatus",
|
|
152
|
+
# Data models - Process
|
|
151
153
|
"ResourceMonitor",
|
|
152
154
|
"ResourceUsage",
|
|
153
155
|
"RestartAttempt",
|
|
@@ -26,10 +26,10 @@ import threading
|
|
|
26
26
|
from collections import defaultdict
|
|
27
27
|
from typing import Callable, Dict, List, Set
|
|
28
28
|
|
|
29
|
+
from claude_mpm.core.enums import HealthStatus
|
|
29
30
|
from claude_mpm.services.core.base import SyncBaseService
|
|
30
31
|
from claude_mpm.services.core.interfaces.health import IHealthCheckManager
|
|
31
32
|
from claude_mpm.services.core.interfaces.restart import ICrashDetector
|
|
32
|
-
from claude_mpm.services.core.models.health import HealthStatus
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class CrashDetector(SyncBaseService, ICrashDetector):
|
|
@@ -29,10 +29,11 @@ import time
|
|
|
29
29
|
import requests
|
|
30
30
|
from requests.exceptions import ConnectionError, RequestException, Timeout
|
|
31
31
|
|
|
32
|
+
from claude_mpm.core.enums import HealthStatus
|
|
32
33
|
from claude_mpm.services.core.base import SyncBaseService
|
|
33
34
|
from claude_mpm.services.core.interfaces.health import IHealthCheck
|
|
34
35
|
from claude_mpm.services.core.interfaces.process import ILocalProcessManager
|
|
35
|
-
from claude_mpm.services.core.models.health import HealthCheckResult
|
|
36
|
+
from claude_mpm.services.core.models.health import HealthCheckResult
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
class HttpHealthCheck(SyncBaseService, IHealthCheck):
|
|
@@ -22,10 +22,11 @@ USAGE:
|
|
|
22
22
|
|
|
23
23
|
import psutil
|
|
24
24
|
|
|
25
|
+
from claude_mpm.core.enums import HealthStatus
|
|
25
26
|
from claude_mpm.services.core.base import SyncBaseService
|
|
26
27
|
from claude_mpm.services.core.interfaces.health import IHealthCheck
|
|
27
28
|
from claude_mpm.services.core.interfaces.process import ILocalProcessManager
|
|
28
|
-
from claude_mpm.services.core.models.health import HealthCheckResult
|
|
29
|
+
from claude_mpm.services.core.models.health import HealthCheckResult
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
class ProcessHealthCheck(SyncBaseService, IHealthCheck):
|
|
@@ -28,10 +28,11 @@ import platform
|
|
|
28
28
|
|
|
29
29
|
import psutil
|
|
30
30
|
|
|
31
|
+
from claude_mpm.core.enums import HealthStatus
|
|
31
32
|
from claude_mpm.services.core.base import SyncBaseService
|
|
32
33
|
from claude_mpm.services.core.interfaces.health import IHealthCheck
|
|
33
34
|
from claude_mpm.services.core.interfaces.process import ILocalProcessManager
|
|
34
|
-
from claude_mpm.services.core.models.health import HealthCheckResult
|
|
35
|
+
from claude_mpm.services.core.models.health import HealthCheckResult
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
class ResourceHealthCheck(SyncBaseService, IHealthCheck):
|
|
@@ -39,13 +39,13 @@ import threading
|
|
|
39
39
|
from collections import defaultdict
|
|
40
40
|
from typing import Callable, Dict, List, Optional
|
|
41
41
|
|
|
42
|
+
from claude_mpm.core.enums import HealthStatus
|
|
42
43
|
from claude_mpm.services.core.base import SyncBaseService
|
|
43
44
|
from claude_mpm.services.core.interfaces.health import IHealthCheckManager
|
|
44
45
|
from claude_mpm.services.core.interfaces.process import ILocalProcessManager
|
|
45
46
|
from claude_mpm.services.core.models.health import (
|
|
46
47
|
DeploymentHealth,
|
|
47
48
|
HealthCheckResult,
|
|
48
|
-
HealthStatus,
|
|
49
49
|
)
|
|
50
50
|
from claude_mpm.services.local_ops.health_checks import (
|
|
51
51
|
HttpHealthCheck,
|
|
@@ -42,6 +42,7 @@ from typing import List, Optional
|
|
|
42
42
|
|
|
43
43
|
import psutil
|
|
44
44
|
|
|
45
|
+
from claude_mpm.core.enums import ServiceState
|
|
45
46
|
from claude_mpm.services.core.base import SyncBaseService
|
|
46
47
|
from claude_mpm.services.core.interfaces.process import (
|
|
47
48
|
IDeploymentStateManager,
|
|
@@ -50,7 +51,6 @@ from claude_mpm.services.core.interfaces.process import (
|
|
|
50
51
|
from claude_mpm.services.core.models.process import (
|
|
51
52
|
DeploymentState,
|
|
52
53
|
ProcessInfo,
|
|
53
|
-
ProcessStatus,
|
|
54
54
|
StartConfig,
|
|
55
55
|
is_port_protected,
|
|
56
56
|
)
|
|
@@ -203,7 +203,7 @@ class LocalProcessManager(SyncBaseService, ILocalProcessManager):
|
|
|
203
203
|
environment=config.environment,
|
|
204
204
|
port=allocated_port,
|
|
205
205
|
started_at=datetime.now(tz=timezone.utc),
|
|
206
|
-
status=
|
|
206
|
+
status=ServiceState.RUNNING,
|
|
207
207
|
metadata=config.metadata,
|
|
208
208
|
)
|
|
209
209
|
|
|
@@ -248,13 +248,13 @@ class LocalProcessManager(SyncBaseService, ILocalProcessManager):
|
|
|
248
248
|
# Process already dead, just update state
|
|
249
249
|
self.log_info(f"Process {deployment.process_id} already dead")
|
|
250
250
|
self.state_manager.update_deployment_status(
|
|
251
|
-
deployment_id,
|
|
251
|
+
deployment_id, ServiceState.STOPPED
|
|
252
252
|
)
|
|
253
253
|
return True
|
|
254
254
|
|
|
255
255
|
self.log_info(f"Stopping process {deployment.process_id} for {deployment_id}")
|
|
256
256
|
self.state_manager.update_deployment_status(
|
|
257
|
-
deployment_id,
|
|
257
|
+
deployment_id, ServiceState.STOPPING
|
|
258
258
|
)
|
|
259
259
|
|
|
260
260
|
try:
|
|
@@ -262,7 +262,7 @@ class LocalProcessManager(SyncBaseService, ILocalProcessManager):
|
|
|
262
262
|
# Force kill immediately
|
|
263
263
|
self._kill_process_group(process)
|
|
264
264
|
self.state_manager.update_deployment_status(
|
|
265
|
-
deployment_id,
|
|
265
|
+
deployment_id, ServiceState.STOPPED
|
|
266
266
|
)
|
|
267
267
|
return True
|
|
268
268
|
|
|
@@ -275,7 +275,7 @@ class LocalProcessManager(SyncBaseService, ILocalProcessManager):
|
|
|
275
275
|
if not process.is_running():
|
|
276
276
|
self.log_info(f"Process {deployment.process_id} stopped gracefully")
|
|
277
277
|
self.state_manager.update_deployment_status(
|
|
278
|
-
deployment_id,
|
|
278
|
+
deployment_id, ServiceState.STOPPED
|
|
279
279
|
)
|
|
280
280
|
return True
|
|
281
281
|
time.sleep(0.1)
|
|
@@ -286,14 +286,14 @@ class LocalProcessManager(SyncBaseService, ILocalProcessManager):
|
|
|
286
286
|
)
|
|
287
287
|
self._kill_process_group(process)
|
|
288
288
|
self.state_manager.update_deployment_status(
|
|
289
|
-
deployment_id,
|
|
289
|
+
deployment_id, ServiceState.STOPPED
|
|
290
290
|
)
|
|
291
291
|
return True
|
|
292
292
|
|
|
293
293
|
except psutil.NoSuchProcess:
|
|
294
294
|
# Process died during shutdown
|
|
295
295
|
self.state_manager.update_deployment_status(
|
|
296
|
-
deployment_id,
|
|
296
|
+
deployment_id, ServiceState.STOPPED
|
|
297
297
|
)
|
|
298
298
|
return True
|
|
299
299
|
|
|
@@ -370,9 +370,9 @@ class LocalProcessManager(SyncBaseService, ILocalProcessManager):
|
|
|
370
370
|
|
|
371
371
|
# Determine status
|
|
372
372
|
if process.is_running():
|
|
373
|
-
status =
|
|
373
|
+
status = ServiceState.RUNNING
|
|
374
374
|
else:
|
|
375
|
-
status =
|
|
375
|
+
status = ServiceState.STOPPED
|
|
376
376
|
|
|
377
377
|
return ProcessInfo(
|
|
378
378
|
deployment_id=deployment_id,
|
|
@@ -389,13 +389,13 @@ class LocalProcessManager(SyncBaseService, ILocalProcessManager):
|
|
|
389
389
|
return ProcessInfo(
|
|
390
390
|
deployment_id=deployment_id,
|
|
391
391
|
process_id=deployment.process_id,
|
|
392
|
-
status=
|
|
392
|
+
status=ServiceState.ERROR, # CRASHED semantically maps to ERROR state
|
|
393
393
|
port=deployment.port,
|
|
394
394
|
error_message="Process no longer exists",
|
|
395
395
|
)
|
|
396
396
|
|
|
397
397
|
def list_processes(
|
|
398
|
-
self, status_filter: Optional[
|
|
398
|
+
self, status_filter: Optional[ServiceState] = None
|
|
399
399
|
) -> List[ProcessInfo]:
|
|
400
400
|
"""
|
|
401
401
|
List all managed processes.
|
|
@@ -43,6 +43,7 @@ import time
|
|
|
43
43
|
from pathlib import Path
|
|
44
44
|
from typing import Optional, Set
|
|
45
45
|
|
|
46
|
+
from claude_mpm.core.enums import HealthStatus
|
|
46
47
|
from claude_mpm.services.core.base import SyncBaseService
|
|
47
48
|
from claude_mpm.services.core.interfaces.health import IHealthCheckManager
|
|
48
49
|
from claude_mpm.services.core.interfaces.process import ILocalProcessManager
|
|
@@ -51,7 +52,6 @@ from claude_mpm.services.core.interfaces.restart import (
|
|
|
51
52
|
IRestartManager,
|
|
52
53
|
IRestartPolicy,
|
|
53
54
|
)
|
|
54
|
-
from claude_mpm.services.core.models.health import HealthStatus
|
|
55
55
|
from claude_mpm.services.core.models.restart import RestartHistory
|
|
56
56
|
|
|
57
57
|
|