claude-mpm 5.6.3__py3-none-any.whl → 5.6.4__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 CHANGED
@@ -1 +1 @@
1
- 5.6.3
1
+ 5.6.4
@@ -8,12 +8,20 @@ Claude Code hook events.
8
8
  import os
9
9
  import re
10
10
  import subprocess # nosec B404 - subprocess used for safe claude CLI version checking only
11
- import sys
12
11
  import uuid
13
12
  from datetime import datetime, timezone
14
13
  from pathlib import Path
15
14
  from typing import Optional
16
15
 
16
+ # Import _log helper to avoid stderr writes (which cause hook errors)
17
+ try:
18
+ from .hook_handler import _log
19
+ except ImportError:
20
+ # Fallback for direct execution
21
+ def _log(message: str) -> None:
22
+ """Fallback logger when hook_handler not available."""
23
+
24
+
17
25
  # Import tool analysis with fallback for direct execution
18
26
  try:
19
27
  # Try relative import first (when imported as module)
@@ -34,8 +42,8 @@ except ImportError:
34
42
  extract_tool_results,
35
43
  )
36
44
 
37
- # Debug mode
38
- DEBUG = os.environ.get("CLAUDE_MPM_HOOK_DEBUG", "true").lower() != "false"
45
+ # Debug mode - MUST match hook_handler.py default (false) to prevent stderr writes
46
+ DEBUG = os.environ.get("CLAUDE_MPM_HOOK_DEBUG", "false").lower() == "true"
39
47
 
40
48
  # Import constants for configuration
41
49
  try:
@@ -111,9 +119,8 @@ class EventHandlers:
111
119
  "working_directory": working_dir,
112
120
  }
113
121
  if DEBUG:
