claude-flow-novice 2.0.3 → 2.0.4
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/dist/src/cli/commands/guidance.js +487 -668
- package/dist/src/cli/commands/index-validate.js +18 -29
- package/dist/src/cli/commands/mcp-troubleshoot.js +230 -282
- package/dist/src/cli/commands/neural-goal-init.js +92 -125
- package/dist/src/cli/commands/swarm-exec.js +317 -393
- package/dist/src/cli/commands/swarm.js +1 -1
- package/dist/src/cli/commands/validate-framework.js +983 -1100
- package/dist/src/cli/commands/validate.js +144 -223
- package/dist/src/cli/simple-commands/__tests__/agent.test.js +265 -277
- package/dist/src/cli/simple-commands/__tests__/memory.test.js +6 -7
- package/dist/src/cli/simple-commands/__tests__/swarm.test.js +373 -356
- package/dist/src/cli/simple-commands/__tests__/task.test.js +6 -7
- package/dist/src/cli/simple-commands/agent.js +157 -193
- package/dist/src/cli/simple-commands/analysis.js +336 -446
- package/dist/src/cli/simple-commands/automation-executor.js +1095 -1339
- package/dist/src/cli/simple-commands/automation.js +481 -469
- package/dist/src/cli/simple-commands/batch-manager.js +261 -313
- package/dist/src/cli/simple-commands/claude-telemetry.js +241 -267
- package/dist/src/cli/simple-commands/claude-track.js +68 -90
- package/dist/src/cli/simple-commands/concurrent-display.js +266 -320
- package/dist/src/cli/simple-commands/config.js +245 -290
- package/dist/src/cli/simple-commands/coordination.js +182 -234
- package/dist/src/cli/simple-commands/enhanced-ui-views.js +812 -615
- package/dist/src/cli/simple-commands/enhanced-webui-complete.js +922 -981
- package/dist/src/cli/simple-commands/fix-hook-variables.js +274 -294
- package/dist/src/cli/simple-commands/github/gh-coordinator.js +378 -457
- package/dist/src/cli/simple-commands/github/github-api.js +535 -574
- package/dist/src/cli/simple-commands/github/init.js +276 -303
- package/dist/src/cli/simple-commands/github.js +222 -247
- package/dist/src/cli/simple-commands/goal.js +51 -63
- package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +208 -278
- package/dist/src/cli/simple-commands/hive-mind/communication.js +601 -696
- package/dist/src/cli/simple-commands/hive-mind/core.js +907 -979
- package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +406 -655
- package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1125 -1245
- package/dist/src/cli/simple-commands/hive-mind/memory.js +854 -1090
- package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +459 -574
- package/dist/src/cli/simple-commands/hive-mind/performance-test.js +263 -347
- package/dist/src/cli/simple-commands/hive-mind/queen.js +727 -768
- package/dist/src/cli/simple-commands/hive-mind/session-manager.js +745 -1049
- package/dist/src/cli/simple-commands/hive-mind-optimize.js +227 -283
- package/dist/src/cli/simple-commands/hive-mind-wizard.js +174 -217
- package/dist/src/cli/simple-commands/hive-mind.js +1842 -2283
- package/dist/src/cli/simple-commands/hive.js +90 -79
- package/dist/src/cli/simple-commands/hook-safety.js +431 -521
- package/dist/src/cli/simple-commands/hooks/session-start-soul.js +203 -254
- package/dist/src/cli/simple-commands/hooks.js +1064 -1204
- package/dist/src/cli/simple-commands/init/agent-copier.js +294 -319
- package/dist/src/cli/simple-commands/init/batch-init.js +496 -562
- package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +13 -19
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +13 -19
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +61 -88
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +125 -150
- package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +42 -49
- package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +43 -61
- package/dist/src/cli/simple-commands/init/copy-revised-templates.js +141 -147
- package/dist/src/cli/simple-commands/init/executable-wrapper.js +31 -44
- package/dist/src/cli/simple-commands/init/gitignore-updater.js +64 -90
- package/dist/src/cli/simple-commands/init/help.js +104 -107
- package/dist/src/cli/simple-commands/init/hive-mind-init.js +509 -528
- package/dist/src/cli/simple-commands/init/index.js +1510 -1759
- package/dist/src/cli/simple-commands/init/performance-monitor.js +234 -317
- package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +441 -504
- package/dist/src/cli/simple-commands/init/rollback/index.js +289 -364
- package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +652 -728
- package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +416 -481
- package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +369 -448
- package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +1 -2
- package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +122 -99
- package/dist/src/cli/simple-commands/init/sparc/workflows.js +32 -37
- package/dist/src/cli/simple-commands/init/sparc-structure.js +55 -62
- package/dist/src/cli/simple-commands/init/template-copier.js +421 -533
- package/dist/src/cli/simple-commands/init/templates/coordination-md.js +3 -6
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +344 -318
- package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +173 -218
- package/dist/src/cli/simple-commands/init/templates/github-safe.js +65 -75
- package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +3 -6
- package/dist/src/cli/simple-commands/init/templates/readme-files.js +2 -4
- package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +187 -230
- package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +53 -80
- package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +101 -85
- package/dist/src/cli/simple-commands/init/validation/config-validator.js +283 -330
- package/dist/src/cli/simple-commands/init/validation/health-checker.js +495 -561
- package/dist/src/cli/simple-commands/init/validation/index.js +302 -358
- package/dist/src/cli/simple-commands/init/validation/mode-validator.js +308 -359
- package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +389 -366
- package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +270 -268
- package/dist/src/cli/simple-commands/init/validation/test-runner.js +427 -447
- package/dist/src/cli/simple-commands/init.js +1 -2
- package/dist/src/cli/simple-commands/mcp-health.js +131 -158
- package/dist/src/cli/simple-commands/mcp-integration-layer.js +533 -634
- package/dist/src/cli/simple-commands/mcp.js +345 -400
- package/dist/src/cli/simple-commands/memory-consolidation.js +426 -537
- package/dist/src/cli/simple-commands/memory.js +247 -311
- package/dist/src/cli/simple-commands/migrate-hooks.js +39 -46
- package/dist/src/cli/simple-commands/monitor.js +294 -363
- package/dist/src/cli/simple-commands/neural.js +51 -65
- package/dist/src/cli/simple-commands/pair-autofix-only.js +538 -662
- package/dist/src/cli/simple-commands/pair-basic.js +528 -656
- package/dist/src/cli/simple-commands/pair-old.js +430 -543
- package/dist/src/cli/simple-commands/pair-working.js +615 -751
- package/dist/src/cli/simple-commands/pair.js +615 -751
- package/dist/src/cli/simple-commands/performance-hooks.js +83 -111
- package/dist/src/cli/simple-commands/performance-metrics.js +348 -433
- package/dist/src/cli/simple-commands/process-ui-enhanced.js +708 -787
- package/dist/src/cli/simple-commands/process-ui.js +230 -254
- package/dist/src/cli/simple-commands/realtime-update-system.js +525 -611
- package/dist/src/cli/simple-commands/sparc/architecture.js +1704 -1530
- package/dist/src/cli/simple-commands/sparc/commands.js +438 -516
- package/dist/src/cli/simple-commands/sparc/completion.js +1224 -1481
- package/dist/src/cli/simple-commands/sparc/coordinator.js +913 -978
- package/dist/src/cli/simple-commands/sparc/index.js +241 -298
- package/dist/src/cli/simple-commands/sparc/phase-base.js +314 -390
- package/dist/src/cli/simple-commands/sparc/pseudocode.js +965 -869
- package/dist/src/cli/simple-commands/sparc/refinement.js +980 -1273
- package/dist/src/cli/simple-commands/sparc/specification.js +559 -645
- package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/index.js +47 -55
- package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/swarm.js +101 -87
- package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/dist/src/cli/simple-commands/sparc.js +465 -493
- package/dist/src/cli/simple-commands/start-ui.js +108 -132
- package/dist/src/cli/simple-commands/start-wrapper.js +240 -268
- package/dist/src/cli/simple-commands/start.js +1 -1
- package/dist/src/cli/simple-commands/status.js +254 -275
- package/dist/src/cli/simple-commands/stream-chain-clean.js +128 -171
- package/dist/src/cli/simple-commands/stream-chain-fixed.js +61 -82
- package/dist/src/cli/simple-commands/stream-chain-real.js +267 -331
- package/dist/src/cli/simple-commands/stream-chain-working.js +211 -263
- package/dist/src/cli/simple-commands/stream-chain.js +260 -318
- package/dist/src/cli/simple-commands/stream-processor.js +290 -315
- package/dist/src/cli/simple-commands/swarm-executor.js +189 -222
- package/dist/src/cli/simple-commands/swarm-metrics-integration.js +208 -300
- package/dist/src/cli/simple-commands/swarm-ui.js +623 -703
- package/dist/src/cli/simple-commands/swarm-webui-integration.js +258 -286
- package/dist/src/cli/simple-commands/swarm.js +887 -1082
- package/dist/src/cli/simple-commands/task.js +161 -206
- package/dist/src/cli/simple-commands/timestamp-fix.js +59 -89
- package/dist/src/cli/simple-commands/token-tracker.js +258 -316
- package/dist/src/cli/simple-commands/tool-execution-framework.js +433 -519
- package/dist/src/cli/simple-commands/train-and-stream.js +275 -331
- package/dist/src/cli/simple-commands/training-pipeline.js +619 -725
- package/dist/src/cli/simple-commands/training.js +170 -227
- package/dist/src/cli/simple-commands/verification-hooks.js +261 -284
- package/dist/src/cli/simple-commands/verification-integration.js +389 -417
- package/dist/src/cli/simple-commands/verification-training-integration.js +486 -606
- package/dist/src/cli/simple-commands/verification.js +493 -513
- package/dist/src/cli/simple-commands/web-server.js +766 -836
- package/dist/src/cli/simple-commands/webui-validator.js +106 -124
- package/dist/src/coordination/event-bus/demo-wasm-integration.js +212 -251
- package/dist/src/coordination/event-bus/qe-event-bus.js +608 -748
- package/dist/src/coordination/event-bus/qe-event-bus.test.js +379 -454
- package/dist/src/coordination/iteration-tracker.js +363 -454
- package/dist/src/enterprise/analytics-manager.js +1135 -0
- package/dist/src/enterprise/audit-manager.js +1115 -0
- package/dist/src/enterprise/cloud-manager.js +891 -0
- package/dist/src/enterprise/deployment-manager.js +966 -0
- package/dist/src/enterprise/index.js +6 -0
- package/dist/src/enterprise/project-manager.js +584 -0
- package/dist/src/enterprise/security-manager.js +991 -0
- package/dist/src/index.js +1 -1
- package/dist/src/mcp/DEPRECATED.js +46 -60
- package/dist/src/mcp/fixes/mcp-error-fixes.js +115 -134
- package/dist/src/mcp/implementations/agent-tracker.js +114 -128
- package/dist/src/mcp/implementations/daa-tools.js +292 -350
- package/dist/src/mcp/implementations/workflow-tools.js +329 -361
- package/dist/src/mcp/mcp-config-manager.js +1183 -1331
- package/dist/src/mcp/mcp-server-novice-simplified.js +11 -17
- package/dist/src/mcp/mcp-server-novice.js +11 -17
- package/dist/src/mcp/mcp-server-sdk.js +11 -17
- package/dist/src/mcp/mcp-server.js +1620 -1484
- package/dist/src/mcp/ruv-swarm-wrapper.js +209 -239
- package/dist/src/memory/advanced-serializer.js +609 -589
- package/dist/src/memory/enhanced-examples.js +220 -305
- package/dist/src/memory/enhanced-memory.js +295 -336
- package/dist/src/memory/enhanced-session-serializer.js +408 -492
- package/dist/src/memory/fallback-memory-system.js +900 -1021
- package/dist/src/memory/fallback-store.js +93 -131
- package/dist/src/memory/high-performance-serialization.js +592 -730
- package/dist/src/memory/in-memory-store.js +161 -213
- package/dist/src/memory/index.js +123 -157
- package/dist/src/memory/lock-free-structures.js +578 -764
- package/dist/src/memory/memory-mapped-persistence.js +585 -766
- package/dist/src/memory/memory-pressure-manager.js +569 -707
- package/dist/src/memory/migration.js +358 -445
- package/dist/src/memory/shared-memory.js +641 -768
- package/dist/src/memory/sqlite-store.js +245 -325
- package/dist/src/memory/sqlite-wrapper.js +122 -151
- package/dist/src/memory/swarm-memory.js +470 -603
- package/dist/src/memory/test-example.js +126 -134
- package/dist/src/memory/ultra-fast-memory-store.js +622 -821
- package/dist/src/memory/unified-memory-manager.js +356 -437
- package/dist/src/migration/index.js +92 -0
- package/dist/src/migration/logger.js +121 -0
- package/dist/src/migration/migration-analyzer.js +268 -0
- package/dist/src/migration/migration-runner.js +522 -0
- package/dist/src/migration/migration-validator.js +285 -0
- package/dist/src/migration/progress-reporter.js +150 -0
- package/dist/src/migration/rollback-manager.js +321 -0
- package/dist/src/migration/tests/migration-system.test.js +7 -0
- package/dist/src/migration/types.js +3 -0
- package/dist/src/swarm/CodeRefactoringSwarm.js +777 -952
- package/dist/src/swarm/__tests__/integration.test.js +227 -0
- package/dist/src/swarm/__tests__/prompt-copier.test.js +344 -0
- package/dist/src/swarm/advanced-orchestrator.js +1095 -0
- package/dist/src/swarm/claude-code-interface.js +961 -0
- package/dist/src/swarm/claude-flow-executor.js +229 -0
- package/dist/src/swarm/consensus-coordinator.js +475 -0
- package/dist/src/swarm/coordinator.js +2993 -0
- package/dist/src/swarm/direct-executor.js +1180 -0
- package/dist/src/swarm/error-recovery/advanced-error-detection.js +691 -0
- package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +998 -0
- package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +1197 -0
- package/dist/src/swarm/error-recovery/recovery-monitoring.js +772 -0
- package/dist/src/swarm/error-recovery/resilience-architecture.js +714 -0
- package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +1319 -0
- package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +808 -0
- package/dist/src/swarm/executor-v2.js +322 -0
- package/dist/src/swarm/executor.js +815 -0
- package/dist/src/swarm/hive-mind-integration.js +703 -0
- package/dist/src/swarm/index.js +41 -0
- package/dist/src/swarm/json-output-aggregator.js +267 -0
- package/dist/src/swarm/large-scale-coordinator.js +542 -0
- package/dist/src/swarm/mcp-integration-wrapper.js +628 -0
- package/dist/src/swarm/memory.js +1117 -0
- package/dist/src/swarm/optimizations/__tests__/optimization.test.js +348 -0
- package/dist/src/swarm/optimizations/async-file-manager.js +285 -0
- package/dist/src/swarm/optimizations/circular-buffer.js +162 -0
- package/dist/src/swarm/optimizations/connection-pool.js +244 -0
- package/dist/src/swarm/optimizations/index.js +28 -0
- package/dist/src/swarm/optimizations/optimized-executor.js +320 -0
- package/dist/src/swarm/optimizations/ttl-map.js +234 -0
- package/dist/src/swarm/prompt-cli.js +200 -0
- package/dist/src/swarm/prompt-copier-enhanced.js +202 -0
- package/dist/src/swarm/prompt-copier.js +381 -0
- package/dist/src/swarm/prompt-manager.js +295 -0
- package/dist/src/swarm/prompt-utils.js +310 -0
- package/dist/src/swarm/result-aggregator.js +718 -0
- package/dist/src/swarm/sparc-executor.js +1568 -0
- package/dist/src/swarm/strategies/auto.js +758 -0
- package/dist/src/swarm/strategies/base.js +128 -0
- package/dist/src/swarm/strategies/research.js +914 -0
- package/dist/src/swarm/strategies/strategy-metrics-patch.js +2 -0
- package/dist/src/swarm/types.js +52 -0
- package/dist/src/swarm/workers/copy-worker.js +56 -0
- package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +332 -400
- package/dist/src/utils/github-cli-safe.js +56 -64
- package/dist/src/utils/github-cli-safety-wrapper.js +451 -546
- package/dist/src/utils/npx-isolated-cache.js +104 -119
- package/dist/src/utils/preference-manager.js +622 -652
- package/dist/src/utils/timezone-utils.js +86 -105
- package/dist/src/validators/epic-config-schema.js +214 -0
- package/dist/src/validators/index.js +10 -0
- package/dist/src/validators/swarm-init-validator.js +259 -0
- package/dist/src/validators/todowrite-batching-validator.js +215 -0
- package/dist/src/validators/todowrite-integration.js +187 -0
- package/package.json +2 -2
|
@@ -1,821 +1,742 @@
|
|
|
1
1
|
// process-ui-enhanced.js - Enhanced process management UI with multiple views - v2.0.0-alpha.83
|
|
2
|
-
import { printSuccess
|
|
3
|
-
import { compat } from
|
|
4
|
-
import SwarmWebUIIntegration from
|
|
5
|
-
|
|
2
|
+
import { printSuccess } from "../utils.js";
|
|
3
|
+
import { compat } from "../runtime-detector.js";
|
|
4
|
+
import SwarmWebUIIntegration from "./swarm-webui-integration.js";
|
|
6
5
|
// Simple color utilities
|
|
7
6
|
const colors = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
cyan: (text)=>`\x1b[36m${text}\x1b[0m`,
|
|
8
|
+
gray: (text)=>`\x1b[90m${text}\x1b[0m`,
|
|
9
|
+
white: (text)=>`\x1b[37m${text}\x1b[0m`,
|
|
10
|
+
yellow: (text)=>`\x1b[33m${text}\x1b[0m`,
|
|
11
|
+
green: (text)=>`\x1b[32m${text}\x1b[0m`,
|
|
12
|
+
red: (text)=>`\x1b[31m${text}\x1b[0m`,
|
|
13
|
+
blue: (text)=>`\x1b[34m${text}\x1b[0m`,
|
|
14
|
+
magenta: (text)=>`\x1b[35m${text}\x1b[0m`,
|
|
15
|
+
bold: (text)=>`\x1b[1m${text}\x1b[0m`,
|
|
16
|
+
dim: (text)=>`\x1b[2m${text}\x1b[0m`
|
|
18
17
|
};
|
|
19
|
-
|
|
20
18
|
const PROCESSES = [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
{
|
|
20
|
+
id: 'event-bus',
|
|
21
|
+
name: 'Event Bus',
|
|
22
|
+
description: 'Central event distribution system'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'orchestrator',
|
|
26
|
+
name: 'Orchestrator',
|
|
27
|
+
description: 'Main coordination engine'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'memory-manager',
|
|
31
|
+
name: 'Memory Manager',
|
|
32
|
+
description: 'Persistent memory system'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'terminal-pool',
|
|
36
|
+
name: 'Terminal Pool',
|
|
37
|
+
description: 'Terminal session management'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'mcp-server',
|
|
41
|
+
name: 'MCP Server',
|
|
42
|
+
description: 'Model Context Protocol server'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'coordinator',
|
|
46
|
+
name: 'Coordinator',
|
|
47
|
+
description: 'Task coordination service'
|
|
48
|
+
}
|
|
27
49
|
];
|
|
28
|
-
|
|
29
50
|
// View modes
|
|
30
51
|
const VIEWS = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
PROCESSES: 'processes',
|
|
53
|
+
STATUS: 'status',
|
|
54
|
+
ORCHESTRATION: 'orchestration',
|
|
55
|
+
MEMORY: 'memory',
|
|
56
|
+
LOGS: 'logs',
|
|
57
|
+
HELP: 'help'
|
|
37
58
|
};
|
|
38
|
-
|
|
39
59
|
export class EnhancedProcessUI {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{ name: 'tasks', entries: 8, size: '24.1 KB' },
|
|
98
|
-
{ name: 'system', entries: 7, size: '48.3 KB' },
|
|
99
|
-
],
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// Initial logs
|
|
103
|
-
this.logs = [
|
|
104
|
-
{ time: new Date(), level: 'info', message: 'System initialized' },
|
|
105
|
-
{ time: new Date(), level: 'success', message: 'All processes ready' },
|
|
106
|
-
{ time: new Date(), level: 'success', message: 'Swarm orchestration active' },
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async start() {
|
|
111
|
-
// Clear screen
|
|
112
|
-
console.clear();
|
|
113
|
-
|
|
114
|
-
// Show welcome
|
|
115
|
-
printSuccess('🧠 Claude-Flow Process Management UI v2.0.0-alpha.80');
|
|
116
|
-
console.log('─'.repeat(80));
|
|
117
|
-
console.log();
|
|
118
|
-
|
|
119
|
-
// Initial render
|
|
120
|
-
this.render();
|
|
121
|
-
|
|
122
|
-
// Main UI loop
|
|
123
|
-
while (this.running) {
|
|
124
|
-
await this.handleInput();
|
|
125
|
-
if (this.running) {
|
|
60
|
+
async initializeSwarm() {
|
|
61
|
+
// Initialize swarm with mock data
|
|
62
|
+
await this.swarmIntegration.initializeSwarm('hierarchical', 8);
|
|
63
|
+
// Mock memory namespaces
|
|
64
|
+
this.memoryStats = {
|
|
65
|
+
totalEntries: 42,
|
|
66
|
+
totalSize: '156.3 KB',
|
|
67
|
+
namespaces: [
|
|
68
|
+
{
|
|
69
|
+
name: 'sparc',
|
|
70
|
+
entries: 15,
|
|
71
|
+
size: '45.2 KB'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'agents',
|
|
75
|
+
entries: 12,
|
|
76
|
+
size: '38.7 KB'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'tasks',
|
|
80
|
+
entries: 8,
|
|
81
|
+
size: '24.1 KB'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'system',
|
|
85
|
+
entries: 7,
|
|
86
|
+
size: '48.3 KB'
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
};
|
|
90
|
+
// Initial logs
|
|
91
|
+
this.logs = [
|
|
92
|
+
{
|
|
93
|
+
time: new Date(),
|
|
94
|
+
level: 'info',
|
|
95
|
+
message: 'System initialized'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
time: new Date(),
|
|
99
|
+
level: 'success',
|
|
100
|
+
message: 'All processes ready'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
time: new Date(),
|
|
104
|
+
level: 'success',
|
|
105
|
+
message: 'Swarm orchestration active'
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
async start() {
|
|
110
|
+
// Clear screen
|
|
111
|
+
console.clear();
|
|
112
|
+
// Show welcome
|
|
113
|
+
printSuccess('🧠 Claude-Flow Process Management UI v2.0.0-alpha.80');
|
|
114
|
+
console.log('─'.repeat(80));
|
|
115
|
+
console.log();
|
|
116
|
+
// Initial render
|
|
126
117
|
this.render();
|
|
127
|
-
|
|
118
|
+
// Main UI loop
|
|
119
|
+
while(this.running){
|
|
120
|
+
await this.handleInput();
|
|
121
|
+
if (this.running) {
|
|
122
|
+
this.render();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
128
125
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.
|
|
157
|
-
break;
|
|
126
|
+
render() {
|
|
127
|
+
// Clear screen and move cursor to top
|
|
128
|
+
console.log('\x1b[2J\x1b[H');
|
|
129
|
+
// Header with navigation
|
|
130
|
+
this.renderHeader();
|
|
131
|
+
// Main content based on current view
|
|
132
|
+
switch(this.currentView){
|
|
133
|
+
case VIEWS.PROCESSES:
|
|
134
|
+
this.renderProcessView();
|
|
135
|
+
break;
|
|
136
|
+
case VIEWS.STATUS:
|
|
137
|
+
this.renderStatusView();
|
|
138
|
+
break;
|
|
139
|
+
case VIEWS.ORCHESTRATION:
|
|
140
|
+
this.renderOrchestrationView();
|
|
141
|
+
break;
|
|
142
|
+
case VIEWS.MEMORY:
|
|
143
|
+
this.renderMemoryView();
|
|
144
|
+
break;
|
|
145
|
+
case VIEWS.LOGS:
|
|
146
|
+
this.renderLogsView();
|
|
147
|
+
break;
|
|
148
|
+
case VIEWS.HELP:
|
|
149
|
+
this.renderHelpView();
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
// Footer with controls
|
|
153
|
+
this.renderFooter();
|
|
158
154
|
}
|
|
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
|
-
if (process.status === 'running') {
|
|
205
|
-
const stats = colors.dim(
|
|
206
|
-
`PID: ${process.pid} | Uptime: ${this.formatUptime(process.uptime)} | CPU: ${process.cpu.toFixed(1)}% | Mem: ${process.memory.toFixed(0)}MB`,
|
|
207
|
-
);
|
|
208
|
-
console.log(` ${stats}`);
|
|
209
|
-
}
|
|
210
|
-
console.log();
|
|
211
|
-
|
|
212
|
-
index++;
|
|
155
|
+
renderHeader() {
|
|
156
|
+
console.log(colors.cyan(colors.bold('🧠 Claude-Flow Process Manager')));
|
|
157
|
+
console.log(colors.gray('─'.repeat(80)));
|
|
158
|
+
// Navigation tabs
|
|
159
|
+
const tabs = [
|
|
160
|
+
{
|
|
161
|
+
key: '1',
|
|
162
|
+
view: VIEWS.PROCESSES,
|
|
163
|
+
label: 'Processes'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
key: '2',
|
|
167
|
+
view: VIEWS.STATUS,
|
|
168
|
+
label: 'Status'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
key: '3',
|
|
172
|
+
view: VIEWS.ORCHESTRATION,
|
|
173
|
+
label: 'Orchestration'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: '4',
|
|
177
|
+
view: VIEWS.MEMORY,
|
|
178
|
+
label: 'Memory'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
key: '5',
|
|
182
|
+
view: VIEWS.LOGS,
|
|
183
|
+
label: 'Logs'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
key: '6',
|
|
187
|
+
view: VIEWS.HELP,
|
|
188
|
+
label: 'Help'
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
let tabLine = '';
|
|
192
|
+
tabs.forEach((tab)=>{
|
|
193
|
+
const isActive = this.currentView === tab.view;
|
|
194
|
+
const label = isActive ? colors.yellow(`[${tab.label}]`) : colors.gray(`${tab.label}`);
|
|
195
|
+
tabLine += ` ${colors.bold(tab.key)}:${label}`;
|
|
196
|
+
});
|
|
197
|
+
console.log(tabLine);
|
|
198
|
+
console.log(colors.gray('─'.repeat(80)));
|
|
199
|
+
console.log();
|
|
213
200
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
// Resource usage
|
|
238
|
-
console.log(colors.cyan('💻 Resource Usage'));
|
|
239
|
-
console.log(
|
|
240
|
-
` CPU Usage: ${this.getUsageBar(this.systemStats.cpuUsage, 100)} ${this.systemStats.cpuUsage}%`,
|
|
241
|
-
);
|
|
242
|
-
console.log(
|
|
243
|
-
` Memory: ${this.getUsageBar(this.systemStats.memoryUsage, 100)} ${this.systemStats.memoryUsage}%`,
|
|
244
|
-
);
|
|
245
|
-
console.log();
|
|
246
|
-
|
|
247
|
-
// Activity metrics
|
|
248
|
-
console.log(colors.cyan('📈 Activity Metrics'));
|
|
249
|
-
console.log(
|
|
250
|
-
` Active Agents: ${colors.yellow(this.agents.filter((a) => a.status === 'working').length)}/${this.agents.length}`,
|
|
251
|
-
);
|
|
252
|
-
console.log(` Total Tasks: ${this.tasks.length}`);
|
|
253
|
-
console.log(
|
|
254
|
-
` Completed: ${colors.green(this.tasks.filter((t) => t.status === 'completed').length)}`,
|
|
255
|
-
);
|
|
256
|
-
console.log(
|
|
257
|
-
` In Progress: ${colors.yellow(this.tasks.filter((t) => t.status === 'in_progress').length)}`,
|
|
258
|
-
);
|
|
259
|
-
console.log(
|
|
260
|
-
` Pending: ${colors.gray(this.tasks.filter((t) => t.status === 'pending').length)}`,
|
|
261
|
-
);
|
|
262
|
-
console.log();
|
|
263
|
-
|
|
264
|
-
// Recent events
|
|
265
|
-
console.log(colors.cyan('🔔 Recent Events'));
|
|
266
|
-
this.logs.slice(-3).forEach((log) => {
|
|
267
|
-
const time = log.time.toLocaleTimeString();
|
|
268
|
-
const icon = log.level === 'success' ? '✓' : log.level === 'warning' ? '⚠' : 'ℹ';
|
|
269
|
-
const color =
|
|
270
|
-
log.level === 'success'
|
|
271
|
-
? colors.green
|
|
272
|
-
: log.level === 'warning'
|
|
273
|
-
? colors.yellow
|
|
274
|
-
: colors.blue;
|
|
275
|
-
console.log(` ${colors.gray(time)} ${color(icon)} ${log.message}`);
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
renderOrchestrationView() {
|
|
280
|
-
console.log(colors.white(colors.bold('Swarm Orchestration Management')));
|
|
281
|
-
console.log();
|
|
282
|
-
|
|
283
|
-
// Swarm metrics
|
|
284
|
-
const metrics = this.swarmIntegration.getSwarmMetrics();
|
|
285
|
-
if (metrics) {
|
|
286
|
-
console.log(colors.cyan('🐝 Swarm Status'));
|
|
287
|
-
console.log(` Swarm ID: ${colors.yellow(metrics.swarmId)}`);
|
|
288
|
-
console.log(
|
|
289
|
-
` Agents: ${colors.green(metrics.agents.active)}/${metrics.agents.total} active`,
|
|
290
|
-
);
|
|
291
|
-
console.log(
|
|
292
|
-
` Tasks: ${colors.yellow(metrics.tasks.inProgress)} in progress, ${colors.green(metrics.tasks.completed)} completed`,
|
|
293
|
-
);
|
|
294
|
-
console.log(` Efficiency: ${metrics.efficiency}%`);
|
|
295
|
-
console.log();
|
|
201
|
+
renderProcessView() {
|
|
202
|
+
console.log(colors.white(colors.bold('Process Management')));
|
|
203
|
+
console.log();
|
|
204
|
+
let index = 0;
|
|
205
|
+
for (const [id, process] of this.processes){
|
|
206
|
+
const selected = index === this.selectedIndex;
|
|
207
|
+
const prefix = selected ? colors.yellow('▶ ') : ' ';
|
|
208
|
+
const status = this.getStatusIcon(process.status);
|
|
209
|
+
const name = selected ? colors.yellow(process.name) : colors.white(process.name);
|
|
210
|
+
console.log(`${prefix}${status} ${name}`);
|
|
211
|
+
console.log(` ${colors.gray(process.description)}`);
|
|
212
|
+
if (process.status === 'running') {
|
|
213
|
+
const stats = colors.dim(`PID: ${process.pid} | Uptime: ${this.formatUptime(process.uptime)} | CPU: ${process.cpu.toFixed(1)}% | Mem: ${process.memory.toFixed(0)}MB`);
|
|
214
|
+
console.log(` ${stats}`);
|
|
215
|
+
}
|
|
216
|
+
console.log();
|
|
217
|
+
index++;
|
|
218
|
+
}
|
|
219
|
+
// Quick stats
|
|
220
|
+
const running = Array.from(this.processes.values()).filter((p)=>p.status === 'running').length;
|
|
221
|
+
console.log(colors.gray('─'.repeat(80)));
|
|
222
|
+
console.log(colors.white(`Total: ${this.processes.size} | Running: ${colors.green(running)} | Stopped: ${colors.gray(this.processes.size - running)}`));
|
|
296
223
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
: colors.gray;
|
|
327
|
-
const status = statusColor(`[${task.status}]`);
|
|
328
|
-
const priority =
|
|
329
|
-
task.priority === 'high'
|
|
330
|
-
? colors.red(`[${task.priority}]`)
|
|
331
|
-
: task.priority === 'medium'
|
|
332
|
-
? colors.yellow(`[${task.priority}]`)
|
|
333
|
-
: colors.gray(`[${task.priority}]`);
|
|
334
|
-
console.log(` ${status} ${priority} ${task.description}`);
|
|
335
|
-
if (task.assignedTo) {
|
|
336
|
-
const agent = this.agents.find((a) => a.id === task.assignedTo);
|
|
337
|
-
console.log(` Assigned to: ${agent ? agent.name : task.assignedTo}`);
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
if (this.tasks.length > 5) {
|
|
342
|
-
console.log(colors.gray(` ... and ${this.tasks.length - 5} more tasks`));
|
|
224
|
+
renderStatusView() {
|
|
225
|
+
console.log(colors.white(colors.bold('System Status')));
|
|
226
|
+
console.log();
|
|
227
|
+
// System overview
|
|
228
|
+
console.log(colors.cyan('📊 System Overview'));
|
|
229
|
+
console.log(` Uptime: ${colors.green(this.formatUptime(this.systemStats.uptime))}`);
|
|
230
|
+
console.log(` Process Health: ${this.getHealthBar()}`);
|
|
231
|
+
console.log();
|
|
232
|
+
// Resource usage
|
|
233
|
+
console.log(colors.cyan('💻 Resource Usage'));
|
|
234
|
+
console.log(` CPU Usage: ${this.getUsageBar(this.systemStats.cpuUsage, 100)} ${this.systemStats.cpuUsage}%`);
|
|
235
|
+
console.log(` Memory: ${this.getUsageBar(this.systemStats.memoryUsage, 100)} ${this.systemStats.memoryUsage}%`);
|
|
236
|
+
console.log();
|
|
237
|
+
// Activity metrics
|
|
238
|
+
console.log(colors.cyan('📈 Activity Metrics'));
|
|
239
|
+
console.log(` Active Agents: ${colors.yellow(this.agents.filter((a)=>a.status === 'working').length)}/${this.agents.length}`);
|
|
240
|
+
console.log(` Total Tasks: ${this.tasks.length}`);
|
|
241
|
+
console.log(` Completed: ${colors.green(this.tasks.filter((t)=>t.status === 'completed').length)}`);
|
|
242
|
+
console.log(` In Progress: ${colors.yellow(this.tasks.filter((t)=>t.status === 'in_progress').length)}`);
|
|
243
|
+
console.log(` Pending: ${colors.gray(this.tasks.filter((t)=>t.status === 'pending').length)}`);
|
|
244
|
+
console.log();
|
|
245
|
+
// Recent events
|
|
246
|
+
console.log(colors.cyan('🔔 Recent Events'));
|
|
247
|
+
this.logs.slice(-3).forEach((log)=>{
|
|
248
|
+
const time = log.time.toLocaleTimeString();
|
|
249
|
+
const icon = log.level === 'success' ? '✓' : log.level === 'warning' ? '⚠' : 'ℹ';
|
|
250
|
+
const color = log.level === 'success' ? colors.green : log.level === 'warning' ? colors.yellow : colors.blue;
|
|
251
|
+
console.log(` ${colors.gray(time)} ${color(icon)} ${log.message}`);
|
|
252
|
+
});
|
|
343
253
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
const time = log.time.toLocaleTimeString();
|
|
390
|
-
let icon, color;
|
|
391
|
-
|
|
392
|
-
switch (log.level) {
|
|
393
|
-
case 'success':
|
|
394
|
-
icon = '✓';
|
|
395
|
-
color = colors.green;
|
|
396
|
-
break;
|
|
397
|
-
case 'warning':
|
|
398
|
-
icon = '⚠';
|
|
399
|
-
color = colors.yellow;
|
|
400
|
-
break;
|
|
401
|
-
case 'error':
|
|
402
|
-
icon = '✗';
|
|
403
|
-
color = colors.red;
|
|
404
|
-
break;
|
|
405
|
-
default:
|
|
406
|
-
icon = 'ℹ';
|
|
407
|
-
color = colors.blue;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
console.log(`${colors.gray(time)} ${color(icon)} ${log.message}`);
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
if (this.logs.length > 15) {
|
|
414
|
-
console.log();
|
|
415
|
-
console.log(colors.gray(`Showing last 15 of ${this.logs.length} logs`));
|
|
254
|
+
renderOrchestrationView() {
|
|
255
|
+
console.log(colors.white(colors.bold('Swarm Orchestration Management')));
|
|
256
|
+
console.log();
|
|
257
|
+
// Swarm metrics
|
|
258
|
+
const metrics = this.swarmIntegration.getSwarmMetrics();
|
|
259
|
+
if (metrics) {
|
|
260
|
+
console.log(colors.cyan('🐝 Swarm Status'));
|
|
261
|
+
console.log(` Swarm ID: ${colors.yellow(metrics.swarmId)}`);
|
|
262
|
+
console.log(` Agents: ${colors.green(metrics.agents.active)}/${metrics.agents.total} active`);
|
|
263
|
+
console.log(` Tasks: ${colors.yellow(metrics.tasks.inProgress)} in progress, ${colors.green(metrics.tasks.completed)} completed`);
|
|
264
|
+
console.log(` Efficiency: ${metrics.efficiency}%`);
|
|
265
|
+
console.log();
|
|
266
|
+
}
|
|
267
|
+
// Agents section
|
|
268
|
+
console.log(colors.cyan('🤖 Active Agents'));
|
|
269
|
+
console.log();
|
|
270
|
+
this.agents.forEach((agent, index)=>{
|
|
271
|
+
const selected = this.currentView === VIEWS.ORCHESTRATION && index === this.selectedIndex;
|
|
272
|
+
const prefix = selected ? colors.yellow('▶ ') : ' ';
|
|
273
|
+
const statusIcon = agent.status === 'working' ? colors.green('●') : colors.gray('○');
|
|
274
|
+
const name = selected ? colors.yellow(agent.name) : colors.white(agent.name);
|
|
275
|
+
console.log(`${prefix}${statusIcon} ${name} (${agent.type})`);
|
|
276
|
+
console.log(` ID: ${agent.id} | Tasks: ${agent.tasks} | Status: ${agent.status}`);
|
|
277
|
+
if (agent.capabilities && agent.capabilities.length > 0) {
|
|
278
|
+
console.log(` Capabilities: ${colors.dim(agent.capabilities.join(', '))}`);
|
|
279
|
+
}
|
|
280
|
+
console.log();
|
|
281
|
+
});
|
|
282
|
+
console.log(colors.gray('─'.repeat(40)));
|
|
283
|
+
// Tasks section
|
|
284
|
+
console.log(colors.cyan('📋 Task Queue'));
|
|
285
|
+
console.log();
|
|
286
|
+
this.tasks.slice(0, 5).forEach((task)=>{
|
|
287
|
+
const statusColor = task.status === 'completed' ? colors.green : task.status === 'in_progress' ? colors.yellow : colors.gray;
|
|
288
|
+
const status = statusColor(`[${task.status}]`);
|
|
289
|
+
const priority = task.priority === 'high' ? colors.red(`[${task.priority}]`) : task.priority === 'medium' ? colors.yellow(`[${task.priority}]`) : colors.gray(`[${task.priority}]`);
|
|
290
|
+
console.log(` ${status} ${priority} ${task.description}`);
|
|
291
|
+
if (task.assignedTo) {
|
|
292
|
+
const agent = this.agents.find((a)=>a.id === task.assignedTo);
|
|
293
|
+
console.log(` Assigned to: ${agent ? agent.name : task.assignedTo}`);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
if (this.tasks.length > 5) {
|
|
297
|
+
console.log(colors.gray(` ... and ${this.tasks.length - 5} more tasks`));
|
|
298
|
+
}
|
|
416
299
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
console.log(colors.cyan('💾 Memory Operations'));
|
|
444
|
-
console.log(` ${colors.yellow('S')} Store new entry`);
|
|
445
|
-
console.log(` ${colors.yellow('G')} Get/search entries`);
|
|
446
|
-
console.log(` ${colors.yellow('C')} Clear namespace`);
|
|
447
|
-
console.log();
|
|
448
|
-
|
|
449
|
-
console.log(colors.cyan('🔧 Other'));
|
|
450
|
-
console.log(` ${colors.yellow('L')} Clear logs`);
|
|
451
|
-
console.log(` ${colors.yellow('H/?')} Show this help`);
|
|
452
|
-
console.log(` ${colors.yellow('Q')} Quit`);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
renderFooter() {
|
|
456
|
-
console.log();
|
|
457
|
-
console.log(colors.gray('─'.repeat(80)));
|
|
458
|
-
|
|
459
|
-
// Context-sensitive controls
|
|
460
|
-
let controls = '';
|
|
461
|
-
switch (this.currentView) {
|
|
462
|
-
case VIEWS.PROCESSES:
|
|
463
|
-
controls = `${colors.yellow('Space')} Toggle | ${colors.yellow('A')} Start All | ${colors.yellow('Z')} Stop All | ${colors.yellow('R')} Restart`;
|
|
464
|
-
break;
|
|
465
|
-
case VIEWS.ORCHESTRATION:
|
|
466
|
-
controls = `${colors.yellow('N')} New Agent | ${colors.yellow('T')} New Task | ${colors.yellow('D')} Complete | ${colors.yellow('S')} Metrics`;
|
|
467
|
-
break;
|
|
468
|
-
case VIEWS.MEMORY:
|
|
469
|
-
controls = `${colors.yellow('S')} Store | ${colors.yellow('G')} Get | ${colors.yellow('C')} Clear`;
|
|
470
|
-
break;
|
|
471
|
-
case VIEWS.LOGS:
|
|
472
|
-
controls = `${colors.yellow('L')} Clear | ${colors.yellow('F')} Filter`;
|
|
473
|
-
break;
|
|
474
|
-
default:
|
|
475
|
-
controls = `${colors.yellow('Tab')} Next View | ${colors.yellow('?')} Help`;
|
|
300
|
+
renderMemoryView() {
|
|
301
|
+
console.log(colors.white(colors.bold('Memory Bank Management')));
|
|
302
|
+
console.log();
|
|
303
|
+
// Overview
|
|
304
|
+
console.log(colors.cyan('💾 Memory Overview'));
|
|
305
|
+
console.log(` Total Entries: ${colors.yellow(this.memoryStats.totalEntries)}`);
|
|
306
|
+
console.log(` Total Size: ${colors.yellow(this.memoryStats.totalSize)}`);
|
|
307
|
+
console.log();
|
|
308
|
+
// Namespaces
|
|
309
|
+
console.log(colors.cyan('📁 Namespaces'));
|
|
310
|
+
console.log();
|
|
311
|
+
this.memoryStats.namespaces.forEach((ns, index)=>{
|
|
312
|
+
const selected = this.currentView === VIEWS.MEMORY && index === this.selectedIndex;
|
|
313
|
+
const prefix = selected ? colors.yellow('▶ ') : ' ';
|
|
314
|
+
const name = selected ? colors.yellow(ns.name) : colors.white(ns.name);
|
|
315
|
+
console.log(`${prefix}${name}`);
|
|
316
|
+
console.log(` Entries: ${ns.entries} | Size: ${ns.size}`);
|
|
317
|
+
console.log();
|
|
318
|
+
});
|
|
319
|
+
// Recent operations
|
|
320
|
+
console.log(colors.gray('─'.repeat(40)));
|
|
321
|
+
console.log(colors.cyan('🔄 Recent Operations'));
|
|
322
|
+
console.log(` ${colors.green('✓')} Stored: config.api.key`);
|
|
323
|
+
console.log(` ${colors.blue('↓')} Retrieved: sparc.modes`);
|
|
324
|
+
console.log(` ${colors.yellow('✎')} Updated: agent.status`);
|
|
476
325
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
326
|
+
renderLogsView() {
|
|
327
|
+
console.log(colors.white(colors.bold('System Logs')));
|
|
328
|
+
console.log();
|
|
329
|
+
// Log filters
|
|
330
|
+
console.log(colors.cyan('🔍 Filters: ') + colors.gray('[A]ll [I]nfo [W]arning [E]rror'));
|
|
331
|
+
console.log(colors.gray('─'.repeat(80)));
|
|
332
|
+
console.log();
|
|
333
|
+
// Display logs
|
|
334
|
+
const displayLogs = this.logs.slice(-15);
|
|
335
|
+
displayLogs.forEach((log)=>{
|
|
336
|
+
const time = log.time.toLocaleTimeString();
|
|
337
|
+
let icon, color;
|
|
338
|
+
switch(log.level){
|
|
339
|
+
case 'success':
|
|
340
|
+
icon = '✓';
|
|
341
|
+
color = colors.green;
|
|
342
|
+
break;
|
|
343
|
+
case 'warning':
|
|
344
|
+
icon = '⚠';
|
|
345
|
+
color = colors.yellow;
|
|
346
|
+
break;
|
|
347
|
+
case 'error':
|
|
348
|
+
icon = '✗';
|
|
349
|
+
color = colors.red;
|
|
350
|
+
break;
|
|
351
|
+
default:
|
|
352
|
+
icon = 'ℹ';
|
|
353
|
+
color = colors.blue;
|
|
354
|
+
}
|
|
355
|
+
console.log(`${colors.gray(time)} ${color(icon)} ${log.message}`);
|
|
356
|
+
});
|
|
357
|
+
if (this.logs.length > 15) {
|
|
358
|
+
console.log();
|
|
359
|
+
console.log(colors.gray(`Showing last 15 of ${this.logs.length} logs`));
|
|
360
|
+
}
|
|
494
361
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
async handleInput() {
|
|
526
|
-
const terminal = compat.terminal;
|
|
527
|
-
|
|
528
|
-
await terminal.write('\nCommand: ');
|
|
529
|
-
|
|
530
|
-
const buf = new Uint8Array(1024);
|
|
531
|
-
const n = await terminal.read(buf);
|
|
532
|
-
if (n === null) return;
|
|
533
|
-
|
|
534
|
-
const rawInput = terminal.decoder.decode(buf.subarray(0, n)).trim();
|
|
535
|
-
const input = rawInput.split('\n')[0].toLowerCase();
|
|
536
|
-
|
|
537
|
-
// Global commands
|
|
538
|
-
switch (input) {
|
|
539
|
-
case 'q':
|
|
540
|
-
case 'quit':
|
|
541
|
-
this.running = false;
|
|
542
|
-
console.clear();
|
|
543
|
-
printSuccess('Goodbye!');
|
|
544
|
-
compat.terminal.exit(0);
|
|
545
|
-
break;
|
|
546
|
-
|
|
547
|
-
case '1':
|
|
548
|
-
this.currentView = VIEWS.PROCESSES;
|
|
549
|
-
this.selectedIndex = 0;
|
|
550
|
-
break;
|
|
551
|
-
|
|
552
|
-
case '2':
|
|
553
|
-
this.currentView = VIEWS.STATUS;
|
|
554
|
-
this.selectedIndex = 0;
|
|
555
|
-
break;
|
|
556
|
-
|
|
557
|
-
case '3':
|
|
558
|
-
this.currentView = VIEWS.ORCHESTRATION;
|
|
559
|
-
this.selectedIndex = 0;
|
|
560
|
-
break;
|
|
561
|
-
|
|
562
|
-
case '4':
|
|
563
|
-
this.currentView = VIEWS.MEMORY;
|
|
564
|
-
this.selectedIndex = 0;
|
|
565
|
-
break;
|
|
566
|
-
|
|
567
|
-
case '5':
|
|
568
|
-
this.currentView = VIEWS.LOGS;
|
|
569
|
-
this.selectedIndex = 0;
|
|
570
|
-
break;
|
|
571
|
-
|
|
572
|
-
case '6':
|
|
573
|
-
case '?':
|
|
574
|
-
case 'h':
|
|
575
|
-
case 'help':
|
|
576
|
-
this.currentView = VIEWS.HELP;
|
|
577
|
-
break;
|
|
578
|
-
|
|
579
|
-
case 'tab':
|
|
580
|
-
case '\t':
|
|
581
|
-
// Cycle through views
|
|
582
|
-
const viewKeys = Object.values(VIEWS);
|
|
583
|
-
const currentIndex = viewKeys.indexOf(this.currentView);
|
|
584
|
-
this.currentView = viewKeys[(currentIndex + 1) % viewKeys.length];
|
|
585
|
-
this.selectedIndex = 0;
|
|
586
|
-
break;
|
|
587
|
-
|
|
588
|
-
default:
|
|
589
|
-
// View-specific commands
|
|
590
|
-
await this.handleViewSpecificInput(input);
|
|
362
|
+
renderHelpView() {
|
|
363
|
+
console.log(colors.white(colors.bold('Help & Documentation')));
|
|
364
|
+
console.log();
|
|
365
|
+
console.log(colors.cyan('🎯 Navigation'));
|
|
366
|
+
console.log(` ${colors.yellow('1-6')} Switch between views`);
|
|
367
|
+
console.log(` ${colors.yellow('Tab')} Cycle through views`);
|
|
368
|
+
console.log(` ${colors.yellow('↑/↓')} Navigate items (when available)`);
|
|
369
|
+
console.log();
|
|
370
|
+
console.log(colors.cyan('⚡ Process Controls'));
|
|
371
|
+
console.log(` ${colors.yellow('Space')} Toggle selected process`);
|
|
372
|
+
console.log(` ${colors.yellow('A')} Start all processes`);
|
|
373
|
+
console.log(` ${colors.yellow('Z')} Stop all processes`);
|
|
374
|
+
console.log(` ${colors.yellow('R')} Restart all processes`);
|
|
375
|
+
console.log();
|
|
376
|
+
console.log(colors.cyan('🤖 Swarm Orchestration'));
|
|
377
|
+
console.log(` ${colors.yellow('N')} Spawn new agent`);
|
|
378
|
+
console.log(` ${colors.yellow('T')} Create new task`);
|
|
379
|
+
console.log(` ${colors.yellow('D')} Complete task`);
|
|
380
|
+
console.log(` ${colors.yellow('S')} Show swarm metrics`);
|
|
381
|
+
console.log();
|
|
382
|
+
console.log(colors.cyan('💾 Memory Operations'));
|
|
383
|
+
console.log(` ${colors.yellow('S')} Store new entry`);
|
|
384
|
+
console.log(` ${colors.yellow('G')} Get/search entries`);
|
|
385
|
+
console.log(` ${colors.yellow('C')} Clear namespace`);
|
|
386
|
+
console.log();
|
|
387
|
+
console.log(colors.cyan('🔧 Other'));
|
|
388
|
+
console.log(` ${colors.yellow('L')} Clear logs`);
|
|
389
|
+
console.log(` ${colors.yellow('H/?')} Show this help`);
|
|
390
|
+
console.log(` ${colors.yellow('Q')} Quit`);
|
|
591
391
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
392
|
+
renderFooter() {
|
|
393
|
+
console.log();
|
|
394
|
+
console.log(colors.gray('─'.repeat(80)));
|
|
395
|
+
// Context-sensitive controls
|
|
396
|
+
let controls = '';
|
|
397
|
+
switch(this.currentView){
|
|
398
|
+
case VIEWS.PROCESSES:
|
|
399
|
+
controls = `${colors.yellow('Space')} Toggle | ${colors.yellow('A')} Start All | ${colors.yellow('Z')} Stop All | ${colors.yellow('R')} Restart`;
|
|
400
|
+
break;
|
|
401
|
+
case VIEWS.ORCHESTRATION:
|
|
402
|
+
controls = `${colors.yellow('N')} New Agent | ${colors.yellow('T')} New Task | ${colors.yellow('D')} Complete | ${colors.yellow('S')} Metrics`;
|
|
403
|
+
break;
|
|
404
|
+
case VIEWS.MEMORY:
|
|
405
|
+
controls = `${colors.yellow('S')} Store | ${colors.yellow('G')} Get | ${colors.yellow('C')} Clear`;
|
|
406
|
+
break;
|
|
407
|
+
case VIEWS.LOGS:
|
|
408
|
+
controls = `${colors.yellow('L')} Clear | ${colors.yellow('F')} Filter`;
|
|
409
|
+
break;
|
|
410
|
+
default:
|
|
411
|
+
controls = `${colors.yellow('Tab')} Next View | ${colors.yellow('?')} Help`;
|
|
412
|
+
}
|
|
413
|
+
console.log(`${controls} | ${colors.yellow('Q')} Quit`);
|
|
414
|
+
console.log(colors.gray('─'.repeat(80)));
|
|
611
415
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
await this.restartAll();
|
|
626
|
-
break;
|
|
627
|
-
|
|
628
|
-
case ' ':
|
|
629
|
-
case 'space':
|
|
630
|
-
case 'enter':
|
|
631
|
-
case '':
|
|
632
|
-
await this.toggleSelected();
|
|
633
|
-
break;
|
|
634
|
-
|
|
635
|
-
case 'up':
|
|
636
|
-
case 'k':
|
|
637
|
-
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
638
|
-
break;
|
|
639
|
-
|
|
640
|
-
case 'down':
|
|
641
|
-
case 'j':
|
|
642
|
-
this.selectedIndex = Math.min(this.processes.size - 1, this.selectedIndex + 1);
|
|
643
|
-
break;
|
|
416
|
+
getStatusIcon(status) {
|
|
417
|
+
switch(status){
|
|
418
|
+
case 'running':
|
|
419
|
+
return colors.green('●');
|
|
420
|
+
case 'stopped':
|
|
421
|
+
return colors.gray('○');
|
|
422
|
+
case 'error':
|
|
423
|
+
return colors.red('✗');
|
|
424
|
+
case 'starting':
|
|
425
|
+
return colors.yellow('◐');
|
|
426
|
+
default:
|
|
427
|
+
return colors.gray('?');
|
|
428
|
+
}
|
|
644
429
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
430
|
+
getHealthBar() {
|
|
431
|
+
const running = Array.from(this.processes.values()).filter((p)=>p.status === 'running').length;
|
|
432
|
+
const total = this.processes.size;
|
|
433
|
+
const percentage = running / total * 100;
|
|
434
|
+
const filled = Math.round(percentage / 10);
|
|
435
|
+
const bar = '█'.repeat(filled) + '░'.repeat(10 - filled);
|
|
436
|
+
const color = percentage >= 80 ? colors.green : percentage >= 50 ? colors.yellow : colors.red;
|
|
437
|
+
return color(bar) + ` ${percentage.toFixed(0)}%`;
|
|
438
|
+
}
|
|
439
|
+
getUsageBar(value, max) {
|
|
440
|
+
const percentage = value / max * 100;
|
|
441
|
+
const filled = Math.round(percentage / 10);
|
|
442
|
+
const bar = '▓'.repeat(filled) + '░'.repeat(10 - filled);
|
|
443
|
+
const color = percentage >= 80 ? colors.red : percentage >= 50 ? colors.yellow : colors.green;
|
|
444
|
+
return color(bar);
|
|
445
|
+
}
|
|
446
|
+
formatUptime(seconds) {
|
|
447
|
+
if (seconds < 60) return `${seconds}s`;
|
|
448
|
+
if (seconds < 3600) return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
449
|
+
const hours = Math.floor(seconds / 3600);
|
|
450
|
+
const minutes = Math.floor(seconds % 3600 / 60);
|
|
451
|
+
return `${hours}h ${minutes}m`;
|
|
452
|
+
}
|
|
453
|
+
async handleInput() {
|
|
454
|
+
const terminal = compat.terminal;
|
|
455
|
+
await terminal.write('\nCommand: ');
|
|
456
|
+
const buf = new Uint8Array(1024);
|
|
457
|
+
const n = await terminal.read(buf);
|
|
458
|
+
if (n === null) return;
|
|
459
|
+
const rawInput = terminal.decoder.decode(buf.subarray(0, n)).trim();
|
|
460
|
+
const input = rawInput.split('\n')[0].toLowerCase();
|
|
461
|
+
// Global commands
|
|
462
|
+
switch(input){
|
|
463
|
+
case 'q':
|
|
464
|
+
case 'quit':
|
|
465
|
+
this.running = false;
|
|
466
|
+
console.clear();
|
|
467
|
+
printSuccess('Goodbye!');
|
|
468
|
+
compat.terminal.exit(0);
|
|
469
|
+
break;
|
|
470
|
+
case '1':
|
|
471
|
+
this.currentView = VIEWS.PROCESSES;
|
|
472
|
+
this.selectedIndex = 0;
|
|
473
|
+
break;
|
|
474
|
+
case '2':
|
|
475
|
+
this.currentView = VIEWS.STATUS;
|
|
476
|
+
this.selectedIndex = 0;
|
|
477
|
+
break;
|
|
478
|
+
case '3':
|
|
479
|
+
this.currentView = VIEWS.ORCHESTRATION;
|
|
480
|
+
this.selectedIndex = 0;
|
|
481
|
+
break;
|
|
482
|
+
case '4':
|
|
483
|
+
this.currentView = VIEWS.MEMORY;
|
|
484
|
+
this.selectedIndex = 0;
|
|
485
|
+
break;
|
|
486
|
+
case '5':
|
|
487
|
+
this.currentView = VIEWS.LOGS;
|
|
488
|
+
this.selectedIndex = 0;
|
|
489
|
+
break;
|
|
490
|
+
case '6':
|
|
491
|
+
case '?':
|
|
492
|
+
case 'h':
|
|
493
|
+
case 'help':
|
|
494
|
+
this.currentView = VIEWS.HELP;
|
|
495
|
+
break;
|
|
496
|
+
case 'tab':
|
|
497
|
+
case '\t':
|
|
498
|
+
// Cycle through views
|
|
499
|
+
const viewKeys = Object.values(VIEWS);
|
|
500
|
+
const currentIndex = viewKeys.indexOf(this.currentView);
|
|
501
|
+
this.currentView = viewKeys[(currentIndex + 1) % viewKeys.length];
|
|
502
|
+
this.selectedIndex = 0;
|
|
503
|
+
break;
|
|
504
|
+
default:
|
|
505
|
+
// View-specific commands
|
|
506
|
+
await this.handleViewSpecificInput(input);
|
|
679
507
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
508
|
+
// Update system stats
|
|
509
|
+
this.updateSystemStats();
|
|
510
|
+
}
|
|
511
|
+
async handleViewSpecificInput(input) {
|
|
512
|
+
switch(this.currentView){
|
|
513
|
+
case VIEWS.PROCESSES:
|
|
514
|
+
await this.handleProcessInput(input);
|
|
515
|
+
break;
|
|
516
|
+
case VIEWS.ORCHESTRATION:
|
|
517
|
+
await this.handleOrchestrationInput(input);
|
|
518
|
+
break;
|
|
519
|
+
case VIEWS.MEMORY:
|
|
520
|
+
await this.handleMemoryInput(input);
|
|
521
|
+
break;
|
|
522
|
+
case VIEWS.LOGS:
|
|
523
|
+
await this.handleLogsInput(input);
|
|
524
|
+
break;
|
|
690
525
|
}
|
|
691
|
-
break;
|
|
692
526
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
527
|
+
async handleProcessInput(input) {
|
|
528
|
+
switch(input){
|
|
529
|
+
case 'a':
|
|
530
|
+
await this.startAll();
|
|
531
|
+
break;
|
|
532
|
+
case 'z':
|
|
533
|
+
await this.stopAll();
|
|
534
|
+
break;
|
|
535
|
+
case 'r':
|
|
536
|
+
await this.restartAll();
|
|
537
|
+
break;
|
|
538
|
+
case ' ':
|
|
539
|
+
case 'space':
|
|
540
|
+
case 'enter':
|
|
541
|
+
case '':
|
|
542
|
+
await this.toggleSelected();
|
|
543
|
+
break;
|
|
544
|
+
case 'up':
|
|
545
|
+
case 'k':
|
|
546
|
+
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
547
|
+
break;
|
|
548
|
+
case 'down':
|
|
549
|
+
case 'j':
|
|
550
|
+
this.selectedIndex = Math.min(this.processes.size - 1, this.selectedIndex + 1);
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
708
553
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
554
|
+
async handleOrchestrationInput(input) {
|
|
555
|
+
switch(input){
|
|
556
|
+
case 'n':
|
|
557
|
+
// Spawn new agent
|
|
558
|
+
const agentTypes = [
|
|
559
|
+
'researcher',
|
|
560
|
+
'coder',
|
|
561
|
+
'analyst',
|
|
562
|
+
'coordinator',
|
|
563
|
+
'tester'
|
|
564
|
+
];
|
|
565
|
+
const randomType = agentTypes[Math.floor(Math.random() * agentTypes.length)];
|
|
566
|
+
await this.swarmIntegration.spawnAgent(randomType);
|
|
567
|
+
break;
|
|
568
|
+
case 't':
|
|
569
|
+
// Create new task
|
|
570
|
+
const sampleTasks = [
|
|
571
|
+
'Implement new feature',
|
|
572
|
+
'Fix critical bug',
|
|
573
|
+
'Optimize performance',
|
|
574
|
+
'Update documentation',
|
|
575
|
+
'Review code quality'
|
|
576
|
+
];
|
|
577
|
+
const randomTask = sampleTasks[Math.floor(Math.random() * sampleTasks.length)];
|
|
578
|
+
await this.swarmIntegration.createTask(randomTask, 'medium');
|
|
579
|
+
break;
|
|
580
|
+
case 'd':
|
|
581
|
+
// Complete selected task (simulate)
|
|
582
|
+
if (this.tasks.length > 0) {
|
|
583
|
+
const pendingTasks = this.tasks.filter((t)=>t.status === 'in_progress');
|
|
584
|
+
if (pendingTasks.length > 0) {
|
|
585
|
+
const taskToComplete = pendingTasks[0];
|
|
586
|
+
await this.swarmIntegration.completeTask(taskToComplete.id);
|
|
587
|
+
} else {
|
|
588
|
+
this.addLog('info', 'No in-progress tasks to complete');
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
break;
|
|
592
|
+
case 's':
|
|
593
|
+
// Show swarm metrics
|
|
594
|
+
const metrics = this.swarmIntegration.getSwarmMetrics();
|
|
595
|
+
if (metrics) {
|
|
596
|
+
this.addLog('info', `Swarm efficiency: ${metrics.efficiency}% (${metrics.tasks.completed}/${metrics.tasks.total} tasks completed)`);
|
|
597
|
+
}
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
async handleMemoryInput(input) {
|
|
602
|
+
switch(input){
|
|
603
|
+
case 's':
|
|
604
|
+
this.addLog('info', 'Memory storage not yet implemented');
|
|
605
|
+
break;
|
|
606
|
+
case 'g':
|
|
607
|
+
this.addLog('info', 'Memory retrieval not yet implemented');
|
|
608
|
+
break;
|
|
609
|
+
case 'c':
|
|
610
|
+
this.addLog('warning', 'Memory clearing not yet implemented');
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
async handleLogsInput(input) {
|
|
615
|
+
switch(input){
|
|
616
|
+
case 'l':
|
|
617
|
+
this.logs = [];
|
|
618
|
+
this.addLog('info', 'Logs cleared');
|
|
619
|
+
break;
|
|
620
|
+
case 'f':
|
|
621
|
+
this.addLog('info', 'Log filtering not yet implemented');
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
addLog(level, message) {
|
|
626
|
+
this.logs.push({
|
|
627
|
+
time: new Date(),
|
|
628
|
+
level,
|
|
629
|
+
message
|
|
630
|
+
});
|
|
721
631
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
process.
|
|
747
|
-
process.
|
|
748
|
-
|
|
749
|
-
|
|
632
|
+
updateSystemStats() {
|
|
633
|
+
// Update random stats for demo
|
|
634
|
+
this.systemStats.cpuUsage = Math.min(100, Math.max(0, this.systemStats.cpuUsage + (Math.random() - 0.5) * 10));
|
|
635
|
+
this.systemStats.memoryUsage = Math.min(100, Math.max(0, this.systemStats.memoryUsage + (Math.random() - 0.5) * 5));
|
|
636
|
+
// Update process stats
|
|
637
|
+
for (const [id, process] of this.processes){
|
|
638
|
+
if (process.status === 'running') {
|
|
639
|
+
process.uptime++;
|
|
640
|
+
process.cpu = Math.min(100, Math.max(0, process.cpu + (Math.random() - 0.5) * 2));
|
|
641
|
+
process.memory = Math.min(200, Math.max(10, process.memory + (Math.random() - 0.5) * 5));
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
async toggleSelected() {
|
|
646
|
+
const process = Array.from(this.processes.values())[this.selectedIndex];
|
|
647
|
+
if (process.status === 'stopped') {
|
|
648
|
+
await this.startProcess(process.id);
|
|
649
|
+
} else {
|
|
650
|
+
await this.stopProcess(process.id);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
async startProcess(id) {
|
|
654
|
+
const process = this.processes.get(id);
|
|
655
|
+
if (!process) return;
|
|
656
|
+
this.addLog('info', `Starting ${process.name}...`);
|
|
657
|
+
process.status = 'starting';
|
|
658
|
+
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
659
|
+
process.status = 'running';
|
|
660
|
+
process.pid = Math.floor(Math.random() * 10000) + 1000;
|
|
661
|
+
process.uptime = 0;
|
|
662
|
+
this.addLog('success', `${process.name} started successfully`);
|
|
750
663
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
664
|
+
async stopProcess(id) {
|
|
665
|
+
const process = this.processes.get(id);
|
|
666
|
+
if (!process) return;
|
|
667
|
+
this.addLog('info', `Stopping ${process.name}...`);
|
|
668
|
+
process.status = 'stopped';
|
|
669
|
+
process.pid = null;
|
|
670
|
+
process.uptime = 0;
|
|
671
|
+
await new Promise((resolve)=>setTimeout(resolve, 300));
|
|
672
|
+
this.addLog('success', `${process.name} stopped`);
|
|
759
673
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
async stopProcess(id) {
|
|
779
|
-
const process = this.processes.get(id);
|
|
780
|
-
if (!process) return;
|
|
781
|
-
|
|
782
|
-
this.addLog('info', `Stopping ${process.name}...`);
|
|
783
|
-
process.status = 'stopped';
|
|
784
|
-
process.pid = null;
|
|
785
|
-
process.uptime = 0;
|
|
786
|
-
|
|
787
|
-
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
788
|
-
this.addLog('success', `${process.name} stopped`);
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
async startAll() {
|
|
792
|
-
this.addLog('info', 'Starting all processes...');
|
|
793
|
-
for (const [id, process] of this.processes) {
|
|
794
|
-
if (process.status === 'stopped') {
|
|
795
|
-
await this.startProcess(id);
|
|
796
|
-
}
|
|
674
|
+
async startAll() {
|
|
675
|
+
this.addLog('info', 'Starting all processes...');
|
|
676
|
+
for (const [id, process] of this.processes){
|
|
677
|
+
if (process.status === 'stopped') {
|
|
678
|
+
await this.startProcess(id);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
this.addLog('success', 'All processes started');
|
|
682
|
+
}
|
|
683
|
+
async stopAll() {
|
|
684
|
+
this.addLog('info', 'Stopping all processes...');
|
|
685
|
+
for (const [id, process] of this.processes){
|
|
686
|
+
if (process.status === 'running') {
|
|
687
|
+
await this.stopProcess(id);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
this.addLog('success', 'All processes stopped');
|
|
797
691
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
692
|
+
async restartAll() {
|
|
693
|
+
await this.stopAll();
|
|
694
|
+
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
695
|
+
await this.startAll();
|
|
696
|
+
}
|
|
697
|
+
constructor(){
|
|
698
|
+
this.processes = new Map();
|
|
699
|
+
this.running = true;
|
|
700
|
+
this.selectedIndex = 0;
|
|
701
|
+
this.currentView = VIEWS.PROCESSES;
|
|
702
|
+
this.agents = [];
|
|
703
|
+
this.tasks = [];
|
|
704
|
+
this.memoryStats = {
|
|
705
|
+
totalEntries: 0,
|
|
706
|
+
totalSize: 0,
|
|
707
|
+
namespaces: []
|
|
708
|
+
};
|
|
709
|
+
this.logs = [];
|
|
710
|
+
this.systemStats = {
|
|
711
|
+
uptime: 0,
|
|
712
|
+
totalTasks: 0,
|
|
713
|
+
completedTasks: 0,
|
|
714
|
+
activeAgents: 0,
|
|
715
|
+
memoryUsage: 0,
|
|
716
|
+
cpuUsage: 0
|
|
717
|
+
};
|
|
718
|
+
// Initialize swarm integration
|
|
719
|
+
this.swarmIntegration = new SwarmWebUIIntegration(this);
|
|
720
|
+
// Initialize process states
|
|
721
|
+
PROCESSES.forEach((p)=>{
|
|
722
|
+
this.processes.set(p.id, {
|
|
723
|
+
...p,
|
|
724
|
+
status: 'stopped',
|
|
725
|
+
pid: null,
|
|
726
|
+
uptime: 0,
|
|
727
|
+
cpu: Math.random() * 5,
|
|
728
|
+
memory: Math.random() * 100
|
|
729
|
+
});
|
|
730
|
+
});
|
|
731
|
+
// Start system uptime counter
|
|
732
|
+
setInterval(()=>{
|
|
733
|
+
this.systemStats.uptime++;
|
|
734
|
+
}, 1000);
|
|
735
|
+
// Initialize swarm (this will create mock data)
|
|
736
|
+
this.initializeSwarm();
|
|
807
737
|
}
|
|
808
|
-
this.addLog('success', 'All processes stopped');
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
async restartAll() {
|
|
812
|
-
await this.stopAll();
|
|
813
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
814
|
-
await this.startAll();
|
|
815
|
-
}
|
|
816
738
|
}
|
|
817
|
-
|
|
818
739
|
export async function launchEnhancedUI() {
|
|
819
|
-
|
|
820
|
-
|
|
740
|
+
const ui = new EnhancedProcessUI();
|
|
741
|
+
await ui.start();
|
|
821
742
|
}
|