snow-flow 2.8.8 → 2.9.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.
package/dist/cli.js
CHANGED
|
@@ -417,6 +417,36 @@ async function executeClaudeCode(prompt) {
|
|
|
417
417
|
// Check for MCP config
|
|
418
418
|
const mcpConfigPath = (0, path_1.join)(process.cwd(), '.mcp.json');
|
|
419
419
|
const hasMcpConfig = (0, fs_2.existsSync)(mcpConfigPath);
|
|
420
|
+
// Auto-start MCP servers if they're not running
|
|
421
|
+
if (hasMcpConfig) {
|
|
422
|
+
cliLogger.info('🔧 Checking MCP server status...');
|
|
423
|
+
try {
|
|
424
|
+
const { MCPServerManager } = await Promise.resolve().then(() => __importStar(require('./utils/mcp-server-manager.js')));
|
|
425
|
+
const manager = new MCPServerManager();
|
|
426
|
+
await manager.initialize();
|
|
427
|
+
const systemStatus = manager.getSystemStatus();
|
|
428
|
+
if (systemStatus.running === 0) {
|
|
429
|
+
cliLogger.info('🚀 Starting MCP servers automatically for swarm operation...');
|
|
430
|
+
await manager.startAllServers();
|
|
431
|
+
const newStatus = manager.getSystemStatus();
|
|
432
|
+
cliLogger.info(`✅ Started ${newStatus.running}/${newStatus.total} MCP servers`);
|
|
433
|
+
}
|
|
434
|
+
else if (systemStatus.running < systemStatus.total) {
|
|
435
|
+
cliLogger.info(`⚠️ Only ${systemStatus.running}/${systemStatus.total} MCP servers running`);
|
|
436
|
+
cliLogger.info('🔄 Starting remaining servers...');
|
|
437
|
+
await manager.startAllServers();
|
|
438
|
+
const newStatus = manager.getSystemStatus();
|
|
439
|
+
cliLogger.info(`✅ All ${newStatus.running}/${newStatus.total} MCP servers running`);
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
cliLogger.info(`✅ All ${systemStatus.running} MCP servers already running`);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
cliLogger.warn('⚠️ Could not auto-start MCP servers:', error instanceof Error ? error.message : error);
|
|
447
|
+
cliLogger.info('💡 You may need to run "npm run mcp:start" manually');
|
|
448
|
+
}
|
|
449
|
+
}
|
|
420
450
|
// Launch Claude Code with MCP config and skip permissions to avoid raw mode issues
|
|
421
451
|
const claudeArgs = hasMcpConfig
|
|
422
452
|
? ['--mcp-config', '.mcp.json', '.', '--dangerously-skip-permissions']
|
|
@@ -643,9 +643,15 @@ class ServiceNowDeploymentMCP {
|
|
|
643
643
|
has_preview: true,
|
|
644
644
|
category: args.category || 'custom',
|
|
645
645
|
});
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
646
|
+
// ONLY set success if the operation actually succeeded
|
|
647
|
+
if (result?.success) {
|
|
648
|
+
deploymentMethod = 'direct_api';
|
|
649
|
+
deploymentSuccess = true;
|
|
650
|
+
this.logger.info('✅ Direct deployment successful');
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
throw new Error(`Widget creation failed: ${result?.error || 'Unknown error'}`);
|
|
654
|
+
}
|
|
649
655
|
}
|
|
650
656
|
catch (error) {
|
|
651
657
|
directError = error;
|
|
@@ -706,8 +712,15 @@ class ServiceNowDeploymentMCP {
|
|
|
706
712
|
roles: '',
|
|
707
713
|
servicenow: false
|
|
708
714
|
});
|
|
709
|
-
|
|
710
|
-
|
|
715
|
+
// ONLY set success if the operation actually succeeded
|
|
716
|
+
if (result?.success) {
|
|
717
|
+
deploymentMethod = 'table_record';
|
|
718
|
+
deploymentSuccess = true;
|
|
719
|
+
this.logger.info('✅ Fallback deployment successful');
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
throw new Error(`Table record creation failed: ${result?.error || 'Unknown error'}`);
|
|
723
|
+
}
|
|
711
724
|
// createRecord should already return a ServiceNowAPIResponse structure
|
|
712
725
|
// No need to wrap it again
|
|
713
726
|
}
|
|
@@ -131,7 +131,7 @@ class ServiceNowOperationsMCP {
|
|
|
131
131
|
// 🎯 UNIVERSAL TABLE QUERY - Works for ANY ServiceNow table!
|
|
132
132
|
{
|
|
133
133
|
name: 'snow_query_table',
|
|
134
|
-
description: '🚀 Universal high-performance query tool for ANY ServiceNow table - optimized for memory efficiency',
|
|
134
|
+
description: '🚀 Universal high-performance query tool for ANY ServiceNow table - optimized for memory efficiency. SMART DEFAULTS: 1000 records (5000 for ML training contexts)',
|
|
135
135
|
inputSchema: {
|
|
136
136
|
type: 'object',
|
|
137
137
|
properties: {
|
|
@@ -146,8 +146,8 @@ class ServiceNowOperationsMCP {
|
|
|
146
146
|
},
|
|
147
147
|
limit: {
|
|
148
148
|
type: 'number',
|
|
149
|
-
description: 'Maximum number of results
|
|
150
|
-
default:
|
|
149
|
+
description: '🎯 Maximum number of results. SMART DEFAULTS: 1000 (normal queries), 5000 (ML training contexts). Set higher for large ML datasets (10000+)',
|
|
150
|
+
default: 1000
|
|
151
151
|
},
|
|
152
152
|
include_content: {
|
|
153
153
|
type: 'boolean',
|
|
@@ -828,8 +828,37 @@ class ServiceNowOperationsMCP {
|
|
|
828
828
|
});
|
|
829
829
|
}
|
|
830
830
|
async handleUniversalQuery(args) {
|
|
831
|
-
|
|
832
|
-
|
|
831
|
+
// 🎯 SMART DEFAULT LIMITS - Context-aware for ML training
|
|
832
|
+
const determineSmartLimit = (providedLimit, table, query, includeContent) => {
|
|
833
|
+
if (providedLimit !== undefined)
|
|
834
|
+
return providedLimit; // User explicitly set limit
|
|
835
|
+
// ML Training context detection
|
|
836
|
+
const isMLContext = query?.toLowerCase().includes('train') ||
|
|
837
|
+
query?.toLowerCase().includes('ml') ||
|
|
838
|
+
table?.toLowerCase().includes('train') ||
|
|
839
|
+
(includeContent && table === 'incident'); // ML often needs incident content
|
|
840
|
+
if (isMLContext) {
|
|
841
|
+
logger_js_1.logger.info(`🧠 ML context detected - using ML-optimized limit: 5000`);
|
|
842
|
+
return 5000; // ML training needs more data
|
|
843
|
+
}
|
|
844
|
+
// Count-only queries can handle more records efficiently
|
|
845
|
+
if (!includeContent) {
|
|
846
|
+
return 2000; // Count queries are memory-efficient
|
|
847
|
+
}
|
|
848
|
+
// Normal content queries
|
|
849
|
+
return 1000; // Balanced default for content queries
|
|
850
|
+
};
|
|
851
|
+
const { table, query, include_content = false, fields, include_display_values = false, group_by, order_by } = args;
|
|
852
|
+
// Apply smart limit logic
|
|
853
|
+
const limit = determineSmartLimit(args.limit, table, query, include_content || !!fields);
|
|
854
|
+
// 🚨 ML Training Warning for low limits
|
|
855
|
+
const isMLTrainingContext = query?.toLowerCase().includes('train') ||
|
|
856
|
+
query?.toLowerCase().includes('ml') ||
|
|
857
|
+
args.limit !== undefined && args.limit < 1000;
|
|
858
|
+
if (isMLTrainingContext && limit < 1000) {
|
|
859
|
+
logger_js_1.logger.warn(`⚠️ ML Training detected with low limit (${limit}). Consider setting limit=5000+ for better training data!`);
|
|
860
|
+
}
|
|
861
|
+
logger_js_1.logger.info(`Universal query on table '${table}' with: ${query} (limit: ${limit}, include_content: ${include_content})`);
|
|
833
862
|
try {
|
|
834
863
|
// Convert natural language to ServiceNow query if needed
|
|
835
864
|
const processedQuery = this.processNaturalLanguageQuery(query, table);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
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",
|