claude-mpm 4.14.7__py3-none-any.whl → 4.14.8__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.

Potentially problematic release.


This version of claude-mpm might be problematic. Click here for more details.

Files changed (78) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/frontmatter_validator.py +284 -253
  3. claude_mpm/cli/__init__.py +34 -740
  4. claude_mpm/cli/commands/agent_manager.py +25 -12
  5. claude_mpm/cli/commands/agent_state_manager.py +186 -0
  6. claude_mpm/cli/commands/agents.py +204 -148
  7. claude_mpm/cli/commands/aggregate.py +7 -3
  8. claude_mpm/cli/commands/analyze.py +9 -4
  9. claude_mpm/cli/commands/analyze_code.py +7 -2
  10. claude_mpm/cli/commands/config.py +47 -13
  11. claude_mpm/cli/commands/configure.py +159 -1801
  12. claude_mpm/cli/commands/configure_agent_display.py +261 -0
  13. claude_mpm/cli/commands/configure_behavior_manager.py +204 -0
  14. claude_mpm/cli/commands/configure_hook_manager.py +225 -0
  15. claude_mpm/cli/commands/configure_models.py +18 -0
  16. claude_mpm/cli/commands/configure_navigation.py +165 -0
  17. claude_mpm/cli/commands/configure_paths.py +104 -0
  18. claude_mpm/cli/commands/configure_persistence.py +254 -0
  19. claude_mpm/cli/commands/configure_startup_manager.py +646 -0
  20. claude_mpm/cli/commands/configure_template_editor.py +497 -0
  21. claude_mpm/cli/commands/configure_validators.py +73 -0
  22. claude_mpm/cli/commands/memory.py +54 -20
  23. claude_mpm/cli/commands/mpm_init.py +35 -21
  24. claude_mpm/cli/executor.py +202 -0
  25. claude_mpm/cli/helpers.py +105 -0
  26. claude_mpm/cli/shared/output_formatters.py +28 -19
  27. claude_mpm/cli/startup.py +455 -0
  28. claude_mpm/core/enums.py +322 -0
  29. claude_mpm/core/instruction_reinforcement_hook.py +2 -1
  30. claude_mpm/core/interactive_session.py +6 -3
  31. claude_mpm/core/logging_config.py +6 -2
  32. claude_mpm/core/oneshot_session.py +8 -4
  33. claude_mpm/core/service_registry.py +5 -1
  34. claude_mpm/core/typing_utils.py +7 -6
  35. claude_mpm/hooks/instruction_reinforcement.py +7 -2
  36. claude_mpm/services/agents/deployment/interface_adapter.py +3 -2
  37. claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +3 -2
  38. claude_mpm/services/agents/memory/agent_memory_manager.py +5 -2
  39. claude_mpm/services/diagnostics/checks/installation_check.py +3 -2
  40. claude_mpm/services/diagnostics/checks/mcp_check.py +20 -6
  41. claude_mpm/services/mcp_gateway/tools/health_check_tool.py +8 -7
  42. claude_mpm/services/memory_hook_service.py +4 -1
  43. claude_mpm/services/monitor/daemon_manager.py +3 -2
  44. claude_mpm/services/monitor/handlers/dashboard.py +2 -1
  45. claude_mpm/services/monitor/handlers/hooks.py +2 -1
  46. claude_mpm/services/monitor/management/lifecycle.py +3 -2
  47. claude_mpm/services/monitor/server.py +2 -1
  48. claude_mpm/services/session_management_service.py +3 -2
  49. claude_mpm/services/socketio/handlers/hook.py +3 -2
  50. claude_mpm/services/socketio/server/main.py +3 -1
  51. claude_mpm/services/subprocess_launcher_service.py +14 -5
  52. claude_mpm/services/unified/analyzer_strategies/code_analyzer.py +6 -5
  53. claude_mpm/services/unified/analyzer_strategies/dependency_analyzer.py +5 -4
  54. claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +5 -4
  55. claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +4 -3
  56. claude_mpm/services/unified/analyzer_strategies/structure_analyzer.py +4 -3
  57. claude_mpm/services/unified/config_strategies/validation_strategy.py +13 -9
  58. claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +10 -3
  59. claude_mpm/services/unified/deployment_strategies/local.py +3 -2
  60. claude_mpm/services/unified/deployment_strategies/utils.py +2 -1
  61. claude_mpm/services/unified/deployment_strategies/vercel.py +2 -1
  62. claude_mpm/services/unified/interfaces.py +3 -1
  63. claude_mpm/services/unified/unified_analyzer.py +7 -6
  64. claude_mpm/services/unified/unified_config.py +2 -1
  65. claude_mpm/services/unified/unified_deployment.py +7 -2
  66. claude_mpm/tools/code_tree_analyzer.py +177 -141
  67. claude_mpm/tools/code_tree_events.py +4 -2
  68. {claude_mpm-4.14.7.dist-info → claude_mpm-4.14.8.dist-info}/METADATA +1 -1
  69. {claude_mpm-4.14.7.dist-info → claude_mpm-4.14.8.dist-info}/RECORD +73 -63
  70. claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +0 -425
  71. claude_mpm/hooks/claude_hooks/hook_handler_original.py +0 -1041
  72. claude_mpm/hooks/claude_hooks/hook_handler_refactored.py +0 -347
  73. claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +0 -575
  74. claude_mpm/services/project/analyzer_refactored.py +0 -450
  75. {claude_mpm-4.14.7.dist-info → claude_mpm-4.14.8.dist-info}/WHEEL +0 -0
  76. {claude_mpm-4.14.7.dist-info → claude_mpm-4.14.8.dist-info}/entry_points.txt +0 -0
  77. {claude_mpm-4.14.7.dist-info → claude_mpm-4.14.8.dist-info}/licenses/LICENSE +0 -0
  78. {claude_mpm-4.14.7.dist-info → claude_mpm-4.14.8.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,322 @@
1
+ """
2
+ Centralized enums for type-safe string constants across Claude MPM.
3
+
4
+ This module provides enumerated types to replace magic strings throughout the codebase,
5
+ improving type safety, IDE autocomplete, and preventing typos.
6
+
7
+ Created: 2025-10-25
8
+ Priority: Phase 1 of systematic enum migration (3-4 week plan)
9
+ Impact: Replaces 2,050+ magic string occurrences
10
+
11
+ Usage:
12
+ from claude_mpm.core.enums import OperationResult, OutputFormat, ServiceState
13
+
14
+ # Type-safe operation results
15
+ result = OperationResult.SUCCESS
16
+ if result == OperationResult.SUCCESS:
17
+ print("Operation completed successfully")
18
+
19
+ # Type-safe output formatting
20
+ format_type = OutputFormat.JSON
21
+
22
+ # Type-safe service state management
23
+ state = ServiceState.RUNNING
24
+ """
25
+
26
+ from enum import StrEnum
27
+
28
+
29
+ class OperationResult(StrEnum):
30
+ """
31
+ Standard result codes for operations throughout Claude MPM.
32
+
33
+ Replaces 876+ occurrences of magic strings like "success", "error", "failed".
34
+ Used in: CLI commands, service operations, API responses, hook handlers.
35
+
36
+ Migration Priority: HIGH (Week 1)
37
+ Coverage: ~42% of all magic strings
38
+ """
39
+
40
+ SUCCESS = "success"
41
+ """Operation completed successfully."""
42
+
43
+ ERROR = "error"
44
+ """Operation encountered an error."""
45
+
46
+ FAILED = "failed"
47
+ """Operation failed to complete."""
48
+
49
+ PENDING = "pending"
50
+ """Operation is waiting to execute."""
51
+
52
+ COMPLETED = "completed"
53
+ """Operation has been completed."""
54
+
55
+ TIMEOUT = "timeout"
56
+ """Operation exceeded time limit."""
57
+
58
+ CANCELLED = "cancelled"
59
+ """Operation was cancelled before completion."""
60
+
61
+ CONTEXT_READY = "context_ready"
62
+ """Context is prepared and ready for use."""
63
+
64
+ SKIPPED = "skipped"
65
+ """Operation was intentionally skipped."""
66
+
67
+ RETRY = "retry"
68
+ """Operation should be retried."""
69
+
70
+ PARTIAL = "partial"
71
+ """Operation completed partially."""
72
+
73
+ UNKNOWN = "unknown"
74
+ """Operation result is unknown or indeterminate."""
75
+
76
+
77
+ class OutputFormat(StrEnum):
78
+ """
79
+ Output format options for CLI commands and logging.
80
+
81
+ Replaces 200+ occurrences of format strings.
82
+ Used in: CLI output, logging, configuration exports, API responses.
83
+
84
+ Migration Priority: HIGH (Week 1)
85
+ Coverage: ~10% of all magic strings
86
+ """
87
+
88
+ JSON = "json"
89
+ """JavaScript Object Notation format."""
90
+
91
+ YAML = "yaml"
92
+ """YAML Ain't Markup Language format."""
93
+
94
+ TEXT = "text"
95
+ """Plain text format."""
96
+
97
+ MARKDOWN = "markdown"
98
+ """Markdown formatted text."""
99
+
100
+ RAW = "raw"
101
+ """Raw unformatted output."""
102
+
103
+ TABLE = "table"
104
+ """Tabular format for display."""
105
+
106
+ CSV = "csv"
107
+ """Comma-separated values format."""
108
+
109
+ HTML = "html"
110
+ """HyperText Markup Language format."""
111
+
112
+ XML = "xml"
113
+ """eXtensible Markup Language format."""
114
+
115
+
116
+ class ServiceState(StrEnum):
117
+ """
118
+ Service lifecycle states for all Claude MPM services.
119
+
120
+ Replaces 150+ occurrences of service state strings.
121
+ Used in: Hook services, MCP servers, monitoring, health checks.
122
+
123
+ Migration Priority: HIGH (Week 1)
124
+ Coverage: ~7% of all magic strings
125
+ """
126
+
127
+ STOPPED = "stopped"
128
+ """Service is completely stopped."""
129
+
130
+ STARTING = "starting"
131
+ """Service is in the process of starting."""
132
+
133
+ RUNNING = "running"
134
+ """Service is actively running."""
135
+
136
+ STOPPING = "stopping"
137
+ """Service is in the process of stopping."""
138
+
139
+ RESTARTING = "restarting"
140
+ """Service is restarting."""
141
+
142
+ ERROR = "error"
143
+ """Service encountered an error."""
144
+
145
+ UNKNOWN = "unknown"
146
+ """Service state cannot be determined."""
147
+
148
+ DEGRADED = "degraded"
149
+ """Service is running but with reduced functionality."""
150
+
151
+ IDLE = "idle"
152
+ """Service is running but not actively processing."""
153
+
154
+
155
+ class ValidationSeverity(StrEnum):
156
+ """
157
+ Severity levels for validation and error reporting.
158
+
159
+ Replaces validation severity strings across validators and error handlers.
160
+ Used in: Frontmatter validation, API validation, config validation.
161
+
162
+ Migration Priority: MEDIUM (Week 2)
163
+ Coverage: ~5% of all magic strings
164
+ """
165
+
166
+ INFO = "info"
167
+ """Informational message, no action required."""
168
+
169
+ WARNING = "warning"
170
+ """Warning that should be addressed but not critical."""
171
+
172
+ ERROR = "error"
173
+ """Error that prevents operation completion."""
174
+
175
+ CRITICAL = "critical"
176
+ """Critical error requiring immediate attention."""
177
+
178
+ DEBUG = "debug"
179
+ """Debug-level information for troubleshooting."""
180
+
181
+
182
+ class ModelTier(StrEnum):
183
+ """
184
+ Claude model tier classifications and identifiers.
185
+
186
+ Replaces model name strings and enables model normalization.
187
+ Used in: Agent configuration, API calls, capability detection.
188
+
189
+ Migration Priority: MEDIUM (Week 2)
190
+ Coverage: ~4% of all magic strings
191
+
192
+ Notes:
193
+ - Replaces manual model normalization code
194
+ - Enables type-safe model selection
195
+ - Provides both tier names and full model identifiers
196
+ """
197
+
198
+ # Tier names (simplified)
199
+ OPUS = "opus"
200
+ """Claude Opus tier (highest capability)."""
201
+
202
+ SONNET = "sonnet"
203
+ """Claude Sonnet tier (balanced)."""
204
+
205
+ HAIKU = "haiku"
206
+ """Claude Haiku tier (fastest)."""
207
+
208
+ # Full model identifiers (Claude 4.x)
209
+ OPUS_4 = "claude-opus-4-20250514"
210
+ """Claude 4 Opus - May 2025 release."""
211
+
212
+ SONNET_4 = "claude-sonnet-4-20250514"
213
+ """Claude 4 Sonnet - May 2025 release."""
214
+
215
+ SONNET_4_5 = "claude-sonnet-4-5-20250929"
216
+ """Claude 4.5 Sonnet - September 2025 release."""
217
+
218
+ # Legacy model identifiers (Claude 3.x)
219
+ OPUS_3 = "claude-3-opus-20240229"
220
+ """Claude 3 Opus - February 2024 release."""
221
+
222
+ SONNET_3_5 = "claude-3-5-sonnet-20241022"
223
+ """Claude 3.5 Sonnet - October 2024 release."""
224
+
225
+ HAIKU_3 = "claude-3-haiku-20240307"
226
+ """Claude 3 Haiku - March 2024 release."""
227
+
228
+ @classmethod
229
+ def normalize(cls, model_name: str) -> "ModelTier":
230
+ """
231
+ Normalize a model name to its canonical tier.
232
+
233
+ Args:
234
+ model_name: Any model name variant (e.g., "opus", "claude-opus-4", "OPUS")
235
+
236
+ Returns:
237
+ Normalized ModelTier enum value
238
+
239
+ Examples:
240
+ >>> ModelTier.normalize("OPUS")
241
+ ModelTier.OPUS
242
+ >>> ModelTier.normalize("claude-sonnet-4-20250514")
243
+ ModelTier.SONNET_4
244
+ >>> ModelTier.normalize("sonnet")
245
+ ModelTier.SONNET
246
+ """
247
+ normalized = model_name.lower().strip()
248
+
249
+ # Direct enum value match
250
+ for tier in cls:
251
+ if tier.value == normalized:
252
+ return tier
253
+
254
+ # Tier name extraction
255
+ if "opus" in normalized:
256
+ return cls.OPUS
257
+ if "sonnet" in normalized:
258
+ return cls.SONNET
259
+ if "haiku" in normalized:
260
+ return cls.HAIKU
261
+
262
+ # Default to sonnet for unknown models
263
+ return cls.SONNET
264
+
265
+
266
+ class AgentCategory(StrEnum):
267
+ """
268
+ Agent specialization categories for classification and routing.
269
+
270
+ Replaces category strings in agent configurations and routing logic.
271
+ Used in: Agent templates, capability detection, routing decisions.
272
+
273
+ Migration Priority: MEDIUM (Week 3)
274
+ Coverage: ~3% of all magic strings
275
+ """
276
+
277
+ RESEARCH = "research"
278
+ """Research and analysis agents."""
279
+
280
+ ENGINEERING = "engineering"
281
+ """Software engineering and implementation agents."""
282
+
283
+ QA = "qa"
284
+ """Quality assurance and testing agents."""
285
+
286
+ SECURITY = "security"
287
+ """Security analysis and vulnerability assessment agents."""
288
+
289
+ DOCUMENTATION = "documentation"
290
+ """Documentation and technical writing agents."""
291
+
292
+ OPERATIONS = "operations"
293
+ """DevOps and infrastructure management agents."""
294
+
295
+ DATA = "data"
296
+ """Data engineering and analytics agents."""
297
+
298
+ VERSION_CONTROL = "version_control"
299
+ """Version control and release management agents."""
300
+
301
+ GENERAL = "general"
302
+ """General-purpose agents without specific specialization."""
303
+
304
+ CUSTOM = "custom"
305
+ """User-defined custom agent categories."""
306
+
307
+ PROJECT_MANAGEMENT = "project_management"
308
+ """Project management and coordination agents."""
309
+
310
+ DESIGN = "design"
311
+ """UI/UX design and frontend agents."""
312
+
313
+
314
+ # Export all enums for convenient access
315
+ __all__ = [
316
+ "AgentCategory",
317
+ "ModelTier",
318
+ "OperationResult",
319
+ "OutputFormat",
320
+ "ServiceState",
321
+ "ValidationSeverity",
322
+ ]
@@ -21,6 +21,7 @@ import threading
21
21
  from datetime import datetime, timezone
22
22
  from typing import Any, Dict, List, Optional
23
23
 
24
+ from ..core.enums import OperationResult
24
25
  from ..core.logger import get_logger
25
26
 
26
27
 
@@ -158,7 +159,7 @@ class InstructionReinforcementHook:
158
159
  # Create reminder todo
159
160
  reminder_todo = {
160
161
  "content": message,
161
- "status": "pending",
162
+ "status": OperationResult.PENDING,
162
163
  "activeForm": "Processing instruction reminder",
163
164
  }
164
165
 
@@ -11,6 +11,7 @@ import uuid
11
11
  from pathlib import Path
12
12
  from typing import Any, Dict, Optional, Tuple
13
13
 
14
+ from claude_mpm.core.enums import ServiceState
14
15
  from claude_mpm.core.logger import get_logger
15
16
 
16
17
 
@@ -179,7 +180,8 @@ class InteractiveSession:
179
180
  # Notify WebSocket if connected
180
181
  if self.runner.websocket_server:
181
182
  self.runner.websocket_server.claude_status_changed(
182
- status="starting", message="Launching Claude interactive session"
183
+ status=ServiceState.STARTING,
184
+ message="Launching Claude interactive session",
183
185
  )
184
186
 
185
187
  # Launch using selected method
@@ -454,7 +456,8 @@ class InteractiveSession:
454
456
  # Notify WebSocket before exec
455
457
  if self.runner.websocket_server:
456
458
  self.runner.websocket_server.claude_status_changed(
457
- status="running", message="Claude process started (exec mode)"
459
+ status=ServiceState.RUNNING,
460
+ message="Claude process started (exec mode)",
458
461
  )
459
462
 
460
463
  # This will not return if successful
@@ -494,7 +497,7 @@ class InteractiveSession:
494
497
  # Notify WebSocket of error
495
498
  if self.runner.websocket_server:
496
499
  self.runner.websocket_server.claude_status_changed(
497
- status="error", message=f"Failed to launch Claude: {error}"
500
+ status=ServiceState.ERROR, message=f"Failed to launch Claude: {error}"
498
501
  )
499
502
 
500
503
  def _handle_keyboard_interrupt(self) -> None:
@@ -24,6 +24,7 @@ from contextlib import contextmanager
24
24
  from pathlib import Path
25
25
  from typing import Any, Dict, Optional, Union
26
26
 
27
+ from claude_mpm.core.enums import OperationResult
27
28
  from claude_mpm.core.logger import (
28
29
  JsonFormatter,
29
30
  finalize_streaming_logs,
@@ -234,7 +235,10 @@ def log_operation(
234
235
  execution_time = time.time() - start_time
235
236
  logger.info(
236
237
  f"Completed {operation}",
237
- extra={"execution_time": execution_time, "status": "success"},
238
+ extra={
239
+ "execution_time": execution_time,
240
+ "status": OperationResult.SUCCESS,
241
+ },
238
242
  )
239
243
  except Exception as e:
240
244
  execution_time = time.time() - start_time
@@ -242,7 +246,7 @@ def log_operation(
242
246
  f"Failed {operation}: {e}",
243
247
  extra={
244
248
  "execution_time": execution_time,
245
- "status": "failure",
249
+ "status": OperationResult.FAILED,
246
250
  "error": str(e),
247
251
  },
248
252
  )
@@ -12,6 +12,7 @@ import uuid
12
12
  from pathlib import Path
13
13
  from typing import Any, Dict, Optional, Tuple
14
14
 
15
+ from claude_mpm.core.enums import OperationResult, ServiceState
15
16
  from claude_mpm.core.logger import get_logger
16
17
 
17
18
 
@@ -162,7 +163,7 @@ class OneshotSession:
162
163
 
163
164
  if self.runner.websocket_server:
164
165
  self.runner.websocket_server.claude_status_changed(
165
- status="running", message="Executing Claude oneshot command"
166
+ status=ServiceState.RUNNING, message="Executing Claude oneshot command"
166
167
  )
167
168
 
168
169
  def _run_subprocess(
@@ -222,7 +223,7 @@ class OneshotSession:
222
223
  # End WebSocket session
223
224
  if self.runner.websocket_server:
224
225
  self.runner.websocket_server.claude_status_changed(
225
- status="stopped", message="Session completed"
226
+ status=ServiceState.STOPPED, message="Session completed"
226
227
  )
227
228
  self.runner.websocket_server.session_ended()
228
229
 
@@ -299,7 +300,9 @@ class OneshotSession:
299
300
  agent_name = self.runner._extract_agent_from_response(response)
300
301
  if agent_name:
301
302
  self.runner.websocket_server.agent_delegated(
302
- agent=agent_name, task=prompt[:100], status="detected"
303
+ agent=agent_name,
304
+ task=prompt[:100],
305
+ status=OperationResult.PENDING,
303
306
  )
304
307
 
305
308
  # Log completion
@@ -335,7 +338,8 @@ class OneshotSession:
335
338
  if self.runner.websocket_server:
336
339
  self.runner.websocket_server.claude_output(error_msg, "stderr")
337
340
  self.runner.websocket_server.claude_status_changed(
338
- status="error", message=f"Command failed with code {return_code}"
341
+ status=ServiceState.ERROR,
342
+ message=f"Command failed with code {return_code}",
339
343
  )
340
344
 
341
345
  # Log error
@@ -10,6 +10,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Union
10
10
  from .base_service import BaseService
11
11
  from .config import Config
12
12
  from .container import DIContainer, ServiceLifetime, get_container
13
+ from .enums import OperationResult
13
14
  from .logger import get_logger
14
15
  from .shared.config_loader import ConfigLoader
15
16
 
@@ -249,7 +250,10 @@ class ServiceRegistry:
249
250
  "metrics": health.metrics,
250
251
  }
251
252
  except Exception as e:
252
- health_status[name] = {"status": "error", "message": str(e)}
253
+ health_status[name] = {
254
+ "status": OperationResult.ERROR,
255
+ "message": str(e),
256
+ }
253
257
 
254
258
  return health_status
255
259
 
@@ -32,6 +32,8 @@ from typing import (
32
32
 
33
33
  from typing_extensions import NotRequired, TypeAlias, TypedDict
34
34
 
35
+ from claude_mpm.core.enums import OperationResult, ServiceState
36
+
35
37
  # Generic type variables
36
38
  T = TypeVar("T")
37
39
  TSession = TypeVar("TSession") # Generic session type
@@ -42,15 +44,14 @@ TService = TypeVar("TService") # Generic service type
42
44
  PathLike: TypeAlias = Union[str, Path]
43
45
  JSONValue: TypeAlias = Union[str, int, float, bool, None, Dict[str, Any], List[Any]]
44
46
  JSONDict: TypeAlias = Dict[str, JSONValue]
47
+
45
48
  Headers: TypeAlias = Dict[str, str]
46
49
  ErrorCode: TypeAlias = Union[int, str]
47
50
  LogLevel: TypeAlias = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
48
51
 
49
52
  # Session types
50
53
  SessionId: TypeAlias = str
51
- SessionStatus: TypeAlias = Literal[
52
- "initializing", "running", "stopped", "error", "completed"
53
- ]
54
+ SessionStatus: TypeAlias = ServiceState # Replaced Literal with ServiceState enum
54
55
  LaunchMethod: TypeAlias = Literal["exec", "subprocess", "oneshot"]
55
56
 
56
57
 
@@ -152,7 +153,7 @@ class WebSocketMessage(TypedDict):
152
153
  class ClaudeStatus(TypedDict):
153
154
  """Claude process status."""
154
155
 
155
- status: Literal["starting", "running", "stopped", "error"]
156
+ status: ServiceState # Replaced Literal with ServiceState enum
156
157
  message: str
157
158
  timestamp: NotRequired[datetime]
158
159
  pid: NotRequired[int]
@@ -163,7 +164,7 @@ class DelegationInfo(TypedDict):
163
164
 
164
165
  agent: AgentId
165
166
  task: str
166
- status: Literal["detected", "started", "completed", "failed"]
167
+ status: OperationResult # Replaced Literal with OperationResult enum
167
168
  timestamp: NotRequired[datetime]
168
169
  result: NotRequired[str]
169
170
 
@@ -194,7 +195,7 @@ class HookContext(TypedDict):
194
195
 
195
196
  # Service types
196
197
  ServiceName: TypeAlias = str
197
- ServiceStatus: TypeAlias = Literal["idle", "running", "stopped", "error"]
198
+ ServiceStatus: TypeAlias = ServiceState # Replaced Literal with ServiceState enum
198
199
 
199
200
 
200
201
  class ServiceConfig(TypedDict):
@@ -10,6 +10,7 @@ from dataclasses import dataclass
10
10
  from enum import Enum
11
11
  from typing import Dict, List, Optional, Tuple
12
12
 
13
+ from claude_mpm.core.enums import OperationResult
13
14
  from claude_mpm.core.logging_utils import get_logger
14
15
 
15
16
  logger = get_logger(__name__)
@@ -267,7 +268,7 @@ class InstructionReinforcementHook:
267
268
  if not self.violations:
268
269
  return {
269
270
  "total_violations": 0,
270
- "status": "COMPLIANT",
271
+ "status": OperationResult.SUCCESS,
271
272
  "message": "No PM delegation violations detected",
272
273
  }
273
274
 
@@ -276,7 +277,11 @@ class InstructionReinforcementHook:
276
277
  vtype = v.violation_type.value
277
278
  violation_types[vtype] = violation_types.get(vtype, 0) + 1
278
279
 
279
- status = "WARNING" if self.violation_count < 3 else "CRITICAL"
280
+ status = (
281
+ OperationResult.ERROR
282
+ if self.violation_count < 3
283
+ else OperationResult.FAILED
284
+ )
280
285
 
281
286
  return {
282
287
  "total_violations": self.violation_count,
@@ -3,6 +3,7 @@
3
3
  from pathlib import Path
4
4
  from typing import Any, Dict, List, Tuple
5
5
 
6
+ from claude_mpm.core.enums import OperationResult
6
7
  from claude_mpm.core.interfaces import AgentDeploymentInterface
7
8
  from claude_mpm.core.logger import get_logger
8
9
 
@@ -195,7 +196,7 @@ class AgentDeploymentInterfaceAdapter(AgentDeploymentInterface):
195
196
  # Ensure the result is a dictionary
196
197
  if not isinstance(status, dict):
197
198
  return {
198
- "status": "unknown",
199
+ "status": OperationResult.UNKNOWN,
199
200
  "error": "Invalid status format from deployment service",
200
201
  "interface_version": "1.0.0",
201
202
  "adapter_used": True,
@@ -210,7 +211,7 @@ class AgentDeploymentInterfaceAdapter(AgentDeploymentInterface):
210
211
  except Exception as e:
211
212
  self.logger.error(f"Failed to get deployment status: {e}", exc_info=True)
212
213
  return {
213
- "status": "error",
214
+ "status": OperationResult.ERROR,
214
215
  "error": str(e),
215
216
  "interface_version": "1.0.0",
216
217
  "adapter_used": True,
@@ -3,6 +3,7 @@
3
3
  from pathlib import Path
4
4
  from typing import Any, Dict, List, Optional, Tuple
5
5
 
6
+ from claude_mpm.core.enums import OperationResult
6
7
  from claude_mpm.core.interfaces import AgentDeploymentInterface
7
8
  from claude_mpm.core.logger import get_logger
8
9
 
@@ -235,7 +236,7 @@ class RefactoredAgentDeploymentService(AgentDeploymentInterface):
235
236
  # Build status information
236
237
  return {
237
238
  "service_version": "refactored-1.0.0",
238
- "status": "ready",
239
+ "status": OperationResult.SUCCESS,
239
240
  "templates_dir": str(self.templates_dir),
240
241
  "base_agent_path": str(self.base_agent_path),
241
242
  "working_directory": str(self.working_directory),
@@ -255,7 +256,7 @@ class RefactoredAgentDeploymentService(AgentDeploymentInterface):
255
256
  self.logger.error(f"Failed to get deployment status: {e}", exc_info=True)
256
257
  return {
257
258
  "service_version": "refactored-1.0.0",
258
- "status": "error",
259
+ "status": OperationResult.ERROR,
259
260
  "error": str(e),
260
261
  }
261
262
 
@@ -25,6 +25,7 @@ import logging
25
25
  from typing import Any, ClassVar, Dict, List, Optional, Tuple
26
26
 
27
27
  from claude_mpm.core.config import Config
28
+ from claude_mpm.core.enums import OperationResult
28
29
  from claude_mpm.core.interfaces import MemoryServiceInterface
29
30
  from claude_mpm.core.unified_paths import get_path_manager
30
31
 
@@ -596,9 +597,10 @@ class AgentMemoryManager(MemoryServiceInterface):
596
597
  """
597
598
  # Deprecated - return informative message
598
599
  return {
599
- "status": "deprecated",
600
+ "status": OperationResult.ERROR, # Deprecated function - calling it is an error
600
601
  "message": "Cross-reference analysis has been deprecated in favor of simplified memory management",
601
602
  "suggestion": "Use get_memory_status() for memory overview",
603
+ "deprecated": True,
602
604
  }
603
605
 
604
606
  def get_all_memories_raw(self) -> Dict[str, Any]:
@@ -613,9 +615,10 @@ class AgentMemoryManager(MemoryServiceInterface):
613
615
  """
614
616
  # Deprecated - return informative message
615
617
  return {
616
- "status": "deprecated",
618
+ "status": OperationResult.ERROR, # Deprecated function - calling it is an error
617
619
  "message": "Raw memory access has been deprecated in favor of simplified memory management",
618
620
  "suggestion": "Use load_agent_memory() for specific agent memories",
621
+ "deprecated": True,
619
622
  }
620
623
 
621
624
  def _save_memory_file_wrapper(self, agent_id: str, content: str) -> bool:
@@ -11,6 +11,7 @@ import sys
11
11
  from pathlib import Path
12
12
  from typing import Optional
13
13
 
14
+ from ....core.enums import OperationResult
14
15
  from ..models import DiagnosticResult, DiagnosticStatus
15
16
  from .base_check import BaseDiagnosticCheck
16
17
 
@@ -418,7 +419,7 @@ class InstallationCheck(BaseDiagnosticCheck):
418
419
  message=f"Missing optional dependencies: {', '.join(warnings)}",
419
420
  details={
420
421
  "optional_missing": warnings,
421
- "status": "partial",
422
+ "status": OperationResult.PARTIAL,
422
423
  "installed": installed,
423
424
  "python_executable": sys.executable,
424
425
  "in_venv": in_venv,
@@ -429,7 +430,7 @@ class InstallationCheck(BaseDiagnosticCheck):
429
430
  status=DiagnosticStatus.OK,
430
431
  message="All dependencies installed",
431
432
  details={
432
- "status": "complete",
433
+ "status": OperationResult.COMPLETED,
433
434
  "installed": installed,
434
435
  "python_executable": sys.executable,
435
436
  "in_venv": in_venv,