claude-flow 2.0.0-alpha.60 → 2.0.0-alpha.62
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.
- package/.claude/commands/sparc/analyzer.md +24 -77
- package/.claude/commands/sparc/architect.md +25 -76
- package/.claude/commands/sparc/batch-executor.md +28 -78
- package/.claude/commands/sparc/coder.md +28 -79
- package/.claude/commands/sparc/debugger.md +26 -76
- package/.claude/commands/sparc/designer.md +25 -75
- package/.claude/commands/sparc/documenter.md +26 -75
- package/.claude/commands/sparc/innovator.md +26 -76
- package/.claude/commands/sparc/memory-manager.md +28 -77
- package/.claude/commands/sparc/optimizer.md +26 -76
- package/.claude/commands/sparc/orchestrator.md +23 -74
- package/.claude/commands/sparc/researcher.md +26 -77
- package/.claude/commands/sparc/reviewer.md +26 -76
- package/.claude/commands/sparc/sparc-modes.md +38 -358
- package/.claude/commands/sparc/swarm-coordinator.md +28 -77
- package/.claude/commands/sparc/tdd.md +28 -78
- package/.claude/commands/sparc/tester.md +26 -76
- package/.claude/commands/sparc/workflow-manager.md +28 -77
- package/.claude/commands/swarm/analysis.md +14 -17
- package/.claude/commands/swarm/development.md +14 -16
- package/.claude/commands/swarm/examples.md +20 -53
- package/.claude/commands/swarm/maintenance.md +14 -17
- package/.claude/commands/swarm/optimization.md +15 -17
- package/.claude/commands/swarm/research.md +14 -17
- package/.claude/commands/swarm/testing.md +15 -17
- package/.claude/config.json +32 -11
- package/CHANGELOG.md +113 -0
- package/bin/claude-flow +1 -1
- package/dist/adapters/cliffy-node.d.ts.map +1 -1
- package/dist/adapters/cliffy-node.js +13 -7
- package/dist/adapters/cliffy-node.js.map +1 -1
- package/dist/agents/agent-manager.d.ts.map +1 -1
- package/dist/agents/agent-manager.js +77 -65
- package/dist/agents/agent-manager.js.map +1 -1
- package/dist/agents/agent-registry.d.ts.map +1 -1
- package/dist/agents/agent-registry.js +38 -30
- package/dist/agents/agent-registry.js.map +1 -1
- package/dist/api/claude-client.d.ts.map +1 -1
- package/dist/api/claude-client.js +22 -16
- package/dist/api/claude-client.js.map +1 -1
- package/dist/cli/agents/analyst.d.ts.map +1 -1
- package/dist/cli/agents/analyst.js +94 -114
- package/dist/cli/agents/analyst.js.map +1 -1
- package/dist/cli/agents/architect.d.ts.map +1 -1
- package/dist/cli/agents/architect.js +100 -114
- package/dist/cli/agents/architect.js.map +1 -1
- package/dist/cli/agents/base-agent.d.ts.map +1 -1
- package/dist/cli/agents/base-agent.js +27 -27
- package/dist/cli/agents/base-agent.js.map +1 -1
- package/dist/cli/agents/capabilities.d.ts.map +1 -1
- package/dist/cli/agents/capabilities.js +49 -51
- package/dist/cli/agents/capabilities.js.map +1 -1
- package/dist/cli/agents/coder.d.ts.map +1 -1
- package/dist/cli/agents/coder.js +92 -98
- package/dist/cli/agents/coder.js.map +1 -1
- package/dist/cli/agents/coordinator.d.ts.map +1 -1
- package/dist/cli/agents/coordinator.js +59 -64
- package/dist/cli/agents/coordinator.js.map +1 -1
- package/dist/cli/agents/hive-agents.d.ts.map +1 -1
- package/dist/cli/agents/hive-agents.js +22 -24
- package/dist/cli/agents/hive-agents.js.map +1 -1
- package/dist/cli/agents/index.d.ts.map +1 -1
- package/dist/cli/agents/index.js +17 -17
- package/dist/cli/agents/index.js.map +1 -1
- package/dist/cli/agents/researcher.d.ts.map +1 -1
- package/dist/cli/agents/researcher.js +41 -61
- package/dist/cli/agents/researcher.js.map +1 -1
- package/dist/cli/agents/tester.d.ts.map +1 -1
- package/dist/cli/agents/tester.js +78 -90
- package/dist/cli/agents/tester.js.map +1 -1
- package/dist/cli/cli-core.d.ts +4 -1
- package/dist/cli/cli-core.d.ts.map +1 -1
- package/dist/cli/cli-core.js +40 -39
- package/dist/cli/cli-core.js.map +1 -1
- package/dist/cli/command-registry.d.ts.map +1 -1
- package/dist/cli/command-registry.js +99 -74
- package/dist/cli/command-registry.js.map +1 -1
- package/dist/cli/commands/advanced-memory-commands.d.ts.map +1 -1
- package/dist/cli/commands/advanced-memory-commands.js +49 -40
- package/dist/cli/commands/advanced-memory-commands.js.map +1 -1
- package/dist/cli/commands/agent-simple.d.ts +3 -0
- package/dist/cli/commands/agent-simple.d.ts.map +1 -1
- package/dist/cli/commands/agent-simple.js +30 -27
- package/dist/cli/commands/agent-simple.js.map +1 -1
- package/dist/cli/commands/agent.d.ts.map +1 -1
- package/dist/cli/commands/agent.js +53 -40
- package/dist/cli/commands/agent.js.map +1 -1
- package/dist/cli/commands/claude-api.js +4 -4
- package/dist/cli/commands/claude-api.js.map +1 -1
- package/dist/cli/commands/claude.d.ts.map +1 -1
- package/dist/cli/commands/claude.js +2 -2
- package/dist/cli/commands/claude.js.map +1 -1
- package/dist/cli/commands/config-integration.d.ts +7 -1
- package/dist/cli/commands/config-integration.d.ts.map +1 -1
- package/dist/cli/commands/config-integration.js +18 -9
- package/dist/cli/commands/config-integration.js.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +2 -3
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/enterprise.d.ts.map +1 -1
- package/dist/cli/commands/enterprise.js +115 -95
- package/dist/cli/commands/enterprise.js.map +1 -1
- package/dist/cli/commands/help-new.d.ts +7 -0
- package/dist/cli/commands/help-new.d.ts.map +1 -0
- package/dist/cli/commands/help-new.js +236 -0
- package/dist/cli/commands/help-new.js.map +1 -0
- package/dist/cli/commands/help.d.ts +2 -1
- package/dist/cli/commands/help.d.ts.map +1 -1
- package/dist/cli/commands/help.js +283 -133
- package/dist/cli/commands/help.js.map +1 -1
- package/dist/cli/commands/hive-mind/index.d.ts +1 -1
- package/dist/cli/commands/hive-mind/index.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/index.js +1 -1
- package/dist/cli/commands/hive-mind/index.js.map +1 -1
- package/dist/cli/commands/hive-mind/init.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/init.js.map +1 -1
- package/dist/cli/commands/hive-mind/optimize-memory.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/optimize-memory.js +35 -26
- package/dist/cli/commands/hive-mind/optimize-memory.js.map +1 -1
- package/dist/cli/commands/hive-mind/pause.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/pause.js +8 -6
- package/dist/cli/commands/hive-mind/pause.js.map +1 -1
- package/dist/cli/commands/hive-mind/ps.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/ps.js +17 -12
- package/dist/cli/commands/hive-mind/ps.js.map +1 -1
- package/dist/cli/commands/hive-mind/resume.js +12 -10
- package/dist/cli/commands/hive-mind/resume.js.map +1 -1
- package/dist/cli/commands/hive-mind/spawn.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/spawn.js +20 -11
- package/dist/cli/commands/hive-mind/spawn.js.map +1 -1
- package/dist/cli/commands/hive-mind/status.js +17 -22
- package/dist/cli/commands/hive-mind/status.js.map +1 -1
- package/dist/cli/commands/hive-mind/stop.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/stop.js +23 -15
- package/dist/cli/commands/hive-mind/stop.js.map +1 -1
- package/dist/cli/commands/hive-mind/task.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/task.js +25 -19
- package/dist/cli/commands/hive-mind/task.js.map +1 -1
- package/dist/cli/commands/hive-mind/wizard.d.ts.map +1 -1
- package/dist/cli/commands/hive-mind/wizard.js +86 -68
- package/dist/cli/commands/hive-mind/wizard.js.map +1 -1
- package/dist/cli/commands/hive.js +73 -38
- package/dist/cli/commands/hive.js.map +1 -1
- package/dist/cli/commands/hook-validator.d.ts.map +1 -1
- package/dist/cli/commands/hook-validator.js +4 -2
- package/dist/cli/commands/hook-validator.js.map +1 -1
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +8 -8
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +850 -784
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +8 -16
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/memory.d.ts.map +1 -1
- package/dist/cli/commands/memory.js +8 -8
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/migrate.d.ts.map +1 -1
- package/dist/cli/commands/migrate.js +3 -3
- package/dist/cli/commands/migrate.js.map +1 -1
- package/dist/cli/commands/monitor.d.ts.map +1 -1
- package/dist/cli/commands/monitor.js +50 -34
- package/dist/cli/commands/monitor.js.map +1 -1
- package/dist/cli/commands/ruv-swarm.d.ts +7 -1
- package/dist/cli/commands/ruv-swarm.d.ts.map +1 -1
- package/dist/cli/commands/ruv-swarm.js +6 -6
- package/dist/cli/commands/ruv-swarm.js.map +1 -1
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +22 -17
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/commands/sparc.d.ts +1 -1
- package/dist/cli/commands/sparc.d.ts.map +1 -1
- package/dist/cli/commands/sparc.js +146 -126
- package/dist/cli/commands/sparc.js.map +1 -1
- package/dist/cli/commands/start/event-emitter.js +1 -1
- package/dist/cli/commands/start/event-emitter.js.map +1 -1
- package/dist/cli/commands/start/process-manager.d.ts.map +1 -1
- package/dist/cli/commands/start/process-manager.js +20 -18
- package/dist/cli/commands/start/process-manager.js.map +1 -1
- package/dist/cli/commands/start/process-ui-simple.d.ts +4 -0
- package/dist/cli/commands/start/process-ui-simple.d.ts.map +1 -1
- package/dist/cli/commands/start/process-ui-simple.js +2 -2
- package/dist/cli/commands/start/process-ui-simple.js.map +1 -1
- package/dist/cli/commands/start/start-command.d.ts.map +1 -1
- package/dist/cli/commands/start/start-command.js +27 -15
- package/dist/cli/commands/start/start-command.js.map +1 -1
- package/dist/cli/commands/start/system-monitor.d.ts +3 -0
- package/dist/cli/commands/start/system-monitor.d.ts.map +1 -1
- package/dist/cli/commands/start/system-monitor.js +16 -18
- package/dist/cli/commands/start/system-monitor.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +28 -33
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/swarm-spawn.d.ts.map +1 -1
- package/dist/cli/commands/swarm-spawn.js +1 -1
- package/dist/cli/commands/swarm-spawn.js.map +1 -1
- package/dist/cli/commands/swarm.d.ts +4 -1
- package/dist/cli/commands/swarm.d.ts.map +1 -1
- package/dist/cli/commands/swarm.js +23 -18
- package/dist/cli/commands/swarm.js.map +1 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts.map +1 -1
- package/dist/cli/commands/workflow.js +49 -45
- package/dist/cli/commands/workflow.js.map +1 -1
- package/dist/cli/completion.d.ts +3 -0
- package/dist/cli/completion.d.ts.map +1 -1
- package/dist/cli/completion.js +15 -5
- package/dist/cli/completion.js.map +1 -1
- package/dist/cli/formatter.d.ts +3 -0
- package/dist/cli/formatter.d.ts.map +1 -1
- package/dist/cli/formatter.js +3 -3
- package/dist/cli/formatter.js.map +1 -1
- package/dist/cli/help-formatter.d.ts +49 -0
- package/dist/cli/help-formatter.d.ts.map +1 -0
- package/dist/cli/help-formatter.js +108 -0
- package/dist/cli/help-formatter.js.map +1 -0
- package/dist/cli/index-remote.d.ts +4 -0
- package/dist/cli/index-remote.d.ts.map +1 -1
- package/dist/cli/index-remote.js +1 -1
- package/dist/cli/index-remote.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +32 -34
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/batch-tools.d.ts.map +1 -1
- package/dist/cli/init/batch-tools.js.map +1 -1
- package/dist/cli/init/claude-config.d.ts.map +1 -1
- package/dist/cli/init/claude-config.js +111 -106
- package/dist/cli/init/claude-config.js.map +1 -1
- package/dist/cli/init/directory-structure.d.ts.map +1 -1
- package/dist/cli/init/directory-structure.js +3 -3
- package/dist/cli/init/directory-structure.js.map +1 -1
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/index.js +1 -1
- package/dist/cli/init/index.js.map +1 -1
- package/dist/cli/init/sparc-environment.d.ts.map +1 -1
- package/dist/cli/init/sparc-environment.js +69 -69
- package/dist/cli/init/sparc-environment.js.map +1 -1
- package/dist/cli/init/swarm-commands.d.ts.map +1 -1
- package/dist/cli/init/swarm-commands.js +1 -1
- package/dist/cli/init/swarm-commands.js.map +1 -1
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +6 -6
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/node-compat.d.ts.map +1 -1
- package/dist/cli/node-compat.js +24 -18
- package/dist/cli/node-compat.js.map +1 -1
- package/dist/cli/node-repl.d.ts +4 -0
- package/dist/cli/node-repl.d.ts.map +1 -1
- package/dist/cli/node-repl.js +24 -30
- package/dist/cli/node-repl.js.map +1 -1
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +81 -70
- package/dist/cli/repl.js.map +1 -1
- package/dist/cli/runtime-detector.d.ts.map +1 -1
- package/dist/cli/runtime-detector.js +11 -7
- package/dist/cli/runtime-detector.js.map +1 -1
- package/dist/cli/simple-cli.d.ts +4 -0
- package/dist/cli/simple-cli.d.ts.map +1 -1
- package/dist/cli/simple-cli.js +109 -95
- package/dist/cli/simple-cli.js.map +1 -1
- package/dist/cli/simple-commands/analysis.d.ts.map +1 -1
- package/dist/cli/simple-commands/analysis.js +18 -11
- package/dist/cli/simple-commands/analysis.js.map +1 -1
- package/dist/cli/simple-commands/automation.js +32 -17
- package/dist/cli/simple-commands/automation.js.map +1 -1
- package/dist/cli/simple-commands/batch-manager.js +44 -39
- package/dist/cli/simple-commands/batch-manager.js.map +1 -1
- package/dist/cli/simple-commands/config.d.ts.map +1 -1
- package/dist/cli/simple-commands/config.js +22 -21
- package/dist/cli/simple-commands/config.js.map +1 -1
- package/dist/cli/simple-commands/coordination.d.ts.map +1 -1
- package/dist/cli/simple-commands/coordination.js +12 -12
- package/dist/cli/simple-commands/coordination.js.map +1 -1
- package/dist/cli/simple-commands/fix-hook-variables.d.ts.map +1 -1
- package/dist/cli/simple-commands/fix-hook-variables.js +36 -30
- package/dist/cli/simple-commands/fix-hook-variables.js.map +1 -1
- package/dist/cli/simple-commands/github.d.ts.map +1 -1
- package/dist/cli/simple-commands/github.js +15 -15
- package/dist/cli/simple-commands/github.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/auto-save-middleware.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/auto-save-middleware.js +12 -10
- package/dist/cli/simple-commands/hive-mind/auto-save-middleware.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/communication.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/communication.js +42 -45
- package/dist/cli/simple-commands/hive-mind/communication.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/core.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/core.js +97 -89
- package/dist/cli/simple-commands/hive-mind/core.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/db-optimizer.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/db-optimizer.js +114 -59
- package/dist/cli/simple-commands/hive-mind/db-optimizer.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/mcp-wrapper.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js +182 -103
- package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/memory.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/memory.js +105 -75
- package/dist/cli/simple-commands/hive-mind/memory.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/performance-optimizer.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/performance-optimizer.js +45 -43
- package/dist/cli/simple-commands/hive-mind/performance-optimizer.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/queen.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind/queen.js +101 -88
- package/dist/cli/simple-commands/hive-mind/queen.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind/session-manager.js +75 -53
- package/dist/cli/simple-commands/hive-mind/session-manager.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind-optimize.js +18 -18
- package/dist/cli/simple-commands/hive-mind-optimize.js.map +1 -1
- package/dist/cli/simple-commands/hive-mind.d.ts.map +1 -1
- package/dist/cli/simple-commands/hive-mind.js +207 -144
- package/dist/cli/simple-commands/hive-mind.js.map +1 -1
- package/dist/cli/simple-commands/hook-safety.d.ts.map +1 -1
- package/dist/cli/simple-commands/hook-safety.js +19 -19
- package/dist/cli/simple-commands/hook-safety.js.map +1 -1
- package/dist/cli/simple-commands/hooks.d.ts.map +1 -1
- package/dist/cli/simple-commands/hooks.js +85 -71
- package/dist/cli/simple-commands/hooks.js.map +1 -1
- package/dist/cli/simple-commands/init/batch-init.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/batch-init.js +62 -55
- package/dist/cli/simple-commands/init/batch-init.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +2 -2
- package/dist/cli/simple-commands/init/claude-commands/optimized-slash-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +58 -50
- package/dist/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/slash-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/slash-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/sparc-commands.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/claude-commands/sparc-commands.js +34 -28
- package/dist/cli/simple-commands/init/claude-commands/sparc-commands.js.map +1 -1
- package/dist/cli/simple-commands/init/executable-wrapper.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/executable-wrapper.js +7 -4
- package/dist/cli/simple-commands/init/executable-wrapper.js.map +1 -1
- package/dist/cli/simple-commands/init/gitignore-updater.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/gitignore-updater.js +10 -9
- package/dist/cli/simple-commands/init/gitignore-updater.js.map +1 -1
- package/dist/cli/simple-commands/init/help.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/help.js.map +1 -1
- package/dist/cli/simple-commands/init/index.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/index.js +159 -103
- package/dist/cli/simple-commands/init/index.js.map +1 -1
- package/dist/cli/simple-commands/init/performance-monitor.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/performance-monitor.js +17 -18
- package/dist/cli/simple-commands/init/performance-monitor.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/backup-manager.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/backup-manager.js +19 -25
- package/dist/cli/simple-commands/init/rollback/backup-manager.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/index.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/index.js +18 -15
- package/dist/cli/simple-commands/init/rollback/index.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/recovery-manager.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/recovery-manager.js +49 -68
- package/dist/cli/simple-commands/init/rollback/recovery-manager.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/rollback-executor.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/rollback-executor.js +16 -24
- package/dist/cli/simple-commands/init/rollback/rollback-executor.js.map +1 -1
- package/dist/cli/simple-commands/init/rollback/state-tracker.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/rollback/state-tracker.js +25 -25
- package/dist/cli/simple-commands/init/rollback/state-tracker.js.map +1 -1
- package/dist/cli/simple-commands/init/sparc/roomodes-config.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/sparc/roomodes-config.js +57 -57
- package/dist/cli/simple-commands/init/sparc/roomodes-config.js.map +1 -1
- package/dist/cli/simple-commands/init/sparc/workflows.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/sparc/workflows.js +21 -21
- package/dist/cli/simple-commands/init/sparc/workflows.js.map +1 -1
- package/dist/cli/simple-commands/init/sparc-structure.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/sparc-structure.js +1 -1
- package/dist/cli/simple-commands/init/sparc-structure.js.map +1 -1
- package/dist/cli/simple-commands/init/templates/enhanced-templates.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/templates/enhanced-templates.js +69 -78
- package/dist/cli/simple-commands/init/templates/enhanced-templates.js.map +1 -1
- package/dist/cli/simple-commands/init/templates/sparc-modes.js +2 -2
- package/dist/cli/simple-commands/init/validation/config-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/config-validator.js +12 -16
- package/dist/cli/simple-commands/init/validation/config-validator.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/health-checker.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/health-checker.js +39 -41
- package/dist/cli/simple-commands/init/validation/health-checker.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/index.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/index.js +8 -8
- package/dist/cli/simple-commands/init/validation/index.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/mode-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/mode-validator.js +12 -12
- package/dist/cli/simple-commands/init/validation/mode-validator.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/post-init-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/post-init-validator.js +13 -13
- package/dist/cli/simple-commands/init/validation/post-init-validator.js.map +1 -1
- package/dist/cli/simple-commands/init/validation/pre-init-validator.d.ts.map +1 -1
- package/dist/cli/simple-commands/init/validation/pre-init-validator.js +19 -24
- package/dist/cli/simple-commands/init/validation/pre-init-validator.js.map +1 -1
- package/dist/cli/simple-commands/mcp.js +2 -2
- package/dist/cli/simple-commands/mcp.js.map +1 -1
- package/dist/cli/simple-commands/memory.js +4 -4
- package/dist/cli/simple-commands/memory.js.map +1 -1
- package/dist/cli/simple-commands/migrate-hooks.d.ts.map +1 -1
- package/dist/cli/simple-commands/migrate-hooks.js +3 -3
- package/dist/cli/simple-commands/migrate-hooks.js.map +1 -1
- package/dist/cli/simple-commands/monitor.d.ts.map +1 -1
- package/dist/cli/simple-commands/monitor.js +34 -26
- package/dist/cli/simple-commands/monitor.js.map +1 -1
- package/dist/cli/simple-commands/process-ui-enhanced.d.ts.map +1 -1
- package/dist/cli/simple-commands/process-ui-enhanced.js +53 -39
- package/dist/cli/simple-commands/process-ui-enhanced.js.map +1 -1
- package/dist/cli/simple-commands/sparc-modes/index.js +11 -11
- package/dist/cli/simple-commands/sparc-modes/index.js.map +1 -1
- package/dist/cli/simple-commands/sparc-modes/swarm.js +50 -50
- package/dist/cli/simple-commands/sparc.d.ts.map +1 -1
- package/dist/cli/simple-commands/sparc.js +21 -11
- package/dist/cli/simple-commands/sparc.js.map +1 -1
- package/dist/cli/simple-commands/start-ui.d.ts.map +1 -1
- package/dist/cli/simple-commands/start-ui.js +5 -3
- package/dist/cli/simple-commands/start-ui.js.map +1 -1
- package/dist/cli/simple-commands/start-wrapper.d.ts.map +1 -1
- package/dist/cli/simple-commands/start-wrapper.js +1 -1
- package/dist/cli/simple-commands/start-wrapper.js.map +1 -1
- package/dist/cli/simple-commands/status.js +14 -14
- package/dist/cli/simple-commands/status.js.map +1 -1
- package/dist/cli/simple-commands/swarm-executor.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm-executor.js +19 -19
- package/dist/cli/simple-commands/swarm-executor.js.map +1 -1
- package/dist/cli/simple-commands/swarm-metrics-integration.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm-metrics-integration.js +30 -21
- package/dist/cli/simple-commands/swarm-metrics-integration.js.map +1 -1
- package/dist/cli/simple-commands/swarm-webui-integration.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm-webui-integration.js +30 -18
- package/dist/cli/simple-commands/swarm-webui-integration.js.map +1 -1
- package/dist/cli/simple-commands/swarm.d.ts +1 -1
- package/dist/cli/simple-commands/swarm.d.ts.map +1 -1
- package/dist/cli/simple-commands/swarm.js +81 -76
- package/dist/cli/simple-commands/swarm.js.map +1 -1
- package/dist/cli/simple-commands/training.d.ts.map +1 -1
- package/dist/cli/simple-commands/training.js +7 -7
- package/dist/cli/simple-commands/training.js.map +1 -1
- package/dist/cli/simple-commands/web-server.d.ts.map +1 -1
- package/dist/cli/simple-commands/web-server.js +68 -66
- package/dist/cli/simple-commands/web-server.js.map +1 -1
- package/dist/cli/simple-mcp.d.ts.map +1 -1
- package/dist/cli/simple-mcp.js +2 -4
- package/dist/cli/simple-mcp.js.map +1 -1
- package/dist/cli/simple-orchestrator.d.ts +3 -0
- package/dist/cli/simple-orchestrator.d.ts.map +1 -1
- package/dist/cli/simple-orchestrator.js +36 -35
- package/dist/cli/simple-orchestrator.js.map +1 -1
- package/dist/cli/ui/compatible-ui.d.ts +4 -0
- package/dist/cli/ui/compatible-ui.d.ts.map +1 -1
- package/dist/cli/ui/compatible-ui.js +9 -8
- package/dist/cli/ui/compatible-ui.js.map +1 -1
- package/dist/cli/ui/fallback-handler.d.ts.map +1 -1
- package/dist/cli/ui/fallback-handler.js +4 -4
- package/dist/cli/ui/fallback-handler.js.map +1 -1
- package/dist/cli/ui/index.d.ts +2 -2
- package/dist/cli/ui/index.d.ts.map +1 -1
- package/dist/cli/ui/index.js +3 -3
- package/dist/cli/ui/index.js.map +1 -1
- package/dist/cli/utils/environment-detector.d.ts.map +1 -1
- package/dist/cli/utils/environment-detector.js +13 -11
- package/dist/cli/utils/environment-detector.js.map +1 -1
- package/dist/cli/utils/interactive-detector.d.ts.map +1 -1
- package/dist/cli/utils/interactive-detector.js +1 -1
- package/dist/cli/utils/interactive-detector.js.map +1 -1
- package/dist/cli/utils/prompt-defaults.d.ts.map +1 -1
- package/dist/cli/utils/prompt-defaults.js +6 -7
- package/dist/cli/utils/prompt-defaults.js.map +1 -1
- package/dist/cli/utils/safe-interactive.d.ts.map +1 -1
- package/dist/cli/utils/safe-interactive.js +7 -6
- package/dist/cli/utils/safe-interactive.js.map +1 -1
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +58 -50
- package/dist/cli/utils.js.map +1 -1
- package/dist/cli/validation-helper.d.ts +27 -0
- package/dist/cli/validation-helper.d.ts.map +1 -0
- package/dist/cli/validation-helper.js +72 -0
- package/dist/cli/validation-helper.js.map +1 -0
- package/dist/communication/message-bus.d.ts.map +1 -1
- package/dist/communication/message-bus.js +80 -74
- package/dist/communication/message-bus.js.map +1 -1
- package/dist/config/config-manager.d.ts +3 -0
- package/dist/config/config-manager.d.ts.map +1 -1
- package/dist/config/config-manager.js +23 -6
- package/dist/config/config-manager.js.map +1 -1
- package/dist/config/ruv-swarm-config.d.ts +6 -0
- package/dist/config/ruv-swarm-config.d.ts.map +1 -1
- package/dist/config/ruv-swarm-config.js +37 -22
- package/dist/config/ruv-swarm-config.js.map +1 -1
- package/dist/config/ruv-swarm-integration.d.ts.map +1 -1
- package/dist/config/ruv-swarm-integration.js +21 -21
- package/dist/config/ruv-swarm-integration.js.map +1 -1
- package/dist/constants/agent-types.d.ts +4 -4
- package/dist/constants/agent-types.d.ts.map +1 -1
- package/dist/constants/agent-types.js +4 -4
- package/dist/constants/agent-types.js.map +1 -1
- package/dist/coordination/advanced-scheduler.d.ts.map +1 -1
- package/dist/coordination/advanced-scheduler.js +6 -10
- package/dist/coordination/advanced-scheduler.js.map +1 -1
- package/dist/coordination/advanced-task-executor.d.ts.map +1 -1
- package/dist/coordination/advanced-task-executor.js +33 -33
- package/dist/coordination/advanced-task-executor.js.map +1 -1
- package/dist/coordination/background-executor.d.ts.map +1 -1
- package/dist/coordination/background-executor.js +17 -16
- package/dist/coordination/background-executor.js.map +1 -1
- package/dist/coordination/circuit-breaker.d.ts.map +1 -1
- package/dist/coordination/circuit-breaker.js +3 -0
- package/dist/coordination/circuit-breaker.js.map +1 -1
- package/dist/coordination/conflict-resolution.d.ts.map +1 -1
- package/dist/coordination/conflict-resolution.js +10 -8
- package/dist/coordination/conflict-resolution.js.map +1 -1
- package/dist/coordination/dependency-graph.d.ts.map +1 -1
- package/dist/coordination/dependency-graph.js +4 -3
- package/dist/coordination/dependency-graph.js.map +1 -1
- package/dist/coordination/hive-orchestrator.d.ts.map +1 -1
- package/dist/coordination/hive-orchestrator.js +29 -25
- package/dist/coordination/hive-orchestrator.js.map +1 -1
- package/dist/coordination/hive-protocol.d.ts.map +1 -1
- package/dist/coordination/hive-protocol.js +22 -23
- package/dist/coordination/hive-protocol.js.map +1 -1
- package/dist/coordination/index.d.ts +1 -1
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +1 -1
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/load-balancer.d.ts.map +1 -1
- package/dist/coordination/load-balancer.js +55 -56
- package/dist/coordination/load-balancer.js.map +1 -1
- package/dist/coordination/manager.d.ts.map +1 -1
- package/dist/coordination/manager.js +2 -8
- package/dist/coordination/manager.js.map +1 -1
- package/dist/coordination/messaging.d.ts.map +1 -1
- package/dist/coordination/messaging.js +4 -4
- package/dist/coordination/messaging.js.map +1 -1
- package/dist/coordination/metrics.d.ts.map +1 -1
- package/dist/coordination/metrics.js +11 -9
- package/dist/coordination/metrics.js.map +1 -1
- package/dist/coordination/resources.d.ts.map +1 -1
- package/dist/coordination/resources.js +10 -6
- package/dist/coordination/resources.js.map +1 -1
- package/dist/coordination/scheduler.d.ts.map +1 -1
- package/dist/coordination/scheduler.js +4 -4
- package/dist/coordination/scheduler.js.map +1 -1
- package/dist/coordination/swarm-coordinator.d.ts.map +1 -1
- package/dist/coordination/swarm-coordinator.js +32 -34
- package/dist/coordination/swarm-coordinator.js.map +1 -1
- package/dist/coordination/swarm-monitor.d.ts.map +1 -1
- package/dist/coordination/swarm-monitor.js +17 -17
- package/dist/coordination/swarm-monitor.js.map +1 -1
- package/dist/coordination/work-stealing.d.ts.map +1 -1
- package/dist/coordination/work-stealing.js +3 -0
- package/dist/coordination/work-stealing.js.map +1 -1
- package/dist/core/config.d.ts +4 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +28 -31
- package/dist/core/config.js.map +1 -1
- package/dist/core/event-bus.d.ts +3 -0
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/json-persistence.d.ts +3 -0
- package/dist/core/json-persistence.d.ts.map +1 -1
- package/dist/core/json-persistence.js +19 -23
- package/dist/core/json-persistence.js.map +1 -1
- package/dist/core/logger.d.ts +3 -0
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +2 -6
- package/dist/core/logger.js.map +1 -1
- package/dist/core/orchestrator-fixed.d.ts.map +1 -1
- package/dist/core/orchestrator-fixed.js +4 -1
- package/dist/core/orchestrator-fixed.js.map +1 -1
- package/dist/core/orchestrator.d.ts.map +1 -1
- package/dist/core/orchestrator.js +66 -33
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/persistence.d.ts +3 -0
- package/dist/core/persistence.d.ts.map +1 -1
- package/dist/core/persistence.js +25 -19
- package/dist/core/persistence.js.map +1 -1
- package/dist/enterprise/analytics-manager.d.ts.map +1 -1
- package/dist/enterprise/analytics-manager.js +141 -134
- package/dist/enterprise/analytics-manager.js.map +1 -1
- package/dist/enterprise/audit-manager.d.ts.map +1 -1
- package/dist/enterprise/audit-manager.js +144 -122
- package/dist/enterprise/audit-manager.js.map +1 -1
- package/dist/enterprise/cloud-manager.d.ts.map +1 -1
- package/dist/enterprise/cloud-manager.js +104 -99
- package/dist/enterprise/cloud-manager.js.map +1 -1
- package/dist/enterprise/deployment-manager.d.ts.map +1 -1
- package/dist/enterprise/deployment-manager.js +104 -97
- package/dist/enterprise/deployment-manager.js.map +1 -1
- package/dist/enterprise/index.d.ts +6 -6
- package/dist/enterprise/index.d.ts.map +1 -1
- package/dist/enterprise/project-manager.d.ts.map +1 -1
- package/dist/enterprise/project-manager.js +74 -66
- package/dist/enterprise/project-manager.js.map +1 -1
- package/dist/enterprise/security-manager.d.ts.map +1 -1
- package/dist/enterprise/security-manager.js +137 -129
- package/dist/enterprise/security-manager.js.map +1 -1
- package/dist/hive-mind/core/Agent.d.ts.map +1 -1
- package/dist/hive-mind/core/Agent.js +36 -36
- package/dist/hive-mind/core/Agent.js.map +1 -1
- package/dist/hive-mind/core/Communication.d.ts.map +1 -1
- package/dist/hive-mind/core/Communication.js +17 -17
- package/dist/hive-mind/core/Communication.js.map +1 -1
- package/dist/hive-mind/core/DatabaseManager.d.ts.map +1 -1
- package/dist/hive-mind/core/DatabaseManager.js +104 -58
- package/dist/hive-mind/core/DatabaseManager.js.map +1 -1
- package/dist/hive-mind/core/HiveMind.d.ts.map +1 -1
- package/dist/hive-mind/core/HiveMind.js +35 -35
- package/dist/hive-mind/core/HiveMind.js.map +1 -1
- package/dist/hive-mind/core/Memory.d.ts.map +1 -1
- package/dist/hive-mind/core/Memory.js +78 -71
- package/dist/hive-mind/core/Memory.js.map +1 -1
- package/dist/hive-mind/core/MemoryMonitor.d.ts.map +1 -1
- package/dist/hive-mind/core/MemoryMonitor.js +38 -38
- package/dist/hive-mind/core/MemoryMonitor.js.map +1 -1
- package/dist/hive-mind/core/Queen.d.ts.map +1 -1
- package/dist/hive-mind/core/Queen.js +110 -47
- package/dist/hive-mind/core/Queen.js.map +1 -1
- package/dist/hive-mind/integration/ConsensusEngine.d.ts.map +1 -1
- package/dist/hive-mind/integration/ConsensusEngine.js +25 -23
- package/dist/hive-mind/integration/ConsensusEngine.js.map +1 -1
- package/dist/hive-mind/integration/MCPToolWrapper.d.ts.map +1 -1
- package/dist/hive-mind/integration/MCPToolWrapper.js.map +1 -1
- package/dist/hive-mind/integration/SwarmOrchestrator.d.ts.map +1 -1
- package/dist/hive-mind/integration/SwarmOrchestrator.js +60 -58
- package/dist/hive-mind/integration/SwarmOrchestrator.js.map +1 -1
- package/dist/hive-mind/types.d.ts.map +1 -1
- package/dist/integration/mock-components.d.ts.map +1 -1
- package/dist/integration/mock-components.js +21 -21
- package/dist/integration/mock-components.js.map +1 -1
- package/dist/integration/system-integration.d.ts.map +1 -1
- package/dist/integration/system-integration.js +29 -12
- package/dist/integration/system-integration.js.map +1 -1
- package/dist/mcp/auth.d.ts +1 -1
- package/dist/mcp/auth.d.ts.map +1 -1
- package/dist/mcp/auth.js +8 -1
- package/dist/mcp/auth.js.map +1 -1
- package/dist/mcp/claude-code-wrapper.d.ts.map +1 -1
- package/dist/mcp/claude-code-wrapper.js +169 -68
- package/dist/mcp/claude-code-wrapper.js.map +1 -1
- package/dist/mcp/claude-flow-tools.d.ts.map +1 -1
- package/dist/mcp/claude-flow-tools.js +42 -3
- package/dist/mcp/claude-flow-tools.js.map +1 -1
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +9 -9
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/integrate-wrapper.d.ts.map +1 -1
- package/dist/mcp/integrate-wrapper.js +5 -7
- package/dist/mcp/integrate-wrapper.js.map +1 -1
- package/dist/mcp/lifecycle-manager.d.ts.map +1 -1
- package/dist/mcp/lifecycle-manager.js +8 -7
- package/dist/mcp/lifecycle-manager.js.map +1 -1
- package/dist/mcp/load-balancer.d.ts.map +1 -1
- package/dist/mcp/load-balancer.js +5 -1
- package/dist/mcp/load-balancer.js.map +1 -1
- package/dist/mcp/orchestration-integration.d.ts.map +1 -1
- package/dist/mcp/orchestration-integration.js +22 -9
- package/dist/mcp/orchestration-integration.js.map +1 -1
- package/dist/mcp/performance-monitor.d.ts.map +1 -1
- package/dist/mcp/performance-monitor.js +22 -19
- package/dist/mcp/performance-monitor.js.map +1 -1
- package/dist/mcp/protocol-manager.d.ts.map +1 -1
- package/dist/mcp/protocol-manager.js +8 -19
- package/dist/mcp/protocol-manager.js.map +1 -1
- package/dist/mcp/recovery/connection-health-monitor.d.ts.map +1 -1
- package/dist/mcp/recovery/connection-health-monitor.js +5 -5
- package/dist/mcp/recovery/connection-health-monitor.js.map +1 -1
- package/dist/mcp/recovery/connection-state-manager.d.ts +4 -0
- package/dist/mcp/recovery/connection-state-manager.d.ts.map +1 -1
- package/dist/mcp/recovery/connection-state-manager.js +13 -13
- package/dist/mcp/recovery/connection-state-manager.js.map +1 -1
- package/dist/mcp/recovery/fallback-coordinator.d.ts.map +1 -1
- package/dist/mcp/recovery/fallback-coordinator.js +5 -5
- package/dist/mcp/recovery/fallback-coordinator.js.map +1 -1
- package/dist/mcp/recovery/index.d.ts +4 -4
- package/dist/mcp/recovery/index.d.ts.map +1 -1
- package/dist/mcp/recovery/index.js +4 -4
- package/dist/mcp/recovery/index.js.map +1 -1
- package/dist/mcp/recovery/reconnection-manager.d.ts.map +1 -1
- package/dist/mcp/recovery/reconnection-manager.js +1 -1
- package/dist/mcp/recovery/reconnection-manager.js.map +1 -1
- package/dist/mcp/recovery/recovery-manager.d.ts.map +1 -1
- package/dist/mcp/recovery/recovery-manager.js +2 -4
- package/dist/mcp/recovery/recovery-manager.js.map +1 -1
- package/dist/mcp/router.d.ts.map +1 -1
- package/dist/mcp/router.js +3 -0
- package/dist/mcp/router.js.map +1 -1
- package/dist/mcp/ruv-swarm-tools.d.ts.map +1 -1
- package/dist/mcp/ruv-swarm-tools.js +132 -102
- package/dist/mcp/ruv-swarm-tools.js.map +1 -1
- package/dist/mcp/server-with-wrapper.d.ts +3 -0
- package/dist/mcp/server-with-wrapper.d.ts.map +1 -1
- package/dist/mcp/server-with-wrapper.js +2 -3
- package/dist/mcp/server-with-wrapper.js.map +1 -1
- package/dist/mcp/server-wrapper-mode.d.ts +5 -0
- package/dist/mcp/server-wrapper-mode.d.ts.map +1 -1
- package/dist/mcp/server-wrapper-mode.js +2 -3
- package/dist/mcp/server-wrapper-mode.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +12 -7
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session-manager.d.ts.map +1 -1
- package/dist/mcp/session-manager.js +4 -3
- package/dist/mcp/session-manager.js.map +1 -1
- package/dist/mcp/sparc-modes.d.ts.map +1 -1
- package/dist/mcp/sparc-modes.js +15 -15
- package/dist/mcp/sparc-modes.js.map +1 -1
- package/dist/mcp/swarm-tools.d.ts.map +1 -1
- package/dist/mcp/swarm-tools.js +100 -80
- package/dist/mcp/swarm-tools.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +28 -12
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transports/base.d.ts.map +1 -1
- package/dist/mcp/transports/base.js +3 -0
- package/dist/mcp/transports/base.js.map +1 -1
- package/dist/mcp/transports/http.d.ts +3 -0
- package/dist/mcp/transports/http.d.ts.map +1 -1
- package/dist/mcp/transports/http.js +3 -3
- package/dist/mcp/transports/http.js.map +1 -1
- package/dist/mcp/transports/stdio.d.ts +3 -0
- package/dist/mcp/transports/stdio.d.ts.map +1 -1
- package/dist/mcp/transports/stdio.js +3 -0
- package/dist/mcp/transports/stdio.js.map +1 -1
- package/dist/memory/advanced-memory-manager.d.ts.map +1 -1
- package/dist/memory/advanced-memory-manager.js +109 -100
- package/dist/memory/advanced-memory-manager.js.map +1 -1
- package/dist/memory/backends/base.d.ts.map +1 -1
- package/dist/memory/backends/base.js +3 -0
- package/dist/memory/backends/base.js.map +1 -1
- package/dist/memory/backends/markdown.d.ts +3 -0
- package/dist/memory/backends/markdown.d.ts.map +1 -1
- package/dist/memory/backends/markdown.js +8 -8
- package/dist/memory/backends/markdown.js.map +1 -1
- package/dist/memory/backends/sqlite.d.ts +3 -0
- package/dist/memory/backends/sqlite.d.ts.map +1 -1
- package/dist/memory/backends/sqlite.js +6 -2
- package/dist/memory/backends/sqlite.js.map +1 -1
- package/dist/memory/cache.d.ts.map +1 -1
- package/dist/memory/cache.js +5 -3
- package/dist/memory/cache.js.map +1 -1
- package/dist/memory/distributed-memory.d.ts.map +1 -1
- package/dist/memory/distributed-memory.js +27 -28
- package/dist/memory/distributed-memory.js.map +1 -1
- package/dist/memory/fallback-store.d.ts.map +1 -1
- package/dist/memory/fallback-store.js.map +1 -1
- package/dist/memory/in-memory-store.d.ts.map +1 -1
- package/dist/memory/in-memory-store.js +8 -8
- package/dist/memory/in-memory-store.js.map +1 -1
- package/dist/memory/indexer.d.ts.map +1 -1
- package/dist/memory/indexer.js +4 -1
- package/dist/memory/indexer.js.map +1 -1
- package/dist/memory/manager.d.ts.map +1 -1
- package/dist/memory/manager.js +17 -20
- package/dist/memory/manager.js.map +1 -1
- package/dist/memory/sqlite-store.js +12 -8
- package/dist/memory/sqlite-store.js.map +1 -1
- package/dist/memory/swarm-memory.d.ts.map +1 -1
- package/dist/memory/swarm-memory.js +37 -44
- package/dist/memory/swarm-memory.js.map +1 -1
- package/dist/migration/index.d.ts +4 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +8 -8
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/logger.d.ts.map +1 -1
- package/dist/migration/logger.js +5 -5
- package/dist/migration/logger.js.map +1 -1
- package/dist/migration/migration-analyzer.d.ts +3 -0
- package/dist/migration/migration-analyzer.d.ts.map +1 -1
- package/dist/migration/migration-analyzer.js +25 -20
- package/dist/migration/migration-analyzer.js.map +1 -1
- package/dist/migration/migration-runner.d.ts.map +1 -1
- package/dist/migration/migration-runner.js +35 -29
- package/dist/migration/migration-runner.js.map +1 -1
- package/dist/migration/migration-validator.d.ts +3 -0
- package/dist/migration/migration-validator.d.ts.map +1 -1
- package/dist/migration/migration-validator.js +22 -26
- package/dist/migration/migration-validator.js.map +1 -1
- package/dist/migration/progress-reporter.d.ts +3 -0
- package/dist/migration/progress-reporter.d.ts.map +1 -1
- package/dist/migration/progress-reporter.js +8 -8
- package/dist/migration/progress-reporter.js.map +1 -1
- package/dist/migration/rollback-manager.d.ts +3 -0
- package/dist/migration/rollback-manager.d.ts.map +1 -1
- package/dist/migration/rollback-manager.js +29 -26
- package/dist/migration/rollback-manager.js.map +1 -1
- package/dist/monitoring/diagnostics.d.ts.map +1 -1
- package/dist/monitoring/diagnostics.js +49 -37
- package/dist/monitoring/diagnostics.js.map +1 -1
- package/dist/monitoring/health-check.d.ts.map +1 -1
- package/dist/monitoring/health-check.js +24 -25
- package/dist/monitoring/health-check.js.map +1 -1
- package/dist/monitoring/real-time-monitor.d.ts.map +1 -1
- package/dist/monitoring/real-time-monitor.js +71 -58
- package/dist/monitoring/real-time-monitor.js.map +1 -1
- package/dist/resources/resource-manager.d.ts.map +1 -1
- package/dist/resources/resource-manager.js +96 -83
- package/dist/resources/resource-manager.js.map +1 -1
- package/dist/swarm/claude-flow-executor.d.ts.map +1 -1
- package/dist/swarm/claude-flow-executor.js +37 -31
- package/dist/swarm/claude-flow-executor.js.map +1 -1
- package/dist/swarm/coordinator.d.ts.map +1 -1
- package/dist/swarm/coordinator.js +330 -280
- package/dist/swarm/coordinator.js.map +1 -1
- package/dist/swarm/direct-executor.d.ts.map +1 -1
- package/dist/swarm/direct-executor.js +44 -37
- package/dist/swarm/direct-executor.js.map +1 -1
- package/dist/swarm/executor-v2.d.ts.map +1 -1
- package/dist/swarm/executor-v2.js +28 -27
- package/dist/swarm/executor-v2.js.map +1 -1
- package/dist/swarm/executor.d.ts +3 -0
- package/dist/swarm/executor.d.ts.map +1 -1
- package/dist/swarm/executor.js +58 -52
- package/dist/swarm/executor.js.map +1 -1
- package/dist/swarm/index.d.ts.map +1 -1
- package/dist/swarm/index.js +2 -2
- package/dist/swarm/index.js.map +1 -1
- package/dist/swarm/json-output-aggregator.d.ts.map +1 -1
- package/dist/swarm/json-output-aggregator.js +20 -19
- package/dist/swarm/json-output-aggregator.js.map +1 -1
- package/dist/swarm/memory.d.ts.map +1 -1
- package/dist/swarm/memory.js +67 -67
- package/dist/swarm/memory.js.map +1 -1
- package/dist/swarm/optimizations/async-file-manager.d.ts +4 -0
- package/dist/swarm/optimizations/async-file-manager.d.ts.map +1 -1
- package/dist/swarm/optimizations/async-file-manager.js +19 -23
- package/dist/swarm/optimizations/async-file-manager.js.map +1 -1
- package/dist/swarm/optimizations/circular-buffer.d.ts.map +1 -1
- package/dist/swarm/optimizations/circular-buffer.js +2 -4
- package/dist/swarm/optimizations/circular-buffer.js.map +1 -1
- package/dist/swarm/optimizations/connection-pool.d.ts.map +1 -1
- package/dist/swarm/optimizations/connection-pool.js +12 -13
- package/dist/swarm/optimizations/connection-pool.js.map +1 -1
- package/dist/swarm/optimizations/index.js +2 -2
- package/dist/swarm/optimizations/optimized-executor.d.ts.map +1 -1
- package/dist/swarm/optimizations/optimized-executor.js +23 -29
- package/dist/swarm/optimizations/optimized-executor.js.map +1 -1
- package/dist/swarm/optimizations/ttl-map.d.ts.map +1 -1
- package/dist/swarm/optimizations/ttl-map.js +4 -4
- package/dist/swarm/optimizations/ttl-map.js.map +1 -1
- package/dist/swarm/prompt-cli.d.ts.map +1 -1
- package/dist/swarm/prompt-cli.js +18 -13
- package/dist/swarm/prompt-cli.js.map +1 -1
- package/dist/swarm/prompt-copier-enhanced.d.ts.map +1 -1
- package/dist/swarm/prompt-copier-enhanced.js +12 -12
- package/dist/swarm/prompt-copier-enhanced.js.map +1 -1
- package/dist/swarm/prompt-copier.d.ts.map +1 -1
- package/dist/swarm/prompt-copier.js +15 -18
- package/dist/swarm/prompt-copier.js.map +1 -1
- package/dist/swarm/prompt-manager.d.ts.map +1 -1
- package/dist/swarm/prompt-manager.js +27 -21
- package/dist/swarm/prompt-manager.js.map +1 -1
- package/dist/swarm/prompt-utils.d.ts.map +1 -1
- package/dist/swarm/prompt-utils.js +34 -32
- package/dist/swarm/prompt-utils.js.map +1 -1
- package/dist/swarm/sparc-executor.d.ts.map +1 -1
- package/dist/swarm/sparc-executor.js +189 -123
- package/dist/swarm/sparc-executor.js.map +1 -1
- package/dist/swarm/strategies/auto.d.ts.map +1 -1
- package/dist/swarm/strategies/auto.js +105 -86
- package/dist/swarm/strategies/auto.js.map +1 -1
- package/dist/swarm/strategies/base.d.ts.map +1 -1
- package/dist/swarm/strategies/base.js +14 -11
- package/dist/swarm/strategies/base.js.map +1 -1
- package/dist/swarm/strategies/research.d.ts.map +1 -1
- package/dist/swarm/strategies/research.js +76 -71
- package/dist/swarm/strategies/research.js.map +1 -1
- package/dist/swarm/types.d.ts.map +1 -1
- package/dist/swarm/types.js +3 -0
- package/dist/swarm/types.js.map +1 -1
- package/dist/swarm/workers/copy-worker.js +4 -4
- package/dist/swarm/workers/copy-worker.js.map +1 -1
- package/dist/task/commands.d.ts.map +1 -1
- package/dist/task/commands.js +11 -7
- package/dist/task/commands.js.map +1 -1
- package/dist/task/coordination.d.ts.map +1 -1
- package/dist/task/coordination.js +75 -70
- package/dist/task/coordination.js.map +1 -1
- package/dist/task/engine.d.ts.map +1 -1
- package/dist/task/engine.js +34 -32
- package/dist/task/engine.js.map +1 -1
- package/dist/task/index.d.ts +3 -3
- package/dist/task/index.d.ts.map +1 -1
- package/dist/task/index.js +11 -11
- package/dist/task/index.js.map +1 -1
- package/dist/terminal/adapters/native.d.ts.map +1 -1
- package/dist/terminal/adapters/native.js +6 -6
- package/dist/terminal/adapters/native.js.map +1 -1
- package/dist/terminal/adapters/vscode.d.ts +3 -0
- package/dist/terminal/adapters/vscode.d.ts.map +1 -1
- package/dist/terminal/adapters/vscode.js +6 -4
- package/dist/terminal/adapters/vscode.js.map +1 -1
- package/dist/terminal/manager.d.ts.map +1 -1
- package/dist/terminal/manager.js +6 -8
- package/dist/terminal/manager.js.map +1 -1
- package/dist/terminal/pool.d.ts.map +1 -1
- package/dist/terminal/pool.js +3 -0
- package/dist/terminal/pool.js.map +1 -1
- package/dist/terminal/session.d.ts.map +1 -1
- package/dist/terminal/session.js +6 -2
- package/dist/terminal/session.js.map +1 -1
- package/dist/ui/hive-dashboard.d.ts.map +1 -1
- package/dist/ui/hive-dashboard.js +52 -33
- package/dist/ui/hive-dashboard.js.map +1 -1
- package/dist/utils/error-handler.d.ts.map +1 -1
- package/dist/utils/error-handler.js +1 -1
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/helpers.d.ts +3 -0
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +5 -8
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/npx-isolated-cache.js +3 -3
- package/dist/utils/npx-isolated-cache.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +8 -4
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/type-guards.d.ts +1 -1
- package/dist/utils/type-guards.d.ts.map +1 -1
- package/dist/utils/type-guards.js +11 -10
- package/dist/utils/type-guards.js.map +1 -1
- package/package.json +7 -6
- package/src/adapters/cliffy-node.ts +27 -22
- package/src/agents/agent-manager.ts +145 -121
- package/src/agents/agent-registry.ts +77 -70
- package/src/api/claude-client.ts +59 -38
- package/src/api/routes/analysis.js +750 -735
- package/src/cli/__tests__/command-registry.test.js +42 -32
- package/src/cli/__tests__/simple-cli.test.js +42 -37
- package/src/cli/__tests__/utils.test.js +9 -9
- package/src/cli/agents/README.md +30 -4
- package/src/cli/agents/analyst.ts +161 -163
- package/src/cli/agents/architect.ts +126 -131
- package/src/cli/agents/base-agent.ts +48 -47
- package/src/cli/agents/capabilities.ts +87 -85
- package/src/cli/agents/coder.ts +127 -120
- package/src/cli/agents/coordinator.ts +72 -72
- package/src/cli/agents/hive-agents.ts +96 -70
- package/src/cli/agents/index.ts +70 -55
- package/src/cli/agents/researcher.ts +63 -74
- package/src/cli/agents/tester.ts +91 -98
- package/src/cli/cli-core.ts +56 -47
- package/src/cli/command-registry.js +125 -83
- package/src/cli/commands/advanced-memory-commands.ts +210 -142
- package/src/cli/commands/agent-simple.ts +146 -114
- package/src/cli/commands/agent.ts +119 -95
- package/src/cli/commands/claude-api.ts +19 -15
- package/src/cli/commands/claude.ts +96 -88
- package/src/cli/commands/config-integration.ts +120 -101
- package/src/cli/commands/config.ts +10 -8
- package/src/cli/commands/enterprise.ts +323 -187
- package/src/cli/commands/help-new.ts +246 -0
- package/src/cli/commands/help.ts +326 -183
- package/src/cli/commands/hive-mind/index.ts +3 -3
- package/src/cli/commands/hive-mind/init.ts +19 -12
- package/src/cli/commands/hive-mind/optimize-memory.ts +83 -53
- package/src/cli/commands/hive-mind/pause.ts +27 -25
- package/src/cli/commands/hive-mind/ps.ts +43 -37
- package/src/cli/commands/hive-mind/resume.ts +26 -26
- package/src/cli/commands/hive-mind/spawn.ts +37 -29
- package/src/cli/commands/hive-mind/status.ts +51 -51
- package/src/cli/commands/hive-mind/stop.ts +56 -51
- package/src/cli/commands/hive-mind/task.ts +65 -54
- package/src/cli/commands/hive-mind/wizard.ts +181 -167
- package/src/cli/commands/hive.ts +136 -96
- package/src/cli/commands/hook-types.ts +2 -2
- package/src/cli/commands/hook-validator.ts +8 -4
- package/src/cli/commands/hook.ts +44 -42
- package/src/cli/commands/index.ts +1162 -1031
- package/src/cli/commands/mcp.ts +105 -94
- package/src/cli/commands/memory.ts +24 -21
- package/src/cli/commands/migrate.ts +24 -24
- package/src/cli/commands/monitor.ts +123 -93
- package/src/cli/commands/ruv-swarm.ts +131 -122
- package/src/cli/commands/session.ts +60 -45
- package/src/cli/commands/sparc.ts +170 -139
- package/src/cli/commands/start/event-emitter.ts +2 -2
- package/src/cli/commands/start/index.ts +1 -1
- package/src/cli/commands/start/process-manager.ts +30 -47
- package/src/cli/commands/start/process-ui-simple.ts +60 -49
- package/src/cli/commands/start/process-ui.ts +1 -1
- package/src/cli/commands/start/start-command.ts +104 -75
- package/src/cli/commands/start/system-monitor.ts +35 -41
- package/src/cli/commands/start/types.ts +3 -3
- package/src/cli/commands/start.ts +1 -1
- package/src/cli/commands/status.ts +67 -67
- package/src/cli/commands/swarm-spawn.ts +21 -12
- package/src/cli/commands/swarm.ts +221 -150
- package/src/cli/commands/task.ts +55 -55
- package/src/cli/commands/workflow.ts +174 -157
- package/src/cli/completion.ts +34 -19
- package/src/cli/create-enhanced-task.js +49 -17
- package/src/cli/formatter.ts +38 -37
- package/src/cli/help-formatter.js +145 -0
- package/src/cli/help-formatter.ts +173 -0
- package/src/cli/help-text.js +273 -6
- package/src/cli/index-remote.ts +12 -9
- package/src/cli/index.ts +77 -67
- package/src/cli/init/batch-tools.ts +4 -5
- package/src/cli/init/claude-config.ts +125 -118
- package/src/cli/init/directory-structure.ts +10 -11
- package/src/cli/init/index.ts +13 -13
- package/src/cli/init/sparc-environment.ts +90 -74
- package/src/cli/init/swarm-commands.ts +5 -6
- package/src/cli/init/utils.ts +1 -1
- package/src/cli/main.ts +9 -10
- package/src/cli/node-compat.js +26 -19
- package/src/cli/node-repl.ts +104 -87
- package/src/cli/repl.ts +190 -158
- package/src/cli/runtime-detector.js +24 -19
- package/src/cli/simple-cli.js +479 -394
- package/src/cli/simple-cli.ts +426 -366
- package/src/cli/simple-commands/__tests__/agent.test.js +49 -55
- package/src/cli/simple-commands/__tests__/memory.test.js +4 -401
- package/src/cli/simple-commands/__tests__/swarm.test.js +49 -55
- package/src/cli/simple-commands/__tests__/task.test.js +4 -478
- package/src/cli/simple-commands/agent.js +27 -27
- package/src/cli/simple-commands/analysis.js +179 -161
- package/src/cli/simple-commands/automation.js +226 -205
- package/src/cli/simple-commands/batch-manager.js +98 -88
- package/src/cli/simple-commands/config.js +65 -60
- package/src/cli/simple-commands/coordination.js +197 -185
- package/src/cli/simple-commands/enhanced-ui-views.js +142 -115
- package/src/cli/simple-commands/enhanced-webui-complete.js +267 -167
- package/src/cli/simple-commands/fix-hook-variables.js +73 -67
- package/src/cli/simple-commands/github/gh-coordinator.js +63 -53
- package/src/cli/simple-commands/github/github-api.js +45 -47
- package/src/cli/simple-commands/github.js +33 -34
- package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +44 -40
- package/src/cli/simple-commands/hive-mind/communication.js +198 -185
- package/src/cli/simple-commands/hive-mind/core.js +289 -304
- package/src/cli/simple-commands/hive-mind/db-optimizer.js +278 -168
- package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +352 -258
- package/src/cli/simple-commands/hive-mind/memory.js +356 -287
- package/src/cli/simple-commands/hive-mind/performance-optimizer.js +88 -79
- package/src/cli/simple-commands/hive-mind/performance-test.js +61 -49
- package/src/cli/simple-commands/hive-mind/queen.js +223 -213
- package/src/cli/simple-commands/hive-mind/session-manager.js +217 -157
- package/src/cli/simple-commands/hive-mind-optimize.js +69 -65
- package/src/cli/simple-commands/hive-mind-wizard.js +213 -211
- package/src/cli/simple-commands/hive-mind.js +602 -435
- package/src/cli/simple-commands/hive.js +12 -12
- package/src/cli/simple-commands/hook-safety.js +114 -111
- package/src/cli/simple-commands/hooks.js +1077 -1017
- package/src/cli/simple-commands/init/README.md +8 -1
- package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +27 -1
- package/src/cli/simple-commands/init/batch-init.js +105 -100
- package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +6 -6
- package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +6 -6
- package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +20 -18
- package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +85 -71
- package/src/cli/simple-commands/init/claude-commands/slash-commands.js +6 -7
- package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +42 -33
- package/src/cli/simple-commands/init/executable-wrapper.js +13 -10
- package/src/cli/simple-commands/init/gitignore-updater.js +22 -22
- package/src/cli/simple-commands/init/help.js +4 -2
- package/src/cli/simple-commands/init/index.js +405 -303
- package/src/cli/simple-commands/init/performance-monitor.js +71 -64
- package/src/cli/simple-commands/init/rollback/backup-manager.js +44 -64
- package/src/cli/simple-commands/init/rollback/index.js +31 -39
- package/src/cli/simple-commands/init/rollback/recovery-manager.js +71 -101
- package/src/cli/simple-commands/init/rollback/rollback-executor.js +34 -53
- package/src/cli/simple-commands/init/rollback/state-tracker.js +38 -49
- package/src/cli/simple-commands/init/sparc/roo-readme.js +1 -1
- package/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -77
- package/src/cli/simple-commands/init/sparc/workflows.js +37 -33
- package/src/cli/simple-commands/init/sparc-structure.js +9 -10
- package/src/cli/simple-commands/init/templates/CLAUDE.md +94 -26
- package/src/cli/simple-commands/init/templates/claude-flow-universal +9 -7
- package/src/cli/simple-commands/init/templates/claude-md.js +1 -1
- package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +15 -3
- package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +12 -2
- package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +10 -1
- package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +18 -5
- package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +13 -6
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +12 -1
- package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +13 -5
- package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +12 -1
- package/src/cli/simple-commands/init/templates/coordination-md.js +1 -1
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +116 -113
- package/src/cli/simple-commands/init/templates/memory-bank-md.js +1 -1
- package/src/cli/simple-commands/init/templates/readme-files.js +1 -1
- package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +176 -127
- package/src/cli/simple-commands/init/templates/settings.json +2 -5
- package/src/cli/simple-commands/init/templates/sparc-modes.js +3 -3
- package/src/cli/simple-commands/init/validation/config-validator.js +17 -28
- package/src/cli/simple-commands/init/validation/health-checker.js +54 -62
- package/src/cli/simple-commands/init/validation/index.js +18 -23
- package/src/cli/simple-commands/init/validation/mode-validator.js +22 -32
- package/src/cli/simple-commands/init/validation/post-init-validator.js +25 -26
- package/src/cli/simple-commands/init/validation/pre-init-validator.js +32 -36
- package/src/cli/simple-commands/init/validation/test-runner.js +55 -63
- package/src/cli/simple-commands/init.js +1 -1
- package/src/cli/simple-commands/mcp-integration-layer.js +179 -110
- package/src/cli/simple-commands/mcp.js +55 -48
- package/src/cli/simple-commands/memory.js +62 -56
- package/src/cli/simple-commands/migrate-hooks.js +9 -10
- package/src/cli/simple-commands/monitor.js +87 -67
- package/src/cli/simple-commands/process-ui-enhanced.js +207 -155
- package/src/cli/simple-commands/process-ui.js +65 -56
- package/src/cli/simple-commands/realtime-update-system.js +136 -129
- package/src/cli/simple-commands/sparc/architecture.js +352 -251
- package/src/cli/simple-commands/sparc/commands.js +122 -94
- package/src/cli/simple-commands/sparc/completion.js +274 -199
- package/src/cli/simple-commands/sparc/coordinator.js +217 -169
- package/src/cli/simple-commands/sparc/index.js +40 -36
- package/src/cli/simple-commands/sparc/phase-base.js +72 -58
- package/src/cli/simple-commands/sparc/pseudocode.js +275 -159
- package/src/cli/simple-commands/sparc/refinement.js +306 -212
- package/src/cli/simple-commands/sparc/specification.js +164 -94
- package/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/src/cli/simple-commands/sparc-modes/index.js +15 -15
- package/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/src/cli/simple-commands/sparc-modes/swarm.js +52 -52
- package/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/src/cli/simple-commands/sparc.js +87 -69
- package/src/cli/simple-commands/start-ui.js +21 -20
- package/src/cli/simple-commands/start-wrapper.js +29 -31
- package/src/cli/simple-commands/start.js +1 -1
- package/src/cli/simple-commands/status.js +53 -47
- package/src/cli/simple-commands/swarm-executor.js +47 -57
- package/src/cli/simple-commands/swarm-metrics-integration.js +119 -79
- package/src/cli/simple-commands/swarm-ui.js +120 -118
- package/src/cli/simple-commands/swarm-webui-integration.js +48 -27
- package/src/cli/simple-commands/swarm.js +216 -181
- package/src/cli/simple-commands/task.js +29 -29
- package/src/cli/simple-commands/timestamp-fix.js +28 -25
- package/src/cli/simple-commands/tool-execution-framework.js +115 -118
- package/src/cli/simple-commands/training.js +219 -194
- package/src/cli/simple-commands/web-server.js +118 -117
- package/src/cli/simple-commands/webui-validator.js +4 -3
- package/src/cli/simple-mcp.ts +14 -17
- package/src/cli/simple-orchestrator.ts +113 -101
- package/src/cli/swarm-standalone.js +20 -21
- package/src/cli/ui/compatible-ui.ts +55 -44
- package/src/cli/ui/fallback-handler.ts +19 -16
- package/src/cli/ui/index.ts +14 -15
- package/src/cli/utils/environment-detector.ts +75 -67
- package/src/cli/utils/interactive-detector.js +17 -11
- package/src/cli/utils/prompt-defaults.ts +32 -28
- package/src/cli/utils/safe-interactive.js +21 -20
- package/src/cli/utils.js +127 -110
- package/src/cli/validation-helper.js +113 -0
- package/src/cli/validation-helper.ts +128 -0
- package/src/communication/message-bus.ts +137 -124
- package/src/config/config-manager.ts +62 -30
- package/src/config/ruv-swarm-config.ts +105 -86
- package/src/config/ruv-swarm-integration.ts +38 -38
- package/src/constants/agent-types.ts +9 -8
- package/src/coordination/README.md +54 -31
- package/src/coordination/advanced-scheduler.ts +23 -26
- package/src/coordination/advanced-task-executor.ts +74 -68
- package/src/coordination/background-executor.ts +33 -30
- package/src/coordination/circuit-breaker.ts +26 -27
- package/src/coordination/conflict-resolution.ts +18 -27
- package/src/coordination/dependency-graph.ts +15 -18
- package/src/coordination/hive-orchestrator.ts +111 -81
- package/src/coordination/hive-protocol.ts +68 -77
- package/src/coordination/index.ts +3 -7
- package/src/coordination/load-balancer.ts +115 -105
- package/src/coordination/manager.ts +38 -51
- package/src/coordination/messaging.ts +19 -29
- package/src/coordination/metrics.ts +57 -60
- package/src/coordination/resources.ts +32 -37
- package/src/coordination/scheduler.ts +29 -30
- package/src/coordination/swarm-coordinator.ts +81 -70
- package/src/coordination/swarm-monitor.ts +90 -69
- package/src/coordination/work-stealing.ts +6 -13
- package/src/core/config.ts +148 -143
- package/src/core/event-bus.ts +5 -6
- package/src/core/json-persistence.ts +27 -34
- package/src/core/logger.ts +13 -16
- package/src/core/orchestrator-fixed.ts +33 -32
- package/src/core/orchestrator.ts +166 -159
- package/src/core/persistence.ts +47 -36
- package/src/enterprise/analytics-manager.ts +242 -233
- package/src/enterprise/audit-manager.ts +238 -184
- package/src/enterprise/cloud-manager.ts +167 -151
- package/src/enterprise/deployment-manager.ts +223 -180
- package/src/enterprise/index.ts +7 -7
- package/src/enterprise/project-manager.ts +151 -133
- package/src/enterprise/security-manager.ts +278 -223
- package/src/hive-mind/core/Agent.ts +112 -109
- package/src/hive-mind/core/Communication.ts +67 -69
- package/src/hive-mind/core/DatabaseManager.ts +299 -166
- package/src/hive-mind/core/HiveMind.ts +100 -96
- package/src/hive-mind/core/Memory.ts +304 -295
- package/src/hive-mind/core/MemoryMonitor.ts +46 -47
- package/src/hive-mind/core/Queen.ts +187 -114
- package/src/hive-mind/index.ts +2 -2
- package/src/hive-mind/integration/ConsensusEngine.ts +88 -92
- package/src/hive-mind/integration/MCPToolWrapper.ts +20 -72
- package/src/hive-mind/integration/SwarmOrchestrator.ts +173 -165
- package/src/hive-mind/types.ts +24 -12
- package/src/integration/mock-components.ts +42 -30
- package/src/integration/system-integration.ts +93 -69
- package/src/integration/types.ts +7 -7
- package/src/mcp/README.md +23 -4
- package/src/mcp/auth.ts +25 -18
- package/src/mcp/claude-code-wrapper.ts +257 -150
- package/src/mcp/claude-flow-tools.ts +52 -13
- package/src/mcp/client.ts +15 -13
- package/src/mcp/index.ts +22 -27
- package/src/mcp/integrate-wrapper.ts +18 -18
- package/src/mcp/lifecycle-manager.ts +30 -27
- package/src/mcp/load-balancer.ts +10 -11
- package/src/mcp/mcp-server.js +755 -370
- package/src/mcp/orchestration-integration.ts +32 -17
- package/src/mcp/performance-monitor.ts +65 -51
- package/src/mcp/protocol-manager.ts +36 -52
- package/src/mcp/recovery/connection-health-monitor.ts +40 -35
- package/src/mcp/recovery/connection-state-manager.ts +52 -50
- package/src/mcp/recovery/fallback-coordinator.ts +24 -24
- package/src/mcp/recovery/index.ts +23 -4
- package/src/mcp/recovery/reconnection-manager.ts +14 -15
- package/src/mcp/recovery/recovery-manager.ts +52 -68
- package/src/mcp/router.ts +1 -2
- package/src/mcp/ruv-swarm-tools.ts +167 -138
- package/src/mcp/ruv-swarm-wrapper.js +31 -23
- package/src/mcp/server-with-wrapper.ts +4 -5
- package/src/mcp/server-wrapper-mode.ts +5 -6
- package/src/mcp/server.ts +45 -40
- package/src/mcp/session-manager.ts +8 -11
- package/src/mcp/sparc-modes.ts +29 -28
- package/src/mcp/swarm-tools.ts +131 -114
- package/src/mcp/tests/mcp-integration.test.ts +49 -55
- package/src/mcp/tools.ts +53 -38
- package/src/mcp/transports/base.ts +4 -5
- package/src/mcp/transports/http.ts +45 -42
- package/src/mcp/transports/stdio.ts +9 -12
- package/src/memory/README.md +37 -27
- package/src/memory/advanced-memory-manager.ts +336 -279
- package/src/memory/backends/base.ts +4 -5
- package/src/memory/backends/markdown.ts +16 -22
- package/src/memory/backends/sqlite.ts +19 -15
- package/src/memory/cache.ts +18 -18
- package/src/memory/distributed-memory.ts +84 -92
- package/src/memory/enhanced-examples.js +68 -59
- package/src/memory/enhanced-memory.js +99 -80
- package/src/memory/fallback-store.js +16 -7
- package/src/memory/in-memory-store.js +31 -27
- package/src/memory/index.js +4 -4
- package/src/memory/indexer.ts +6 -10
- package/src/memory/manager.ts +45 -59
- package/src/memory/migration.js +107 -90
- package/src/memory/shared-memory.js +155 -157
- package/src/memory/sqlite-store.js +76 -59
- package/src/memory/swarm-memory.js +138 -131
- package/src/memory/swarm-memory.ts +74 -75
- package/src/memory/test-example.js +28 -30
- package/src/migration/README.md +25 -9
- package/src/migration/index.ts +13 -14
- package/src/migration/logger.ts +9 -7
- package/src/migration/migration-analyzer.ts +66 -52
- package/src/migration/migration-manifest.json +2 -6
- package/src/migration/migration-runner.ts +86 -63
- package/src/migration/migration-validator.ts +93 -68
- package/src/migration/package.json +1 -1
- package/src/migration/progress-reporter.ts +25 -21
- package/src/migration/rollback-manager.ts +79 -63
- package/src/migration/tests/migration-system.test.ts +4 -491
- package/src/migration/tsconfig.json +3 -10
- package/src/migration/types.ts +1 -1
- package/src/monitoring/diagnostics.ts +123 -97
- package/src/monitoring/health-check.ts +45 -51
- package/src/monitoring/real-time-monitor.ts +105 -92
- package/src/resources/resource-manager.ts +205 -159
- package/src/swarm/__tests__/integration.test.ts +59 -65
- package/src/swarm/__tests__/prompt-copier.test.ts +27 -27
- package/src/swarm/claude-flow-executor.ts +50 -49
- package/src/swarm/coordinator.ts +727 -635
- package/src/swarm/direct-executor.ts +80 -86
- package/src/swarm/executor-v2.ts +81 -66
- package/src/swarm/executor.ts +124 -124
- package/src/swarm/index.ts +7 -8
- package/src/swarm/json-output-aggregator.ts +56 -40
- package/src/swarm/memory.ts +152 -147
- package/src/swarm/optimizations/README.md +20 -12
- package/src/swarm/optimizations/__tests__/optimization.test.ts +84 -87
- package/src/swarm/optimizations/async-file-manager.ts +70 -80
- package/src/swarm/optimizations/circular-buffer.ts +37 -37
- package/src/swarm/optimizations/connection-pool.ts +64 -64
- package/src/swarm/optimizations/index.ts +4 -4
- package/src/swarm/optimizations/migration-guide.md +27 -16
- package/src/swarm/optimizations/optimized-executor.ts +104 -114
- package/src/swarm/optimizations/ttl-map.ts +66 -63
- package/src/swarm/prompt-cli.ts +48 -42
- package/src/swarm/prompt-copier-enhanced.ts +54 -55
- package/src/swarm/prompt-copier.ts +59 -65
- package/src/swarm/prompt-copying-README.md +49 -33
- package/src/swarm/prompt-manager.ts +69 -63
- package/src/swarm/prompt-utils.ts +71 -66
- package/src/swarm/sparc-executor.ts +298 -225
- package/src/swarm/strategies/auto.ts +367 -252
- package/src/swarm/strategies/base.ts +24 -20
- package/src/swarm/strategies/research.ts +144 -124
- package/src/swarm/types.ts +340 -309
- package/src/swarm/workers/copy-worker.ts +12 -13
- package/src/task/README.md +99 -70
- package/src/task/commands.ts +16 -8
- package/src/task/coordination.ts +209 -162
- package/src/task/engine.ts +81 -65
- package/src/task/index.ts +28 -31
- package/src/templates/claude-optimized/.claude/BATCHTOOLS_BEST_PRACTICES.md +479 -481
- package/src/templates/claude-optimized/.claude/BATCHTOOLS_GUIDE.md +210 -188
- package/src/templates/claude-optimized/.claude/MIGRATION_GUIDE.md +151 -105
- package/src/templates/claude-optimized/.claude/PERFORMANCE_BENCHMARKS.md +102 -87
- package/src/templates/claude-optimized/.claude/commands/claude-flow-help.md +18 -1
- package/src/templates/claude-optimized/.claude/commands/claude-flow-memory.md +17 -1
- package/src/templates/claude-optimized/.claude/commands/claude-flow-swarm.md +21 -1
- package/src/templates/claude-optimized/.claude/commands/sparc/architect.md +11 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/ask.md +16 -10
- package/src/templates/claude-optimized/.claude/commands/sparc/code.md +26 -7
- package/src/templates/claude-optimized/.claude/commands/sparc/debug.md +14 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/devops.md +23 -10
- package/src/templates/claude-optimized/.claude/commands/sparc/docs-writer.md +8 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/integration.md +43 -27
- package/src/templates/claude-optimized/.claude/commands/sparc/mcp.md +15 -1
- package/src/templates/claude-optimized/.claude/commands/sparc/post-deployment-monitoring-mode.md +45 -30
- package/src/templates/claude-optimized/.claude/commands/sparc/refinement-optimization-mode.md +23 -13
- package/src/templates/claude-optimized/.claude/commands/sparc/security-review.md +31 -17
- package/src/templates/claude-optimized/.claude/commands/sparc/sparc.md +54 -47
- package/src/templates/claude-optimized/.claude/commands/sparc/spec-pseudocode.md +27 -17
- package/src/templates/claude-optimized/.claude/commands/sparc/supabase-admin.md +18 -4
- package/src/templates/claude-optimized/.claude/commands/sparc/tdd.md +23 -9
- package/src/templates/claude-optimized/.claude/commands/sparc/tutorial.md +22 -16
- package/src/templates/claude-optimized/.claude/commands/sparc.md +20 -1
- package/src/templates/claude-optimized/README.md +10 -1
- package/src/templates/claude-optimized/SUMMARY.md +23 -1
- package/src/templates/claude-optimized/deploy-to-project.js +22 -10
- package/src/templates/claude-optimized/install-template.js +14 -10
- package/src/templates/claude-optimized/manifest.json +1 -1
- package/src/templates/claude-optimized/package.json +1 -1
- package/src/templates/claude-optimized/template-manager.js +8 -8
- package/src/templates/claude-optimized/validate-template.js +33 -23
- package/src/terminal/adapters/base.ts +1 -1
- package/src/terminal/adapters/native.ts +47 -47
- package/src/terminal/adapters/vscode.ts +21 -28
- package/src/terminal/manager.ts +27 -22
- package/src/terminal/pool.ts +24 -27
- package/src/terminal/session.ts +18 -18
- package/src/terminal/vscode-bridge.ts +21 -21
- package/src/tests/validation-consistency.test.ts +4 -4
- package/src/types/cliffy.d.ts +11 -14
- package/src/types/global.d.ts +1 -2
- package/src/types/index.ts +2 -2
- package/src/types/mcp.d.ts +11 -17
- package/src/types/vscode.d.ts +18 -5
- package/src/ui/console/README-analysis-tools.md +52 -2
- package/src/ui/console/README.md +33 -1
- package/src/ui/console/WORKFLOW_DESIGNER_README.md +81 -22
- package/src/ui/console/analysis-tools.html +282 -261
- package/src/ui/console/analytics.html +329 -326
- package/src/ui/console/index.html +221 -209
- package/src/ui/console/js/analysis-tools.js +815 -754
- package/src/ui/console/js/command-handler.js +226 -196
- package/src/ui/console/js/console.js +117 -119
- package/src/ui/console/js/daa-tools.js +797 -787
- package/src/ui/console/js/memory-interface.js +676 -638
- package/src/ui/console/js/memory-test.js +49 -46
- package/src/ui/console/js/memory-tools.js +181 -159
- package/src/ui/console/js/settings.js +124 -103
- package/src/ui/console/js/terminal-emulator.js +147 -130
- package/src/ui/console/js/websocket-client.js +71 -71
- package/src/ui/console/js/workflow-designer.js +1126 -1110
- package/src/ui/console/neural-networks-demo.md +45 -16
- package/src/ui/console/styles/analysis-tools.css +571 -561
- package/src/ui/console/styles/console.css +16 -12
- package/src/ui/console/styles/daa-tools.css +322 -319
- package/src/ui/console/styles/responsive.css +71 -70
- package/src/ui/console/styles/settings.css +12 -12
- package/src/ui/console/styles/workflow-designer.css +628 -584
- package/src/ui/console/test-neural-networks.js +59 -54
- package/src/ui/console/test-neural.html +194 -196
- package/src/ui/console/workflow-designer-demo.html +433 -424
- package/src/ui/hive-dashboard.ts +74 -52
- package/src/ui/web-ui/EnhancedProcessUI.js +570 -424
- package/src/ui/web-ui/EnhancedWebUI.js +65 -65
- package/src/ui/web-ui/README.md +16 -16
- package/src/ui/web-ui/components/ComponentLibrary.js +173 -124
- package/src/ui/web-ui/core/EventBus.js +27 -25
- package/src/ui/web-ui/core/MCPIntegrationLayer.js +294 -108
- package/src/ui/web-ui/core/StateManager.js +43 -46
- package/src/ui/web-ui/core/UIManager.js +120 -70
- package/src/ui/web-ui/core/ViewManager.js +16 -19
- package/src/ui/web-ui/index.js +101 -48
- package/src/ui/web-ui/neural-panel-test.js +109 -108
- package/src/ui/web-ui/test-github-view.js +11 -12
- package/src/ui/web-ui/test-neural-panel.html +219 -205
- package/src/ui/web-ui/views/DAAView.js +88 -85
- package/src/ui/web-ui/views/GitHubIntegrationTest.js +42 -42
- package/src/ui/web-ui/views/GitHubIntegrationView.js +59 -53
- package/src/ui/web-ui/views/NeuralNetworkView.js +20 -21
- package/src/ui/web-ui/views/WorkflowAutomationView.js +31 -32
- package/src/utils/error-handler.js +1 -1
- package/src/utils/error-handler.ts +9 -5
- package/src/utils/errors.ts +20 -18
- package/src/utils/formatters.ts +6 -6
- package/src/utils/helpers.ts +53 -55
- package/src/utils/npx-isolated-cache.js +16 -16
- package/src/utils/paths.ts +9 -6
- package/src/utils/timezone-utils.js +16 -16
- package/src/utils/type-guards.ts +37 -26
- package/src/utils/types.ts +2 -2
|
@@ -4,33 +4,33 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
class WorkflowDesigner {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
constructor(containerId) {
|
|
8
|
+
this.container = document.getElementById(containerId);
|
|
9
|
+
this.canvas = null;
|
|
10
|
+
this.ctx = null;
|
|
11
|
+
this.nodes = new Map();
|
|
12
|
+
this.connections = new Map();
|
|
13
|
+
this.selectedNode = null;
|
|
14
|
+
this.draggedNode = null;
|
|
15
|
+
this.dragOffset = { x: 0, y: 0 };
|
|
16
|
+
this.connectionStart = null;
|
|
17
|
+
this.executionState = new Map();
|
|
18
|
+
this.isExecuting = false;
|
|
19
|
+
this.zoom = 1;
|
|
20
|
+
this.pan = { x: 0, y: 0 };
|
|
21
|
+
|
|
22
|
+
this.init();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
init() {
|
|
26
|
+
this.createUI();
|
|
27
|
+
this.setupEventListeners();
|
|
28
|
+
this.loadTemplates();
|
|
29
|
+
this.setupNodePalette();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
createUI() {
|
|
33
|
+
this.container.innerHTML = `
|
|
34
34
|
<div class="workflow-designer">
|
|
35
35
|
<div class="toolbar">
|
|
36
36
|
<div class="toolbar-section">
|
|
@@ -147,656 +147,666 @@ class WorkflowDesigner {
|
|
|
147
147
|
</div>
|
|
148
148
|
`;
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
150
|
+
this.canvas = document.getElementById('workflowCanvas');
|
|
151
|
+
this.ctx = this.canvas.getContext('2d');
|
|
152
|
+
this.setupCanvas();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
setupCanvas() {
|
|
156
|
+
// Set up high-DPI canvas
|
|
157
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
158
|
+
const dpr = window.devicePixelRatio || 1;
|
|
159
|
+
|
|
160
|
+
this.canvas.width = rect.width * dpr;
|
|
161
|
+
this.canvas.height = rect.height * dpr;
|
|
162
|
+
this.ctx.scale(dpr, dpr);
|
|
163
|
+
|
|
164
|
+
this.canvas.style.width = rect.width + 'px';
|
|
165
|
+
this.canvas.style.height = rect.height + 'px';
|
|
166
|
+
|
|
167
|
+
this.draw();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
setupEventListeners() {
|
|
171
|
+
// Canvas events
|
|
172
|
+
this.canvas.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
173
|
+
this.canvas.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
174
|
+
this.canvas.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
175
|
+
this.canvas.addEventListener('wheel', this.handleWheel.bind(this));
|
|
176
|
+
this.canvas.addEventListener('contextmenu', this.handleContextMenu.bind(this));
|
|
177
|
+
|
|
178
|
+
// Toolbar events
|
|
179
|
+
document.getElementById('saveWorkflow').addEventListener('click', this.saveWorkflow.bind(this));
|
|
180
|
+
document.getElementById('loadWorkflow').addEventListener('click', this.loadWorkflow.bind(this));
|
|
181
|
+
document
|
|
182
|
+
.getElementById('exportWorkflow')
|
|
183
|
+
.addEventListener('click', this.exportWorkflow.bind(this));
|
|
184
|
+
document
|
|
185
|
+
.getElementById('importWorkflow')
|
|
186
|
+
.addEventListener('click', this.importWorkflow.bind(this));
|
|
187
|
+
document
|
|
188
|
+
.getElementById('importFile')
|
|
189
|
+
.addEventListener('change', this.handleFileImport.bind(this));
|
|
190
|
+
document
|
|
191
|
+
.getElementById('validateWorkflow')
|
|
192
|
+
.addEventListener('click', this.validateWorkflow.bind(this));
|
|
193
|
+
document
|
|
194
|
+
.getElementById('executeWorkflow')
|
|
195
|
+
.addEventListener('click', this.executeWorkflow.bind(this));
|
|
196
|
+
document.getElementById('stopWorkflow').addEventListener('click', this.stopWorkflow.bind(this));
|
|
197
|
+
document
|
|
198
|
+
.getElementById('zoomIn')
|
|
199
|
+
.addEventListener('click', () => this.setZoom(this.zoom * 1.2));
|
|
200
|
+
document
|
|
201
|
+
.getElementById('zoomOut')
|
|
202
|
+
.addEventListener('click', () => this.setZoom(this.zoom / 1.2));
|
|
203
|
+
document.getElementById('zoomReset').addEventListener('click', () => this.setZoom(1));
|
|
204
|
+
document.getElementById('clearCanvas').addEventListener('click', this.clearCanvas.bind(this));
|
|
205
|
+
|
|
206
|
+
// Palette search
|
|
207
|
+
document
|
|
208
|
+
.getElementById('paletteSearch')
|
|
209
|
+
.addEventListener('input', this.filterPalette.bind(this));
|
|
210
|
+
|
|
211
|
+
// Tab switching
|
|
212
|
+
document.querySelectorAll('.tab-button').forEach((button) => {
|
|
213
|
+
button.addEventListener('click', this.switchTab.bind(this));
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Window resize
|
|
217
|
+
window.addEventListener('resize', this.handleResize.bind(this));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
setupNodePalette() {
|
|
221
|
+
const nodeTypes = {
|
|
222
|
+
input: [
|
|
223
|
+
{ type: 'file-input', name: 'File Input', icon: 'fas fa-file-import' },
|
|
224
|
+
{ type: 'text-input', name: 'Text Input', icon: 'fas fa-keyboard' },
|
|
225
|
+
{ type: 'url-input', name: 'URL Input', icon: 'fas fa-link' },
|
|
226
|
+
{ type: 'api-input', name: 'API Input', icon: 'fas fa-cloud-download-alt' },
|
|
227
|
+
],
|
|
228
|
+
processing: [
|
|
229
|
+
{ type: 'transform', name: 'Transform', icon: 'fas fa-exchange-alt' },
|
|
230
|
+
{ type: 'filter', name: 'Filter', icon: 'fas fa-filter' },
|
|
231
|
+
{ type: 'aggregate', name: 'Aggregate', icon: 'fas fa-layer-group' },
|
|
232
|
+
{ type: 'sort', name: 'Sort', icon: 'fas fa-sort' },
|
|
233
|
+
],
|
|
234
|
+
output: [
|
|
235
|
+
{ type: 'file-output', name: 'File Output', icon: 'fas fa-file-export' },
|
|
236
|
+
{ type: 'display', name: 'Display', icon: 'fas fa-desktop' },
|
|
237
|
+
{ type: 'api-output', name: 'API Output', icon: 'fas fa-cloud-upload-alt' },
|
|
238
|
+
{ type: 'notification', name: 'Notification', icon: 'fas fa-bell' },
|
|
239
|
+
],
|
|
240
|
+
control: [
|
|
241
|
+
{ type: 'condition', name: 'Condition', icon: 'fas fa-code-branch' },
|
|
242
|
+
{ type: 'loop', name: 'Loop', icon: 'fas fa-redo' },
|
|
243
|
+
{ type: 'delay', name: 'Delay', icon: 'fas fa-clock' },
|
|
244
|
+
{ type: 'parallel', name: 'Parallel', icon: 'fas fa-stream' },
|
|
245
|
+
],
|
|
246
|
+
ai: [
|
|
247
|
+
{ type: 'ai-analyze', name: 'AI Analyze', icon: 'fas fa-brain' },
|
|
248
|
+
{ type: 'ai-generate', name: 'AI Generate', icon: 'fas fa-magic' },
|
|
249
|
+
{ type: 'ai-classify', name: 'AI Classify', icon: 'fas fa-tags' },
|
|
250
|
+
{ type: 'ai-summarize', name: 'AI Summarize', icon: 'fas fa-compress-alt' },
|
|
251
|
+
],
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
Object.entries(nodeTypes).forEach(([category, nodes]) => {
|
|
255
|
+
const container = document.querySelector(`[data-category="${category}"] .palette-items`);
|
|
256
|
+
nodes.forEach((node) => {
|
|
257
|
+
const item = document.createElement('div');
|
|
258
|
+
item.className = 'palette-item';
|
|
259
|
+
item.draggable = true;
|
|
260
|
+
item.dataset.nodeType = node.type;
|
|
261
|
+
item.innerHTML = `
|
|
246
262
|
<i class="${node.icon}"></i>
|
|
247
263
|
<span>${node.name}</span>
|
|
248
264
|
`;
|
|
249
|
-
|
|
250
|
-
item.addEventListener('dragstart', (e) => {
|
|
251
|
-
e.dataTransfer.setData('text/plain', node.type);
|
|
252
|
-
e.dataTransfer.effectAllowed = 'copy';
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
container.appendChild(item);
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
265
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
e.dataTransfer.dropEffect = 'copy';
|
|
266
|
+
item.addEventListener('dragstart', (e) => {
|
|
267
|
+
e.dataTransfer.setData('text/plain', node.type);
|
|
268
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
263
269
|
});
|
|
264
270
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
container.appendChild(item);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Canvas drop support
|
|
276
|
+
this.canvas.addEventListener('dragover', (e) => {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
this.canvas.addEventListener('drop', (e) => {
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
const nodeType = e.dataTransfer.getData('text/plain');
|
|
284
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
285
|
+
const x = (e.clientX - rect.left - this.pan.x) / this.zoom;
|
|
286
|
+
const y = (e.clientY - rect.top - this.pan.y) / this.zoom;
|
|
287
|
+
this.createNode(nodeType, x, y);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
createNode(type, x, y) {
|
|
292
|
+
const nodeId = 'node_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
|
|
293
|
+
const node = {
|
|
294
|
+
id: nodeId,
|
|
295
|
+
type: type,
|
|
296
|
+
x: x,
|
|
297
|
+
y: y,
|
|
298
|
+
width: 150,
|
|
299
|
+
height: 80,
|
|
300
|
+
inputs: this.getNodeInputs(type),
|
|
301
|
+
outputs: this.getNodeOutputs(type),
|
|
302
|
+
properties: this.getNodeProperties(type),
|
|
303
|
+
status: 'idle',
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
this.nodes.set(nodeId, node);
|
|
307
|
+
this.draw();
|
|
308
|
+
this.showProperties(node);
|
|
309
|
+
|
|
310
|
+
return node;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
getNodeInputs(type) {
|
|
314
|
+
const inputs = {
|
|
315
|
+
'file-input': [],
|
|
316
|
+
'text-input': [],
|
|
317
|
+
'url-input': [],
|
|
318
|
+
'api-input': [],
|
|
319
|
+
transform: [{ name: 'data', type: 'any' }],
|
|
320
|
+
filter: [{ name: 'data', type: 'any' }],
|
|
321
|
+
aggregate: [{ name: 'data', type: 'array' }],
|
|
322
|
+
sort: [{ name: 'data', type: 'array' }],
|
|
323
|
+
'file-output': [{ name: 'data', type: 'any' }],
|
|
324
|
+
display: [{ name: 'data', type: 'any' }],
|
|
325
|
+
'api-output': [{ name: 'data', type: 'any' }],
|
|
326
|
+
notification: [{ name: 'message', type: 'string' }],
|
|
327
|
+
condition: [
|
|
328
|
+
{ name: 'condition', type: 'boolean' },
|
|
329
|
+
{ name: 'data', type: 'any' },
|
|
330
|
+
],
|
|
331
|
+
loop: [{ name: 'data', type: 'array' }],
|
|
332
|
+
delay: [{ name: 'data', type: 'any' }],
|
|
333
|
+
parallel: [{ name: 'data', type: 'array' }],
|
|
334
|
+
'ai-analyze': [{ name: 'data', type: 'any' }],
|
|
335
|
+
'ai-generate': [{ name: 'prompt', type: 'string' }],
|
|
336
|
+
'ai-classify': [{ name: 'data', type: 'any' }],
|
|
337
|
+
'ai-summarize': [{ name: 'data', type: 'string' }],
|
|
338
|
+
};
|
|
339
|
+
return inputs[type] || [];
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
getNodeOutputs(type) {
|
|
343
|
+
const outputs = {
|
|
344
|
+
'file-input': [{ name: 'data', type: 'any' }],
|
|
345
|
+
'text-input': [{ name: 'text', type: 'string' }],
|
|
346
|
+
'url-input': [{ name: 'data', type: 'any' }],
|
|
347
|
+
'api-input': [{ name: 'data', type: 'any' }],
|
|
348
|
+
transform: [{ name: 'result', type: 'any' }],
|
|
349
|
+
filter: [{ name: 'result', type: 'any' }],
|
|
350
|
+
aggregate: [{ name: 'result', type: 'any' }],
|
|
351
|
+
sort: [{ name: 'result', type: 'array' }],
|
|
352
|
+
'file-output': [],
|
|
353
|
+
display: [],
|
|
354
|
+
'api-output': [{ name: 'response', type: 'any' }],
|
|
355
|
+
notification: [],
|
|
356
|
+
condition: [
|
|
357
|
+
{ name: 'true', type: 'any' },
|
|
358
|
+
{ name: 'false', type: 'any' },
|
|
359
|
+
],
|
|
360
|
+
loop: [{ name: 'result', type: 'array' }],
|
|
361
|
+
delay: [{ name: 'data', type: 'any' }],
|
|
362
|
+
parallel: [{ name: 'results', type: 'array' }],
|
|
363
|
+
'ai-analyze': [{ name: 'analysis', type: 'object' }],
|
|
364
|
+
'ai-generate': [{ name: 'generated', type: 'string' }],
|
|
365
|
+
'ai-classify': [{ name: 'categories', type: 'array' }],
|
|
366
|
+
'ai-summarize': [{ name: 'summary', type: 'string' }],
|
|
367
|
+
};
|
|
368
|
+
return outputs[type] || [];
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
getNodeProperties(type) {
|
|
372
|
+
const properties = {
|
|
373
|
+
'file-input': { path: '', format: 'auto' },
|
|
374
|
+
'text-input': { value: '', multiline: false },
|
|
375
|
+
'url-input': { url: '', method: 'GET', headers: {} },
|
|
376
|
+
'api-input': { endpoint: '', method: 'GET', headers: {}, body: '' },
|
|
377
|
+
transform: { expression: '', language: 'javascript' },
|
|
378
|
+
filter: { condition: '', language: 'javascript' },
|
|
379
|
+
aggregate: { operation: 'sum', field: '' },
|
|
380
|
+
sort: { field: '', order: 'asc' },
|
|
381
|
+
'file-output': { path: '', format: 'auto' },
|
|
382
|
+
display: { format: 'table', title: '' },
|
|
383
|
+
'api-output': { endpoint: '', method: 'POST', headers: {} },
|
|
384
|
+
notification: { type: 'info', title: '' },
|
|
385
|
+
condition: { expression: '', language: 'javascript' },
|
|
386
|
+
loop: { type: 'forEach', condition: '' },
|
|
387
|
+
delay: { duration: 1000, unit: 'ms' },
|
|
388
|
+
parallel: { maxConcurrency: 5 },
|
|
389
|
+
'ai-analyze': { model: 'gpt-4', temperature: 0.7 },
|
|
390
|
+
'ai-generate': { model: 'gpt-4', temperature: 0.7, maxTokens: 1000 },
|
|
391
|
+
'ai-classify': { model: 'gpt-4', categories: [] },
|
|
392
|
+
'ai-summarize': { model: 'gpt-4', length: 'medium' },
|
|
393
|
+
};
|
|
394
|
+
return properties[type] || {};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
handleMouseDown(e) {
|
|
398
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
399
|
+
const x = (e.clientX - rect.left - this.pan.x) / this.zoom;
|
|
400
|
+
const y = (e.clientY - rect.top - this.pan.y) / this.zoom;
|
|
401
|
+
|
|
402
|
+
// Check for node selection
|
|
403
|
+
const node = this.getNodeAt(x, y);
|
|
404
|
+
if (node) {
|
|
405
|
+
this.selectedNode = node;
|
|
406
|
+
this.draggedNode = node;
|
|
407
|
+
this.dragOffset = { x: x - node.x, y: y - node.y };
|
|
408
|
+
this.showProperties(node);
|
|
409
|
+
} else {
|
|
410
|
+
this.selectedNode = null;
|
|
411
|
+
this.showProperties(null);
|
|
273
412
|
}
|
|
274
413
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
type: type,
|
|
280
|
-
x: x,
|
|
281
|
-
y: y,
|
|
282
|
-
width: 150,
|
|
283
|
-
height: 80,
|
|
284
|
-
inputs: this.getNodeInputs(type),
|
|
285
|
-
outputs: this.getNodeOutputs(type),
|
|
286
|
-
properties: this.getNodeProperties(type),
|
|
287
|
-
status: 'idle'
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
this.nodes.set(nodeId, node);
|
|
291
|
-
this.draw();
|
|
292
|
-
this.showProperties(node);
|
|
293
|
-
|
|
294
|
-
return node;
|
|
414
|
+
// Check for connection point
|
|
415
|
+
const connectionPoint = this.getConnectionPointAt(x, y);
|
|
416
|
+
if (connectionPoint) {
|
|
417
|
+
this.connectionStart = connectionPoint;
|
|
295
418
|
}
|
|
296
419
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
'file-input': [],
|
|
300
|
-
'text-input': [],
|
|
301
|
-
'url-input': [],
|
|
302
|
-
'api-input': [],
|
|
303
|
-
'transform': [{ name: 'data', type: 'any' }],
|
|
304
|
-
'filter': [{ name: 'data', type: 'any' }],
|
|
305
|
-
'aggregate': [{ name: 'data', type: 'array' }],
|
|
306
|
-
'sort': [{ name: 'data', type: 'array' }],
|
|
307
|
-
'file-output': [{ name: 'data', type: 'any' }],
|
|
308
|
-
'display': [{ name: 'data', type: 'any' }],
|
|
309
|
-
'api-output': [{ name: 'data', type: 'any' }],
|
|
310
|
-
'notification': [{ name: 'message', type: 'string' }],
|
|
311
|
-
'condition': [{ name: 'condition', type: 'boolean' }, { name: 'data', type: 'any' }],
|
|
312
|
-
'loop': [{ name: 'data', type: 'array' }],
|
|
313
|
-
'delay': [{ name: 'data', type: 'any' }],
|
|
314
|
-
'parallel': [{ name: 'data', type: 'array' }],
|
|
315
|
-
'ai-analyze': [{ name: 'data', type: 'any' }],
|
|
316
|
-
'ai-generate': [{ name: 'prompt', type: 'string' }],
|
|
317
|
-
'ai-classify': [{ name: 'data', type: 'any' }],
|
|
318
|
-
'ai-summarize': [{ name: 'data', type: 'string' }]
|
|
319
|
-
};
|
|
320
|
-
return inputs[type] || [];
|
|
321
|
-
}
|
|
420
|
+
this.draw();
|
|
421
|
+
}
|
|
322
422
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
'url-input': [{ name: 'data', type: 'any' }],
|
|
328
|
-
'api-input': [{ name: 'data', type: 'any' }],
|
|
329
|
-
'transform': [{ name: 'result', type: 'any' }],
|
|
330
|
-
'filter': [{ name: 'result', type: 'any' }],
|
|
331
|
-
'aggregate': [{ name: 'result', type: 'any' }],
|
|
332
|
-
'sort': [{ name: 'result', type: 'array' }],
|
|
333
|
-
'file-output': [],
|
|
334
|
-
'display': [],
|
|
335
|
-
'api-output': [{ name: 'response', type: 'any' }],
|
|
336
|
-
'notification': [],
|
|
337
|
-
'condition': [{ name: 'true', type: 'any' }, { name: 'false', type: 'any' }],
|
|
338
|
-
'loop': [{ name: 'result', type: 'array' }],
|
|
339
|
-
'delay': [{ name: 'data', type: 'any' }],
|
|
340
|
-
'parallel': [{ name: 'results', type: 'array' }],
|
|
341
|
-
'ai-analyze': [{ name: 'analysis', type: 'object' }],
|
|
342
|
-
'ai-generate': [{ name: 'generated', type: 'string' }],
|
|
343
|
-
'ai-classify': [{ name: 'categories', type: 'array' }],
|
|
344
|
-
'ai-summarize': [{ name: 'summary', type: 'string' }]
|
|
345
|
-
};
|
|
346
|
-
return outputs[type] || [];
|
|
347
|
-
}
|
|
423
|
+
handleMouseMove(e) {
|
|
424
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
425
|
+
const x = (e.clientX - rect.left - this.pan.x) / this.zoom;
|
|
426
|
+
const y = (e.clientY - rect.top - this.pan.y) / this.zoom;
|
|
348
427
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
'url-input': { url: '', method: 'GET', headers: {} },
|
|
354
|
-
'api-input': { endpoint: '', method: 'GET', headers: {}, body: '' },
|
|
355
|
-
'transform': { expression: '', language: 'javascript' },
|
|
356
|
-
'filter': { condition: '', language: 'javascript' },
|
|
357
|
-
'aggregate': { operation: 'sum', field: '' },
|
|
358
|
-
'sort': { field: '', order: 'asc' },
|
|
359
|
-
'file-output': { path: '', format: 'auto' },
|
|
360
|
-
'display': { format: 'table', title: '' },
|
|
361
|
-
'api-output': { endpoint: '', method: 'POST', headers: {} },
|
|
362
|
-
'notification': { type: 'info', title: '' },
|
|
363
|
-
'condition': { expression: '', language: 'javascript' },
|
|
364
|
-
'loop': { type: 'forEach', condition: '' },
|
|
365
|
-
'delay': { duration: 1000, unit: 'ms' },
|
|
366
|
-
'parallel': { maxConcurrency: 5 },
|
|
367
|
-
'ai-analyze': { model: 'gpt-4', temperature: 0.7 },
|
|
368
|
-
'ai-generate': { model: 'gpt-4', temperature: 0.7, maxTokens: 1000 },
|
|
369
|
-
'ai-classify': { model: 'gpt-4', categories: [] },
|
|
370
|
-
'ai-summarize': { model: 'gpt-4', length: 'medium' }
|
|
371
|
-
};
|
|
372
|
-
return properties[type] || {};
|
|
428
|
+
if (this.draggedNode) {
|
|
429
|
+
this.draggedNode.x = x - this.dragOffset.x;
|
|
430
|
+
this.draggedNode.y = y - this.dragOffset.y;
|
|
431
|
+
this.draw();
|
|
373
432
|
}
|
|
374
433
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
if (connectionPoint) {
|
|
395
|
-
this.connectionStart = connectionPoint;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
this.draw();
|
|
434
|
+
if (this.connectionStart) {
|
|
435
|
+
this.tempConnection = { x, y };
|
|
436
|
+
this.draw();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
handleMouseUp(e) {
|
|
441
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
442
|
+
const x = (e.clientX - rect.left - this.pan.x) / this.zoom;
|
|
443
|
+
const y = (e.clientY - rect.top - this.pan.y) / this.zoom;
|
|
444
|
+
|
|
445
|
+
if (this.connectionStart) {
|
|
446
|
+
const connectionEnd = this.getConnectionPointAt(x, y);
|
|
447
|
+
if (connectionEnd && connectionEnd.node !== this.connectionStart.node) {
|
|
448
|
+
this.createConnection(this.connectionStart, connectionEnd);
|
|
449
|
+
}
|
|
450
|
+
this.connectionStart = null;
|
|
451
|
+
this.tempConnection = null;
|
|
452
|
+
this.draw();
|
|
399
453
|
}
|
|
400
454
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const x = (e.clientX - rect.left - this.pan.x) / this.zoom;
|
|
404
|
-
const y = (e.clientY - rect.top - this.pan.y) / this.zoom;
|
|
405
|
-
|
|
406
|
-
if (this.draggedNode) {
|
|
407
|
-
this.draggedNode.x = x - this.dragOffset.x;
|
|
408
|
-
this.draggedNode.y = y - this.dragOffset.y;
|
|
409
|
-
this.draw();
|
|
410
|
-
}
|
|
455
|
+
this.draggedNode = null;
|
|
456
|
+
}
|
|
411
457
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
458
|
+
handleWheel(e) {
|
|
459
|
+
e.preventDefault();
|
|
460
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
461
|
+
const x = e.clientX - rect.left;
|
|
462
|
+
const y = e.clientY - rect.top;
|
|
417
463
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const x = (e.clientX - rect.left - this.pan.x) / this.zoom;
|
|
421
|
-
const y = (e.clientY - rect.top - this.pan.y) / this.zoom;
|
|
422
|
-
|
|
423
|
-
if (this.connectionStart) {
|
|
424
|
-
const connectionEnd = this.getConnectionPointAt(x, y);
|
|
425
|
-
if (connectionEnd && connectionEnd.node !== this.connectionStart.node) {
|
|
426
|
-
this.createConnection(this.connectionStart, connectionEnd);
|
|
427
|
-
}
|
|
428
|
-
this.connectionStart = null;
|
|
429
|
-
this.tempConnection = null;
|
|
430
|
-
this.draw();
|
|
431
|
-
}
|
|
464
|
+
const wheelDelta = e.deltaY < 0 ? 1.1 : 0.9;
|
|
465
|
+
const newZoom = Math.max(0.1, Math.min(3, this.zoom * wheelDelta));
|
|
432
466
|
|
|
433
|
-
|
|
434
|
-
|
|
467
|
+
this.pan.x = x - (x - this.pan.x) * (newZoom / this.zoom);
|
|
468
|
+
this.pan.y = y - (y - this.pan.y) * (newZoom / this.zoom);
|
|
469
|
+
this.zoom = newZoom;
|
|
435
470
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const rect = this.canvas.getBoundingClientRect();
|
|
439
|
-
const x = e.clientX - rect.left;
|
|
440
|
-
const y = e.clientY - rect.top;
|
|
441
|
-
|
|
442
|
-
const wheelDelta = e.deltaY < 0 ? 1.1 : 0.9;
|
|
443
|
-
const newZoom = Math.max(0.1, Math.min(3, this.zoom * wheelDelta));
|
|
444
|
-
|
|
445
|
-
this.pan.x = x - (x - this.pan.x) * (newZoom / this.zoom);
|
|
446
|
-
this.pan.y = y - (y - this.pan.y) * (newZoom / this.zoom);
|
|
447
|
-
this.zoom = newZoom;
|
|
448
|
-
|
|
449
|
-
this.draw();
|
|
450
|
-
}
|
|
471
|
+
this.draw();
|
|
472
|
+
}
|
|
451
473
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
474
|
+
handleContextMenu(e) {
|
|
475
|
+
e.preventDefault();
|
|
476
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
477
|
+
const x = (e.clientX - rect.left - this.pan.x) / this.zoom;
|
|
478
|
+
const y = (e.clientY - rect.top - this.pan.y) / this.zoom;
|
|
457
479
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
480
|
+
const node = this.getNodeAt(x, y);
|
|
481
|
+
if (node) {
|
|
482
|
+
this.showContextMenu(e.clientX, e.clientY, node);
|
|
462
483
|
}
|
|
484
|
+
}
|
|
463
485
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return null;
|
|
486
|
+
getNodeAt(x, y) {
|
|
487
|
+
for (let node of this.nodes.values()) {
|
|
488
|
+
if (x >= node.x && x <= node.x + node.width && y >= node.y && y <= node.y + node.height) {
|
|
489
|
+
return node;
|
|
490
|
+
}
|
|
472
491
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
// Check output points
|
|
486
|
-
const outputPoints = this.getOutputPoints(node);
|
|
487
|
-
for (let i = 0; i < outputPoints.length; i++) {
|
|
488
|
-
const point = outputPoints[i];
|
|
489
|
-
if (Math.abs(x - point.x) < 8 && Math.abs(y - point.y) < 8) {
|
|
490
|
-
return { node, type: 'output', index: i };
|
|
491
|
-
}
|
|
492
|
-
}
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
getConnectionPointAt(x, y) {
|
|
496
|
+
for (let node of this.nodes.values()) {
|
|
497
|
+
// Check input points
|
|
498
|
+
const inputPoints = this.getInputPoints(node);
|
|
499
|
+
for (let i = 0; i < inputPoints.length; i++) {
|
|
500
|
+
const point = inputPoints[i];
|
|
501
|
+
if (Math.abs(x - point.x) < 8 && Math.abs(y - point.y) < 8) {
|
|
502
|
+
return { node, type: 'input', index: i };
|
|
493
503
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
x: node.x,
|
|
503
|
-
y: node.y + (node.height / (inputCount + 1)) * (i + 1)
|
|
504
|
-
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// Check output points
|
|
507
|
+
const outputPoints = this.getOutputPoints(node);
|
|
508
|
+
for (let i = 0; i < outputPoints.length; i++) {
|
|
509
|
+
const point = outputPoints[i];
|
|
510
|
+
if (Math.abs(x - point.x) < 8 && Math.abs(y - point.y) < 8) {
|
|
511
|
+
return { node, type: 'output', index: i };
|
|
505
512
|
}
|
|
506
|
-
|
|
513
|
+
}
|
|
507
514
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
515
|
+
return null;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
getInputPoints(node) {
|
|
519
|
+
const points = [];
|
|
520
|
+
const inputCount = node.inputs.length;
|
|
521
|
+
for (let i = 0; i < inputCount; i++) {
|
|
522
|
+
points.push({
|
|
523
|
+
x: node.x,
|
|
524
|
+
y: node.y + (node.height / (inputCount + 1)) * (i + 1),
|
|
525
|
+
});
|
|
519
526
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
527
|
+
return points;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
getOutputPoints(node) {
|
|
531
|
+
const points = [];
|
|
532
|
+
const outputCount = node.outputs.length;
|
|
533
|
+
for (let i = 0; i < outputCount; i++) {
|
|
534
|
+
points.push({
|
|
535
|
+
x: node.x + node.width,
|
|
536
|
+
y: node.y + (node.height / (outputCount + 1)) * (i + 1),
|
|
537
|
+
});
|
|
532
538
|
}
|
|
539
|
+
return points;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
createConnection(start, end) {
|
|
543
|
+
if (start.type === 'output' && end.type === 'input') {
|
|
544
|
+
const connectionId = `${start.node.id}_${start.index}_${end.node.id}_${end.index}`;
|
|
545
|
+
this.connections.set(connectionId, {
|
|
546
|
+
id: connectionId,
|
|
547
|
+
from: start.node.id,
|
|
548
|
+
fromIndex: start.index,
|
|
549
|
+
to: end.node.id,
|
|
550
|
+
toIndex: end.index,
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
}
|
|
533
554
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
this.ctx.save();
|
|
538
|
-
this.ctx.translate(this.pan.x, this.pan.y);
|
|
539
|
-
this.ctx.scale(this.zoom, this.zoom);
|
|
540
|
-
|
|
541
|
-
// Draw grid
|
|
542
|
-
this.drawGrid();
|
|
555
|
+
draw() {
|
|
556
|
+
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
543
557
|
|
|
544
|
-
|
|
545
|
-
|
|
558
|
+
this.ctx.save();
|
|
559
|
+
this.ctx.translate(this.pan.x, this.pan.y);
|
|
560
|
+
this.ctx.scale(this.zoom, this.zoom);
|
|
546
561
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
this.drawTempConnection();
|
|
550
|
-
}
|
|
562
|
+
// Draw grid
|
|
563
|
+
this.drawGrid();
|
|
551
564
|
|
|
552
|
-
|
|
553
|
-
|
|
565
|
+
// Draw connections
|
|
566
|
+
this.drawConnections();
|
|
554
567
|
|
|
555
|
-
|
|
568
|
+
// Draw temporary connection
|
|
569
|
+
if (this.tempConnection && this.connectionStart) {
|
|
570
|
+
this.drawTempConnection();
|
|
556
571
|
}
|
|
557
572
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
const canvasWidth = this.canvas.width / this.zoom;
|
|
561
|
-
const canvasHeight = this.canvas.height / this.zoom;
|
|
562
|
-
|
|
563
|
-
this.ctx.strokeStyle = '#e0e0e0';
|
|
564
|
-
this.ctx.lineWidth = 0.5;
|
|
565
|
-
|
|
566
|
-
for (let x = 0; x <= canvasWidth; x += gridSize) {
|
|
567
|
-
this.ctx.beginPath();
|
|
568
|
-
this.ctx.moveTo(x, 0);
|
|
569
|
-
this.ctx.lineTo(x, canvasHeight);
|
|
570
|
-
this.ctx.stroke();
|
|
571
|
-
}
|
|
573
|
+
// Draw nodes
|
|
574
|
+
this.drawNodes();
|
|
572
575
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
this.ctx.moveTo(0, y);
|
|
576
|
-
this.ctx.lineTo(canvasWidth, y);
|
|
577
|
-
this.ctx.stroke();
|
|
578
|
-
}
|
|
579
|
-
}
|
|
576
|
+
this.ctx.restore();
|
|
577
|
+
}
|
|
580
578
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
579
|
+
drawGrid() {
|
|
580
|
+
const gridSize = 20;
|
|
581
|
+
const canvasWidth = this.canvas.width / this.zoom;
|
|
582
|
+
const canvasHeight = this.canvas.height / this.zoom;
|
|
586
583
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
const isExecuting = node.status === 'executing';
|
|
590
|
-
const hasError = node.status === 'error';
|
|
591
|
-
|
|
592
|
-
// Node body
|
|
593
|
-
this.ctx.fillStyle = isSelected ? '#e3f2fd' : '#ffffff';
|
|
594
|
-
this.ctx.strokeStyle = isSelected ? '#2196f3' : (hasError ? '#f44336' : '#cccccc');
|
|
595
|
-
this.ctx.lineWidth = isSelected ? 2 : 1;
|
|
596
|
-
|
|
597
|
-
this.ctx.fillRect(node.x, node.y, node.width, node.height);
|
|
598
|
-
this.ctx.strokeRect(node.x, node.y, node.width, node.height);
|
|
599
|
-
|
|
600
|
-
// Node title
|
|
601
|
-
this.ctx.fillStyle = '#333333';
|
|
602
|
-
this.ctx.font = '12px Arial';
|
|
603
|
-
this.ctx.textAlign = 'center';
|
|
604
|
-
this.ctx.fillText(
|
|
605
|
-
this.getNodeTitle(node.type),
|
|
606
|
-
node.x + node.width / 2,
|
|
607
|
-
node.y + 20
|
|
608
|
-
);
|
|
609
|
-
|
|
610
|
-
// Status indicator
|
|
611
|
-
if (isExecuting) {
|
|
612
|
-
this.ctx.fillStyle = '#ff9800';
|
|
613
|
-
this.ctx.beginPath();
|
|
614
|
-
this.ctx.arc(node.x + node.width - 10, node.y + 10, 4, 0, 2 * Math.PI);
|
|
615
|
-
this.ctx.fill();
|
|
616
|
-
} else if (hasError) {
|
|
617
|
-
this.ctx.fillStyle = '#f44336';
|
|
618
|
-
this.ctx.beginPath();
|
|
619
|
-
this.ctx.arc(node.x + node.width - 10, node.y + 10, 4, 0, 2 * Math.PI);
|
|
620
|
-
this.ctx.fill();
|
|
621
|
-
}
|
|
584
|
+
this.ctx.strokeStyle = '#e0e0e0';
|
|
585
|
+
this.ctx.lineWidth = 0.5;
|
|
622
586
|
|
|
623
|
-
|
|
624
|
-
|
|
587
|
+
for (let x = 0; x <= canvasWidth; x += gridSize) {
|
|
588
|
+
this.ctx.beginPath();
|
|
589
|
+
this.ctx.moveTo(x, 0);
|
|
590
|
+
this.ctx.lineTo(x, canvasHeight);
|
|
591
|
+
this.ctx.stroke();
|
|
625
592
|
}
|
|
626
593
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
this.ctx.beginPath();
|
|
633
|
-
this.ctx.arc(point.x, point.y, 4, 0, 2 * Math.PI);
|
|
634
|
-
this.ctx.fill();
|
|
635
|
-
|
|
636
|
-
// Input label
|
|
637
|
-
this.ctx.fillStyle = '#666666';
|
|
638
|
-
this.ctx.font = '10px Arial';
|
|
639
|
-
this.ctx.textAlign = 'right';
|
|
640
|
-
this.ctx.fillText(
|
|
641
|
-
node.inputs[index].name,
|
|
642
|
-
point.x - 8,
|
|
643
|
-
point.y + 3
|
|
644
|
-
);
|
|
645
|
-
});
|
|
646
|
-
|
|
647
|
-
// Output points
|
|
648
|
-
const outputPoints = this.getOutputPoints(node);
|
|
649
|
-
outputPoints.forEach((point, index) => {
|
|
650
|
-
this.ctx.fillStyle = '#2196f3';
|
|
651
|
-
this.ctx.beginPath();
|
|
652
|
-
this.ctx.arc(point.x, point.y, 4, 0, 2 * Math.PI);
|
|
653
|
-
this.ctx.fill();
|
|
654
|
-
|
|
655
|
-
// Output label
|
|
656
|
-
this.ctx.fillStyle = '#666666';
|
|
657
|
-
this.ctx.font = '10px Arial';
|
|
658
|
-
this.ctx.textAlign = 'left';
|
|
659
|
-
this.ctx.fillText(
|
|
660
|
-
node.outputs[index].name,
|
|
661
|
-
point.x + 8,
|
|
662
|
-
point.y + 3
|
|
663
|
-
);
|
|
664
|
-
});
|
|
594
|
+
for (let y = 0; y <= canvasHeight; y += gridSize) {
|
|
595
|
+
this.ctx.beginPath();
|
|
596
|
+
this.ctx.moveTo(0, y);
|
|
597
|
+
this.ctx.lineTo(canvasWidth, y);
|
|
598
|
+
this.ctx.stroke();
|
|
665
599
|
}
|
|
600
|
+
}
|
|
666
601
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
const toNode = this.nodes.get(connection.to);
|
|
671
|
-
|
|
672
|
-
if (fromNode && toNode) {
|
|
673
|
-
const fromPoints = this.getOutputPoints(fromNode);
|
|
674
|
-
const toPoints = this.getInputPoints(toNode);
|
|
675
|
-
|
|
676
|
-
const fromPoint = fromPoints[connection.fromIndex];
|
|
677
|
-
const toPoint = toPoints[connection.toIndex];
|
|
678
|
-
|
|
679
|
-
this.drawConnection(fromPoint, toPoint);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
602
|
+
drawNodes() {
|
|
603
|
+
for (let node of this.nodes.values()) {
|
|
604
|
+
this.drawNode(node);
|
|
682
605
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
drawNode(node) {
|
|
609
|
+
const isSelected = this.selectedNode === node;
|
|
610
|
+
const isExecuting = node.status === 'executing';
|
|
611
|
+
const hasError = node.status === 'error';
|
|
612
|
+
|
|
613
|
+
// Node body
|
|
614
|
+
this.ctx.fillStyle = isSelected ? '#e3f2fd' : '#ffffff';
|
|
615
|
+
this.ctx.strokeStyle = isSelected ? '#2196f3' : hasError ? '#f44336' : '#cccccc';
|
|
616
|
+
this.ctx.lineWidth = isSelected ? 2 : 1;
|
|
617
|
+
|
|
618
|
+
this.ctx.fillRect(node.x, node.y, node.width, node.height);
|
|
619
|
+
this.ctx.strokeRect(node.x, node.y, node.width, node.height);
|
|
620
|
+
|
|
621
|
+
// Node title
|
|
622
|
+
this.ctx.fillStyle = '#333333';
|
|
623
|
+
this.ctx.font = '12px Arial';
|
|
624
|
+
this.ctx.textAlign = 'center';
|
|
625
|
+
this.ctx.fillText(this.getNodeTitle(node.type), node.x + node.width / 2, node.y + 20);
|
|
626
|
+
|
|
627
|
+
// Status indicator
|
|
628
|
+
if (isExecuting) {
|
|
629
|
+
this.ctx.fillStyle = '#ff9800';
|
|
630
|
+
this.ctx.beginPath();
|
|
631
|
+
this.ctx.arc(node.x + node.width - 10, node.y + 10, 4, 0, 2 * Math.PI);
|
|
632
|
+
this.ctx.fill();
|
|
633
|
+
} else if (hasError) {
|
|
634
|
+
this.ctx.fillStyle = '#f44336';
|
|
635
|
+
this.ctx.beginPath();
|
|
636
|
+
this.ctx.arc(node.x + node.width - 10, node.y + 10, 4, 0, 2 * Math.PI);
|
|
637
|
+
this.ctx.fill();
|
|
709
638
|
}
|
|
710
639
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
640
|
+
// Input/Output points
|
|
641
|
+
this.drawConnectionPoints(node);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
drawConnectionPoints(node) {
|
|
645
|
+
// Input points
|
|
646
|
+
const inputPoints = this.getInputPoints(node);
|
|
647
|
+
inputPoints.forEach((point, index) => {
|
|
648
|
+
this.ctx.fillStyle = '#4caf50';
|
|
649
|
+
this.ctx.beginPath();
|
|
650
|
+
this.ctx.arc(point.x, point.y, 4, 0, 2 * Math.PI);
|
|
651
|
+
this.ctx.fill();
|
|
652
|
+
|
|
653
|
+
// Input label
|
|
654
|
+
this.ctx.fillStyle = '#666666';
|
|
655
|
+
this.ctx.font = '10px Arial';
|
|
656
|
+
this.ctx.textAlign = 'right';
|
|
657
|
+
this.ctx.fillText(node.inputs[index].name, point.x - 8, point.y + 3);
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
// Output points
|
|
661
|
+
const outputPoints = this.getOutputPoints(node);
|
|
662
|
+
outputPoints.forEach((point, index) => {
|
|
663
|
+
this.ctx.fillStyle = '#2196f3';
|
|
664
|
+
this.ctx.beginPath();
|
|
665
|
+
this.ctx.arc(point.x, point.y, 4, 0, 2 * Math.PI);
|
|
666
|
+
this.ctx.fill();
|
|
667
|
+
|
|
668
|
+
// Output label
|
|
669
|
+
this.ctx.fillStyle = '#666666';
|
|
670
|
+
this.ctx.font = '10px Arial';
|
|
671
|
+
this.ctx.textAlign = 'left';
|
|
672
|
+
this.ctx.fillText(node.outputs[index].name, point.x + 8, point.y + 3);
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
drawConnections() {
|
|
677
|
+
for (let connection of this.connections.values()) {
|
|
678
|
+
const fromNode = this.nodes.get(connection.from);
|
|
679
|
+
const toNode = this.nodes.get(connection.to);
|
|
680
|
+
|
|
681
|
+
if (fromNode && toNode) {
|
|
682
|
+
const fromPoints = this.getOutputPoints(fromNode);
|
|
683
|
+
const toPoints = this.getInputPoints(toNode);
|
|
684
|
+
|
|
685
|
+
const fromPoint = fromPoints[connection.fromIndex];
|
|
686
|
+
const toPoint = toPoints[connection.toIndex];
|
|
687
|
+
|
|
688
|
+
this.drawConnection(fromPoint, toPoint);
|
|
689
|
+
}
|
|
724
690
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
drawConnection(from, to) {
|
|
694
|
+
const midX = (from.x + to.x) / 2;
|
|
695
|
+
|
|
696
|
+
this.ctx.strokeStyle = '#666666';
|
|
697
|
+
this.ctx.lineWidth = 2;
|
|
698
|
+
this.ctx.beginPath();
|
|
699
|
+
this.ctx.moveTo(from.x, from.y);
|
|
700
|
+
this.ctx.bezierCurveTo(midX, from.y, midX, to.y, to.x, to.y);
|
|
701
|
+
this.ctx.stroke();
|
|
702
|
+
|
|
703
|
+
// Arrow
|
|
704
|
+
const angle = Math.atan2(to.y - from.y, to.x - from.x);
|
|
705
|
+
const arrowLength = 8;
|
|
706
|
+
this.ctx.beginPath();
|
|
707
|
+
this.ctx.moveTo(to.x, to.y);
|
|
708
|
+
this.ctx.lineTo(
|
|
709
|
+
to.x - arrowLength * Math.cos(angle - Math.PI / 6),
|
|
710
|
+
to.y - arrowLength * Math.sin(angle - Math.PI / 6),
|
|
711
|
+
);
|
|
712
|
+
this.ctx.moveTo(to.x, to.y);
|
|
713
|
+
this.ctx.lineTo(
|
|
714
|
+
to.x - arrowLength * Math.cos(angle + Math.PI / 6),
|
|
715
|
+
to.y - arrowLength * Math.sin(angle + Math.PI / 6),
|
|
716
|
+
);
|
|
717
|
+
this.ctx.stroke();
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
drawTempConnection() {
|
|
721
|
+
const startPoint =
|
|
722
|
+
this.connectionStart.type === 'output'
|
|
723
|
+
? this.getOutputPoints(this.connectionStart.node)[this.connectionStart.index]
|
|
724
|
+
: this.getInputPoints(this.connectionStart.node)[this.connectionStart.index];
|
|
725
|
+
|
|
726
|
+
this.ctx.strokeStyle = '#2196f3';
|
|
727
|
+
this.ctx.lineWidth = 2;
|
|
728
|
+
this.ctx.setLineDash([5, 5]);
|
|
729
|
+
this.ctx.beginPath();
|
|
730
|
+
this.ctx.moveTo(startPoint.x, startPoint.y);
|
|
731
|
+
this.ctx.lineTo(this.tempConnection.x, this.tempConnection.y);
|
|
732
|
+
this.ctx.stroke();
|
|
733
|
+
this.ctx.setLineDash([]);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
getNodeTitle(type) {
|
|
737
|
+
const titles = {
|
|
738
|
+
'file-input': 'File Input',
|
|
739
|
+
'text-input': 'Text Input',
|
|
740
|
+
'url-input': 'URL Input',
|
|
741
|
+
'api-input': 'API Input',
|
|
742
|
+
transform: 'Transform',
|
|
743
|
+
filter: 'Filter',
|
|
744
|
+
aggregate: 'Aggregate',
|
|
745
|
+
sort: 'Sort',
|
|
746
|
+
'file-output': 'File Output',
|
|
747
|
+
display: 'Display',
|
|
748
|
+
'api-output': 'API Output',
|
|
749
|
+
notification: 'Notification',
|
|
750
|
+
condition: 'Condition',
|
|
751
|
+
loop: 'Loop',
|
|
752
|
+
delay: 'Delay',
|
|
753
|
+
parallel: 'Parallel',
|
|
754
|
+
'ai-analyze': 'AI Analyze',
|
|
755
|
+
'ai-generate': 'AI Generate',
|
|
756
|
+
'ai-classify': 'AI Classify',
|
|
757
|
+
'ai-summarize': 'AI Summarize',
|
|
758
|
+
};
|
|
759
|
+
return titles[type] || type;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
showProperties(node) {
|
|
763
|
+
const panel = document.getElementById('propertiesContent');
|
|
764
|
+
|
|
765
|
+
if (!node) {
|
|
766
|
+
panel.innerHTML = '<div class="no-selection"><p>Select a node to edit properties</p></div>';
|
|
767
|
+
return;
|
|
750
768
|
}
|
|
751
769
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
if (!node) {
|
|
756
|
-
panel.innerHTML = '<div class="no-selection"><p>Select a node to edit properties</p></div>';
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
const properties = node.properties;
|
|
761
|
-
let html = `
|
|
770
|
+
const properties = node.properties;
|
|
771
|
+
let html = `
|
|
762
772
|
<div class="properties-form">
|
|
763
773
|
<h4>${this.getNodeTitle(node.type)}</h4>
|
|
764
774
|
`;
|
|
765
775
|
|
|
766
|
-
|
|
767
|
-
|
|
776
|
+
Object.entries(properties).forEach(([key, value]) => {
|
|
777
|
+
html += `
|
|
768
778
|
<div class="property-field">
|
|
769
779
|
<label>${this.formatPropertyLabel(key)}</label>
|
|
770
780
|
${this.renderPropertyInput(key, value, node.id)}
|
|
771
781
|
</div>
|
|
772
782
|
`;
|
|
773
|
-
|
|
783
|
+
});
|
|
774
784
|
|
|
775
|
-
|
|
776
|
-
|
|
785
|
+
html += '</div>';
|
|
786
|
+
panel.innerHTML = html;
|
|
777
787
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
788
|
+
// Attach event listeners
|
|
789
|
+
panel.querySelectorAll('input, select, textarea').forEach((input) => {
|
|
790
|
+
input.addEventListener('change', (e) => {
|
|
791
|
+
const propertyKey = e.target.dataset.property;
|
|
792
|
+
node.properties[propertyKey] = e.target.value;
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
}
|
|
786
796
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
797
|
+
formatPropertyLabel(key) {
|
|
798
|
+
return key.charAt(0).toUpperCase() + key.slice(1).replace(/([A-Z])/g, ' $1');
|
|
799
|
+
}
|
|
790
800
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
801
|
+
renderPropertyInput(key, value, nodeId) {
|
|
802
|
+
const inputId = `${nodeId}_${key}`;
|
|
803
|
+
|
|
804
|
+
if (typeof value === 'boolean') {
|
|
805
|
+
return `
|
|
796
806
|
<input type="checkbox" id="${inputId}" data-property="${key}" ${value ? 'checked' : ''}>
|
|
797
807
|
`;
|
|
798
|
-
|
|
799
|
-
|
|
808
|
+
} else if (key === 'method') {
|
|
809
|
+
return `
|
|
800
810
|
<select id="${inputId}" data-property="${key}">
|
|
801
811
|
<option value="GET" ${value === 'GET' ? 'selected' : ''}>GET</option>
|
|
802
812
|
<option value="POST" ${value === 'POST' ? 'selected' : ''}>POST</option>
|
|
@@ -804,503 +814,509 @@ class WorkflowDesigner {
|
|
|
804
814
|
<option value="DELETE" ${value === 'DELETE' ? 'selected' : ''}>DELETE</option>
|
|
805
815
|
</select>
|
|
806
816
|
`;
|
|
807
|
-
|
|
808
|
-
|
|
817
|
+
} else if (key.includes('expression') || key.includes('body')) {
|
|
818
|
+
return `
|
|
809
819
|
<textarea id="${inputId}" data-property="${key}" rows="3">${value}</textarea>
|
|
810
820
|
`;
|
|
811
|
-
|
|
812
|
-
|
|
821
|
+
} else {
|
|
822
|
+
return `
|
|
813
823
|
<input type="text" id="${inputId}" data-property="${key}" value="${value}">
|
|
814
824
|
`;
|
|
815
|
-
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
async validateWorkflow() {
|
|
829
|
+
const results = {
|
|
830
|
+
errors: [],
|
|
831
|
+
warnings: [],
|
|
832
|
+
info: [],
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
// Check for isolated nodes
|
|
836
|
+
const connectedNodes = new Set();
|
|
837
|
+
for (let connection of this.connections.values()) {
|
|
838
|
+
connectedNodes.add(connection.from);
|
|
839
|
+
connectedNodes.add(connection.to);
|
|
816
840
|
}
|
|
817
841
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
};
|
|
824
|
-
|
|
825
|
-
// Check for isolated nodes
|
|
826
|
-
const connectedNodes = new Set();
|
|
827
|
-
for (let connection of this.connections.values()) {
|
|
828
|
-
connectedNodes.add(connection.from);
|
|
829
|
-
connectedNodes.add(connection.to);
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
for (let node of this.nodes.values()) {
|
|
833
|
-
if (!connectedNodes.has(node.id) && this.nodes.size > 1) {
|
|
834
|
-
results.warnings.push(`Node "${this.getNodeTitle(node.type)}" is not connected`);
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
// Check for circular dependencies
|
|
839
|
-
if (this.hasCircularDependencies()) {
|
|
840
|
-
results.errors.push('Circular dependencies detected in workflow');
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
// Check required properties
|
|
844
|
-
for (let node of this.nodes.values()) {
|
|
845
|
-
const required = this.getRequiredProperties(node.type);
|
|
846
|
-
for (let prop of required) {
|
|
847
|
-
if (!node.properties[prop] || node.properties[prop] === '') {
|
|
848
|
-
results.errors.push(`Node "${this.getNodeTitle(node.type)}" missing required property: ${prop}`);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
842
|
+
for (let node of this.nodes.values()) {
|
|
843
|
+
if (!connectedNodes.has(node.id) && this.nodes.size > 1) {
|
|
844
|
+
results.warnings.push(`Node "${this.getNodeTitle(node.type)}" is not connected`);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
852
847
|
|
|
853
|
-
|
|
854
|
-
|
|
848
|
+
// Check for circular dependencies
|
|
849
|
+
if (this.hasCircularDependencies()) {
|
|
850
|
+
results.errors.push('Circular dependencies detected in workflow');
|
|
855
851
|
}
|
|
856
852
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
visiting.add(nodeId);
|
|
866
|
-
|
|
867
|
-
for (let connection of this.connections.values()) {
|
|
868
|
-
if (connection.from === nodeId) {
|
|
869
|
-
if (visit(connection.to)) return true;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
visiting.delete(nodeId);
|
|
874
|
-
visited.add(nodeId);
|
|
875
|
-
return false;
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
for (let nodeId of this.nodes.keys()) {
|
|
879
|
-
if (visit(nodeId)) return true;
|
|
853
|
+
// Check required properties
|
|
854
|
+
for (let node of this.nodes.values()) {
|
|
855
|
+
const required = this.getRequiredProperties(node.type);
|
|
856
|
+
for (let prop of required) {
|
|
857
|
+
if (!node.properties[prop] || node.properties[prop] === '') {
|
|
858
|
+
results.errors.push(
|
|
859
|
+
`Node "${this.getNodeTitle(node.type)}" missing required property: ${prop}`,
|
|
860
|
+
);
|
|
880
861
|
}
|
|
881
|
-
|
|
882
|
-
return false;
|
|
862
|
+
}
|
|
883
863
|
}
|
|
884
864
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
'url-input': ['url'],
|
|
889
|
-
'api-input': ['endpoint'],
|
|
890
|
-
'transform': ['expression'],
|
|
891
|
-
'filter': ['condition'],
|
|
892
|
-
'file-output': ['path'],
|
|
893
|
-
'api-output': ['endpoint'],
|
|
894
|
-
'condition': ['expression']
|
|
895
|
-
};
|
|
896
|
-
return required[type] || [];
|
|
897
|
-
}
|
|
865
|
+
this.showValidationResults(results);
|
|
866
|
+
return results.errors.length === 0;
|
|
867
|
+
}
|
|
898
868
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
let html = '<div class="validation-results">';
|
|
904
|
-
|
|
905
|
-
if (results.errors.length > 0) {
|
|
906
|
-
html += '<div class="validation-section errors">';
|
|
907
|
-
html += '<h4><i class="fas fa-exclamation-circle"></i> Errors</h4>';
|
|
908
|
-
html += '<ul>';
|
|
909
|
-
results.errors.forEach(error => {
|
|
910
|
-
html += `<li class="error">${error}</li>`;
|
|
911
|
-
});
|
|
912
|
-
html += '</ul></div>';
|
|
913
|
-
}
|
|
869
|
+
hasCircularDependencies() {
|
|
870
|
+
const visited = new Set();
|
|
871
|
+
const visiting = new Set();
|
|
914
872
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
html += '<ul>';
|
|
919
|
-
results.warnings.forEach(warning => {
|
|
920
|
-
html += `<li class="warning">${warning}</li>`;
|
|
921
|
-
});
|
|
922
|
-
html += '</ul></div>';
|
|
923
|
-
}
|
|
873
|
+
const visit = (nodeId) => {
|
|
874
|
+
if (visiting.has(nodeId)) return true;
|
|
875
|
+
if (visited.has(nodeId)) return false;
|
|
924
876
|
|
|
925
|
-
|
|
926
|
-
html += '<div class="validation-section info">';
|
|
927
|
-
html += '<h4><i class="fas fa-info-circle"></i> Information</h4>';
|
|
928
|
-
html += '<ul>';
|
|
929
|
-
results.info.forEach(info => {
|
|
930
|
-
html += `<li class="info">${info}</li>`;
|
|
931
|
-
});
|
|
932
|
-
html += '</ul></div>';
|
|
933
|
-
}
|
|
877
|
+
visiting.add(nodeId);
|
|
934
878
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
html += '</div>';
|
|
879
|
+
for (let connection of this.connections.values()) {
|
|
880
|
+
if (connection.from === nodeId) {
|
|
881
|
+
if (visit(connection.to)) return true;
|
|
939
882
|
}
|
|
883
|
+
}
|
|
940
884
|
|
|
941
|
-
|
|
942
|
-
|
|
885
|
+
visiting.delete(nodeId);
|
|
886
|
+
visited.add(nodeId);
|
|
887
|
+
return false;
|
|
888
|
+
};
|
|
943
889
|
|
|
944
|
-
|
|
945
|
-
|
|
890
|
+
for (let nodeId of this.nodes.keys()) {
|
|
891
|
+
if (visit(nodeId)) return true;
|
|
946
892
|
}
|
|
947
893
|
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
getRequiredProperties(type) {
|
|
898
|
+
const required = {
|
|
899
|
+
'file-input': ['path'],
|
|
900
|
+
'url-input': ['url'],
|
|
901
|
+
'api-input': ['endpoint'],
|
|
902
|
+
transform: ['expression'],
|
|
903
|
+
filter: ['condition'],
|
|
904
|
+
'file-output': ['path'],
|
|
905
|
+
'api-output': ['endpoint'],
|
|
906
|
+
condition: ['expression'],
|
|
907
|
+
};
|
|
908
|
+
return required[type] || [];
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
showValidationResults(results) {
|
|
912
|
+
const panel = document.getElementById('validationTab');
|
|
913
|
+
const content = panel.querySelector('.validation-results') || panel;
|
|
914
|
+
|
|
915
|
+
let html = '<div class="validation-results">';
|
|
916
|
+
|
|
917
|
+
if (results.errors.length > 0) {
|
|
918
|
+
html += '<div class="validation-section errors">';
|
|
919
|
+
html += '<h4><i class="fas fa-exclamation-circle"></i> Errors</h4>';
|
|
920
|
+
html += '<ul>';
|
|
921
|
+
results.errors.forEach((error) => {
|
|
922
|
+
html += `<li class="error">${error}</li>`;
|
|
923
|
+
});
|
|
924
|
+
html += '</ul></div>';
|
|
978
925
|
}
|
|
979
926
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
927
|
+
if (results.warnings.length > 0) {
|
|
928
|
+
html += '<div class="validation-section warnings">';
|
|
929
|
+
html += '<h4><i class="fas fa-exclamation-triangle"></i> Warnings</h4>';
|
|
930
|
+
html += '<ul>';
|
|
931
|
+
results.warnings.forEach((warning) => {
|
|
932
|
+
html += `<li class="warning">${warning}</li>`;
|
|
933
|
+
});
|
|
934
|
+
html += '</ul></div>';
|
|
987
935
|
}
|
|
988
936
|
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
try {
|
|
998
|
-
const result = await this.processNode(node);
|
|
999
|
-
node.status = 'completed';
|
|
1000
|
-
this.executionState.set(node.id, result);
|
|
1001
|
-
|
|
1002
|
-
this.logExecution(`Node completed: ${this.getNodeTitle(node.type)}`, 'success');
|
|
1003
|
-
|
|
1004
|
-
// Execute connected nodes
|
|
1005
|
-
const connectedNodes = this.getConnectedNodes(node.id);
|
|
1006
|
-
for (let connectedNode of connectedNodes) {
|
|
1007
|
-
await this.executeNode(connectedNode);
|
|
1008
|
-
}
|
|
1009
|
-
} catch (error) {
|
|
1010
|
-
node.status = 'error';
|
|
1011
|
-
this.logExecution(`Node failed: ${this.getNodeTitle(node.type)} - ${error.message}`, 'error');
|
|
1012
|
-
throw error;
|
|
1013
|
-
}
|
|
937
|
+
if (results.info.length > 0) {
|
|
938
|
+
html += '<div class="validation-section info">';
|
|
939
|
+
html += '<h4><i class="fas fa-info-circle"></i> Information</h4>';
|
|
940
|
+
html += '<ul>';
|
|
941
|
+
results.info.forEach((info) => {
|
|
942
|
+
html += `<li class="info">${info}</li>`;
|
|
943
|
+
});
|
|
944
|
+
html += '</ul></div>';
|
|
1014
945
|
}
|
|
1015
946
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
switch (node.type) {
|
|
1021
|
-
case 'file-input':
|
|
1022
|
-
return { type: 'file', path: node.properties.path };
|
|
1023
|
-
case 'text-input':
|
|
1024
|
-
return { type: 'text', value: node.properties.value };
|
|
1025
|
-
case 'transform':
|
|
1026
|
-
return { type: 'transformed', data: 'transformed_data' };
|
|
1027
|
-
case 'ai-analyze':
|
|
1028
|
-
return { type: 'analysis', confidence: 0.95, insights: [] };
|
|
1029
|
-
default:
|
|
1030
|
-
return { type: 'generic', processed: true };
|
|
1031
|
-
}
|
|
947
|
+
if (results.errors.length === 0 && results.warnings.length === 0) {
|
|
948
|
+
html += '<div class="validation-success">';
|
|
949
|
+
html += '<i class="fas fa-check-circle"></i> Workflow validation passed';
|
|
950
|
+
html += '</div>';
|
|
1032
951
|
}
|
|
1033
952
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
for (let connection of this.connections.values()) {
|
|
1037
|
-
if (connection.from === nodeId) {
|
|
1038
|
-
const node = this.nodes.get(connection.to);
|
|
1039
|
-
if (node) connected.push(node);
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
return connected;
|
|
1043
|
-
}
|
|
953
|
+
html += '</div>';
|
|
954
|
+
content.innerHTML = html;
|
|
1044
955
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
entry.className = `log-entry ${type}`;
|
|
1049
|
-
entry.innerHTML = `
|
|
1050
|
-
<span class="timestamp">${new Date().toLocaleTimeString()}</span>
|
|
1051
|
-
<span class="message">${message}</span>
|
|
1052
|
-
`;
|
|
1053
|
-
log.appendChild(entry);
|
|
1054
|
-
log.scrollTop = log.scrollHeight;
|
|
1055
|
-
}
|
|
956
|
+
// Switch to validation tab
|
|
957
|
+
this.switchTabToValidation();
|
|
958
|
+
}
|
|
1056
959
|
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
for (let node of this.nodes.values()) {
|
|
1062
|
-
if (node.status === 'executing') {
|
|
1063
|
-
node.status = 'idle';
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
this.logExecution('Workflow execution stopped by user', 'warning');
|
|
1068
|
-
this.draw();
|
|
960
|
+
async executeWorkflow() {
|
|
961
|
+
if (!(await this.validateWorkflow())) {
|
|
962
|
+
alert('Workflow validation failed. Please fix errors before executing.');
|
|
963
|
+
return;
|
|
1069
964
|
}
|
|
1070
965
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
nodes: Array.from(this.nodes.values()),
|
|
1074
|
-
connections: Array.from(this.connections.values()),
|
|
1075
|
-
metadata: {
|
|
1076
|
-
version: '1.0',
|
|
1077
|
-
created: new Date().toISOString(),
|
|
1078
|
-
name: prompt('Enter workflow name:') || 'Untitled Workflow'
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
|
|
1082
|
-
const saved = JSON.parse(localStorage.getItem('claudeflow_workflows') || '[]');
|
|
1083
|
-
saved.push(workflow);
|
|
1084
|
-
localStorage.setItem('claudeflow_workflows', JSON.stringify(saved));
|
|
1085
|
-
|
|
1086
|
-
alert('Workflow saved successfully!');
|
|
1087
|
-
}
|
|
966
|
+
this.isExecuting = true;
|
|
967
|
+
this.executionState.clear();
|
|
1088
968
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
if (saved.length === 0) {
|
|
1092
|
-
alert('No saved workflows found');
|
|
1093
|
-
return;
|
|
1094
|
-
}
|
|
969
|
+
document.getElementById('executeWorkflow').disabled = true;
|
|
970
|
+
document.getElementById('stopWorkflow').disabled = false;
|
|
1095
971
|
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
if (choice) {
|
|
1100
|
-
const index = parseInt(choice) - 1;
|
|
1101
|
-
if (index >= 0 && index < saved.length) {
|
|
1102
|
-
this.loadWorkflowData(saved[index]);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
972
|
+
const executionLog = document.querySelector('#executionTab .execution-log');
|
|
973
|
+
executionLog.innerHTML = '';
|
|
1106
974
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
workflow.nodes.forEach(nodeData => {
|
|
1112
|
-
this.nodes.set(nodeData.id, { ...nodeData });
|
|
1113
|
-
});
|
|
1114
|
-
|
|
1115
|
-
workflow.connections.forEach(connectionData => {
|
|
1116
|
-
this.connections.set(connectionData.id, { ...connectionData });
|
|
1117
|
-
});
|
|
1118
|
-
|
|
1119
|
-
this.draw();
|
|
1120
|
-
}
|
|
975
|
+
try {
|
|
976
|
+
const startNodes = this.getStartNodes();
|
|
977
|
+
const executionPromises = startNodes.map((node) => this.executeNode(node));
|
|
1121
978
|
|
|
1122
|
-
|
|
1123
|
-
const workflow = {
|
|
1124
|
-
nodes: Array.from(this.nodes.values()),
|
|
1125
|
-
connections: Array.from(this.connections.values()),
|
|
1126
|
-
metadata: {
|
|
1127
|
-
version: '1.0',
|
|
1128
|
-
exported: new Date().toISOString(),
|
|
1129
|
-
name: prompt('Enter workflow name:') || 'Exported Workflow'
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
|
|
1133
|
-
const blob = new Blob([JSON.stringify(workflow, null, 2)], { type: 'application/json' });
|
|
1134
|
-
const url = URL.createObjectURL(blob);
|
|
1135
|
-
const a = document.createElement('a');
|
|
1136
|
-
a.href = url;
|
|
1137
|
-
a.download = `${workflow.metadata.name}.json`;
|
|
1138
|
-
a.click();
|
|
1139
|
-
URL.revokeObjectURL(url);
|
|
1140
|
-
}
|
|
979
|
+
await Promise.all(executionPromises);
|
|
1141
980
|
|
|
1142
|
-
|
|
1143
|
-
|
|
981
|
+
this.logExecution('Workflow execution completed successfully', 'success');
|
|
982
|
+
} catch (error) {
|
|
983
|
+
this.logExecution(`Workflow execution failed: ${error.message}`, 'error');
|
|
984
|
+
} finally {
|
|
985
|
+
this.isExecuting = false;
|
|
986
|
+
document.getElementById('executeWorkflow').disabled = false;
|
|
987
|
+
document.getElementById('stopWorkflow').disabled = true;
|
|
988
|
+
this.draw();
|
|
1144
989
|
}
|
|
990
|
+
}
|
|
1145
991
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
const reader = new FileReader();
|
|
1151
|
-
reader.onload = (event) => {
|
|
1152
|
-
try {
|
|
1153
|
-
const workflow = JSON.parse(event.target.result);
|
|
1154
|
-
this.loadWorkflowData(workflow);
|
|
1155
|
-
alert('Workflow imported successfully!');
|
|
1156
|
-
} catch (error) {
|
|
1157
|
-
alert('Error importing workflow: ' + error.message);
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
reader.readAsText(file);
|
|
992
|
+
getStartNodes() {
|
|
993
|
+
const hasInput = new Set();
|
|
994
|
+
for (let connection of this.connections.values()) {
|
|
995
|
+
hasInput.add(connection.to);
|
|
1161
996
|
}
|
|
1162
997
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
{
|
|
1166
|
-
name: 'Data Processing Pipeline',
|
|
1167
|
-
description: 'Process files through transformation and analysis',
|
|
1168
|
-
nodes: [
|
|
1169
|
-
{ type: 'file-input', x: 50, y: 100 },
|
|
1170
|
-
{ type: 'transform', x: 250, y: 100 },
|
|
1171
|
-
{ type: 'ai-analyze', x: 450, y: 100 },
|
|
1172
|
-
{ type: 'file-output', x: 650, y: 100 }
|
|
1173
|
-
]
|
|
1174
|
-
},
|
|
1175
|
-
{
|
|
1176
|
-
name: 'Content Generation',
|
|
1177
|
-
description: 'Generate and process content using AI',
|
|
1178
|
-
nodes: [
|
|
1179
|
-
{ type: 'text-input', x: 50, y: 100 },
|
|
1180
|
-
{ type: 'ai-generate', x: 250, y: 100 },
|
|
1181
|
-
{ type: 'ai-summarize', x: 450, y: 100 },
|
|
1182
|
-
{ type: 'display', x: 650, y: 100 }
|
|
1183
|
-
]
|
|
1184
|
-
},
|
|
1185
|
-
{
|
|
1186
|
-
name: 'API Integration',
|
|
1187
|
-
description: 'Fetch, process, and send data via APIs',
|
|
1188
|
-
nodes: [
|
|
1189
|
-
{ type: 'api-input', x: 50, y: 100 },
|
|
1190
|
-
{ type: 'filter', x: 250, y: 100 },
|
|
1191
|
-
{ type: 'transform', x: 450, y: 100 },
|
|
1192
|
-
{ type: 'api-output', x: 650, y: 100 }
|
|
1193
|
-
]
|
|
1194
|
-
}
|
|
1195
|
-
];
|
|
1196
|
-
|
|
1197
|
-
const gallery = document.querySelector('.template-gallery');
|
|
1198
|
-
gallery.innerHTML = templates.map(template => `
|
|
1199
|
-
<div class="template-card" data-template="${template.name}">
|
|
1200
|
-
<h4>${template.name}</h4>
|
|
1201
|
-
<p>${template.description}</p>
|
|
1202
|
-
<button class="btn btn-primary load-template">Load Template</button>
|
|
1203
|
-
</div>
|
|
1204
|
-
`).join('');
|
|
1205
|
-
|
|
1206
|
-
// Add event listeners
|
|
1207
|
-
gallery.querySelectorAll('.load-template').forEach(btn => {
|
|
1208
|
-
btn.addEventListener('click', (e) => {
|
|
1209
|
-
const templateName = e.target.closest('.template-card').dataset.template;
|
|
1210
|
-
const template = templates.find(t => t.name === templateName);
|
|
1211
|
-
if (template) {
|
|
1212
|
-
this.loadTemplate(template);
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
998
|
+
return Array.from(this.nodes.values()).filter((node) => !hasInput.has(node.id));
|
|
999
|
+
}
|
|
1217
1000
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
const nodeMap = new Map();
|
|
1222
|
-
|
|
1223
|
-
// Create nodes
|
|
1224
|
-
template.nodes.forEach((nodeData, index) => {
|
|
1225
|
-
const node = this.createNode(nodeData.type, nodeData.x, nodeData.y);
|
|
1226
|
-
nodeMap.set(index, node);
|
|
1227
|
-
});
|
|
1001
|
+
async executeNode(node) {
|
|
1002
|
+
if (!this.isExecuting) return;
|
|
1228
1003
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
template.connections.forEach(conn => {
|
|
1232
|
-
const fromNode = nodeMap.get(conn.from);
|
|
1233
|
-
const toNode = nodeMap.get(conn.to);
|
|
1234
|
-
if (fromNode && toNode) {
|
|
1235
|
-
this.createConnection(
|
|
1236
|
-
{ node: fromNode, type: 'output', index: conn.fromIndex || 0 },
|
|
1237
|
-
{ node: toNode, type: 'input', index: conn.toIndex || 0 }
|
|
1238
|
-
);
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1004
|
+
node.status = 'executing';
|
|
1005
|
+
this.draw();
|
|
1242
1006
|
|
|
1243
|
-
|
|
1244
|
-
}
|
|
1007
|
+
this.logExecution(`Executing node: ${this.getNodeTitle(node.type)}`, 'info');
|
|
1245
1008
|
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
items.forEach(item => {
|
|
1251
|
-
const text = item.textContent.toLowerCase();
|
|
1252
|
-
item.style.display = text.includes(filter) ? 'block' : 'none';
|
|
1253
|
-
});
|
|
1254
|
-
}
|
|
1009
|
+
try {
|
|
1010
|
+
const result = await this.processNode(node);
|
|
1011
|
+
node.status = 'completed';
|
|
1012
|
+
this.executionState.set(node.id, result);
|
|
1255
1013
|
|
|
1256
|
-
|
|
1257
|
-
const targetTab = e.target.dataset.tab;
|
|
1258
|
-
|
|
1259
|
-
// Update button states
|
|
1260
|
-
document.querySelectorAll('.tab-button').forEach(btn => {
|
|
1261
|
-
btn.classList.remove('active');
|
|
1262
|
-
});
|
|
1263
|
-
e.target.classList.add('active');
|
|
1014
|
+
this.logExecution(`Node completed: ${this.getNodeTitle(node.type)}`, 'success');
|
|
1264
1015
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1016
|
+
// Execute connected nodes
|
|
1017
|
+
const connectedNodes = this.getConnectedNodes(node.id);
|
|
1018
|
+
for (let connectedNode of connectedNodes) {
|
|
1019
|
+
await this.executeNode(connectedNode);
|
|
1020
|
+
}
|
|
1021
|
+
} catch (error) {
|
|
1022
|
+
node.status = 'error';
|
|
1023
|
+
this.logExecution(`Node failed: ${this.getNodeTitle(node.type)} - ${error.message}`, 'error');
|
|
1024
|
+
throw error;
|
|
1270
1025
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
async processNode(node) {
|
|
1029
|
+
// Simulate node processing
|
|
1030
|
+
await new Promise((resolve) => setTimeout(resolve, 500 + Math.random() * 1000));
|
|
1031
|
+
|
|
1032
|
+
switch (node.type) {
|
|
1033
|
+
case 'file-input':
|
|
1034
|
+
return { type: 'file', path: node.properties.path };
|
|
1035
|
+
case 'text-input':
|
|
1036
|
+
return { type: 'text', value: node.properties.value };
|
|
1037
|
+
case 'transform':
|
|
1038
|
+
return { type: 'transformed', data: 'transformed_data' };
|
|
1039
|
+
case 'ai-analyze':
|
|
1040
|
+
return { type: 'analysis', confidence: 0.95, insights: [] };
|
|
1041
|
+
default:
|
|
1042
|
+
return { type: 'generic', processed: true };
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
getConnectedNodes(nodeId) {
|
|
1047
|
+
const connected = [];
|
|
1048
|
+
for (let connection of this.connections.values()) {
|
|
1049
|
+
if (connection.from === nodeId) {
|
|
1050
|
+
const node = this.nodes.get(connection.to);
|
|
1051
|
+
if (node) connected.push(node);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return connected;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
logExecution(message, type) {
|
|
1058
|
+
const log = document.querySelector('#executionTab .execution-log');
|
|
1059
|
+
const entry = document.createElement('div');
|
|
1060
|
+
entry.className = `log-entry ${type}`;
|
|
1061
|
+
entry.innerHTML = `
|
|
1062
|
+
<span class="timestamp">${new Date().toLocaleTimeString()}</span>
|
|
1063
|
+
<span class="message">${message}</span>
|
|
1064
|
+
`;
|
|
1065
|
+
log.appendChild(entry);
|
|
1066
|
+
log.scrollTop = log.scrollHeight;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
stopWorkflow() {
|
|
1070
|
+
this.isExecuting = false;
|
|
1071
|
+
|
|
1072
|
+
// Reset all node statuses
|
|
1073
|
+
for (let node of this.nodes.values()) {
|
|
1074
|
+
if (node.status === 'executing') {
|
|
1075
|
+
node.status = 'idle';
|
|
1076
|
+
}
|
|
1282
1077
|
}
|
|
1283
1078
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1079
|
+
this.logExecution('Workflow execution stopped by user', 'warning');
|
|
1080
|
+
this.draw();
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
saveWorkflow() {
|
|
1084
|
+
const workflow = {
|
|
1085
|
+
nodes: Array.from(this.nodes.values()),
|
|
1086
|
+
connections: Array.from(this.connections.values()),
|
|
1087
|
+
metadata: {
|
|
1088
|
+
version: '1.0',
|
|
1089
|
+
created: new Date().toISOString(),
|
|
1090
|
+
name: prompt('Enter workflow name:') || 'Untitled Workflow',
|
|
1091
|
+
},
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
const saved = JSON.parse(localStorage.getItem('claudeflow_workflows') || '[]');
|
|
1095
|
+
saved.push(workflow);
|
|
1096
|
+
localStorage.setItem('claudeflow_workflows', JSON.stringify(saved));
|
|
1097
|
+
|
|
1098
|
+
alert('Workflow saved successfully!');
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
loadWorkflow() {
|
|
1102
|
+
const saved = JSON.parse(localStorage.getItem('claudeflow_workflows') || '[]');
|
|
1103
|
+
if (saved.length === 0) {
|
|
1104
|
+
alert('No saved workflows found');
|
|
1105
|
+
return;
|
|
1287
1106
|
}
|
|
1288
1107
|
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1108
|
+
const names = saved.map((w, i) => `${i + 1}. ${w.metadata.name}`);
|
|
1109
|
+
const choice = prompt(`Select workflow to load:\n${names.join('\n')}`);
|
|
1110
|
+
|
|
1111
|
+
if (choice) {
|
|
1112
|
+
const index = parseInt(choice) - 1;
|
|
1113
|
+
if (index >= 0 && index < saved.length) {
|
|
1114
|
+
this.loadWorkflowData(saved[index]);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
loadWorkflowData(workflow) {
|
|
1120
|
+
this.nodes.clear();
|
|
1121
|
+
this.connections.clear();
|
|
1122
|
+
|
|
1123
|
+
workflow.nodes.forEach((nodeData) => {
|
|
1124
|
+
this.nodes.set(nodeData.id, { ...nodeData });
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
workflow.connections.forEach((connectionData) => {
|
|
1128
|
+
this.connections.set(connectionData.id, { ...connectionData });
|
|
1129
|
+
});
|
|
1130
|
+
|
|
1131
|
+
this.draw();
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
exportWorkflow() {
|
|
1135
|
+
const workflow = {
|
|
1136
|
+
nodes: Array.from(this.nodes.values()),
|
|
1137
|
+
connections: Array.from(this.connections.values()),
|
|
1138
|
+
metadata: {
|
|
1139
|
+
version: '1.0',
|
|
1140
|
+
exported: new Date().toISOString(),
|
|
1141
|
+
name: prompt('Enter workflow name:') || 'Exported Workflow',
|
|
1142
|
+
},
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
const blob = new Blob([JSON.stringify(workflow, null, 2)], { type: 'application/json' });
|
|
1146
|
+
const url = URL.createObjectURL(blob);
|
|
1147
|
+
const a = document.createElement('a');
|
|
1148
|
+
a.href = url;
|
|
1149
|
+
a.download = `${workflow.metadata.name}.json`;
|
|
1150
|
+
a.click();
|
|
1151
|
+
URL.revokeObjectURL(url);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
importWorkflow() {
|
|
1155
|
+
document.getElementById('importFile').click();
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
handleFileImport(e) {
|
|
1159
|
+
const file = e.target.files[0];
|
|
1160
|
+
if (!file) return;
|
|
1161
|
+
|
|
1162
|
+
const reader = new FileReader();
|
|
1163
|
+
reader.onload = (event) => {
|
|
1164
|
+
try {
|
|
1165
|
+
const workflow = JSON.parse(event.target.result);
|
|
1166
|
+
this.loadWorkflowData(workflow);
|
|
1167
|
+
alert('Workflow imported successfully!');
|
|
1168
|
+
} catch (error) {
|
|
1169
|
+
alert('Error importing workflow: ' + error.message);
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
reader.readAsText(file);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
loadTemplates() {
|
|
1176
|
+
const templates = [
|
|
1177
|
+
{
|
|
1178
|
+
name: 'Data Processing Pipeline',
|
|
1179
|
+
description: 'Process files through transformation and analysis',
|
|
1180
|
+
nodes: [
|
|
1181
|
+
{ type: 'file-input', x: 50, y: 100 },
|
|
1182
|
+
{ type: 'transform', x: 250, y: 100 },
|
|
1183
|
+
{ type: 'ai-analyze', x: 450, y: 100 },
|
|
1184
|
+
{ type: 'file-output', x: 650, y: 100 },
|
|
1185
|
+
],
|
|
1186
|
+
},
|
|
1187
|
+
{
|
|
1188
|
+
name: 'Content Generation',
|
|
1189
|
+
description: 'Generate and process content using AI',
|
|
1190
|
+
nodes: [
|
|
1191
|
+
{ type: 'text-input', x: 50, y: 100 },
|
|
1192
|
+
{ type: 'ai-generate', x: 250, y: 100 },
|
|
1193
|
+
{ type: 'ai-summarize', x: 450, y: 100 },
|
|
1194
|
+
{ type: 'display', x: 650, y: 100 },
|
|
1195
|
+
],
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
name: 'API Integration',
|
|
1199
|
+
description: 'Fetch, process, and send data via APIs',
|
|
1200
|
+
nodes: [
|
|
1201
|
+
{ type: 'api-input', x: 50, y: 100 },
|
|
1202
|
+
{ type: 'filter', x: 250, y: 100 },
|
|
1203
|
+
{ type: 'transform', x: 450, y: 100 },
|
|
1204
|
+
{ type: 'api-output', x: 650, y: 100 },
|
|
1205
|
+
],
|
|
1206
|
+
},
|
|
1207
|
+
];
|
|
1208
|
+
|
|
1209
|
+
const gallery = document.querySelector('.template-gallery');
|
|
1210
|
+
gallery.innerHTML = templates
|
|
1211
|
+
.map(
|
|
1212
|
+
(template) => `
|
|
1213
|
+
<div class="template-card" data-template="${template.name}">
|
|
1214
|
+
<h4>${template.name}</h4>
|
|
1215
|
+
<p>${template.description}</p>
|
|
1216
|
+
<button class="btn btn-primary load-template">Load Template</button>
|
|
1217
|
+
</div>
|
|
1218
|
+
`,
|
|
1219
|
+
)
|
|
1220
|
+
.join('');
|
|
1221
|
+
|
|
1222
|
+
// Add event listeners
|
|
1223
|
+
gallery.querySelectorAll('.load-template').forEach((btn) => {
|
|
1224
|
+
btn.addEventListener('click', (e) => {
|
|
1225
|
+
const templateName = e.target.closest('.template-card').dataset.template;
|
|
1226
|
+
const template = templates.find((t) => t.name === templateName);
|
|
1227
|
+
if (template) {
|
|
1228
|
+
this.loadTemplate(template);
|
|
1295
1229
|
}
|
|
1230
|
+
});
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
loadTemplate(template) {
|
|
1235
|
+
this.clearCanvas();
|
|
1236
|
+
|
|
1237
|
+
const nodeMap = new Map();
|
|
1238
|
+
|
|
1239
|
+
// Create nodes
|
|
1240
|
+
template.nodes.forEach((nodeData, index) => {
|
|
1241
|
+
const node = this.createNode(nodeData.type, nodeData.x, nodeData.y);
|
|
1242
|
+
nodeMap.set(index, node);
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
// Create connections (if defined in template)
|
|
1246
|
+
if (template.connections) {
|
|
1247
|
+
template.connections.forEach((conn) => {
|
|
1248
|
+
const fromNode = nodeMap.get(conn.from);
|
|
1249
|
+
const toNode = nodeMap.get(conn.to);
|
|
1250
|
+
if (fromNode && toNode) {
|
|
1251
|
+
this.createConnection(
|
|
1252
|
+
{ node: fromNode, type: 'output', index: conn.fromIndex || 0 },
|
|
1253
|
+
{ node: toNode, type: 'input', index: conn.toIndex || 0 },
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1296
1257
|
}
|
|
1297
1258
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1259
|
+
this.draw();
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
filterPalette(e) {
|
|
1263
|
+
const filter = e.target.value.toLowerCase();
|
|
1264
|
+
const items = document.querySelectorAll('.palette-item');
|
|
1265
|
+
|
|
1266
|
+
items.forEach((item) => {
|
|
1267
|
+
const text = item.textContent.toLowerCase();
|
|
1268
|
+
item.style.display = text.includes(filter) ? 'block' : 'none';
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
switchTab(e) {
|
|
1273
|
+
const targetTab = e.target.dataset.tab;
|
|
1274
|
+
|
|
1275
|
+
// Update button states
|
|
1276
|
+
document.querySelectorAll('.tab-button').forEach((btn) => {
|
|
1277
|
+
btn.classList.remove('active');
|
|
1278
|
+
});
|
|
1279
|
+
e.target.classList.add('active');
|
|
1280
|
+
|
|
1281
|
+
// Update tab content
|
|
1282
|
+
document.querySelectorAll('.tab-content').forEach((content) => {
|
|
1283
|
+
content.classList.remove('active');
|
|
1284
|
+
});
|
|
1285
|
+
document.getElementById(targetTab + 'Tab').classList.add('active');
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
switchTabToValidation() {
|
|
1289
|
+
document.querySelectorAll('.tab-button').forEach((btn) => {
|
|
1290
|
+
btn.classList.remove('active');
|
|
1291
|
+
});
|
|
1292
|
+
document.querySelector('[data-tab="validation"]').classList.add('active');
|
|
1293
|
+
|
|
1294
|
+
document.querySelectorAll('.tab-content').forEach((content) => {
|
|
1295
|
+
content.classList.remove('active');
|
|
1296
|
+
});
|
|
1297
|
+
document.getElementById('validationTab').classList.add('active');
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
setZoom(newZoom) {
|
|
1301
|
+
this.zoom = Math.max(0.1, Math.min(3, newZoom));
|
|
1302
|
+
this.draw();
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
clearCanvas() {
|
|
1306
|
+
if (confirm('Are you sure you want to clear the canvas?')) {
|
|
1307
|
+
this.nodes.clear();
|
|
1308
|
+
this.connections.clear();
|
|
1309
|
+
this.selectedNode = null;
|
|
1310
|
+
this.draw();
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
showContextMenu(x, y, node) {
|
|
1315
|
+
const menu = document.createElement('div');
|
|
1316
|
+
menu.className = 'context-menu';
|
|
1317
|
+
menu.style.left = x + 'px';
|
|
1318
|
+
menu.style.top = y + 'px';
|
|
1319
|
+
menu.innerHTML = `
|
|
1304
1320
|
<div class="context-menu-item" data-action="duplicate">
|
|
1305
1321
|
<i class="fas fa-copy"></i> Duplicate
|
|
1306
1322
|
</div>
|
|
@@ -1312,73 +1328,73 @@ class WorkflowDesigner {
|
|
|
1312
1328
|
</div>
|
|
1313
1329
|
`;
|
|
1314
1330
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1331
|
+
document.body.appendChild(menu);
|
|
1332
|
+
|
|
1333
|
+
menu.addEventListener('click', (e) => {
|
|
1334
|
+
const action = e.target.dataset.action;
|
|
1335
|
+
switch (action) {
|
|
1336
|
+
case 'duplicate':
|
|
1337
|
+
this.duplicateNode(node);
|
|
1338
|
+
break;
|
|
1339
|
+
case 'delete':
|
|
1340
|
+
this.deleteNode(node);
|
|
1341
|
+
break;
|
|
1342
|
+
case 'properties':
|
|
1343
|
+
this.showProperties(node);
|
|
1344
|
+
break;
|
|
1345
|
+
}
|
|
1346
|
+
document.body.removeChild(menu);
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
// Remove menu when clicking elsewhere
|
|
1350
|
+
setTimeout(() => {
|
|
1351
|
+
document.addEventListener('click', function removeMenu() {
|
|
1352
|
+
if (menu.parentNode) {
|
|
1353
|
+
document.body.removeChild(menu);
|
|
1354
|
+
}
|
|
1355
|
+
document.removeEventListener('click', removeMenu);
|
|
1356
|
+
});
|
|
1357
|
+
}, 100);
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
duplicateNode(node) {
|
|
1361
|
+
const newNode = this.createNode(node.type, node.x + 50, node.y + 50);
|
|
1362
|
+
newNode.properties = { ...node.properties };
|
|
1363
|
+
this.draw();
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
deleteNode(node) {
|
|
1367
|
+
// Remove connections
|
|
1368
|
+
const connectionsToRemove = [];
|
|
1369
|
+
for (let [id, connection] of this.connections) {
|
|
1370
|
+
if (connection.from === node.id || connection.to === node.id) {
|
|
1371
|
+
connectionsToRemove.push(id);
|
|
1372
|
+
}
|
|
1342
1373
|
}
|
|
1374
|
+
connectionsToRemove.forEach((id) => this.connections.delete(id));
|
|
1343
1375
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
newNode.properties = { ...node.properties };
|
|
1347
|
-
this.draw();
|
|
1348
|
-
}
|
|
1376
|
+
// Remove node
|
|
1377
|
+
this.nodes.delete(node.id);
|
|
1349
1378
|
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
for (let [id, connection] of this.connections) {
|
|
1354
|
-
if (connection.from === node.id || connection.to === node.id) {
|
|
1355
|
-
connectionsToRemove.push(id);
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
connectionsToRemove.forEach(id => this.connections.delete(id));
|
|
1359
|
-
|
|
1360
|
-
// Remove node
|
|
1361
|
-
this.nodes.delete(node.id);
|
|
1362
|
-
|
|
1363
|
-
if (this.selectedNode === node) {
|
|
1364
|
-
this.selectedNode = null;
|
|
1365
|
-
this.showProperties(null);
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
this.draw();
|
|
1379
|
+
if (this.selectedNode === node) {
|
|
1380
|
+
this.selectedNode = null;
|
|
1381
|
+
this.showProperties(null);
|
|
1369
1382
|
}
|
|
1370
1383
|
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1384
|
+
this.draw();
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
handleResize() {
|
|
1388
|
+
this.setupCanvas();
|
|
1389
|
+
}
|
|
1374
1390
|
}
|
|
1375
1391
|
|
|
1376
1392
|
// Initialize the workflow designer when the page loads
|
|
1377
1393
|
document.addEventListener('DOMContentLoaded', () => {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1394
|
+
if (document.getElementById('workflowDesigner')) {
|
|
1395
|
+
window.workflowDesigner = new WorkflowDesigner('workflowDesigner');
|
|
1396
|
+
}
|
|
1381
1397
|
});
|
|
1382
1398
|
|
|
1383
1399
|
// Export for external use
|
|
1384
|
-
window.WorkflowDesigner = WorkflowDesigner;
|
|
1400
|
+
window.WorkflowDesigner = WorkflowDesigner;
|