snow-flow 2.0.2 → 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.
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 +48 -1
  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,365 +0,0 @@
1
- /**
2
- * Agent Context Provider for MCP Operations
3
- * Provides agent context awareness and tracking for all MCP tools
4
- */
5
-
6
- import { MCPMemoryManager, AgentContext } from './mcp-memory-manager.js';
7
- import { Logger } from '../../utils/logger.js';
8
-
9
- export interface MCPOperationContext {
10
- session_id: string;
11
- agent_id: string;
12
- agent_type: string;
13
- operation_name: string;
14
- mcp_server: string;
15
- }
16
-
17
- export interface OperationResult<T = any> {
18
- success: boolean;
19
- data?: T;
20
- error?: string;
21
- duration_ms: number;
22
- memory_updates?: Record<string, any>;
23
- }
24
-
25
- export class AgentContextProvider {
26
- private memory: MCPMemoryManager;
27
- private logger: Logger;
28
-
29
- constructor() {
30
- this.memory = MCPMemoryManager.getInstance();
31
- this.logger = new Logger('AgentContextProvider');
32
- }
33
-
34
- /**
35
- * Extract agent context from tool arguments or environment
36
- */
37
- extractAgentContext(args: any): AgentContext {
38
- // Check if agent context is provided in args
39
- if (args.agent_context) {
40
- return args.agent_context;
41
- }
42
-
43
- // Check for session_id and agent_id in args
44
- if (args.session_id && args.agent_id) {
45
- return {
46
- session_id: args.session_id,
47
- agent_id: args.agent_id,
48
- agent_type: args.agent_type || 'unknown'
49
- };
50
- }
51
-
52
- // Check environment variables (for backward compatibility)
53
- const session_id = process.env.SNOW_FLOW_SESSION_ID || `session_${Date.now()}`;
54
- const agent_id = process.env.SNOW_FLOW_AGENT_ID || `agent_${Date.now()}`;
55
- const agent_type = process.env.SNOW_FLOW_AGENT_TYPE || 'mcp_direct';
56
-
57
- return {
58
- session_id,
59
- agent_id,
60
- agent_type
61
- };
62
- }
63
-
64
- /**
65
- * Execute an MCP operation with full agent context tracking
66
- */
67
- async executeWithContext<T>(
68
- context: MCPOperationContext,
69
- operation: () => Promise<T>
70
- ): Promise<OperationResult<T>> {
71
- const startTime = Date.now();
72
- const { session_id, agent_id, operation_name } = context;
73
-
74
- try {
75
- // Update agent coordination - mark as active
76
- await this.memory.updateAgentCoordination({
77
- session_id,
78
- agent_id,
79
- agent_type: context.agent_type,
80
- status: 'active',
81
- current_tool: operation_name,
82
- progress_percentage: 0
83
- });
84
-
85
- // Execute the operation
86
- const result = await operation();
87
- const duration = Date.now() - startTime;
88
-
89
- // Track performance
90
- await this.memory.trackPerformance({
91
- session_id,
92
- agent_id,
93
- operation_name,
94
- duration_ms: duration,
95
- success: true
96
- });
97
-
98
- // Update progress
99
- await this.memory.updateAgentCoordination({
100
- session_id,
101
- agent_id,
102
- progress_percentage: 100,
103
- current_tool: null
104
- });
105
-
106
- return {
107
- success: true,
108
- data: result,
109
- duration_ms: duration
110
- };
111
-
112
- } catch (error) {
113
- const duration = Date.now() - startTime;
114
- const errorMessage = error instanceof Error ? error.message : String(error);
115
-
116
- // Track failed operation
117
- await this.memory.trackPerformance({
118
- session_id,
119
- agent_id,
120
- operation_name,
121
- duration_ms: duration,
122
- success: false,
123
- error_message: errorMessage
124
- });
125
-
126
- // Update agent status with error
127
- await this.memory.updateAgentCoordination({
128
- session_id,
129
- agent_id,
130
- status: 'blocked',
131
- error_state: errorMessage,
132
- current_tool: null
133
- });
134
-
135
- return {
136
- success: false,
137
- error: errorMessage,
138
- duration_ms: duration
139
- };
140
- }
141
- }
142
-
143
- /**
144
- * Report progress during long-running operations
145
- */
146
- async reportProgress(
147
- context: AgentContext,
148
- progress: number,
149
- phase?: string
150
- ): Promise<void> {
151
- try {
152
- await this.memory.updateAgentCoordination({
153
- session_id: context.session_id,
154
- agent_id: context.agent_id,
155
- agent_type: context.agent_type,
156
- progress_percentage: Math.min(100, Math.max(0, progress)),
157
- current_tool: phase
158
- });
159
-
160
- // Optionally update shared context with detailed progress
161
- if (phase) {
162
- await this.memory.updateSharedContext({
163
- session_id: context.session_id,
164
- context_key: `${context.agent_id}_progress`,
165
- context_value: JSON.stringify({
166
- progress,
167
- phase,
168
- timestamp: new Date().toISOString()
169
- }),
170
- created_by_agent: context.agent_id
171
- });
172
- }
173
- } catch (error) {
174
- this.logger.error('Failed to report progress', error);
175
- }
176
- }
177
-
178
- /**
179
- * Notify other agents of handoff or completion
180
- */
181
- async notifyHandoff(
182
- from_context: AgentContext,
183
- to_agent: string,
184
- artifact_info: {
185
- type: string;
186
- sys_id: string;
187
- next_steps: string[];
188
- }
189
- ): Promise<void> {
190
- try {
191
- await this.memory.sendAgentMessage({
192
- session_id: from_context.session_id,
193
- from_agent: from_context.agent_id,
194
- to_agent,
195
- message_type: 'handoff',
196
- content: JSON.stringify({
197
- artifact_type: artifact_info.type,
198
- artifact_sys_id: artifact_info.sys_id,
199
- next_steps: artifact_info.next_steps,
200
- handoff_time: new Date().toISOString()
201
- }),
202
- artifact_reference: artifact_info.sys_id
203
- });
204
-
205
- // Update shared context for the handoff
206
- await this.memory.updateSharedContext({
207
- session_id: from_context.session_id,
208
- context_key: `${artifact_info.type}_ready_for_${to_agent}`,
209
- context_value: JSON.stringify({
210
- sys_id: artifact_info.sys_id,
211
- ready: true,
212
- from_agent: from_context.agent_id,
213
- next_steps: artifact_info.next_steps
214
- }),
215
- created_by_agent: from_context.agent_id
216
- });
217
-
218
- this.logger.info(`Notified handoff from ${from_context.agent_id} to ${to_agent}`);
219
- } catch (error) {
220
- this.logger.error('Failed to notify handoff', error);
221
- throw error;
222
- }
223
- }
224
-
225
- /**
226
- * Check for pending work from other agents
227
- */
228
- async checkForHandoffs(context: AgentContext): Promise<any[]> {
229
- try {
230
- const messages = await this.memory.checkForMessages(
231
- context.agent_id,
232
- context.session_id
233
- );
234
-
235
- const handoffs = messages
236
- .filter(m => m.message_type === 'handoff')
237
- .map(m => {
238
- try {
239
- return JSON.parse(m.content);
240
- } catch {
241
- return m.content;
242
- }
243
- });
244
-
245
- return handoffs;
246
- } catch (error) {
247
- this.logger.error('Failed to check for handoffs', error);
248
- return [];
249
- }
250
- }
251
-
252
- /**
253
- * Store artifact information with agent tracking
254
- */
255
- async storeArtifact(
256
- context: AgentContext,
257
- artifact: {
258
- sys_id: string;
259
- type: string;
260
- name: string;
261
- description?: string;
262
- config?: any;
263
- update_set_id?: string;
264
- }
265
- ): Promise<void> {
266
- try {
267
- await this.memory.storeArtifact({
268
- sys_id: artifact.sys_id,
269
- artifact_type: artifact.type,
270
- name: artifact.name,
271
- description: artifact.description,
272
- created_by_agent: context.agent_id,
273
- session_id: context.session_id,
274
- deployment_status: 'created',
275
- update_set_id: artifact.update_set_id,
276
- metadata: artifact.config ? JSON.stringify(artifact.config) : undefined
277
- });
278
-
279
- // Update shared context
280
- await this.memory.updateSharedContext({
281
- session_id: context.session_id,
282
- context_key: `${artifact.type}_${artifact.name}_created`,
283
- context_value: JSON.stringify({
284
- sys_id: artifact.sys_id,
285
- created_by: context.agent_id,
286
- timestamp: new Date().toISOString()
287
- }),
288
- created_by_agent: context.agent_id
289
- });
290
-
291
- this.logger.info(`Stored artifact ${artifact.name} (${artifact.sys_id})`);
292
- } catch (error) {
293
- this.logger.error('Failed to store artifact', error);
294
- throw error;
295
- }
296
- }
297
-
298
- /**
299
- * Request Queen intervention for critical issues
300
- */
301
- async requestQueenIntervention(
302
- context: AgentContext,
303
- issue: {
304
- type: string;
305
- priority: 'low' | 'medium' | 'high' | 'critical';
306
- description: string;
307
- attempted_solutions?: string[];
308
- }
309
- ): Promise<void> {
310
- try {
311
- await this.memory.sendAgentMessage({
312
- session_id: context.session_id,
313
- from_agent: context.agent_id,
314
- to_agent: 'queen_agent',
315
- message_type: 'error',
316
- content: JSON.stringify({
317
- issue_type: issue.type,
318
- priority: issue.priority,
319
- description: issue.description,
320
- attempted_solutions: issue.attempted_solutions || [],
321
- requesting_agent: context.agent_id,
322
- timestamp: new Date().toISOString()
323
- })
324
- });
325
-
326
- // Update agent status to blocked
327
- await this.memory.updateAgentCoordination({
328
- session_id: context.session_id,
329
- agent_id: context.agent_id,
330
- agent_type: context.agent_type,
331
- status: 'blocked',
332
- error_state: issue.description
333
- });
334
-
335
- this.logger.warn(`Requested Queen intervention for ${issue.type}`);
336
- } catch (error) {
337
- this.logger.error('Failed to request Queen intervention', error);
338
- throw error;
339
- }
340
- }
341
-
342
- /**
343
- * Get session artifacts created by all agents
344
- */
345
- async getSessionArtifacts(session_id: string): Promise<any[]> {
346
- try {
347
- return await this.memory.getSessionArtifacts(session_id);
348
- } catch (error) {
349
- this.logger.error('Failed to get session artifacts', error);
350
- return [];
351
- }
352
- }
353
-
354
- /**
355
- * Get current session context
356
- */
357
- async getSessionContext(session_id: string): Promise<any> {
358
- try {
359
- return await this.memory.getSessionContext(session_id);
360
- } catch (error) {
361
- this.logger.error('Failed to get session context', error);
362
- return {};
363
- }
364
- }
365
- }