claude-mpm 4.1.1__py3-none-any.whl → 4.1.2__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/BUILD_NUMBER +1 -1
- claude_mpm/VERSION +1 -1
- claude_mpm/__main__.py +1 -1
- claude_mpm/agents/BASE_PM.md +74 -46
- claude_mpm/agents/INSTRUCTIONS.md +11 -153
- claude_mpm/agents/WORKFLOW.md +61 -321
- claude_mpm/agents/__init__.py +11 -11
- claude_mpm/agents/agent_loader.py +23 -20
- claude_mpm/agents/agent_loader_integration.py +1 -1
- claude_mpm/agents/agents_metadata.py +27 -0
- claude_mpm/agents/async_agent_loader.py +5 -8
- claude_mpm/agents/base_agent_loader.py +36 -25
- claude_mpm/agents/frontmatter_validator.py +6 -6
- claude_mpm/agents/schema/agent_schema.json +1 -1
- claude_mpm/agents/system_agent_config.py +9 -9
- claude_mpm/agents/templates/api_qa.json +47 -2
- claude_mpm/agents/templates/imagemagick.json +256 -0
- claude_mpm/agents/templates/qa.json +41 -2
- claude_mpm/agents/templates/ticketing.json +5 -5
- claude_mpm/agents/templates/web_qa.json +50 -2
- claude_mpm/cli/__init__.py +51 -46
- claude_mpm/cli/__main__.py +1 -1
- claude_mpm/cli/commands/__init__.py +10 -12
- claude_mpm/cli/commands/agent_manager.py +186 -181
- claude_mpm/cli/commands/agents.py +271 -268
- claude_mpm/cli/commands/aggregate.py +30 -29
- claude_mpm/cli/commands/cleanup.py +50 -44
- claude_mpm/cli/commands/cleanup_orphaned_agents.py +25 -25
- claude_mpm/cli/commands/config.py +162 -127
- claude_mpm/cli/commands/doctor.py +52 -62
- claude_mpm/cli/commands/info.py +37 -25
- claude_mpm/cli/commands/mcp.py +3 -7
- claude_mpm/cli/commands/mcp_command_router.py +14 -18
- claude_mpm/cli/commands/mcp_install_commands.py +28 -23
- claude_mpm/cli/commands/mcp_pipx_config.py +58 -49
- claude_mpm/cli/commands/mcp_server_commands.py +23 -17
- claude_mpm/cli/commands/memory.py +192 -141
- claude_mpm/cli/commands/monitor.py +117 -88
- claude_mpm/cli/commands/run.py +120 -84
- claude_mpm/cli/commands/run_config_checker.py +4 -5
- claude_mpm/cli/commands/socketio_monitor.py +17 -19
- claude_mpm/cli/commands/tickets.py +92 -92
- claude_mpm/cli/parser.py +1 -5
- claude_mpm/cli/parsers/__init__.py +1 -1
- claude_mpm/cli/parsers/agent_manager_parser.py +50 -98
- claude_mpm/cli/parsers/agents_parser.py +2 -3
- claude_mpm/cli/parsers/base_parser.py +7 -5
- claude_mpm/cli/parsers/mcp_parser.py +4 -2
- claude_mpm/cli/parsers/monitor_parser.py +26 -18
- claude_mpm/cli/shared/__init__.py +10 -10
- claude_mpm/cli/shared/argument_patterns.py +57 -71
- claude_mpm/cli/shared/base_command.py +61 -53
- claude_mpm/cli/shared/error_handling.py +62 -58
- claude_mpm/cli/shared/output_formatters.py +78 -77
- claude_mpm/cli/startup_logging.py +204 -172
- claude_mpm/cli/utils.py +10 -11
- claude_mpm/cli_module/__init__.py +1 -1
- claude_mpm/cli_module/args.py +1 -1
- claude_mpm/cli_module/migration_example.py +5 -5
- claude_mpm/config/__init__.py +9 -9
- claude_mpm/config/agent_config.py +15 -14
- claude_mpm/config/experimental_features.py +4 -4
- claude_mpm/config/paths.py +0 -1
- claude_mpm/config/socketio_config.py +5 -6
- claude_mpm/constants.py +1 -2
- claude_mpm/core/__init__.py +8 -8
- claude_mpm/core/agent_name_normalizer.py +1 -1
- claude_mpm/core/agent_registry.py +20 -23
- claude_mpm/core/agent_session_manager.py +3 -3
- claude_mpm/core/base_service.py +7 -15
- claude_mpm/core/cache.py +4 -6
- claude_mpm/core/claude_runner.py +85 -113
- claude_mpm/core/config.py +43 -28
- claude_mpm/core/config_aliases.py +0 -9
- claude_mpm/core/config_constants.py +52 -30
- claude_mpm/core/constants.py +0 -1
- claude_mpm/core/container.py +18 -27
- claude_mpm/core/exceptions.py +2 -2
- claude_mpm/core/factories.py +10 -12
- claude_mpm/core/framework_loader.py +581 -280
- claude_mpm/core/hook_manager.py +26 -22
- claude_mpm/core/hook_performance_config.py +58 -47
- claude_mpm/core/injectable_service.py +1 -1
- claude_mpm/core/interactive_session.py +61 -152
- claude_mpm/core/interfaces.py +1 -100
- claude_mpm/core/lazy.py +5 -5
- claude_mpm/core/log_manager.py +587 -0
- claude_mpm/core/logger.py +125 -8
- claude_mpm/core/logging_config.py +15 -15
- claude_mpm/core/minimal_framework_loader.py +5 -8
- claude_mpm/core/oneshot_session.py +15 -33
- claude_mpm/core/optimized_agent_loader.py +4 -6
- claude_mpm/core/optimized_startup.py +2 -1
- claude_mpm/core/output_style_manager.py +147 -106
- claude_mpm/core/pm_hook_interceptor.py +0 -1
- claude_mpm/core/service_registry.py +11 -8
- claude_mpm/core/session_manager.py +1 -2
- claude_mpm/core/shared/__init__.py +1 -1
- claude_mpm/core/shared/config_loader.py +101 -97
- claude_mpm/core/shared/path_resolver.py +72 -68
- claude_mpm/core/shared/singleton_manager.py +56 -50
- claude_mpm/core/socketio_pool.py +26 -6
- claude_mpm/core/tool_access_control.py +4 -5
- claude_mpm/core/typing_utils.py +50 -59
- claude_mpm/core/unified_agent_registry.py +14 -19
- claude_mpm/core/unified_config.py +4 -6
- claude_mpm/core/unified_paths.py +197 -109
- claude_mpm/dashboard/open_dashboard.py +2 -4
- claude_mpm/experimental/cli_enhancements.py +51 -36
- claude_mpm/generators/agent_profile_generator.py +2 -4
- claude_mpm/hooks/base_hook.py +1 -2
- claude_mpm/hooks/claude_hooks/connection_pool.py +72 -26
- claude_mpm/hooks/claude_hooks/event_handlers.py +93 -38
- claude_mpm/hooks/claude_hooks/hook_handler.py +130 -76
- claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +104 -77
- claude_mpm/hooks/claude_hooks/memory_integration.py +2 -4
- claude_mpm/hooks/claude_hooks/response_tracking.py +15 -11
- claude_mpm/hooks/claude_hooks/tool_analysis.py +12 -18
- claude_mpm/hooks/memory_integration_hook.py +5 -5
- claude_mpm/hooks/tool_call_interceptor.py +1 -1
- claude_mpm/hooks/validation_hooks.py +4 -4
- claude_mpm/init.py +4 -9
- claude_mpm/models/__init__.py +2 -2
- claude_mpm/models/agent_session.py +11 -14
- claude_mpm/scripts/mcp_server.py +20 -11
- claude_mpm/scripts/mcp_wrapper.py +5 -5
- claude_mpm/scripts/mpm_doctor.py +321 -0
- claude_mpm/scripts/socketio_daemon.py +28 -25
- claude_mpm/scripts/socketio_daemon_hardened.py +298 -258
- claude_mpm/scripts/socketio_server_manager.py +116 -95
- claude_mpm/services/__init__.py +49 -49
- claude_mpm/services/agent_capabilities_service.py +12 -18
- claude_mpm/services/agents/__init__.py +22 -22
- claude_mpm/services/agents/agent_builder.py +140 -119
- claude_mpm/services/agents/deployment/__init__.py +3 -3
- claude_mpm/services/agents/deployment/agent_config_provider.py +9 -9
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +19 -20
- claude_mpm/services/agents/deployment/agent_definition_factory.py +1 -5
- claude_mpm/services/agents/deployment/agent_deployment.py +136 -106
- claude_mpm/services/agents/deployment/agent_discovery_service.py +4 -8
- claude_mpm/services/agents/deployment/agent_environment_manager.py +2 -7
- claude_mpm/services/agents/deployment/agent_filesystem_manager.py +6 -10
- claude_mpm/services/agents/deployment/agent_format_converter.py +11 -15
- claude_mpm/services/agents/deployment/agent_frontmatter_validator.py +2 -3
- claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +5 -5
- claude_mpm/services/agents/deployment/agent_metrics_collector.py +13 -19
- claude_mpm/services/agents/deployment/agent_restore_handler.py +0 -1
- claude_mpm/services/agents/deployment/agent_template_builder.py +26 -35
- claude_mpm/services/agents/deployment/agent_validator.py +0 -1
- claude_mpm/services/agents/deployment/agent_version_manager.py +7 -9
- claude_mpm/services/agents/deployment/agent_versioning.py +3 -3
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +6 -7
- claude_mpm/services/agents/deployment/async_agent_deployment.py +51 -38
- claude_mpm/services/agents/deployment/config/__init__.py +1 -1
- claude_mpm/services/agents/deployment/config/deployment_config.py +7 -8
- claude_mpm/services/agents/deployment/deployment_type_detector.py +1 -1
- claude_mpm/services/agents/deployment/deployment_wrapper.py +18 -18
- claude_mpm/services/agents/deployment/facade/__init__.py +1 -1
- claude_mpm/services/agents/deployment/facade/deployment_executor.py +0 -3
- claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -4
- claude_mpm/services/agents/deployment/interface_adapter.py +5 -7
- claude_mpm/services/agents/deployment/multi_source_deployment_service.py +345 -276
- claude_mpm/services/agents/deployment/pipeline/__init__.py +2 -2
- claude_mpm/services/agents/deployment/pipeline/pipeline_builder.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/pipeline_context.py +6 -4
- claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +3 -3
- claude_mpm/services/agents/deployment/pipeline/steps/__init__.py +2 -2
- claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +14 -13
- claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +0 -1
- claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +8 -9
- claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +1 -1
- claude_mpm/services/agents/deployment/processors/__init__.py +1 -1
- claude_mpm/services/agents/deployment/processors/agent_processor.py +20 -16
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +5 -12
- claude_mpm/services/agents/deployment/results/__init__.py +1 -1
- claude_mpm/services/agents/deployment/results/deployment_result_builder.py +1 -1
- claude_mpm/services/agents/deployment/strategies/__init__.py +2 -2
- claude_mpm/services/agents/deployment/strategies/base_strategy.py +1 -7
- claude_mpm/services/agents/deployment/strategies/project_strategy.py +1 -4
- claude_mpm/services/agents/deployment/strategies/system_strategy.py +2 -3
- claude_mpm/services/agents/deployment/strategies/user_strategy.py +3 -7
- claude_mpm/services/agents/deployment/validation/__init__.py +1 -1
- claude_mpm/services/agents/deployment/validation/agent_validator.py +1 -1
- claude_mpm/services/agents/deployment/validation/template_validator.py +2 -2
- claude_mpm/services/agents/deployment/validation/validation_result.py +2 -6
- claude_mpm/services/agents/loading/__init__.py +1 -1
- claude_mpm/services/agents/loading/agent_profile_loader.py +6 -12
- claude_mpm/services/agents/loading/base_agent_manager.py +5 -5
- claude_mpm/services/agents/loading/framework_agent_loader.py +2 -4
- claude_mpm/services/agents/management/__init__.py +1 -1
- claude_mpm/services/agents/management/agent_capabilities_generator.py +1 -3
- claude_mpm/services/agents/management/agent_management_service.py +5 -9
- claude_mpm/services/agents/memory/__init__.py +4 -4
- claude_mpm/services/agents/memory/agent_memory_manager.py +280 -160
- claude_mpm/services/agents/memory/agent_persistence_service.py +0 -2
- claude_mpm/services/agents/memory/content_manager.py +44 -38
- claude_mpm/services/agents/memory/template_generator.py +4 -6
- claude_mpm/services/agents/registry/__init__.py +10 -6
- claude_mpm/services/agents/registry/deployed_agent_discovery.py +30 -27
- claude_mpm/services/agents/registry/modification_tracker.py +3 -6
- claude_mpm/services/async_session_logger.py +1 -2
- claude_mpm/services/claude_session_logger.py +1 -2
- claude_mpm/services/command_deployment_service.py +173 -0
- claude_mpm/services/command_handler_service.py +20 -22
- claude_mpm/services/core/__init__.py +25 -25
- claude_mpm/services/core/base.py +0 -5
- claude_mpm/services/core/interfaces/__init__.py +32 -32
- claude_mpm/services/core/interfaces/agent.py +0 -21
- claude_mpm/services/core/interfaces/communication.py +0 -27
- claude_mpm/services/core/interfaces/infrastructure.py +0 -56
- claude_mpm/services/core/interfaces/service.py +0 -29
- claude_mpm/services/diagnostics/__init__.py +1 -1
- claude_mpm/services/diagnostics/checks/__init__.py +6 -6
- claude_mpm/services/diagnostics/checks/agent_check.py +89 -80
- claude_mpm/services/diagnostics/checks/base_check.py +12 -16
- claude_mpm/services/diagnostics/checks/claude_desktop_check.py +84 -81
- claude_mpm/services/diagnostics/checks/common_issues_check.py +99 -91
- claude_mpm/services/diagnostics/checks/configuration_check.py +82 -77
- claude_mpm/services/diagnostics/checks/filesystem_check.py +67 -68
- claude_mpm/services/diagnostics/checks/installation_check.py +254 -94
- claude_mpm/services/diagnostics/checks/mcp_check.py +90 -88
- claude_mpm/services/diagnostics/checks/monitor_check.py +75 -76
- claude_mpm/services/diagnostics/checks/startup_log_check.py +67 -73
- claude_mpm/services/diagnostics/diagnostic_runner.py +67 -59
- claude_mpm/services/diagnostics/doctor_reporter.py +107 -70
- claude_mpm/services/diagnostics/models.py +21 -19
- claude_mpm/services/event_aggregator.py +10 -17
- claude_mpm/services/event_bus/__init__.py +1 -1
- claude_mpm/services/event_bus/config.py +54 -35
- claude_mpm/services/event_bus/event_bus.py +76 -71
- claude_mpm/services/event_bus/relay.py +74 -64
- claude_mpm/services/events/__init__.py +11 -11
- claude_mpm/services/events/consumers/__init__.py +3 -3
- claude_mpm/services/events/consumers/dead_letter.py +71 -63
- claude_mpm/services/events/consumers/logging.py +39 -37
- claude_mpm/services/events/consumers/metrics.py +56 -57
- claude_mpm/services/events/consumers/socketio.py +82 -81
- claude_mpm/services/events/core.py +110 -99
- claude_mpm/services/events/interfaces.py +56 -72
- claude_mpm/services/events/producers/__init__.py +1 -1
- claude_mpm/services/events/producers/hook.py +38 -38
- claude_mpm/services/events/producers/system.py +46 -44
- claude_mpm/services/exceptions.py +81 -80
- claude_mpm/services/framework_claude_md_generator/__init__.py +2 -4
- claude_mpm/services/framework_claude_md_generator/content_assembler.py +3 -5
- claude_mpm/services/framework_claude_md_generator/content_validator.py +1 -1
- claude_mpm/services/framework_claude_md_generator/deployment_manager.py +4 -4
- claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +0 -1
- claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +0 -2
- claude_mpm/services/framework_claude_md_generator/version_manager.py +4 -5
- claude_mpm/services/hook_service.py +6 -9
- claude_mpm/services/infrastructure/__init__.py +1 -1
- claude_mpm/services/infrastructure/context_preservation.py +8 -12
- claude_mpm/services/infrastructure/monitoring.py +21 -23
- claude_mpm/services/mcp_gateway/__init__.py +37 -37
- claude_mpm/services/mcp_gateway/auto_configure.py +95 -103
- claude_mpm/services/mcp_gateway/config/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/config/config_loader.py +23 -25
- claude_mpm/services/mcp_gateway/config/config_schema.py +5 -5
- claude_mpm/services/mcp_gateway/config/configuration.py +9 -6
- claude_mpm/services/mcp_gateway/core/__init__.py +10 -10
- claude_mpm/services/mcp_gateway/core/base.py +0 -3
- claude_mpm/services/mcp_gateway/core/interfaces.py +1 -38
- claude_mpm/services/mcp_gateway/core/process_pool.py +99 -93
- claude_mpm/services/mcp_gateway/core/singleton_manager.py +65 -62
- claude_mpm/services/mcp_gateway/core/startup_verification.py +75 -74
- claude_mpm/services/mcp_gateway/main.py +2 -1
- claude_mpm/services/mcp_gateway/registry/service_registry.py +5 -8
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +1 -1
- claude_mpm/services/mcp_gateway/server/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/server/mcp_gateway.py +12 -19
- claude_mpm/services/mcp_gateway/server/stdio_handler.py +4 -3
- claude_mpm/services/mcp_gateway/server/stdio_server.py +79 -71
- claude_mpm/services/mcp_gateway/tools/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +5 -6
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +13 -22
- claude_mpm/services/mcp_gateway/tools/health_check_tool.py +79 -78
- claude_mpm/services/mcp_gateway/tools/hello_world.py +12 -14
- claude_mpm/services/mcp_gateway/tools/ticket_tools.py +42 -49
- claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +51 -55
- claude_mpm/services/memory/__init__.py +3 -3
- claude_mpm/services/memory/builder.py +3 -6
- claude_mpm/services/memory/cache/__init__.py +1 -1
- claude_mpm/services/memory/cache/shared_prompt_cache.py +3 -5
- claude_mpm/services/memory/cache/simple_cache.py +1 -1
- claude_mpm/services/memory/indexed_memory.py +5 -7
- claude_mpm/services/memory/optimizer.py +7 -10
- claude_mpm/services/memory/router.py +8 -9
- claude_mpm/services/memory_hook_service.py +48 -34
- claude_mpm/services/monitor_build_service.py +77 -73
- claude_mpm/services/port_manager.py +130 -108
- claude_mpm/services/project/analyzer.py +12 -10
- claude_mpm/services/project/registry.py +11 -11
- claude_mpm/services/recovery_manager.py +10 -19
- claude_mpm/services/response_tracker.py +0 -1
- claude_mpm/services/runner_configuration_service.py +19 -20
- claude_mpm/services/session_management_service.py +7 -11
- claude_mpm/services/shared/__init__.py +1 -1
- claude_mpm/services/shared/async_service_base.py +58 -50
- claude_mpm/services/shared/config_service_base.py +73 -67
- claude_mpm/services/shared/lifecycle_service_base.py +82 -78
- claude_mpm/services/shared/manager_base.py +94 -82
- claude_mpm/services/shared/service_factory.py +96 -98
- claude_mpm/services/socketio/__init__.py +3 -3
- claude_mpm/services/socketio/client_proxy.py +5 -5
- claude_mpm/services/socketio/event_normalizer.py +199 -181
- claude_mpm/services/socketio/handlers/__init__.py +3 -3
- claude_mpm/services/socketio/handlers/base.py +5 -4
- claude_mpm/services/socketio/handlers/connection.py +163 -136
- claude_mpm/services/socketio/handlers/file.py +13 -14
- claude_mpm/services/socketio/handlers/git.py +12 -7
- claude_mpm/services/socketio/handlers/hook.py +49 -44
- claude_mpm/services/socketio/handlers/memory.py +0 -1
- claude_mpm/services/socketio/handlers/project.py +0 -1
- claude_mpm/services/socketio/handlers/registry.py +37 -19
- claude_mpm/services/socketio/migration_utils.py +98 -84
- claude_mpm/services/socketio/server/__init__.py +1 -1
- claude_mpm/services/socketio/server/broadcaster.py +81 -87
- claude_mpm/services/socketio/server/core.py +65 -54
- claude_mpm/services/socketio/server/eventbus_integration.py +95 -56
- claude_mpm/services/socketio/server/main.py +64 -38
- claude_mpm/services/socketio_client_manager.py +10 -12
- claude_mpm/services/subprocess_launcher_service.py +4 -7
- claude_mpm/services/system_instructions_service.py +13 -14
- claude_mpm/services/ticket_manager.py +2 -2
- claude_mpm/services/utility_service.py +5 -13
- claude_mpm/services/version_control/__init__.py +16 -16
- claude_mpm/services/version_control/branch_strategy.py +5 -8
- claude_mpm/services/version_control/conflict_resolution.py +9 -23
- claude_mpm/services/version_control/git_operations.py +5 -7
- claude_mpm/services/version_control/semantic_versioning.py +16 -17
- claude_mpm/services/version_control/version_parser.py +13 -18
- claude_mpm/services/version_service.py +10 -11
- claude_mpm/storage/__init__.py +1 -1
- claude_mpm/storage/state_storage.py +22 -28
- claude_mpm/utils/__init__.py +6 -6
- claude_mpm/utils/agent_dependency_loader.py +47 -33
- claude_mpm/utils/config_manager.py +11 -14
- claude_mpm/utils/dependency_cache.py +1 -1
- claude_mpm/utils/dependency_manager.py +13 -17
- claude_mpm/utils/dependency_strategies.py +8 -10
- claude_mpm/utils/environment_context.py +3 -9
- claude_mpm/utils/error_handler.py +3 -13
- claude_mpm/utils/file_utils.py +1 -1
- claude_mpm/utils/path_operations.py +8 -12
- claude_mpm/utils/robust_installer.py +110 -33
- claude_mpm/utils/subprocess_utils.py +5 -6
- claude_mpm/validation/agent_validator.py +3 -6
- claude_mpm/validation/frontmatter_validator.py +1 -1
- {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/METADATA +1 -1
- claude_mpm-4.1.2.dist-info/RECORD +498 -0
- claude_mpm-4.1.1.dist-info/RECORD +0 -494
- {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.1.dist-info → claude_mpm-4.1.2.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This module handles:
|
|
4
4
|
1. Claude version detection
|
|
5
|
-
2. Output style extraction from framework instructions
|
|
5
|
+
2. Output style extraction from framework instructions
|
|
6
6
|
3. One-time deployment to Claude Code >= 1.0.83 at startup
|
|
7
7
|
4. Fallback injection for older versions
|
|
8
8
|
|
|
@@ -11,13 +11,10 @@ Users can change it if they want, and the system will respect their choice.
|
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
import json
|
|
14
|
-
import logging
|
|
15
|
-
import os
|
|
16
14
|
import re
|
|
17
|
-
import shutil
|
|
18
15
|
import subprocess
|
|
19
16
|
from pathlib import Path
|
|
20
|
-
from typing import Dict, Optional
|
|
17
|
+
from typing import Dict, Optional
|
|
21
18
|
|
|
22
19
|
from ..utils.imports import safe_import
|
|
23
20
|
|
|
@@ -35,14 +32,16 @@ class OutputStyleManager:
|
|
|
35
32
|
self.output_style_dir = Path.home() / ".claude" / "output-styles"
|
|
36
33
|
self.output_style_path = self.output_style_dir / "claude-mpm.md"
|
|
37
34
|
self.settings_file = Path.home() / ".claude" / "settings.json"
|
|
38
|
-
|
|
35
|
+
|
|
39
36
|
# Cache the output style content path
|
|
40
|
-
self.mpm_output_style_path =
|
|
37
|
+
self.mpm_output_style_path = (
|
|
38
|
+
Path(__file__).parent.parent / "agents" / "OUTPUT_STYLE.md"
|
|
39
|
+
)
|
|
41
40
|
|
|
42
41
|
def _detect_claude_version(self) -> Optional[str]:
|
|
43
42
|
"""
|
|
44
43
|
Detect Claude Code version by running 'claude --version'.
|
|
45
|
-
|
|
44
|
+
|
|
46
45
|
Returns:
|
|
47
46
|
Version string (e.g., "1.0.82") or None if Claude not found
|
|
48
47
|
"""
|
|
@@ -52,26 +51,26 @@ class OutputStyleManager:
|
|
|
52
51
|
["claude", "--version"],
|
|
53
52
|
capture_output=True,
|
|
54
53
|
text=True,
|
|
55
|
-
timeout=5
|
|
54
|
+
timeout=5,
|
|
55
|
+
check=False,
|
|
56
56
|
)
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
if result.returncode != 0:
|
|
59
59
|
self.logger.warning(f"Claude command failed: {result.stderr}")
|
|
60
60
|
return None
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
# Parse version from output
|
|
63
63
|
# Expected format: "Claude 1.0.82" or similar
|
|
64
64
|
version_output = result.stdout.strip()
|
|
65
65
|
version_match = re.search(r"(\d+\.\d+\.\d+)", version_output)
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
if version_match:
|
|
68
68
|
version = version_match.group(1)
|
|
69
69
|
self.logger.info(f"Detected Claude version: {version}")
|
|
70
70
|
return version
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
self.logger.warning(f"Could not parse version from: {version_output}")
|
|
72
|
+
return None
|
|
73
|
+
|
|
75
74
|
except FileNotFoundError:
|
|
76
75
|
self.logger.info("Claude Code not found in PATH")
|
|
77
76
|
return None
|
|
@@ -85,29 +84,29 @@ class OutputStyleManager:
|
|
|
85
84
|
def _compare_versions(self, version1: str, version2: str) -> int:
|
|
86
85
|
"""
|
|
87
86
|
Compare two version strings.
|
|
88
|
-
|
|
87
|
+
|
|
89
88
|
Args:
|
|
90
89
|
version1: First version string
|
|
91
90
|
version2: Second version string
|
|
92
|
-
|
|
91
|
+
|
|
93
92
|
Returns:
|
|
94
93
|
-1 if version1 < version2
|
|
95
94
|
0 if version1 == version2
|
|
96
95
|
1 if version1 > version2
|
|
97
96
|
"""
|
|
98
97
|
try:
|
|
99
|
-
v1_parts = [int(x) for x in version1.split(
|
|
100
|
-
v2_parts = [int(x) for x in version2.split(
|
|
101
|
-
|
|
98
|
+
v1_parts = [int(x) for x in version1.split(".")]
|
|
99
|
+
v2_parts = [int(x) for x in version2.split(".")]
|
|
100
|
+
|
|
102
101
|
# Pad shorter version with zeros
|
|
103
102
|
max_len = max(len(v1_parts), len(v2_parts))
|
|
104
103
|
v1_parts.extend([0] * (max_len - len(v1_parts)))
|
|
105
104
|
v2_parts.extend([0] * (max_len - len(v2_parts)))
|
|
106
|
-
|
|
105
|
+
|
|
107
106
|
for i in range(max_len):
|
|
108
107
|
if v1_parts[i] < v2_parts[i]:
|
|
109
108
|
return -1
|
|
110
|
-
|
|
109
|
+
if v1_parts[i] > v2_parts[i]:
|
|
111
110
|
return 1
|
|
112
111
|
return 0
|
|
113
112
|
except Exception as e:
|
|
@@ -117,19 +116,19 @@ class OutputStyleManager:
|
|
|
117
116
|
def supports_output_styles(self) -> bool:
|
|
118
117
|
"""
|
|
119
118
|
Check if Claude Code supports output styles (>= 1.0.83).
|
|
120
|
-
|
|
119
|
+
|
|
121
120
|
Returns:
|
|
122
121
|
True if Claude version >= 1.0.83, False otherwise
|
|
123
122
|
"""
|
|
124
123
|
if not self.claude_version:
|
|
125
124
|
return False
|
|
126
|
-
|
|
125
|
+
|
|
127
126
|
return self._compare_versions(self.claude_version, "1.0.83") >= 0
|
|
128
127
|
|
|
129
128
|
def should_inject_content(self) -> bool:
|
|
130
129
|
"""
|
|
131
130
|
Check if output style content should be injected into instructions.
|
|
132
|
-
|
|
131
|
+
|
|
133
132
|
Returns:
|
|
134
133
|
True if Claude version < 1.0.83 or not detected, False otherwise
|
|
135
134
|
"""
|
|
@@ -138,45 +137,55 @@ class OutputStyleManager:
|
|
|
138
137
|
def extract_output_style_content(self, framework_loader=None) -> str:
|
|
139
138
|
"""
|
|
140
139
|
Extract output style content from framework instructions.
|
|
141
|
-
|
|
140
|
+
|
|
142
141
|
This extracts PM delegation behavior, tone, communication standards,
|
|
143
142
|
response formats, TodoWrite requirements, and workflow rules from:
|
|
144
143
|
- INSTRUCTIONS.md
|
|
145
144
|
- BASE_PM.md
|
|
146
|
-
|
|
145
|
+
|
|
147
146
|
Args:
|
|
148
147
|
framework_loader: Optional FrameworkLoader instance to reuse loaded content
|
|
149
|
-
|
|
148
|
+
|
|
150
149
|
Returns:
|
|
151
150
|
Formatted output style content in YAML frontmatter + markdown format
|
|
152
151
|
"""
|
|
153
152
|
# Build the content sections
|
|
154
153
|
sections = []
|
|
155
|
-
|
|
154
|
+
|
|
156
155
|
# Add YAML frontmatter
|
|
157
156
|
sections.append("---")
|
|
158
157
|
sections.append("name: Claude MPM")
|
|
159
|
-
sections.append(
|
|
158
|
+
sections.append(
|
|
159
|
+
"description: Multi-Agent Project Manager orchestration mode for delegation and coordination"
|
|
160
|
+
)
|
|
160
161
|
sections.append("---")
|
|
161
162
|
sections.append("")
|
|
162
|
-
|
|
163
|
+
|
|
163
164
|
# Header
|
|
164
|
-
sections.append(
|
|
165
|
+
sections.append(
|
|
166
|
+
"You are Claude Multi-Agent PM, a PROJECT MANAGER whose SOLE PURPOSE is to delegate work to specialized agents."
|
|
167
|
+
)
|
|
165
168
|
sections.append("")
|
|
166
|
-
|
|
169
|
+
|
|
167
170
|
# Extract from INSTRUCTIONS.md
|
|
168
|
-
if framework_loader and framework_loader.framework_content.get(
|
|
171
|
+
if framework_loader and framework_loader.framework_content.get(
|
|
172
|
+
"framework_instructions"
|
|
173
|
+
):
|
|
169
174
|
instructions = framework_loader.framework_content["framework_instructions"]
|
|
170
175
|
sections.extend(self._extract_instructions_sections(instructions))
|
|
171
176
|
else:
|
|
172
177
|
# Load from file if no framework_loader provided
|
|
173
|
-
instructions_path =
|
|
178
|
+
instructions_path = (
|
|
179
|
+
Path(__file__).parent.parent / "agents" / "INSTRUCTIONS.md"
|
|
180
|
+
)
|
|
174
181
|
if instructions_path.exists():
|
|
175
182
|
instructions = instructions_path.read_text()
|
|
176
183
|
sections.extend(self._extract_instructions_sections(instructions))
|
|
177
|
-
|
|
184
|
+
|
|
178
185
|
# Extract from BASE_PM.md
|
|
179
|
-
if framework_loader and framework_loader.framework_content.get(
|
|
186
|
+
if framework_loader and framework_loader.framework_content.get(
|
|
187
|
+
"base_pm_instructions"
|
|
188
|
+
):
|
|
180
189
|
base_pm = framework_loader.framework_content["base_pm_instructions"]
|
|
181
190
|
sections.extend(self._extract_base_pm_sections(base_pm))
|
|
182
191
|
else:
|
|
@@ -185,83 +194,105 @@ class OutputStyleManager:
|
|
|
185
194
|
if base_pm_path.exists():
|
|
186
195
|
base_pm = base_pm_path.read_text()
|
|
187
196
|
sections.extend(self._extract_base_pm_sections(base_pm))
|
|
188
|
-
|
|
197
|
+
|
|
189
198
|
return "\n".join(sections)
|
|
190
199
|
|
|
191
200
|
def _extract_instructions_sections(self, content: str) -> list:
|
|
192
201
|
"""Extract relevant sections from INSTRUCTIONS.md."""
|
|
193
202
|
sections = []
|
|
194
|
-
|
|
203
|
+
|
|
195
204
|
# Extract Primary Directive
|
|
196
205
|
if "## 🔴 PRIMARY DIRECTIVE" in content:
|
|
197
206
|
sections.append("## 🔴 PRIMARY DIRECTIVE - MANDATORY DELEGATION 🔴")
|
|
198
207
|
sections.append("")
|
|
199
|
-
sections.append(
|
|
208
|
+
sections.append(
|
|
209
|
+
"**YOU ARE STRICTLY FORBIDDEN FROM DOING ANY WORK DIRECTLY.**"
|
|
210
|
+
)
|
|
200
211
|
sections.append("")
|
|
201
|
-
sections.append(
|
|
212
|
+
sections.append(
|
|
213
|
+
"Direct implementation is ABSOLUTELY PROHIBITED unless the user EXPLICITLY overrides with phrases like:"
|
|
214
|
+
)
|
|
202
215
|
sections.append('- "do this yourself"')
|
|
203
216
|
sections.append('- "don\'t delegate"')
|
|
204
217
|
sections.append('- "implement directly"')
|
|
205
218
|
sections.append('- "you do it"')
|
|
206
219
|
sections.append('- "no delegation"')
|
|
207
220
|
sections.append("")
|
|
208
|
-
|
|
221
|
+
|
|
209
222
|
# Extract Core Identity and Rules
|
|
210
223
|
if "## Core Identity" in content:
|
|
211
224
|
sections.append("## Core Operating Rules")
|
|
212
225
|
sections.append("")
|
|
213
226
|
sections.append("**DEFAULT BEHAVIOR - ALWAYS DELEGATE**:")
|
|
214
|
-
sections.append(
|
|
215
|
-
|
|
216
|
-
|
|
227
|
+
sections.append(
|
|
228
|
+
"- 🔴 You MUST delegate 100% of ALL work to specialized agents by default"
|
|
229
|
+
)
|
|
230
|
+
sections.append(
|
|
231
|
+
"- 🔴 Direct action is STRICTLY FORBIDDEN without explicit user override"
|
|
232
|
+
)
|
|
233
|
+
sections.append(
|
|
234
|
+
"- 🔴 Even the simplest tasks MUST be delegated - NO EXCEPTIONS"
|
|
235
|
+
)
|
|
217
236
|
sections.append("- 🔴 When in doubt, ALWAYS DELEGATE - never act directly")
|
|
218
237
|
sections.append("")
|
|
219
238
|
sections.append("**Allowed Tools**:")
|
|
220
239
|
sections.append("- **Task** for delegation (YOUR PRIMARY FUNCTION)")
|
|
221
240
|
sections.append("- **TodoWrite** for tracking delegation progress ONLY")
|
|
222
|
-
sections.append(
|
|
223
|
-
|
|
241
|
+
sections.append(
|
|
242
|
+
"- **WebSearch/WebFetch** for gathering context BEFORE delegation"
|
|
243
|
+
)
|
|
244
|
+
sections.append(
|
|
245
|
+
"- **Direct answers** ONLY for questions about PM capabilities"
|
|
246
|
+
)
|
|
224
247
|
sections.append("")
|
|
225
|
-
|
|
248
|
+
|
|
226
249
|
# Extract Communication Standards
|
|
227
250
|
if "## Communication Standards" in content:
|
|
228
251
|
sections.append("## Communication Standards")
|
|
229
252
|
sections.append("")
|
|
230
253
|
sections.append("- **Tone**: Professional, neutral by default")
|
|
231
|
-
sections.append(
|
|
254
|
+
sections.append('- **Use**: "Understood", "Confirmed", "Noted"')
|
|
232
255
|
sections.append("- **No simplification** without explicit user request")
|
|
233
256
|
sections.append("- **No mocks** outside test environments")
|
|
234
257
|
sections.append("- **Complete implementations** only - no placeholders")
|
|
235
|
-
sections.append(
|
|
258
|
+
sections.append(
|
|
259
|
+
'- **FORBIDDEN**: Overeager enthusiasm ("Excellent!", "Perfect!", "Amazing!")'
|
|
260
|
+
)
|
|
236
261
|
sections.append("")
|
|
237
|
-
|
|
262
|
+
|
|
238
263
|
# Extract Error Handling
|
|
239
264
|
if "## Error Handling Protocol" in content:
|
|
240
265
|
sections.append("## Error Handling Protocol")
|
|
241
266
|
sections.append("")
|
|
242
267
|
sections.append("**3-Attempt Process**:")
|
|
243
268
|
sections.append("1. **First Failure**: Re-delegate with enhanced context")
|
|
244
|
-
sections.append(
|
|
245
|
-
|
|
269
|
+
sections.append(
|
|
270
|
+
'2. **Second Failure**: Mark "ERROR - Attempt 2/3", escalate if needed'
|
|
271
|
+
)
|
|
272
|
+
sections.append(
|
|
273
|
+
"3. **Third Failure**: TodoWrite escalation with user decision required"
|
|
274
|
+
)
|
|
246
275
|
sections.append("")
|
|
247
|
-
|
|
276
|
+
|
|
248
277
|
# Extract Standard Operating Procedure
|
|
249
278
|
if "## Standard Operating Procedure" in content:
|
|
250
279
|
sections.append("## Standard Operating Procedure")
|
|
251
280
|
sections.append("")
|
|
252
281
|
sections.append("1. **Analysis**: Parse request, assess context (NO TOOLS)")
|
|
253
|
-
sections.append(
|
|
282
|
+
sections.append(
|
|
283
|
+
"2. **Planning**: Agent selection, task breakdown, priority assignment"
|
|
284
|
+
)
|
|
254
285
|
sections.append("3. **Delegation**: Task Tool with enhanced format")
|
|
255
286
|
sections.append("4. **Monitoring**: Track progress via TodoWrite")
|
|
256
287
|
sections.append("5. **Integration**: Synthesize results, validate, report")
|
|
257
288
|
sections.append("")
|
|
258
|
-
|
|
289
|
+
|
|
259
290
|
return sections
|
|
260
291
|
|
|
261
292
|
def _extract_base_pm_sections(self, content: str) -> list:
|
|
262
293
|
"""Extract relevant sections from BASE_PM.md."""
|
|
263
294
|
sections = []
|
|
264
|
-
|
|
295
|
+
|
|
265
296
|
# Extract TodoWrite Requirements
|
|
266
297
|
if "## TodoWrite Framework Requirements" in content:
|
|
267
298
|
sections.append("## TodoWrite Requirements")
|
|
@@ -279,15 +310,19 @@ class OutputStyleManager:
|
|
|
279
310
|
sections.append("### Task Status Management")
|
|
280
311
|
sections.append("")
|
|
281
312
|
sections.append("- `pending` - Task not yet started")
|
|
282
|
-
sections.append(
|
|
313
|
+
sections.append(
|
|
314
|
+
"- `in_progress` - Currently being worked on (ONE at a time)"
|
|
315
|
+
)
|
|
283
316
|
sections.append("- `completed` - Task finished successfully")
|
|
284
317
|
sections.append("")
|
|
285
|
-
|
|
318
|
+
|
|
286
319
|
# Extract PM Response Format
|
|
287
320
|
if "## PM Response Format" in content:
|
|
288
321
|
sections.append("## Response Format")
|
|
289
322
|
sections.append("")
|
|
290
|
-
sections.append(
|
|
323
|
+
sections.append(
|
|
324
|
+
"When completing delegations, provide structured summaries including:"
|
|
325
|
+
)
|
|
291
326
|
sections.append("- Request summary")
|
|
292
327
|
sections.append("- Agents used and task counts")
|
|
293
328
|
sections.append("- Tasks completed with [Agent] prefixes")
|
|
@@ -296,27 +331,27 @@ class OutputStyleManager:
|
|
|
296
331
|
sections.append("- Next steps for user")
|
|
297
332
|
sections.append("- Key information to remember")
|
|
298
333
|
sections.append("")
|
|
299
|
-
|
|
334
|
+
|
|
300
335
|
return sections
|
|
301
336
|
|
|
302
337
|
def save_output_style(self, content: str) -> Path:
|
|
303
338
|
"""
|
|
304
339
|
Save output style content to OUTPUT_STYLE.md.
|
|
305
|
-
|
|
340
|
+
|
|
306
341
|
Args:
|
|
307
342
|
content: The formatted output style content
|
|
308
|
-
|
|
343
|
+
|
|
309
344
|
Returns:
|
|
310
345
|
Path to the saved file
|
|
311
346
|
"""
|
|
312
347
|
try:
|
|
313
348
|
# Ensure the parent directory exists
|
|
314
349
|
self.mpm_output_style_path.parent.mkdir(parents=True, exist_ok=True)
|
|
315
|
-
|
|
350
|
+
|
|
316
351
|
# Write the content
|
|
317
|
-
self.mpm_output_style_path.write_text(content, encoding=
|
|
352
|
+
self.mpm_output_style_path.write_text(content, encoding="utf-8")
|
|
318
353
|
self.logger.info(f"Saved output style to {self.mpm_output_style_path}")
|
|
319
|
-
|
|
354
|
+
|
|
320
355
|
return self.mpm_output_style_path
|
|
321
356
|
except Exception as e:
|
|
322
357
|
self.logger.error(f"Failed to save output style: {e}")
|
|
@@ -326,30 +361,32 @@ class OutputStyleManager:
|
|
|
326
361
|
"""
|
|
327
362
|
Deploy output style to Claude Code if version >= 1.0.83.
|
|
328
363
|
Deploys the style file and activates it once.
|
|
329
|
-
|
|
364
|
+
|
|
330
365
|
Args:
|
|
331
366
|
content: The output style content to deploy
|
|
332
|
-
|
|
367
|
+
|
|
333
368
|
Returns:
|
|
334
369
|
True if deployed successfully, False otherwise
|
|
335
370
|
"""
|
|
336
371
|
if not self.supports_output_styles():
|
|
337
|
-
self.logger.info(
|
|
372
|
+
self.logger.info(
|
|
373
|
+
f"Claude version {self.claude_version or 'unknown'} does not support output styles"
|
|
374
|
+
)
|
|
338
375
|
return False
|
|
339
|
-
|
|
376
|
+
|
|
340
377
|
try:
|
|
341
378
|
# Ensure output-styles directory exists
|
|
342
379
|
self.output_style_dir.mkdir(parents=True, exist_ok=True)
|
|
343
|
-
|
|
380
|
+
|
|
344
381
|
# Write the output style file
|
|
345
|
-
self.output_style_path.write_text(content, encoding=
|
|
382
|
+
self.output_style_path.write_text(content, encoding="utf-8")
|
|
346
383
|
self.logger.info(f"Deployed output style to {self.output_style_path}")
|
|
347
|
-
|
|
384
|
+
|
|
348
385
|
# Activate the claude-mpm style
|
|
349
386
|
self._activate_output_style()
|
|
350
|
-
|
|
387
|
+
|
|
351
388
|
return True
|
|
352
|
-
|
|
389
|
+
|
|
353
390
|
except Exception as e:
|
|
354
391
|
self.logger.error(f"Failed to deploy output style: {e}")
|
|
355
392
|
return False
|
|
@@ -358,7 +395,7 @@ class OutputStyleManager:
|
|
|
358
395
|
"""
|
|
359
396
|
Update Claude Code settings to activate the claude-mpm output style.
|
|
360
397
|
Sets activeOutputStyle to "claude-mpm" once at startup.
|
|
361
|
-
|
|
398
|
+
|
|
362
399
|
Returns:
|
|
363
400
|
True if activated successfully, False otherwise
|
|
364
401
|
"""
|
|
@@ -369,30 +406,33 @@ class OutputStyleManager:
|
|
|
369
406
|
try:
|
|
370
407
|
settings = json.loads(self.settings_file.read_text())
|
|
371
408
|
except json.JSONDecodeError:
|
|
372
|
-
self.logger.warning(
|
|
373
|
-
|
|
409
|
+
self.logger.warning(
|
|
410
|
+
"Could not parse existing settings.json, using defaults"
|
|
411
|
+
)
|
|
412
|
+
|
|
374
413
|
# Check current active style
|
|
375
414
|
current_style = settings.get("activeOutputStyle")
|
|
376
|
-
|
|
415
|
+
|
|
377
416
|
# Update active output style to claude-mpm if not already set
|
|
378
417
|
if current_style != "claude-mpm":
|
|
379
418
|
settings["activeOutputStyle"] = "claude-mpm"
|
|
380
|
-
|
|
419
|
+
|
|
381
420
|
# Ensure settings directory exists
|
|
382
421
|
self.settings_file.parent.mkdir(parents=True, exist_ok=True)
|
|
383
|
-
|
|
422
|
+
|
|
384
423
|
# Write updated settings
|
|
385
424
|
self.settings_file.write_text(
|
|
386
|
-
json.dumps(settings, indent=2),
|
|
387
|
-
|
|
425
|
+
json.dumps(settings, indent=2), encoding="utf-8"
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
self.logger.info(
|
|
429
|
+
f"✅ Activated claude-mpm output style (was: {current_style or 'none'})"
|
|
388
430
|
)
|
|
389
|
-
|
|
390
|
-
self.logger.info(f"✅ Activated claude-mpm output style (was: {current_style or 'none'})")
|
|
391
431
|
else:
|
|
392
432
|
self.logger.debug("Claude MPM output style already active")
|
|
393
|
-
|
|
433
|
+
|
|
394
434
|
return True
|
|
395
|
-
|
|
435
|
+
|
|
396
436
|
except Exception as e:
|
|
397
437
|
self.logger.warning(f"Failed to update settings: {e}")
|
|
398
438
|
return False
|
|
@@ -400,7 +440,7 @@ class OutputStyleManager:
|
|
|
400
440
|
def get_status_summary(self) -> Dict[str, str]:
|
|
401
441
|
"""
|
|
402
442
|
Get a summary of the output style status.
|
|
403
|
-
|
|
443
|
+
|
|
404
444
|
Returns:
|
|
405
445
|
Dictionary with status information
|
|
406
446
|
"""
|
|
@@ -409,18 +449,18 @@ class OutputStyleManager:
|
|
|
409
449
|
"supports_output_styles": "Yes" if self.supports_output_styles() else "No",
|
|
410
450
|
"deployment_mode": "Not initialized",
|
|
411
451
|
"active_style": "Unknown",
|
|
412
|
-
"file_status": "Not checked"
|
|
452
|
+
"file_status": "Not checked",
|
|
413
453
|
}
|
|
414
|
-
|
|
454
|
+
|
|
415
455
|
if self.supports_output_styles():
|
|
416
456
|
status["deployment_mode"] = "Output style deployment"
|
|
417
|
-
|
|
457
|
+
|
|
418
458
|
# Check if file exists
|
|
419
459
|
if self.output_style_path.exists():
|
|
420
460
|
status["file_status"] = "Deployed"
|
|
421
461
|
else:
|
|
422
462
|
status["file_status"] = "Pending deployment"
|
|
423
|
-
|
|
463
|
+
|
|
424
464
|
# Check active style
|
|
425
465
|
if self.settings_file.exists():
|
|
426
466
|
try:
|
|
@@ -432,37 +472,38 @@ class OutputStyleManager:
|
|
|
432
472
|
status["deployment_mode"] = "Framework injection"
|
|
433
473
|
status["file_status"] = "N/A (legacy mode)"
|
|
434
474
|
status["active_style"] = "N/A (legacy mode)"
|
|
435
|
-
|
|
475
|
+
|
|
436
476
|
return status
|
|
437
|
-
|
|
477
|
+
|
|
438
478
|
def get_injectable_content(self, framework_loader=None) -> str:
|
|
439
479
|
"""
|
|
440
480
|
Get output style content for injection into instructions (for Claude < 1.0.83).
|
|
441
|
-
|
|
481
|
+
|
|
442
482
|
This returns a simplified version without YAML frontmatter, suitable for
|
|
443
483
|
injection into the framework instructions.
|
|
444
|
-
|
|
484
|
+
|
|
445
485
|
Args:
|
|
446
486
|
framework_loader: Optional FrameworkLoader instance to reuse loaded content
|
|
447
|
-
|
|
487
|
+
|
|
448
488
|
Returns:
|
|
449
489
|
Simplified output style content for injection
|
|
450
490
|
"""
|
|
451
491
|
# Extract the same content but without YAML frontmatter
|
|
452
492
|
full_content = self.extract_output_style_content(framework_loader)
|
|
453
|
-
|
|
493
|
+
|
|
454
494
|
# Remove YAML frontmatter
|
|
455
|
-
lines = full_content.split(
|
|
456
|
-
if lines[0] ==
|
|
495
|
+
lines = full_content.split("\n")
|
|
496
|
+
if lines[0] == "---":
|
|
457
497
|
# Find the closing ---
|
|
458
498
|
for i in range(1, len(lines)):
|
|
459
|
-
if lines[i] ==
|
|
499
|
+
if lines[i] == "---":
|
|
460
500
|
# Skip frontmatter and empty lines after it
|
|
461
501
|
content_start = i + 1
|
|
462
|
-
while
|
|
502
|
+
while (
|
|
503
|
+
content_start < len(lines) and not lines[content_start].strip()
|
|
504
|
+
):
|
|
463
505
|
content_start += 1
|
|
464
|
-
return
|
|
465
|
-
|
|
506
|
+
return "\n".join(lines[content_start:])
|
|
507
|
+
|
|
466
508
|
# If no frontmatter found, return as-is
|
|
467
509
|
return full_content
|
|
468
|
-
|
|
@@ -129,10 +129,14 @@ class ServiceRegistry:
|
|
|
129
129
|
|
|
130
130
|
# Create factory wrapper if config provided
|
|
131
131
|
if config and not factory:
|
|
132
|
-
|
|
132
|
+
|
|
133
|
+
def factory(c):
|
|
134
|
+
return service_class(name=name, config=config, container=c)
|
|
135
|
+
|
|
133
136
|
elif not factory:
|
|
134
137
|
# Default factory with container injection
|
|
135
|
-
factory
|
|
138
|
+
def factory(c):
|
|
139
|
+
return service_class(name=name, container=c)
|
|
136
140
|
|
|
137
141
|
# Register with DI container
|
|
138
142
|
self.container.register(
|
|
@@ -216,12 +220,11 @@ class ServiceRegistry:
|
|
|
216
220
|
if (
|
|
217
221
|
registration
|
|
218
222
|
and registration.lifetime == ServiceLifetime.SINGLETON
|
|
219
|
-
):
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
logger.info(f"Stopped service: {name}")
|
|
223
|
+
) and service_class in self.container._singletons:
|
|
224
|
+
service = self.container._singletons[service_class]
|
|
225
|
+
if hasattr(service, "stop") and service.running:
|
|
226
|
+
await service.stop()
|
|
227
|
+
logger.info(f"Stopped service: {name}")
|
|
225
228
|
except Exception as e:
|
|
226
229
|
logger.error(f"Failed to stop service {name}: {e}")
|
|
227
230
|
|
|
@@ -195,7 +195,7 @@ class SessionManager:
|
|
|
195
195
|
session_file = self.session_dir / "active_sessions.json"
|
|
196
196
|
if session_file.exists():
|
|
197
197
|
try:
|
|
198
|
-
with open(session_file
|
|
198
|
+
with open(session_file) as f:
|
|
199
199
|
self.active_sessions = json.load(f)
|
|
200
200
|
|
|
201
201
|
# Clean up old sessions on load (archive by default)
|
|
@@ -323,7 +323,6 @@ class OrchestrationSession:
|
|
|
323
323
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
324
324
|
"""Exit session context."""
|
|
325
325
|
# Could add cleanup here if needed
|
|
326
|
-
pass
|
|
327
326
|
|
|
328
327
|
|
|
329
328
|
# Example usage in subprocess orchestrator:
|