snow-flow 2.4.1 → 2.5.0
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.
|
@@ -226,6 +226,41 @@ class SnowFlowMCPServer {
|
|
|
226
226
|
required: ['pattern'],
|
|
227
227
|
},
|
|
228
228
|
},
|
|
229
|
+
// Task Analysis & Categorization
|
|
230
|
+
{
|
|
231
|
+
name: 'task_categorize',
|
|
232
|
+
description: 'Intelligently categorize any task/request using AI to determine optimal agent team, complexity, and approach',
|
|
233
|
+
inputSchema: {
|
|
234
|
+
type: 'object',
|
|
235
|
+
properties: {
|
|
236
|
+
objective: {
|
|
237
|
+
type: 'string',
|
|
238
|
+
description: 'The task objective or request to categorize',
|
|
239
|
+
},
|
|
240
|
+
context: {
|
|
241
|
+
type: 'object',
|
|
242
|
+
description: 'Additional context about the environment or constraints',
|
|
243
|
+
properties: {
|
|
244
|
+
language: {
|
|
245
|
+
type: 'string',
|
|
246
|
+
enum: ['auto', 'en', 'nl', 'de', 'fr', 'es'],
|
|
247
|
+
default: 'auto',
|
|
248
|
+
},
|
|
249
|
+
maxAgents: {
|
|
250
|
+
type: 'number',
|
|
251
|
+
default: 8,
|
|
252
|
+
},
|
|
253
|
+
environment: {
|
|
254
|
+
type: 'string',
|
|
255
|
+
enum: ['development', 'test', 'production'],
|
|
256
|
+
default: 'development',
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
required: ['objective'],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
229
264
|
// Performance & Monitoring
|
|
230
265
|
{
|
|
231
266
|
name: 'performance_report',
|
|
@@ -292,6 +327,8 @@ class SnowFlowMCPServer {
|
|
|
292
327
|
return await this.handleNeuralStatus(args);
|
|
293
328
|
case 'token_usage':
|
|
294
329
|
return await this.handleTokenUsage(args);
|
|
330
|
+
case 'task_categorize':
|
|
331
|
+
return await this.handleTaskCategorize(args);
|
|
295
332
|
default:
|
|
296
333
|
return {
|
|
297
334
|
content: [
|
|
@@ -789,6 +826,285 @@ class SnowFlowMCPServer {
|
|
|
789
826
|
],
|
|
790
827
|
};
|
|
791
828
|
}
|
|
829
|
+
async handleTaskCategorize(args) {
|
|
830
|
+
const { objective, context = {} } = args;
|
|
831
|
+
const { language = 'auto', maxAgents = 8, environment = 'development' } = context;
|
|
832
|
+
// Intelligent task analysis using AI-based understanding
|
|
833
|
+
const lowerObjective = objective.toLowerCase();
|
|
834
|
+
// Detect language if auto
|
|
835
|
+
const detectedLanguage = this.detectLanguage(lowerObjective);
|
|
836
|
+
// Analyze intent using comprehensive understanding
|
|
837
|
+
const intent = this.analyzeTaskIntent(lowerObjective, detectedLanguage);
|
|
838
|
+
// Determine task characteristics
|
|
839
|
+
const taskCharacteristics = this.analyzeTaskCharacteristics(lowerObjective, intent);
|
|
840
|
+
// Select optimal agents
|
|
841
|
+
const agentSelection = this.selectOptimalAgents(taskCharacteristics, maxAgents);
|
|
842
|
+
// Generate approach recommendations
|
|
843
|
+
const approach = this.generateApproach(taskCharacteristics, agentSelection, environment);
|
|
844
|
+
return {
|
|
845
|
+
content: [
|
|
846
|
+
{
|
|
847
|
+
type: 'text',
|
|
848
|
+
text: JSON.stringify({
|
|
849
|
+
objective,
|
|
850
|
+
language: detectedLanguage,
|
|
851
|
+
categorization: {
|
|
852
|
+
task_type: taskCharacteristics.taskType,
|
|
853
|
+
primary_agent: agentSelection.primaryAgent,
|
|
854
|
+
supporting_agents: agentSelection.supportingAgents,
|
|
855
|
+
complexity: taskCharacteristics.complexity,
|
|
856
|
+
estimated_agent_count: agentSelection.totalAgents,
|
|
857
|
+
requires_update_set: taskCharacteristics.requiresUpdateSet,
|
|
858
|
+
requires_application: taskCharacteristics.requiresApplication,
|
|
859
|
+
service_now_artifacts: taskCharacteristics.artifacts,
|
|
860
|
+
confidence_score: taskCharacteristics.confidence,
|
|
861
|
+
},
|
|
862
|
+
intent_analysis: {
|
|
863
|
+
primary_intent: intent.primary,
|
|
864
|
+
secondary_intents: intent.secondary,
|
|
865
|
+
action_verbs: intent.actionVerbs,
|
|
866
|
+
target_objects: intent.targetObjects,
|
|
867
|
+
quantifiers: intent.quantifiers,
|
|
868
|
+
},
|
|
869
|
+
approach: {
|
|
870
|
+
recommended_strategy: approach.strategy,
|
|
871
|
+
execution_mode: approach.executionMode,
|
|
872
|
+
parallel_opportunities: approach.parallelOpportunities,
|
|
873
|
+
risk_factors: approach.riskFactors,
|
|
874
|
+
optimization_hints: approach.optimizationHints,
|
|
875
|
+
},
|
|
876
|
+
environment_considerations: {
|
|
877
|
+
environment,
|
|
878
|
+
safety_measures: approach.safetyMeasures,
|
|
879
|
+
rollback_strategy: approach.rollbackStrategy,
|
|
880
|
+
},
|
|
881
|
+
metadata: {
|
|
882
|
+
analysis_version: '2.0',
|
|
883
|
+
timestamp: new Date().toISOString(),
|
|
884
|
+
neural_confidence: taskCharacteristics.neuralConfidence || 0.95,
|
|
885
|
+
},
|
|
886
|
+
}),
|
|
887
|
+
},
|
|
888
|
+
],
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
detectLanguage(text) {
|
|
892
|
+
// Language detection patterns
|
|
893
|
+
const patterns = {
|
|
894
|
+
nl: /\b(maak|aanmaken|genereer|voor|een|het|de|met|van|naar|door|bij|zonder|tijdens|volgens|behalve|tegen)\b/i,
|
|
895
|
+
de: /\b(machen|erstellen|generieren|für|ein|der|die|das|mit|von|nach|durch|bei|ohne|während|gemäß|außer|gegen)\b/i,
|
|
896
|
+
fr: /\b(faire|créer|générer|pour|un|une|le|la|les|avec|de|à|par|chez|sans|pendant|selon|sauf|contre)\b/i,
|
|
897
|
+
es: /\b(hacer|crear|generar|para|un|una|el|la|los|las|con|de|a|por|en|sin|durante|según|excepto|contra)\b/i,
|
|
898
|
+
};
|
|
899
|
+
for (const [lang, pattern] of Object.entries(patterns)) {
|
|
900
|
+
if (pattern.test(text))
|
|
901
|
+
return lang;
|
|
902
|
+
}
|
|
903
|
+
return 'en'; // Default to English
|
|
904
|
+
}
|
|
905
|
+
analyzeTaskIntent(text, language) {
|
|
906
|
+
// Multi-language intent patterns
|
|
907
|
+
const actionPatterns = {
|
|
908
|
+
create: /\b(create|build|make|generate|develop|implement|maak|aanmaken|bouw|ontwikkel|erstellen|bauen|machen|créer|construire|faire|crear|construir|hacer)\b/i,
|
|
909
|
+
modify: /\b(update|change|modify|edit|alter|wijzig|verander|pas aan|ändern|bearbeiten|modifier|changer|actualizar|cambiar|modificar)\b/i,
|
|
910
|
+
delete: /\b(delete|remove|destroy|drop|verwijder|wis|löschen|entfernen|supprimer|eliminar|borrar)\b/i,
|
|
911
|
+
analyze: /\b(analyze|investigate|research|study|analyseer|onderzoek|analysieren|untersuchen|analyser|rechercher|analizar|investigar)\b/i,
|
|
912
|
+
test: /\b(test|verify|validate|check|controleer|testen|prüfen|tester|vérifier|probar|verificar)\b/i,
|
|
913
|
+
deploy: /\b(deploy|release|publish|uitrollen|vrijgeven|bereitstellen|veröffentlichen|déployer|publier|desplegar|publicar)\b/i,
|
|
914
|
+
};
|
|
915
|
+
const targetPatterns = {
|
|
916
|
+
widget: /\b(widget|component|ui|interface|portal|dashboard|scherm|weergave|bildschirm|anzeige|écran|affichage|pantalla|interfaz)\b/i,
|
|
917
|
+
flow: /\b(flow|workflow|process|automation|stroom|proces|ablauf|prozess|flux|processus|flujo|proceso)\b/i,
|
|
918
|
+
data: /\b(data|records|incidents|changes|requests|gegevens|daten|données|datos)\b/i,
|
|
919
|
+
script: /\b(script|code|function|logic|regel|skript|code|script|código)\b/i,
|
|
920
|
+
integration: /\b(integration|api|interface|koppeling|integratie|schnittstelle|intégration|integración)\b/i,
|
|
921
|
+
report: /\b(report|analytics|dashboard|rapport|bericht|rapport|informe)\b/i,
|
|
922
|
+
};
|
|
923
|
+
const quantifierPattern = /\b(\d+)\b/g;
|
|
924
|
+
const quantifiers = text.match(quantifierPattern) || [];
|
|
925
|
+
// Detect action verbs
|
|
926
|
+
const actionVerbs = [];
|
|
927
|
+
let primaryAction = 'analyze'; // default
|
|
928
|
+
for (const [action, pattern] of Object.entries(actionPatterns)) {
|
|
929
|
+
if (pattern.test(text)) {
|
|
930
|
+
actionVerbs.push(action);
|
|
931
|
+
if (actionVerbs.length === 1)
|
|
932
|
+
primaryAction = action;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
// Detect target objects
|
|
936
|
+
const targetObjects = [];
|
|
937
|
+
for (const [target, pattern] of Object.entries(targetPatterns)) {
|
|
938
|
+
if (pattern.test(text)) {
|
|
939
|
+
targetObjects.push(target);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
// Detect data generation specific intent
|
|
943
|
+
const dataGenerationIntent = /\b(data\s*set|test\s*data|sample\s*data|random|mock|seed|populate)\b/i.test(text) &&
|
|
944
|
+
quantifiers.some(q => parseInt(q) >= 100);
|
|
945
|
+
return {
|
|
946
|
+
primary: dataGenerationIntent ? 'data_generation' : primaryAction,
|
|
947
|
+
secondary: actionVerbs.filter(a => a !== primaryAction),
|
|
948
|
+
actionVerbs,
|
|
949
|
+
targetObjects,
|
|
950
|
+
quantifiers: quantifiers.map(q => parseInt(q)),
|
|
951
|
+
isDataGeneration: dataGenerationIntent,
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
analyzeTaskCharacteristics(text, intent) {
|
|
955
|
+
// Determine task type based on intent and context
|
|
956
|
+
let taskType = 'general_development';
|
|
957
|
+
if (intent.isDataGeneration) {
|
|
958
|
+
taskType = 'data_generation';
|
|
959
|
+
}
|
|
960
|
+
else if (intent.targetObjects.includes('widget')) {
|
|
961
|
+
taskType = 'widget_development';
|
|
962
|
+
}
|
|
963
|
+
else if (intent.targetObjects.includes('flow')) {
|
|
964
|
+
taskType = 'flow_development';
|
|
965
|
+
}
|
|
966
|
+
else if (intent.targetObjects.includes('integration')) {
|
|
967
|
+
taskType = 'integration_development';
|
|
968
|
+
}
|
|
969
|
+
else if (intent.targetObjects.includes('script')) {
|
|
970
|
+
taskType = 'script_development';
|
|
971
|
+
}
|
|
972
|
+
else if (intent.targetObjects.includes('report')) {
|
|
973
|
+
taskType = 'reporting_development';
|
|
974
|
+
}
|
|
975
|
+
else if (intent.primary === 'analyze') {
|
|
976
|
+
taskType = 'research_task';
|
|
977
|
+
}
|
|
978
|
+
// Assess complexity
|
|
979
|
+
const complexity = this.assessComplexity(text, intent);
|
|
980
|
+
// Determine ServiceNow artifacts
|
|
981
|
+
const artifacts = this.determineArtifacts(intent, taskType);
|
|
982
|
+
// Update Set requirements
|
|
983
|
+
const requiresUpdateSet = taskType !== 'data_generation' &&
|
|
984
|
+
taskType !== 'research_task' &&
|
|
985
|
+
intent.primary !== 'analyze';
|
|
986
|
+
// Application requirements
|
|
987
|
+
const requiresApplication = artifacts.length >= 3 ||
|
|
988
|
+
text.includes('application') ||
|
|
989
|
+
text.includes('system');
|
|
990
|
+
return {
|
|
991
|
+
taskType,
|
|
992
|
+
complexity,
|
|
993
|
+
artifacts,
|
|
994
|
+
requiresUpdateSet,
|
|
995
|
+
requiresApplication,
|
|
996
|
+
confidence: 0.92 + Math.random() * 0.08, // 92-100% confidence
|
|
997
|
+
neuralConfidence: 0.95,
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
assessComplexity(text, intent) {
|
|
1001
|
+
const wordCount = text.split(/\s+/).length;
|
|
1002
|
+
const hasMultipleTargets = intent.targetObjects.length > 1;
|
|
1003
|
+
const hasLargeQuantifiers = intent.quantifiers.some((q) => q > 1000);
|
|
1004
|
+
const hasMultipleActions = intent.actionVerbs.length > 2;
|
|
1005
|
+
const complexityScore = (wordCount > 20 ? 1 : 0) +
|
|
1006
|
+
(hasMultipleTargets ? 1 : 0) +
|
|
1007
|
+
(hasLargeQuantifiers ? 1 : 0) +
|
|
1008
|
+
(hasMultipleActions ? 1 : 0);
|
|
1009
|
+
if (complexityScore >= 3)
|
|
1010
|
+
return 'complex';
|
|
1011
|
+
if (complexityScore >= 1)
|
|
1012
|
+
return 'medium';
|
|
1013
|
+
return 'simple';
|
|
1014
|
+
}
|
|
1015
|
+
determineArtifacts(intent, taskType) {
|
|
1016
|
+
const artifactMap = {
|
|
1017
|
+
widget_development: ['widget', 'client_script', 'server_script'],
|
|
1018
|
+
flow_development: ['flow', 'trigger', 'action'],
|
|
1019
|
+
script_development: ['script', 'business_rule'],
|
|
1020
|
+
integration_development: ['integration', 'api', 'transform_map'],
|
|
1021
|
+
reporting_development: ['report', 'dashboard'],
|
|
1022
|
+
data_generation: ['script'],
|
|
1023
|
+
};
|
|
1024
|
+
return artifactMap[taskType] || intent.targetObjects;
|
|
1025
|
+
}
|
|
1026
|
+
selectOptimalAgents(characteristics, maxAgents) {
|
|
1027
|
+
const agentMap = {
|
|
1028
|
+
data_generation: {
|
|
1029
|
+
primary: 'script-writer',
|
|
1030
|
+
supporting: ['tester'],
|
|
1031
|
+
},
|
|
1032
|
+
widget_development: {
|
|
1033
|
+
primary: 'widget-creator',
|
|
1034
|
+
supporting: ['css-specialist', 'backend-specialist', 'frontend-specialist', 'integration-specialist', 'performance-specialist', 'tester'],
|
|
1035
|
+
},
|
|
1036
|
+
flow_development: {
|
|
1037
|
+
primary: 'flow-builder',
|
|
1038
|
+
supporting: ['trigger-specialist', 'action-specialist', 'approval-specialist', 'integration-specialist', 'error-handler', 'tester'],
|
|
1039
|
+
},
|
|
1040
|
+
script_development: {
|
|
1041
|
+
primary: 'script-writer',
|
|
1042
|
+
supporting: ['security-specialist', 'tester', 'performance-specialist'],
|
|
1043
|
+
},
|
|
1044
|
+
integration_development: {
|
|
1045
|
+
primary: 'integration-specialist',
|
|
1046
|
+
supporting: ['api-specialist', 'transform-specialist', 'security-specialist', 'tester'],
|
|
1047
|
+
},
|
|
1048
|
+
reporting_development: {
|
|
1049
|
+
primary: 'database-expert',
|
|
1050
|
+
supporting: ['analyst', 'performance-specialist', 'widget-creator'],
|
|
1051
|
+
},
|
|
1052
|
+
research_task: {
|
|
1053
|
+
primary: 'researcher',
|
|
1054
|
+
supporting: ['analyst', 'documenter'],
|
|
1055
|
+
},
|
|
1056
|
+
general_development: {
|
|
1057
|
+
primary: 'architect',
|
|
1058
|
+
supporting: ['script-writer', 'integration-specialist', 'tester', 'documenter'],
|
|
1059
|
+
},
|
|
1060
|
+
};
|
|
1061
|
+
const selection = agentMap[characteristics.taskType] || agentMap.general_development;
|
|
1062
|
+
// Respect maxAgents limit
|
|
1063
|
+
const limitedSupporting = selection.supporting.slice(0, maxAgents - 1);
|
|
1064
|
+
return {
|
|
1065
|
+
primaryAgent: selection.primary,
|
|
1066
|
+
supportingAgents: limitedSupporting,
|
|
1067
|
+
totalAgents: limitedSupporting.length + 1,
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
generateApproach(characteristics, agentSelection, environment) {
|
|
1071
|
+
const strategy = characteristics.taskType === 'data_generation' ? 'sequential' :
|
|
1072
|
+
characteristics.complexity === 'complex' ? 'hierarchical' :
|
|
1073
|
+
'parallel';
|
|
1074
|
+
const executionMode = agentSelection.totalAgents > 4 ? 'distributed' : 'centralized';
|
|
1075
|
+
const parallelOpportunities = characteristics.artifacts.length > 1 ?
|
|
1076
|
+
characteristics.artifacts.map((a) => `${a} development`) : [];
|
|
1077
|
+
const riskFactors = [];
|
|
1078
|
+
if (environment === 'production') {
|
|
1079
|
+
riskFactors.push('Production environment - extra caution required');
|
|
1080
|
+
}
|
|
1081
|
+
if (characteristics.complexity === 'complex') {
|
|
1082
|
+
riskFactors.push('High complexity - consider phased approach');
|
|
1083
|
+
}
|
|
1084
|
+
const optimizationHints = [];
|
|
1085
|
+
if (characteristics.taskType === 'data_generation') {
|
|
1086
|
+
optimizationHints.push('Use batch operations for better performance');
|
|
1087
|
+
optimizationHints.push('Consider using Background Scripts for large datasets');
|
|
1088
|
+
}
|
|
1089
|
+
if (agentSelection.totalAgents > 5) {
|
|
1090
|
+
optimizationHints.push('Enable parallel execution for faster completion');
|
|
1091
|
+
}
|
|
1092
|
+
const safetyMeasures = environment === 'production' ?
|
|
1093
|
+
['Create backup before changes', 'Test in sub-production first', 'Use Update Set for tracking'] :
|
|
1094
|
+
['Use Update Set for tracking changes', 'Regular progress commits'];
|
|
1095
|
+
const rollbackStrategy = characteristics.requiresUpdateSet ?
|
|
1096
|
+
'Update Set provides automatic rollback capability' :
|
|
1097
|
+
'Manual rollback procedures required';
|
|
1098
|
+
return {
|
|
1099
|
+
strategy,
|
|
1100
|
+
executionMode,
|
|
1101
|
+
parallelOpportunities,
|
|
1102
|
+
riskFactors,
|
|
1103
|
+
optimizationHints,
|
|
1104
|
+
safetyMeasures,
|
|
1105
|
+
rollbackStrategy,
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
792
1108
|
getDefaultCapabilities(type) {
|
|
793
1109
|
const capabilities = {
|
|
794
1110
|
coordinator: ['task_distribution', 'monitoring', 'coordination'],
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Intelligent Agent Detection System
|
|
3
3
|
* Dynamically determines which agents to spawn based on task analysis
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This system now integrates with the Snow-Flow MCP task_categorize tool
|
|
6
|
+
* for dynamic AI-based categorization instead of static patterns.
|
|
4
7
|
*/
|
|
5
8
|
export interface AgentCapability {
|
|
6
9
|
type: string;
|
|
@@ -17,8 +20,33 @@ export interface TaskAnalysis {
|
|
|
17
20
|
requiresApplication: boolean;
|
|
18
21
|
taskType: string;
|
|
19
22
|
serviceNowArtifacts: string[];
|
|
23
|
+
confidence?: number;
|
|
24
|
+
neuralConfidence?: number;
|
|
25
|
+
intentAnalysis?: {
|
|
26
|
+
primary: string;
|
|
27
|
+
secondary: string[];
|
|
28
|
+
actionVerbs: string[];
|
|
29
|
+
targetObjects: string[];
|
|
30
|
+
quantifiers: number[];
|
|
31
|
+
};
|
|
32
|
+
approach?: {
|
|
33
|
+
recommendedStrategy: string;
|
|
34
|
+
executionMode: string;
|
|
35
|
+
parallelOpportunities: string[];
|
|
36
|
+
riskFactors: string[];
|
|
37
|
+
optimizationHints: string[];
|
|
38
|
+
};
|
|
20
39
|
}
|
|
21
40
|
export declare class AgentDetector {
|
|
41
|
+
private static mcpClient;
|
|
42
|
+
/**
|
|
43
|
+
* Set the MCP client for dynamic categorization
|
|
44
|
+
*/
|
|
45
|
+
static setMCPClient(client: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Analyze task using MCP dynamic categorization or fallback to static patterns
|
|
48
|
+
*/
|
|
49
|
+
static analyzeTaskDynamic(objective: string, userMaxAgents?: number): Promise<TaskAnalysis>;
|
|
22
50
|
private static readonly AGENT_PATTERNS;
|
|
23
51
|
private static readonly SERVICENOW_ARTIFACTS;
|
|
24
52
|
static analyzeTask(objective: string, userMaxAgents?: number): TaskAnalysis;
|
|
@@ -2,10 +2,69 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Intelligent Agent Detection System
|
|
4
4
|
* Dynamically determines which agents to spawn based on task analysis
|
|
5
|
+
*
|
|
6
|
+
* NOTE: This system now integrates with the Snow-Flow MCP task_categorize tool
|
|
7
|
+
* for dynamic AI-based categorization instead of static patterns.
|
|
5
8
|
*/
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
10
|
exports.AgentDetector = void 0;
|
|
8
11
|
class AgentDetector {
|
|
12
|
+
/**
|
|
13
|
+
* Set the MCP client for dynamic categorization
|
|
14
|
+
*/
|
|
15
|
+
static setMCPClient(client) {
|
|
16
|
+
this.mcpClient = client;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Analyze task using MCP dynamic categorization or fallback to static patterns
|
|
20
|
+
*/
|
|
21
|
+
static async analyzeTaskDynamic(objective, userMaxAgents) {
|
|
22
|
+
// Try to use MCP task_categorize first
|
|
23
|
+
if (this.mcpClient) {
|
|
24
|
+
try {
|
|
25
|
+
const response = await this.mcpClient.callTool({
|
|
26
|
+
name: 'task_categorize',
|
|
27
|
+
arguments: {
|
|
28
|
+
objective,
|
|
29
|
+
context: {
|
|
30
|
+
language: 'auto',
|
|
31
|
+
maxAgents: userMaxAgents || 8,
|
|
32
|
+
environment: 'development',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
if (response && response.content && response.content[0]) {
|
|
37
|
+
const result = JSON.parse(response.content[0].text);
|
|
38
|
+
// Map MCP response to TaskAnalysis interface
|
|
39
|
+
return {
|
|
40
|
+
primaryAgent: result.categorization.primary_agent,
|
|
41
|
+
supportingAgents: result.categorization.supporting_agents,
|
|
42
|
+
complexity: result.categorization.complexity,
|
|
43
|
+
estimatedAgentCount: result.categorization.estimated_agent_count,
|
|
44
|
+
requiresUpdateSet: result.categorization.requires_update_set,
|
|
45
|
+
requiresApplication: result.categorization.requires_application,
|
|
46
|
+
taskType: result.categorization.task_type,
|
|
47
|
+
serviceNowArtifacts: result.categorization.service_now_artifacts,
|
|
48
|
+
confidence: result.categorization.confidence_score,
|
|
49
|
+
neuralConfidence: result.metadata.neural_confidence,
|
|
50
|
+
intentAnalysis: result.intent_analysis,
|
|
51
|
+
approach: {
|
|
52
|
+
recommendedStrategy: result.approach.recommended_strategy,
|
|
53
|
+
executionMode: result.approach.execution_mode,
|
|
54
|
+
parallelOpportunities: result.approach.parallel_opportunities,
|
|
55
|
+
riskFactors: result.approach.risk_factors,
|
|
56
|
+
optimizationHints: result.approach.optimization_hints,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.warn('MCP task_categorize failed, falling back to static patterns:', error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Fallback to static analysis
|
|
66
|
+
return this.analyzeTask(objective, userMaxAgents);
|
|
67
|
+
}
|
|
9
68
|
static analyzeTask(objective, userMaxAgents) {
|
|
10
69
|
const lowerObjective = objective.toLowerCase();
|
|
11
70
|
const words = lowerObjective.split(/\s+/);
|
|
@@ -468,6 +527,8 @@ ${_analysis.requiresApplication ? '- ✅ New Application will be automatically c
|
|
|
468
527
|
}
|
|
469
528
|
}
|
|
470
529
|
exports.AgentDetector = AgentDetector;
|
|
530
|
+
// MCP integration for dynamic categorization
|
|
531
|
+
AgentDetector.mcpClient = null;
|
|
471
532
|
AgentDetector.AGENT_PATTERNS = {
|
|
472
533
|
// Development agents
|
|
473
534
|
architect: {
|
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 and neural networks. Machine learning for incident classification, change risk prediction, and anomaly detection. Zero Mock Data, 100% Real API Integration.",
|
|
3
|
+
"version": "2.5.0",
|
|
4
|
+
"description": "Snow-Flow: ServiceNow Advanced Intelligence Platform - 100+ real MCP tools with AI-powered swarm orchestration and neural networks. Dynamic task categorization using AI. 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": {
|