claude-mpm 4.24.0__py3-none-any.whl → 5.4.41__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.
- claude_mpm/VERSION +1 -1
- claude_mpm/__init__.py +4 -0
- claude_mpm/agents/BASE_AGENT.md +164 -0
- claude_mpm/agents/{OUTPUT_STYLE.md → CLAUDE_MPM_OUTPUT_STYLE.md} +3 -48
- claude_mpm/agents/CLAUDE_MPM_TEACHER_OUTPUT_STYLE.md +2002 -0
- claude_mpm/agents/MEMORY.md +1 -1
- claude_mpm/agents/PM_INSTRUCTIONS.md +735 -925
- claude_mpm/agents/WORKFLOW.md +5 -254
- claude_mpm/agents/__init__.py +6 -0
- claude_mpm/agents/agent_loader.py +14 -48
- claude_mpm/agents/base_agent.json +7 -4
- claude_mpm/agents/frontmatter_validator.py +71 -3
- claude_mpm/agents/templates/circuit-breakers.md +1391 -0
- claude_mpm/agents/templates/context-management-examples.md +544 -0
- claude_mpm/agents/templates/{pm_red_flags.md → pm-red-flags.md} +48 -0
- claude_mpm/agents/templates/pr-workflow-examples.md +427 -0
- claude_mpm/agents/templates/research-gate-examples.md +669 -0
- claude_mpm/agents/templates/structured-questions-examples.md +615 -0
- claude_mpm/agents/templates/ticket-completeness-examples.md +139 -0
- claude_mpm/agents/templates/ticketing-examples.md +277 -0
- claude_mpm/cli/__init__.py +37 -2
- claude_mpm/cli/__main__.py +4 -0
- claude_mpm/cli/chrome_devtools_installer.py +175 -0
- claude_mpm/cli/commands/__init__.py +2 -0
- claude_mpm/cli/commands/agent_source.py +774 -0
- claude_mpm/cli/commands/agent_state_manager.py +180 -31
- claude_mpm/cli/commands/agents.py +1116 -55
- claude_mpm/cli/commands/agents_cleanup.py +210 -0
- claude_mpm/cli/commands/agents_discover.py +338 -0
- claude_mpm/cli/commands/aggregate.py +1 -1
- claude_mpm/cli/commands/analyze.py +3 -3
- claude_mpm/cli/commands/auto_configure.py +725 -242
- claude_mpm/cli/commands/config.py +95 -6
- claude_mpm/cli/commands/configure.py +1875 -46
- claude_mpm/cli/commands/configure_agent_display.py +29 -10
- claude_mpm/cli/commands/configure_navigation.py +63 -46
- claude_mpm/cli/commands/debug.py +12 -12
- claude_mpm/cli/commands/doctor.py +10 -2
- claude_mpm/cli/commands/hook_errors.py +277 -0
- claude_mpm/cli/commands/local_deploy.py +1 -4
- claude_mpm/cli/commands/mcp_install_commands.py +1 -1
- claude_mpm/cli/commands/mpm_init/core.py +229 -2
- claude_mpm/cli/commands/mpm_init/git_activity.py +10 -10
- claude_mpm/cli/commands/mpm_init/knowledge_extractor.py +481 -0
- claude_mpm/cli/commands/mpm_init/prompts.py +286 -6
- claude_mpm/cli/commands/postmortem.py +401 -0
- claude_mpm/cli/commands/profile.py +277 -0
- claude_mpm/cli/commands/run.py +123 -165
- claude_mpm/cli/commands/skill_source.py +694 -0
- claude_mpm/cli/commands/skills.py +782 -20
- claude_mpm/cli/commands/summarize.py +413 -0
- claude_mpm/cli/executor.py +96 -3
- claude_mpm/cli/interactive/agent_wizard.py +1030 -45
- claude_mpm/cli/parsers/agent_source_parser.py +171 -0
- claude_mpm/cli/parsers/agents_parser.py +307 -10
- claude_mpm/cli/parsers/auto_configure_parser.py +13 -138
- claude_mpm/cli/parsers/base_parser.py +65 -0
- claude_mpm/cli/parsers/config_parser.py +162 -39
- claude_mpm/cli/parsers/profile_parser.py +148 -0
- claude_mpm/cli/parsers/skill_source_parser.py +169 -0
- claude_mpm/cli/parsers/skills_parser.py +146 -0
- claude_mpm/cli/parsers/source_parser.py +138 -0
- claude_mpm/cli/startup.py +1280 -118
- claude_mpm/cli/startup_display.py +480 -0
- claude_mpm/cli/utils.py +1 -1
- claude_mpm/cli_module/commands.py +1 -1
- claude_mpm/commands/mpm-config.md +21 -134
- claude_mpm/commands/mpm-doctor.md +16 -20
- claude_mpm/commands/mpm-help.md +13 -283
- claude_mpm/commands/mpm-init.md +88 -489
- claude_mpm/commands/mpm-monitor.md +23 -401
- claude_mpm/commands/mpm-organize.md +72 -247
- claude_mpm/commands/mpm-postmortem.md +21 -0
- claude_mpm/commands/mpm-session-resume.md +30 -0
- claude_mpm/commands/mpm-status.md +13 -68
- claude_mpm/commands/mpm-ticket-view.md +109 -0
- claude_mpm/commands/mpm-version.md +13 -106
- claude_mpm/commands/mpm.md +10 -0
- claude_mpm/config/agent_presets.py +488 -0
- claude_mpm/config/agent_sources.py +352 -0
- claude_mpm/config/skill_presets.py +392 -0
- claude_mpm/config/skill_sources.py +590 -0
- claude_mpm/constants.py +13 -0
- claude_mpm/core/claude_runner.py +5 -34
- claude_mpm/core/config.py +15 -1
- claude_mpm/core/constants.py +1 -1
- claude_mpm/core/framework/__init__.py +3 -16
- claude_mpm/core/framework/formatters/content_formatter.py +3 -13
- claude_mpm/core/framework/loaders/agent_loader.py +8 -5
- claude_mpm/core/framework/loaders/file_loader.py +54 -101
- claude_mpm/core/framework/loaders/instruction_loader.py +66 -5
- claude_mpm/core/framework_loader.py +4 -2
- claude_mpm/core/hook_error_memory.py +381 -0
- claude_mpm/core/hook_manager.py +41 -2
- claude_mpm/core/interactive_session.py +91 -10
- claude_mpm/core/logger.py +16 -1
- claude_mpm/core/oneshot_session.py +71 -8
- claude_mpm/core/optimized_startup.py +59 -0
- claude_mpm/core/output_style_manager.py +173 -43
- claude_mpm/core/protocols/__init__.py +23 -0
- claude_mpm/core/protocols/runner_protocol.py +103 -0
- claude_mpm/core/protocols/session_protocol.py +131 -0
- claude_mpm/core/shared/config_loader.py +1 -1
- claude_mpm/core/shared/singleton_manager.py +11 -4
- claude_mpm/core/socketio_pool.py +3 -3
- claude_mpm/core/system_context.py +38 -0
- claude_mpm/core/unified_agent_registry.py +134 -16
- claude_mpm/core/unified_config.py +22 -0
- claude_mpm/dashboard/static/svelte-build/_app/env.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/0.B_FtCwCQ.css +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/assets/2.Cl_eSA4x.css +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/BgChzWQ1.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/CIXEwuWe.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/CWc5urbQ.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/DMkZpdF2.js +2 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/DjhvlsAc.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/N4qtv3Hx.js +2 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/chunks/uj46x2Wr.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/entry/app.DTL5mJO-.js +2 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/entry/start.DzuEhzqh.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/0.CAGBuiOw.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/1.DFLC8jdE.js +1 -0
- claude_mpm/dashboard/static/svelte-build/_app/immutable/nodes/2.DPvEihJJ.js +10 -0
- claude_mpm/dashboard/static/svelte-build/_app/version.json +1 -0
- claude_mpm/dashboard/static/svelte-build/favicon.svg +7 -0
- claude_mpm/dashboard/static/svelte-build/index.html +36 -0
- claude_mpm/experimental/cli_enhancements.py +1 -5
- claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/correlation_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/installer.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/correlation_manager.py +60 -0
- claude_mpm/hooks/claude_hooks/event_handlers.py +214 -79
- claude_mpm/hooks/claude_hooks/hook_handler.py +155 -1
- claude_mpm/hooks/claude_hooks/installer.py +33 -10
- claude_mpm/hooks/claude_hooks/memory_integration.py +28 -0
- claude_mpm/hooks/claude_hooks/response_tracking.py +2 -3
- claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/connection_manager.py +30 -6
- claude_mpm/hooks/failure_learning/__init__.py +2 -8
- claude_mpm/hooks/failure_learning/failure_detection_hook.py +1 -6
- claude_mpm/hooks/failure_learning/fix_detection_hook.py +1 -6
- claude_mpm/hooks/failure_learning/learning_extraction_hook.py +1 -6
- claude_mpm/hooks/kuzu_response_hook.py +1 -5
- claude_mpm/hooks/memory_integration_hook.py +46 -1
- claude_mpm/init.py +63 -19
- claude_mpm/models/agent_definition.py +7 -0
- claude_mpm/models/git_repository.py +198 -0
- claude_mpm/scripts/claude-hook-handler.sh +60 -20
- claude_mpm/scripts/launch_monitor.py +93 -13
- claude_mpm/scripts/start_activity_logging.py +3 -1
- claude_mpm/services/agents/agent_builder.py +48 -12
- claude_mpm/services/agents/agent_preset_service.py +238 -0
- claude_mpm/services/agents/agent_recommendation_service.py +278 -0
- claude_mpm/services/agents/agent_review_service.py +280 -0
- claude_mpm/services/agents/agent_selection_service.py +484 -0
- claude_mpm/services/agents/auto_deploy_index_parser.py +569 -0
- claude_mpm/services/agents/cache_git_manager.py +621 -0
- claude_mpm/services/agents/deployment/agent_deployment.py +148 -2
- claude_mpm/services/agents/deployment/agent_discovery_service.py +104 -73
- claude_mpm/services/agents/deployment/agent_format_converter.py +1 -1
- claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +1 -5
- claude_mpm/services/agents/deployment/agent_metrics_collector.py +3 -3
- claude_mpm/services/agents/deployment/agent_restore_handler.py +1 -4
- claude_mpm/services/agents/deployment/agent_template_builder.py +238 -15
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +101 -15
- claude_mpm/services/agents/deployment/async_agent_deployment.py +2 -1
- claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -3
- claude_mpm/services/agents/deployment/multi_source_deployment_service.py +422 -31
- claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +2 -2
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +1 -4
- claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +841 -0
- claude_mpm/services/agents/deployment/single_agent_deployer.py +2 -2
- claude_mpm/services/agents/deployment/system_instructions_deployer.py +168 -46
- claude_mpm/services/agents/deployment/validation/deployment_validator.py +2 -2
- claude_mpm/services/agents/git_source_manager.py +663 -0
- claude_mpm/services/agents/loading/base_agent_manager.py +1 -13
- claude_mpm/services/agents/loading/framework_agent_loader.py +9 -12
- claude_mpm/services/agents/local_template_manager.py +50 -10
- claude_mpm/services/agents/recommender.py +5 -3
- claude_mpm/services/agents/single_tier_deployment_service.py +696 -0
- claude_mpm/services/agents/sources/__init__.py +13 -0
- claude_mpm/services/agents/sources/agent_sync_state.py +516 -0
- claude_mpm/services/agents/sources/git_source_sync_service.py +1094 -0
- claude_mpm/services/agents/startup_sync.py +259 -0
- claude_mpm/services/agents/toolchain_detector.py +478 -0
- claude_mpm/services/analysis/__init__.py +35 -0
- claude_mpm/services/analysis/clone_detector.py +1030 -0
- claude_mpm/services/analysis/postmortem_reporter.py +474 -0
- claude_mpm/services/analysis/postmortem_service.py +765 -0
- claude_mpm/services/cli/session_pause_manager.py +1 -1
- claude_mpm/services/command_deployment_service.py +271 -6
- claude_mpm/services/core/base.py +7 -2
- claude_mpm/services/core/interfaces/__init__.py +1 -3
- claude_mpm/services/core/interfaces/health.py +1 -4
- claude_mpm/services/core/models/__init__.py +2 -11
- claude_mpm/services/diagnostics/checks/__init__.py +4 -0
- claude_mpm/services/diagnostics/checks/agent_check.py +2 -4
- claude_mpm/services/diagnostics/checks/agent_sources_check.py +577 -0
- claude_mpm/services/diagnostics/checks/instructions_check.py +1 -2
- claude_mpm/services/diagnostics/checks/mcp_check.py +0 -1
- claude_mpm/services/diagnostics/checks/mcp_services_check.py +7 -15
- claude_mpm/services/diagnostics/checks/monitor_check.py +0 -1
- claude_mpm/services/diagnostics/checks/skill_sources_check.py +587 -0
- claude_mpm/services/diagnostics/diagnostic_runner.py +9 -0
- claude_mpm/services/diagnostics/doctor_reporter.py +40 -10
- claude_mpm/services/event_bus/config.py +3 -1
- claude_mpm/services/event_bus/direct_relay.py +3 -3
- claude_mpm/services/events/consumers/logging.py +1 -2
- claude_mpm/services/git/__init__.py +21 -0
- claude_mpm/services/git/git_operations_service.py +579 -0
- claude_mpm/services/github/__init__.py +21 -0
- claude_mpm/services/github/github_cli_service.py +397 -0
- claude_mpm/services/infrastructure/monitoring/__init__.py +1 -5
- claude_mpm/services/infrastructure/monitoring/aggregator.py +1 -6
- claude_mpm/services/instructions/__init__.py +9 -0
- claude_mpm/services/instructions/instruction_cache_service.py +374 -0
- claude_mpm/services/local_ops/__init__.py +3 -13
- claude_mpm/services/local_ops/health_checks/__init__.py +1 -3
- claude_mpm/services/local_ops/health_manager.py +1 -4
- claude_mpm/services/local_ops/resource_monitor.py +1 -1
- claude_mpm/services/mcp_config_manager.py +75 -145
- claude_mpm/services/mcp_service_verifier.py +6 -3
- claude_mpm/services/model/model_router.py +1 -2
- claude_mpm/services/monitor/daemon.py +38 -11
- claude_mpm/services/monitor/daemon_manager.py +134 -21
- claude_mpm/services/monitor/management/lifecycle.py +8 -1
- claude_mpm/services/monitor/server.py +700 -24
- claude_mpm/services/pm_skills_deployer.py +676 -0
- claude_mpm/services/port_manager.py +1 -1
- claude_mpm/services/pr/__init__.py +14 -0
- claude_mpm/services/pr/pr_template_service.py +329 -0
- claude_mpm/services/profile_manager.py +331 -0
- claude_mpm/services/project/documentation_manager.py +2 -1
- claude_mpm/services/project/project_organizer.py +4 -0
- claude_mpm/services/project/toolchain_analyzer.py +3 -1
- claude_mpm/services/runner_configuration_service.py +16 -3
- claude_mpm/services/self_upgrade_service.py +120 -12
- claude_mpm/services/session_management_service.py +16 -4
- claude_mpm/services/skills/__init__.py +21 -0
- claude_mpm/services/skills/git_skill_source_manager.py +1297 -0
- claude_mpm/services/skills/selective_skill_deployer.py +704 -0
- claude_mpm/services/skills/skill_discovery_service.py +568 -0
- claude_mpm/services/skills/skill_to_agent_mapper.py +406 -0
- claude_mpm/services/skills_config.py +547 -0
- claude_mpm/services/skills_deployer.py +1072 -0
- claude_mpm/services/socketio/dashboard_server.py +1 -0
- claude_mpm/services/socketio/event_normalizer.py +51 -6
- claude_mpm/services/socketio/handlers/connection.py +1 -1
- claude_mpm/services/socketio/handlers/git.py +1 -1
- claude_mpm/services/socketio/server/core.py +387 -112
- claude_mpm/services/socketio/server/main.py +1 -3
- claude_mpm/services/system_instructions_service.py +1 -3
- claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +0 -3
- claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +0 -1
- claude_mpm/services/unified/deployment_strategies/vercel.py +1 -5
- claude_mpm/services/unified/unified_deployment.py +1 -5
- claude_mpm/services/version_control/conflict_resolution.py +6 -4
- claude_mpm/services/version_control/git_operations.py +103 -0
- claude_mpm/services/visualization/__init__.py +1 -5
- claude_mpm/services/visualization/mermaid_generator.py +2 -3
- claude_mpm/skills/bundled/testing/webapp-testing/scripts/with_server.py +2 -2
- claude_mpm/skills/skill_manager.py +92 -3
- claude_mpm/skills/skills_registry.py +0 -1
- claude_mpm/templates/questions/__init__.py +38 -0
- claude_mpm/templates/questions/base.py +193 -0
- claude_mpm/templates/questions/pr_strategy.py +311 -0
- claude_mpm/templates/questions/project_init.py +385 -0
- claude_mpm/templates/questions/ticket_mgmt.py +394 -0
- claude_mpm/tools/__main__.py +8 -8
- claude_mpm/utils/agent_dependency_loader.py +91 -12
- claude_mpm/utils/agent_filters.py +261 -0
- claude_mpm/utils/dependency_cache.py +3 -1
- claude_mpm/utils/gitignore.py +244 -0
- claude_mpm/utils/migration.py +372 -0
- claude_mpm/utils/progress.py +387 -0
- claude_mpm/utils/robust_installer.py +49 -7
- claude_mpm/utils/structured_questions.py +619 -0
- {claude_mpm-4.24.0.dist-info → claude_mpm-5.4.41.dist-info}/METADATA +445 -122
- {claude_mpm-4.24.0.dist-info → claude_mpm-5.4.41.dist-info}/RECORD +298 -503
- claude_mpm-5.4.41.dist-info/entry_points.txt +5 -0
- claude_mpm-5.4.41.dist-info/licenses/LICENSE +94 -0
- claude_mpm-5.4.41.dist-info/licenses/LICENSE-FAQ.md +153 -0
- claude_mpm/agents/BASE_AGENT_TEMPLATE.md +0 -292
- claude_mpm/agents/BASE_DOCUMENTATION.md +0 -53
- claude_mpm/agents/BASE_OPS.md +0 -219
- claude_mpm/agents/BASE_PM.md +0 -468
- claude_mpm/agents/BASE_PROMPT_ENGINEER.md +0 -787
- claude_mpm/agents/BASE_QA.md +0 -167
- claude_mpm/agents/BASE_RESEARCH.md +0 -53
- claude_mpm/agents/base_agent_loader.py +0 -626
- claude_mpm/agents/templates/.claude-mpm/memories/README.md +0 -17
- claude_mpm/agents/templates/.claude-mpm/memories/engineer_memories.md +0 -3
- claude_mpm/agents/templates/agent-manager.json +0 -273
- claude_mpm/agents/templates/agentic-coder-optimizer.json +0 -248
- claude_mpm/agents/templates/api_qa.json +0 -183
- claude_mpm/agents/templates/circuit_breakers.md +0 -638
- claude_mpm/agents/templates/clerk-ops.json +0 -235
- claude_mpm/agents/templates/code_analyzer.json +0 -101
- claude_mpm/agents/templates/content-agent.json +0 -358
- claude_mpm/agents/templates/dart_engineer.json +0 -307
- claude_mpm/agents/templates/data_engineer.json +0 -225
- claude_mpm/agents/templates/documentation.json +0 -238
- claude_mpm/agents/templates/engineer.json +0 -210
- claude_mpm/agents/templates/gcp_ops_agent.json +0 -253
- claude_mpm/agents/templates/golang_engineer.json +0 -270
- claude_mpm/agents/templates/imagemagick.json +0 -264
- claude_mpm/agents/templates/java_engineer.json +0 -346
- claude_mpm/agents/templates/javascript_engineer_agent.json +0 -380
- claude_mpm/agents/templates/local_ops_agent.json +0 -1840
- claude_mpm/agents/templates/logs/prompts/agent_engineer_20250826_014258_728.md +0 -39
- claude_mpm/agents/templates/logs/prompts/agent_engineer_20250901_010124_142.md +0 -400
- claude_mpm/agents/templates/memory_manager.json +0 -158
- claude_mpm/agents/templates/nextjs_engineer.json +0 -285
- claude_mpm/agents/templates/ops.json +0 -185
- claude_mpm/agents/templates/php-engineer.json +0 -287
- claude_mpm/agents/templates/product_owner.json +0 -338
- claude_mpm/agents/templates/project_organizer.json +0 -144
- claude_mpm/agents/templates/prompt-engineer.json +0 -737
- claude_mpm/agents/templates/python_engineer.json +0 -387
- claude_mpm/agents/templates/qa.json +0 -243
- claude_mpm/agents/templates/react_engineer.json +0 -239
- claude_mpm/agents/templates/refactoring_engineer.json +0 -276
- claude_mpm/agents/templates/research.json +0 -188
- claude_mpm/agents/templates/ruby-engineer.json +0 -280
- claude_mpm/agents/templates/rust_engineer.json +0 -275
- claude_mpm/agents/templates/security.json +0 -202
- claude_mpm/agents/templates/svelte-engineer.json +0 -225
- claude_mpm/agents/templates/tauri_engineer.json +0 -274
- claude_mpm/agents/templates/ticketing.json +0 -178
- claude_mpm/agents/templates/typescript_engineer.json +0 -285
- claude_mpm/agents/templates/vercel_ops_agent.json +0 -412
- claude_mpm/agents/templates/version_control.json +0 -159
- claude_mpm/agents/templates/web_qa.json +0 -400
- claude_mpm/agents/templates/web_ui.json +0 -189
- claude_mpm/cli/commands/agents_detect.py +0 -380
- claude_mpm/cli/commands/agents_recommend.py +0 -309
- claude_mpm/cli/ticket_cli.py +0 -35
- claude_mpm/commands/mpm-agents-detect.md +0 -168
- claude_mpm/commands/mpm-agents-recommend.md +0 -214
- claude_mpm/commands/mpm-agents.md +0 -122
- claude_mpm/commands/mpm-auto-configure.md +0 -269
- claude_mpm/commands/mpm-resume.md +0 -372
- claude_mpm/commands/mpm-tickets.md +0 -151
- claude_mpm/dashboard/.claude-mpm/socketio-instances.json +0 -1
- claude_mpm/dashboard/analysis_runner.py +0 -455
- claude_mpm/dashboard/index.html +0 -13
- claude_mpm/dashboard/open_dashboard.py +0 -66
- claude_mpm/dashboard/react/components/DataInspector/DataInspector.module.css +0 -188
- claude_mpm/dashboard/react/components/EventViewer/EventViewer.module.css +0 -156
- claude_mpm/dashboard/react/components/shared/ConnectionStatus.module.css +0 -38
- claude_mpm/dashboard/react/components/shared/FilterBar.module.css +0 -92
- claude_mpm/dashboard/static/archive/activity_dashboard_fixed.html +0 -248
- claude_mpm/dashboard/static/archive/activity_dashboard_test.html +0 -61
- claude_mpm/dashboard/static/archive/test_activity_connection.html +0 -179
- claude_mpm/dashboard/static/archive/test_claude_tree_tab.html +0 -68
- claude_mpm/dashboard/static/archive/test_dashboard.html +0 -409
- claude_mpm/dashboard/static/archive/test_dashboard_fixed.html +0 -519
- claude_mpm/dashboard/static/archive/test_dashboard_verification.html +0 -181
- claude_mpm/dashboard/static/archive/test_file_data.html +0 -315
- claude_mpm/dashboard/static/archive/test_file_tree_empty_state.html +0 -243
- claude_mpm/dashboard/static/archive/test_file_tree_fix.html +0 -234
- claude_mpm/dashboard/static/archive/test_file_tree_rename.html +0 -117
- claude_mpm/dashboard/static/archive/test_file_tree_tab.html +0 -115
- claude_mpm/dashboard/static/archive/test_file_viewer.html +0 -224
- claude_mpm/dashboard/static/archive/test_final_activity.html +0 -220
- claude_mpm/dashboard/static/archive/test_tab_fix.html +0 -139
- claude_mpm/dashboard/static/built/assets/events.DjpNxWNo.css +0 -1
- claude_mpm/dashboard/static/built/components/activity-tree.js +0 -2
- claude_mpm/dashboard/static/built/components/agent-hierarchy.js +0 -777
- claude_mpm/dashboard/static/built/components/agent-inference.js +0 -2
- claude_mpm/dashboard/static/built/components/build-tracker.js +0 -333
- claude_mpm/dashboard/static/built/components/code-simple.js +0 -857
- claude_mpm/dashboard/static/built/components/code-tree/tree-breadcrumb.js +0 -353
- claude_mpm/dashboard/static/built/components/code-tree/tree-constants.js +0 -235
- claude_mpm/dashboard/static/built/components/code-tree/tree-search.js +0 -409
- claude_mpm/dashboard/static/built/components/code-tree/tree-utils.js +0 -435
- claude_mpm/dashboard/static/built/components/code-tree.js +0 -2
- claude_mpm/dashboard/static/built/components/code-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/connection-debug.js +0 -654
- claude_mpm/dashboard/static/built/components/diff-viewer.js +0 -891
- claude_mpm/dashboard/static/built/components/event-processor.js +0 -2
- claude_mpm/dashboard/static/built/components/event-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/export-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/file-change-tracker.js +0 -443
- claude_mpm/dashboard/static/built/components/file-change-viewer.js +0 -690
- claude_mpm/dashboard/static/built/components/file-tool-tracker.js +0 -2
- claude_mpm/dashboard/static/built/components/file-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/hud-library-loader.js +0 -2
- claude_mpm/dashboard/static/built/components/hud-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/hud-visualizer.js +0 -2
- claude_mpm/dashboard/static/built/components/module-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/nav-bar.js +0 -145
- claude_mpm/dashboard/static/built/components/page-structure.js +0 -429
- claude_mpm/dashboard/static/built/components/session-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/socket-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/ui-state-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/unified-data-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/working-directory.js +0 -2
- claude_mpm/dashboard/static/built/connection-manager.js +0 -536
- claude_mpm/dashboard/static/built/dashboard.js +0 -2
- claude_mpm/dashboard/static/built/extension-error-handler.js +0 -164
- claude_mpm/dashboard/static/built/react/events.js +0 -30
- claude_mpm/dashboard/static/built/shared/dom-helpers.js +0 -396
- claude_mpm/dashboard/static/built/shared/event-bus.js +0 -330
- claude_mpm/dashboard/static/built/shared/event-filter-service.js +0 -540
- claude_mpm/dashboard/static/built/shared/logger.js +0 -385
- claude_mpm/dashboard/static/built/shared/page-structure.js +0 -249
- claude_mpm/dashboard/static/built/shared/tooltip-service.js +0 -253
- claude_mpm/dashboard/static/built/socket-client.js +0 -2
- claude_mpm/dashboard/static/built/tab-isolation-fix.js +0 -185
- claude_mpm/dashboard/static/css/activity.css +0 -1958
- claude_mpm/dashboard/static/css/connection-status.css +0 -370
- claude_mpm/dashboard/static/css/dashboard.css +0 -4701
- claude_mpm/dashboard/static/dist/assets/events.DjpNxWNo.css +0 -1
- claude_mpm/dashboard/static/dist/components/activity-tree.js +0 -2
- claude_mpm/dashboard/static/dist/components/agent-inference.js +0 -2
- claude_mpm/dashboard/static/dist/components/code-tree.js +0 -2
- claude_mpm/dashboard/static/dist/components/code-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/event-processor.js +0 -2
- claude_mpm/dashboard/static/dist/components/event-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/export-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/file-tool-tracker.js +0 -2
- claude_mpm/dashboard/static/dist/components/file-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/hud-library-loader.js +0 -2
- claude_mpm/dashboard/static/dist/components/hud-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/hud-visualizer.js +0 -2
- claude_mpm/dashboard/static/dist/components/module-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/session-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/socket-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/ui-state-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/unified-data-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/working-directory.js +0 -2
- claude_mpm/dashboard/static/dist/dashboard.js +0 -2
- claude_mpm/dashboard/static/dist/react/events.js +0 -30
- claude_mpm/dashboard/static/dist/socket-client.js +0 -2
- claude_mpm/dashboard/static/events.html +0 -607
- claude_mpm/dashboard/static/index.html +0 -635
- claude_mpm/dashboard/static/js/components/activity-tree.js +0 -1871
- claude_mpm/dashboard/static/js/components/agent-hierarchy.js +0 -777
- claude_mpm/dashboard/static/js/components/agent-inference.js +0 -956
- claude_mpm/dashboard/static/js/components/build-tracker.js +0 -333
- claude_mpm/dashboard/static/js/components/code-simple.js +0 -857
- claude_mpm/dashboard/static/js/components/connection-debug.js +0 -654
- claude_mpm/dashboard/static/js/components/diff-viewer.js +0 -891
- claude_mpm/dashboard/static/js/components/event-processor.js +0 -542
- claude_mpm/dashboard/static/js/components/event-viewer.js +0 -1155
- claude_mpm/dashboard/static/js/components/export-manager.js +0 -368
- claude_mpm/dashboard/static/js/components/file-change-tracker.js +0 -443
- claude_mpm/dashboard/static/js/components/file-change-viewer.js +0 -690
- claude_mpm/dashboard/static/js/components/file-tool-tracker.js +0 -724
- claude_mpm/dashboard/static/js/components/file-viewer.js +0 -580
- claude_mpm/dashboard/static/js/components/hud-library-loader.js +0 -211
- claude_mpm/dashboard/static/js/components/hud-manager.js +0 -671
- claude_mpm/dashboard/static/js/components/hud-visualizer.js +0 -1718
- claude_mpm/dashboard/static/js/components/module-viewer.js +0 -2764
- claude_mpm/dashboard/static/js/components/session-manager.js +0 -579
- claude_mpm/dashboard/static/js/components/socket-manager.js +0 -368
- claude_mpm/dashboard/static/js/components/ui-state-manager.js +0 -749
- claude_mpm/dashboard/static/js/components/unified-data-viewer.js +0 -1824
- claude_mpm/dashboard/static/js/components/working-directory.js +0 -920
- claude_mpm/dashboard/static/js/connection-manager.js +0 -536
- claude_mpm/dashboard/static/js/dashboard.js +0 -1896
- claude_mpm/dashboard/static/js/extension-error-handler.js +0 -164
- claude_mpm/dashboard/static/js/shared/dom-helpers.js +0 -396
- claude_mpm/dashboard/static/js/shared/event-bus.js +0 -330
- claude_mpm/dashboard/static/js/shared/logger.js +0 -385
- claude_mpm/dashboard/static/js/shared/tooltip-service.js +0 -253
- claude_mpm/dashboard/static/js/socket-client.js +0 -1457
- claude_mpm/dashboard/static/js/stores/dashboard-store.js +0 -562
- claude_mpm/dashboard/static/js/tab-isolation-fix.js +0 -185
- claude_mpm/dashboard/static/legacy/activity.html +0 -736
- claude_mpm/dashboard/static/legacy/agents.html +0 -786
- claude_mpm/dashboard/static/legacy/files.html +0 -747
- claude_mpm/dashboard/static/legacy/tools.html +0 -831
- claude_mpm/dashboard/static/monitors.html +0 -431
- claude_mpm/dashboard/static/production/events.html +0 -659
- claude_mpm/dashboard/static/production/main.html +0 -698
- claude_mpm/dashboard/static/production/monitors.html +0 -483
- claude_mpm/dashboard/static/socket.io.min.js +0 -7
- claude_mpm/dashboard/static/socket.io.v4.8.1.backup.js +0 -7
- claude_mpm/dashboard/static/test-archive/dashboard.html +0 -635
- claude_mpm/dashboard/static/test-archive/debug-events.html +0 -147
- claude_mpm/dashboard/static/test-archive/test-navigation.html +0 -256
- claude_mpm/dashboard/static/test-archive/test-react-exports.html +0 -180
- claude_mpm/dashboard/static/test-archive/test_debug.html +0 -25
- claude_mpm/dashboard/templates/code_simple.html +0 -153
- claude_mpm/dashboard/templates/index.html +0 -606
- claude_mpm/dashboard/test_dashboard.html +0 -372
- claude_mpm/scripts/mcp_server.py +0 -75
- claude_mpm/scripts/mcp_wrapper.py +0 -39
- claude_mpm/services/mcp_gateway/__init__.py +0 -159
- claude_mpm/services/mcp_gateway/auto_configure.py +0 -369
- claude_mpm/services/mcp_gateway/config/__init__.py +0 -17
- claude_mpm/services/mcp_gateway/config/config_loader.py +0 -296
- claude_mpm/services/mcp_gateway/config/config_schema.py +0 -243
- claude_mpm/services/mcp_gateway/config/configuration.py +0 -429
- claude_mpm/services/mcp_gateway/core/__init__.py +0 -43
- claude_mpm/services/mcp_gateway/core/base.py +0 -312
- claude_mpm/services/mcp_gateway/core/exceptions.py +0 -253
- claude_mpm/services/mcp_gateway/core/interfaces.py +0 -443
- claude_mpm/services/mcp_gateway/core/process_pool.py +0 -971
- claude_mpm/services/mcp_gateway/core/singleton_manager.py +0 -315
- claude_mpm/services/mcp_gateway/core/startup_verification.py +0 -316
- claude_mpm/services/mcp_gateway/main.py +0 -589
- claude_mpm/services/mcp_gateway/registry/__init__.py +0 -12
- claude_mpm/services/mcp_gateway/registry/service_registry.py +0 -412
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +0 -489
- claude_mpm/services/mcp_gateway/server/__init__.py +0 -15
- claude_mpm/services/mcp_gateway/server/mcp_gateway.py +0 -419
- claude_mpm/services/mcp_gateway/server/stdio_handler.py +0 -372
- claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -714
- claude_mpm/services/mcp_gateway/tools/__init__.py +0 -36
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +0 -485
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +0 -789
- claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +0 -654
- claude_mpm/services/mcp_gateway/tools/health_check_tool.py +0 -456
- claude_mpm/services/mcp_gateway/tools/hello_world.py +0 -551
- claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +0 -551
- claude_mpm/services/mcp_gateway/utils/__init__.py +0 -14
- claude_mpm/services/mcp_gateway/utils/package_version_checker.py +0 -160
- claude_mpm/services/mcp_gateway/utils/update_preferences.py +0 -170
- claude_mpm/skills/bundled/collaboration/brainstorming/SKILL.md +0 -79
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/SKILL.md +0 -178
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/agent-prompts.md +0 -577
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/coordination-patterns.md +0 -467
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/examples.md +0 -537
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/references/troubleshooting.md +0 -730
- claude_mpm/skills/bundled/collaboration/requesting-code-review/SKILL.md +0 -112
- claude_mpm/skills/bundled/collaboration/requesting-code-review/references/code-reviewer-template.md +0 -146
- claude_mpm/skills/bundled/collaboration/requesting-code-review/references/review-examples.md +0 -412
- claude_mpm/skills/bundled/collaboration/writing-plans/SKILL.md +0 -81
- claude_mpm/skills/bundled/collaboration/writing-plans/references/best-practices.md +0 -362
- claude_mpm/skills/bundled/collaboration/writing-plans/references/plan-structure-templates.md +0 -312
- claude_mpm/skills/bundled/debugging/root-cause-tracing/SKILL.md +0 -152
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/advanced-techniques.md +0 -668
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/examples.md +0 -587
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/integration.md +0 -438
- claude_mpm/skills/bundled/debugging/root-cause-tracing/references/tracing-techniques.md +0 -391
- claude_mpm/skills/bundled/debugging/systematic-debugging/CREATION-LOG.md +0 -119
- claude_mpm/skills/bundled/debugging/systematic-debugging/SKILL.md +0 -148
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/anti-patterns.md +0 -483
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/examples.md +0 -452
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/troubleshooting.md +0 -449
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/workflow.md +0 -411
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-academic.md +0 -14
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-1.md +0 -58
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-2.md +0 -68
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-3.md +0 -69
- claude_mpm/skills/bundled/debugging/verification-before-completion/SKILL.md +0 -131
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/gate-function.md +0 -325
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/integration-and-workflows.md +0 -490
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/red-flags-and-failures.md +0 -425
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/verification-patterns.md +0 -499
- claude_mpm/skills/bundled/main/artifacts-builder/SKILL.md +0 -86
- claude_mpm/skills/bundled/main/internal-comms/SKILL.md +0 -43
- claude_mpm/skills/bundled/main/internal-comms/examples/3p-updates.md +0 -47
- claude_mpm/skills/bundled/main/internal-comms/examples/company-newsletter.md +0 -65
- claude_mpm/skills/bundled/main/internal-comms/examples/faq-answers.md +0 -30
- claude_mpm/skills/bundled/main/internal-comms/examples/general-comms.md +0 -16
- claude_mpm/skills/bundled/main/mcp-builder/SKILL.md +0 -160
- claude_mpm/skills/bundled/main/mcp-builder/reference/design_principles.md +0 -412
- claude_mpm/skills/bundled/main/mcp-builder/reference/evaluation.md +0 -602
- claude_mpm/skills/bundled/main/mcp-builder/reference/mcp_best_practices.md +0 -915
- claude_mpm/skills/bundled/main/mcp-builder/reference/node_mcp_server.md +0 -916
- claude_mpm/skills/bundled/main/mcp-builder/reference/python_mcp_server.md +0 -752
- claude_mpm/skills/bundled/main/mcp-builder/reference/workflow.md +0 -1237
- claude_mpm/skills/bundled/main/skill-creator/SKILL.md +0 -189
- claude_mpm/skills/bundled/main/skill-creator/references/best-practices.md +0 -500
- claude_mpm/skills/bundled/main/skill-creator/references/creation-workflow.md +0 -464
- claude_mpm/skills/bundled/main/skill-creator/references/examples.md +0 -619
- claude_mpm/skills/bundled/main/skill-creator/references/progressive-disclosure.md +0 -437
- claude_mpm/skills/bundled/main/skill-creator/references/skill-structure.md +0 -231
- claude_mpm/skills/bundled/php/espocrm-development/SKILL.md +0 -170
- claude_mpm/skills/bundled/php/espocrm-development/references/architecture.md +0 -602
- claude_mpm/skills/bundled/php/espocrm-development/references/common-tasks.md +0 -821
- claude_mpm/skills/bundled/php/espocrm-development/references/development-workflow.md +0 -742
- claude_mpm/skills/bundled/php/espocrm-development/references/frontend-customization.md +0 -726
- claude_mpm/skills/bundled/php/espocrm-development/references/hooks-and-services.md +0 -764
- claude_mpm/skills/bundled/php/espocrm-development/references/testing-debugging.md +0 -831
- claude_mpm/skills/bundled/rust/desktop-applications/SKILL.md +0 -226
- claude_mpm/skills/bundled/rust/desktop-applications/references/architecture-patterns.md +0 -901
- claude_mpm/skills/bundled/rust/desktop-applications/references/native-gui-frameworks.md +0 -901
- claude_mpm/skills/bundled/rust/desktop-applications/references/platform-integration.md +0 -775
- claude_mpm/skills/bundled/rust/desktop-applications/references/state-management.md +0 -937
- claude_mpm/skills/bundled/rust/desktop-applications/references/tauri-framework.md +0 -770
- claude_mpm/skills/bundled/rust/desktop-applications/references/testing-deployment.md +0 -961
- claude_mpm/skills/bundled/testing/condition-based-waiting/SKILL.md +0 -119
- claude_mpm/skills/bundled/testing/condition-based-waiting/references/patterns-and-implementation.md +0 -253
- claude_mpm/skills/bundled/testing/test-driven-development/SKILL.md +0 -145
- claude_mpm/skills/bundled/testing/test-driven-development/references/anti-patterns.md +0 -543
- claude_mpm/skills/bundled/testing/test-driven-development/references/examples.md +0 -741
- claude_mpm/skills/bundled/testing/test-driven-development/references/integration.md +0 -470
- claude_mpm/skills/bundled/testing/test-driven-development/references/philosophy.md +0 -458
- claude_mpm/skills/bundled/testing/test-driven-development/references/workflow.md +0 -639
- claude_mpm/skills/bundled/testing/testing-anti-patterns/SKILL.md +0 -140
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/completeness-anti-patterns.md +0 -572
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/core-anti-patterns.md +0 -411
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/detection-guide.md +0 -569
- claude_mpm/skills/bundled/testing/testing-anti-patterns/references/tdd-connection.md +0 -695
- claude_mpm/skills/bundled/testing/webapp-testing/SKILL.md +0 -184
- claude_mpm/skills/bundled/testing/webapp-testing/decision-tree.md +0 -459
- claude_mpm/skills/bundled/testing/webapp-testing/playwright-patterns.md +0 -479
- claude_mpm/skills/bundled/testing/webapp-testing/reconnaissance-pattern.md +0 -687
- claude_mpm/skills/bundled/testing/webapp-testing/server-management.md +0 -758
- claude_mpm/skills/bundled/testing/webapp-testing/troubleshooting.md +0 -868
- claude_mpm-4.24.0.dist-info/entry_points.txt +0 -10
- claude_mpm-4.24.0.dist-info/licenses/LICENSE +0 -21
- /claude_mpm/agents/templates/{git_file_tracking.md → git-file-tracking.md} +0 -0
- /claude_mpm/agents/templates/{pm_examples.md → pm-examples.md} +0 -0
- /claude_mpm/agents/templates/{response_format.md → response-format.md} +0 -0
- /claude_mpm/agents/templates/{validation_templates.md → validation-templates.md} +0 -0
- {claude_mpm-4.24.0.dist-info → claude_mpm-5.4.41.dist-info}/WHEEL +0 -0
- {claude_mpm-4.24.0.dist-info → claude_mpm-5.4.41.dist-info}/top_level.txt +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
window.FileToolTracker=class{constructor(e,t){this.agentInference=e,this.workingDirectoryManager=t,this.fileOperations=new Map,this.toolCalls=new Map,console.log("File-tool tracker initialized")}updateFileOperations(e){this.fileOperations.clear(),console.log("updateFileOperations - processing",e.length,"events");const t=new Map;let o=0;e.forEach((e,a)=>{const s=this.isFileOperation(e);if(s&&o++,a<5&&console.log(`Event ${a}:`,{type:e.type,subtype:e.subtype,tool_name:e.tool_name,tool_parameters:e.tool_parameters,isFileOp:s}),s){const o=e.tool_name||e.data&&e.data.tool_name,a=e.session_id||e.data&&e.data.session_id||"unknown",s=`${a}_${o}_${Math.floor(new Date(e.timestamp).getTime()/1e3)}`;t.has(s)||t.set(s,{pre_event:null,post_event:null,tool_name:o,session_id:a});const n=t.get(s);"pre_tool"===e.subtype||"hook"===e.type&&e.subtype&&!e.subtype.includes("post")?n.pre_event=e:("post_tool"===e.subtype||e.subtype&&e.subtype.includes("post")||(n.pre_event=e),n.post_event=e)}}),console.log("updateFileOperations - found",o,"file operations in",t.size,"event pairs"),t.forEach((e,t)=>{const o=this.extractFilePathFromPair(e);if(o){console.log("File operation detected for:",o,"from pair:",t),this.fileOperations.has(o)||this.fileOperations.set(o,{path:o,operations:[],lastOperation:null});const a=this.fileOperations.get(o),s=this.getFileOperationFromPair(e),n=e.post_event?.timestamp||e.pre_event?.timestamp,r=this.extractAgentFromPair(e),i=this.workingDirectoryManager.extractWorkingDirectoryFromPair(e);a.operations.push({operation:s,timestamp:n,agent:r.name,confidence:r.confidence,sessionId:e.session_id,details:this.getFileOperationDetailsFromPair(e),workingDirectory:i}),a.lastOperation=n}else console.log("No file path found for pair:",t,e)}),console.log("updateFileOperations - final result:",this.fileOperations.size,"file operations"),this.fileOperations.size>0&&console.log("File operations map:",Array.from(this.fileOperations.entries()))}updateToolCalls(e){this.toolCalls.clear(),console.log("updateToolCalls - processing",e.length,"events");const t=[],o=[];let a=0;e.forEach((e,s)=>{const n=this.isToolOperation(e);n&&a++,s<5&&console.log(`Tool Event ${s}:`,{type:e.type,subtype:e.subtype,tool_name:e.tool_name,tool_parameters:e.tool_parameters,isToolOp:n}),n&&("pre_tool"===e.subtype||"hook"===e.type&&e.subtype&&!e.subtype.includes("post")?t.push(e):("post_tool"===e.subtype||e.subtype&&e.subtype.includes("post")||t.push(e),o.push(e)))}),console.log("updateToolCalls - found",a,"tool operations:",t.length,"pre_tool,",o.length,"post_tool");const s=new Map,n=new Set;t.forEach((e,t)=>{const a=e.tool_name||e.data&&e.data.tool_name,r=e.session_id||e.data&&e.data.session_id||"unknown",i=new Date(e.timestamp).getTime(),l=`${r}_${a}_${t}_${i}`,p={pre_event:e,post_event:null,tool_name:a,session_id:r,operation_type:e.operation_type||"tool_execution",timestamp:e.timestamp,duration_ms:null,success:null,exit_code:null,result_summary:null,agent_type:null,agent_confidence:null},c=this.extractAgentFromEvent(e);p.agent_type=c.name,p.agent_confidence=c.confidence;let _=-1,m=-1;if(o.forEach((t,o)=>{if(n.has(o))return;const s=t.tool_name||t.data&&t.data.tool_name,l=t.session_id||t.data&&t.data.session_id||"unknown";if(s!==a||l!==r)return;const p=new Date(t.timestamp).getTime(),c=Math.abs(p-i);let u=0;p>=i-1e3&&c<=3e5&&(u=1e3-c/1e3,this.compareToolParameters(e,t)&&(u+=500),e.working_directory&&t.working_directory&&e.working_directory===t.working_directory&&(u+=100)),u>m&&(m=u,_=o)}),_>=0&&m>0){const t=o[_];p.post_event=t,p.duration_ms=t.duration_ms,p.success=t.success,p.exit_code=t.exit_code,p.result_summary=t.result_summary,n.add(_),console.log(`Paired pre_tool ${a} at ${e.timestamp} with post_tool at ${t.timestamp} (score: ${m})`)}else console.log(`No matching post_tool found for ${a} at ${e.timestamp} (still running or orphaned)`);s.set(l,p)}),o.forEach((e,t)=>{if(n.has(t))return;const o=e.tool_name||e.data&&e.data.tool_name;console.log("Orphaned post_tool event found:",o,"at",e.timestamp);const a=e.session_id||e.data&&e.data.session_id||"unknown",r=`orphaned_${a}_${o}_${t}_${new Date(e.timestamp).getTime()}`,i={pre_event:null,post_event:e,tool_name:o,session_id:a,operation_type:"tool_execution",timestamp:e.timestamp,duration_ms:e.duration_ms,success:e.success,exit_code:e.exit_code,result_summary:e.result_summary,agent_type:null,agent_confidence:null},l=this.extractAgentFromEvent(e);i.agent_type=l.name,i.agent_confidence=l.confidence,s.set(r,i)}),this.toolCalls=s,console.log("updateToolCalls - final result:",this.toolCalls.size,"tool calls"),this.toolCalls.size>0&&console.log("Tool calls map keys:",Array.from(this.toolCalls.keys()))}isToolOperation(e){const t=e.tool_name||e.data&&e.data.tool_name,o=["hook","tool_use","tool","agent","response"].includes(e.type)||e.type&&e.type.includes("tool"),a="pre_tool"===e.subtype||"post_tool"===e.subtype||e.subtype&&"string"==typeof e.subtype&&e.subtype.includes("tool")||"tool_use"===e.type||"tool"===e.type;return t&&(o||a)}isFileOperation(e){let t=e.tool_name||e.data&&e.data.tool_name||"";if(!t)return!1;t=t.toLowerCase();const o=e.tool_parameters||e.data&&e.data.tool_parameters;if("bash"===t&&o){if((o.command||"").match(/\b(cat|less|more|head|tail|touch|mv|cp|rm|mkdir|ls|find)\b/))return!0}return["read","write","edit","grep","multiedit","glob","ls","bash","notebookedit"].includes(t)}extractFilePath(e){const t=e.tool_name||e.data&&e.data.tool_name;if(["Read","Write","Edit","MultiEdit","NotebookEdit"].includes(t)&&console.log("Extracting file path from event:",{tool_name:t,has_tool_parameters_top:!!e.tool_parameters,has_tool_parameters_data:!(!e.data||!e.data.tool_parameters),tool_parameters:e.tool_parameters,data_tool_parameters:e.data?.tool_parameters}),e.tool_parameters?.file_path)return e.tool_parameters.file_path;if(e.tool_parameters?.path)return e.tool_parameters.path;if(e.tool_parameters?.notebook_path)return e.tool_parameters.notebook_path;if(e.data?.tool_parameters?.file_path)return e.data.tool_parameters.file_path;if(e.data?.tool_parameters?.path)return e.data.tool_parameters.path;if(e.data?.tool_parameters?.notebook_path)return e.data.tool_parameters.notebook_path;if(e.file_path)return e.file_path;if(e.path)return e.path;if("glob"===e.tool_name?.toLowerCase()&&e.tool_parameters?.pattern)return`[glob] ${e.tool_parameters.pattern}`;if("bash"===e.tool_name?.toLowerCase()&&e.tool_parameters?.command){const t=e.tool_parameters.command,o=t.match(/(?:cat|less|more|head|tail|touch|mv|cp|rm|mkdir|ls|find|echo.*>|sed|awk|grep)(?:\s+-[a-zA-Z0-9]+)*(?:\s+[0-9]+)*\s+([^\s;|&]+)/);if(o&&o[1]){const e=o[1];if(e.startsWith("-")){const e=t.match(/(?:cat|less|more|head|tail|touch|mv|cp|rm|mkdir|ls|find|echo.*>|sed|awk|grep)(?:\s+-[^\s]+)*\s+([^-][^\s;|&]*)/);if(e&&e[1])return e[1]}return e}}return null}extractFilePathFromPair(e){let t=null;return e.pre_event&&(t=this.extractFilePath(e.pre_event)),!t&&e.post_event&&(t=this.extractFilePath(e.post_event)),t}getFileOperation(e){if(!e.tool_name)return"unknown";const t=e.tool_name.toLowerCase();switch(t){case"read":return"read";case"write":return"write";case"edit":case"multiedit":case"notebookedit":return"edit";case"grep":case"glob":return"search";case"ls":return"list";case"bash":const o=e.tool_parameters?.command||"";return o.match(/\b(cat|less|more|head|tail)\b/)?"read":o.match(/\b(touch|echo.*>|tee)\b/)?"write":o.match(/\b(sed|awk)\b/)?"edit":o.match(/\b(grep|find)\b/)?"search":o.match(/\b(ls|dir)\b/)?"list":o.match(/\b(mv|cp)\b/)?"copy/move":o.match(/\b(rm|rmdir)\b/)?"delete":o.match(/\b(mkdir)\b/)?"create":"bash";default:return t}}getFileOperationFromPair(e){return e.pre_event?this.getFileOperation(e.pre_event):e.post_event?this.getFileOperation(e.post_event):"unknown"}extractAgentFromPair(e){const t=e.pre_event||e.post_event;if(t&&this.agentInference){const e=this.agentInference.getInferredAgentForEvent(t);if(e)return{name:e.agentName||"Unknown",confidence:e.confidence||"unknown"}}return{name:t?.agent_type||t?.subagent_type||e.pre_event?.agent_type||e.post_event?.agent_type||"PM",confidence:"direct"}}getFileOperationDetailsFromPair(e){const t={};if(e.pre_event){const o=e.pre_event.tool_parameters||e.pre_event.data?.tool_parameters||{};t.parameters=o,t.tool_input=e.pre_event.tool_input}return e.post_event&&(t.result=e.post_event.result,t.success=e.post_event.success,t.error=e.post_event.error,t.exit_code=e.post_event.exit_code,t.duration_ms=e.post_event.duration_ms),t}getFileOperations(){return this.fileOperations}getToolCalls(){return this.toolCalls}getToolCallsArray(){return Array.from(this.toolCalls.entries())}getFileOperationsForFile(e){return this.fileOperations.get(e)||null}getToolCall(e){return this.toolCalls.get(e)||null}clear(){this.fileOperations.clear(),this.toolCalls.clear(),console.log("File-tool tracker cleared")}getStatistics(){return{fileOperations:this.fileOperations.size,toolCalls:this.toolCalls.size,uniqueFiles:this.fileOperations.size,totalFileOperations:Array.from(this.fileOperations.values()).reduce((e,t)=>e+t.operations.length,0)}}compareToolParameters(e,t){const o=e.tool_parameters||e.data?.tool_parameters||{},a=t.tool_parameters||t.data?.tool_parameters||{};if(0===Object.keys(o).length&&0===Object.keys(a).length)return!1;let s=0,n=0;if(["file_path","path","pattern","command","notebook_path"].forEach(e=>{const t=o[e],r=a[e];void 0===t&&void 0===r||(n++,t===r&&s++)}),n>0)return s/n>=.8;const r=Object.keys(o).sort(),i=Object.keys(a).sort();if(0===r.length&&0===i.length)return!1;if(r.length===i.length){return r.filter(e=>i.includes(e)).length>=Math.max(1,.5*r.length)}return!1}extractAgentFromEvent(e){if(this.agentInference){const t=this.agentInference.getInferredAgentForEvent(e);if(t)return{name:t.agentName||"Unknown",confidence:t.confidence||"unknown"}}return{name:e.agent_type||e.subagent_type||e.data?.agent_type||e.data?.subagent_type||"PM",confidence:"direct"}}};
|
|
2
|
-
//# sourceMappingURL=file-tool-tracker.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=new class{constructor(){this.modal=null,this.currentFile=null,this.initialized=!1,this.contentCache=new Map}initialize(){this.initialized||(this.createModal(),this.setupEventHandlers(),this.initialized=!0,console.log("File viewer initialized"))}createModal(){if(document.body.insertAdjacentHTML("beforeend",'\n <div class="file-viewer-modal" id="file-viewer-modal">\n <div class="file-viewer-content">\n <div class="file-viewer-header">\n <h2>📄 File Viewer</h2>\n <button class="file-viewer-close" id="file-viewer-close">×</button>\n </div>\n <div class="file-viewer-path" id="file-viewer-path">\n Loading...\n </div>\n <div class="file-viewer-body">\n <pre class="file-viewer-code" id="file-viewer-code">\n <code id="file-viewer-code-content">Loading file content...</code>\n </pre>\n </div>\n <div class="file-viewer-footer">\n <div class="file-viewer-info">\n <span id="file-viewer-type">Type: --</span>\n <span id="file-viewer-lines">Lines: --</span>\n <span id="file-viewer-size">Size: --</span>\n </div>\n <button class="file-viewer-copy" id="file-viewer-copy">📋 Copy</button>\n </div>\n </div>\n </div>\n '),this.modal=document.getElementById("file-viewer-modal"),!document.getElementById("file-viewer-styles")){const e="\n <style id=\"file-viewer-styles\">\n .file-viewer-modal {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.7);\n z-index: 10000;\n animation: fadeIn 0.2s;\n }\n\n .file-viewer-modal.show {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .file-viewer-content {\n background: #1e1e1e;\n border-radius: 8px;\n width: 90%;\n max-width: 1200px;\n height: 80%;\n display: flex;\n flex-direction: column;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);\n }\n\n .file-viewer-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 15px 20px;\n background: #2d2d30;\n border-radius: 8px 8px 0 0;\n border-bottom: 1px solid #3e3e42;\n }\n\n .file-viewer-header h2 {\n margin: 0;\n color: #cccccc;\n font-size: 18px;\n }\n\n .file-viewer-close {\n background: none;\n border: none;\n color: #999;\n font-size: 24px;\n cursor: pointer;\n padding: 0;\n width: 30px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .file-viewer-close:hover {\n color: #fff;\n }\n\n .file-viewer-path {\n padding: 10px 20px;\n background: #252526;\n color: #8b8b8b;\n font-family: 'Consolas', 'Monaco', monospace;\n font-size: 12px;\n border-bottom: 1px solid #3e3e42;\n word-break: break-all;\n }\n\n .file-viewer-body {\n flex: 1;\n overflow: auto;\n padding: 20px;\n background: #1e1e1e;\n }\n\n .file-viewer-code {\n margin: 0;\n padding: 0;\n background: transparent;\n overflow: visible;\n }\n\n .file-viewer-code code {\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 13px;\n line-height: 1.5;\n color: #d4d4d4;\n white-space: pre;\n display: block;\n }\n\n .file-viewer-footer {\n padding: 15px 20px;\n background: #2d2d30;\n border-top: 1px solid #3e3e42;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-radius: 0 0 8px 8px;\n }\n\n .file-viewer-info {\n display: flex;\n gap: 20px;\n color: #8b8b8b;\n font-size: 12px;\n }\n\n .file-viewer-copy {\n background: #0e639c;\n color: white;\n border: none;\n padding: 6px 12px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n }\n\n .file-viewer-copy:hover {\n background: #1177bb;\n }\n\n .file-viewer-copy.copied {\n background: #4ec9b0;\n }\n\n .file-viewer-error {\n color: #f48771;\n padding: 20px;\n text-align: center;\n }\n\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n </style>\n ";document.head.insertAdjacentHTML("beforeend",e)}}setupEventHandlers(){document.getElementById("file-viewer-close").addEventListener("click",()=>{this.hide()}),this.modal.addEventListener("click",e=>{e.target===this.modal&&this.hide()}),document.addEventListener("keydown",e=>{"Escape"===e.key&&this.modal.classList.contains("show")&&this.hide()}),document.getElementById("file-viewer-copy").addEventListener("click",()=>{this.copyContent()})}async show(e){console.log("[FileViewer] show() called with path:",e),console.log("[FileViewer] initialized:",this.initialized),this.initialized||(console.log("[FileViewer] Not initialized, initializing now..."),this.initialize()),this.currentFile=e,this.modal.classList.add("show"),document.getElementById("file-viewer-path").textContent=e,console.log("[FileViewer] Modal shown, loading file content..."),await this.loadFileContent(e)}hide(){this.modal.classList.remove("show"),this.currentFile=null}async loadFileContent(e){const n=document.getElementById("file-viewer-code-content");if(console.log("[FileViewer] loadFileContent called with path:",e),this.contentCache.has(e))return console.log("[FileViewer] Using cached content for:",e),void this.displayContent(this.contentCache.get(e));n.textContent="Loading file content...";try{if(!window.socket||!window.socket.connected)throw console.error("[FileViewer] No Socket.IO connection available"),new Error("No socket connection available. Please ensure the dashboard is connected to the monitoring server.");{console.log("[FileViewer] Using Socket.IO to load file:",e);const n=new Promise((n,i)=>{const t=setTimeout(()=>{console.error("[FileViewer] Socket.IO request timed out for:",e),i(new Error("Socket.IO request timed out"))},1e4);window.socket.once("file_content_response",e=>{clearTimeout(t),console.log("[FileViewer] Received file_content_response:",e),n(e)}),console.log("[FileViewer] Emitting read_file event with data:",{file_path:e,working_dir:window.workingDirectory||"/",max_size:5242880}),window.socket.emit("read_file",{file_path:e,working_dir:window.workingDirectory||"/",max_size:5242880})}),i=await n;if(!i.success||void 0===i.content)throw console.error("[FileViewer] Server returned error:",i.error),new Error(i.error||"Failed to load file content");console.log("[FileViewer] Successfully loaded file content, caching..."),this.contentCache.set(e,i.content),this.displayContent(i.content),this.updateFileInfo(i)}}catch(i){console.error("[FileViewer] Error loading file:",i),console.error("[FileViewer] Error stack:",i.stack),this.displayError(e,i.message)}}displayContent(e){const n=document.getElementById("file-viewer-code-content");n.textContent=e||"(Empty file)";const i=e?e.split("\n").length:0;document.getElementById("file-viewer-lines").textContent=`Lines: ${i}`;const t=e?new Blob([e]).size:0;document.getElementById("file-viewer-size").textContent=`Size: ${this.formatFileSize(t)}`;const o=this.detectFileType(this.currentFile);if(document.getElementById("file-viewer-type").textContent=`Type: ${o}`,window.Prism){const e=this.detectLanguage(this.currentFile);n.className=`language-${e}`,Prism.highlightElement(n)}}displayError(e,n){const i=`\n <div class="file-viewer-error">\n ⚠️ File content loading is not yet implemented\n \n File path: ${e}\n \n The file viewing functionality requires:\n 1. A server-side /api/file endpoint\n 2. Proper file reading permissions\n 3. Security validation for file access\n \n Error: ${n}\n \n This feature will be available once the backend API is implemented.\n </div>\n `;document.getElementById("file-viewer-code-content").innerHTML=i,document.getElementById("file-viewer-lines").textContent="Lines: --",document.getElementById("file-viewer-size").textContent="Size: --",document.getElementById("file-viewer-type").textContent="Type: --"}updateFileInfo(e){void 0!==e.lines&&(document.getElementById("file-viewer-lines").textContent=`Lines: ${e.lines}`),void 0!==e.size&&(document.getElementById("file-viewer-size").textContent=`Size: ${this.formatFileSize(e.size)}`),e.type&&(document.getElementById("file-viewer-type").textContent=`Type: ${e.type}`)}formatFileSize(e){if(0===e)return"0 Bytes";const n=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,n)*100)/100+" "+["Bytes","KB","MB","GB"][n]}detectFileType(e){if(!e)return"Unknown";const n=e.split(".").pop()?.toLowerCase();return{py:"Python",js:"JavaScript",ts:"TypeScript",jsx:"React JSX",tsx:"React TSX",html:"HTML",css:"CSS",json:"JSON",xml:"XML",yaml:"YAML",yml:"YAML",md:"Markdown",txt:"Text",sh:"Shell Script",bash:"Bash Script",sql:"SQL",go:"Go",rs:"Rust",java:"Java",cpp:"C++",c:"C",cs:"C#",rb:"Ruby",php:"PHP"}[n]||"Text"}detectLanguage(e){if(!e)return"plaintext";const n=e.split(".").pop()?.toLowerCase();return{py:"python",js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",xml:"xml",yaml:"yaml",yml:"yaml",md:"markdown",sh:"bash",bash:"bash",sql:"sql",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",rb:"ruby",php:"php"}[n]||"plaintext"}async copyContent(){const e=document.getElementById("file-viewer-code-content"),n=document.getElementById("file-viewer-copy"),i=e.textContent;try{await navigator.clipboard.writeText(i);const e=n.textContent;n.textContent="✅ Copied!",n.classList.add("copied"),setTimeout(()=>{n.textContent=e,n.classList.remove("copied")},2e3)}catch(t){console.error("Failed to copy:",t),alert("Failed to copy content to clipboard")}}};window.showFileViewerModal||(window.showFileViewerModal=n=>{console.log("[FileViewer] showFileViewerModal called with path:",n),e.show(n)}),window.fileViewerInstance=e,"undefined"!=typeof window&&(window.FileViewer=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{e.initialize()}):e.initialize());
|
|
2
|
-
//# sourceMappingURL=file-viewer.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
window.HUDLibraryLoader=new class{constructor(){this.loadedLibraries=new Set,this.loadingPromises=new Map,this.loadingCallbacks=new Map,this.libraries=[{name:"cytoscape",url:"https://unpkg.com/cytoscape@3.26.0/dist/cytoscape.min.js",globalCheck:()=>void 0!==window.cytoscape,dependencies:[]},{name:"dagre",url:"https://unpkg.com/dagre@0.8.5/dist/dagre.min.js",globalCheck:()=>void 0!==window.dagre,dependencies:[]},{name:"cytoscape-dagre",url:"https://unpkg.com/cytoscape-dagre@2.5.0/cytoscape-dagre.js",globalCheck:()=>void 0!==window.cytoscapeDagre,dependencies:["cytoscape","dagre"]}]}loadLibrary(e){if(e.globalCheck())return this.loadedLibraries.add(e.name),Promise.resolve();if(this.loadingPromises.has(e.name))return this.loadingPromises.get(e.name);console.log(`Loading library: ${e.name} from ${e.url}`);const r=new Promise((r,a)=>{const i=document.createElement("script");i.src=e.url,i.async=!0,i.onload=()=>{if(e.globalCheck())console.log(`Successfully loaded library: ${e.name}`),this.loadedLibraries.add(e.name),this.loadingPromises.delete(e.name),r();else{const r=new Error(`Library ${e.name} failed global check after loading`);console.error(r),this.loadingPromises.delete(e.name),a(r)}},i.onerror=()=>{const r=new Error(`Failed to load library: ${e.name} from ${e.url}`);console.error(r),this.loadingPromises.delete(e.name),a(r)},document.head.appendChild(i)});return this.loadingPromises.set(e.name,r),r}async loadDependencies(e){const r=e.map(e=>{const r=this.libraries.find(r=>r.name===e);if(!r)throw new Error(`Dependency ${e} not found in library configuration`);return this.loadLibraryWithDependencies(r)});return Promise.all(r)}async loadLibraryWithDependencies(e){return e.dependencies.length>0&&await this.loadDependencies(e.dependencies),this.loadLibrary(e)}async loadHUDLibraries(e=null){console.log("Starting HUD libraries loading...");try{for(let a=0;a<this.libraries.length;a++){const r=this.libraries[a];e&&e({library:r.name,current:a+1,total:this.libraries.length,message:`Loading ${r.name}...`}),await this.loadLibraryWithDependencies(r)}const r=this.libraries.filter(e=>!e.globalCheck());if(r.length>0)throw new Error(`Failed to load libraries: ${r.map(e=>e.name).join(", ")}`);return console.log("All HUD libraries loaded successfully"),e&&e({library:"complete",current:this.libraries.length,total:this.libraries.length,message:"All libraries loaded successfully"}),!0}catch(r){throw console.error("Failed to load HUD libraries:",r),e&&e({library:"error",current:0,total:this.libraries.length,message:`Error: ${r.message}`,error:r}),r}}areLibrariesLoaded(){return this.libraries.every(e=>e.globalCheck())}getLoadingStatus(){return{loaded:Array.from(this.loadedLibraries),loading:Array.from(this.loadingPromises.keys()),total:this.libraries.length,allLoaded:this.areLibrariesLoaded()}}reset(){this.loadedLibraries.clear(),this.loadingPromises.clear(),this.loadingCallbacks.clear()}};
|
|
2
|
-
//# sourceMappingURL=hud-library-loader.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
window.HUDVisualizer=class{constructor(){this.cy=null,this.container=null,this.nodes=new Map,this.isActive=!1,this.librariesLoaded=!1,this.loadingPromise=null,this.pendingEvents=[],this.layoutConfig={name:"dagre",rankDir:"TB",animate:!0,animationDuration:500,fit:!0,padding:30,rankSep:100,nodeSep:80},this.nodeTypes={PM:{color:"#48bb78",shape:"rectangle",width:120,height:40,icon:"👤"},AGENT:{color:"#9f7aea",shape:"ellipse",width:100,height:60,icon:"🤖"},TOOL:{color:"#4299e1",shape:"diamond",width:80,height:50,icon:"🔧"},TODO:{color:"#e53e3e",shape:"triangle",width:70,height:40,icon:"📝"}}}initialize(){return this.container=document.getElementById("hud-cytoscape"),this.container?(this.container.style.pointerEvents="auto",this.container.style.cursor="default",this.container.style.position="relative",this.container.style.zIndex="1",this.setupBasicEventHandlers(),console.log("HUD Visualizer initialized (libraries will load lazily)"),!0):(console.error("HUD container not found"),!1)}async loadLibrariesAndInitialize(){return this.librariesLoaded&&this.cy?Promise.resolve():(this.loadingPromise||(this.loadingPromise=this._performLazyLoading()),this.loadingPromise)}async _performLazyLoading(){try{if(console.log("[HUD-VISUALIZER-DEBUG] _performLazyLoading() called"),console.log("[HUD-VISUALIZER-DEBUG] Loading HUD visualization libraries..."),this.showLoadingIndicator(),!window.HUDLibraryLoader)throw new Error("HUD Library Loader not available");if(console.log("[HUD-VISUALIZER-DEBUG] HUD Library Loader found, loading libraries..."),await window.HUDLibraryLoader.loadHUDLibraries(e=>{console.log("[HUD-VISUALIZER-DEBUG] Loading progress:",e),this.updateLoadingProgress(e)}),console.log("[HUD-VISUALIZER-DEBUG] Verifying libraries are loaded..."),void 0===window.cytoscape)throw new Error("Cytoscape.js not loaded");if(void 0===window.dagre)throw new Error("Dagre not loaded");if(void 0===window.cytoscapeDagre)throw new Error("Cytoscape-dagre not loaded");return console.log("[HUD-VISUALIZER-DEBUG] All HUD libraries loaded successfully"),this.librariesLoaded=!0,console.log("[HUD-VISUALIZER-DEBUG] Initializing Cytoscape..."),this.initializeCytoscape(),console.log("[HUD-VISUALIZER-DEBUG] Setting up Cytoscape event handlers..."),this.setupCytoscapeEventHandlers(),console.log("[HUD-VISUALIZER-DEBUG] Processing pending events..."),this.processPendingEvents(),this.hideLoadingIndicator(),console.log("[HUD-VISUALIZER-DEBUG] HUD Visualizer fully initialized with lazy loading"),!0}catch(e){throw console.error("[HUD-VISUALIZER-DEBUG] Failed to load HUD libraries:",e),console.error("[HUD-VISUALIZER-DEBUG] Error stack:",e.stack),this.showLoadingError(e.message),this.librariesLoaded=!1,this.loadingPromise=null,e}}initializeCytoscape(){this.librariesLoaded&&window.cytoscape?(void 0!==window.cytoscape&&void 0!==window.cytoscapeDagre&&window.cytoscape.use(window.cytoscapeDagre),this.cy=window.cytoscape({container:this.container,elements:[],userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,autoungrabify:!1,autounselectify:!1,style:[{selector:"node",style:{"background-color":"data(color)","border-color":"data(borderColor)","border-width":2,color:"#ffffff",label:"data(label)","text-valign":"center","text-halign":"center","font-size":"12px","font-weight":"bold",width:"data(width)",height:"data(height)",shape:"data(shape)","text-wrap":"wrap","text-max-width":"100px"}},{selector:"edge",style:{width:2,"line-color":"#718096","target-arrow-color":"#718096","target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":1.2}},{selector:".pm-node",style:{"background-color":"#48bb78","border-color":"#38a169",shape:"rectangle"}},{selector:".agent-node",style:{"background-color":"#9f7aea","border-color":"#805ad5",shape:"ellipse"}},{selector:".tool-node",style:{"background-color":"#4299e1","border-color":"#3182ce",shape:"diamond"}},{selector:".todo-node",style:{"background-color":"#e53e3e","border-color":"#c53030",shape:"triangle"}},{selector:"node:active",style:{"overlay-opacity":.2,"overlay-color":"#000000"}}],layout:this.layoutConfig}),this.setupResizeHandler()):console.error("Cannot initialize Cytoscape: libraries not loaded")}setupBasicEventHandlers(){const e=document.getElementById("hud-reset-layout");e&&e.addEventListener("click",()=>{this.resetLayout()});const t=document.getElementById("hud-center-view");t&&t.addEventListener("click",()=>{this.centerView()})}setupCytoscapeEventHandlers(){this.cy?(console.log("[HUD-VISUALIZER-DEBUG] Setting up Cytoscape event handlers..."),this.cy.on("tap","node",e=>{const t=e.target,o=t.data();console.log("[HUD-VISUALIZER-DEBUG] Node clicked:",o),this.highlightConnectedNodes(t)}),this.cy.on("tap",e=>{e.target===this.cy&&(console.log("[HUD-VISUALIZER-DEBUG] Background clicked - resetting highlights"),this.cy.nodes().style({opacity:1}),this.cy.edges().style({opacity:1}))}),this.cy.on("mouseover","node",e=>{e.target.style("opacity",.8)}),this.cy.on("mouseout","node",e=>{e.target.style("opacity",1)}),console.log("[HUD-VISUALIZER-DEBUG] Cytoscape event handlers set up successfully")):console.warn("[HUD-VISUALIZER-DEBUG] Cannot setup Cytoscape event handlers: no cy instance")}setupResizeHandler(){const e=new ResizeObserver(()=>{this.cy&&this.isActive&&this.ensureContainerResize()});this.container&&e.observe(this.container)}ensureContainerResize(){if(!this.cy||!this.container)return void console.log("[HUD-VISUALIZER-DEBUG] Cannot resize: missing cy or container");this.ensureContainerInteractivity();const e=this.container.getBoundingClientRect();if(console.log("[HUD-VISUALIZER-DEBUG] Container dimensions:",{width:e.width,height:e.height,offsetWidth:this.container.offsetWidth,offsetHeight:this.container.offsetHeight,isVisible:e.width>0&&e.height>0}),e.width>0&&e.height>0){console.log("[HUD-VISUALIZER-DEBUG] Container is visible, resizing Cytoscape...");try{this.cy.resize();const e=this.cy.nodes().length,t=this.cy.edges().length;console.log("[HUD-VISUALIZER-DEBUG] Cytoscape elements after resize:",{nodes:e,edges:t}),e>0?(console.log("[HUD-VISUALIZER-DEBUG] Running fit and layout..."),this.cy.fit(),this.runLayout()):console.log("[HUD-VISUALIZER-DEBUG] No nodes to display")}catch(t){console.error("[HUD-VISUALIZER-DEBUG] Error during resize:",t)}}else console.log("[HUD-VISUALIZER-DEBUG] Container not visible yet, skipping resize")}ensureContainerInteractivity(){if(!this.container)return;this.container.style.pointerEvents="auto",this.container.style.cursor="default",this.container.style.userSelect="none",this.container.style.touchAction="manipulation";const e=this.container.parentElement;e&&(e.style.pointerEvents="auto",e.style.position="relative"),console.log("[HUD-VISUALIZER-DEBUG] Container interactivity ensured")}async activate(){console.log("[HUD-VISUALIZER-DEBUG] activate() called"),this.isActive=!0;try{console.log("[HUD-VISUALIZER-DEBUG] Loading libraries and initializing..."),await this.loadLibrariesAndInitialize(),console.log("[HUD-VISUALIZER-DEBUG] Libraries loaded, cy exists:",!!this.cy),this.cy||(console.log("[HUD-VISUALIZER-DEBUG] Cytoscape instance missing, recreating..."),this.initializeCytoscape(),this.setupCytoscapeEventHandlers()),this.cy&&(console.log("[HUD-VISUALIZER-DEBUG] Triggering resize and fit..."),setTimeout(()=>{console.log("[HUD-VISUALIZER-DEBUG] First resize attempt..."),this.ensureContainerResize()},50),setTimeout(()=>{console.log("[HUD-VISUALIZER-DEBUG] Second resize attempt..."),this.ensureContainerResize()},200),setTimeout(()=>{console.log("[HUD-VISUALIZER-DEBUG] Final resize attempt..."),this.ensureContainerResize()},500)),console.log("[HUD-VISUALIZER-DEBUG] activate() completed successfully")}catch(e){throw console.error("[HUD-VISUALIZER-DEBUG] Failed to activate HUD:",e),console.error("[HUD-VISUALIZER-DEBUG] Error stack:",e.stack),e}}deactivate(){this.isActive=!1}processPendingEvents(){if(this.pendingEvents.length>0){console.log(`Processing ${this.pendingEvents.length} pending events`);for(const e of this.pendingEvents)this._processEventInternal(e);this.pendingEvents=[]}}processExistingEvents(e){if(console.log(`[HUD-VISUALIZER-DEBUG] processExistingEvents called with ${e?e.length:0} events`),!e)return void console.error("[HUD-VISUALIZER-DEBUG] No events provided to processExistingEvents");if(!Array.isArray(e))return void console.error("[HUD-VISUALIZER-DEBUG] Events is not an array:",typeof e);if(console.log(`[HUD-VISUALIZER-DEBUG] Libraries loaded: ${this.librariesLoaded}, Cytoscape available: ${!!this.cy}`),!this.librariesLoaded||!this.cy)return console.warn("[HUD-VISUALIZER-DEBUG] HUD libraries not loaded, cannot process existing events"),console.log(`[HUD-VISUALIZER-DEBUG] Storing ${e.length} events as pending`),void(this.pendingEvents=[...e]);console.log(`[HUD-VISUALIZER-DEBUG] 🏗️ Building HUD tree structure from ${e.length} historical events`),e.length>0&&(console.log("[HUD-VISUALIZER-DEBUG] Sample events:"),e.slice(0,3).forEach((e,t)=>{console.log(`[HUD-VISUALIZER-DEBUG] Event ${t+1}:`,{timestamp:e.timestamp,hook_event_name:e.hook_event_name,type:e.type,subtype:e.subtype,session_id:e.session_id,data_session_id:e.data?.session_id,data_keys:e.data?Object.keys(e.data):"no data"})})),this.clear();const t=this.groupEventsBySession(e);Object.entries(t).forEach(([e,t])=>{console.log(` 📂 Processing session ${e}: ${t.length} events`),this.buildSessionTree(e,t)}),this.runLayout(),console.log("✅ HUD tree structure built successfully")}groupEventsBySession(e){const t={};return e.forEach(e=>{const o=e.session_id||e.data?.session_id||"unknown";t[o]||(t[o]=[]),t[o].push(e)}),t}buildSessionTree(e,t){console.log(`[HUD-VISUALIZER-DEBUG] Building session tree for ${e} with ${t.length} events`);const o=new Map;let n=null;const s=t.sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime());console.log(`[HUD-VISUALIZER-DEBUG] Sorted ${s.length} events chronologically`),s.forEach((t,s)=>{const i=this.createNodeFromEvent(t,e);i&&(this.addNode(i.id,i.type,i.label,{sessionId:e,timestamp:t.timestamp,eventData:t,isSessionRoot:i.isSessionRoot}),o.set(i.id,{...i,event:t,index:s}),i.isSessionRoot&&!n&&(n=i.id),this.createHierarchicalRelationships(i.id,t,o,n))})}createNodeFromEvent(e,t){const o=e.hook_event_name||e.type||"",n=e.subtype||"",s=new Date(e.timestamp||Date.now());console.log(`[HUD-VISUALIZER-DEBUG] Creating node from event: ${o}/${n} for session ${t}`);let i,r,a,l=!1;const c=s.getTime(),d=Math.random().toString(36).substring(2,7);if("session"===o&&"started"===n)r="PM",a=`Session ${t.substring(0,8)}...`,i=`session-${t.replace(/[^a-zA-Z0-9]/g,"")}`,l=!0;else if("hook"===o&&"user_prompt"===n){r="PM";const t=e.data?.prompt_preview||"User Prompt";a=t.length>20?t.substring(0,20)+"...":t,i=`user-prompt-${c}-${d}`}else if("hook"===o&&"claude_response"===n)r="PM",a="Claude Response",i=`claude-response-${c}-${d}`;else if("hook"===o&&"pre_tool"===n){r="TOOL";const t=e.data?.tool_name||"Unknown Tool",o=t.replace(/[^a-zA-Z0-9]/g,"");a=`${t}`,i=`tool-${o}-${c}-${d}`}else if("agent"===o||e.data?.agent_type){r="AGENT";const t=e.data?.agent_type||e.data?.agent_name||"Agent",o=t.replace(/[^a-zA-Z0-9]/g,"");a=t,i=`agent-${o}-${c}-${d}`}else if("todo"===o||n.includes("todo"))r="TODO",a="Todo Update",i=`todo-${c}-${d}`;else{if("hook"===o&&"notification"===n)return null;if("log"===o){const t=e.data?.level||"info";if(!["error","critical"].includes(t))return null;r="PM",a=`${t.toUpperCase()} Log`,i=`log-${t}-${c}-${d}`}else{r="PM";const e=o.replace(/[^a-zA-Z0-9]/g,"")||"Event";a=o||"Event",i=`generic-${e}-${c}-${d}`}}return{id:i,type:r,label:a,isSessionRoot:l}}createHierarchicalRelationships(e,t,o,n){const s=t.hook_event_name||t.type||"",i=t.subtype||"";let r=null;"session"===s&&"started"===i||(r="hook"===s&&"pre_tool"===i?this.findRecentParentNode(o,["user-prompt","agent"],e):"hook"===s&&"claude_response"===i?this.findRecentParentNode(o,["user-prompt"],e):"agent"===s?this.findRecentParentNode(o,["user-prompt","agent"],e):"todo"===s?this.findRecentParentNode(o,["agent","user-prompt"],e):this.findRecentParentNode(o,["user-prompt","agent","session"],e),!r&&n&&e!==n&&(r=n),r&&r!==e&&this.addEdge(r,e))}findRecentParentNode(e,t,o){const n=Array.from(e.entries()).reverse();for(const[s,i]of n)if(s!==o)for(const e of t)if(s.startsWith(e))return s;return null}processEvent(e){this.isActive&&(this.librariesLoaded&&this.cy?this._processEventInternal(e):this.pendingEvents.push(e))}_processEventInternal(e){const t=e.hook_event_name||e.type||"",o=e.session_id||"unknown",n=new Date(e.timestamp||Date.now());let s=`${t}-${n.getTime()}`,i="PM",r=t;if(t.includes("tool_call")){i="TOOL";const t=e.data?.tool_name||"Unknown Tool";r=t,s=`tool-${t}-${n.getTime()}`}else if(t.includes("agent")){i="AGENT";const t=e.data?.agent_name||"Agent";r=t,s=`agent-${t}-${n.getTime()}`}else t.includes("todo")?(i="TODO",r="Todo List",s=`todo-${n.getTime()}`):(t.includes("user_prompt")||t.includes("claude_response"))&&(i="PM",r=t.includes("user_prompt")?"User Prompt":"Claude Response",s=`pm-${r.replace(" ","")}-${n.getTime()}`);this.addNode(s,i,r,{sessionId:o,timestamp:n.toISOString(),eventData:e}),this.createEventRelationships(s,e)}addNode(e,t,o,n={}){if(console.log(`[HUD-VISUALIZER-DEBUG] Adding node: ${e} (${t}) - ${o}`),this.nodes.has(e))return void console.log(`[HUD-VISUALIZER-DEBUG] Node ${e} already exists, skipping`);const s=this.nodeTypes[t]||this.nodeTypes.PM,i={id:e,label:`${s.icon} ${o}`,type:t,color:s.color,borderColor:this.darkenColor(s.color,20),shape:s.shape,width:s.width,height:s.height,...n};if(this.nodes.set(e,i),this.cy){const e={group:"nodes",data:i,classes:`${t.toLowerCase()}-node`};console.log("[HUD-VISUALIZER-DEBUG] Adding node element to Cytoscape:",e),this.cy.add(e),console.log(`[HUD-VISUALIZER-DEBUG] Node added successfully. Total nodes in cy: ${this.cy.nodes().length}`),this.runLayout()}}addEdge(e,t,o=null,n={}){if(e&&t)if(e!==t){if(o||(o=`edge-${e}-to-${t}`),this.cy){if(this.cy.getElementById(o).length>0)return void console.log(`[HUD-VISUALIZER-DEBUG] Edge ${o} already exists, skipping`);const i=this.cy.getElementById(e),r=this.cy.getElementById(t);if(0===i.length)return void console.warn(`[HUD-VISUALIZER-DEBUG] Source node ${e} does not exist, cannot create edge`);if(0===r.length)return void console.warn(`[HUD-VISUALIZER-DEBUG] Target node ${t} does not exist, cannot create edge`);const a={group:"edges",data:{id:o,source:e,target:t,...n}};console.log("[HUD-VISUALIZER-DEBUG] Adding edge element to Cytoscape:",a);try{this.cy.add(a),console.log(`[HUD-VISUALIZER-DEBUG] Edge added successfully. Total edges in cy: ${this.cy.edges().length}`),this.runLayout()}catch(s){console.error(`[HUD-VISUALIZER-DEBUG] Failed to add edge ${o}:`,s),console.error("[HUD-VISUALIZER-DEBUG] Element details:",a)}}}else console.warn(`[HUD-VISUALIZER-DEBUG] Cannot create self-loop edge from ${e} to itself`);else console.warn(`[HUD-VISUALIZER-DEBUG] Cannot create edge: missing source (${e}) or target (${t})`)}createEventRelationships(e,t){const o=t.hook_event_name||t.type||"",n=t.session_id||"unknown";if(Array.from(this.nodes.entries()),o.includes("tool_call")&&t.data?.tool_name){const t=this.findParentNode(n,["PM","AGENT"]);if(t)return void this.addEdge(t,e)}if(o.includes("agent")||t.data?.agent_name){const t=this.findParentNode(n,["PM"]);if(t)return void this.addEdge(t,e)}if(o.includes("todo")){const t=this.findParentNode(n,["AGENT","PM"]);if(t)return void this.addEdge(t,e)}const s=Array.from(this.nodes.keys()),i=s.indexOf(e);if(i>0){const t=s[i-1];this.addEdge(t,e)}}findParentNode(e,t){const o=Array.from(this.nodes.entries()).reverse();for(const[n,s]of o)if(s.sessionId===e&&t.includes(s.type))return n;return null}highlightConnectedNodes(e){if(!this.cy)return;this.cy.nodes().style({opacity:.3}),this.cy.edges().style({opacity:.2});const t=e.neighborhood();e.style("opacity",1),t.style("opacity",1)}resetLayout(){this.cy&&this.cy.layout(this.layoutConfig).run()}centerView(){this.cy&&(this.cy.fit(),this.cy.center())}runLayout(){if(console.log(`[HUD-VISUALIZER-DEBUG] runLayout called - isActive: ${this.isActive}, cy exists: ${!!this.cy}`),this.cy&&this.isActive){const e=this.cy.nodes().length,t=this.cy.edges().length;if(console.log(`[HUD-VISUALIZER-DEBUG] Running layout with ${e} nodes and ${t} edges`),this.container){const e=this.container.getBoundingClientRect();console.log("[HUD-VISUALIZER-DEBUG] Container dimensions before layout:",{width:e.width,height:e.height,offsetWidth:this.container.offsetWidth,offsetHeight:this.container.offsetHeight})}const o=this.cy.layout(this.layoutConfig);o.on("layoutstop",()=>{console.log("[HUD-VISUALIZER-DEBUG] Layout completed. Final node positions:"),this.cy.nodes().forEach((e,t)=>{const o=e.position(),n=e.data();console.log(`[HUD-VISUALIZER-DEBUG] Node ${t+1}: ${n.label} at (${o.x.toFixed(1)}, ${o.y.toFixed(1)})`)})}),o.run()}else console.log("[HUD-VISUALIZER-DEBUG] Skipping layout - not active or no Cytoscape instance")}clear(){if(console.log(`[HUD-VISUALIZER-DEBUG] Clearing HUD: ${this.nodes.size} nodes, ${this.pendingEvents.length} pending events`),this.nodes.clear(),this.pendingEvents=[],this.cy){const o=this.cy.elements().length;try{this.cy.elements().remove(),console.log(`[HUD-VISUALIZER-DEBUG] Removed ${o} Cytoscape elements`)}catch(e){console.error("[HUD-VISUALIZER-DEBUG] Error clearing Cytoscape elements:",e);try{this.cy.destroy(),this.cy=null,console.log("[HUD-VISUALIZER-DEBUG] Destroyed Cytoscape instance due to clear error")}catch(t){console.error("[HUD-VISUALIZER-DEBUG] Error destroying Cytoscape:",t)}}}}showLoadingIndicator(){this.container&&(this.container.innerHTML='\n <div class="hud-loading-container">\n <div class="hud-loading-spinner"></div>\n <div class="hud-loading-text">Loading HUD visualization libraries...</div>\n <div class="hud-loading-progress" id="hud-loading-progress"></div>\n </div>\n ')}updateLoadingProgress(e){const t=document.getElementById("hud-loading-progress");t&&(e.error?t.innerHTML=`<span class="hud-error">❌ ${e.message}</span>`:t.innerHTML=`\n <div class="hud-progress-bar">\n <div class="hud-progress-fill" style="width: ${e.current/e.total*100}%"></div>\n </div>\n <div class="hud-progress-text">${e.message} (${e.current}/${e.total})</div>\n `)}hideLoadingIndicator(){this.container&&(this.container.innerHTML="")}showLoadingError(e){this.container&&(this.container.innerHTML=`\n <div class="hud-error-container">\n <div class="hud-error-icon">⚠️</div>\n <div class="hud-error-text">Failed to load HUD libraries</div>\n <div class="hud-error-message">${e}</div>\n <button class="hud-retry-button" onclick="window.hudVisualizer && window.hudVisualizer.retryLoading()">\n Retry Loading\n </button>\n </div>\n `)}retryLoading(){this.librariesLoaded=!1,this.loadingPromise=null,this.activate()}debugTest(){return console.log("[HUD-VISUALIZER-DEBUG] debugTest() called manually"),console.log("[HUD-VISUALIZER-DEBUG] Current state:",{isActive:this.isActive,librariesLoaded:this.librariesLoaded,hasCy:!!this.cy,hasContainer:!!this.container,nodeCount:this.nodes.size,pendingEventCount:this.pendingEvents.length,hasHUDLibraryLoader:!!window.HUDLibraryLoader}),this.container&&console.log("[HUD-VISUALIZER-DEBUG] Container info:",{id:this.container.id,className:this.container.className,offsetWidth:this.container.offsetWidth,offsetHeight:this.container.offsetHeight,innerHTML:this.container.innerHTML?"has content":"empty"}),console.log("[HUD-VISUALIZER-DEBUG] Library availability:",{cytoscape:typeof window.cytoscape,dagre:typeof window.dagre,cytoscapeDagre:typeof window.cytoscapeDagre,HUDLibraryLoader:typeof window.HUDLibraryLoader}),{isActive:this.isActive,librariesLoaded:this.librariesLoaded,hasCy:!!this.cy,containerFound:!!this.container}}debugBlankScreen(){console.log("[HUD-BLANK-SCREEN-DEBUG] ================================="),console.log("[HUD-BLANK-SCREEN-DEBUG] COMPREHENSIVE BLANK SCREEN DEBUG"),console.log("[HUD-BLANK-SCREEN-DEBUG] =================================");const e={isActive:this.isActive,librariesLoaded:this.librariesLoaded,hasCy:!!this.cy,hasContainer:!!this.container,nodeCount:this.nodes.size,cytoscapeElementCount:this.cy?this.cy.elements().length:0};if(console.log("[HUD-BLANK-SCREEN-DEBUG] 1. Basic State:",e),!this.container)return console.error("[HUD-BLANK-SCREEN-DEBUG] 2. Container not found!"),!1;{const e=this.getContainerDebugInfo();console.log("[HUD-BLANK-SCREEN-DEBUG] 2. Container Info:",e),this.debugAddContainerBackground()}if(!this.cy)return console.error("[HUD-BLANK-SCREEN-DEBUG] 3. Cytoscape instance not found!"),!1;{const e=this.getCytoscapeDebugInfo();console.log("[HUD-BLANK-SCREEN-DEBUG] 3. Cytoscape Info:",e)}return this.debugNodePositions(),this.debugManualRenderingTriggers(),this.cy&&0===this.cy.nodes().length&&(console.log("[HUD-BLANK-SCREEN-DEBUG] 6. No nodes found, adding test nodes..."),this.debugAddTestNodes()),this.debugForceZoomFit(),console.log("[HUD-BLANK-SCREEN-DEBUG] Debug complete. Check visual results."),!0}getContainerDebugInfo(){const e=this.container.getBoundingClientRect(),t=window.getComputedStyle(this.container);return{id:this.container.id,className:this.container.className,offsetWidth:this.container.offsetWidth,offsetHeight:this.container.offsetHeight,clientWidth:this.container.clientWidth,clientHeight:this.container.clientHeight,scrollWidth:this.container.scrollWidth,scrollHeight:this.container.scrollHeight,boundingRect:{width:e.width,height:e.height,top:e.top,left:e.left,bottom:e.bottom,right:e.right},computedStyles:{display:t.display,visibility:t.visibility,opacity:t.opacity,position:t.position,overflow:t.overflow,zIndex:t.zIndex,backgroundColor:t.backgroundColor,transform:t.transform},isVisible:e.width>0&&e.height>0&&"none"!==t.display&&"hidden"!==t.visibility,parentElement:this.container.parentElement?{tagName:this.container.parentElement.tagName,className:this.container.parentElement.className,offsetWidth:this.container.parentElement.offsetWidth,offsetHeight:this.container.parentElement.offsetHeight}:null}}getCytoscapeDebugInfo(){const e=this.cy.extent(),t=this.cy.zoom(),o=this.cy.pan(),n=this.cy.viewport();return{nodeCount:this.cy.nodes().length,edgeCount:this.cy.edges().length,elementCount:this.cy.elements().length,zoom:t,pan:o,extent:e,viewport:n,containerWidth:this.cy.width(),containerHeight:this.cy.height(),isInitialized:void 0!==this.cy.scratch("_cytoscape-initialized"),renderer:this.cy.renderer()?{name:this.cy.renderer().name,options:this.cy.renderer().options}:null}}debugNodePositions(){if(!this.cy||0===this.cy.nodes().length)return void console.log("[HUD-BLANK-SCREEN-DEBUG] 4. No nodes to check positions");console.log("[HUD-BLANK-SCREEN-DEBUG] 4. Node Positions:");const e=this.cy.nodes(),t=this.cy.extent(),o=this.cy.viewport();console.log("[HUD-BLANK-SCREEN-DEBUG] Viewport extent:",t),console.log("[HUD-BLANK-SCREEN-DEBUG] Current viewport:",o),e.forEach((e,t)=>{const o=e.position(),n=e.data(),s=e.boundingBox();console.log(`[HUD-BLANK-SCREEN-DEBUG] Node ${t+1}:`,{id:n.id,label:n.label,position:o,boundingBox:s,isVisible:e.visible(),opacity:e.style("opacity"),width:e.style("width"),height:e.style("height")})})}debugAddContainerBackground(){this.container&&(this.container.style.backgroundColor="#ff000020",this.container.style.border="2px solid #ff0000",this.container.style.minHeight="400px",console.log("[HUD-BLANK-SCREEN-DEBUG] Added red background and border to container for visibility test"))}debugManualRenderingTriggers(){if(this.cy){console.log("[HUD-BLANK-SCREEN-DEBUG] 5. Triggering manual rendering operations...");try{console.log("[HUD-BLANK-SCREEN-DEBUG] - Forcing resize..."),this.cy.resize(),console.log("[HUD-BLANK-SCREEN-DEBUG] - Forcing redraw..."),this.cy.forceRender(),this.cy.nodes().length>0&&(console.log("[HUD-BLANK-SCREEN-DEBUG] - Running layout..."),this.cy.layout(this.layoutConfig).run()),console.log("[HUD-BLANK-SCREEN-DEBUG] - Updating viewport..."),this.cy.viewport({zoom:this.cy.zoom(),pan:this.cy.pan()}),console.log("[HUD-BLANK-SCREEN-DEBUG] Manual rendering triggers completed")}catch(e){console.error("[HUD-BLANK-SCREEN-DEBUG] Error during manual rendering:",e)}}else console.log("[HUD-BLANK-SCREEN-DEBUG] 5. No Cytoscape instance for manual rendering")}debugAddTestNodes(){if(this.cy){console.log("[HUD-BLANK-SCREEN-DEBUG] Adding test nodes...");try{this.cy.elements().remove();const e=[{group:"nodes",data:{id:"test-node-1",label:"🤖 Test Node 1",color:"#48bb78",borderColor:"#38a169",shape:"rectangle",width:120,height:40},classes:"pm-node"},{group:"nodes",data:{id:"test-node-2",label:"🔧 Test Node 2",color:"#4299e1",borderColor:"#3182ce",shape:"diamond",width:80,height:50},classes:"tool-node"},{group:"nodes",data:{id:"test-node-3",label:"📝 Test Node 3",color:"#e53e3e",borderColor:"#c53030",shape:"triangle",width:70,height:40},classes:"todo-node"}],t=[{group:"edges",data:{id:"test-edge-1",source:"test-node-1",target:"test-node-2"}},{group:"edges",data:{id:"test-edge-2",source:"test-node-2",target:"test-node-3"}}];this.cy.add(e),this.cy.add(t),console.log("[HUD-BLANK-SCREEN-DEBUG] Added 3 test nodes and 2 test edges"),e.forEach(e=>{this.nodes.set(e.data.id,e.data)}),this.runLayout()}catch(e){console.error("[HUD-BLANK-SCREEN-DEBUG] Error adding test nodes:",e)}}}debugForceZoomFit(){if(!this.cy)return;console.log("[HUD-BLANK-SCREEN-DEBUG] 7. Forcing zoom fit...");const e=e=>{try{console.log(`[HUD-BLANK-SCREEN-DEBUG] Zoom fit attempt ${e}...`);const t=this.cy.zoom(),o=this.cy.pan(),n=this.cy.elements();if(console.log("[HUD-BLANK-SCREEN-DEBUG] Before fit:",{zoom:t,pan:o,elementCount:n.length}),n.length>0){this.cy.fit(n,50);const e=this.cy.zoom(),s=this.cy.pan();console.log("[HUD-BLANK-SCREEN-DEBUG] After fit:",{zoom:e,pan:s,changed:t!==e||o.x!==s.x||o.y!==s.y}),this.cy.center(n)}else console.log("[HUD-BLANK-SCREEN-DEBUG] No elements to fit")}catch(t){console.error(`[HUD-BLANK-SCREEN-DEBUG] Zoom fit attempt ${e} failed:`,t)}};e(1),setTimeout(()=>e(2),100),setTimeout(()=>e(3),500),setTimeout(()=>e(4),1e3)}debugDrawSimpleShape(){if(!this.cy)return console.log("[HUD-CANVAS-TEST] No Cytoscape instance"),!1;console.log("[HUD-CANVAS-TEST] Testing Cytoscape canvas rendering...");try{return this.cy.elements().remove(),this.cy.add({group:"nodes",data:{id:"canvas-test",label:"✅ CANVAS TEST",color:"#ff0000",borderColor:"#000000",width:200,height:100,shape:"rectangle"},position:{x:200,y:200}}),this.cy.forceRender(),this.cy.fit(this.cy.$("#canvas-test"),50),console.log("[HUD-CANVAS-TEST] Canvas test node added and positioned"),console.log('[HUD-CANVAS-TEST] If you see a red rectangle with "CANVAS TEST", rendering works!'),!0}catch(e){return console.error("[HUD-CANVAS-TEST] Canvas test failed:",e),!1}}darkenColor(e,t){const o=parseInt(e.replace("#",""),16),n=Math.round(2.55*t),s=(o>>16)-n,i=(o>>8&255)-n,r=(255&o)-n;return"#"+(16777216+65536*(s<255?s<1?0:s:255)+256*(i<255?i<1?0:i:255)+(r<255?r<1?0:r:255)).toString(16).slice(1)}};
|
|
2
|
-
//# sourceMappingURL=hud-manager.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{U as t}from"./unified-data-viewer.js";window.ModuleViewer=class{constructor(e){this.container=document.getElementById(e),this.dataContainer=null,this.jsonContainer=null,this.currentEvent=null,this.eventsByClass=new Map,this.globalJsonExpanded="true"===localStorage.getItem("dashboard-json-expanded"),this.fullEventDataExpanded="true"===localStorage.getItem("dashboard-full-event-expanded"),this.keyboardListenerAdded=!1,this.unifiedViewer=new t("module-data-content"),this.unifiedViewer.globalJsonExpanded=this.globalJsonExpanded,this.unifiedViewer.fullEventDataExpanded=this.fullEventDataExpanded,document.addEventListener("jsonToggleChanged",t=>{this.globalJsonExpanded=t.detail.expanded,this.unifiedViewer.globalJsonExpanded!==t.detail.expanded&&(this.unifiedViewer.globalJsonExpanded=t.detail.expanded)}),document.addEventListener("fullEventToggleChanged",t=>{this.fullEventDataExpanded=t.detail.expanded,this.unifiedViewer.fullEventDataExpanded!==t.detail.expanded&&(this.unifiedViewer.fullEventDataExpanded=t.detail.expanded)}),this.init()}init(){this.setupContainers(),this.setupEventHandlers(),this.showEmptyState()}setupContainers(){this.dataContainer=document.getElementById("module-data-content"),this.jsonContainer=null,this.dataContainer||console.error("Module viewer data container not found")}setupEventHandlers(){document.addEventListener("eventSelected",t=>{this.showEventDetails(t.detail.event)}),document.addEventListener("eventSelectionCleared",()=>{this.showEmptyState()}),document.addEventListener("socketEventUpdate",t=>{this.updateEventsByClass(t.detail.events)})}showEmptyState(){this.dataContainer&&(this.dataContainer.innerHTML='\n <div class="module-empty">\n <p>Click on an event to view structured data</p>\n <p class="module-hint">Data is organized by event type</p>\n </div>\n '),this.currentEvent=null}showEventDetails(t){if(this.currentEvent=t,!this.unifiedViewer)return console.warn("ModuleViewer: UnifiedDataViewer not available"),this.renderStructuredData(t),void this.renderJsonData(t);this.unifiedViewer.display(t,"event")}renderStructuredData(t){if(!this.dataContainer)return;const e=this.createContextualHeader(t),n=this.createEventStructuredView(t),s=this.createCollapsibleJsonSection(t);this.dataContainer.innerHTML=e+n+s,this.initializeJsonToggle()}renderJsonData(t){}ingest(t){Array.isArray(t)?t.length>0?this.showEventDetails(t[0]):this.showEmptyState():t&&"object"==typeof t?this.showEventDetails(t):this.showEmptyState()}updateEventsByClass(t){this.eventsByClass.clear(),t.forEach(t=>{const e=this.getEventClass(t);this.eventsByClass.has(e)||this.eventsByClass.set(e,[]),this.eventsByClass.get(e).push(t)})}getEventClass(t){if(!t.type)return"unknown";switch(t.type){case"session":return"Session Management";case"claude":return"Claude Interactions";case"agent":return"Agent Operations";case"hook":return"Hook System";case"todo":return"Task Management";case"memory":return"Memory Operations";case"log":return"System Logs";case"connection":return"Connection Events";default:return"Other Events"}}createContextualHeader(t){const e=this.formatTimestamp(t.timestamp),n=t.data||{};let s="";switch(t.type){case"hook":const o=this.extractToolName(n),a=this.extractAgent(t)||"Unknown";if(o)s=`${o}: ${a} ${e}`;else{s=`${this.getHookDisplayName(t,n)}: ${a} ${e}`}break;case"agent":s=`Agent: ${n.agent_type||n.name||"Unknown"} ${e}`;break;case"todo":s=`TodoWrite: ${this.extractAgent(t)||"PM"} ${e}`;break;case"memory":s=`Memory: ${n.operation||"Unknown"} ${e}`;break;case"session":case"claude":case"log":case"connection":s=`Event: ${t.type}.${t.subtype||"default"} ${e}`;break;default:const i=this.extractFileName(n);if(i)s=`File: ${i} ${e}`;else{s=`Event: ${t.type||"Unknown"}.${t.subtype||"default"} ${e}`}}return`\n <div class="contextual-header">\n <h3 class="contextual-header-text">${s}</h3>\n </div>\n `}createEventStructuredView(t){const e=this.getEventClass(t),n=(this.eventsByClass.get(e)||[]).length;let s=`\n <div class="structured-view-section">\n ${this.createEventDetailCard(t.type,t,n)}\n </div>\n `;switch(t.type){case"agent":s+=this.createAgentStructuredView(t);break;case"hook":"Task"===t.data?.tool_name&&t.data?.tool_parameters?.subagent_type?s+=this.createAgentStructuredView(t):s+=this.createHookStructuredView(t);break;case"todo":s+=this.createTodoStructuredView(t);break;case"memory":s+=this.createMemoryStructuredView(t);break;case"claude":s+=this.createClaudeStructuredView(t);break;case"session":s+=this.createSessionStructuredView(t);break;default:s+=this.createGenericStructuredView(t)}return s}createEventDetailCard(t,e,n){const s=new Date(e.timestamp).toLocaleString();return`\n <div class="event-detail-card">\n <div class="event-detail-header">\n <div class="event-detail-title">\n ${this.getEventIcon(t)} ${t||"Unknown"}.${e.subtype||"default"}\n </div>\n <div class="event-detail-time">${s}</div>\n </div>\n <div class="event-detail-content">\n ${this.createProperty("Event ID",e.id||"N/A")}\n ${this.createProperty("Type",`${t}.${e.subtype||"default"}`)}\n ${this.createProperty("Class Events",n)}\n ${e.data&&e.data.session_id?this.createProperty("Session",e.data.session_id):""}\n </div>\n </div>\n `}createAgentStructuredView(t){const e=t.data||{};if("hook"===t.type&&"Task"===e.tool_name&&e.tool_parameters?.subagent_type){const n=e.tool_parameters;return`\n <div class="structured-view-section">\n <div class="structured-data">\n ${this.createProperty("Agent Type",n.subagent_type)}\n ${this.createProperty("Task Type","Subagent Delegation")}\n ${this.createProperty("Phase",t.subtype||"pre_tool")}\n ${n.description?this.createProperty("Description",n.description):""}\n ${n.prompt?this.createProperty("Prompt Preview",this.truncateText(n.prompt,200)):""}\n ${e.session_id?this.createProperty("Session ID",e.session_id):""}\n ${e.working_directory?this.createProperty("Working Directory",e.working_directory):""}\n </div>\n ${n.prompt?`\n <div class="prompt-section">\n <div class="contextual-header">\n <h3 class="contextual-header-text">📝 Task Prompt</h3>\n </div>\n <div class="structured-data">\n <div class="task-prompt" style="white-space: pre-wrap; max-height: 300px; overflow-y: auto; padding: 10px; background: #f8fafc; border-radius: 6px; font-family: monospace; font-size: 12px; line-height: 1.4;">\n ${n.prompt}\n </div>\n </div>\n </div>\n `:""}\n </div>\n `}return`\n <div class="structured-view-section">\n <div class="structured-data">\n ${this.createProperty("Agent Type",e.agent_type||e.subagent_type||"Unknown")}\n ${this.createProperty("Name",e.name||"N/A")}\n ${this.createProperty("Phase",t.subtype||"N/A")}\n ${e.config?this.createProperty("Config","object"==typeof e.config?Object.keys(e.config).join(", "):String(e.config)):""}\n ${e.capabilities?this.createProperty("Capabilities",e.capabilities.join(", ")):""}\n ${e.result?this.createProperty("Result","object"==typeof e.result?"[Object]":String(e.result)):""}\n </div>\n </div>\n `}createHookStructuredView(t){const e=t.data||{},n=this.extractFilePathFromHook(e),s=this.extractToolInfoFromHook(e),o=this.createInlineToolResultContent(e,t);return`\n <div class="structured-view-section">\n <div class="structured-data">\n ${this.createProperty("Hook Name",this.getHookDisplayName(t,e))}\n ${this.createProperty("Event Type",e.event_type||t.subtype||"N/A")}\n ${n?this.createProperty("File Path",n):""}\n ${s.tool_name?this.createProperty("Tool",s.tool_name):""}\n ${s.operation_type?this.createProperty("Operation",s.operation_type):""}\n ${e.session_id?this.createProperty("Session ID",e.session_id):""}\n ${e.working_directory?this.createProperty("Working Directory",e.working_directory):""}\n ${e.duration_ms?this.createProperty("Duration",`${e.duration_ms}ms`):""}\n ${o}\n </div>\n </div>\n `}createInlineToolResultContent(t,e=null){const n=t.result_summary,s=e?.subtype||t.event_type||t.phase,o="post_tool"===s||s?.includes("post");if(window.DEBUG_TOOL_RESULTS&&console.log("🔧 createInlineToolResultContent debug:",{hasResultSummary:!!n,eventPhase:s,isPostTool:o,eventSubtype:e?.subtype,dataEventType:t.event_type,dataPhase:t.phase,toolName:t.tool_name,resultSummaryKeys:n?Object.keys(n):[]}),!n)return"";if("pre_tool"===s||s?.includes("pre")&&!s?.includes("post"))return"";let a="";if(n.has_output&&n.output_preview&&(a+=`\n ${this.createProperty("Output",this.truncateText(n.output_preview,200))}\n ${n.output_lines?this.createProperty("Output Lines",n.output_lines):""}\n `),n.has_error&&n.error_preview&&(a+=`\n ${this.createProperty("Error",this.truncateText(n.error_preview,200))}\n `),!n.has_output&&!n.has_error&&Object.keys(n).length>3){a+=Object.entries(n).filter(([t,e])=>!["has_output","has_error","exit_code"].includes(t)&&void 0!==e).map(([t,e])=>this.createProperty(this.formatFieldName(t),String(e))).join("")}return a}createToolResultSection(t,e=null){const n=t.result_summary,s=e?.subtype||t.event_type||t.phase,o="post_tool"===s||s?.includes("post");if(window.DEBUG_TOOL_RESULTS&&console.log("🔧 createToolResultSection debug:",{hasResultSummary:!!n,eventPhase:s,isPostTool:o,eventSubtype:e?.subtype,dataEventType:t.event_type,dataPhase:t.phase,toolName:t.tool_name,resultSummaryKeys:n?Object.keys(n):[]}),!n)return"";if("pre_tool"===s||s?.includes("pre")&&!s?.includes("post"))return"";let a="⏳",i="tool-running",r="Unknown";!0===t.success?(a="✅",i="tool-success",r="Success"):!1===t.success?(a="❌",i="tool-failure",r="Failed"):0===t.exit_code?(a="✅",i="tool-success",r="Completed"):2===t.exit_code?(a="⚠️",i="tool-blocked",r="Blocked"):void 0!==t.exit_code&&0!==t.exit_code&&(a="❌",i="tool-failure",r="Error");let l="";if(l+=`\n <div class="tool-result-status ${i}">\n <span class="tool-result-icon">${a}</span>\n <span class="tool-result-text">${r}</span>\n ${void 0!==t.exit_code?`<span class="tool-exit-code">Exit Code: ${t.exit_code}</span>`:""}\n </div>\n `,n.has_output&&n.output_preview&&(l+=`\n <div class="tool-result-output">\n <div class="tool-result-label">📄 Output:</div>\n <div class="tool-result-preview">\n <pre>${this.escapeHtml(n.output_preview)}</pre>\n </div>\n ${n.output_lines?`<div class="tool-result-meta">Lines: ${n.output_lines}</div>`:""}\n </div>\n `),n.has_error&&n.error_preview&&(l+=`\n <div class="tool-result-error">\n <div class="tool-result-label">⚠️ Error:</div>\n <div class="tool-result-preview error-preview">\n <pre>${this.escapeHtml(n.error_preview)}</pre>\n </div>\n </div>\n `),!n.has_output&&!n.has_error&&Object.keys(n).length>3){const t=Object.entries(n).filter(([t,e])=>!["has_output","has_error","exit_code"].includes(t)&&void 0!==e).map(([t,e])=>this.createProperty(this.formatFieldName(t),String(e))).join("");t&&(l+=`\n <div class="tool-result-other">\n <div class="tool-result-label">📊 Result Details:</div>\n <div class="structured-data">\n ${t}\n </div>\n </div>\n `)}return l.trim()?`\n <div class="tool-result-section">\n <div class="contextual-header">\n <h3 class="contextual-header-text">🔧 Tool Result</h3>\n </div>\n <div class="tool-result-content">\n ${l}\n </div>\n </div>\n `:""}isWriteOperation(t,e){if(["Write","Edit","MultiEdit","NotebookEdit"].includes(t))return!0;if(e.tool_parameters){const t=e.tool_parameters;if(t.content||t.new_string||t.edits)return!0;if(t.edit_mode&&"read"!==t.edit_mode)return!0}return!("post_tool"!==e.event_type&&"pre_tool"!==e.event_type||!t||!(t.toLowerCase().includes("write")||t.toLowerCase().includes("edit")||t.toLowerCase().includes("modify")))}isReadOnlyOperation(t){if(!t)return!0;const e=t.toLowerCase();return!!["read"].includes(e)||!["write","edit","multiedit","create","delete","move","copy"].includes(e)}createTodoStructuredView(t){const e=t.data||{};let n="";return e.todos&&Array.isArray(e.todos)&&(n+=`\n <div class="todo-checklist">\n ${e.todos.map(t=>`\n <div class="todo-item todo-${t.status||"pending"}">\n <span class="todo-status">${this.getTodoStatusIcon(t.status)}</span>\n <span class="todo-content">${t.content||"No content"}</span>\n <span class="todo-priority priority-${t.priority||"medium"}">${this.getTodoPriorityIcon(t.priority)}</span>\n </div>\n `).join("")}\n </div>\n `),n}createMemoryStructuredView(t){const e=t.data||{};return`\n <div class="structured-view-section">\n <div class="structured-data">\n ${this.createProperty("Operation",e.operation||"Unknown")}\n ${this.createProperty("Key",e.key||"N/A")}\n ${e.value?this.createProperty("Value","object"==typeof e.value?"[Object]":String(e.value)):""}\n ${e.namespace?this.createProperty("Namespace",e.namespace):""}\n ${e.metadata?this.createProperty("Metadata","object"==typeof e.metadata?"[Object]":String(e.metadata)):""}\n </div>\n </div>\n `}createClaudeStructuredView(t){const e=t.data||{};return`\n <div class="structured-view-section">\n <div class="structured-data">\n ${this.createProperty("Type",t.subtype||"N/A")}\n ${e.prompt?this.createProperty("Prompt",this.truncateText(e.prompt,200)):""}\n ${e.message?this.createProperty("Message",this.truncateText(e.message,200)):""}\n ${e.response?this.createProperty("Response",this.truncateText(e.response,200)):""}\n ${e.content?this.createProperty("Content",this.truncateText(e.content,200)):""}\n ${e.tokens?this.createProperty("Tokens",e.tokens):""}\n ${e.model?this.createProperty("Model",e.model):""}\n </div>\n </div>\n `}createSessionStructuredView(t){const e=t.data||{};return`\n <div class="structured-view-section">\n <div class="structured-data">\n ${this.createProperty("Action",t.subtype||"N/A")}\n ${this.createProperty("Session ID",e.session_id||"N/A")}\n ${e.working_directory?this.createProperty("Working Dir",e.working_directory):""}\n ${e.git_branch?this.createProperty("Git Branch",e.git_branch):""}\n ${e.agent_type?this.createProperty("Agent Type",e.agent_type):""}\n </div>\n </div>\n `}createGenericStructuredView(t){const e=t.data||{},n=Object.keys(e);return 0===n.length?"":`\n <div class="structured-view-section">\n <div class="structured-data">\n ${n.map(t=>this.createProperty(t,"object"==typeof e[t]?"[Object]":String(e[t]))).join("")}\n </div>\n </div>\n `}createCollapsibleJsonSection(t){const e="json-section-"+Math.random().toString(36).substr(2,9),n=this.formatJSON(t),s=this.globalJsonExpanded;return`\n <div class="collapsible-json-section" id="${e}">\n <div class="json-toggle-header"\n onclick="window.moduleViewer.toggleJsonSection()"\n role="button"\n tabindex="0"\n aria-expanded="${s?"true":"false"}"\n onkeydown="if(event.key==='Enter'||event.key===' '){window.moduleViewer.toggleJsonSection();event.preventDefault();}">\n <span class="json-toggle-text">Raw JSON</span>\n <span class="json-toggle-arrow">${s?"▲":"▼"}</span>\n </div>\n <div class="json-content-collapsible" style="display: ${s?"block":"none"};" aria-hidden="${!s}">\n <div class="json-display" onclick="window.moduleViewer.copyJsonToClipboard(event)">\n <pre>${n}</pre>\n </div>\n </div>\n </div>\n `}async copyJsonToClipboard(t){const e=t.currentTarget.getBoundingClientRect(),n=t.clientX-e.left,s=t.clientY-e.top;if(n>e.width-50&&s<30){const e=t.currentTarget.querySelector("pre");if(e)try{await navigator.clipboard.writeText(e.textContent),this.showNotification("JSON copied to clipboard","success")}catch(o){console.error("Failed to copy JSON:",o),this.showNotification("Failed to copy JSON","error")}t.stopPropagation()}}initializeJsonToggle(){window.moduleViewer=this,this.globalJsonExpanded&&setTimeout(()=>{this.updateAllJsonSections()},0),this.keyboardListenerAdded||(this.keyboardListenerAdded=!0,document.addEventListener("keydown",t=>{t.target.classList.contains("json-toggle-header")&&("Enter"!==t.key&&" "!==t.key||(this.toggleJsonSection(),t.preventDefault()))}))}toggleJsonSection(){this.globalJsonExpanded=!this.globalJsonExpanded,localStorage.setItem("dashboard-json-expanded",this.globalJsonExpanded.toString()),this.updateAllJsonSections(),document.dispatchEvent(new CustomEvent("jsonToggleChanged",{detail:{expanded:this.globalJsonExpanded}}))}updateAllJsonSections(){const t=document.querySelectorAll(".json-content-collapsible"),e=document.querySelectorAll(".json-toggle-arrow"),n=document.querySelectorAll(".json-toggle-header");t.forEach((t,s)=>{this.globalJsonExpanded?(t.style.display="block",t.setAttribute("aria-hidden","false"),e[s]&&(e[s].textContent="▲"),n[s]&&n[s].setAttribute("aria-expanded","true")):(t.style.display="none",t.setAttribute("aria-hidden","true"),e[s]&&(e[s].textContent="▼"),n[s]&&n[s].setAttribute("aria-expanded","false"))}),this.globalJsonExpanded&&t.length>0&&setTimeout(()=>{const e=t[0];e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})},100)}createProperty(t,e){const n=this.truncateText(String(e),300);return this.isFilePathProperty(t,e)?`\n <div class="event-property">\n <span class="event-property-key">${t}:</span>\n <span class="event-property-value">\n ${this.createClickableFilePath(e)}\n </span>\n </div>\n `:`\n <div class="event-property">\n <span class="event-property-key">${t}:</span>\n <span class="event-property-value">${n}</span>\n </div>\n `}isFilePathProperty(t,e){if(["File Path","file_path","notebook_path","Full Path","Working Directory","working_directory"].some(e=>t.toLowerCase().includes(e.toLowerCase()))){const t=String(e);return t.length>0&&(t.includes("/")||t.includes("\\"))&&t.length<500}return!1}createClickableFilePath(t){const e=this.truncateText(String(t),300);return`\n <span class="clickable-file-path"\n onclick="showFileViewerModal('${t.replace(/'/g,"\\'")}')"\n title="Click to view file contents with syntax highlighting Path: ${t}">\n ${e}\n </span>\n `}getEventIcon(t){const e={session:"📱",claude:"🤖",agent:"🎯",hook:"🔗",todo:"✅",memory:"🧠",log:"📝",connection:"🔌",unknown:"❓"};return e[t]||e.unknown}getTodoStatusIcon(t){const e={completed:"✅",in_progress:"🔄",pending:"⏳",cancelled:"❌"};return e[t]||e.pending}getTodoPriorityIcon(t){const e={high:"🔴",medium:"🟡",low:"🟢"};return e[t]||e.medium}getHookDisplayName(t,e){if(e.hook_name)return e.hook_name;if(e.name)return e.name;const n=t.subtype||e.event_type,s={user_prompt:"User Prompt",pre_tool:"Tool Execution (Pre)",post_tool:"Tool Execution (Post)",notification:"Notification",stop:"Session Stop",subagent_stop:"Subagent Stop"};if(s[n])return s[n];if("string"==typeof t.type&&t.type.startsWith("hook.")){const e=t.type.replace("hook.","");if(s[e])return s[e]}return n?n.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):"Unknown Hook"}extractFilePathFromHook(t){return t.tool_parameters&&t.tool_parameters.file_path?t.tool_parameters.file_path:t.file_path?t.file_path:t.tool_input&&t.tool_input.file_path?t.tool_input.file_path:t.tool_parameters&&t.tool_parameters.notebook_path?t.tool_parameters.notebook_path:null}extractToolInfoFromHook(t){return{tool_name:t.tool_name||t.tool_parameters&&t.tool_parameters.tool_name,operation_type:t.operation_type||t.tool_parameters&&t.tool_parameters.operation_type}}truncateText(t,e){return!t||t.length<=e?t:t.substring(0,e)+"..."}formatOperationDetails(t){if(!t||"object"!=typeof t)return"";let e="";if(t.parameters&&t.parameters.command&&(e+=`<br><strong>Command:</strong> <code>${this.escapeHtml(t.parameters.command)}</code>`),void 0!==t.success&&(e+="<br><strong>Status:</strong> "+(t.success?"✅ Success":"❌ Failed")),void 0!==t.exit_code&&null!==t.exit_code&&(e+=`<br><strong>Exit Code:</strong> ${t.exit_code}`),void 0!==t.duration_ms&&null!==t.duration_ms){e+=`<br><strong>Duration:</strong> ${t.duration_ms>1e3?`${(t.duration_ms/1e3).toFixed(2)}s`:`${t.duration_ms}ms`}`}return t.error&&(e+=`<br><strong>Error:</strong> ${this.escapeHtml(this.truncateText(t.error,200))}`),e}escapeHtml(t){if(!t)return"";const e=document.createElement("div");return e.textContent=t,e.innerHTML}formatJSON(t){try{return JSON.stringify(t,null,2)}catch(e){return String(t)}}formatTimestamp(t){if(!t)return"Unknown time";try{return new Date(t).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})}catch(e){return"Invalid time"}}escapeHtml(t){if(!t)return"";const e=document.createElement("div");return e.textContent=t,e.innerHTML}formatFieldName(t){return t.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}extractToolName(t){if(t.tool_name)return t.tool_name;if(t.tool_parameters&&t.tool_parameters.tool_name)return t.tool_parameters.tool_name;if(t.tool_input&&t.tool_input.tool_name)return t.tool_input.tool_name;if(t.tool_parameters){if(t.tool_parameters.file_path||t.tool_parameters.notebook_path)return"FileOperation";if(t.tool_parameters.pattern)return"Search";if(t.tool_parameters.command)return"Bash";if(t.tool_parameters.todos)return"TodoWrite"}return null}extractAgent(t){if(t._agentName&&"Unknown Agent"!==t._agentName)return t._agentName;if(t._inference&&t._inference.agentName&&"Unknown"!==t._inference.agentName)return t._inference.agentName;if(t.agent)return t.agent;if(t.agent_type)return t.agent_type;if(t.agent_name)return t.agent_name;if(t.session_id&&"string"==typeof t.session_id){const e=t.session_id.split("_");if(e.length>1)return e[0].toUpperCase()}return t.todos||"TodoWrite"===t.tool_name?"PM":null}extractFileName(t){const e=this.extractFilePathFromHook(t);if(e){const t=e.split("/");return t[t.length-1]}return t.filename?t.filename:t.file?t.file:null}clear(){this.unifiedViewer&&this.unifiedViewer.clear(),this.showEmptyState()}showToolCall(t,e){if(!t)return void this.showEmptyState();const n=t.tool_name||"Unknown Tool",s=t.agent_type||"PM",o=this.formatTimestamp(t.timestamp),a=t.pre_event,i=t.post_event,r=a?.tool_parameters||{},l=a?this.extractToolTarget(n,r):"Unknown target",c=t.duration_ms?`${t.duration_ms}ms`:"-",d=void 0!==t.success?t.success:null;void 0!==t.exit_code&&t.exit_code;let p=t.result_summary||"No summary available";if("object"==typeof p&&null!==p){const t=[];void 0!==p.exit_code&&t.push(`Exit Code: ${p.exit_code}`),void 0!==p.has_output&&t.push("Has Output: "+(p.has_output?"Yes":"No")),void 0!==p.has_error&&t.push("Has Error: "+(p.has_error?"Yes":"No")),void 0!==p.output_lines&&t.push(`Output Lines: ${p.output_lines}`),p.output_preview&&t.push(`Output Preview: ${p.output_preview}`),p.error_preview&&t.push(`Error Preview: ${p.error_preview}`)}let u="⏳",m="Running...",h="tool-running";i&&(!0===d?(u="✅",m="Success",h="tool-success"):!1===d?(u="❌",m="Failed",h="tool-failure"):(u="⏳",m="Completed",h="tool-completed"));const g=`\n <div class="contextual-header">\n <h3 class="contextual-header-text">${n}: ${s} ${o}</h3>\n </div>\n `;if("TodoWrite"===n&&r.todos){const e=`\n <div class="todo-checklist">\n ${r.todos.map(t=>{const e=this.getTodoStatusIcon(t.status),n=this.getTodoPriorityIcon(t.priority);return`\n <div class="todo-item todo-${t.status||"pending"}">\n <span class="todo-status">${e}</span>\n <span class="todo-content">${t.content||"No content"}</span>\n <span class="todo-priority priority-${t.priority||"medium"}">${n}</span>\n </div>\n `}).join("")}\n </div>\n `,n={toolCall:t,preEvent:a,postEvent:i},s=this.createCollapsibleJsonSection(n);this.dataContainer&&(this.dataContainer.innerHTML=g+e+s),this.initializeJsonToggle()}else if("Grep"===n||"Search"===n||r&&r.pattern&&!r.file_path){const e=r.pattern||"No pattern specified",o=r.path||r.directory||".",l=r.type||r.glob||"all files";let d="";t.result_summary&&(d="string"==typeof t.result_summary?t.result_summary:t.result_summary.output_preview?t.result_summary.output_preview:JSON.stringify(t.result_summary,null,2));const p=`\n <div class="structured-view-section">\n <div class="tool-call-details">\n <div class="tool-call-info ${h}">\n <div class="structured-field">\n <strong>Tool Name:</strong> ${n}\n </div>\n <div class="structured-field">\n <strong>Agent:</strong> ${s}\n </div>\n <div class="structured-field">\n <strong>Status:</strong> ${u} ${m}\n </div>\n <div class="structured-field">\n <strong>Search Pattern:</strong> <code>${e}</code>\n </div>\n <div class="structured-field">\n <strong>Search Path:</strong> ${o}\n </div>\n <div class="structured-field">\n <strong>File Type:</strong> ${l}\n </div>\n <div class="structured-field">\n <strong>Started:</strong> ${new Date(t.timestamp).toLocaleString()}\n </div>\n ${c&&"-"!==c?`\n <div class="structured-field">\n <strong>Duration:</strong> ${c}\n </div>\n `:""}\n </div>\n\n <div class="search-view-action" style="margin-top: 20px;">\n <button class="btn-view-search" data-search-params='${JSON.stringify(r)}' data-search-results='${JSON.stringify(d).replace(/'/g,"'")}' onclick="window.showSearchViewerModal(JSON.parse(this.getAttribute('data-search-params')), JSON.parse(this.getAttribute('data-search-results')))">\n 🔍 View Search Details\n </button>\n </div>\n\n ${this.createToolResultFromToolCall(t)}\n </div>\n </div>\n `,v={toolCall:t,preEvent:a,postEvent:i},y=this.createCollapsibleJsonSection(v);this.dataContainer&&(this.dataContainer.innerHTML=g+p+y),this.initializeJsonToggle()}else{const e=`\n <div class="structured-view-section">\n <div class="tool-call-details">\n <div class="tool-call-info ${h}">\n <div class="structured-field">\n <strong>Tool Name:</strong> ${n}\n </div>\n <div class="structured-field">\n <strong>Agent:</strong> ${s}\n </div>\n <div class="structured-field">\n <strong>Status:</strong> ${u} ${m}\n </div>\n <div class="structured-field">\n <strong>Target:</strong> ${l}\n </div>\n <div class="structured-field">\n <strong>Started:</strong> ${new Date(t.timestamp).toLocaleString()}\n </div>\n ${c&&"-"!==c?`\n <div class="structured-field">\n <strong>Duration:</strong> ${c}\n </div>\n `:""}\n ${t.session_id?`\n <div class="structured-field">\n <strong>Session ID:</strong> ${t.session_id}\n </div>\n `:""}\n </div>\n\n ${this.createToolResultFromToolCall(t)}\n </div>\n </div>\n `,o={toolCall:t,preEvent:a,postEvent:i},r=this.createCollapsibleJsonSection(o);this.dataContainer&&(this.dataContainer.innerHTML=g+e+r),this.initializeJsonToggle()}}showFileOperations(e,n){if(!e||!n)return void this.showEmptyState();this.unifiedViewer||(this.unifiedViewer=new t("module-data-content"));const s={file_path:n,operations:e.operations||[],lastOperation:e.lastOperation,...e};this.unifiedViewer.display(s,"file_operation");const o=document.querySelector(".module-data-header h5");if(o){const t=n.split("/").pop()||n;o.textContent=`📄 File: ${t}`}this.checkAndShowTrackControl(n)}showErrorMessage(t,e){const n=`\n <div class="module-error">\n <div class="error-header">\n <h3>❌ ${t}</h3>\n </div>\n <div class="error-message">\n <p>${e}</p>\n </div>\n </div>\n `,s={title:t,message:e},o=this.createCollapsibleJsonSection(s);this.dataContainer&&(this.dataContainer.innerHTML=n+o),this.initializeJsonToggle()}showAgentEvent(t,e){this.showAgentSpecificDetails(t,e)}showAgentSpecificDetails(t,e){if(!t)return void this.showEmptyState();const n=window.dashboard?.agentInference,s=window.dashboard?.eventViewer;if(!n||!s)return console.warn("AgentInference or EventViewer not available, falling back to single event view"),void this.showEventDetails(t);const o=n.getInferredAgentForEvent(t),a=o?.agentName||this.extractAgent(t)||"Unknown",i=s.events||[],r=this.getAgentSpecificEvents(i,a,n);console.log(`Showing details for agent: ${a}, found ${r.length} related events`);const l=this.extractAgentSpecificData(a,r);this.renderAgentSpecificView(a,l,t)}getAgentSpecificEvents(t,e,n){return t.filter(t=>{const s=n.getInferredAgentForEvent(t);return(s?.agentName||this.extractAgent(t)||"Unknown").toLowerCase()===e.toLowerCase()})}extractAgentSpecificData(t,e){const n={agentName:t,totalEvents:e.length,prompt:null,todos:[],toolsCalled:[],sessions:new Set,firstSeen:null,lastSeen:null,eventTypes:new Set};return e.forEach(e=>{const s=e.data||{},o=new Date(e.timestamp);(!n.firstSeen||o<n.firstSeen)&&(n.firstSeen=o),(!n.lastSeen||o>n.lastSeen)&&(n.lastSeen=o),(e.session_id||s.session_id)&&n.sessions.add(e.session_id||s.session_id);const a=e.hook_event_name||e.type||"unknown";if(n.eventTypes.add(a),"hook"===e.type&&"Task"===s.tool_name&&s.tool_parameters){const e=s.tool_parameters;e.prompt&&!n.prompt&&(n.prompt=e.prompt),e.description&&!n.description&&(n.description=e.description),e.subagent_type===t&&e.prompt&&(n.prompt=e.prompt)}if(!s.prompt||s.agent_type!==t&&s.subagent_type!==t||(n.prompt=s.prompt),"todo"===e.type||"hook"===e.type&&"TodoWrite"===s.tool_name){const t=s.todos||s.tool_parameters?.todos;t&&Array.isArray(t)&&t.forEach(t=>{const e=n.todos.findIndex(e=>e.id===t.id||e.content===t.content);e>=0?n.todos[e]={...n.todos[e],...t,timestamp:o}:n.todos.push({...t,timestamp:o})})}if("hook"===e.type&&s.tool_name){const t=e.subtype||s.event_type,a=this.generateToolCallId(s.tool_name,s.tool_parameters,o);"pre_tool"===t?(n._preToolEvents||(n._preToolEvents=new Map),n._preToolEvents.set(a,{toolName:s.tool_name,timestamp:o,target:this.extractToolTarget(s.tool_name,s.tool_parameters,null),parameters:s.tool_parameters})):"post_tool"===t&&(n._postToolEvents||(n._postToolEvents=new Map),n._postToolEvents.set(a,{toolName:s.tool_name,timestamp:o,success:s.success,duration:s.duration_ms,resultSummary:s.result_summary,exitCode:s.exit_code}))}}),n.todos.sort((t,e)=>(e.timestamp||0)-(t.timestamp||0)),n.toolsCalled=this.consolidateToolCalls(n._preToolEvents,n._postToolEvents),delete n._preToolEvents,delete n._postToolEvents,n.toolsCalled.sort((t,e)=>e.timestamp-t.timestamp),n}generateToolCallId(t,e,n){const s=Math.floor(n.getTime()/5e3);let o="";if(e){const t=[];e.file_path&&t.push(e.file_path),e.command&&t.push(e.command.substring(0,50)),e.pattern&&t.push(e.pattern),e.subagent_type&&t.push(e.subagent_type),e.notebook_path&&t.push(e.notebook_path),e.url&&t.push(e.url),e.prompt&&t.push(e.prompt.substring(0,30)),o=t.join("|")}return o||(o="default"),`${t}:${s}:${o}`}consolidateToolCalls(t,e){const n=[],s=new Set;t||(t=new Map),e||(e=new Map);for(const[o,a]of t){if(s.has(o))continue;const t=e.get(o),i={toolName:a.toolName,timestamp:a.timestamp,target:a.target,parameters:a.parameters,status:this.determineToolCallStatus(a,t),statusIcon:this.getToolCallStatusIcon(a,t),phase:t?"completed":"running"};t&&(i.success=t.success,i.duration=t.duration,i.resultSummary=t.resultSummary,i.exitCode=t.exitCode,i.completedAt=t.timestamp),n.push(i),s.add(o)}for(const[o,a]of e){if(s.has(o))continue;const t={toolName:a.toolName,timestamp:a.timestamp,target:"Unknown target",parameters:null,status:this.determineToolCallStatus(null,a),statusIcon:this.getToolCallStatusIcon(null,a),phase:"completed",success:a.success,duration:a.duration,resultSummary:a.resultSummary,exitCode:a.exitCode,completedAt:a.timestamp};n.push(t),s.add(o)}return n}determineToolCallStatus(t,e){return e?!0===e.success?"Success":!1===e.success?"Failed":0===e.exitCode?"Completed":2===e.exitCode?"Blocked":void 0!==e.exitCode&&0!==e.exitCode?"Error":"Completed":"Running..."}getToolCallStatusIcon(t,e){return e?!0===e.success?"✅":!1===e.success?"❌":0===e.exitCode?"✅":2===e.exitCode?"⚠️":void 0!==e.exitCode&&0!==e.exitCode?"❌":"✅":"⏳"}estimateTokenCount(t){if(!t||"string"!=typeof t)return 0;const e=t.trim().split(/\s+/).length,n=Math.ceil(t.length/4);return Math.max(1.3*e,n)}trimPromptWhitespace(t){return t&&"string"==typeof t?t=(t=(t=t.trim()).replace(/\n\s*\n\s*\n+/g,"\n\n")).split("\n").map(t=>t.replace(/\s+$/,"")).join("\n"):""}renderAgentSpecificView(t,e,n){const s=this.formatTimestamp(n.timestamp),o=`\n <div class="contextual-header">\n <h3 class="contextual-header-text">🤖 ${t} Agent Details ${s}</h3>\n </div>\n `;let a=`\n <div class="agent-overview-section">\n <div class="structured-data">\n ${this.createProperty("Agent Name",t)}\n ${this.createProperty("Total Events",e.totalEvents)}\n ${this.createProperty("Active Sessions",e.sessions.size)}\n ${this.createProperty("Event Types",Array.from(e.eventTypes).join(", "))}\n ${e.firstSeen?this.createProperty("First Seen",e.firstSeen.toLocaleString()):""}\n ${e.lastSeen?this.createProperty("Last Seen",e.lastSeen.toLocaleString()):""}\n </div>\n </div>\n `;if(e.prompt){const t=this.trimPromptWhitespace(e.prompt);a+=`\n <div class="agent-prompt-section">\n <div class="contextual-header">\n <h3 class="contextual-header-text">📝 Agent Task Prompt</h3>\n <div class="prompt-stats" style="font-size: 11px; color: #64748b; margin-top: 4px;">\n ~${Math.round(this.estimateTokenCount(t))} tokens • ${t.trim().split(/\s+/).length} words • ${t.length} characters\n </div>\n </div>\n <div class="structured-data">\n <div class="agent-prompt" style="white-space: pre-wrap; max-height: 300px; overflow-y: auto; padding: 10px; background: #f8fafc; border-radius: 6px; font-family: monospace; font-size: 12px; line-height: 1.4; border: 1px solid #e2e8f0;">\n ${this.escapeHtml(t)}\n </div>\n </div>\n </div>\n `}e.todos.length>0&&(a+=`\n <div class="agent-todos-section">\n <div class="contextual-header">\n <h3 class="contextual-header-text">✅ Agent Todo List (${e.todos.length} items)</h3>\n </div>\n <div class="todo-checklist">\n ${e.todos.map(t=>`\n <div class="todo-item todo-${t.status||"pending"}">\n <span class="todo-status">${this.getTodoStatusIcon(t.status)}</span>\n <span class="todo-content">${t.content||"No content"}</span>\n <span class="todo-priority priority-${t.priority||"medium"}">${this.getTodoPriorityIcon(t.priority)}</span>\n ${t.timestamp?`<span class="todo-timestamp">${new Date(t.timestamp).toLocaleTimeString()}</span>`:""}\n </div>\n `).join("")}\n </div>\n </div>\n `),e.toolsCalled.length>0&&(a+=`\n <div class="agent-tools-section">\n <div class="contextual-header">\n <h3 class="contextual-header-text">🔧 Tools Called by Agent (${e.toolsCalled.length} calls)</h3>\n </div>\n <div class="tools-list">\n ${e.toolsCalled.map(e=>{let n="";return"✅"===e.statusIcon?n="status-success":"❌"===e.statusIcon?n="status-failed":"⚠️"===e.statusIcon?n="status-blocked":"⏳"===e.statusIcon&&(n="status-running"),`\n <div class="tool-call-item">\n <div class="tool-call-header">\n <div style="display: flex; align-items: center; gap: 12px; flex: 1;">\n <span class="tool-name">🔧 ${e.toolName}</span>\n <span class="tool-agent">${t}</span>\n <span class="tool-status-indicator ${n}">${e.statusIcon} ${e.status}</span>\n </div>\n <span class="tool-timestamp" style="margin-left: auto;">${e.timestamp.toLocaleTimeString()}</span>\n </div>\n <div class="tool-call-details">\n ${e.target?`<span class="tool-target">Target: ${e.target}</span>`:""}\n ${e.duration?`<span class="tool-duration">Duration: ${e.duration}ms</span>`:""}\n ${e.completedAt&&e.completedAt!==e.timestamp?`<span class="tool-completed">Completed: ${e.completedAt.toLocaleTimeString()}</span>`:""}\n </div>\n </div>\n `}).join("")}\n </div>\n </div>\n `);const i={agentName:t,agentData:e,originalEvent:n},r=this.createCollapsibleJsonSection(i);this.dataContainer&&(this.dataContainer.innerHTML=o+a+r),this.initializeJsonToggle()}createToolResultFromToolCall(t){if(!t.result_summary)return"";const e={event_type:"post_tool",result_summary:t.result_summary,success:t.success,exit_code:t.exit_code},n=this.createInlineToolResultContent(e,{subtype:"post_tool"});return n.trim()?`\n <div class="tool-result-inline">\n <div class="structured-data">\n ${n}\n </div>\n </div>\n `:""}extractToolTarget(t,e,n){const s=e||n||{};switch(t?.toLowerCase()){case"write":case"read":case"edit":case"multiedit":return s.file_path||"Unknown file";case"bash":return s.command?`${s.command.substring(0,50)}${s.command.length>50?"...":""}`:"Unknown command";case"grep":return s.pattern?`Pattern: ${s.pattern}`:"Unknown pattern";case"glob":return s.pattern?`Pattern: ${s.pattern}`:"Unknown glob";case"todowrite":return`${s.todos?.length||0} todos`;case"task":return s.subagent_type||s.agent_type||"Subagent delegation";default:return s.file_path?s.file_path:s.pattern?`Pattern: ${s.pattern}`:s.command?`Command: ${s.command.substring(0,30)}...`:s.path?s.path:"Unknown target"}}getOperationIcon(t){return{read:"👁️",write:"✏️",edit:"📝",multiedit:"📝",create:"🆕",delete:"🗑️",move:"📦",copy:"📋"}[t?.toLowerCase()]||"📄"}getCurrentEvent(){return this.currentEvent}async checkAndShowTrackControl(t){if(t)try{const e=window.socket||window.dashboard?.socketClient?.socket;if(!e)return void console.warn("No socket connection available for git tracking check");let n=window.dashboard?.currentWorkingDir;if(!n||"Unknown"===n||""===n.trim()){const t=document.getElementById("footer-working-dir");n=t?.textContent?.trim()&&"Unknown"!==t.textContent.trim()?t.textContent.trim():".",console.log("[MODULE-VIEWER-DEBUG] Working directory fallback used:",n)}const s=new Promise((n,s)=>{const o=s=>{s.file_path===t&&(e.off("file_tracked_response",o),n(s))};e.on("file_tracked_response",o),setTimeout(()=>{e.off("file_tracked_response",o),s(new Error("Request timeout"))},5e3)});e.emit("check_file_tracked",{file_path:t,working_dir:n});const o=await s;this.displayTrackingStatus(t,o)}catch(e){console.error("Error checking file tracking status:",e),this.displayTrackingStatus(t,{success:!1,error:e.message,file_path:t})}}displayTrackingStatus(t,e){const n=`git-track-status-${t.replace(/[^a-zA-Z0-9]/g,"-")}`,s=document.getElementById(n);s&&(e.success&&!1===e.is_tracked?s.innerHTML=`\n <div class="untracked-file-notice">\n <span class="untracked-icon">⚠️</span>\n <span class="untracked-text">This file is not tracked by git</span>\n <button class="track-file-button"\n onclick="window.moduleViewer.trackFile('${t}')"\n title="Add this file to git tracking">\n <span class="git-icon">📁</span> Track File\n </button>\n </div>\n `:e.success&&!0===e.is_tracked?s.innerHTML='\n <div class="tracked-file-notice">\n <span class="tracked-icon">✅</span>\n <span class="tracked-text">This file is tracked by git</span>\n </div>\n ':e.success||(s.innerHTML=`\n <div class="tracking-error-notice">\n <span class="error-icon">❌</span>\n <span class="error-text">Could not check git status: ${e.error||"Unknown error"}</span>\n </div>\n `))}async trackFile(t){if(t)try{const e=window.socket||window.dashboard?.socketClient?.socket;if(!e)return void console.warn("No socket connection available for git add");let n=window.dashboard?.currentWorkingDir;if(!n||"Unknown"===n||""===n.trim()){const t=document.getElementById("footer-working-dir");n=t?.textContent?.trim()&&"Unknown"!==t.textContent.trim()?t.textContent.trim():".",console.log("[MODULE-VIEWER-DEBUG] Working directory fallback used:",n)}const s=`git-track-status-${t.replace(/[^a-zA-Z0-9]/g,"-")}`,o=document.getElementById(s);o&&(o.innerHTML='\n <div class="tracking-file-notice">\n <span class="loading-icon">⏳</span>\n <span class="loading-text">Adding file to git tracking...</span>\n </div>\n ');const a=new Promise((n,s)=>{const o=s=>{s.file_path===t&&(e.off("git_add_response",o),n(s))};e.on("git_add_response",o),setTimeout(()=>{e.off("git_add_response",o),s(new Error("Request timeout"))},1e4)});e.emit("git_add_file",{file_path:t,working_dir:n}),console.log("📁 Git add request sent:",{filePath:t,workingDir:n});const i=await a;console.log("📦 Git add result:",i),i.success?(o&&(o.innerHTML='\n <div class="tracked-file-notice">\n <span class="tracked-icon">✅</span>\n <span class="tracked-text">File successfully added to git tracking</span>\n </div>\n '),this.showNotification("File tracked successfully","success")):(o&&(o.innerHTML=`\n <div class="tracking-error-notice">\n <span class="error-icon">❌</span>\n <span class="error-text">Failed to track file: ${i.error||"Unknown error"}</span>\n <button class="track-file-button"\n onclick="window.moduleViewer.trackFile('${t}')"\n title="Try again">\n <span class="git-icon">📁</span> Retry\n </button>\n </div>\n `),this.showNotification(`Failed to track file: ${i.error}`,"error"))}catch(e){console.error("❌ Failed to track file:",e);const n=`git-track-status-${t.replace(/[^a-zA-Z0-9]/g,"-")}`,s=document.getElementById(n);s&&(s.innerHTML=`\n <div class="tracking-error-notice">\n <span class="error-icon">❌</span>\n <span class="error-text">Error: ${e.message}</span>\n <button class="track-file-button"\n onclick="window.moduleViewer.trackFile('${t}')"\n title="Try again">\n <span class="git-icon">📁</span> Retry\n </button>\n </div>\n `),this.showNotification(`Error tracking file: ${e.message}`,"error")}}showNotification(t,e="info"){const n=document.createElement("div");n.className=`notification notification-${e}`,n.innerHTML=`\n <span class="notification-icon">${"success"===e?"✅":"error"===e?"❌":"ℹ️"}</span>\n <span class="notification-message">${t}</span>\n `,n.style.cssText=`\n position: fixed;\n top: 20px;\n right: 20px;\n background: ${"success"===e?"#d4edda":"error"===e?"#f8d7da":"#d1ecf1"};\n color: ${"success"===e?"#155724":"error"===e?"#721c24":"#0c5460"};\n border: 1px solid ${"success"===e?"#c3e6cb":"error"===e?"#f5c6cb":"#bee5eb"};\n border-radius: 6px;\n padding: 12px 16px;\n font-size: 14px;\n font-weight: 500;\n z-index: 2000;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n display: flex;\n align-items: center;\n gap: 8px;\n max-width: 400px;\n animation: slideIn 0.3s ease-out;\n `;const s=document.createElement("style");s.textContent="\n @keyframes slideIn {\n from { transform: translateX(100%); opacity: 0; }\n to { transform: translateX(0); opacity: 1; }\n }\n @keyframes slideOut {\n from { transform: translateX(0); opacity: 1; }\n to { transform: translateX(100%); opacity: 0; }\n }\n ",document.head.appendChild(s),document.body.appendChild(n),setTimeout(()=>{n.style.animation="slideOut 0.3s ease-in",setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),s.parentNode&&s.parentNode.removeChild(s)},300)},5e3)}showAgentInstance(t){if(!t)return void this.showEmptyState();const e={type:"pm_delegation",subtype:t.agentName,agent_type:t.agentName,timestamp:t.timestamp,session_id:t.sessionId,metadata:{delegation_type:"explicit",event_count:t.agentEvents.length,pm_call:t.pmCall||null,agent_events:t.agentEvents}};console.log("Showing PM delegation details:",t),this.showAgentSpecificDetails(e,0)}showImpliedAgent(t){if(!t)return void this.showEmptyState();const e={type:"implied_delegation",subtype:t.agentName,agent_type:t.agentName,timestamp:t.timestamp,session_id:t.sessionId,metadata:{delegation_type:"implied",event_count:t.eventCount,pm_call:null,note:"No explicit PM call found - inferred from agent activity"}};console.log("Showing implied agent details:",t),this.showAgentSpecificDetails(e,0)}},window.enableToolResultDebugging=function(){window.DEBUG_TOOL_RESULTS=!0,console.log("🔧 Tool result debugging enabled. Click on tool events to see debug info.")},window.disableToolResultDebugging=function(){window.DEBUG_TOOL_RESULTS=!1,console.log("🔧 Tool result debugging disabled.")};
|
|
2
|
-
//# sourceMappingURL=module-viewer.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
window.refreshSessions=function(){window.sessionManager&&window.sessionManager.refreshSessions()},window.SessionManager=class{constructor(e){this.socketClient=e,this.sessions=new Map,this.currentSessionId=null,this.selectedSessionId="",this.init()}init(){this.setupEventHandlers(),this.setupSocketListeners(),this.updateSessionSelect()}setupEventHandlers(){const e=document.getElementById("session-select");e&&e.addEventListener("change",e=>{this.selectedSessionId=e.target.value,this.onSessionFilterChanged(),window.dashboard&&window.dashboard.loadWorkingDirectoryForSession&&window.dashboard.loadWorkingDirectoryForSession(e.target.value)});const s=document.querySelector('button[onclick="refreshSessions()"]');s&&s.addEventListener("click",()=>{this.refreshSessions()})}setupSocketListeners(){this.socketClient.onEventUpdate((e,s)=>{console.log("[SESSION-MANAGER] Received sessions update:",s),this.sessions=s,this.updateSessionSelect(),this.updateFooterInfo()}),document.addEventListener("socketConnectionStatus",e=>{"connected"===e.detail.type&&setTimeout(()=>this.refreshSessions(),1e3)})}updateSessionSelect(){const e=document.getElementById("session-select");if(!e)return;const s=e.value;let t="/";if(window.dashboard&&window.dashboard.workingDirectoryManager)t=window.dashboard.workingDirectoryManager.getDefaultWorkingDir();else{const e=document.getElementById("working-dir-path");if(e?.textContent?.trim()){const s=e.textContent.trim();"Loading..."!==s&&"Unknown"!==s&&(t=s)}}if(console.log("[SESSION-MANAGER] Using default working directory:",t),e.innerHTML=`\n <option value="">${t} | All Sessions</option>\n `,this.sessions&&this.sessions.size>0){Array.from(this.sessions.values()).sort((e,s)=>new Date(s.lastActivity||s.startTime)-new Date(e.lastActivity||e.startTime)).forEach(s=>{const n=document.createElement("option");n.value=s.id,new Date(s.startTime||s.last_activity).toLocaleString(),s.eventCount||s.event_count;const o=s.id===this.currentSessionId;let i=s.working_directory||s.workingDirectory||"";if(console.log(`[SESSION-DROPDOWN] Session ${s.id.substring(0,8)} working_directory:`,i),!i){i=this.extractSessionInfoFromEvents(s.id).workingDir||t,console.log("[SESSION-DROPDOWN] Extracted working directory from events:",i)}const r=s.id.substring(0,8),a=i||t;n.textContent=`${a} | ${r}...${o?" [ACTIVE]":""}`,e.appendChild(n)})}s&&Array.from(e.options).some(e=>e.value===s)?(e.value=s,this.selectedSessionId=s,this.onSessionFilterChanged()):(this.selectedSessionId=e.value,this.selectedSessionId&&this.onSessionFilterChanged())}onSessionFilterChanged(){const e=window.eventViewer;e&&e.setSessionFilter(this.selectedSessionId),this.updateFooterInfo(),document.dispatchEvent(new CustomEvent("sessionFilterChanged",{detail:{sessionId:this.selectedSessionId}})),document.dispatchEvent(new CustomEvent("sessionChanged",{detail:{sessionId:this.selectedSessionId}}))}refreshSessions(){this.socketClient&&this.socketClient.getConnectionState().isConnected?(console.log("Refreshing sessions..."),this.socketClient.requestStatus()):console.warn("Cannot refresh sessions: not connected to server")}updateFooterInfo(){console.log("[SESSION-DEBUG] updateFooterInfo called, selectedSessionId:",this.selectedSessionId);const e=document.getElementById("footer-session"),s=document.getElementById("footer-working-dir"),t=document.getElementById("footer-git-branch");if(!e)return void console.warn("[SESSION-DEBUG] footer-session element not found");let n="All Sessions",o=window.dashboard?.workingDirectoryManager?.getDefaultWorkingDir()||window.dashboardConfig?.workingDirectory||".",i="Unknown";if(console.log("[SESSION-DEBUG] Initial values - sessionInfo:",n,"workingDir:",o,"gitBranch:",i),"current"===this.selectedSessionId){if(n=this.currentSessionId?`Current: ${this.currentSessionId.substring(0,8)}...`:"Current: None",this.currentSessionId){const e=this.extractSessionInfoFromEvents(this.currentSessionId);o=e.workingDir||window.dashboard?.workingDirectoryManager?.getDefaultWorkingDir()||window.dashboardConfig?.workingDirectory||".",i=e.gitBranch||"Unknown"}}else if(this.selectedSessionId){const e=this.sessions.get(this.selectedSessionId);if(e&&(n=`${this.selectedSessionId.substring(0,8)}...`,o=e.working_directory||e.workingDirectory||"",i=e.git_branch||e.gitBranch||"",!o||!i)){const e=this.extractSessionInfoFromEvents(this.selectedSessionId);o=o||e.workingDir||window.dashboardConfig?.workingDirectory||".",i=i||e.gitBranch||""}}console.log("[SESSION-DEBUG] Final values before setting footer - sessionInfo:",n,"workingDir:",o,"gitBranch:",i),e.textContent=n,s?(console.log("[SESSION-DEBUG] Setting footer working dir to:",o),s.textContent=o):console.warn("[SESSION-DEBUG] footer-working-dir element not found"),t?(console.log("[SESSION-DEBUG] Setting footer git branch to:",i),t.textContent=i):console.warn("[SESSION-DEBUG] footer-git-branch element not found")}extractSessionInfoFromEvents(e){let s="",t="";console.log(`[DEBUG] extractSessionInfoFromEvents called for sessionId: ${e}`);const n=this.socketClient;if(n&&n.events){console.log(`[DEBUG] Total events available: ${n.events.length}`);const o=n.events.filter(s=>s.data&&s.data.session_id===e);console.log(`[DEBUG] Events matching sessionId ${e}: ${o.length}`),o.length>0&&(console.log(`[DEBUG] Sample events for session ${e}:`),o.slice(0,3).forEach((e,s)=>{console.log(`[DEBUG] Event ${s+1}:`,{type:e.type,timestamp:e.timestamp,data_keys:e.data?Object.keys(e.data):"no data",full_event:e})}),o.length>3&&(console.log(`[DEBUG] Last 3 events for session ${e}:`),o.slice(-3).forEach((e,s)=>{console.log(`[DEBUG] Last Event ${s+1}:`,{type:e.type,timestamp:e.timestamp,data_keys:e.data?Object.keys(e.data):"no data",full_event:e})})));for(let e=o.length-1;e>=0;e--){const n=o[e];if(n.data){if(console.log(`[DEBUG] Examining event ${e} data:`,n.data),s||(n.data.working_directory?(s=n.data.working_directory,console.log(`[DEBUG] Found working_directory: ${s}`)):n.data.cwd?(s=n.data.cwd,console.log(`[DEBUG] Found cwd: ${s}`)):n.data.instance_info&&n.data.instance_info.working_dir&&(s=n.data.instance_info.working_dir,console.log(`[DEBUG] Found instance_info.working_dir: ${s}`))),!t){const e=["git_branch","gitBranch","branch","git.branch","vcs_branch","current_branch"];for(const s of e)if(n.data[s]){t=n.data[s],console.log(`[DEBUG] Found git branch in field '${s}': ${t}`);break}if(!t){if(n.data.instance_info){console.log("[DEBUG] Checking instance_info for branch:",n.data.instance_info);for(const s of e)if(n.data.instance_info[s]){t=n.data.instance_info[s],console.log(`[DEBUG] Found git branch in instance_info.${s}: ${t}`);break}}!t&&n.data.git&&(console.log("[DEBUG] Checking git object:",n.data.git),n.data.git.branch&&(t=n.data.git.branch,console.log(`[DEBUG] Found git branch in git.branch: ${t}`)))}}if(s&&t){console.log("[DEBUG] Found both workingDir and gitBranch, stopping search");break}}}}else console.log("[DEBUG] No socket client or events available");return console.log(`[DEBUG] Final results - workingDir: '${s}', gitBranch: '${t}'`),{workingDir:s,gitBranch:t}}setCurrentSessionId(e){this.currentSessionId=e,this.updateSessionSelect(),this.updateFooterInfo()}addSession(e){if(!e.id)return;const s=this.sessions.get(e.id);s?Object.assign(s,e):this.sessions.set(e.id,{id:e.id,startTime:e.startTime||e.start_time||(new Date).toISOString(),lastActivity:e.lastActivity||e.last_activity||(new Date).toISOString(),eventCount:e.eventCount||e.event_count||0,working_directory:e.working_directory||e.workingDirectory||"",git_branch:e.git_branch||e.gitBranch||"",agent_type:e.agent_type||e.agentType||"",...e}),this.updateSessionSelect()}removeSession(e){if(this.sessions.has(e)){if(this.sessions.delete(e),this.selectedSessionId===e){this.selectedSessionId="";const e=document.getElementById("session-select");e&&(e.value=""),this.onSessionFilterChanged()}this.updateSessionSelect()}}getCurrentFilter(){return this.selectedSessionId}getSession(e){return this.sessions.get(e)||null}getAllSessions(){return this.sessions}getCurrentSessionId(){return this.currentSessionId}clearSessions(){this.sessions.clear(),this.currentSessionId=null,this.selectedSessionId="",this.updateSessionSelect(),this.updateFooterInfo()}exportSessionData(){return{sessions:Array.from(this.sessions.entries()),currentSessionId:this.currentSessionId,selectedSessionId:this.selectedSessionId}}importSessionData(e){e.sessions&&Array.isArray(e.sessions)&&(this.sessions.clear(),e.sessions.forEach(([e,s])=>{this.sessions.set(e,s)})),e.currentSessionId&&(this.currentSessionId=e.currentSessionId),void 0!==e.selectedSessionId&&(this.selectedSessionId=e.selectedSessionId),this.updateSessionSelect(),this.updateFooterInfo()}getEventsForSession(e){if(!e||!this.socketClient)return[];return(this.socketClient.events||[]).filter(s=>(s.session_id||s.data&&s.data.session_id||null)===e)}};
|
|
2
|
-
//# sourceMappingURL=session-manager.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
class e{constructor(e="module-data-content"){this.container=document.getElementById(e),this.currentData=null,this.currentType=null,this.globalJsonExpanded="true"===localStorage.getItem("dashboard-json-expanded"),this.fullEventDataExpanded="true"===localStorage.getItem("dashboard-full-event-expanded"),document.addEventListener("jsonToggleChanged",e=>{this.globalJsonExpanded=e.detail.expanded,this.updateAllJsonSections()}),document.addEventListener("fullEventToggleChanged",e=>{this.fullEventDataExpanded=e.detail.expanded,this.updateAllFullEventSections()})}display(e,n=null){if(this.container)switch(this.currentData=e,this.currentType=n,n||(n=this.detectType(e)),this.container.innerHTML="",n){case"event":this.displayEvent(e);break;case"agent":this.displayAgent(e);break;case"tool":this.displayTool(e);break;case"todo":this.displayTodo(e);break;case"instruction":this.displayInstruction(e);break;case"session":this.displaySession(e);break;case"file_operation":if(e.name&&(e.params||e.tool_parameters)){const n=this.convertToolToFileOperation(e);this.displayFileOperation(n)}else this.displayFileOperation(e);break;case"hook":this.displayHook(e);break;default:this.displayGeneric(e)}else console.warn("UnifiedDataViewer: Container not found")}detectType(e){return e&&"object"==typeof e?e.hook_event_name||e.event_type||e.type&&e.timestamp?"event":e.agent_name||e.agentName||e.name&&("active"===e.status||"completed"===e.status)?"agent":e.tool_name||"TodoWrite"===e.name||"Read"===e.name||e.tool_parameters||e.params&&e.icon||e.name&&"tool"===e.type?"tool":!e.todos||e.name||e.params?e.content&&e.activeForm&&e.status&&!e.name&&!e.params?"todo":e.text&&e.preview&&"user_instruction"===e.type?"instruction":e.session_id&&(e.startTime||e.lastActivity)?"session":e.file_path&&(e.operations||e.operation)?"file_operation":"Read"!==e.name&&"Write"!==e.name&&"Edit"!==e.name&&"MultiEdit"!==e.name&&"Grep"!==e.name&&"Glob"!==e.name||!e.params?.file_path&&!e.tool_parameters?.file_path?e.event_type&&(e.hook_name||e.subtype)?"hook":"generic":"file_operation":"todo":"generic"}displayEvent(e){let n=`\n <div class="unified-viewer-header">\n <h6>${this.formatEventType(e)}</h6>\n <span class="unified-viewer-timestamp">${this.formatTimestamp(e.timestamp)}</span>\n </div>\n <div class="unified-viewer-content">\n `;if(n+='<div class="primary-data">',n+=this.formatEventDetails(e),e.tool_name||e.data?.tool_name){const t=e.tool_name||e.data.tool_name;n+=`\n <div class="detail-row highlight">\n <span class="detail-label">Tool:</span>\n <span class="detail-value">${this.getToolIcon(t)} ${t}</span>\n </div>\n `;const a=e.tool_parameters||e.data?.tool_parameters;a&&(a.file_path&&(n+=`\n <div class="detail-row">\n <span class="detail-label">File:</span>\n <span class="detail-value code">${a.file_path}</span>\n </div>\n `),a.command&&(n+=`\n <div class="detail-row">\n <span class="detail-label">Command:</span>\n <pre class="code-snippet">${this.escapeHtml(a.command)}</pre>\n </div>\n `))}n+="</div>",n+=this.createCollapsibleJSON(e,"Full Event Data"),n+="</div>",this.container.innerHTML=n}displayAgent(e){const n=this.getAgentIcon(e.name||e.agentName),t=e.name||e.agentName||"Unknown Agent",a=this.formatStatus(e.status);let s=`\n <div class="unified-viewer-header">\n <h6>${n} ${t}</h6>\n <span class="unified-viewer-status">${a}</span>\n </div>\n <div class="unified-viewer-content">\n `;if(s+='<div class="primary-data">',s+=`\n <div class="detail-row highlight">\n <span class="detail-label">Status:</span>\n <span class="detail-value ${this.formatStatusClass(a)}">${a}</span>\n </div>\n `,e.tools&&e.tools.length>0){const n=e.tools.filter(e=>"in_progress"===e.status),t=e.tools.filter(e=>"completed"===e.status);n.length>0&&(s+='\n <div class="active-tools-section">\n <span class="section-label">🔄 Active Tools:</span>\n <div class="tools-grid">\n ',n.forEach(e=>{s+=`\n <div class="tool-chip active">\n ${this.getToolIcon(e.name)} ${e.name}\n </div>\n `}),s+="</div></div>"),s+=`\n <div class="detail-row">\n <span class="detail-label">Tools Summary:</span>\n <span class="detail-value">\n ${n.length} active, ${t.length} completed, ${e.tools.length} total\n </span>\n </div>\n `}(e.currentTask||e.description)&&(s+=`\n <div class="detail-row">\n <span class="detail-label">Current Task:</span>\n <span class="detail-value">${e.currentTask||e.description}</span>\n </div>\n `),s+="</div>",s+=this.createCollapsibleJSON(e,"Full Agent Details"),s+="</div>",this.container.innerHTML=s}displayTool(e){const n=e.name||e.tool_name||"Unknown Tool",t=this.getToolIcon(n),a=this.formatStatus(e.status);if("TodoWrite"===n)return void this.displayTodoWriteTool(e);let s=`\n <div class="unified-viewer-header">\n <h6>${t} ${n}</h6>\n <span class="unified-viewer-status">${a}</span>\n </div>\n <div class="unified-viewer-content">\n `;const i=e.params||e.tool_parameters||{};"Read"===n||"Edit"===n||"Write"===n?i.file_path&&(s+=`\n <div class="primary-data">\n <div class="detail-row highlight">\n <span class="detail-label">📁 File:</span>\n <span class="detail-value code">${i.file_path}</span>\n </div>\n `,i.old_string&&(s+=`\n <div class="detail-row">\n <span class="detail-label">Old Text:</span>\n <pre class="code-snippet">${this.escapeHtml(i.old_string.substring(0,200))}${i.old_string.length>200?"...":""}</pre>\n </div>\n `),i.new_string&&(s+=`\n <div class="detail-row">\n <span class="detail-label">New Text:</span>\n <pre class="code-snippet">${this.escapeHtml(i.new_string.substring(0,200))}${i.new_string.length>200?"...":""}</pre>\n </div>\n `),s+="</div>"):"Bash"===n?i.command&&(s+=`\n <div class="primary-data">\n <div class="detail-row highlight">\n <span class="detail-label">💻 Command:</span>\n <pre class="code-snippet">${this.escapeHtml(i.command)}</pre>\n </div>\n </div>\n `):"Grep"===n||"Glob"===n?i.pattern&&(s+=`\n <div class="primary-data">\n <div class="detail-row highlight">\n <span class="detail-label">🔍 Pattern:</span>\n <span class="detail-value code">${this.escapeHtml(i.pattern)}</span>\n </div>\n `,i.path&&(s+=`\n <div class="detail-row">\n <span class="detail-label">Path:</span>\n <span class="detail-value">${i.path}</span>\n </div>\n `),s+="</div>"):"Task"===n&&i.subagent_type&&(s+=`\n <div class="primary-data">\n <div class="detail-row highlight">\n <span class="detail-label">🤖 Delegating to:</span>\n <span class="detail-value">${i.subagent_type} agent</span>\n </div>\n `,i.description&&(s+=`\n <div class="detail-row">\n <span class="detail-label">Task:</span>\n <span class="detail-value">${i.description}</span>\n </div>\n `),s+="</div>"),s+=`\n <div class="detail-row">\n <span class="detail-label">Status:</span>\n <span class="detail-value">${a}</span>\n </div>\n `,e.callCount&&(s+=`\n <div class="detail-row">\n <span class="detail-label">Call Count:</span>\n <span class="detail-value">${e.callCount}</span>\n </div>\n `),s+=this.createCollapsibleJSON(e,"Full Tool Details"),s+="</div>",this.container.innerHTML=s}displayTodoWriteTool(e){const n=this.formatStatus(e.status),t=(e.params||e.tool_parameters||{}).todos||[];let a=`\n <div class="unified-viewer-header">\n <h6>📝 TodoWrite</h6>\n <span class="unified-viewer-status">${n}</span>\n </div>\n <div class="unified-viewer-content">\n `;if(t.length>0){const e=this.getTodoStatusCounts(t);a+=`\n <div class="todo-status-line">\n <span class="status-inline">✅ ${e.completed} Done</span>\n <span class="status-inline">🔄 ${e.in_progress} Active</span>\n <span class="status-inline">⏳ ${e.pending} Pending</span>\n </div>\n `,a+='\n <div class="todo-list-primary">\n ',t.forEach((e,n)=>{const t=this.getCheckboxIcon(e.status),s="in_progress"===e.status&&e.activeForm||e.content,i=this.formatStatusClass(e.status);a+=`\n <div class="todo-item ${e.status}">\n <span class="todo-icon ${i}">${t}</span>\n <span class="todo-text">${this.escapeHtml(s)}</span>\n ${"in_progress"===e.status?'<span class="todo-badge active">ACTIVE</span>':""}\n </div>\n `}),a+="\n </div>\n "}else a+='\n <div class="detail-row">\n <span class="detail-value">No todos in list</span>\n </div>\n ';e.callCount&&e.callCount>1&&(a+=`\n <div class="detail-row">\n <span class="detail-label">Updates:</span>\n <span class="detail-value">${e.callCount}</span>\n </div>\n `),a+=this.createCollapsibleJSON(e,"Full Details"),a+="</div>",this.container.innerHTML=a}displayTodo(e){let n;n=e.todos&&Array.isArray(e.todos)?e.todos:Array.isArray(e)?e:e.content&&e.activeForm&&e.status?[e]:[];let t='\n <div class="unified-viewer-header">\n <h6>📋 Todo List</h6>\n </div>\n <div class="unified-viewer-content">\n ';n.length>0?(t+='\n <div class="todo-list-primary">\n ',n.forEach(e=>{const n=this.getCheckboxIcon(e.status),a="in_progress"===e.status&&e.activeForm||e.content,s=this.formatStatusClass(e.status);t+=`\n <div class="todo-item ${e.status}">\n <span class="todo-icon ${s}">${n}</span>\n <span class="todo-text">${this.escapeHtml(a)}</span>\n <span class="todo-status-text ${s}">${e.status.replace("_"," ")}</span>\n </div>\n `}),t+="\n </div>\n "):t+='\n <div class="detail-section">\n <div class="no-todos">No todo items found</div>\n </div>\n ',t+="</div>",this.container.innerHTML=t}displayInstruction(e){let n=`\n <div class="unified-viewer-header">\n <h6>💬 User Instruction</h6>\n <span class="unified-viewer-timestamp">${this.formatTimestamp(e.timestamp)}</span>\n </div>\n <div class="unified-viewer-content">\n `;n+=`\n <div class="primary-data">\n <div class="instruction-content">\n ${this.escapeHtml(e.text)}\n </div>\n <div class="instruction-meta">\n <span class="meta-item">📏 ${e.text.length} characters</span>\n <span class="meta-item">🕐 ${this.formatTimestamp(e.timestamp)}</span>\n </div>\n </div>\n `,Object.keys(e).length>3&&(n+=this.createCollapsibleJSON(e,"Full Instruction Data")),n+="</div>",this.container.innerHTML=n}displaySession(e){let n=`\n <div class="unified-viewer-header">\n <h6>🎯 Session: ${e.session_id||e.id}</h6>\n <span class="unified-viewer-status">${this.formatStatus(e.status||"active")}</span>\n </div>\n <div class="unified-viewer-content">\n <div class="detail-row">\n <span class="detail-label">Session ID:</span>\n <span class="detail-value">${e.session_id||e.id}</span>\n </div>\n <div class="detail-row">\n <span class="detail-label">Start Time:</span>\n <span class="detail-value">${this.formatTimestamp(e.startTime||e.timestamp)}</span>\n </div>\n `;e.working_directory&&(n+=`\n <div class="detail-row">\n <span class="detail-label">Working Directory:</span>\n <span class="detail-value">${e.working_directory}</span>\n </div>\n `),e.git_branch&&(n+=`\n <div class="detail-row">\n <span class="detail-label">Git Branch:</span>\n <span class="detail-value">${e.git_branch}</span>\n </div>\n `),void 0!==e.eventCount&&(n+=`\n <div class="detail-row">\n <span class="detail-label">Events:</span>\n <span class="detail-value">${e.eventCount}</span>\n </div>\n `),n+="</div>",this.container.innerHTML=n}displayFileOperation(e){const n=e.file_path?e.file_path.split("/").pop():"Unknown File",t=this.isSingleFileOperation(e),a=this.getFileIcon(e.file_path),s=this.getFileType(e.file_path);let i=`\n <div class="unified-viewer-header ${t?"single-file-header":""}">\n <h6>${a} File: ${n}</h6>\n <span class="unified-viewer-count">${e.operations?e.operations.length:1} operation${e.operations&&1!==e.operations.length?"s":""}</span>\n ${s?`<span class="file-type-badge">${s}</span>`:""}\n </div>\n <div class="unified-viewer-content">\n <div class="primary-data">\n <div class="detail-row highlight">\n <span class="detail-label">📁 File Path:</span>\n <span class="detail-value code clickable-file-path" \n onclick="window.showFileViewerModal && window.showFileViewerModal('${e.file_path}')"\n title="Click to view file contents\\nKeyboard: Hover + V key or Ctrl/Cmd + Click\\nFile: ${e.file_path}"\n tabindex="0"\n role="button"\n aria-label="Open file ${e.file_path} in viewer"\n onkeypress="if(event.key==='Enter'||event.key===' '){window.showFileViewerModal && window.showFileViewerModal('${e.file_path}')}">${e.file_path}</span>\n </div>\n `;if(e.file_path){const n=this.shouldShowInlinePreview(e);if(i+=`\n <div class="file-actions ${t?"single-file-actions":""}">\n <button class="file-action-btn view-file-btn ${t?"primary-action":""}" \n onclick="window.showFileViewerModal && window.showFileViewerModal('${e.file_path}')"\n title="View file contents with syntax highlighting">\n ${a} View File Contents\n </button>\n ${t&&this.isTextFile(e.file_path)?`\n <button class="file-action-btn inline-preview-btn" \n onclick="window.unifiedDataViewer && window.unifiedDataViewer.toggleInlinePreview('${e.file_path}', this)"\n title="Toggle inline preview">\n 📖 Quick Preview\n </button>\n `:""}\n </div>\n `,t&&n){i+=`\n <div class="inline-preview-container" id="preview-${this.generatePreviewId(e.file_path)}" style="display: none;">\n <div class="inline-preview-loading">Loading preview...</div>\n </div>\n `}}i+="</div>",e.operations&&Array.isArray(e.operations)&&(i+=`\n <div class="detail-section">\n <span class="detail-section-title">Operations (${e.operations.length}):</span>\n <div class="operations-list">\n ${e.operations.map((e,n)=>`\n <div class="operation-item">\n <div class="operation-header">\n <span class="operation-type">${this.getOperationIcon(e.operation)} ${e.operation}</span>\n <span class="operation-timestamp">${this.formatTimestamp(e.timestamp)}</span>\n </div>\n <div class="operation-details">\n <span class="operation-agent">by ${e.agent||"Unknown"}</span>\n ${e.workingDirectory?`<span class="operation-dir">in ${e.workingDirectory}</span>`:""}\n </div>\n </div>\n `).join("")}\n </div>\n </div>\n `),i+=this.createCollapsibleJSON(e,"Full File Data"),i+="</div>",this.container.innerHTML=i}displayHook(e){let n=`\n <div class="unified-viewer-header">\n <h6>🔗 Hook: ${e.event_type||e.subtype||"unknown"}</h6>\n <span class="unified-viewer-timestamp">${this.formatTimestamp(e.timestamp)}</span>\n </div>\n <div class="unified-viewer-content">\n `;n+=this.formatHookDetails(e),n+="</div>",this.container.innerHTML=n}displayGeneric(e){let n=`\n <div class="unified-viewer-header">\n <h6>📊 Data Details</h6>\n ${e.timestamp?`<span class="unified-viewer-timestamp">${this.formatTimestamp(e.timestamp)}</span>`:""}\n </div>\n <div class="unified-viewer-content">\n `;if("object"==typeof e&&null!==e){const t=["id","name","type","status","timestamp","text","content","message"];for(let a of t)if(void 0!==e[a]){let t=e[a];"string"==typeof t&&t.length>200&&(t=t.substring(0,200)+"..."),n+=`\n <div class="detail-row">\n <span class="detail-label">${a}:</span>\n <span class="detail-value">${this.escapeHtml(String(t))}</span>\n </div>\n `}}else n+=`<div class="simple-value">${this.escapeHtml(String(e))}</div>`;n+="</div>",this.container.innerHTML=n}formatEventType(e){return e.type&&e.subtype?e.type===e.subtype||"generic"===e.subtype?e.type:`${e.type}.${e.subtype}`:e.type?e.type:e.hook_event_name?e.hook_event_name:"unknown"}formatEventDetails(e){switch(e.data,e.type){case"hook":return this.formatHookDetails(e);case"agent":return this.formatAgentEventDetails(e);case"todo":return this.formatTodoEventDetails(e);case"session":return this.formatSessionEventDetails(e);default:return this.formatGenericEventDetails(e)}}formatHookDetails(e){const n=e.data||{},t=e.subtype||e.event_type||"unknown";let a=`\n <div class="detail-row">\n <span class="detail-label">Hook Type:</span>\n <span class="detail-value">${t}</span>\n </div>\n `;switch(t){case"user_prompt":const e=n.prompt_text||n.prompt_preview||"";a+=`\n <div class="detail-row">\n <span class="detail-label">Prompt:</span>\n <div class="detail-value prompt-text">${this.escapeHtml(e)}</div>\n </div>\n `;break;case"pre_tool":case"post_tool":a+=`\n <div class="detail-row">\n <span class="detail-label">Tool:</span>\n <span class="detail-value">${n.tool_name||"Unknown tool"}</span>\n </div>\n `,n.operation_type&&(a+=`\n <div class="detail-row">\n <span class="detail-label">Operation:</span>\n <span class="detail-value">${n.operation_type}</span>\n </div>\n `),"post_tool"===t&&n.duration_ms&&(a+=`\n <div class="detail-row">\n <span class="detail-label">Duration:</span>\n <span class="detail-value">${n.duration_ms}ms</span>\n </div>\n `);break;case"subagent_start":case"subagent_stop":a+=`\n <div class="detail-row">\n <span class="detail-label">Agent:</span>\n <span class="detail-value">${n.agent_type||n.agent||"Unknown"}</span>\n </div>\n `,"subagent_start"===t&&n.prompt&&(a+=`\n <div class="detail-row">\n <span class="detail-label">Task:</span>\n <div class="detail-value">${this.escapeHtml(n.prompt)}</div>\n </div>\n `),"subagent_stop"===t&&n.reason&&(a+=`\n <div class="detail-row">\n <span class="detail-label">Reason:</span>\n <span class="detail-value">${n.reason}</span>\n </div>\n `)}return a}formatAgentEventDetails(e){const n=e.data||{};let t="";return(n.agent_type||n.name)&&(t+=`\n <div class="detail-row">\n <span class="detail-label">Agent Type:</span>\n <span class="detail-value">${n.agent_type||n.name}</span>\n </div>\n `),e.subtype&&(t+=`\n <div class="detail-row">\n <span class="detail-label">Action:</span>\n <span class="detail-value">${e.subtype}</span>\n </div>\n `),t}formatTodoEventDetails(e){const n=e.data||{};let t="";if(n.todos&&Array.isArray(n.todos)){const e=this.getTodoStatusCounts(n.todos);t+=`\n <div class="detail-row">\n <span class="detail-label">Todo Items:</span>\n <span class="detail-value">${n.todos.length} total</span>\n </div>\n <div class="detail-row">\n <span class="detail-label">Status:</span>\n <span class="detail-value">${e.completed} completed, ${e.in_progress} in progress</span>\n </div>\n `}return t}formatSessionEventDetails(e){const n=e.data||{};let t="";return n.session_id&&(t+=`\n <div class="detail-row">\n <span class="detail-label">Session ID:</span>\n <span class="detail-value">${n.session_id}</span>\n </div>\n `),e.subtype&&(t+=`\n <div class="detail-row">\n <span class="detail-label">Action:</span>\n <span class="detail-value">${e.subtype}</span>\n </div>\n `),t}formatGenericEventDetails(e){const n=e.data||{};let t="";const a=["message","description","value","result"];for(let s of a)if(void 0!==n[s]){let e=n[s];"string"==typeof e&&e.length>200&&(e=e.substring(0,200)+"..."),t+=`\n <div class="detail-row">\n <span class="detail-label">${s}:</span>\n <span class="detail-value">${this.escapeHtml(String(e))}</span>\n </div>\n `}return t}formatEventData(e){const n=e.data;return n&&0!==Object.keys(n).length?`\n <div class="detail-section">\n <span class="detail-section-title">Event Data:</span>\n <pre class="event-data-json">${this.escapeHtml(JSON.stringify(n,null,2))}</pre>\n </div>\n `:""}formatParameters(e,n="Parameters"){if(!e||0===Object.keys(e).length)return`\n <div class="detail-section">\n <span class="detail-section-title">${n}:</span>\n <div class="no-params">No parameters</div>\n </div>\n `;const t=Object.keys(e);return`\n <div class="detail-section">\n <span class="detail-section-title">${n} (${t.length}):</span>\n <div class="params-list">\n ${t.map(n=>{const t=e[n];return`\n <div class="param-item">\n <div class="param-key">${n}:</div>\n <div class="param-value">${this.formatParameterValue(t)}</div>\n </div>\n `}).join("")}\n </div>\n </div>\n `}formatParameterValue(e){if("string"==typeof e)return e.length>500?`<pre class="param-text-long">${this.escapeHtml(e.substring(0,500)+"...\n\n[Content truncated - "+e.length+" total characters]")}</pre>`:e.length>100?`<pre class="param-text">${this.escapeHtml(e)}</pre>`:`<span class="param-text-short">${this.escapeHtml(e)}</span>`;if("object"!=typeof e||null===e)return`<span class="param-primitive">${this.escapeHtml(String(e))}</span>`;if(Array.isArray(e)&&e.length>0&&e[0].hasOwnProperty("content")&&e[0].hasOwnProperty("status"))return this.formatTodosAsParameter(e);try{return`<pre class="param-json">${this.escapeHtml(JSON.stringify(e,null,2))}</pre>`}catch(n){return'<span class="param-error">Error displaying object</span>'}}formatTodosAsParameter(e){const n=this.getTodoStatusCounts(e);let t=`\n <div class="param-todos">\n <div class="param-todos-header">\n Array of todo objects (${e.length} items)\n </div>\n <div class="param-todos-summary">\n ${n.completed} completed • ${n.in_progress} in progress • ${n.pending} pending\n </div>\n <div class="param-todos-list">\n `;return e.forEach((e,n)=>{const a=this.getCheckboxIcon(e.status),s="in_progress"===e.status&&e.activeForm||e.content,i=this.formatStatusClass(e.status);t+=`\n <div class="param-todo-item ${e.status}">\n <div class="param-todo-checkbox">\n <span class="param-checkbox-icon ${i}">${a}</span>\n </div>\n <div class="param-todo-text">\n <span class="param-todo-content">${this.escapeHtml(s)}</span>\n <span class="param-todo-status-badge ${i}">${e.status.replace("_"," ")}</span>\n </div>\n </div>\n `}),t+="\n </div>\n </div>\n ",t}isSingleFileOperation(e){return!e.operations||1===e.operations.length}getFileIcon(e){if(!e)return"📄";const n=e.split(".").pop()?.toLowerCase();return{js:"🟨",jsx:"⚛️",ts:"🔷",tsx:"⚛️",py:"🐍",java:"☕",cpp:"⚡",c:"⚡",cs:"#️⃣",php:"🐘",rb:"💎",go:"🐹",rs:"🦀",swift:"🦉",kt:"🅺",scala:"🎯",html:"🌐",htm:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",vue:"💚",json:"📋",xml:"📄",yaml:"⚙️",yml:"⚙️",toml:"⚙️",ini:"⚙️",conf:"⚙️",config:"⚙️",md:"📝",txt:"📃",rtf:"📃",pdf:"📕",doc:"📘",docx:"📘",jpg:"🖼️",jpeg:"🖼️",png:"🖼️",gif:"🖼️",svg:"🎨",webp:"🖼️",ico:"🖼️",zip:"🗜️",tar:"🗜️",gz:"🗜️",rar:"🗜️","7z":"🗜️",sql:"🗃️",db:"🗃️",log:"📊",env:"🔐",lock:"🔒"}[n]||"📄"}getFileType(e){if(!e)return null;const n=e.split(".").pop()?.toLowerCase();return{js:"JavaScript",jsx:"React JSX",ts:"TypeScript",tsx:"React TSX",py:"Python",java:"Java",cpp:"C++",c:"C",cs:"C#",php:"PHP",rb:"Ruby",go:"Go",rs:"Rust",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",xml:"XML",yaml:"YAML",yml:"YAML",md:"Markdown",txt:"Text",sql:"SQL",log:"Log File"}[n]||null}shouldShowInlinePreview(e){return this.isSingleFileOperation(e)&&this.isTextFile(e.file_path)}isTextFile(e){if(!e)return!1;const n=e.split(".").pop()?.toLowerCase();return["txt","md","json","xml","yaml","yml","ini","conf","config","js","jsx","ts","tsx","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","scala","html","htm","css","scss","sass","less","vue","sql","log","env","gitignore","dockerignore"].includes(n)}async toggleInlinePreview(e,n){const t=`preview-${this.generatePreviewId(e)}`,a=document.getElementById(t);a?"none"===a.style.display?(a.style.display="block",n.innerHTML="📖 Hide Preview",await this.loadInlinePreview(e,a)):(a.style.display="none",n.innerHTML="📖 Quick Preview"):console.warn("Preview container not found")}async loadInlinePreview(e,n){try{n.innerHTML=`\n <div class="inline-preview-header">\n <span class="preview-label">Quick Preview:</span>\n <span class="preview-file">${e}</span>\n </div>\n <div class="inline-preview-content">\n <div class="preview-note">\n 💡 Inline preview feature ready - API integration needed\n <br>Click "View File Contents" for full syntax-highlighted view\n </div>\n </div>\n `}catch(t){n.innerHTML=`\n <div class="inline-preview-error">\n ❌ Could not load preview: ${t.message}\n </div>\n `}}generateId(){return Date.now().toString(36)+Math.random().toString(36).substr(2,9)}generatePreviewId(e){return btoa(e).replace(/[^a-zA-Z0-9]/g,"")}formatTimestamp(e){if(!e)return"Unknown time";try{const n=new Date(e);return isNaN(n.getTime())?"Invalid date":n.toLocaleString()}catch(n){return"Invalid date"}}formatStatus(e){if(!e)return"unknown";return{active:"🟢 Active",completed:"✅ Completed",in_progress:"🔄 In Progress",pending:"⏳ Pending",error:"❌ Error",failed:"❌ Failed"}[e]||e}formatStatusClass(e){return`status-${e}`}getAgentIcon(e){return{PM:"🎯",Engineer:"🔧","Engineer Agent":"🔧",Research:"🔍","Research Agent":"🔍",QA:"✅","QA Agent":"✅",Architect:"🏗️","Architect Agent":"🏗️",Ops:"⚙️","Ops Agent":"⚙️"}[e]||"🤖"}getToolIcon(e){return{Read:"👁️",Write:"✍️",Edit:"✏️",MultiEdit:"📝",Bash:"💻",Grep:"🔍",Glob:"📂",LS:"📁",TodoWrite:"📝",Task:"📋",WebFetch:"🌐"}[e]||"🔧"}getCheckboxIcon(e){return{pending:"⏳",in_progress:"🔄",completed:"✅"}[e]||"❓"}getOperationIcon(e){return{read:"👁️",write:"✍️",edit:"✏️",delete:"🗑️",create:"📝",search:"🔍",list:"📂",copy:"📋",move:"📦",bash:"💻"}[e.toLowerCase()]||"📄"}convertToolToFileOperation(e){const n=e.params||e.tool_parameters||{},t=n.file_path||n.path||n.notebook_path;if(!t)return e;const a={operation:e.name.toLowerCase(),timestamp:e.timestamp||(new Date).toISOString(),agent:"Activity Tool",sessionId:e.sessionId||"unknown",details:{parameters:n,tool_name:e.name,status:e.status||"completed"}};return{file_path:t,operations:[a],lastOperation:a.timestamp,originalTool:e}}getTodoStatusCounts(e){const n={completed:0,in_progress:0,pending:0};return e.forEach(e=>{n.hasOwnProperty(e.status)&&n[e.status]++}),n}escapeHtml(e){if("string"!=typeof e)return"";const n=document.createElement("div");return n.textContent=e,n.innerHTML}toggleJsonSection(e,n){this.globalJsonExpanded=!this.globalJsonExpanded,localStorage.setItem("dashboard-json-expanded",this.globalJsonExpanded.toString()),this.updateAllJsonSections(),document.dispatchEvent(new CustomEvent("jsonToggleChanged",{detail:{expanded:this.globalJsonExpanded}}))}toggleFullEventSection(e,n){this.fullEventDataExpanded=!this.fullEventDataExpanded,localStorage.setItem("dashboard-full-event-expanded",this.fullEventDataExpanded.toString()),this.updateAllFullEventSections(),document.dispatchEvent(new CustomEvent("fullEventToggleChanged",{detail:{expanded:this.fullEventDataExpanded}}))}updateAllJsonSections(){const e=document.querySelectorAll(".unified-json-content"),n=document.querySelectorAll(".unified-json-toggle");e.forEach(e=>{this.globalJsonExpanded?e.style.display="block":e.style.display="none"}),n.forEach(e=>{const n=e.textContent.substring(2);this.globalJsonExpanded?(e.innerHTML="▼ "+n,e.classList.add("expanded")):(e.innerHTML="▶ "+n,e.classList.remove("expanded"))})}updateAllFullEventSections(){const e=document.querySelectorAll(".full-event-content"),n=document.querySelectorAll(".full-event-toggle");e.forEach(e=>{this.fullEventDataExpanded?e.style.display="block":e.style.display="none"}),n.forEach(e=>{const n=e.textContent.substring(2);this.fullEventDataExpanded?(e.innerHTML="▼ "+n,e.classList.add("expanded")):(e.innerHTML="▶ "+n,e.classList.remove("expanded"))})}createCollapsibleJSON(e,n="Full Details"){const t=`json-details-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,a=this.cleanDataForDisplay(e),s=n.includes("Full Event")||n.includes("Full Details")||n.includes("Full Agent")||n.includes("Full Tool"),i=s?this.fullEventDataExpanded:this.globalJsonExpanded;return`\n <div class="collapsible-json-section">\n <button class="collapsible-json-toggle ${s?"full-event-toggle":"unified-json-toggle"} ${i?"expanded":""}" \n data-section-id="${t}"\n data-is-full-event="${s}"\n onclick="window.unifiedDataViewer.${s?"toggleFullEventSection":"toggleJsonSection"}('${t}', this)">\n ${i?"▼":"▶"} ${n}\n </button>\n <div id="${t}" class="collapsible-json-content ${s?"full-event-content":"unified-json-content"}" style="display: ${i?"block":"none"};">\n <pre class="json-viewer">${this.escapeHtml(JSON.stringify(a,null,2))}</pre>\n </div>\n </div>\n `}cleanDataForDisplay(e){const n=new WeakSet;return JSON.parse(JSON.stringify(e,(e,t)=>{if("object"==typeof t&&null!==t){if(n.has(t))return"[Circular Reference]";n.add(t)}return"string"==typeof t&&t.length>1e3?t.substring(0,1e3)+"... [truncated]":"function"==typeof t?"[Function]":t}))}clear(){this.container&&(this.container.innerHTML=""),this.currentData=null,this.currentType=null}getCurrentData(){return this.currentData}getCurrentType(){return this.currentType}hasData(){return null!==this.currentData}}window.UnifiedDataViewer=e,"undefined"!=typeof window&&(window.unifiedDataViewer=new e,window.toggleFullEventSection=function(e,n){window.unifiedDataViewer&&window.unifiedDataViewer.toggleFullEventSection(e,n)},window.toggleJsonSection=function(e,n){window.unifiedDataViewer&&window.unifiedDataViewer.toggleJsonSection(e,n)}),"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",function(){window.unifiedDataViewer||(window.unifiedDataViewer=new e),document.addEventListener("keydown",function(e){if((e.ctrlKey||e.metaKey)&&e.target.classList.contains("clickable-file-path")){e.preventDefault();const n=e.target.textContent.trim();window.showFileViewerModal&&window.showFileViewerModal(n)}if("v"===e.key.toLowerCase()&&document.querySelector(".clickable-file-path:hover")){const n=document.querySelector(".clickable-file-path:hover");if(n&&window.showFileViewerModal){e.preventDefault();const t=n.textContent.trim();window.showFileViewerModal(t)}}})});export{e as U};
|
|
2
|
-
//# sourceMappingURL=unified-data-viewer.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
window.WorkingDirectoryManager=class{constructor(e){this.socketManager=e,this.currentWorkingDir=null,this.footerDirObserver=null,this._updatingFooter=!1,this.setupEventHandlers(),this.initialize(),console.log("Working directory manager initialized")}initialize(){this.initializeWorkingDirectory(),this.watchFooterDirectory()}setupEventHandlers(){const e=document.getElementById("change-dir-btn"),t=document.getElementById("working-dir-path");if(e&&e.addEventListener("click",()=>{this.showChangeDirDialog()}),t&&t.addEventListener("click",e=>{e.shiftKey?this.showChangeDirDialog():this.showWorkingDirectoryViewer()}),document.addEventListener("sessionChanged",e=>{const t=e.detail.sessionId;console.log("[WORKING-DIR-DEBUG] sessionChanged event received, sessionId:",this.repr(t)),t&&this.loadWorkingDirectoryForSession(t)}),this.socketManager&&this.socketManager.getSocket){const e=this.socketManager.getSocket();e&&(console.log("[WORKING-DIR-DEBUG] Setting up git_branch_response listener"),e.on("git_branch_response",e=>{console.log("[GIT-BRANCH-DEBUG] Received git_branch_response:",e),this.handleGitBranchResponse(e)}))}}initializeWorkingDirectory(){const e=document.getElementById("working-dir-path");e&&!e.textContent.trim()&&(e.textContent="Loading...");const t=document.getElementById("session-select");t&&t.value&&"all"!==t.value?this.loadWorkingDirectoryForSession(t.value):this.setWorkingDirectory(this.getDefaultWorkingDir())}watchFooterDirectory(){const e=document.getElementById("footer-working-dir");e&&(this.footerDirObserver=new MutationObserver(t=>{this._updatingFooter||t.forEach(t=>{if("childList"===t.type||"characterData"===t.type){const t=e.textContent.trim();console.log("Footer directory changed to:",t),t&&t!==this.currentWorkingDir&&(console.log("Syncing working directory from footer change"),this.setWorkingDirectory(t))}})}),this.footerDirObserver.observe(e,{childList:!0,characterData:!0,subtree:!0}),console.log("Started watching footer directory for changes"))}loadWorkingDirectoryForSession(e){if(console.log("[WORKING-DIR-DEBUG] loadWorkingDirectoryForSession called with sessionId:",this.repr(e)),!e||"all"===e){console.log('[WORKING-DIR-DEBUG] No sessionId or sessionId is "all", using default working dir');const e=this.getDefaultWorkingDir();return console.log("[WORKING-DIR-DEBUG] Default working dir:",this.repr(e)),void this.setWorkingDirectory(e)}const t=JSON.parse(localStorage.getItem("sessionWorkingDirs")||"{}");console.log("[WORKING-DIR-DEBUG] Session directories from localStorage:",t);const r=t[e],o=this.getDefaultWorkingDir(),i=r||o;console.log("[WORKING-DIR-DEBUG] Directory selection:",{sessionId:e,sessionDir:this.repr(r),defaultDir:this.repr(o),finalDir:this.repr(i)}),this.setWorkingDirectory(i)}setWorkingDirectory(e){console.log("[WORKING-DIR-DEBUG] setWorkingDirectory called with:",this.repr(e)),this.currentWorkingDir=e,e&&this.validateDirectoryPath(e)&&(sessionStorage.setItem("currentWorkingDirectory",e),console.log("[WORKING-DIR-DEBUG] Stored working directory in session storage:",e));const t=document.getElementById("working-dir-path");t?(console.log("[WORKING-DIR-DEBUG] Updating UI path element to:",e),t.textContent=e):console.warn("[WORKING-DIR-DEBUG] working-dir-path element not found");const r=document.getElementById("footer-working-dir");if(r){const t=r.textContent;console.log("[WORKING-DIR-DEBUG] Footer directory current text:",this.repr(t),"new text:",this.repr(e)),t!==e?(this._updatingFooter=!0,r.textContent=e,console.log("[WORKING-DIR-DEBUG] Updated footer directory to:",e),setTimeout(()=>{this._updatingFooter=!1,console.log("[WORKING-DIR-DEBUG] Cleared _updatingFooter flag")},100)):console.log("[WORKING-DIR-DEBUG] Footer directory already has correct text")}else console.warn("[WORKING-DIR-DEBUG] footer-working-dir element not found");const o=document.getElementById("session-select");if(o&&o.value&&"all"!==o.value){const t=o.value,r=JSON.parse(localStorage.getItem("sessionWorkingDirs")||"{}");r[t]=e,localStorage.setItem("sessionWorkingDirs",JSON.stringify(r)),console.log(`[WORKING-DIR-DEBUG] Saved working directory for session ${t}:`,e)}else console.log('[WORKING-DIR-DEBUG] No session selected or session is "all", not saving to localStorage');console.log("[WORKING-DIR-DEBUG] About to call updateGitBranch with:",this.repr(e)),this.validateDirectoryPath(e)?this.updateGitBranch(e):console.log("[WORKING-DIR-DEBUG] Skipping git branch update for invalid directory:",this.repr(e)),document.dispatchEvent(new CustomEvent("workingDirectoryChanged",{detail:{directory:e}})),console.log("[WORKING-DIR-DEBUG] Working directory set to:",e)}updateGitBranch(e){if(console.log("[GIT-BRANCH-DEBUG] updateGitBranch called with dir:",this.repr(e),"type:",typeof e),!this.socketManager||!this.socketManager.isConnected()){console.log("[GIT-BRANCH-DEBUG] Not connected to socket server");const e=document.getElementById("footer-git-branch");return void(e&&(e.textContent="Not Connected",e.style.display="inline"))}const t=this.validateDirectoryPath(e),r="Loading..."===e||"Loading"===e,o="Unknown"===e,i=!e||"string"==typeof e&&""===e.trim();if(console.log("[GIT-BRANCH-DEBUG] Validation results:",{dir:e,isValidPath:t,isLoadingState:r,isUnknown:o,isEmptyOrWhitespace:i,shouldReject:!t||r||o||i}),!t||r||o||i){console.warn("[GIT-BRANCH-DEBUG] Invalid working directory for git branch request:",e);const t=document.getElementById("footer-git-branch");return void(t&&(t.textContent=r?"Loading...":o||i?"No Directory":"Invalid Directory",t.style.display="inline"))}const n=this.socketManager.getSocket();n?(console.log("[GIT-BRANCH-DEBUG] Requesting git branch for directory:",e),console.log("[GIT-BRANCH-DEBUG] Socket state:",{connected:n.connected,id:n.id}),n.emit("get_git_branch",e)):console.error("[GIT-BRANCH-DEBUG] No socket available for git branch request")}getDefaultWorkingDir(){if(console.log("[WORKING-DIR-DEBUG] getDefaultWorkingDir called"),this.currentWorkingDir&&this.validateDirectoryPath(this.currentWorkingDir))return console.log("[WORKING-DIR-DEBUG] Using current working directory:",this.currentWorkingDir),this.currentWorkingDir;const e=document.querySelector(".working-dir-text");if(e?.textContent?.trim()){const t=e.textContent.trim();if("Loading..."!==t&&"Unknown"!==t&&this.validateDirectoryPath(t))return console.log("[WORKING-DIR-DEBUG] Using header working directory:",t),t}const t=document.getElementById("footer-working-dir");if(t?.textContent?.trim()){const e=t.textContent.trim();console.log("[WORKING-DIR-DEBUG] Footer path found:",this.repr(e));const r="Unknown"===e,o=this.validateDirectoryPath(e);if(console.log("[WORKING-DIR-DEBUG] Footer path validation:",{footerPath:this.repr(e),isUnknown:r,isValid:o,shouldUse:!r&&o}),!r&&o)return console.log("[WORKING-DIR-DEBUG] Using footer path as default:",e),e}else console.log("[WORKING-DIR-DEBUG] No footer directory element or no text content");if(window.socketClient&&window.socketClient.events){const e=window.socketClient.events.filter(e=>e.data&&(e.data.working_directory||e.data.cwd||e.data.working_dir)).reverse();if(e.length>0){const t=e[0],r=t.data.working_directory||t.data.cwd||t.data.working_dir;return console.log("[WORKING-DIR-DEBUG] Using working directory from recent event:",r),r}}const r=document.getElementById("working-dir-path");if(r?.textContent?.trim()){const e=r.textContent.trim();if(console.log("[WORKING-DIR-DEBUG] Found working-dir-path element text:",this.repr(e)),"Unknown"!==e&&this.validateDirectoryPath(e))return console.log("[WORKING-DIR-DEBUG] Using working-dir-path as fallback:",e),e}const o=sessionStorage.getItem("currentWorkingDirectory");if(o&&this.validateDirectoryPath(o))return console.log("[WORKING-DIR-DEBUG] Using session storage working directory:",this.repr(o)),o;const i=window.processWorkingDirectory||process?.cwd?.()||null;if(i&&this.validateDirectoryPath(i))return console.log("[WORKING-DIR-DEBUG] Using process working directory:",this.repr(i)),i;const n=window.homeDirectory||process?.env?.HOME||process?.env?.USERPROFILE||null||process?.cwd?.()||os?.homedir?.()||"/Users/masa";return console.log("[WORKING-DIR-DEBUG] Using fallback directory (home or cwd):",this.repr(n)),n}showChangeDirDialog(){const e=prompt("Enter new working directory:",this.currentWorkingDir||"");e&&""!==e.trim()&&this.setWorkingDirectory(e.trim())}showWorkingDirectoryViewer(){this.createDirectoryViewerOverlay()}createDirectoryViewerOverlay(){this.removeDirectoryViewerOverlay();const e=document.querySelector(".working-dir-display");if(!e)return;const t=document.createElement("div");t.id="directory-viewer-overlay",t.className="directory-viewer-overlay",t.innerHTML=`\n <div class="directory-viewer-content">\n <div class="directory-viewer-header">\n <h3 class="directory-viewer-title">\n 📁 ${this.currentWorkingDir||"Working Directory"}\n </h3>\n <button class="close-btn" onclick="workingDirectoryManager.removeDirectoryViewerOverlay()">✕</button>\n </div>\n <div class="directory-viewer-body">\n <div class="loading-indicator">Loading directory contents...</div>\n </div>\n <div class="directory-viewer-footer">\n <span class="directory-hint">Click file to view • Shift+Click directory path to change</span>\n </div>\n </div>\n `;const r=e.getBoundingClientRect();t.style.cssText=`\n position: fixed;\n top: ${r.bottom+5}px;\n left: ${r.left}px;\n min-width: 400px;\n max-width: 600px;\n max-height: 400px;\n z-index: 1001;\n background: white;\n border-radius: 8px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);\n border: 1px solid #e2e8f0;\n `,document.body.appendChild(t),this.loadDirectoryContents(),setTimeout(()=>{document.addEventListener("click",this.handleOutsideClick.bind(this),!0)},100)}removeDirectoryViewerOverlay(){const e=document.getElementById("directory-viewer-overlay");e&&(e.remove(),document.removeEventListener("click",this.handleOutsideClick.bind(this),!0))}handleOutsideClick(e){const t=document.getElementById("directory-viewer-overlay"),r=document.getElementById("working-dir-path");t&&!t.contains(e.target)&&e.target!==r&&this.removeDirectoryViewerOverlay()}loadDirectoryContents(){if(!this.socketManager||!this.socketManager.isConnected())return void this.showDirectoryError("Not connected to server");const e=this.socketManager.getSocket();if(!e)return void this.showDirectoryError("No socket connection available");e.emit("get_directory_listing",{directory:this.currentWorkingDir,limit:50});const t=r=>{e.off("directory_listing_response",t),this.handleDirectoryListingResponse(r)};e.on("directory_listing_response",t),setTimeout(()=>{e.off("directory_listing_response",t);const r=document.getElementById("directory-viewer-overlay");r&&r.querySelector(".loading-indicator")&&this.showDirectoryError("Request timeout")},5e3)}handleDirectoryListingResponse(e){const t=document.querySelector(".directory-viewer-body");if(!t)return;if(!e.success)return void this.showDirectoryError(e.error||"Failed to load directory");const r=e.files||[],o=e.directories||[];let i="";if(this.currentWorkingDir&&"/"!==this.currentWorkingDir){const e=this.currentWorkingDir.split("/").slice(0,-1).join("/")||"/";i+=`\n <div class="file-item directory-item" onclick="workingDirectoryManager.setWorkingDirectory('${e}')">\n <span class="file-icon">📁</span>\n <span class="file-name">..</span>\n <span class="file-type">parent directory</span>\n </div>\n `}o.forEach(e=>{const t=`${this.currentWorkingDir}/${e}`.replace(/\/+/g,"/");i+=`\n <div class="file-item directory-item" onclick="workingDirectoryManager.setWorkingDirectory('${t}')">\n <span class="file-icon">📁</span>\n <span class="file-name">${e}</span>\n <span class="file-type">directory</span>\n </div>\n `}),r.forEach(e=>{const t=`${this.currentWorkingDir}/${e}`.replace(/\/+/g,"/"),r=e.split(".").pop().toLowerCase(),o=this.getFileIcon(r);i+=`\n <div class="file-item" onclick="workingDirectoryManager.viewFile('${t}')">\n <span class="file-icon">${o}</span>\n <span class="file-name">${e}</span>\n <span class="file-type">${r}</span>\n </div>\n `}),""===i&&(i='<div class="no-files">Empty directory</div>'),t.innerHTML=i}showDirectoryError(e){const t=document.querySelector(".directory-viewer-body");t&&(t.innerHTML=`\n <div class="directory-error">\n <span class="error-icon">⚠️</span>\n <span class="error-message">${e}</span>\n </div>\n `)}getFileIcon(e){return{js:"📄",py:"🐍",html:"🌐",css:"🎨",json:"📋",md:"📝",txt:"📝",yml:"⚙️",yaml:"⚙️",xml:"📄",pdf:"📕",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",svg:"🖼️",zip:"📦",tar:"📦",gz:"📦",sh:"🔧",bat:"🔧",exe:"⚙️",dll:"⚙️"}[e]||"📄"}viewFile(e){this.removeDirectoryViewerOverlay(),window.showFileViewerModal?window.showFileViewerModal(e):console.warn("File viewer modal function not available")}getCurrentWorkingDir(){return this.currentWorkingDir}getSessionDirectories(){return JSON.parse(localStorage.getItem("sessionWorkingDirs")||"{}")}setSessionDirectory(e,t){const r=this.getSessionDirectories();r[e]=t,localStorage.setItem("sessionWorkingDirs",JSON.stringify(r));const o=document.getElementById("session-select");o&&o.value===e&&this.setWorkingDirectory(t)}removeSessionDirectory(e){const t=this.getSessionDirectories();delete t[e],localStorage.setItem("sessionWorkingDirs",JSON.stringify(t))}clearAllSessionDirectories(){localStorage.removeItem("sessionWorkingDirs")}extractWorkingDirectoryFromPair(e){return e.pre?.working_dir?e.pre.working_dir:e.post?.working_dir?e.post.working_dir:e.pre?.data?.working_dir?e.pre.data.working_dir:e.post?.data?.working_dir?e.post.data.working_dir:this.currentWorkingDir||this.getDefaultWorkingDir()}validateDirectoryPath(e){if(!e||"string"!=typeof e)return!1;const t=e.trim();if(0===t.length)return!1;if(t.includes("\0"))return!1;return!["Loading...","Loading","Unknown","undefined","null","Not Connected","Invalid Directory","No Directory"].includes(t)&&(!(!t.startsWith("/")&&!/^[A-Za-z]:/.test(t))||!!(t.startsWith("./")||t.startsWith("../")||/^[a-zA-Z0-9._-]+/.test(t)))}handleGitBranchResponse(e){console.log("[GIT-BRANCH-DEBUG] handleGitBranchResponse called with:",e);const t=document.getElementById("footer-git-branch");if(t){if(e.success)console.log("[GIT-BRANCH-DEBUG] Git branch request successful, branch:",e.branch),t.textContent=e.branch,t.style.display="inline",t.classList.remove("git-error"),t.classList.add("git-success");else{let r="Git Error";const o=e.error||"Unknown error";r=o.includes("Directory not found")||o.includes("does not exist")?"Dir Not Found":o.includes("Not a directory")?"Invalid Path":o.includes("Not a git repository")?"No Git Repo":o.includes("git")?"Git Error":"Unknown",console.log("[GIT-BRANCH-DEBUG] Git branch request failed:",o,"- showing as:",r),t.textContent=r,t.style.display="inline",t.classList.remove("git-success"),t.classList.add("git-error")}e.original_working_dir&&console.log("[GIT-BRANCH-DEBUG] Server received original working_dir:",this.repr(e.original_working_dir)),e.working_dir&&console.log("[GIT-BRANCH-DEBUG] Server used working_dir:",this.repr(e.working_dir)),e.git_error&&console.log("[GIT-BRANCH-DEBUG] Git command stderr:",e.git_error)}else console.warn("[GIT-BRANCH-DEBUG] footer-git-branch element not found")}isWorkingDirectoryReady(){const e=this.getCurrentWorkingDir();return this.validateDirectoryPath(e)&&"Loading..."!==e&&"Unknown"!==e}whenDirectoryReady(e,t=5e3){const r=Date.now(),o=()=>{this.isWorkingDirectoryReady()?e():Date.now()-r<t?setTimeout(o,100):console.warn("[WORKING-DIR-DEBUG] Timeout waiting for directory to be ready")};o()}repr(e){return null===e?"null":void 0===e?"undefined":"string"==typeof e?`"${e}"`:String(e)}cleanup(){this.footerDirObserver&&(this.footerDirObserver.disconnect(),this.footerDirObserver=null),console.log("Working directory manager cleaned up")}};
|
|
2
|
-
//# sourceMappingURL=working-directory.js.map
|