snow-flow 2.0.11 → 2.4.1
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/.mcp.json +13 -12
- package/.mcp.json.template +13 -12
- package/README.md +145 -0
- package/dist/cli.js +157 -1
- package/dist/mcp/servicenow-development-assistant-mcp.d.ts +143 -0
- package/dist/mcp/servicenow-development-assistant-mcp.js +4156 -0
- package/dist/mcp/servicenow-machine-learning-mcp.d.ts +85 -0
- package/dist/mcp/servicenow-machine-learning-mcp.js +1743 -0
- package/dist/utils/agent-detector.js +97 -8
- package/package.json +70 -3
|
@@ -9,6 +9,58 @@ class AgentDetector {
|
|
|
9
9
|
static analyzeTask(objective, userMaxAgents) {
|
|
10
10
|
const lowerObjective = objective.toLowerCase();
|
|
11
11
|
const words = lowerObjective.split(/\s+/);
|
|
12
|
+
// Check for data generation FIRST - before any other analysis
|
|
13
|
+
const dataGenerationPatterns = [
|
|
14
|
+
// Pattern for "create/make X incidents/changes" with flexible word order
|
|
15
|
+
/\b(create|generate|make|maak|genereer|aanmaken)\b.*\b\d+\b.*(incident|change|request|problem|task|record|item)/i,
|
|
16
|
+
// Pattern for "data set" with numbers anywhere
|
|
17
|
+
/\bdata\s*set\b.*\b\d{3,}/i, // data set with 3+ digit numbers
|
|
18
|
+
// Pattern for various test/mock/sample data keywords
|
|
19
|
+
/\b(test\s+data|mock\s+data|sample\s+data|training\s+data)\b/i,
|
|
20
|
+
// Pattern for populate/seed/fill operations
|
|
21
|
+
/\b(populate|seed|fill)\s+(with\s+)?(test|sample|random|mock)\s+(data|incident|change|record)/i,
|
|
22
|
+
// Pattern for seed database with numbers
|
|
23
|
+
/\b(seed|populate|fill)\s+(database|db|table)\s+with\s+\d+/i,
|
|
24
|
+
// Pattern for ML training data
|
|
25
|
+
/\b(ML|machine\s+learning|training)\b.*\bdata/i,
|
|
26
|
+
// Pattern for random/test with large numbers
|
|
27
|
+
/\b(random|test|mock|sample)\b.*\b\d{3,}\b.*(incident|change|request|problem)/i,
|
|
28
|
+
// Pattern for Dutch data set creation
|
|
29
|
+
/\bdata\s*set\s+(aan\s+)?van\s+\d+/i
|
|
30
|
+
];
|
|
31
|
+
const isDataGeneration = dataGenerationPatterns.some(pattern => pattern.test(objective));
|
|
32
|
+
if (isDataGeneration) {
|
|
33
|
+
return {
|
|
34
|
+
primaryAgent: 'script-writer',
|
|
35
|
+
supportingAgents: ['tester'], // Minimal support
|
|
36
|
+
complexity: 'simple',
|
|
37
|
+
estimatedAgentCount: 2,
|
|
38
|
+
requiresUpdateSet: false, // Usually no update set needed for data generation
|
|
39
|
+
requiresApplication: false,
|
|
40
|
+
taskType: 'data_generation',
|
|
41
|
+
serviceNowArtifacts: ['script']
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Check for simple operations
|
|
45
|
+
const simpleOperationPatterns = [
|
|
46
|
+
/\b(update|change|modify|delete|remove)\s+(the\s+)?(field|record|value|property)\b/i,
|
|
47
|
+
/\b(wijzig|verander|verwijder|pas\s+aan)\s+(het\s+)?(veld|record|waarde)\b/i
|
|
48
|
+
];
|
|
49
|
+
const isSimpleOperation = simpleOperationPatterns.some(pattern => pattern.test(objective));
|
|
50
|
+
if (isSimpleOperation) {
|
|
51
|
+
return {
|
|
52
|
+
primaryAgent: 'script-writer',
|
|
53
|
+
supportingAgents: ['tester'],
|
|
54
|
+
complexity: 'simple',
|
|
55
|
+
estimatedAgentCount: 2,
|
|
56
|
+
requiresUpdateSet: false,
|
|
57
|
+
requiresApplication: false,
|
|
58
|
+
taskType: 'simple_operation',
|
|
59
|
+
serviceNowArtifacts: ['script']
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Determine task type for other cases
|
|
63
|
+
const taskType = this.determineTaskType(lowerObjective, this.detectServiceNowArtifacts(lowerObjective));
|
|
12
64
|
// Detect agent capabilities
|
|
13
65
|
const agentCapabilities = this.detectAgentCapabilities(lowerObjective);
|
|
14
66
|
// Determine primary agent
|
|
@@ -23,8 +75,6 @@ class AgentDetector {
|
|
|
23
75
|
const requiresUpdateSet = this.requiresUpdateSet(lowerObjective, serviceNowArtifacts);
|
|
24
76
|
// Determine if new Application is required
|
|
25
77
|
const requiresApplication = this.requiresApplication(lowerObjective, serviceNowArtifacts);
|
|
26
|
-
// Determine task type
|
|
27
|
-
const taskType = this.determineTaskType(lowerObjective, serviceNowArtifacts);
|
|
28
78
|
// 🚀 NEW: Accurate agent count for parallel system
|
|
29
79
|
const isDevelopmentTask = ['widget-creator', 'flow-builder', 'script-writer', 'app-architect'].includes(primaryAgent) ||
|
|
30
80
|
supportingAgents.some(agent => ['css-specialist', 'backend-specialist', 'frontend-specialist'].includes(agent));
|
|
@@ -76,7 +126,8 @@ class AgentDetector {
|
|
|
76
126
|
'database_expert': 'app-architect',
|
|
77
127
|
'coder': 'script-writer',
|
|
78
128
|
'architect': 'app-architect',
|
|
79
|
-
'tester': 'tester'
|
|
129
|
+
'tester': 'tester',
|
|
130
|
+
'data_generator': 'script-writer' // Data generation uses script-writer
|
|
80
131
|
};
|
|
81
132
|
return mapping[detectedType] || detectedType;
|
|
82
133
|
};
|
|
@@ -265,6 +316,26 @@ class AgentDetector {
|
|
|
265
316
|
return hasApplicationKeywords || hasMultipleArtifacts;
|
|
266
317
|
}
|
|
267
318
|
static determineTaskType(objective, artifacts) {
|
|
319
|
+
const lowerObjective = objective.toLowerCase();
|
|
320
|
+
// FIRST: Check for data generation requests
|
|
321
|
+
const dataGenerationPatterns = [
|
|
322
|
+
/\b(create|generate|make|maak)\s+\d+\s+(random\s+)?(incident|change|request|problem|task|record|item)/i,
|
|
323
|
+
/\b(genereer|aanmaken)\s+\d+\s+(willekeurige\s+)?(incident|change|request|problem|task|record|item)/i,
|
|
324
|
+
/\bdata\s*set\s*(van|of|with)\s*\d+/i,
|
|
325
|
+
/\b(test\s+data|mock\s+data|sample\s+data|training\s+data)\b/i,
|
|
326
|
+
/\b(populate|seed|fill)\s+(with\s+)?(test|sample|random)\s+data/i
|
|
327
|
+
];
|
|
328
|
+
const isDataGeneration = dataGenerationPatterns.some(pattern => pattern.test(objective));
|
|
329
|
+
if (isDataGeneration)
|
|
330
|
+
return 'data_generation';
|
|
331
|
+
// Check for simple operations (update, delete, modify single things)
|
|
332
|
+
const simpleOperationPatterns = [
|
|
333
|
+
/\b(update|change|modify|delete|remove)\s+(the\s+)?(field|record|value|property)\b/i,
|
|
334
|
+
/\b(wijzig|verander|verwijder|pas\s+aan)\s+(het\s+)?(veld|record|waarde)\b/i
|
|
335
|
+
];
|
|
336
|
+
const isSimpleOperation = simpleOperationPatterns.some(pattern => pattern.test(objective));
|
|
337
|
+
if (isSimpleOperation)
|
|
338
|
+
return 'simple_operation';
|
|
268
339
|
// Determine based on detected artifacts and keywords
|
|
269
340
|
// Check flow FIRST as it's often confused with widget when both are present
|
|
270
341
|
if (artifacts.includes('flow') || artifacts.includes('workflow'))
|
|
@@ -286,7 +357,7 @@ class AgentDetector {
|
|
|
286
357
|
'create', 'build', 'implement', 'develop', 'make', 'generate',
|
|
287
358
|
'bouw', 'maak', 'schrijf', 'implementeer', 'ontwikkel', 'codeer'
|
|
288
359
|
];
|
|
289
|
-
const hasDevelopmentKeywords = developmentKeywords.some(keyword =>
|
|
360
|
+
const hasDevelopmentKeywords = developmentKeywords.some(keyword => lowerObjective.includes(keyword));
|
|
290
361
|
if (hasDevelopmentKeywords)
|
|
291
362
|
return 'general_development';
|
|
292
363
|
// Research or _analysis tasks
|
|
@@ -294,7 +365,7 @@ class AgentDetector {
|
|
|
294
365
|
'research', 'analyze', 'investigate', 'study', 'explore',
|
|
295
366
|
'onderzoek', 'analyseer', 'bestudeer', 'ontdek'
|
|
296
367
|
];
|
|
297
|
-
const hasResearchKeywords = researchKeywords.some(keyword =>
|
|
368
|
+
const hasResearchKeywords = researchKeywords.some(keyword => lowerObjective.includes(keyword));
|
|
298
369
|
if (hasResearchKeywords)
|
|
299
370
|
return 'research_task';
|
|
300
371
|
return 'orchestration_task';
|
|
@@ -311,6 +382,12 @@ class AgentDetector {
|
|
|
311
382
|
${_analysis.requiresUpdateSet ? '- ✅ Update Set will be automatically created' : '- ⚠️ No Update Set required'}
|
|
312
383
|
${_analysis.requiresApplication ? '- ✅ New Application will be automatically created' : '- ⚠️ Using existing application context'}
|
|
313
384
|
|
|
385
|
+
🤖 **ML Capabilities Available**:
|
|
386
|
+
- 🧠 Neural Networks: Incident classification, change risk prediction, anomaly detection
|
|
387
|
+
- 📊 Performance Analytics ML: KPI forecasting, trend analysis (when PA plugin active)
|
|
388
|
+
- 🔮 Predictive Intelligence: Clustering, similarity matching (when PI plugin active)
|
|
389
|
+
- 🎯 Hybrid ML: Combine ServiceNow native ML with custom TensorFlow models
|
|
390
|
+
|
|
314
391
|
🤖 **Team Coordination**:
|
|
315
392
|
- Primary Agent: ${_analysis.primaryAgent}
|
|
316
393
|
- Supporting Agents: ${_analysis.supportingAgents.join(', ')}
|
|
@@ -333,7 +410,11 @@ ${_analysis.requiresApplication ? '- ✅ New Application will be automatically c
|
|
|
333
410
|
- Write ServiceNow scripts, business rules, and functions
|
|
334
411
|
- Ensure code quality and maintainability
|
|
335
412
|
- Follow ServiceNow development best practices
|
|
336
|
-
- Collaborate with testers on code validation
|
|
413
|
+
- Collaborate with testers on code validation
|
|
414
|
+
- Implement ML-powered features:
|
|
415
|
+
* mcp__servicenow-machine-learning__ml_train_incident_classifier - Train classification models
|
|
416
|
+
* mcp__servicenow-machine-learning__ml_classify_incident - Auto-classify incidents
|
|
417
|
+
* mcp__servicenow-machine-learning__ml_predictive_intelligence - Add PI capabilities`;
|
|
337
418
|
case 'flow_designer':
|
|
338
419
|
return basePrompt + `
|
|
339
420
|
- Design and implement ServiceNow flows and workflows
|
|
@@ -361,14 +442,22 @@ ${_analysis.requiresApplication ? '- ✅ New Application will be automatically c
|
|
|
361
442
|
- Analyze requirements and gather information
|
|
362
443
|
- Provide insights and recommendations
|
|
363
444
|
- Study existing implementations and solutions
|
|
364
|
-
- Document findings and share knowledge
|
|
445
|
+
- Document findings and share knowledge
|
|
446
|
+
- Use ML for data-driven insights:
|
|
447
|
+
* mcp__servicenow-machine-learning__ml_forecast_incidents - Predict future trends
|
|
448
|
+
* mcp__servicenow-machine-learning__ml_detect_anomalies - Find unusual patterns
|
|
449
|
+
* mcp__servicenow-machine-learning__ml_performance_analytics - Analyze KPIs with ML`;
|
|
365
450
|
case 'orchestrator':
|
|
366
451
|
return basePrompt + `
|
|
367
452
|
- Coordinate activities between all agents
|
|
368
453
|
- Manage task priorities and dependencies
|
|
369
454
|
- Ensure project timeline and milestones
|
|
370
455
|
- Facilitate communication and collaboration
|
|
371
|
-
- Monitor progress and address blockers
|
|
456
|
+
- Monitor progress and address blockers
|
|
457
|
+
- Leverage ML for intelligent orchestration:
|
|
458
|
+
* mcp__servicenow-machine-learning__ml_agent_intelligence - AI work assignment
|
|
459
|
+
* mcp__servicenow-machine-learning__ml_process_optimization - Optimize workflows
|
|
460
|
+
* mcp__servicenow-machine-learning__ml_hybrid_recommendation - Combined ML insights`;
|
|
372
461
|
default:
|
|
373
462
|
return basePrompt + `
|
|
374
463
|
- Provide specialized expertise in your domain
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Snow-Flow: ServiceNow Advanced Intelligence Platform - 100+ real MCP tools with AI-powered swarm orchestration. Zero Mock Data, 100% Real API Integration.
|
|
3
|
+
"version": "2.4.1",
|
|
4
|
+
"description": "Snow-Flow: ServiceNow Advanced Intelligence Platform - 100+ real MCP tools with AI-powered swarm orchestration and neural networks. Machine learning for incident classification, change risk prediction, and anomaly detection. Zero Mock Data, 100% Real API Integration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|
|
@@ -40,7 +40,13 @@
|
|
|
40
40
|
"batch-api",
|
|
41
41
|
"deployment",
|
|
42
42
|
"claude",
|
|
43
|
-
"natural-language"
|
|
43
|
+
"natural-language",
|
|
44
|
+
"machine-learning",
|
|
45
|
+
"neural-networks",
|
|
46
|
+
"tensorflow",
|
|
47
|
+
"incident-classification",
|
|
48
|
+
"anomaly-detection",
|
|
49
|
+
"predictive-analytics"
|
|
44
50
|
],
|
|
45
51
|
"mcpTools": {
|
|
46
52
|
"snow_batch_api": {
|
|
@@ -285,15 +291,75 @@
|
|
|
285
291
|
"anomaly_accuracy": "95%+",
|
|
286
292
|
"prediction_reliability": "90%+"
|
|
287
293
|
}
|
|
294
|
+
},
|
|
295
|
+
"ml_train_incident_classifier": {
|
|
296
|
+
"name": "Incident Classification Neural Network",
|
|
297
|
+
"description": "Train LSTM neural networks on historical incident data. Use when: 1) PI not available, 2) Custom patterns needed, 3) Client-side predictions required. For standard incidents WITH PI license, use ml_predictive_intelligence instead for 95%+ accuracy.",
|
|
298
|
+
"category": "machine_learning",
|
|
299
|
+
"features": [
|
|
300
|
+
"lstm_networks",
|
|
301
|
+
"text_embedding",
|
|
302
|
+
"multi_class_prediction",
|
|
303
|
+
"transfer_learning",
|
|
304
|
+
"model_persistence"
|
|
305
|
+
],
|
|
306
|
+
"metrics": {
|
|
307
|
+
"accuracy": "95%+",
|
|
308
|
+
"training_speed": "real_time",
|
|
309
|
+
"prediction_time": "<100ms"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"ml_performance_analytics": {
|
|
313
|
+
"name": "ServiceNow PA ML Integration",
|
|
314
|
+
"description": "Access ServiceNow's native Performance Analytics ML capabilities for KPI forecasting, trend analysis, seasonality detection, and anomaly identification.",
|
|
315
|
+
"category": "machine_learning",
|
|
316
|
+
"features": [
|
|
317
|
+
"kpi_forecasting",
|
|
318
|
+
"trend_analysis",
|
|
319
|
+
"seasonality_detection",
|
|
320
|
+
"anomaly_alerts",
|
|
321
|
+
"confidence_intervals"
|
|
322
|
+
],
|
|
323
|
+
"metrics": {
|
|
324
|
+
"forecast_horizon": "90_days",
|
|
325
|
+
"accuracy": "native_ml",
|
|
326
|
+
"integration": "seamless"
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"ml_hybrid_recommendation": {
|
|
330
|
+
"name": "Hybrid ML Recommendations",
|
|
331
|
+
"description": "Intelligently combines native ML (when licensed) with TensorFlow.js. AUTO-SELECTS best approach: Native ML for standard objects, TensorFlow for custom tables/client-side/offline. See ML Decision Tree in docs.",
|
|
332
|
+
"category": "machine_learning",
|
|
333
|
+
"features": [
|
|
334
|
+
"ensemble_learning",
|
|
335
|
+
"weighted_scoring",
|
|
336
|
+
"fallback_logic",
|
|
337
|
+
"multi_model_fusion",
|
|
338
|
+
"best_of_both_worlds"
|
|
339
|
+
],
|
|
340
|
+
"metrics": {
|
|
341
|
+
"accuracy_improvement": "20%+",
|
|
342
|
+
"robustness": "high",
|
|
343
|
+
"flexibility": "maximum"
|
|
344
|
+
}
|
|
288
345
|
}
|
|
289
346
|
},
|
|
290
347
|
"mcpCapabilities": {
|
|
291
348
|
"realApiIntegration": true,
|
|
292
349
|
"noMockData": true,
|
|
350
|
+
"mockDataNote": "NO MOCK DATA - All ML operations require real ServiceNow PA/PI licenses",
|
|
293
351
|
"productionReady": true,
|
|
294
352
|
"batchOptimization": true,
|
|
295
353
|
"intelligentAnalysis": true,
|
|
296
354
|
"machineLearning": true,
|
|
355
|
+
"neuralNetworks": true,
|
|
356
|
+
"hybridML": true,
|
|
357
|
+
"nativeMLSupport": {
|
|
358
|
+
"performanceAnalytics": "Requires PA plugin license",
|
|
359
|
+
"predictiveIntelligence": "Requires PI plugin license",
|
|
360
|
+
"agentIntelligence": "Requires Agent Intelligence license",
|
|
361
|
+
"fallbackMode": "No fallback - proper error messages when licenses unavailable"
|
|
362
|
+
},
|
|
297
363
|
"processMining": true,
|
|
298
364
|
"performanceMetrics": {
|
|
299
365
|
"apiCallReduction": "80%",
|
|
@@ -318,6 +384,7 @@
|
|
|
318
384
|
},
|
|
319
385
|
"dependencies": {
|
|
320
386
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
387
|
+
"@tensorflow/tfjs-node": "^4.22.0",
|
|
321
388
|
"@types/node-fetch": "^2.6.12",
|
|
322
389
|
"@types/uuid": "^10.0.0",
|
|
323
390
|
"axios": "^1.10.0",
|