114
- print(
115
- f"Stored prompt for comprehensive tracking: session {session_id[:8]}...",
116
- file=sys.stderr,
122
+ _log(
123
+ f"Stored prompt for comprehensive tracking: session {session_id[:8]}..."
117
124
  )
118
125
  except Exception: # nosec B110
119
126
  # Response tracking is optional - silently continue if it fails
@@ -133,11 +140,8 @@ class EventHandlers:
133
140
  # Enhanced debug logging for session correlation
134
141
  session_id = event.get("session_id", "")
135
142
  if DEBUG:
136
- print(
137
- f" - session_id: {session_id[:16] if session_id else 'None'}...",
138
- file=sys.stderr,
139
- )
140
- print(f" - event keys: {list(event.keys())}", file=sys.stderr)
143
+ _log(f" - session_id: {session_id[:16] if session_id else 'None'}...")
144
+ _log(f" - event keys: {list(event.keys())}")
141
145
 
142
146
  tool_name = event.get("tool_name", "")
143
147
  tool_input = event.get("tool_input", {})
@@ -180,9 +184,8 @@ class EventHandlers:
180
184
 
181
185
  CorrelationManager.store(session_id, tool_call_id, tool_name)
182
186
  if DEBUG:
183
- print(
184
- f" - Generated tool_call_id: {tool_call_id[:8]}... for session {session_id[:8]}...",
185
- file=sys.stderr,
187
+ _log(
188
+ f" - Generated tool_call_id: {tool_call_id[:8]}... for session {session_id[:8]}..."
186
189
  )
187
190
 
188
191
  # Add delegation-specific data if this is a Task tool
@@ -196,7 +199,7 @@ class EventHandlers:
196
199
  auto_pause.on_tool_call(tool_name, tool_input)
197
200
  except Exception as e:
198
201
  if DEBUG:
199
- print(f"Auto-pause tool recording error: {e}", file=sys.stderr)
202
+ _log(f"Auto-pause tool recording error: {e}")
200
203
 
201
204
  self.hook_handler._emit_socketio_event("", "pre_tool", pre_tool_data)
202
205
 
@@ -212,9 +215,8 @@ class EventHandlers:
212
215
  }
213
216
  self.hook_handler._emit_socketio_event("", "todo_updated", todo_data)
214
217
  if DEBUG:
215
- print(
216
- f" - Emitted todo_updated event with {len(tool_params['todos'])} todos for session {session_id[:8]}...",
217
- file=sys.stderr,
218
+ _log(
219
+ f" - Emitted todo_updated event with {len(tool_params['todos'])} todos for session {session_id[:8]}..."
218
220
  )
219
221
 
220
222
  def _handle_task_delegation(
@@ -255,12 +257,9 @@ class EventHandlers:
255
257
 
256
258
  # Track this delegation for SubagentStop correlation and response tracking
257
259
  if DEBUG:
258
- print(
259
- f" - session_id: {session_id[:16] if session_id else 'None'}...",
260
- file=sys.stderr,
261
- )
262
- print(f" - agent_type: {agent_type}", file=sys.stderr)
263
- print(f" - raw_agent_type: {raw_agent_type}", file=sys.stderr)
260
+ _log(f" - session_id: {session_id[:16] if session_id else 'None'}...")
261
+ _log(f" - agent_type: {agent_type}")
262
+ _log(f" - raw_agent_type: {raw_agent_type}")
264
263
 
265
264
  if session_id and agent_type != "unknown":
266
265
  # Prepare request data for response tracking correlation
@@ -272,24 +271,17 @@ class EventHandlers:
272
271
  self.hook_handler._track_delegation(session_id, agent_type, request_data)
273
272
 
274
273
  if DEBUG:
275
- print(" - Delegation tracked successfully", file=sys.stderr)
276
- print(
277
- f" - Request data keys: {list(request_data.keys())}",
278
- file=sys.stderr,
279
- )
274
+ _log(" - Delegation tracked successfully")
275
+ _log(f" - Request data keys: {list(request_data.keys())}")
280
276
  delegation_requests = getattr(
281
277
  self.hook_handler, "delegation_requests", {}
282
278
  )
283
- print(
284
- f" - delegation_requests size: {len(delegation_requests)}",
285
- file=sys.stderr,
286
- )
279
+ _log(f" - delegation_requests size: {len(delegation_requests)}")
287
280
 
288
281
  # Log important delegations for debugging
289
282
  if DEBUG or agent_type in ["research", "engineer", "qa", "documentation"]:
290
- print(
291
- f"Hook handler: Task delegation started - agent: '{agent_type}', session: '{session_id}'",
292
- file=sys.stderr,
283
+ _log(
284
+ f"Hook handler: Task delegation started - agent: '{agent_type}', session: '{session_id}'"
293
285
  )
294
286
 
295
287
  # Trigger memory pre-delegation hook
@@ -359,10 +351,10 @@ class EventHandlers:
359
351
  )
360
352
 
361
353
  if DEBUG:
362
- print(f" - Agent prompt logged for {agent_type}", file=sys.stderr)
354
+ _log(f" - Agent prompt logged for {agent_type}")
363
355
  except Exception as e:
364
356
  if DEBUG:
365
- print(f" - Could not log agent prompt: {e}", file=sys.stderr)
357
+ _log(f" - Could not log agent prompt: {e}")
366
358
 
367
359
  def _get_git_branch(self, working_dir: Optional[str] = None) -> str:
368
360
  """Get git branch for the given directory with caching."""
@@ -450,9 +442,8 @@ class EventHandlers:
450
442
 
451
443
  tool_call_id = CorrelationManager.retrieve(session_id) if session_id else None
452
444
  if DEBUG and tool_call_id:
453
- print(
454
- f" - Retrieved tool_call_id: {tool_call_id[:8]}... for session {session_id[:8]}...",
455
- file=sys.stderr,
445
+ _log(
446
+ f" - Retrieved tool_call_id: {tool_call_id[:8]}... for session {session_id[:8]}..."
456
447
  )
457
448
 
458
449
  post_tool_data = {
@@ -605,16 +596,12 @@ class EventHandlers:
605
596
  _log(f"⚠️ Auto-pause threshold crossed: {warning}")
606
597
 
607
598
  if DEBUG:
608
- print(
609
- f" - Auto-pause threshold crossed: {threshold_crossed}",
610
- file=sys.stderr,
599
+ _log(
600
+ f" - Auto-pause threshold crossed: {threshold_crossed}"
611
601
  )
612
602
  except Exception as e:
613
603
  if DEBUG:
614
- print(
615
- f"Auto-pause error in handle_stop_fast: {e}",
616
- file=sys.stderr,
617
- )
604
+ _log(f"Auto-pause error in handle_stop_fast: {e}")
618
605
 
619
606
  # Track response if enabled
620
607
  try:
@@ -656,24 +643,15 @@ class EventHandlers:
656
643
  getattr(rtm, "response_tracker", None) is not None if rtm else False
657
644
  )
658
645
 
659
- print(
660
- f" - response_tracking_enabled: {tracking_enabled}",
661
- file=sys.stderr,
662
- )
663
- print(
664
- f" - response_tracker exists: {tracker_exists}",
665
- file=sys.stderr,
666
- )
646
+ _log(f" - response_tracking_enabled: {tracking_enabled}")
647
+ _log(f" - response_tracker exists: {tracker_exists}")
667
648
  except Exception: # nosec B110
668
649
  # If debug logging fails, just skip it
669
650
  pass
670
651
 
671
- print(
672
- f" - session_id: {session_id[:8] if session_id else 'None'}...",
673
- file=sys.stderr,
674
- )
675
- print(f" - reason: {metadata['reason']}", file=sys.stderr)
676
- print(f" - stop_type: {metadata['stop_type']}", file=sys.stderr)
652
+ _log(f" - session_id: {session_id[:8] if session_id else 'None'}...")
653
+ _log(f" - reason: {metadata['reason']}")
654
+ _log(f" - stop_type: {metadata['stop_type']}")
677
655
 
678
656
  def _emit_stop_event(self, event: dict, session_id: str, metadata: dict) -> None:
679
657
  """Emit stop event data to Socket.IO."""
@@ -735,10 +713,7 @@ class EventHandlers:
735
713
  # If exact match fails, try partial matching
736
714
  if not request_info and session_id:
737
715
  if DEBUG:
738
- print(
739
- f" - Trying fuzzy match for session {session_id[:16]}...",
740
- file=sys.stderr,
741
- )
716
+ _log(f" - Trying fuzzy match for session {session_id[:16]}...")
742
717
  # Try to find a session that matches the first 8-16 characters
743
718
  for stored_sid in list(delegation_requests.keys()):
744
719
  if (
@@ -751,10 +726,7 @@ class EventHandlers:
751
726
  )
752
727
  ):
753
728
  if DEBUG:
754
- print(
755
- f" - ✅ Fuzzy match found: {stored_sid[:16]}...",
756
- file=sys.stderr,
757
- )
729
+ _log(f" - ✅ Fuzzy match found: {stored_sid[:16]}...")
758
730
  request_info = delegation_requests.get(stored_sid) # nosec B113
759
731
  # Update the key to use the current session_id for consistency
760
732
  if request_info:
@@ -823,9 +795,8 @@ class EventHandlers:
823
795
  )
824
796
 
825
797
  if file_path and DEBUG:
826
- print(
827
- f"✅ Tracked {agent_type} agent response on SubagentStop: {file_path.name}",
828
- file=sys.stderr,
798
+ _log(
799
+ f"✅ Tracked {agent_type} agent response on SubagentStop: {file_path.name}"
829
800
  )
830
801
 
831
802
  # Clean up the request data
@@ -836,16 +807,13 @@ class EventHandlers:
836
807
  del delegation_requests[session_id]
837
808
 
838
809
  elif DEBUG:
839
- print(
840
- f"No request data for SubagentStop session {session_id[:8]}..., agent: {agent_type}",
841
- file=sys.stderr,
810
+ _log(
811
+ f"No request data for SubagentStop session {session_id[:8]}..., agent: {agent_type}"
842
812
  )
843
813
 
844
814
  except Exception as e:
845
815
  if DEBUG:
846
- print(
847
- f"❌ Failed to track response on SubagentStop: {e}", file=sys.stderr
848
- )
816
+ _log(f"❌ Failed to track response on SubagentStop: {e}")
849
817
 
850
818
  def handle_assistant_response(self, event):
851
819
  """Handle assistant response events for comprehensive response tracking.
@@ -872,7 +840,7 @@ class EventHandlers:
872
840
  self._scan_for_delegation_patterns(event)
873
841
  except Exception as e: # nosec B110
874
842
  if DEBUG:
875
- print(f"Delegation scanning error: {e}", file=sys.stderr)
843
+ _log(f"Delegation scanning error: {e}")
876
844
 
877
845
  # Get working directory and git branch
878
846
  working_dir = event.get("cwd", "")
@@ -921,9 +889,8 @@ class EventHandlers:
921
889
 
922
890
  # Debug logging
923
891
  if DEBUG:
924
- print(
925
- f"Hook handler: Processing AssistantResponse - session: '{session_id}', response_length: {len(response_text)}",
926
- file=sys.stderr,
892
+ _log(
893
+ f"Hook handler: Processing AssistantResponse - session: '{session_id}', response_length: {len(response_text)}"
927
894
  )
928
895
 
929
896
  # Record assistant response for auto-pause if active
@@ -939,7 +906,7 @@ class EventHandlers:
939
906
  auto_pause.on_assistant_response(summary)
940
907
  except Exception as e:
941
908
  if DEBUG:
942
- print(f"Auto-pause response recording error: {e}", file=sys.stderr)
909
+ _log(f"Auto-pause response recording error: {e}")
943
910
 
944
911
  # Emit normalized event
945
912
  self.hook_handler._emit_socketio_event(
@@ -990,22 +957,13 @@ class EventHandlers:
990
957
  if pending_todos:
991
958
  session_start_data["pending_autotodos"] = pending_todos
992
959
  session_start_data["autotodos_count"] = len(pending_todos)
993
- if DEBUG:
994
- print(
995
- f" - Auto-injected {len(pending_todos)} pending autotodos",
996
- file=sys.stderr,
997
- )
960
+ _log(f" - Auto-injected {len(pending_todos)} pending autotodos")
998
961
  except Exception as e: # nosec B110
999
962
  # Auto-injection is optional - continue if it fails
1000
- if DEBUG:
1001
- print(f" - Failed to auto-inject autotodos: {e}", file=sys.stderr)
963
+ _log(f" - Failed to auto-inject autotodos: {e}")
1002
964
 
1003
965
  # Debug logging
1004
- if DEBUG:
1005
- print(
1006
- f"Hook handler: Processing SessionStart - session: '{session_id}'",
1007
- file=sys.stderr,
1008
- )
966
+ _log(f"Hook handler: Processing SessionStart - session: '{session_id}'")
1009
967
 
1010
968
  # Emit normalized event
1011
969
  self.hook_handler._emit_socketio_event("", "session_start", session_start_data)
@@ -1048,10 +1006,8 @@ class EventHandlers:
1048
1006
 
1049
1007
  # Debug logging
1050
1008
  if DEBUG:
1051
- print(
1052
- f"Hook handler: SubagentStart - agent_type='{agent_type}', "
1053
- f"agent_id='{agent_id}', session_id='{session_id[:16]}...'",
1054
- file=sys.stderr,
1009
+ _log(
1010
+ f"Hook handler: SubagentStart - agent_type='{agent_type}', agent_id='{agent_id}', session_id='{session_id[:16]}...'"
1055
1011
  )
1056
1012
 
1057
1013
  # Emit to /hook namespace as subagent_start (NOT session_start!)
@@ -1086,7 +1042,7 @@ class EventHandlers:
1086
1042
  from claude_mpm.services.event_log import get_event_log
1087
1043
  except ImportError:
1088
1044
  if DEBUG:
1089
- print("Delegation detector or event log not available", file=sys.stderr)
1045
+ _log("Delegation detector or event log not available")
1090
1046
  return
1091
1047
 
1092
1048
  response_text = event.get("response", "")
@@ -1125,7 +1081,4 @@ class EventHandlers:
1125
1081
  )
1126
1082
 
1127
1083
  if DEBUG:
1128
- print(
1129
- f"⚠️ PM violation detected: {detection['original_text'][:60]}...",
1130
- file=sys.stderr,
1131
- )
1084
+ _log(f"⚠️ PM violation detected: {detection['original_text'][:60]}...")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: claude-mpm
3
- Version: 5.6.3
3
+ Version: 5.6.4
4
4
  Summary: Claude Multi-Agent Project Manager - Orchestrate Claude with agent delegation and ticket tracking
5
5
  Author-email: Bob Matsuoka <bob@matsuoka.com>
6
6
  Maintainer: Claude MPM Team
@@ -1,5 +1,5 @@
1
1
  claude_mpm/BUILD_NUMBER,sha256=9JfxhnDtr-8l3kCP2U5TVXSErptHoga8m7XA8zqgGOc,4
2
- claude_mpm/VERSION,sha256=R9OiitDPBv_gv7xkOMO-ERh_3EigciQpc2odWzCTYAA,6
2
+ claude_mpm/VERSION,sha256=Oqgs7rfIqUTkwLUznw-1vfEEF2PD1vAqz2KSQ7W0t8E,6
3
3
  claude_mpm/__init__.py,sha256=AGfh00BHKvLYD-UVFw7qbKtl7NMRIzRXOWw7vEuZ-h4,2214
4
4
  claude_mpm/__main__.py,sha256=Ro5UBWBoQaSAIoSqWAr7zkbLyvi4sSy28WShqAhKJG0,723
5
5
  claude_mpm/constants.py,sha256=pz3lTrZZR5HhV3eZzYtIbtBwWo7iM6pkBHP_ixxmI6Y,6827
@@ -411,7 +411,7 @@ claude_mpm/hooks/claude_hooks/__init__.py,sha256=b4mud_g3S-3itHY_Dzpbb_SmdMEcJwt
411
411
  claude_mpm/hooks/claude_hooks/auto_pause_handler.py,sha256=xDAQZ33I5OhGvtWvA9mxwVSoir9tM-aCvrWkSRdnVmU,17465
412
412
  claude_mpm/hooks/claude_hooks/connection_pool.py,sha256=vpi-XbVf61GWhh85tHBzubbOgbJly_I-5-QmsleND2M,8658
413
413
  claude_mpm/hooks/claude_hooks/correlation_manager.py,sha256=3n-RxzqE8egG4max_NcpJgL9gzrBY6Ti529LrjleI1g,2033
414
- claude_mpm/hooks/claude_hooks/event_handlers.py,sha256=Zt0yj8Dyibmer6JSk2DLfcII_JyX_0SqGQnZ5Uq6Psg,47253
414
+ claude_mpm/hooks/claude_hooks/event_handlers.py,sha256=u7qkfthzAJxE5X4vAp5dCYhVDsadfC--vsqZVlmcrvE,45768
415
415
  claude_mpm/hooks/claude_hooks/hook_handler.py,sha256=UOl5IVvz0Ro8Z0Owx4sKUWCxoIhvQpt7VTJ8lRC7Y8o,28266
416
416
  claude_mpm/hooks/claude_hooks/hook_wrapper.sh,sha256=XYkdYtcM0nfnwYvMdyIFCasr80ry3uI5-fLYsLtDGw4,2214
417
417
  claude_mpm/hooks/claude_hooks/installer.py,sha256=X6m0CQ9mjaESqUu9RF00uOopZx1u5VOeR0-ilyaP6Xg,33275
@@ -1070,10 +1070,10 @@ claude_mpm/utils/subprocess_utils.py,sha256=D0izRT8anjiUb_JG72zlJR_JAw1cDkb7kalN
1070
1070
  claude_mpm/validation/__init__.py,sha256=YZhwE3mhit-lslvRLuwfX82xJ_k4haZeKmh4IWaVwtk,156
1071
1071
  claude_mpm/validation/agent_validator.py,sha256=GprtAvu80VyMXcKGsK_VhYiXWA6BjKHv7O6HKx0AB9w,20917
1072
1072
  claude_mpm/validation/frontmatter_validator.py,sha256=YpJlYNNYcV8u6hIOi3_jaRsDnzhbcQpjCBE6eyBKaFY,7076
1073
- claude_mpm-5.6.3.dist-info/licenses/LICENSE,sha256=ca3y_Rk4aPrbF6f62z8Ht5MJM9OAvbGlHvEDcj9vUQ4,3867
1074
- claude_mpm-5.6.3.dist-info/licenses/LICENSE-FAQ.md,sha256=TxfEkXVCK98RzDOer09puc7JVCP_q_bN4dHtZKHCMcM,5104
1075
- claude_mpm-5.6.3.dist-info/METADATA,sha256=7Z7Dz2L8KLMZWUcVhx0dcmuhJRac7nrUGfT3ecZFmQc,14983
1076
- claude_mpm-5.6.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1077
- claude_mpm-5.6.3.dist-info/entry_points.txt,sha256=n-Uk4vwHPpuvu-g_I7-GHORzTnN_m6iyOsoLveKKD0E,228
1078
- claude_mpm-5.6.3.dist-info/top_level.txt,sha256=1nUg3FEaBySgm8t-s54jK5zoPnu3_eY6EP6IOlekyHA,11
1079
- claude_mpm-5.6.3.dist-info/RECORD,,
1073
+ claude_mpm-5.6.4.dist-info/licenses/LICENSE,sha256=ca3y_Rk4aPrbF6f62z8Ht5MJM9OAvbGlHvEDcj9vUQ4,3867
1074
+ claude_mpm-5.6.4.dist-info/licenses/LICENSE-FAQ.md,sha256=TxfEkXVCK98RzDOer09puc7JVCP_q_bN4dHtZKHCMcM,5104
1075
+ claude_mpm-5.6.4.dist-info/METADATA,sha256=wv0oC9soogBs5j04eGyZDNvTVXAzs68eOOCtnFvC_eE,14983
1076
+ claude_mpm-5.6.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1077
+ claude_mpm-5.6.4.dist-info/entry_points.txt,sha256=n-Uk4vwHPpuvu-g_I7-GHORzTnN_m6iyOsoLveKKD0E,228
1078
+ claude_mpm-5.6.4.dist-info/top_level.txt,sha256=1nUg3FEaBySgm8t-s54jK5zoPnu3_eY6EP6IOlekyHA,11
1079
+ claude_mpm-5.6.4.dist-info/RECORD,,