claude-flow-novice 1.3.0 โ 1.3.2
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-flow-novice/preferences/generation.json +147 -0
- package/.claude-flow-novice/preferences/language-configs/javascript.json +51 -0
- package/.claude-flow-novice/preferences/language-configs/python.json +50 -0
- package/.claude-flow-novice/preferences/language-configs/rust.json +237 -0
- package/.claude-flow-novice/preferences/language-configs/typescript.json +54 -0
- package/.claude-flow-novice/preferences/project-local.json +91 -0
- package/.claude-flow-novice/preferences/resource-delegation.json +120 -0
- package/.claude-flow-novice/preferences/team-shared.json +195 -0
- package/.claude-flow-novice/preferences/user-global.json +247 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-JAVASCRIPT.md +769 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-PYTHON.md +1214 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-RUST.md +475 -0
- package/.claude-flow-novice/templates/claude-md-templates/CLAUDE-TYPESCRIPT.md +851 -0
- package/.claude-flow-novice/templates/claude-md-templates/README.md +263 -0
- package/CLAUDE.md +81 -0
- package/README-NPM.md +0 -0
- package/package.json +11 -7
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/migration/README.md +434 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/src/cli/simple-commands/__tests__/agent.test.js +291 -0
- package/src/cli/simple-commands/__tests__/memory.test.js +8 -0
- package/src/cli/simple-commands/__tests__/swarm.test.js +371 -0
- package/src/cli/simple-commands/__tests__/task.test.js +8 -0
- package/src/cli/simple-commands/agent.js +216 -0
- package/src/cli/simple-commands/analysis.js +570 -0
- package/src/cli/simple-commands/automation-executor.js +1603 -0
- package/src/cli/simple-commands/automation.js +627 -0
- package/src/cli/simple-commands/batch-manager.js +338 -0
- package/src/cli/simple-commands/claude-telemetry.js +311 -0
- package/src/cli/simple-commands/claude-track.js +102 -0
- package/src/cli/simple-commands/concurrent-display.js +348 -0
- package/src/cli/simple-commands/config.js +319 -0
- package/src/cli/simple-commands/coordination.js +307 -0
- package/src/cli/simple-commands/enhanced-ui-views.js +654 -0
- package/src/cli/simple-commands/enhanced-webui-complete.js +1038 -0
- package/src/cli/simple-commands/fix-hook-variables.js +363 -0
- package/src/cli/simple-commands/github/gh-coordinator.js +605 -0
- package/src/cli/simple-commands/github/github-api.js +624 -0
- package/src/cli/simple-commands/github/init.js +543 -0
- package/src/cli/simple-commands/github.js +377 -0
- package/src/cli/simple-commands/goal.js +145 -0
- package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +311 -0
- package/src/cli/simple-commands/hive-mind/communication.js +740 -0
- package/src/cli/simple-commands/hive-mind/core.js +1031 -0
- package/src/cli/simple-commands/hive-mind/db-optimizer.js +872 -0
- package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1364 -0
- package/src/cli/simple-commands/hive-mind/memory.js +1292 -0
- package/src/cli/simple-commands/hive-mind/performance-optimizer.js +618 -0
- package/src/cli/simple-commands/hive-mind/performance-test.js +373 -0
- package/src/cli/simple-commands/hive-mind/queen.js +809 -0
- package/src/cli/simple-commands/hive-mind/session-manager.js +1223 -0
- package/src/cli/simple-commands/hive-mind-optimize.js +361 -0
- package/src/cli/simple-commands/hive-mind-wizard.js +281 -0
- package/src/cli/simple-commands/hive-mind.js +3112 -0
- package/src/cli/simple-commands/hive.js +140 -0
- package/src/cli/simple-commands/hook-safety.js +671 -0
- package/src/cli/simple-commands/hooks.js +1268 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224542.json +7 -0
- package/src/cli/simple-commands/init/.claude/checkpoints/1756224544.json +8 -0
- package/src/cli/simple-commands/init/README.md +106 -0
- package/src/cli/simple-commands/init/VALIDATION_ROLLBACK.md +488 -0
- package/src/cli/simple-commands/init/agent-copier.js +347 -0
- package/src/cli/simple-commands/init/batch-init.js +663 -0
- package/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +438 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +876 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +356 -0
- package/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +501 -0
- package/src/cli/simple-commands/init/claude-commands/slash-commands.js +57 -0
- package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +296 -0
- package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
- package/src/cli/simple-commands/init/executable-wrapper.js +122 -0
- package/src/cli/simple-commands/init/gitignore-updater.js +137 -0
- package/src/cli/simple-commands/init/help.js +110 -0
- package/src/cli/simple-commands/init/hive-mind-init.js +749 -0
- package/src/cli/simple-commands/init/index.js +1953 -0
- package/src/cli/simple-commands/init/performance-monitor.js +344 -0
- package/src/cli/simple-commands/init/rollback/backup-manager.js +542 -0
- package/src/cli/simple-commands/init/rollback/index.js +399 -0
- package/src/cli/simple-commands/init/rollback/recovery-manager.js +778 -0
- package/src/cli/simple-commands/init/rollback/rollback-executor.js +521 -0
- package/src/cli/simple-commands/init/rollback/state-tracker.js +486 -0
- package/src/cli/simple-commands/init/sparc/roo-readme.js +61 -0
- package/src/cli/simple-commands/init/sparc/roomodes-config.js +102 -0
- package/src/cli/simple-commands/init/sparc/workflows.js +40 -0
- package/src/cli/simple-commands/init/sparc-structure.js +68 -0
- package/src/cli/simple-commands/init/template-copier.js +640 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +1185 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md.optimized +265 -0
- package/src/cli/simple-commands/init/templates/claude-flow-universal +81 -0
- package/src/cli/simple-commands/init/templates/claude-flow.bat +18 -0
- package/src/cli/simple-commands/init/templates/claude-flow.ps1 +24 -0
- package/src/cli/simple-commands/init/templates/claude-md.js +1101 -0
- package/src/cli/simple-commands/init/templates/commands/analysis/bottleneck-detect.md +162 -0
- package/src/cli/simple-commands/init/templates/commands/automation/auto-agent.md +122 -0
- package/src/cli/simple-commands/init/templates/commands/coordination/swarm-init.md +85 -0
- package/src/cli/simple-commands/init/templates/commands/github/github-swarm.md +121 -0
- package/src/cli/simple-commands/init/templates/commands/helpers/standard-checkpoint-hooks.sh +179 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/notification.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-command.md +116 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-edit.md +117 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/post-task.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-command.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-edit.md +113 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-search.md +112 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/pre-task.md +111 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-end.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-restore.md +118 -0
- package/src/cli/simple-commands/init/templates/commands/hooks/session-start.md +117 -0
- package/src/cli/simple-commands/init/templates/coordination-md.js +340 -0
- package/src/cli/simple-commands/init/templates/coordination.md +16 -0
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +2347 -0
- package/src/cli/simple-commands/init/templates/github-safe-enhanced.js +331 -0
- package/src/cli/simple-commands/init/templates/github-safe.js +106 -0
- package/src/cli/simple-commands/init/templates/memory-bank-md.js +259 -0
- package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
- package/src/cli/simple-commands/init/templates/readme-files.js +72 -0
- package/src/cli/simple-commands/init/templates/safe-hook-patterns.js +430 -0
- package/src/cli/simple-commands/init/templates/settings.json +109 -0
- package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
- package/src/cli/simple-commands/init/templates/sparc-modes.js +1401 -0
- package/src/cli/simple-commands/init/templates/verification-claude-md.js +432 -0
- package/src/cli/simple-commands/init/validation/config-validator.js +354 -0
- package/src/cli/simple-commands/init/validation/health-checker.js +599 -0
- package/src/cli/simple-commands/init/validation/index.js +388 -0
- package/src/cli/simple-commands/init/validation/mode-validator.js +387 -0
- package/src/cli/simple-commands/init/validation/post-init-validator.js +390 -0
- package/src/cli/simple-commands/init/validation/pre-init-validator.js +290 -0
- package/src/cli/simple-commands/init/validation/test-runner.js +488 -0
- package/src/cli/simple-commands/init.js +4 -0
- package/src/cli/simple-commands/mcp-health.js +163 -0
- package/src/cli/simple-commands/mcp-integration-layer.js +689 -0
- package/src/cli/simple-commands/mcp.js +420 -0
- package/src/cli/simple-commands/memory-consolidation.js +631 -0
- package/src/cli/simple-commands/memory.js +345 -0
- package/src/cli/simple-commands/migrate-hooks.js +63 -0
- package/src/cli/simple-commands/monitor.js +417 -0
- package/src/cli/simple-commands/neural.js +148 -0
- package/src/cli/simple-commands/pair-autofix-only.js +755 -0
- package/src/cli/simple-commands/pair-basic.js +751 -0
- package/src/cli/simple-commands/pair-old.js +623 -0
- package/src/cli/simple-commands/pair-working.js +849 -0
- package/src/cli/simple-commands/pair.js +849 -0
- package/src/cli/simple-commands/performance-hooks.js +149 -0
- package/src/cli/simple-commands/performance-metrics.js +601 -0
- package/src/cli/simple-commands/process-ui-enhanced.js +821 -0
- package/src/cli/simple-commands/process-ui.js +274 -0
- package/src/cli/simple-commands/realtime-update-system.js +659 -0
- package/src/cli/simple-commands/sparc/architecture.js +1750 -0
- package/src/cli/simple-commands/sparc/commands.js +575 -0
- package/src/cli/simple-commands/sparc/completion.js +1831 -0
- package/src/cli/simple-commands/sparc/coordinator.js +1045 -0
- package/src/cli/simple-commands/sparc/index.js +321 -0
- package/src/cli/simple-commands/sparc/phase-base.js +430 -0
- package/src/cli/simple-commands/sparc/pseudocode.js +984 -0
- package/src/cli/simple-commands/sparc/refinement.js +1856 -0
- package/src/cli/simple-commands/sparc/specification.js +736 -0
- package/src/cli/simple-commands/sparc-modes/architect.js +125 -0
- package/src/cli/simple-commands/sparc-modes/ask.js +126 -0
- package/src/cli/simple-commands/sparc-modes/code.js +148 -0
- package/src/cli/simple-commands/sparc-modes/debug.js +112 -0
- package/src/cli/simple-commands/sparc-modes/devops.js +137 -0
- package/src/cli/simple-commands/sparc-modes/docs-writer.js +38 -0
- package/src/cli/simple-commands/sparc-modes/generic.js +34 -0
- package/src/cli/simple-commands/sparc-modes/index.js +201 -0
- package/src/cli/simple-commands/sparc-modes/integration.js +55 -0
- package/src/cli/simple-commands/sparc-modes/mcp.js +38 -0
- package/src/cli/simple-commands/sparc-modes/monitoring.js +38 -0
- package/src/cli/simple-commands/sparc-modes/optimization.js +38 -0
- package/src/cli/simple-commands/sparc-modes/security-review.js +130 -0
- package/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +167 -0
- package/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +38 -0
- package/src/cli/simple-commands/sparc-modes/supabase-admin.js +149 -0
- package/src/cli/simple-commands/sparc-modes/swarm.js +436 -0
- package/src/cli/simple-commands/sparc-modes/tdd.js +112 -0
- package/src/cli/simple-commands/sparc-modes/tutorial.js +277 -0
- package/src/cli/simple-commands/sparc.js +530 -0
- package/src/cli/simple-commands/start-ui.js +147 -0
- package/src/cli/simple-commands/start-wrapper.js +285 -0
- package/src/cli/simple-commands/start.js +2 -0
- package/src/cli/simple-commands/status.js +303 -0
- package/src/cli/simple-commands/stream-chain-clean.js +221 -0
- package/src/cli/simple-commands/stream-chain-fixed.js +89 -0
- package/src/cli/simple-commands/stream-chain-real.js +408 -0
- package/src/cli/simple-commands/stream-chain-working.js +323 -0
- package/src/cli/simple-commands/stream-chain.js +491 -0
- package/src/cli/simple-commands/stream-processor.js +340 -0
- package/src/cli/simple-commands/swarm-executor.js +253 -0
- package/src/cli/simple-commands/swarm-metrics-integration.js +371 -0
- package/src/cli/simple-commands/swarm-ui.js +741 -0
- package/src/cli/simple-commands/swarm-webui-integration.js +311 -0
- package/src/cli/simple-commands/swarm.js +2277 -0
- package/src/cli/simple-commands/task.js +228 -0
- package/src/cli/simple-commands/templates/mle-star-workflow.json +294 -0
- package/src/cli/simple-commands/timestamp-fix.js +104 -0
- package/src/cli/simple-commands/token-tracker.js +372 -0
- package/src/cli/simple-commands/tool-execution-framework.js +555 -0
- package/src/cli/simple-commands/train-and-stream.js +354 -0
- package/src/cli/simple-commands/training-pipeline.js +874 -0
- package/src/cli/simple-commands/training.js +288 -0
- package/src/cli/simple-commands/verification-hooks.js +336 -0
- package/src/cli/simple-commands/verification-integration.js +464 -0
- package/src/cli/simple-commands/verification-training-integration.js +646 -0
- package/src/cli/simple-commands/verification.js +551 -0
- package/src/cli/simple-commands/web-server.js +929 -0
- package/src/cli/simple-commands/webui-validator.js +136 -0
- package/src/language/README.md +503 -0
- package/src/language/claude-md-generator.js +618 -0
- package/src/language/cli.js +422 -0
- package/src/language/example.js +347 -0
- package/src/language/integration-system.js +619 -0
- package/src/language/language-detector.js +581 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream processor for Claude stream-json output
|
|
3
|
+
* Provides real-time status updates and progress tracking
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Transform } from 'stream';
|
|
7
|
+
|
|
8
|
+
export class StreamJsonProcessor extends Transform {
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
super({ objectMode: false });
|
|
11
|
+
this.buffer = '';
|
|
12
|
+
this.agentId = options.agentId;
|
|
13
|
+
this.agentName = options.agentName || 'Agent';
|
|
14
|
+
this.agentIcon = options.agentIcon || '๐ค';
|
|
15
|
+
this.taskId = options.taskId || 'unknown';
|
|
16
|
+
this.startTime = Date.now();
|
|
17
|
+
this.eventCount = 0;
|
|
18
|
+
this.lastUpdate = Date.now();
|
|
19
|
+
this.options = options;
|
|
20
|
+
this.display = options.display; // Reference to concurrent display
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_transform(chunk, encoding, callback) {
|
|
24
|
+
this.buffer += chunk.toString();
|
|
25
|
+
const lines = this.buffer.split('\n');
|
|
26
|
+
this.buffer = lines.pop() || '';
|
|
27
|
+
|
|
28
|
+
for (const line of lines) {
|
|
29
|
+
if (line.trim()) {
|
|
30
|
+
try {
|
|
31
|
+
const event = JSON.parse(line);
|
|
32
|
+
this.processEvent(event);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Not JSON, pass through if in verbose mode
|
|
35
|
+
if (this.options.verbose) {
|
|
36
|
+
console.log(`[${this.agentName}] ${line}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Update progress display periodically
|
|
43
|
+
if (Date.now() - this.lastUpdate > 1000) {
|
|
44
|
+
this.updateProgress();
|
|
45
|
+
this.lastUpdate = Date.now();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
callback();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_flush(callback) {
|
|
52
|
+
if (this.buffer.trim()) {
|
|
53
|
+
try {
|
|
54
|
+
const event = JSON.parse(this.buffer);
|
|
55
|
+
this.processEvent(event);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
// Ignore
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this.showFinalStatus();
|
|
61
|
+
callback();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
processEvent(event) {
|
|
65
|
+
this.eventCount++;
|
|
66
|
+
|
|
67
|
+
// If we have a concurrent display, update it instead of console logging
|
|
68
|
+
if (this.display) {
|
|
69
|
+
this.updateDisplay(event);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Handle quiet mode - show important actions and commands
|
|
74
|
+
if (this.options.verbose === false && this.options.logLevel === 'quiet') {
|
|
75
|
+
switch (event.type) {
|
|
76
|
+
case 'system':
|
|
77
|
+
if (event.subtype === 'init') {
|
|
78
|
+
console.log(`๐ค ${this.agentName} - Started`);
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case 'assistant':
|
|
82
|
+
// In quiet mode, still show bash commands and key actions
|
|
83
|
+
if (event.message?.content?.length > 0) {
|
|
84
|
+
const content = event.message.content[0];
|
|
85
|
+
if (content.type === 'tool_use' && content.name === 'Bash' && content.input?.command) {
|
|
86
|
+
const command = content.input.command;
|
|
87
|
+
if (command.length > 60) {
|
|
88
|
+
console.log(` ๐ง ${command.substring(0, 57)}...`);
|
|
89
|
+
} else {
|
|
90
|
+
console.log(` ๐ง ${command}`);
|
|
91
|
+
}
|
|
92
|
+
} else if (
|
|
93
|
+
content.type === 'tool_use' &&
|
|
94
|
+
['WebSearch', 'Read', 'Write'].includes(content.name)
|
|
95
|
+
) {
|
|
96
|
+
const toolName = content.name.replace(/([A-Z])/g, ' $1').trim();
|
|
97
|
+
if (content.input) {
|
|
98
|
+
const firstKey = Object.keys(content.input)[0];
|
|
99
|
+
const firstValue = content.input[firstKey];
|
|
100
|
+
if (typeof firstValue === 'string' && firstValue.length < 40) {
|
|
101
|
+
console.log(` ๐ง ${toolName}: ${firstValue}`);
|
|
102
|
+
} else {
|
|
103
|
+
console.log(` ๐ง ${toolName}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
case 'result':
|
|
110
|
+
if (event.subtype === 'success') {
|
|
111
|
+
console.log(
|
|
112
|
+
`โ
${this.agentName} - Completed (${this.formatDuration(event.duration_ms)})`,
|
|
113
|
+
);
|
|
114
|
+
} else if (event.is_error) {
|
|
115
|
+
console.log(`โ ${this.agentName} - Failed: ${event.error || 'Unknown error'}`);
|
|
116
|
+
}
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Use clean, concise formatting for non-interactive mode
|
|
123
|
+
switch (event.type) {
|
|
124
|
+
case 'system':
|
|
125
|
+
if (event.subtype === 'init') {
|
|
126
|
+
console.log(
|
|
127
|
+
`\n๐ค ${this.agentName} - Started (Session: ${event.session_id?.substring(0, 8) || 'unknown'})`,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
|
|
132
|
+
case 'assistant':
|
|
133
|
+
if (event.message?.content?.length > 0) {
|
|
134
|
+
const content = event.message.content[0];
|
|
135
|
+
if (content.type === 'text') {
|
|
136
|
+
// Show only the first meaningful line, skip verbose details
|
|
137
|
+
const lines = content.text.split('\n').filter((line) => line.trim());
|
|
138
|
+
if (lines.length > 0) {
|
|
139
|
+
const firstLine = lines[0].trim();
|
|
140
|
+
if (firstLine.length > 100) {
|
|
141
|
+
console.log(`๐ญ ${firstLine.substring(0, 97)}...`);
|
|
142
|
+
} else {
|
|
143
|
+
console.log(`๐ญ ${firstLine}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} else if (content.type === 'tool_use') {
|
|
147
|
+
// Show tool use with actual command/input when available
|
|
148
|
+
const toolName = content.name.replace(/([A-Z])/g, ' $1').trim();
|
|
149
|
+
|
|
150
|
+
// For Bash tool, show the actual command
|
|
151
|
+
if (content.name === 'Bash' && content.input?.command) {
|
|
152
|
+
const command = content.input.command;
|
|
153
|
+
if (command.length > 80) {
|
|
154
|
+
console.log(`๐ง Bash: ${command.substring(0, 77)}...`);
|
|
155
|
+
} else {
|
|
156
|
+
console.log(`๐ง Bash: ${command}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// For other tools, show key parameters
|
|
160
|
+
else if (content.input && Object.keys(content.input).length > 0) {
|
|
161
|
+
const firstKey = Object.keys(content.input)[0];
|
|
162
|
+
const firstValue = content.input[firstKey];
|
|
163
|
+
|
|
164
|
+
if (typeof firstValue === 'string' && firstValue.length < 60) {
|
|
165
|
+
console.log(`๐ง ${toolName}: ${firstValue}`);
|
|
166
|
+
} else if (typeof firstValue === 'string') {
|
|
167
|
+
console.log(`๐ง ${toolName}: ${firstValue.substring(0, 57)}...`);
|
|
168
|
+
} else {
|
|
169
|
+
console.log(`๐ง ${toolName}`);
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
console.log(`๐ง ${toolName}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
|
|
178
|
+
case 'user':
|
|
179
|
+
// Tool results - show only success/failure
|
|
180
|
+
if (event.message?.content?.[0]?.type === 'tool_result') {
|
|
181
|
+
const result = event.message.content[0];
|
|
182
|
+
if (!result.is_error) {
|
|
183
|
+
console.log(` โ
Tool completed`);
|
|
184
|
+
} else {
|
|
185
|
+
console.log(` โ Tool failed: ${result.error || 'Unknown error'}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
|
|
190
|
+
case 'result':
|
|
191
|
+
if (event.subtype === 'success') {
|
|
192
|
+
console.log(
|
|
193
|
+
`\nโ
${this.agentName} - Completed (${this.formatDuration(event.duration_ms)})`,
|
|
194
|
+
);
|
|
195
|
+
if (event.total_cost_usd) {
|
|
196
|
+
console.log(` ๐ฐ Cost: $${event.total_cost_usd.toFixed(4)}`);
|
|
197
|
+
}
|
|
198
|
+
} else if (event.is_error) {
|
|
199
|
+
console.log(`\nโ ${this.agentName} - Failed: ${event.error || 'Unknown error'}`);
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
|
|
203
|
+
default:
|
|
204
|
+
// Only show important events in verbose mode
|
|
205
|
+
if (this.options.verbose && ['tool_call', 'error', 'warning'].includes(event.type)) {
|
|
206
|
+
console.log(
|
|
207
|
+
`โน๏ธ [${event.type}] ${event.message || JSON.stringify(event).substring(0, 80)}...`,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Update the concurrent display instead of console
|
|
215
|
+
*/
|
|
216
|
+
updateDisplay(event) {
|
|
217
|
+
switch (event.type) {
|
|
218
|
+
case 'system':
|
|
219
|
+
if (event.subtype === 'init') {
|
|
220
|
+
this.display.updateAgent(this.agentId, { status: 'active' });
|
|
221
|
+
this.display.addActivity(this.agentId, 'Initialized');
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
|
|
225
|
+
case 'assistant':
|
|
226
|
+
if (event.message?.content?.length > 0) {
|
|
227
|
+
const content = event.message.content[0];
|
|
228
|
+
if (content.type === 'text') {
|
|
229
|
+
const preview = content.text.substring(0, 80);
|
|
230
|
+
this.display.addActivity(this.agentId, preview);
|
|
231
|
+
} else if (content.type === 'tool_use') {
|
|
232
|
+
this.display.addActivity(this.agentId, `Using ${content.name}`, content.name);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
|
|
237
|
+
case 'user':
|
|
238
|
+
// Tool results
|
|
239
|
+
if (event.message?.content?.[0]?.type === 'tool_result') {
|
|
240
|
+
const result = event.message.content[0];
|
|
241
|
+
if (!result.is_error) {
|
|
242
|
+
this.display.addActivity(this.agentId, 'Tool completed', null);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
|
|
247
|
+
case 'result':
|
|
248
|
+
if (event.subtype === 'success') {
|
|
249
|
+
this.display.updateAgent(this.agentId, {
|
|
250
|
+
status: 'completed',
|
|
251
|
+
progress: 100,
|
|
252
|
+
});
|
|
253
|
+
this.display.addActivity(this.agentId, 'Task completed successfully');
|
|
254
|
+
} else if (event.is_error) {
|
|
255
|
+
this.display.updateAgent(this.agentId, {
|
|
256
|
+
status: 'failed',
|
|
257
|
+
});
|
|
258
|
+
this.display.addActivity(this.agentId, `Failed: ${event.error || 'Unknown error'}`);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
updateProgress() {
|
|
265
|
+
// Don't show progress updates in interactive-style mode - events handle the display
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
showFinalStatus() {
|
|
269
|
+
const elapsed = this.formatDuration(Date.now() - this.startTime);
|
|
270
|
+
if (this.eventCount > 0) {
|
|
271
|
+
console.log(`\n๐ ${this.agentName} - Processed ${this.eventCount} events in ${elapsed}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
getSpinner() {
|
|
276
|
+
const frames = ['โ ', 'โ ', 'โ น', 'โ ธ', 'โ ผ', 'โ ด', 'โ ฆ', 'โ ง', 'โ ', 'โ '];
|
|
277
|
+
return frames[Math.floor(Date.now() / 100) % frames.length];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
getProgressBar(elapsed, expected) {
|
|
281
|
+
const progress = Math.min(elapsed / expected, 1);
|
|
282
|
+
const filled = Math.floor(progress * 10);
|
|
283
|
+
const empty = 10 - filled;
|
|
284
|
+
return '[' + 'โ'.repeat(filled) + 'โ'.repeat(empty) + ']';
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
formatDuration(ms) {
|
|
288
|
+
const seconds = Math.floor(ms / 1000);
|
|
289
|
+
const minutes = Math.floor(seconds / 60);
|
|
290
|
+
if (minutes > 0) {
|
|
291
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
292
|
+
}
|
|
293
|
+
return `${seconds}s`;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
formatToolParams(input) {
|
|
297
|
+
if (!input || typeof input !== 'object' || Object.keys(input).length === 0) {
|
|
298
|
+
return '';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Format key parameters for display
|
|
302
|
+
const keys = Object.keys(input);
|
|
303
|
+
if (keys.length === 1) {
|
|
304
|
+
const key = keys[0];
|
|
305
|
+
const value = input[key];
|
|
306
|
+
if (typeof value === 'string' && value.length < 30) {
|
|
307
|
+
return `(${key}: "${value}")`;
|
|
308
|
+
} else if (typeof value === 'number' || typeof value === 'boolean') {
|
|
309
|
+
return `(${key}: ${value})`;
|
|
310
|
+
}
|
|
311
|
+
} else if (keys.length <= 3) {
|
|
312
|
+
const params = keys
|
|
313
|
+
.map((key) => {
|
|
314
|
+
const value = input[key];
|
|
315
|
+
if (typeof value === 'string' && value.length < 20) {
|
|
316
|
+
return `${key}: "${value}"`;
|
|
317
|
+
} else if (typeof value === 'number' || typeof value === 'boolean') {
|
|
318
|
+
return `${key}: ${value}`;
|
|
319
|
+
} else {
|
|
320
|
+
return `${key}: ...`;
|
|
321
|
+
}
|
|
322
|
+
})
|
|
323
|
+
.join(', ');
|
|
324
|
+
return `(${params})`;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return '(...)';
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Create a stream processor for an agent
|
|
333
|
+
*/
|
|
334
|
+
export function createStreamProcessor(agentName, agentIcon, options = {}) {
|
|
335
|
+
return new StreamJsonProcessor({
|
|
336
|
+
agentName,
|
|
337
|
+
agentIcon,
|
|
338
|
+
...options,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple Swarm Executor - Provides basic swarm functionality without TypeScript dependencies
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { promises as fs } from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
|
|
8
|
+
// Simple ID generator to avoid build dependencies
|
|
9
|
+
function generateId(prefix = 'id') {
|
|
10
|
+
const timestamp = Date.now().toString(36);
|
|
11
|
+
const random = Math.random().toString(36).substring(2, 9);
|
|
12
|
+
return `${prefix}_${timestamp}_${random}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Simple SwarmCoordinator implementation
|
|
16
|
+
export class SwarmCoordinator {
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.id = config.name || generateId('swarm');
|
|
20
|
+
this.agents = [];
|
|
21
|
+
this.tasks = [];
|
|
22
|
+
this.status = 'initializing';
|
|
23
|
+
this.startTime = Date.now();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async initialize() {
|
|
27
|
+
console.log(`\n๐ Swarm initialized: ${this.id}`);
|
|
28
|
+
console.log(`๐ Description: ${this.config.description}`);
|
|
29
|
+
console.log(`๐ฏ Strategy: ${this.config.strategy}`);
|
|
30
|
+
console.log(`๐๏ธ Mode: ${this.config.mode}`);
|
|
31
|
+
console.log(`๐ค Max Agents: ${this.config.maxAgents}`);
|
|
32
|
+
|
|
33
|
+
this.status = 'active';
|
|
34
|
+
|
|
35
|
+
// Create swarm directory
|
|
36
|
+
const swarmDir = `./swarm-runs/${this.id}`;
|
|
37
|
+
await fs.mkdir(swarmDir, { recursive: true });
|
|
38
|
+
|
|
39
|
+
// Save configuration
|
|
40
|
+
await fs.writeFile(path.join(swarmDir, 'config.json'), JSON.stringify(this.config, null, 2));
|
|
41
|
+
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async addAgent(type, name) {
|
|
46
|
+
const agent = {
|
|
47
|
+
id: generateId('agent'),
|
|
48
|
+
type,
|
|
49
|
+
name: name || `${type}-${this.agents.length + 1}`,
|
|
50
|
+
status: 'active',
|
|
51
|
+
tasks: [],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
this.agents.push(agent);
|
|
55
|
+
console.log(` ๐ค Agent spawned: ${agent.name} (${agent.type})`);
|
|
56
|
+
|
|
57
|
+
return agent;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async executeTask(task) {
|
|
61
|
+
const taskObj = {
|
|
62
|
+
id: generateId('task'),
|
|
63
|
+
description: task,
|
|
64
|
+
status: 'in_progress',
|
|
65
|
+
startTime: Date.now(),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
this.tasks.push(taskObj);
|
|
69
|
+
console.log(`\n๐ Executing task: ${task}`);
|
|
70
|
+
|
|
71
|
+
// Simulate task execution with progress
|
|
72
|
+
console.log(` โณ Processing...`);
|
|
73
|
+
|
|
74
|
+
// Simulate different types of tasks
|
|
75
|
+
if (task.toLowerCase().includes('api')) {
|
|
76
|
+
await this.createAPIProject();
|
|
77
|
+
} else if (task.toLowerCase().includes('test')) {
|
|
78
|
+
await this.runTests();
|
|
79
|
+
} else {
|
|
80
|
+
await this.genericTaskExecution(task);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
taskObj.status = 'completed';
|
|
84
|
+
taskObj.endTime = Date.now();
|
|
85
|
+
|
|
86
|
+
console.log(` โ
Task completed in ${(taskObj.endTime - taskObj.startTime) / 1000}s`);
|
|
87
|
+
|
|
88
|
+
return taskObj;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async createAPIProject() {
|
|
92
|
+
console.log(` ๐๏ธ Creating API project structure...`);
|
|
93
|
+
|
|
94
|
+
const projectDir = './api-project';
|
|
95
|
+
await fs.mkdir(projectDir, { recursive: true });
|
|
96
|
+
|
|
97
|
+
// Create basic Express server
|
|
98
|
+
const serverCode = `const express = require('express');
|
|
99
|
+
const app = express();
|
|
100
|
+
const port = process.env.PORT || 3000;
|
|
101
|
+
|
|
102
|
+
app.use(express.json());
|
|
103
|
+
|
|
104
|
+
app.get('/health', (req, res) => {
|
|
105
|
+
res.json({ status: 'healthy', swarm: '${this.id}' });
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
app.get('/api/items', (req, res) => {
|
|
109
|
+
res.json({ items: [], count: 0 });
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
app.listen(port, () => {
|
|
113
|
+
console.log(\`API server running on port \${port}\`);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
module.exports = app;
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
await fs.writeFile(path.join(projectDir, 'server.js'), serverCode);
|
|
120
|
+
|
|
121
|
+
// Create package.json
|
|
122
|
+
const packageJson = {
|
|
123
|
+
name: 'api-project',
|
|
124
|
+
version: '1.0.0',
|
|
125
|
+
description: 'API created by Claude Flow Swarm',
|
|
126
|
+
main: 'server.js',
|
|
127
|
+
scripts: {
|
|
128
|
+
start: 'node server.js',
|
|
129
|
+
dev: 'nodemon server.js',
|
|
130
|
+
},
|
|
131
|
+
dependencies: {
|
|
132
|
+
express: '^4.18.2',
|
|
133
|
+
},
|
|
134
|
+
devDependencies: {
|
|
135
|
+
nodemon: '^3.0.1',
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
await fs.writeFile(path.join(projectDir, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
140
|
+
|
|
141
|
+
console.log(` โ
Created API project in ${projectDir}`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async runTests() {
|
|
145
|
+
console.log(` ๐งช Running tests...`);
|
|
146
|
+
console.log(` โ
All tests passed (0 tests)`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async genericTaskExecution(task) {
|
|
150
|
+
console.log(` ๐ Executing: ${task}`);
|
|
151
|
+
|
|
152
|
+
// Simulate work being done
|
|
153
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
154
|
+
|
|
155
|
+
console.log(` โ
Generic task completed`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async getStatus() {
|
|
159
|
+
return {
|
|
160
|
+
id: this.id,
|
|
161
|
+
status: this.status,
|
|
162
|
+
agents: this.agents.length,
|
|
163
|
+
tasks: {
|
|
164
|
+
total: this.tasks.length,
|
|
165
|
+
completed: this.tasks.filter((t) => t.status === 'completed').length,
|
|
166
|
+
in_progress: this.tasks.filter((t) => t.status === 'in_progress').length,
|
|
167
|
+
},
|
|
168
|
+
runtime: Math.floor((Date.now() - this.startTime) / 1000),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async complete() {
|
|
173
|
+
this.status = 'completed';
|
|
174
|
+
|
|
175
|
+
const summary = await this.getStatus();
|
|
176
|
+
console.log(`\nโ
Swarm completed successfully!`);
|
|
177
|
+
console.log(`๐ Summary:`);
|
|
178
|
+
console.log(` โข Swarm ID: ${summary.id}`);
|
|
179
|
+
console.log(` โข Total Agents: ${summary.agents}`);
|
|
180
|
+
console.log(` โข Tasks Completed: ${summary.tasks.completed}`);
|
|
181
|
+
console.log(` โข Runtime: ${summary.runtime}s`);
|
|
182
|
+
|
|
183
|
+
// Save summary
|
|
184
|
+
const swarmDir = `./swarm-runs/${this.id}`;
|
|
185
|
+
await fs.writeFile(path.join(swarmDir, 'summary.json'), JSON.stringify(summary, null, 2));
|
|
186
|
+
|
|
187
|
+
return summary;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Main execution function
|
|
192
|
+
export async function executeSwarm(objective, flags = {}) {
|
|
193
|
+
try {
|
|
194
|
+
// Parse configuration from flags
|
|
195
|
+
const config = {
|
|
196
|
+
name: generateId('swarm'),
|
|
197
|
+
description: objective,
|
|
198
|
+
mode: flags.mode || 'centralized',
|
|
199
|
+
strategy: flags.strategy || 'auto',
|
|
200
|
+
maxAgents: parseInt(flags['max-agents']) || 5,
|
|
201
|
+
maxTasks: parseInt(flags['max-tasks']) || 100,
|
|
202
|
+
timeout: (parseInt(flags.timeout) || 60) * 60 * 1000,
|
|
203
|
+
taskTimeoutMinutes: parseInt(flags['task-timeout-minutes']) || 59,
|
|
204
|
+
qualityThreshold: parseFloat(flags['quality-threshold']) || 0.8,
|
|
205
|
+
reviewRequired: flags.review || false,
|
|
206
|
+
testingRequired: flags.testing || false,
|
|
207
|
+
monitoring: {
|
|
208
|
+
enabled: flags.monitor || false,
|
|
209
|
+
},
|
|
210
|
+
memory: {
|
|
211
|
+
namespace: flags['memory-namespace'] || 'swarm',
|
|
212
|
+
persistent: flags.persistence !== false,
|
|
213
|
+
},
|
|
214
|
+
security: {
|
|
215
|
+
encryptionEnabled: flags.encryption || false,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// Initialize swarm coordinator
|
|
220
|
+
const coordinator = new SwarmCoordinator(config);
|
|
221
|
+
await coordinator.initialize();
|
|
222
|
+
|
|
223
|
+
// Spawn agents based on strategy
|
|
224
|
+
if (config.strategy === 'development' || config.strategy === 'auto') {
|
|
225
|
+
await coordinator.addAgent('architect', 'System Architect');
|
|
226
|
+
await coordinator.addAgent('coder', 'Backend Developer');
|
|
227
|
+
await coordinator.addAgent('coder', 'Frontend Developer');
|
|
228
|
+
await coordinator.addAgent('tester', 'QA Engineer');
|
|
229
|
+
await coordinator.addAgent('reviewer', 'Code Reviewer');
|
|
230
|
+
} else if (config.strategy === 'research') {
|
|
231
|
+
await coordinator.addAgent('researcher', 'Lead Researcher');
|
|
232
|
+
await coordinator.addAgent('analyst', 'Data Analyst');
|
|
233
|
+
await coordinator.addAgent('researcher', 'Research Assistant');
|
|
234
|
+
} else if (config.strategy === 'testing') {
|
|
235
|
+
await coordinator.addAgent('tester', 'Test Lead');
|
|
236
|
+
await coordinator.addAgent('tester', 'Integration Tester');
|
|
237
|
+
await coordinator.addAgent('tester', 'Performance Tester');
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Execute the main objective
|
|
241
|
+
await coordinator.executeTask(objective);
|
|
242
|
+
|
|
243
|
+
// Complete and return summary
|
|
244
|
+
const summary = await coordinator.complete();
|
|
245
|
+
|
|
246
|
+
return { success: true, summary };
|
|
247
|
+
} catch (error) {
|
|
248
|
+
console.error(`โ Swarm execution failed: ${error.message}`);
|
|
249
|
+
return { success: false, error: error.message };
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Exports are already declared inline above
|