snow-flow 2.0.2 → 2.0.3

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.
Files changed (173) hide show
  1. package/{.claude/mcp-config.json → .mcp.json} +13 -12
  2. package/.releaserc.json +47 -0
  3. package/README.md +6 -0
  4. package/package.json +1 -1
  5. package/.claude/claude-settings.json +0 -15
  6. package/.claude/commands/analysis/README.md +0 -9
  7. package/.claude/commands/automation/README.md +0 -9
  8. package/.claude/commands/github/README.md +0 -11
  9. package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
  10. package/.claude/commands/hooks/README.md +0 -11
  11. package/.claude/commands/monitoring/README.md +0 -9
  12. package/.claude/commands/optimization/README.md +0 -9
  13. package/.claude/commands/training/README.md +0 -9
  14. package/.claude/commands/workflows/README.md +0 -9
  15. package/.claude/config.json +0 -36
  16. package/.claude/helpers/github-setup.sh +0 -28
  17. package/.claude/helpers/quick-start.sh +0 -19
  18. package/.claude/helpers/setup-mcp.sh +0 -18
  19. package/.claude/settings.json +0 -114
  20. package/.claude/settings.local.json +0 -33
  21. package/.claude-flow/metrics/agent-metrics.json +0 -1
  22. package/.claude-flow/metrics/performance.json +0 -9
  23. package/.claude-flow/metrics/system-metrics.json +0 -15986
  24. package/.claude-flow/metrics/task-metrics.json +0 -10
  25. package/.roo/README.md +0 -402
  26. package/.roo/mcp-list.txt +0 -257
  27. package/.roo/mcp.json +0 -32
  28. package/.roo/workflows/basic-tdd.json +0 -32
  29. package/.roomodes +0 -201
  30. package/CLAUDE.md +0 -393
  31. package/bin/snow-flow.js +0 -3
  32. package/dist/cli.js.bak +0 -2052
  33. package/dist/config/snow-flow-config.d.ts +0 -1492
  34. package/dist/config/snow-flow-config.js +0 -938
  35. package/scripts/create-env.js +0 -91
  36. package/scripts/postinstall.js +0 -30
  37. package/scripts/register-mcp-servers.js +0 -210
  38. package/scripts/reset-mcp-servers.js +0 -246
  39. package/scripts/setup-mcp.js +0 -106
  40. package/scripts/update-version.js +0 -31
  41. package/src/agents/README.md +0 -192
  42. package/src/agents/base-agent.ts +0 -251
  43. package/src/agents/coordinator.ts +0 -971
  44. package/src/agents/index.ts +0 -18
  45. package/src/agents/queen-403-handler.ts +0 -230
  46. package/src/agents/queen-agent.ts +0 -1399
  47. package/src/agents/script-writer-agent.ts +0 -769
  48. package/src/agents/security-agent.ts +0 -726
  49. package/src/agents/widget-creator-agent.ts +0 -568
  50. package/src/api/error-handling.ts +0 -1758
  51. package/src/api/natural-language-mapper.ts +0 -630
  52. package/src/api/performance-optimizer.ts +0 -891
  53. package/src/api/transaction-manager.ts +0 -754
  54. package/src/cli/deploy-artifact.ts +0 -304
  55. package/src/cli/snow-flow-cli-integration.ts +0 -434
  56. package/src/cli.ts +0 -4455
  57. package/src/cli.ts.bak +0 -5616
  58. package/src/compliance/advanced-compliance-system.ts +0 -1268
  59. package/src/compliance/index.ts +0 -19
  60. package/src/config/snow-flow-config.ts +0 -1019
  61. package/src/documentation/index.ts +0 -16
  62. package/src/documentation/self-documenting-system.ts +0 -1421
  63. package/src/dynamic-version.ts +0 -44
  64. package/src/healing/index.ts +0 -20
  65. package/src/healing/self-healing-system.ts +0 -1435
  66. package/src/health/README.md +0 -161
  67. package/src/health/system-health.ts +0 -995
  68. package/src/index.ts +0 -60
  69. package/src/intelligence/acl-analyzer.ts +0 -377
  70. package/src/intelligence/auto-resolution-engine.ts +0 -643
  71. package/src/intelligence/gap-analysis-engine.ts +0 -488
  72. package/src/intelligence/manual-instructions-generator.ts +0 -744
  73. package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
  74. package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
  75. package/src/intelligence/performance-recommendations-engine.ts +0 -1223
  76. package/src/intelligence/requirements-analyzer.ts +0 -1148
  77. package/src/intelligence/task-analyzer.ts +0 -628
  78. package/src/managers/scope-manager.ts +0 -555
  79. package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
  80. package/src/mcp/base-mcp-server.ts +0 -660
  81. package/src/mcp/http-transport-wrapper.ts +0 -426
  82. package/src/mcp/service-discovery-client.ts +0 -312
  83. package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
  84. package/src/mcp/servicenow-automation-mcp.ts +0 -838
  85. package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
  86. package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
  87. package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
  88. package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
  89. package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
  90. package/src/mcp/servicenow-integration-mcp.ts +0 -819
  91. package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
  92. package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
  93. package/src/mcp/servicenow-mcp-server.ts +0 -728
  94. package/src/mcp/servicenow-memory-mcp.ts +0 -474
  95. package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
  96. package/src/mcp/servicenow-operations-mcp.ts +0 -3384
  97. package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
  98. package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
  99. package/src/mcp/servicenow-progressive-indexer.ts +0 -370
  100. package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
  101. package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
  102. package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
  103. package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
  104. package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
  105. package/src/mcp/servicenow-update-set-mcp.ts +0 -811
  106. package/src/mcp/shared/agent-context-provider.ts +0 -365
  107. package/src/mcp/shared/base-mcp-server.ts +0 -2463
  108. package/src/mcp/shared/mcp-memory-manager.ts +0 -540
  109. package/src/mcp/shared/mcp-resource-manager.ts +0 -367
  110. package/src/mcp/snow-flow-mcp.ts +0 -911
  111. package/src/mcp/start-all-mcp-servers.ts +0 -102
  112. package/src/mcp/start-servicenow-mcp.ts +0 -67
  113. package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
  114. package/src/monitoring/performance-tracker.ts +0 -777
  115. package/src/optimization/cost-optimization-engine.ts +0 -1125
  116. package/src/optimization/index.ts +0 -10
  117. package/src/queen/README.md +0 -403
  118. package/src/queen/agent-factory.ts +0 -574
  119. package/src/queen/index.ts +0 -94
  120. package/src/queen/mcp-execution-bridge.ts +0 -681
  121. package/src/queen/neural-learning.ts +0 -319
  122. package/src/queen/parallel-agent-engine.ts +0 -848
  123. package/src/queen/queen-memory-system.ts +0 -490
  124. package/src/queen/queen-memory.ts +0 -456
  125. package/src/queen/servicenow-queen.ts +0 -1029
  126. package/src/queen/types.ts +0 -87
  127. package/src/rollback/smart-rollback-system.ts +0 -866
  128. package/src/schemas/deployment.schema.json +0 -58
  129. package/src/schemas/flow.schema.json +0 -79
  130. package/src/schemas/widget.schema.json +0 -72
  131. package/src/snow-flow-system.ts +0 -541
  132. package/src/sparc/sparc-help.ts +0 -49
  133. package/src/sparc/team-sparc.ts +0 -88
  134. package/src/strategies/global-scope-strategy.ts +0 -736
  135. package/src/templates/base/application.template.json +0 -45
  136. package/src/templates/base/business_rule.template.json +0 -33
  137. package/src/templates/base/script_include.template.json +0 -18
  138. package/src/templates/base/table.template.json +0 -64
  139. package/src/templates/base/widget.template.json +0 -25
  140. package/src/templates/patterns/composite.incident-management.template.json +0 -140
  141. package/src/templates/patterns/widget.dashboard.template.json +0 -238
  142. package/src/templates/patterns/widget.datatable.template.json +0 -292
  143. package/src/testing/integration-test-suite.ts +0 -1276
  144. package/src/types/index.ts +0 -183
  145. package/src/types/neo4j-driver.d.ts +0 -23
  146. package/src/types/servicenow.types.ts +0 -307
  147. package/src/types/snow-flow.types.ts +0 -186
  148. package/src/types/todo.types.ts +0 -70
  149. package/src/utils/action-type-cache.ts +0 -286
  150. package/src/utils/agent-detector.ts +0 -573
  151. package/src/utils/artifact-tracker.ts +0 -379
  152. package/src/utils/dependency-detector.ts +0 -233
  153. package/src/utils/deployment-metadata-handler.ts +0 -518
  154. package/src/utils/error-recovery.ts +0 -680
  155. package/src/utils/logger.ts +0 -60
  156. package/src/utils/mcp-auth-middleware.ts +0 -262
  157. package/src/utils/mcp-config-manager.ts +0 -270
  158. package/src/utils/mcp-server-manager.ts +0 -446
  159. package/src/utils/mcp-tool-registry.ts +0 -298
  160. package/src/utils/migrate-snow-flow.ts +0 -98
  161. package/src/utils/oauth-html-templates.ts +0 -188
  162. package/src/utils/scope-utils.ts +0 -443
  163. package/src/utils/servicenow-client.ts +0 -3321
  164. package/src/utils/servicenow-id-generator.ts +0 -181
  165. package/src/utils/snow-memory-manager.ts +0 -605
  166. package/src/utils/snow-oauth.ts +0 -797
  167. package/src/utils/template-engine.ts +0 -463
  168. package/src/utils/theme-manager.ts +0 -295
  169. package/src/utils/unified-auth-store.ts +0 -222
  170. package/src/utils/update-set-importer.ts +0 -422
  171. package/src/utils/update-set-xml-packager.ts +0 -371
  172. package/src/utils/widget-template-generator.ts +0 -1744
  173. package/src/version.ts +0 -1950
