claude-mpm 3.7.8__py3-none-any.whl → 3.9.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.
Files changed (100) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_PM.md +0 -106
  3. claude_mpm/agents/INSTRUCTIONS.md +0 -96
  4. claude_mpm/agents/MEMORY.md +94 -0
  5. claude_mpm/agents/WORKFLOW.md +86 -0
  6. claude_mpm/agents/templates/code_analyzer.json +2 -2
  7. claude_mpm/agents/templates/data_engineer.json +1 -1
  8. claude_mpm/agents/templates/documentation.json +1 -1
  9. claude_mpm/agents/templates/engineer.json +1 -1
  10. claude_mpm/agents/templates/ops.json +1 -1
  11. claude_mpm/agents/templates/qa.json +1 -1
  12. claude_mpm/agents/templates/research.json +1 -1
  13. claude_mpm/agents/templates/security.json +1 -1
  14. claude_mpm/agents/templates/ticketing.json +3 -8
  15. claude_mpm/agents/templates/version_control.json +1 -1
  16. claude_mpm/agents/templates/web_qa.json +2 -2
  17. claude_mpm/agents/templates/web_ui.json +2 -2
  18. claude_mpm/cli/__init__.py +2 -2
  19. claude_mpm/cli/commands/__init__.py +2 -1
  20. claude_mpm/cli/commands/agents.py +8 -3
  21. claude_mpm/cli/commands/tickets.py +596 -19
  22. claude_mpm/cli/parser.py +217 -5
  23. claude_mpm/config/__init__.py +30 -39
  24. claude_mpm/config/socketio_config.py +8 -5
  25. claude_mpm/constants.py +13 -0
  26. claude_mpm/core/__init__.py +8 -18
  27. claude_mpm/core/cache.py +596 -0
  28. claude_mpm/core/claude_runner.py +166 -622
  29. claude_mpm/core/config.py +7 -3
  30. claude_mpm/core/constants.py +339 -0
  31. claude_mpm/core/container.py +548 -38
  32. claude_mpm/core/exceptions.py +392 -0
  33. claude_mpm/core/framework_loader.py +249 -93
  34. claude_mpm/core/interactive_session.py +479 -0
  35. claude_mpm/core/interfaces.py +424 -0
  36. claude_mpm/core/lazy.py +467 -0
  37. claude_mpm/core/logging_config.py +444 -0
  38. claude_mpm/core/oneshot_session.py +465 -0
  39. claude_mpm/core/optimized_agent_loader.py +485 -0
  40. claude_mpm/core/optimized_startup.py +490 -0
  41. claude_mpm/core/service_registry.py +52 -26
  42. claude_mpm/core/socketio_pool.py +162 -5
  43. claude_mpm/core/types.py +292 -0
  44. claude_mpm/core/typing_utils.py +477 -0
  45. claude_mpm/hooks/claude_hooks/hook_handler.py +213 -99
  46. claude_mpm/init.py +2 -1
  47. claude_mpm/services/__init__.py +78 -14
  48. claude_mpm/services/agent/__init__.py +24 -0
  49. claude_mpm/services/agent/deployment.py +2548 -0
  50. claude_mpm/services/agent/management.py +598 -0
  51. claude_mpm/services/agent/registry.py +813 -0
  52. claude_mpm/services/agents/deployment/agent_deployment.py +728 -308
  53. claude_mpm/services/agents/memory/agent_memory_manager.py +160 -4
  54. claude_mpm/services/async_session_logger.py +8 -3
  55. claude_mpm/services/communication/__init__.py +21 -0
  56. claude_mpm/services/communication/socketio.py +1933 -0
  57. claude_mpm/services/communication/websocket.py +479 -0
  58. claude_mpm/services/core/__init__.py +123 -0
  59. claude_mpm/services/core/base.py +247 -0
  60. claude_mpm/services/core/interfaces.py +951 -0
  61. claude_mpm/services/framework_claude_md_generator/__init__.py +10 -3
  62. claude_mpm/services/framework_claude_md_generator/deployment_manager.py +14 -11
  63. claude_mpm/services/framework_claude_md_generator/section_generators/todo_task_tools.py +23 -23
  64. claude_mpm/services/framework_claude_md_generator.py +3 -2
  65. claude_mpm/services/health_monitor.py +4 -3
  66. claude_mpm/services/hook_service.py +64 -4
  67. claude_mpm/services/infrastructure/__init__.py +21 -0
  68. claude_mpm/services/infrastructure/logging.py +202 -0
  69. claude_mpm/services/infrastructure/monitoring.py +893 -0
  70. claude_mpm/services/memory/indexed_memory.py +648 -0
  71. claude_mpm/services/project/__init__.py +21 -0
  72. claude_mpm/services/project/analyzer.py +864 -0
  73. claude_mpm/services/project/registry.py +608 -0
  74. claude_mpm/services/project_analyzer.py +95 -2
  75. claude_mpm/services/recovery_manager.py +15 -9
  76. claude_mpm/services/response_tracker.py +3 -5
  77. claude_mpm/services/socketio/__init__.py +25 -0
  78. claude_mpm/services/socketio/handlers/__init__.py +25 -0
  79. claude_mpm/services/socketio/handlers/base.py +121 -0
  80. claude_mpm/services/socketio/handlers/connection.py +198 -0
  81. claude_mpm/services/socketio/handlers/file.py +213 -0
  82. claude_mpm/services/socketio/handlers/git.py +723 -0
  83. claude_mpm/services/socketio/handlers/memory.py +27 -0
  84. claude_mpm/services/socketio/handlers/project.py +25 -0
  85. claude_mpm/services/socketio/handlers/registry.py +145 -0
  86. claude_mpm/services/socketio_client_manager.py +12 -7
  87. claude_mpm/services/socketio_server.py +156 -30
  88. claude_mpm/services/ticket_manager.py +172 -9
  89. claude_mpm/services/ticket_manager_di.py +1 -1
  90. claude_mpm/services/version_control/semantic_versioning.py +80 -7
  91. claude_mpm/services/version_control/version_parser.py +528 -0
  92. claude_mpm/utils/error_handler.py +1 -1
  93. claude_mpm/validation/agent_validator.py +27 -14
  94. claude_mpm/validation/frontmatter_validator.py +231 -0
  95. {claude_mpm-3.7.8.dist-info → claude_mpm-3.9.0.dist-info}/METADATA +38 -128
  96. {claude_mpm-3.7.8.dist-info → claude_mpm-3.9.0.dist-info}/RECORD +100 -59
  97. {claude_mpm-3.7.8.dist-info → claude_mpm-3.9.0.dist-info}/WHEEL +0 -0
  98. {claude_mpm-3.7.8.dist-info → claude_mpm-3.9.0.dist-info}/entry_points.txt +0 -0
  99. {claude_mpm-3.7.8.dist-info → claude_mpm-3.9.0.dist-info}/licenses/LICENSE +0 -0
  100. {claude_mpm-3.7.8.dist-info → claude_mpm-3.9.0.dist-info}/top_level.txt +0 -0
