claude-mpm 4.13.2__py3-none-any.whl → 4.18.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/VERSION +1 -1
- claude_mpm/agents/BASE_ENGINEER.md +286 -0
- claude_mpm/agents/BASE_PM.md +48 -17
- claude_mpm/agents/OUTPUT_STYLE.md +329 -11
- claude_mpm/agents/PM_INSTRUCTIONS.md +227 -8
- claude_mpm/agents/agent_loader.py +17 -5
- claude_mpm/agents/frontmatter_validator.py +284 -253
- claude_mpm/agents/templates/agentic-coder-optimizer.json +9 -2
- claude_mpm/agents/templates/api_qa.json +7 -1
- claude_mpm/agents/templates/clerk-ops.json +8 -1
- claude_mpm/agents/templates/code_analyzer.json +4 -1
- claude_mpm/agents/templates/dart_engineer.json +11 -1
- claude_mpm/agents/templates/data_engineer.json +11 -1
- claude_mpm/agents/templates/documentation.json +6 -1
- claude_mpm/agents/templates/engineer.json +18 -1
- claude_mpm/agents/templates/gcp_ops_agent.json +8 -1
- claude_mpm/agents/templates/golang_engineer.json +11 -1
- claude_mpm/agents/templates/java_engineer.json +12 -2
- claude_mpm/agents/templates/local_ops_agent.json +1217 -6
- claude_mpm/agents/templates/nextjs_engineer.json +11 -1
- claude_mpm/agents/templates/ops.json +8 -1
- claude_mpm/agents/templates/php-engineer.json +11 -1
- claude_mpm/agents/templates/project_organizer.json +10 -3
- claude_mpm/agents/templates/prompt-engineer.json +5 -1
- claude_mpm/agents/templates/python_engineer.json +11 -1
- claude_mpm/agents/templates/qa.json +7 -1
- claude_mpm/agents/templates/react_engineer.json +11 -1
- claude_mpm/agents/templates/refactoring_engineer.json +8 -1
- claude_mpm/agents/templates/research.json +4 -1
- claude_mpm/agents/templates/ruby-engineer.json +11 -1
- claude_mpm/agents/templates/rust_engineer.json +11 -1
- claude_mpm/agents/templates/security.json +6 -1
- claude_mpm/agents/templates/svelte-engineer.json +225 -0
- claude_mpm/agents/templates/ticketing.json +6 -1
- claude_mpm/agents/templates/typescript_engineer.json +11 -1
- claude_mpm/agents/templates/vercel_ops_agent.json +8 -1
- claude_mpm/agents/templates/version_control.json +8 -1
- claude_mpm/agents/templates/web_qa.json +7 -1
- claude_mpm/agents/templates/web_ui.json +11 -1
- claude_mpm/cli/__init__.py +34 -706
- claude_mpm/cli/commands/agent_manager.py +25 -12
- claude_mpm/cli/commands/agent_state_manager.py +186 -0
- claude_mpm/cli/commands/agents.py +204 -148
- claude_mpm/cli/commands/aggregate.py +7 -3
- claude_mpm/cli/commands/analyze.py +9 -4
- claude_mpm/cli/commands/analyze_code.py +7 -2
- claude_mpm/cli/commands/auto_configure.py +7 -9
- claude_mpm/cli/commands/config.py +47 -13
- claude_mpm/cli/commands/configure.py +294 -1788
- claude_mpm/cli/commands/configure_agent_display.py +261 -0
- claude_mpm/cli/commands/configure_behavior_manager.py +204 -0
- claude_mpm/cli/commands/configure_hook_manager.py +225 -0
- claude_mpm/cli/commands/configure_models.py +18 -0
- claude_mpm/cli/commands/configure_navigation.py +167 -0
- claude_mpm/cli/commands/configure_paths.py +104 -0
- claude_mpm/cli/commands/configure_persistence.py +254 -0
- claude_mpm/cli/commands/configure_startup_manager.py +646 -0
- claude_mpm/cli/commands/configure_template_editor.py +497 -0
- claude_mpm/cli/commands/configure_validators.py +73 -0
- claude_mpm/cli/commands/local_deploy.py +537 -0
- claude_mpm/cli/commands/memory.py +54 -20
- claude_mpm/cli/commands/mpm_init.py +39 -25
- claude_mpm/cli/commands/mpm_init_handler.py +8 -3
- claude_mpm/cli/executor.py +202 -0
- claude_mpm/cli/helpers.py +105 -0
- claude_mpm/cli/interactive/__init__.py +3 -0
- claude_mpm/cli/interactive/skills_wizard.py +491 -0
- claude_mpm/cli/parsers/__init__.py +7 -1
- claude_mpm/cli/parsers/base_parser.py +98 -3
- claude_mpm/cli/parsers/local_deploy_parser.py +227 -0
- claude_mpm/cli/shared/output_formatters.py +28 -19
- claude_mpm/cli/startup.py +481 -0
- claude_mpm/cli/utils.py +52 -1
- claude_mpm/commands/mpm-help.md +3 -0
- claude_mpm/commands/mpm-version.md +113 -0
- claude_mpm/commands/mpm.md +1 -0
- claude_mpm/config/agent_config.py +2 -2
- claude_mpm/config/model_config.py +428 -0
- claude_mpm/core/base_service.py +13 -12
- claude_mpm/core/enums.py +452 -0
- claude_mpm/core/factories.py +1 -1
- claude_mpm/core/instruction_reinforcement_hook.py +2 -1
- claude_mpm/core/interactive_session.py +9 -3
- claude_mpm/core/logging_config.py +6 -2
- claude_mpm/core/oneshot_session.py +8 -4
- claude_mpm/core/optimized_agent_loader.py +3 -3
- claude_mpm/core/output_style_manager.py +12 -192
- claude_mpm/core/service_registry.py +5 -1
- claude_mpm/core/types.py +2 -9
- claude_mpm/core/typing_utils.py +7 -6
- claude_mpm/dashboard/static/js/dashboard.js +0 -14
- claude_mpm/dashboard/templates/index.html +3 -41
- claude_mpm/hooks/claude_hooks/response_tracking.py +35 -1
- claude_mpm/hooks/instruction_reinforcement.py +7 -2
- claude_mpm/models/resume_log.py +340 -0
- claude_mpm/services/agents/auto_config_manager.py +10 -11
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +1 -1
- claude_mpm/services/agents/deployment/agent_record_service.py +1 -1
- claude_mpm/services/agents/deployment/agent_validator.py +17 -1
- claude_mpm/services/agents/deployment/async_agent_deployment.py +1 -1
- claude_mpm/services/agents/deployment/interface_adapter.py +3 -2
- claude_mpm/services/agents/deployment/local_template_deployment.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +7 -6
- claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +7 -16
- claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +4 -3
- claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +5 -3
- claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +6 -5
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +9 -6
- claude_mpm/services/agents/deployment/validation/__init__.py +3 -1
- claude_mpm/services/agents/deployment/validation/validation_result.py +1 -9
- claude_mpm/services/agents/local_template_manager.py +1 -1
- claude_mpm/services/agents/memory/agent_memory_manager.py +5 -2
- claude_mpm/services/agents/registry/modification_tracker.py +5 -2
- claude_mpm/services/command_handler_service.py +11 -5
- claude_mpm/services/core/interfaces/__init__.py +74 -2
- claude_mpm/services/core/interfaces/health.py +172 -0
- claude_mpm/services/core/interfaces/model.py +281 -0
- claude_mpm/services/core/interfaces/process.py +372 -0
- claude_mpm/services/core/interfaces/restart.py +307 -0
- claude_mpm/services/core/interfaces/stability.py +260 -0
- claude_mpm/services/core/models/__init__.py +33 -0
- claude_mpm/services/core/models/agent_config.py +12 -28
- claude_mpm/services/core/models/health.py +162 -0
- claude_mpm/services/core/models/process.py +235 -0
- claude_mpm/services/core/models/restart.py +302 -0
- claude_mpm/services/core/models/stability.py +264 -0
- claude_mpm/services/core/path_resolver.py +23 -7
- claude_mpm/services/diagnostics/__init__.py +2 -2
- claude_mpm/services/diagnostics/checks/agent_check.py +25 -24
- claude_mpm/services/diagnostics/checks/claude_code_check.py +24 -23
- claude_mpm/services/diagnostics/checks/common_issues_check.py +25 -24
- claude_mpm/services/diagnostics/checks/configuration_check.py +24 -23
- claude_mpm/services/diagnostics/checks/filesystem_check.py +18 -17
- claude_mpm/services/diagnostics/checks/installation_check.py +30 -29
- claude_mpm/services/diagnostics/checks/instructions_check.py +20 -19
- claude_mpm/services/diagnostics/checks/mcp_check.py +50 -36
- claude_mpm/services/diagnostics/checks/mcp_services_check.py +36 -31
- claude_mpm/services/diagnostics/checks/monitor_check.py +23 -22
- claude_mpm/services/diagnostics/checks/startup_log_check.py +9 -8
- claude_mpm/services/diagnostics/diagnostic_runner.py +6 -5
- claude_mpm/services/diagnostics/doctor_reporter.py +28 -25
- claude_mpm/services/diagnostics/models.py +19 -24
- claude_mpm/services/infrastructure/monitoring/__init__.py +1 -1
- claude_mpm/services/infrastructure/monitoring/aggregator.py +12 -12
- claude_mpm/services/infrastructure/monitoring/base.py +5 -13
- claude_mpm/services/infrastructure/monitoring/network.py +7 -6
- claude_mpm/services/infrastructure/monitoring/process.py +13 -12
- claude_mpm/services/infrastructure/monitoring/resources.py +7 -6
- claude_mpm/services/infrastructure/monitoring/service.py +16 -15
- claude_mpm/services/infrastructure/resume_log_generator.py +439 -0
- claude_mpm/services/local_ops/__init__.py +163 -0
- claude_mpm/services/local_ops/crash_detector.py +257 -0
- claude_mpm/services/local_ops/health_checks/__init__.py +28 -0
- claude_mpm/services/local_ops/health_checks/http_check.py +224 -0
- claude_mpm/services/local_ops/health_checks/process_check.py +236 -0
- claude_mpm/services/local_ops/health_checks/resource_check.py +255 -0
- claude_mpm/services/local_ops/health_manager.py +430 -0
- claude_mpm/services/local_ops/log_monitor.py +396 -0
- claude_mpm/services/local_ops/memory_leak_detector.py +294 -0
- claude_mpm/services/local_ops/process_manager.py +595 -0
- claude_mpm/services/local_ops/resource_monitor.py +331 -0
- claude_mpm/services/local_ops/restart_manager.py +401 -0
- claude_mpm/services/local_ops/restart_policy.py +387 -0
- claude_mpm/services/local_ops/state_manager.py +372 -0
- claude_mpm/services/local_ops/unified_manager.py +600 -0
- claude_mpm/services/mcp_config_manager.py +9 -4
- claude_mpm/services/mcp_gateway/core/__init__.py +1 -2
- claude_mpm/services/mcp_gateway/core/base.py +18 -31
- claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +71 -24
- claude_mpm/services/mcp_gateway/tools/health_check_tool.py +30 -28
- claude_mpm/services/memory_hook_service.py +4 -1
- claude_mpm/services/model/__init__.py +147 -0
- claude_mpm/services/model/base_provider.py +365 -0
- claude_mpm/services/model/claude_provider.py +412 -0
- claude_mpm/services/model/model_router.py +453 -0
- claude_mpm/services/model/ollama_provider.py +415 -0
- claude_mpm/services/monitor/daemon_manager.py +3 -2
- claude_mpm/services/monitor/handlers/dashboard.py +2 -1
- claude_mpm/services/monitor/handlers/hooks.py +2 -1
- claude_mpm/services/monitor/management/lifecycle.py +3 -2
- claude_mpm/services/monitor/server.py +2 -1
- claude_mpm/services/session_management_service.py +3 -2
- claude_mpm/services/session_manager.py +205 -1
- claude_mpm/services/shared/async_service_base.py +16 -27
- claude_mpm/services/shared/lifecycle_service_base.py +1 -14
- claude_mpm/services/socketio/handlers/__init__.py +5 -2
- claude_mpm/services/socketio/handlers/hook.py +13 -2
- claude_mpm/services/socketio/handlers/registry.py +4 -2
- claude_mpm/services/socketio/server/main.py +10 -8
- claude_mpm/services/subprocess_launcher_service.py +14 -5
- claude_mpm/services/unified/analyzer_strategies/code_analyzer.py +8 -7
- claude_mpm/services/unified/analyzer_strategies/dependency_analyzer.py +6 -5
- claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +8 -7
- claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +7 -6
- claude_mpm/services/unified/analyzer_strategies/structure_analyzer.py +5 -4
- claude_mpm/services/unified/config_strategies/validation_strategy.py +13 -9
- claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +10 -3
- claude_mpm/services/unified/deployment_strategies/local.py +6 -5
- claude_mpm/services/unified/deployment_strategies/utils.py +6 -5
- claude_mpm/services/unified/deployment_strategies/vercel.py +7 -6
- claude_mpm/services/unified/interfaces.py +3 -1
- claude_mpm/services/unified/unified_analyzer.py +14 -10
- claude_mpm/services/unified/unified_config.py +2 -1
- claude_mpm/services/unified/unified_deployment.py +9 -4
- claude_mpm/services/version_service.py +104 -1
- claude_mpm/skills/__init__.py +21 -0
- claude_mpm/skills/bundled/__init__.py +6 -0
- claude_mpm/skills/bundled/api-documentation.md +393 -0
- claude_mpm/skills/bundled/async-testing.md +571 -0
- claude_mpm/skills/bundled/code-review.md +143 -0
- claude_mpm/skills/bundled/database-migration.md +199 -0
- claude_mpm/skills/bundled/docker-containerization.md +194 -0
- claude_mpm/skills/bundled/express-local-dev.md +1429 -0
- claude_mpm/skills/bundled/fastapi-local-dev.md +1199 -0
- claude_mpm/skills/bundled/git-workflow.md +414 -0
- claude_mpm/skills/bundled/imagemagick.md +204 -0
- claude_mpm/skills/bundled/json-data-handling.md +223 -0
- claude_mpm/skills/bundled/nextjs-local-dev.md +807 -0
- claude_mpm/skills/bundled/pdf.md +141 -0
- claude_mpm/skills/bundled/performance-profiling.md +567 -0
- claude_mpm/skills/bundled/refactoring-patterns.md +180 -0
- claude_mpm/skills/bundled/security-scanning.md +327 -0
- claude_mpm/skills/bundled/systematic-debugging.md +473 -0
- claude_mpm/skills/bundled/test-driven-development.md +378 -0
- claude_mpm/skills/bundled/vite-local-dev.md +1061 -0
- claude_mpm/skills/bundled/web-performance-optimization.md +2305 -0
- claude_mpm/skills/bundled/xlsx.md +157 -0
- claude_mpm/skills/registry.py +286 -0
- claude_mpm/skills/skill_manager.py +310 -0
- claude_mpm/tools/code_tree_analyzer.py +177 -141
- claude_mpm/tools/code_tree_events.py +4 -2
- claude_mpm/utils/agent_dependency_loader.py +2 -2
- {claude_mpm-4.13.2.dist-info → claude_mpm-4.18.2.dist-info}/METADATA +117 -8
- {claude_mpm-4.13.2.dist-info → claude_mpm-4.18.2.dist-info}/RECORD +238 -174
- claude_mpm/dashboard/static/css/code-tree.css +0 -1639
- claude_mpm/dashboard/static/js/components/code-tree/tree-breadcrumb.js +0 -353
- claude_mpm/dashboard/static/js/components/code-tree/tree-constants.js +0 -235
- claude_mpm/dashboard/static/js/components/code-tree/tree-search.js +0 -409
- claude_mpm/dashboard/static/js/components/code-tree/tree-utils.js +0 -435
- claude_mpm/dashboard/static/js/components/code-tree.js +0 -5869
- claude_mpm/dashboard/static/js/components/code-viewer.js +0 -1386
- claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +0 -425
- claude_mpm/hooks/claude_hooks/hook_handler_original.py +0 -1041
- claude_mpm/hooks/claude_hooks/hook_handler_refactored.py +0 -347
- claude_mpm/services/agents/deployment/agent_lifecycle_manager_refactored.py +0 -575
- claude_mpm/services/project/analyzer_refactored.py +0 -450
- {claude_mpm-4.13.2.dist-info → claude_mpm-4.18.2.dist-info}/WHEEL +0 -0
- {claude_mpm-4.13.2.dist-info → claude_mpm-4.18.2.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.13.2.dist-info → claude_mpm-4.18.2.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.13.2.dist-info → claude_mpm-4.18.2.dist-info}/top_level.txt +0 -0
|
@@ -160,203 +160,23 @@ class OutputStyleManager:
|
|
|
160
160
|
|
|
161
161
|
def extract_output_style_content(self, framework_loader=None) -> str:
|
|
162
162
|
"""
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
This extracts PM delegation behavior, tone, communication standards,
|
|
166
|
-
response formats, TodoWrite requirements, and workflow rules from:
|
|
167
|
-
- INSTRUCTIONS.md
|
|
168
|
-
- BASE_PM.md
|
|
163
|
+
Read output style content from OUTPUT_STYLE.md.
|
|
169
164
|
|
|
170
165
|
Args:
|
|
171
|
-
framework_loader: Optional
|
|
166
|
+
framework_loader: Optional framework loader (kept for compatibility, not used)
|
|
172
167
|
|
|
173
168
|
Returns:
|
|
174
|
-
|
|
169
|
+
Complete output style content from file
|
|
175
170
|
"""
|
|
176
|
-
#
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
)
|
|
185
|
-
sections.append("---")
|
|
186
|
-
sections.append("")
|
|
187
|
-
|
|
188
|
-
# Header
|
|
189
|
-
sections.append(
|
|
190
|
-
"You are Claude Multi-Agent PM, a PROJECT MANAGER whose SOLE PURPOSE is to delegate work to specialized agents."
|
|
191
|
-
)
|
|
192
|
-
sections.append("")
|
|
193
|
-
|
|
194
|
-
# Extract from INSTRUCTIONS.md
|
|
195
|
-
if framework_loader and framework_loader.framework_content.get(
|
|
196
|
-
"framework_instructions"
|
|
197
|
-
):
|
|
198
|
-
instructions = framework_loader.framework_content["framework_instructions"]
|
|
199
|
-
sections.extend(self._extract_instructions_sections(instructions))
|
|
200
|
-
else:
|
|
201
|
-
# Load from file if no framework_loader provided
|
|
202
|
-
instructions_path = (
|
|
203
|
-
Path(__file__).parent.parent / "agents" / "INSTRUCTIONS.md"
|
|
204
|
-
)
|
|
205
|
-
if instructions_path.exists():
|
|
206
|
-
instructions = instructions_path.read_text()
|
|
207
|
-
sections.extend(self._extract_instructions_sections(instructions))
|
|
208
|
-
|
|
209
|
-
# Extract from BASE_PM.md
|
|
210
|
-
if framework_loader and framework_loader.framework_content.get(
|
|
211
|
-
"base_pm_instructions"
|
|
212
|
-
):
|
|
213
|
-
base_pm = framework_loader.framework_content["base_pm_instructions"]
|
|
214
|
-
sections.extend(self._extract_base_pm_sections(base_pm))
|
|
215
|
-
else:
|
|
216
|
-
# Load from file if no framework_loader provided
|
|
217
|
-
base_pm_path = Path(__file__).parent.parent / "agents" / "BASE_PM.md"
|
|
218
|
-
if base_pm_path.exists():
|
|
219
|
-
base_pm = base_pm_path.read_text()
|
|
220
|
-
sections.extend(self._extract_base_pm_sections(base_pm))
|
|
221
|
-
|
|
222
|
-
return "\n".join(sections)
|
|
223
|
-
|
|
224
|
-
def _extract_instructions_sections(self, content: str) -> list:
|
|
225
|
-
"""Extract relevant sections from INSTRUCTIONS.md."""
|
|
226
|
-
sections = []
|
|
227
|
-
|
|
228
|
-
# Extract Primary Directive
|
|
229
|
-
if "## 🔴 PRIMARY DIRECTIVE" in content:
|
|
230
|
-
sections.append("## 🔴 PRIMARY DIRECTIVE - MANDATORY DELEGATION 🔴")
|
|
231
|
-
sections.append("")
|
|
232
|
-
sections.append(
|
|
233
|
-
"**YOU ARE STRICTLY FORBIDDEN FROM DOING ANY WORK DIRECTLY.**"
|
|
234
|
-
)
|
|
235
|
-
sections.append("")
|
|
236
|
-
sections.append(
|
|
237
|
-
"Direct implementation is ABSOLUTELY PROHIBITED unless the user EXPLICITLY overrides with phrases like:"
|
|
238
|
-
)
|
|
239
|
-
sections.append('- "do this yourself"')
|
|
240
|
-
sections.append('- "don\'t delegate"')
|
|
241
|
-
sections.append('- "implement directly"')
|
|
242
|
-
sections.append('- "you do it"')
|
|
243
|
-
sections.append('- "no delegation"')
|
|
244
|
-
sections.append("")
|
|
245
|
-
|
|
246
|
-
# Extract Core Identity and Rules
|
|
247
|
-
if "## Core Identity" in content:
|
|
248
|
-
sections.append("## Core Operating Rules")
|
|
249
|
-
sections.append("")
|
|
250
|
-
sections.append("**DEFAULT BEHAVIOR - ALWAYS DELEGATE**:")
|
|
251
|
-
sections.append(
|
|
252
|
-
"- 🔴 You MUST delegate 100% of ALL work to specialized agents by default"
|
|
253
|
-
)
|
|
254
|
-
sections.append(
|
|
255
|
-
"- 🔴 Direct action is STRICTLY FORBIDDEN without explicit user override"
|
|
256
|
-
)
|
|
257
|
-
sections.append(
|
|
258
|
-
"- 🔴 Even the simplest tasks MUST be delegated - NO EXCEPTIONS"
|
|
259
|
-
)
|
|
260
|
-
sections.append("- 🔴 When in doubt, ALWAYS DELEGATE - never act directly")
|
|
261
|
-
sections.append("")
|
|
262
|
-
sections.append("**Allowed Tools**:")
|
|
263
|
-
sections.append("- **Task** for delegation (YOUR PRIMARY FUNCTION)")
|
|
264
|
-
sections.append("- **TodoWrite** for tracking delegation progress ONLY")
|
|
265
|
-
sections.append(
|
|
266
|
-
"- **WebSearch/WebFetch** for gathering context BEFORE delegation"
|
|
267
|
-
)
|
|
268
|
-
sections.append(
|
|
269
|
-
"- **Direct answers** ONLY for questions about PM capabilities"
|
|
270
|
-
)
|
|
271
|
-
sections.append("")
|
|
272
|
-
|
|
273
|
-
# Extract Communication Standards
|
|
274
|
-
if "## Communication Standards" in content:
|
|
275
|
-
sections.append("## Communication Standards")
|
|
276
|
-
sections.append("")
|
|
277
|
-
sections.append("- **Tone**: Professional, neutral by default")
|
|
278
|
-
sections.append('- **Use**: "Understood", "Confirmed", "Noted"')
|
|
279
|
-
sections.append("- **No simplification** without explicit user request")
|
|
280
|
-
sections.append("- **No mocks** outside test environments")
|
|
281
|
-
sections.append("- **Complete implementations** only - no placeholders")
|
|
282
|
-
sections.append(
|
|
283
|
-
'- **FORBIDDEN**: Overeager enthusiasm ("Excellent!", "Perfect!", "Amazing!")'
|
|
284
|
-
)
|
|
285
|
-
sections.append("")
|
|
286
|
-
|
|
287
|
-
# Extract Error Handling
|
|
288
|
-
if "## Error Handling Protocol" in content:
|
|
289
|
-
sections.append("## Error Handling Protocol")
|
|
290
|
-
sections.append("")
|
|
291
|
-
sections.append("**3-Attempt Process**:")
|
|
292
|
-
sections.append("1. **First Failure**: Re-delegate with enhanced context")
|
|
293
|
-
sections.append(
|
|
294
|
-
'2. **Second Failure**: Mark "ERROR - Attempt 2/3", escalate if needed'
|
|
295
|
-
)
|
|
296
|
-
sections.append(
|
|
297
|
-
"3. **Third Failure**: TodoWrite escalation with user decision required"
|
|
298
|
-
)
|
|
299
|
-
sections.append("")
|
|
300
|
-
|
|
301
|
-
# Extract Standard Operating Procedure
|
|
302
|
-
if "## Standard Operating Procedure" in content:
|
|
303
|
-
sections.append("## Standard Operating Procedure")
|
|
304
|
-
sections.append("")
|
|
305
|
-
sections.append("1. **Analysis**: Parse request, assess context (NO TOOLS)")
|
|
306
|
-
sections.append(
|
|
307
|
-
"2. **Planning**: Agent selection, task breakdown, priority assignment"
|
|
308
|
-
)
|
|
309
|
-
sections.append("3. **Delegation**: Task Tool with enhanced format")
|
|
310
|
-
sections.append("4. **Monitoring**: Track progress via TodoWrite")
|
|
311
|
-
sections.append("5. **Integration**: Synthesize results, validate, report")
|
|
312
|
-
sections.append("")
|
|
313
|
-
|
|
314
|
-
return sections
|
|
315
|
-
|
|
316
|
-
def _extract_base_pm_sections(self, content: str) -> list:
|
|
317
|
-
"""Extract relevant sections from BASE_PM.md."""
|
|
318
|
-
sections = []
|
|
319
|
-
|
|
320
|
-
# Extract TodoWrite Requirements
|
|
321
|
-
if "## TodoWrite Framework Requirements" in content:
|
|
322
|
-
sections.append("## TodoWrite Requirements")
|
|
323
|
-
sections.append("")
|
|
324
|
-
sections.append("### Mandatory [Agent] Prefix Rules")
|
|
325
|
-
sections.append("")
|
|
326
|
-
sections.append("**ALWAYS use [Agent] prefix for delegated tasks**:")
|
|
327
|
-
sections.append("- ✅ `[Research] Analyze authentication patterns`")
|
|
328
|
-
sections.append("- ✅ `[Engineer] Implement user registration`")
|
|
329
|
-
sections.append("- ✅ `[QA] Test payment flow`")
|
|
330
|
-
sections.append("- ✅ `[Documentation] Update API docs`")
|
|
331
|
-
sections.append("")
|
|
332
|
-
sections.append("**NEVER use [PM] prefix for implementation tasks**")
|
|
333
|
-
sections.append("")
|
|
334
|
-
sections.append("### Task Status Management")
|
|
335
|
-
sections.append("")
|
|
336
|
-
sections.append("- `pending` - Task not yet started")
|
|
337
|
-
sections.append(
|
|
338
|
-
"- `in_progress` - Currently being worked on (ONE at a time)"
|
|
339
|
-
)
|
|
340
|
-
sections.append("- `completed` - Task finished successfully")
|
|
341
|
-
sections.append("")
|
|
342
|
-
|
|
343
|
-
# Extract PM Response Format
|
|
344
|
-
if "## PM Response Format" in content:
|
|
345
|
-
sections.append("## Response Format")
|
|
346
|
-
sections.append("")
|
|
347
|
-
sections.append(
|
|
348
|
-
"When completing delegations, provide structured summaries including:"
|
|
349
|
-
)
|
|
350
|
-
sections.append("- Request summary")
|
|
351
|
-
sections.append("- Agents used and task counts")
|
|
352
|
-
sections.append("- Tasks completed with [Agent] prefixes")
|
|
353
|
-
sections.append("- Files affected across all agents")
|
|
354
|
-
sections.append("- Blockers encountered and resolutions")
|
|
355
|
-
sections.append("- Next steps for user")
|
|
356
|
-
sections.append("- Key information to remember")
|
|
357
|
-
sections.append("")
|
|
358
|
-
|
|
359
|
-
return sections
|
|
171
|
+
# Always read from the complete OUTPUT_STYLE.md file
|
|
172
|
+
if self.mpm_output_style_path.exists():
|
|
173
|
+
content = self.mpm_output_style_path.read_text()
|
|
174
|
+
self.logger.info(f"Read OUTPUT_STYLE.md directly ({len(content)} chars)")
|
|
175
|
+
return content
|
|
176
|
+
# Fallback error
|
|
177
|
+
error_msg = f"OUTPUT_STYLE.md not found at {self.mpm_output_style_path}"
|
|
178
|
+
self.logger.error(error_msg)
|
|
179
|
+
raise FileNotFoundError(error_msg)
|
|
360
180
|
|
|
361
181
|
def save_output_style(self, content: str) -> Path:
|
|
362
182
|
"""
|
|
@@ -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] = {
|
|
253
|
+
health_status[name] = {
|
|
254
|
+
"status": OperationResult.ERROR,
|
|
255
|
+
"message": str(e),
|
|
256
|
+
}
|
|
253
257
|
|
|
254
258
|
return health_status
|
|
255
259
|
|
claude_mpm/core/types.py
CHANGED
|
@@ -20,6 +20,8 @@ from datetime import datetime, timezone
|
|
|
20
20
|
from enum import Enum
|
|
21
21
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
22
22
|
|
|
23
|
+
from .enums import HealthStatus
|
|
24
|
+
|
|
23
25
|
|
|
24
26
|
# Service operation results
|
|
25
27
|
@dataclass
|
|
@@ -230,15 +232,6 @@ class SocketMessage:
|
|
|
230
232
|
|
|
231
233
|
|
|
232
234
|
# Health monitoring types
|
|
233
|
-
class HealthStatus(Enum):
|
|
234
|
-
"""Service health status levels."""
|
|
235
|
-
|
|
236
|
-
HEALTHY = "healthy"
|
|
237
|
-
DEGRADED = "degraded"
|
|
238
|
-
UNHEALTHY = "unhealthy"
|
|
239
|
-
UNKNOWN = "unknown"
|
|
240
|
-
|
|
241
|
-
|
|
242
235
|
@dataclass
|
|
243
236
|
class HealthCheck:
|
|
244
237
|
"""Health check result."""
|
claude_mpm/core/typing_utils.py
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
198
|
+
ServiceStatus: TypeAlias = ServiceState # Replaced Literal with ServiceState enum
|
|
198
199
|
|
|
199
200
|
|
|
200
201
|
class ServiceConfig(TypedDict):
|
|
@@ -321,14 +321,6 @@ class Dashboard {
|
|
|
321
321
|
// Process agent inference for new events
|
|
322
322
|
this.agentInference.processAgentInference();
|
|
323
323
|
|
|
324
|
-
// Notify CodeViewer that file operations have been updated
|
|
325
|
-
// This ensures File Tree tab shows the same data as Files tab
|
|
326
|
-
if (window.CodeViewer && typeof window.CodeViewer.refreshFromFileToolTracker === 'function') {
|
|
327
|
-
setTimeout(() => {
|
|
328
|
-
window.CodeViewer.refreshFromFileToolTracker();
|
|
329
|
-
}, 50);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
324
|
// Update agent hierarchy with new events
|
|
333
325
|
this.agentHierarchy.updateWithNewEvents(events);
|
|
334
326
|
|
|
@@ -445,12 +437,6 @@ class Dashboard {
|
|
|
445
437
|
case 'events':
|
|
446
438
|
// Events tab is handled by EventViewer
|
|
447
439
|
break;
|
|
448
|
-
case 'claude-tree':
|
|
449
|
-
// File Tree tab - trigger CodeViewer rendering
|
|
450
|
-
if (window.CodeViewer && typeof window.CodeViewer.show === 'function') {
|
|
451
|
-
window.CodeViewer.show();
|
|
452
|
-
}
|
|
453
|
-
break;
|
|
454
440
|
case 'activity':
|
|
455
441
|
// Trigger Activity tab rendering through the component
|
|
456
442
|
// Check if ActivityTree class is available (from built module)
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
<link rel="stylesheet" href="/static/css/dashboard.css">
|
|
34
34
|
<link rel="stylesheet" href="/static/css/connection-status.css">
|
|
35
35
|
<link rel="stylesheet" href="/static/css/activity.css">
|
|
36
|
-
<link rel="stylesheet" href="/static/css/code-tree.css">
|
|
37
36
|
|
|
38
37
|
<!-- Additional styles for file operations -->
|
|
39
38
|
<style>
|
|
@@ -258,7 +257,6 @@
|
|
|
258
257
|
<a href="#tools" class="tab-button" data-tab="tools">🔧 Tools</a>
|
|
259
258
|
<a href="#files" class="tab-button" data-tab="files">📁 Files</a>
|
|
260
259
|
<a href="#activity" class="tab-button" data-tab="activity">🌳 Activity</a>
|
|
261
|
-
<a href="#file_tree" class="tab-button" data-tab="claude-tree">📝 File Tree</a>
|
|
262
260
|
</div>
|
|
263
261
|
|
|
264
262
|
<!-- Events Tab -->
|
|
@@ -397,15 +395,6 @@
|
|
|
397
395
|
</div>
|
|
398
396
|
</div>
|
|
399
397
|
|
|
400
|
-
<!-- File Tree Tab -->
|
|
401
|
-
<div class="tab-content" id="claude-tree-tab">
|
|
402
|
-
<div id="claude-tree-container" style="width: 100%; height: 100%; position: relative;">
|
|
403
|
-
<!-- File activity tree will be rendered here by code-viewer.js -->
|
|
404
|
-
<!-- This container is ISOLATED from other tabs -->
|
|
405
|
-
</div>
|
|
406
|
-
</div>
|
|
407
|
-
|
|
408
|
-
|
|
409
398
|
</div>
|
|
410
399
|
</div>
|
|
411
400
|
</div>
|
|
@@ -489,16 +478,12 @@
|
|
|
489
478
|
});
|
|
490
479
|
};
|
|
491
480
|
|
|
492
|
-
// Load shared services first, then
|
|
481
|
+
// Load shared services first, then components
|
|
493
482
|
// Load services sequentially to ensure dependencies are available
|
|
494
483
|
loadModule('/static/js/shared/tooltip-service.js')
|
|
495
484
|
.then(() => loadModule('/static/js/shared/dom-helpers.js'))
|
|
496
485
|
.then(() => loadModule('/static/js/shared/event-bus.js'))
|
|
497
486
|
.then(() => loadModule('/static/js/shared/logger.js'))
|
|
498
|
-
.then(() => loadModule('/static/js/components/code-tree/tree-utils.js'))
|
|
499
|
-
.then(() => loadModule('/static/js/components/code-tree/tree-constants.js'))
|
|
500
|
-
.then(() => loadModule('/static/js/components/code-tree/tree-search.js'))
|
|
501
|
-
.then(() => loadModule('/static/js/components/code-tree/tree-breadcrumb.js'))
|
|
502
487
|
.then(() => {
|
|
503
488
|
// CRITICAL: Load socket-client.js FIRST (dependency of socket-manager)
|
|
504
489
|
return loadModule('/static/js/socket-client.js');
|
|
@@ -530,29 +515,15 @@
|
|
|
530
515
|
return Promise.all([
|
|
531
516
|
loadModule('/static/dist/dashboard.js'), // Use dist version that requires above components
|
|
532
517
|
loadModule('/static/dist/components/activity-tree.js'),
|
|
533
|
-
loadModule('/static/js/components/code-tree.js'), // TEMPORARY: Direct source for debugging
|
|
534
|
-
loadModule('/static/js/components/code-viewer.js').catch(err => {
|
|
535
|
-
console.error('[CRITICAL] Failed to load code-viewer.js:', err);
|
|
536
|
-
throw err;
|
|
537
|
-
}), // Code viewer now includes file change tracking
|
|
538
518
|
loadModule('/static/dist/components/file-viewer.js') // File viewer for viewing file contents
|
|
539
519
|
]);
|
|
540
520
|
})
|
|
541
521
|
.then(() => {
|
|
542
522
|
console.log('All dashboard modules loaded successfully');
|
|
543
|
-
|
|
544
|
-
// Debug: Check if CodeViewer loaded
|
|
545
|
-
if (window.CodeViewer) {
|
|
546
|
-
console.log('[DEBUG] CodeViewer is available on window object');
|
|
547
|
-
} else {
|
|
548
|
-
console.error('[ERROR] CodeViewer NOT FOUND on window object!');
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
// CodeViewer will auto-initialize and handle tab switching internally
|
|
552
|
-
|
|
523
|
+
|
|
553
524
|
// Browser Log Viewer initialization is now handled by UIStateManager
|
|
554
525
|
// This prevents duplicate event handlers and tab selection conflicts
|
|
555
|
-
|
|
526
|
+
|
|
556
527
|
// Load bulletproof tab isolation fix
|
|
557
528
|
loadModule('/static/js/tab-isolation-fix.js')
|
|
558
529
|
.then(() => {
|
|
@@ -564,15 +535,6 @@
|
|
|
564
535
|
|
|
565
536
|
// Hash navigation will handle default tab based on URL
|
|
566
537
|
// If no hash, default will be 'events' as per hashToTab mapping
|
|
567
|
-
// To start with File Tree, we can set hash if not present
|
|
568
|
-
setTimeout(() => {
|
|
569
|
-
if (!window.location.hash) {
|
|
570
|
-
console.log('No hash present, setting default to File Tree tab...');
|
|
571
|
-
window.location.hash = '#file_tree';
|
|
572
|
-
} else {
|
|
573
|
-
console.log('Hash present:', window.location.hash);
|
|
574
|
-
}
|
|
575
|
-
}, 500);
|
|
576
538
|
})
|
|
577
539
|
.catch(error => {
|
|
578
540
|
console.error('[CRITICAL] Error loading dashboard modules:', error);
|
|
@@ -268,7 +268,10 @@ class ResponseTrackingManager:
|
|
|
268
268
|
def track_stop_response(
|
|
269
269
|
self, event: dict, session_id: str, metadata: dict, pending_prompts: dict
|
|
270
270
|
):
|
|
271
|
-
"""Track response for stop events.
|
|
271
|
+
"""Track response for stop events.
|
|
272
|
+
|
|
273
|
+
Captures Claude API stop_reason and usage data for context management.
|
|
274
|
+
"""
|
|
272
275
|
if not (self.response_tracking_enabled and self.response_tracker):
|
|
273
276
|
return
|
|
274
277
|
|
|
@@ -294,6 +297,37 @@ class ResponseTrackingManager:
|
|
|
294
297
|
# Add prompt timestamp to metadata
|
|
295
298
|
metadata["prompt_timestamp"] = prompt_data.get("timestamp")
|
|
296
299
|
|
|
300
|
+
# Capture Claude API stop_reason if available
|
|
301
|
+
if "stop_reason" in event:
|
|
302
|
+
metadata["stop_reason"] = event["stop_reason"]
|
|
303
|
+
if DEBUG:
|
|
304
|
+
print(
|
|
305
|
+
f" - Captured stop_reason: {event['stop_reason']}",
|
|
306
|
+
file=sys.stderr,
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
# Capture Claude API usage data if available
|
|
310
|
+
if "usage" in event:
|
|
311
|
+
usage_data = event["usage"]
|
|
312
|
+
metadata["usage"] = {
|
|
313
|
+
"input_tokens": usage_data.get("input_tokens", 0),
|
|
314
|
+
"output_tokens": usage_data.get("output_tokens", 0),
|
|
315
|
+
"cache_creation_input_tokens": usage_data.get(
|
|
316
|
+
"cache_creation_input_tokens", 0
|
|
317
|
+
),
|
|
318
|
+
"cache_read_input_tokens": usage_data.get(
|
|
319
|
+
"cache_read_input_tokens", 0
|
|
320
|
+
),
|
|
321
|
+
}
|
|
322
|
+
if DEBUG:
|
|
323
|
+
total_tokens = usage_data.get(
|
|
324
|
+
"input_tokens", 0
|
|
325
|
+
) + usage_data.get("output_tokens", 0)
|
|
326
|
+
print(
|
|
327
|
+
f" - Captured usage: {total_tokens} total tokens",
|
|
328
|
+
file=sys.stderr,
|
|
329
|
+
)
|
|
330
|
+
|
|
297
331
|
# Track the main Claude response
|
|
298
332
|
file_path = self.response_tracker.track_response(
|
|
299
333
|
agent_name="claude_main",
|
|
@@ -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":
|
|
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 =
|
|
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,
|