@@ -1,541 +0,0 @@
1
- /**
2
- * Snow-Flow Main Integration Layer
3
- * Coordinates all subsystems: Agents, Memory, MCPs, and ServiceNow
4
- */
5
-
6
- import { EventEmitter } from 'events';
7
- import { SnowFlowConfig, ISnowFlowConfig } from './config/snow-flow-config';
8
- import { ServiceNowQueen } from './queen/servicenow-queen';
9
- import { MemorySystem } from './memory/memory-system';
10
- import { MCPServerManager } from './utils/mcp-server-manager';
11
- import { PerformanceTracker } from './monitoring/performance-tracker';
12
- import { SystemHealth } from './health/system-health';
13
- import { ErrorRecovery } from './utils/error-recovery';
14
- import { Logger } from './utils/logger';
15
- import Database from 'better-sqlite3';
16
- import path from 'path';
17
- import os from 'os';
18
-
19
- export interface SwarmSession {
20
- id: string;
21
- objective: string;
22
- startedAt: Date;
23
- status: 'initializing' | 'active' | 'completing' | 'completed' | 'failed';
24
- queenAgentId: string;
25
- activeAgents: Map<string, AgentInfo>;
26
- completedTasks: number;
27
- totalTasks: number;
28
- errors: Error[];
29
- }
30
-
31
- export interface AgentInfo {
32
- id: string;
33
- type: string;
34
- status: 'spawned' | 'active' | 'blocked' | 'completed' | 'failed';
35
- assignedTasks: string[];
36
- progress: number;
37
- lastActivity: Date;
38
- }
39
-
40
- export class SnowFlowSystem extends EventEmitter {
41
- private config: SnowFlowConfig;
42
- private queen?: ServiceNowQueen;
43
- private memory?: MemorySystem;
44
- private mcpManager?: MCPServerManager;
45
- private performanceTracker?: PerformanceTracker;
46
- private systemHealth?: SystemHealth;
47
- private errorRecovery: ErrorRecovery;
48
- private logger: Logger;
49
- private sessions: Map<string, SwarmSession> = new Map();
50
- private initialized = false;
51
-
52
- constructor(config?: Partial<ISnowFlowConfig>) {
53
- super();
54
- this.config = new SnowFlowConfig(config);
55
- this.logger = new Logger('SnowFlowSystem');
56
- this.errorRecovery = new ErrorRecovery(this.logger);
57
- }
58
-
59
- /**
60
- * Initialize the entire Snow-Flow system
61
- */
62
- async initialize(): Promise<void> {
63
- if (this.initialized) {
64
- this.logger.info('System already initialized');
65
- return;
66
- }
67
-
68
- try {
69
- this.logger.info('Initializing Snow-Flow System...');
70
-
71
- // 1. Initialize Memory System
72
- await this.initializeMemory();
73
-
74
- // 2. Initialize MCP Servers
75
- await this.initializeMCPServers();
76
-
77
- // 3. Initialize Queen Agent System
78
- await this.initializeQueen();
79
-
80
- // 4. Initialize Performance Tracking
81
- await this.initializePerformanceTracking();
82
-
83
- // 5. Initialize System Health Monitoring
84
- await this.initializeHealthMonitoring();
85
-
86
- this.initialized = true;
87
- this.emit('system:initialized');
88
- this.logger.info('Snow-Flow System initialized successfully');
89
-
90
- } catch (error) {
91
- this.logger.error('System initialization failed:', error);
92
- await this.errorRecovery.handleCriticalError(error as Error, {
93
- operation: 'system_initialization',
94
- fallbackStrategies: ['retry_initialization', 'partial_initialization']
95
- });
96
- throw error;
97
- }
98
- }
99
-
100
- /**
101
- * Initialize Memory System with SQLite
102
- */
103
- private async initializeMemory(): Promise<void> {
104
- this.logger.info('Initializing Memory System...');
105
-
106
- const dbPath = path.join(
107
- os.homedir(),
108
- '.snow-flow',
109
- 'memory',
110
- 'snow-flow.db'
111
- );
112
-
113
- this.memory = new MemorySystem({
114
- dbPath,
115
- schema: { version: '1.0.0', autoMigrate: true, ...(this.config.memory.schema || {}) },
116
- ttl: { default: 86400000, session: 3600000, artifact: 86400000, metric: 3600000, ...(this.config.memory.ttl || {}) }
117
- });
118
-
119
- await this.memory.initialize();
120
- this.emit('memory:initialized');
121
- }
122
-
123
- /**
124
- * Initialize MCP Server Manager
125
- */
126
- private async initializeMCPServers(): Promise<void> {
127
- this.logger.info('Initializing MCP Servers...');
128
-
129
- this.mcpManager = new MCPServerManager(JSON.stringify(this.config.mcp));
130
-
131
- // Start all required MCP servers
132
- const servers = [
133
- 'servicenow-deployment',
134
- 'servicenow-intelligent',
135
- 'servicenow-operations',
136
- 'servicenow-platform-development',
137
- 'servicenow-integration',
138
- 'servicenow-automation',
139
- 'servicenow-security-compliance',
140
- 'servicenow-reporting-analytics',
141
- 'servicenow-graph-memory',
142
- 'servicenow-update-set'
143
- ];
144
-
145
- for (const server of servers) {
146
- try {
147
- await this.mcpManager.startServer(server);
148
- this.logger.info(`Started MCP server: ${server}`);
149
- } catch (error) {
150
- this.logger.error(`Failed to start MCP server ${server}:`, error);
151
- // Continue with other servers even if one fails
152
- }
153
- }
154
-
155
- this.emit('mcp:initialized');
156
- }
157
-
158
- /**
159
- * Initialize Queen Agent System
160
- */
161
- private async initializeQueen(): Promise<void> {
162
- this.logger.info('Initializing Queen Agent System...');
163
-
164
- if (!this.memory || !this.mcpManager) {
165
- throw new Error('Memory and MCP must be initialized before Queen');
166
- }
167
-
168
- this.queen = new ServiceNowQueen({
169
- memoryPath: this.config.memory?.dbPath,
170
- maxConcurrentAgents: (this.config.agents?.queen as any)?.maxConcurrentAgents || 5,
171
- learningRate: (this.config.agents?.queen as any)?.learningRate || 0.1,
172
- debugMode: (this.config as any).debugMode || false,
173
- autoPermissions: (this.config.agents?.queen as any)?.autoPermissions || false
174
- });
175
-
176
- // ServiceNowQueen is ready to use after construction
177
- // No initialize method or event handlers available
178
-
179
- this.emit('queen:initialized');
180
- }
181
-
182
- /**
183
- * Initialize Performance Tracking
184
- */
185
- private async initializePerformanceTracking(): Promise<void> {
186
- this.logger.info('Initializing Performance Tracking...');
187
-
188
- if (!this.memory) {
189
- throw new Error('Memory must be initialized before Performance Tracking');
190
- }
191
-
192
- this.performanceTracker = new PerformanceTracker({
193
- memory: this.memory,
194
- config: { sampleRate: 100, metricsRetention: 86400000, aggregationInterval: 60000, ...(this.config.monitoring.performance || {}) }
195
- });
196
-
197
- await this.performanceTracker.initialize();
198
-
199
- // Set up performance monitoring
200
- this.performanceTracker.on('metric:recorded', (metric) => {
201
- this.emit('performance:metric', metric);
202
- });
203
-
204
- this.emit('performance:initialized');
205
- }
206
-
207
- /**
208
- * Initialize System Health Monitoring
209
- */
210
- private async initializeHealthMonitoring(): Promise<void> {
211
- this.logger.info('Initializing System Health Monitoring...');
212
-
213
- if (!this.memory || !this.mcpManager) {
214
- throw new Error('Memory and MCP must be initialized before Health Monitoring');
215
- }
216
-
217
- this.systemHealth = new SystemHealth({
218
- memory: this.memory,
219
- mcpManager: this.mcpManager,
220
- config: {
221
- checks: { memory: true, mcp: true, servicenow: true, queen: true },
222
- thresholds: { memoryUsage: 85, responseTime: 5000, queueSize: 100, cpuUsage: 80, errorRate: 5 }
223
- }
224
- });
225
-
226
- await this.systemHealth.initialize();
227
-
228
- // Set up health monitoring
229
- this.systemHealth.on('health:check', (status) => {
230
- this.emit('health:status', status);
231
- });
232
-
233
- // Start periodic health checks
234
- await this.systemHealth.startMonitoring();
235
-
236
- this.emit('health:initialized');
237
- }
238
-
239
- /**
240
- * Execute a swarm objective
241
- */
242
- async executeSwarm(objective: string, options: SwarmOptions = {}): Promise<SwarmResult> {
243
- if (!this.initialized) {
244
- throw new Error('System not initialized. Call initialize() first.');
245
- }
246
-
247
- const sessionId = this.generateSessionId();
248
- const session: SwarmSession = {
249
- id: sessionId,
250
- objective,
251
- startedAt: new Date(),
252
- status: 'initializing',
253
- queenAgentId: '',
254
- activeAgents: new Map(),
255
- completedTasks: 0,
256
- totalTasks: 0,
257
- errors: []
258
- };
259
-
260
- this.sessions.set(sessionId, session);
261
-
262
- try {
263
- // Track swarm execution
264
- await this.performanceTracker?.startOperation('swarm_execution', {
265
- sessionId,
266
- objective
267
- });
268
-
269
- // Execute objective using Queen's main method
270
- const queenResult = await this.queen!.executeObjective(objective);
271
- const _analysis = {
272
- complexity: 0.5,
273
- type: 'unknown',
274
- estimatedDuration: 30000,
275
- queenId: 'main-queen',
276
- estimatedTasks: 1
277
- };
278
-
279
- session.queenAgentId = _analysis.queenId;
280
- session.totalTasks = _analysis.estimatedTasks;
281
- session.status = 'active';
282
-
283
- // Execute swarm with Queen coordination (MCP-FIRST workflow)
284
- console.log(`🚨 SWARM EXECUTING WITH MCP-FIRST WORKFLOW`);
285
- console.log(`šŸŽÆ Objective: ${objective}`);
286
-
287
- const executionResult = await this.queen!.executeObjective(objective);
288
-
289
- // Update session with swarm-specific progress tracking
290
- session.completedTasks = 1; // Queen completed the objective
291
- session.status = 'completed' as any;
292
- this.emit('swarm:progress', {
293
- sessionId,
294
- progress: {
295
- completed: 1,
296
- total: 1,
297
- status: 'completed',
298
- mcpFirst: true,
299
- realServiceNow: true
300
- }
301
- });
302
-
303
- session.status = 'completed';
304
- await this.performanceTracker?.endOperation('swarm_execution', {
305
- success: true
306
- });
307
-
308
- return {
309
- sessionId,
310
- success: true,
311
- artifacts: queenResult.artifacts || [],
312
- summary: queenResult.deploymentResult || queenResult,
313
- metrics: await this.performanceTracker?.getSessionMetrics(sessionId) || {}
314
- };
315
-
316
- } catch (error) {
317
- session.status = 'failed';
318
- session.errors.push(error as Error);
319
-
320
- await this.performanceTracker?.endOperation('swarm_execution', {
321
- success: false,
322
- error: (error as Error).message
323
- });
324
-
325
- // Attempt recovery
326
- const recovery = await this.errorRecovery.attemptSwarmRecovery(sessionId, error as Error);
327
-
328
- if (recovery.success) {
329
- return recovery.result as SwarmResult;
330
- }
331
-
332
- throw error;
333
- }
334
- }
335
-
336
- /**
337
- * Get system status
338
- */
339
- async getStatus(): Promise<SystemStatus> {
340
- if (!this.initialized) {
341
- return {
342
- initialized: false,
343
- status: 'not_initialized',
344
- components: {}
345
- };
346
- }
347
-
348
- const healthStatus = await this.systemHealth!.getFullStatus();
349
- const activeSessions = Array.from(this.sessions.values())
350
- .filter(s => s.status === 'active');
351
-
352
- return {
353
- initialized: true,
354
- status: healthStatus.healthy ? 'healthy' : 'degraded',
355
- components: {
356
- memory: healthStatus.components.memory,
357
- mcp: healthStatus.components.mcp,
358
- queen: healthStatus.components.queen,
359
- performance: healthStatus.components.performance
360
- },
361
- activeSessions: activeSessions.length,
362
- metrics: {
363
- totalSessions: this.sessions.size,
364
- successRate: await this.calculateSuccessRate(),
365
- averageExecutionTime: await this.calculateAverageExecutionTime()
366
- }
367
- };
368
- }
369
-
370
- /**
371
- * Shutdown the system gracefully
372
- */
373
- async shutdown(): Promise<void> {
374
- this.logger.info('Shutting down Snow-Flow System...');
375
-
376
- try {
377
- // Complete active sessions
378
- for (const session of this.sessions.values()) {
379
- if (session.status === 'active') {
380
- await this.gracefullyCompleteSession(session.id);
381
- }
382
- }
383
-
384
- // Shutdown components in reverse order
385
- await this.systemHealth?.stopMonitoring();
386
- await this.performanceTracker?.shutdown();
387
- await this.queen?.shutdown();
388
- // Use available shutdown method
389
- if (this.mcpManager && typeof (this.mcpManager as any).shutdownAll === 'function') {
390
- await (this.mcpManager as any).shutdownAll();
391
- } else if (this.mcpManager && typeof (this.mcpManager as any).shutdown === 'function') {
392
- await (this.mcpManager as any).shutdown();
393
- }
394
- await this.memory?.close();
395
-
396
- this.initialized = false;
397
- this.emit('system:shutdown');
398
- this.logger.info('Snow-Flow System shutdown complete');
399
-
400
- } catch (error) {
401
- this.logger.error('Error during shutdown:', error);
402
- throw error;
403
- }
404
- }
405
-
406
- /**
407
- * Get session information
408
- */
409
- getSession(sessionId: string): SwarmSession | undefined {
410
- return this.sessions.get(sessionId);
411
- }
412
-
413
- /**
414
- * List all sessions
415
- */
416
- listSessions(filter?: { status?: string }): SwarmSession[] {
417
- const sessions = Array.from(this.sessions.values());
418
-
419
- if (filter?.status) {
420
- return sessions.filter(s => s.status === filter.status);
421
- }
422
-
423
- return sessions;
424
- }
425
-
426
- /**
427
- * Get memory system instance
428
- */
429
- getMemory(): MemorySystem | undefined {
430
- return this.memory;
431
- }
432
-
433
- /**
434
- * Get MCP manager instance
435
- */
436
- getMCPManager(): MCPServerManager | undefined {
437
- return this.mcpManager;
438
- }
439
-
440
- /**
441
- * Private helper methods
442
- */
443
- private generateSessionId(): string {
444
- return `swarm_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
445
- }
446
-
447
- private updateAgentInfo(session: SwarmSession, update: any): void {
448
- const agent = session.activeAgents.get(update.agentId) || {
449
- id: update.agentId,
450
- type: update.agentType,
451
- status: 'spawned',
452
- assignedTasks: [],
453
- progress: 0,
454
- lastActivity: new Date()
455
- };
456
-
457
- Object.assign(agent, update);
458
- session.activeAgents.set(update.agentId, agent);
459
- }
460
-
461
- private async gracefullyCompleteSession(sessionId: string): Promise<void> {
462
- const session = this.sessions.get(sessionId);
463
- if (!session) return;
464
-
465
- this.logger.info(`Gracefully completing session ${sessionId}`);
466
-
467
- // Notify all active agents to wrap up
468
- for (const agent of session.activeAgents.values()) {
469
- if (agent.status === 'active') {
470
- // Use available shutdown method
471
- // await this.queen?.shutdown(); // No per-agent shutdown available
472
- }
473
- }
474
-
475
- // Wait for agents to complete (max 30 seconds)
476
- const timeout = setTimeout(() => {
477
- session.status = 'completed';
478
- }, 30000);
479
-
480
- while (session.status === 'active') {
481
- await new Promise(resolve => setTimeout(resolve, 1000));
482
-
483
- const activeAgents = Array.from(session.activeAgents.values())
484
- .filter(a => a.status === 'active');
485
-
486
- if (activeAgents.length === 0) {
487
- session.status = 'completed';
488
- clearTimeout(timeout);
489
- break;
490
- }
491
- }
492
- }
493
-
494
- private async calculateSuccessRate(): Promise<number> {
495
- const sessions = Array.from(this.sessions.values());
496
- const completed = sessions.filter(s => s.status === 'completed').length;
497
- const total = sessions.filter(s => ['completed', 'failed'].includes(s.status)).length;
498
-
499
- return total > 0 ? (completed / total) * 100 : 0;
500
- }
501
-
502
- private async calculateAverageExecutionTime(): Promise<number> {
503
- const metrics = await this.performanceTracker?.getAggregateMetrics('swarm_execution');
504
- return metrics?.averageDuration || 0;
505
- }
506
- }
507
-
508
- // Type definitions
509
- export interface SwarmOptions {
510
- strategy?: 'research' | 'development' | '_analysis' | 'testing' | 'optimization' | 'maintenance';
511
- mode?: 'centralized' | 'distributed' | 'hierarchical' | 'mesh' | 'hybrid';
512
- maxAgents?: number;
513
- parallel?: boolean;
514
- monitor?: boolean;
515
- autoPermissions?: boolean;
516
- smartDiscovery?: boolean;
517
- liveTesting?: boolean;
518
- autoDeploy?: boolean;
519
- autoRollback?: boolean;
520
- sharedMemory?: boolean;
521
- progressMonitoring?: boolean;
522
- }
523
-
524
- export interface SwarmResult {
525
- sessionId: string;
526
- success: boolean;
527
- artifacts: any[];
528
- summary: string;
529
- metrics: any;
530
- }
531
-
532
- export interface SystemStatus {
533
- initialized: boolean;
534
- status: string;
535
- components: Record<string, any>;
536
- activeSessions?: number;
537
- metrics?: any;
538
- }
539
-
540
- // Export singleton instance
541
- export const snowFlowSystem = new SnowFlowSystem();
@@ -1,49 +0,0 @@
1
- /**
2
- * SPARC Help System - Provides guidance to working functionality
3
- */
4
-
5
- export function displayTeamHelp(): void {
6
- console.log(`
7
- šŸŽÆ SPARC Team Development - Available Now!
8
-
9
- The SPARC team functionality you're looking for is available through the SWARM system:
10
-
11
- šŸ’” INSTEAD OF SPARC COMMANDS, USE:
12
- ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
13
- │ āœ… WORKING ALTERNATIVES (Use These!) │
14
- ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
15
- │ snow-flow swarm "create incident dashboard widget" │
16
- │ snow-flow swarm "build approval workflow for equipment" │
17
- │ snow-flow swarm "develop mobile app with authentication" │
18
- │ snow-flow queen "create ServiceNow integration" │
19
- ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
20
-
21
- šŸš€ SWARM FEATURES (What you get automatically):
22
- • 🧠 Multi-Agent Coordination: Automatic spawning of specialized agents
23
- • šŸŽÆ Smart Discovery: Finds existing artifacts to prevent duplication
24
- • šŸ”„ Live Testing: Real-time testing on your ServiceNow instance
25
- • šŸ“‹ Update Set Management: Automatic change tracking
26
- • šŸš€ Auto-Deployment: Direct deployment to ServiceNow when ready
27
- • šŸ›”ļø Error Recovery: Automatic rollback on failures
28
-
29
- šŸ”§ SWARM OPTIONS:
30
- • --strategy: research, development, _analysis, testing, optimization
31
- • --mode: centralized, distributed, hierarchical, mesh, hybrid
32
- • --max-agents: Control team size (default: 5)
33
- • --parallel: Enable parallel execution
34
- • --monitor: Real-time progress monitoring
35
-
36
- šŸ“š EXAMPLES:
37
- • Widget Team: snow-flow swarm "create dashboard with charts" --strategy development
38
- • Flow Team: snow-flow swarm "approval workflow with notifications" --mode hierarchical
39
- • Full App: snow-flow swarm "mobile ITSM solution" --max-agents 8 --monitor
40
-
41
- šŸŽÆ GET STARTED:
42
- 1. snow-flow auth login # Authenticate with ServiceNow
43
- 2. snow-flow swarm "your objective" # Everything else is automatic!
44
- 3. snow-flow status # Check system health
45
-
46
- The swarm system provides all the team coordination, specialist roles, and
47
- quality gates that SPARC was designed to deliver - and it's working now!
48
- `);
49
- }
@@ -1,88 +0,0 @@
1
- /**
2
- * SPARC Team Executor - Redirects to Working Functionality
3
- * Provides helpful guidance to users who try SPARC commands
4
- */
5
-
6
- export class TeamSparcExecutor {
7
- static async execute(teamType: string, task: string, options: any = {}): Promise<any> {
8
- console.log(`\nšŸŽÆ SPARC Team: ${teamType.toUpperCase()}`);
9
- console.log(`šŸ“‹ Task: ${task}\n`);
10
-
11
- // Determine the best swarm strategy based on team type
12
- const strategyMap: Record<string, string> = {
13
- 'widget': 'development',
14
- 'flow': 'development',
15
- 'app': 'development',
16
- 'application': 'development',
17
- 'adaptive': '_analysis'
18
- };
19
-
20
- const strategy = strategyMap[teamType.toLowerCase()] || 'development';
21
- const swarmCommand = `snow-flow swarm "${task}"${strategy !== 'development' ? ` --strategy ${strategy}` : ''}${options.parallel ? ' --parallel' : ''}${options.monitor ? ' --monitor' : ''}`;
22
-
23
- console.log(`āœ… SPARC Team functionality is available through the SWARM system!\n`);
24
- console.log(`šŸš€ Run this command instead:\n`);
25
- console.log(` ${swarmCommand}\n`);
26
- console.log(`šŸ’” The SWARM system provides:`);
27
- console.log(` • Multi-agent team coordination (what SPARC was designed for)`);
28
- console.log(` • Specialist role assignment automatically`);
29
- console.log(` • Real-time progress monitoring`);
30
- console.log(` • Direct ServiceNow integration\n`);
31
- console.log(`šŸ“š For more options: snow-flow swarm --help`);
32
- console.log(`šŸ†˜ For detailed help: snow-flow sparc-help\n`);
33
-
34
- return {
35
- success: true,
36
- message: 'SPARC functionality redirected to working SWARM system',
37
- teamType,
38
- task,
39
- options,
40
- recommendedCommand: swarmCommand,
41
- redirectedTo: 'swarm'
42
- };
43
- }
44
-
45
- static async executeSpecialist(specialistType: string, task: string, options: any = {}): Promise<any> {
46
- console.log(`\nšŸ‘Øā€šŸ’» SPARC ${specialistType.toUpperCase()} Specialist`);
47
- console.log(`šŸ“‹ Task: ${task}\n`);
48
-
49
- // Map specialist types to swarm strategies
50
- const specialistStrategyMap: Record<string, string> = {
51
- 'frontend': 'development',
52
- 'backend': 'development',
53
- 'security': '_analysis',
54
- 'database': 'development',
55
- 'process': 'development',
56
- 'trigger': 'development',
57
- 'data': '_analysis',
58
- 'logic': 'development',
59
- 'interface': 'development',
60
- 'uiux': 'development',
61
- 'platform': 'development'
62
- };
63
-
64
- const strategy = specialistStrategyMap[specialistType.toLowerCase()] || 'development';
65
- const swarmCommand = `snow-flow swarm "${task}" --strategy ${strategy}${options.monitor ? ' --monitor' : ''}${options.dryRun ? ' --dry-run' : ''}`;
66
-
67
- console.log(`āœ… SPARC Specialist functionality is available through the SWARM system!\n`);
68
- console.log(`šŸš€ Run this command instead:\n`);
69
- console.log(` ${swarmCommand}\n`);
70
- console.log(`šŸ’” The SWARM system automatically:`);
71
- console.log(` • Spawns ${specialistType} specialists when needed`);
72
- console.log(` • Coordinates with other specialists automatically`);
73
- console.log(` • Provides real-time progress monitoring`);
74
- console.log(` • Integrates directly with ServiceNow\n`);
75
- console.log(`šŸ“š For more options: snow-flow swarm --help`);
76
- console.log(`šŸ†˜ For detailed help: snow-flow sparc-help\n`);
77
-
78
- return {
79
- success: true,
80
- message: 'SPARC specialist functionality redirected to working SWARM system',
81
- specialistType,
82
- task,
83
- options,
84
- recommendedCommand: swarmCommand,
85
- redirectedTo: 'swarm'
86
- };
87
- }
88
- }