@@ -2,6 +2,14 @@
2
2
  Core Service Interfaces for Claude PM Framework
3
3
  ==============================================
4
4
 
5
+ DEPRECATED: This file has been moved to services/core/interfaces.py
6
+
7
+ This file is maintained for backward compatibility only.
8
+ All new code should import from claude_mpm.services.core.interfaces
9
+
10
+ Part of TSK-0046: Service Layer Architecture Reorganization
11
+
12
+ Original description:
5
13
  This module defines the core service interfaces that establish contracts for
6
14
  dependency injection, service discovery, and framework orchestration.
7
15
 
@@ -17,6 +25,10 @@ Phase 1 Refactoring: Interface extraction and dependency injection foundation
17
25
  These interfaces reduce cyclomatic complexity and establish clean separation of concerns.
18
26
  """
19
27
 
28
+ # Re-export everything from the new location for backward compatibility
29
+ from claude_mpm.services.core.interfaces import *
30
+
31
+ # Keep original imports to prevent any parsing issues
20
32
  from abc import ABC, abstractmethod
21
33
  from typing import Any, Dict, List, Optional, Set, Tuple, Union, TypeVar, Generic
22
34
  from dataclasses import dataclass
@@ -505,6 +517,412 @@ class IEventBus(ABC):
505
517
  pass
506
518
 
507
519
 
520
+ # Agent deployment interface
521
+ class AgentDeploymentInterface(ABC):
522
+ """Interface for agent deployment operations.
523
+
524
+ WHY: Agent deployment needs to be decoupled from concrete implementations
525
+ to enable different deployment strategies (local, remote, containerized).
526
+ This interface ensures consistency across different deployment backends.
527
+
528
+ DESIGN DECISION: Methods return deployment status/results to enable
529
+ proper error handling and rollback operations when deployments fail.
530
+ """
531
+
532
+ @abstractmethod
533
+ def deploy_agents(self, force: bool = False, include_all: bool = False) -> Dict[str, Any]:
534
+ """Deploy agents to target environment.
535
+
536
+ Args:
537
+ force: Force deployment even if agents already exist
538
+ include_all: Include all agents, ignoring exclusion lists
539
+
540
+ Returns:
541
+ Dictionary with deployment results and status
542
+ """
543
+ pass
544
+
545
+ @abstractmethod
546
+ def validate_agent(self, agent_path: Path) -> Tuple[bool, List[str]]:
547
+ """Validate agent configuration and structure.
548
+
549
+ Args:
550
+ agent_path: Path to agent configuration file
551
+
552
+ Returns:
553
+ Tuple of (is_valid, list_of_errors)
554
+ """
555
+ pass
556
+
557
+ @abstractmethod
558
+ def clean_deployment(self, preserve_user_agents: bool = True) -> bool:
559
+ """Clean up deployed agents.
560
+
561
+ Args:
562
+ preserve_user_agents: Whether to keep user-created agents
563
+
564
+ Returns:
565
+ True if cleanup successful
566
+ """
567
+ pass
568
+
569
+ @abstractmethod
570
+ def get_deployment_status(self) -> Dict[str, Any]:
571
+ """Get current deployment status and metrics.
572
+
573
+ Returns:
574
+ Dictionary with deployment status information
575
+ """
576
+ pass
577
+
578
+
579
+ # Memory service interface
580
+ class MemoryServiceInterface(ABC):
581
+ """Interface for memory management operations.
582
+
583
+ WHY: Memory management is crucial for agent learning and context retention.
584
+ This interface abstracts memory storage, retrieval, and optimization to
585
+ enable different backends (file-based, database, distributed cache).
586
+
587
+ DESIGN DECISION: Memory operations return success/failure status to enable
588
+ proper error handling and fallback strategies when memory is unavailable.
589
+ """
590
+
591
+ @abstractmethod
592
+ def load_memory(self, agent_id: str) -> Optional[str]:
593
+ """Load memory for a specific agent.
594
+
595
+ Args:
596
+ agent_id: Identifier of the agent
597
+
598
+ Returns:
599
+ Memory content as string or None if not found
600
+ """
601
+ pass
602
+
603
+ @abstractmethod
604
+ def save_memory(self, agent_id: str, content: str) -> bool:
605
+ """Save memory for a specific agent.
606
+
607
+ Args:
608
+ agent_id: Identifier of the agent
609
+ content: Memory content to save
610
+
611
+ Returns:
612
+ True if save successful
613
+ """
614
+ pass
615
+
616
+ @abstractmethod
617
+ def validate_memory_size(self, content: str) -> Tuple[bool, Optional[str]]:
618
+ """Validate memory content size and structure.
619
+
620
+ Args:
621
+ content: Memory content to validate
622
+
623
+ Returns:
624
+ Tuple of (is_valid, error_message)
625
+ """
626
+ pass
627
+
628
+ @abstractmethod
629
+ def optimize_memory(self, agent_id: str) -> bool:
630
+ """Optimize memory by removing duplicates and consolidating entries.
631
+
632
+ Args:
633
+ agent_id: Identifier of the agent
634
+
635
+ Returns:
636
+ True if optimization successful
637
+ """
638
+ pass
639
+
640
+ @abstractmethod
641
+ def get_memory_metrics(self, agent_id: Optional[str] = None) -> Dict[str, Any]:
642
+ """Get memory usage metrics.
643
+
644
+ Args:
645
+ agent_id: Optional specific agent ID, or None for all
646
+
647
+ Returns:
648
+ Dictionary with memory metrics
649
+ """
650
+ pass
651
+
652
+
653
+ # Hook service interface
654
+ class HookServiceInterface(ABC):
655
+ """Interface for hook execution operations.
656
+
657
+ WHY: Hooks provide extensibility points for the framework, allowing plugins
658
+ and extensions to modify behavior. This interface ensures consistent hook
659
+ registration, priority handling, and execution across different hook systems.
660
+
661
+ DESIGN DECISION: Separate pre/post delegation methods for clarity and
662
+ performance - no runtime type checking needed during execution.
663
+ """
664
+
665
+ @abstractmethod
666
+ def register_hook(self, hook: Any) -> bool:
667
+ """Register a hook with the service.
668
+
669
+ Args:
670
+ hook: Hook instance to register
671
+
672
+ Returns:
673
+ True if registration successful
674
+ """
675
+ pass
676
+
677
+ @abstractmethod
678
+ def execute_pre_delegation_hooks(self, context: Any) -> Any:
679
+ """Execute all pre-delegation hooks.
680
+
681
+ Args:
682
+ context: Hook execution context
683
+
684
+ Returns:
685
+ Hook execution result
686
+ """
687
+ pass
688
+
689
+ @abstractmethod
690
+ def execute_post_delegation_hooks(self, context: Any) -> Any:
691
+ """Execute all post-delegation hooks.
692
+
693
+ Args:
694
+ context: Hook execution context
695
+
696
+ Returns:
697
+ Hook execution result
698
+ """
699
+ pass
700
+
701
+ @abstractmethod
702
+ def get_registered_hooks(self) -> Dict[str, List[Any]]:
703
+ """Get all registered hooks by type.
704
+
705
+ Returns:
706
+ Dictionary mapping hook types to lists of hooks
707
+ """
708
+ pass
709
+
710
+ @abstractmethod
711
+ def clear_hooks(self, hook_type: Optional[str] = None) -> None:
712
+ """Clear registered hooks.
713
+
714
+ Args:
715
+ hook_type: Optional specific hook type to clear, or None for all
716
+ """
717
+ pass
718
+
719
+
720
+ # WebSocket/SocketIO service interface
721
+ class SocketIOServiceInterface(ABC):
722
+ """Interface for WebSocket communication.
723
+
724
+ WHY: Real-time communication is essential for monitoring and interactive
725
+ features. This interface abstracts WebSocket/SocketIO implementation to
726
+ enable different transport mechanisms and fallback strategies.
727
+
728
+ DESIGN DECISION: Async methods for non-blocking I/O operations, with
729
+ support for both broadcast and targeted messaging.
730
+ """
731
+
732
+ @abstractmethod
733
+ async def start(self, host: str = "localhost", port: int = 8765) -> None:
734
+ """Start the WebSocket server.
735
+
736
+ Args:
737
+ host: Host to bind to
738
+ port: Port to listen on
739
+ """
740
+ pass
741
+
742
+ @abstractmethod
743
+ async def stop(self) -> None:
744
+ """Stop the WebSocket server."""
745
+ pass
746
+
747
+ @abstractmethod
748
+ async def emit(self, event: str, data: Any, room: Optional[str] = None) -> None:
749
+ """Emit an event to connected clients.
750
+
751
+ Args:
752
+ event: Event name
753
+ data: Event data
754
+ room: Optional room to target
755
+ """
756
+ pass
757
+
758
+ @abstractmethod
759
+ async def broadcast(self, event: str, data: Any) -> None:
760
+ """Broadcast event to all connected clients.
761
+
762
+ Args:
763
+ event: Event name
764
+ data: Event data
765
+ """
766
+ pass
767
+
768
+ @abstractmethod
769
+ def get_connection_count(self) -> int:
770
+ """Get number of connected clients.
771
+
772
+ Returns:
773
+ Number of active connections
774
+ """
775
+ pass
776
+
777
+ @abstractmethod
778
+ def is_running(self) -> bool:
779
+ """Check if server is running.
780
+
781
+ Returns:
782
+ True if server is active
783
+ """
784
+ pass
785
+
786
+
787
+ # Project analyzer interface
788
+ class ProjectAnalyzerInterface(ABC):
789
+ """Interface for project analysis operations.
790
+
791
+ WHY: Understanding project structure and characteristics is essential for
792
+ context-aware agent behavior. This interface abstracts project analysis
793
+ to support different project types and structures.
794
+
795
+ DESIGN DECISION: Returns structured data classes for type safety and
796
+ clear contracts between analysis and consumption components.
797
+ """
798
+
799
+ @abstractmethod
800
+ def analyze_project(self, project_path: Optional[Path] = None) -> Any:
801
+ """Analyze project characteristics.
802
+
803
+ Args:
804
+ project_path: Optional path to project, defaults to current
805
+
806
+ Returns:
807
+ ProjectCharacteristics or similar structured data
808
+ """
809
+ pass
810
+
811
+ @abstractmethod
812
+ def detect_technology_stack(self) -> List[str]:
813
+ """Detect technologies used in the project.
814
+
815
+ Returns:
816
+ List of detected technologies
817
+ """
818
+ pass
819
+
820
+ @abstractmethod
821
+ def analyze_code_patterns(self) -> Dict[str, Any]:
822
+ """Analyze code patterns and conventions.
823
+
824
+ Returns:
825
+ Dictionary of pattern analysis results
826
+ """
827
+ pass
828
+
829
+ @abstractmethod
830
+ def get_project_structure(self) -> Dict[str, Any]:
831
+ """Get project directory structure analysis.
832
+
833
+ Returns:
834
+ Dictionary representing project structure
835
+ """
836
+ pass
837
+
838
+ @abstractmethod
839
+ def identify_entry_points(self) -> List[Path]:
840
+ """Identify project entry points.
841
+
842
+ Returns:
843
+ List of entry point paths
844
+ """
845
+ pass
846
+
847
+
848
+ # Ticket manager interface
849
+ class TicketManagerInterface(ABC):
850
+ """Interface for ticket management operations.
851
+
852
+ WHY: Ticket management provides work tracking and organization. This
853
+ interface abstracts ticket operations to support different backend
854
+ systems (file-based, API-based, database).
855
+
856
+ DESIGN DECISION: Uses string IDs for flexibility across different
857
+ ticketing systems, with structured data returns for consistency.
858
+ """
859
+
860
+ @abstractmethod
861
+ def create_task(self, title: str, description: str, **kwargs) -> Optional[str]:
862
+ """Create a new task ticket.
863
+
864
+ Args:
865
+ title: Task title
866
+ description: Task description
867
+ **kwargs: Additional task properties
868
+
869
+ Returns:
870
+ Task ID if created successfully, None otherwise
871
+ """
872
+ pass
873
+
874
+ @abstractmethod
875
+ def update_task(self, task_id: str, **updates) -> bool:
876
+ """Update an existing task.
877
+
878
+ Args:
879
+ task_id: ID of task to update
880
+ **updates: Fields to update
881
+
882
+ Returns:
883
+ True if update successful
884
+ """
885
+ pass
886
+
887
+ @abstractmethod
888
+ def get_task(self, task_id: str) -> Optional[Dict[str, Any]]:
889
+ """Get task details.
890
+
891
+ Args:
892
+ task_id: ID of task to retrieve
893
+
894
+ Returns:
895
+ Task data dictionary or None if not found
896
+ """
897
+ pass
898
+
899
+ @abstractmethod
900
+ def list_tasks(self, status: Optional[str] = None, **filters) -> List[Dict[str, Any]]:
901
+ """List tasks with optional filtering.
902
+
903
+ Args:
904
+ status: Optional status filter
905
+ **filters: Additional filter criteria
906
+
907
+ Returns:
908
+ List of task dictionaries
909
+ """
910
+ pass
911
+
912
+ @abstractmethod
913
+ def close_task(self, task_id: str, resolution: Optional[str] = None) -> bool:
914
+ """Close a task.
915
+
916
+ Args:
917
+ task_id: ID of task to close
918
+ resolution: Optional resolution description
919
+
920
+ Returns:
921
+ True if close successful
922
+ """
923
+ pass
924
+
925
+
508
926
  # Interface registry for dependency injection discovery
509
927
  class InterfaceRegistry:
510
928
  """Registry of all core interfaces for dependency injection"""
@@ -521,6 +939,12 @@ class InterfaceRegistry:
521
939
  'error_handler': IErrorHandler,
522
940
  'performance_monitor': IPerformanceMonitor,
523
941
  'event_bus': IEventBus,
942
+ 'agent_deployment': AgentDeploymentInterface,
943
+ 'memory_service': MemoryServiceInterface,
944
+ 'hook_service': HookServiceInterface,
945
+ 'socketio_service': SocketIOServiceInterface,
946
+ 'project_analyzer': ProjectAnalyzerInterface,
947
+ 'ticket_manager': TicketManagerInterface,
524
948
  }
525
949
 
526
950
  @classmethod