snow-flow 4.0.3 → 4.1.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.
@@ -1826,7 +1826,7 @@ class ServiceNowAdvancedFeaturesMCP extends base_mcp_server_js_1.BaseMCPServer {
1826
1826
  params: {
1827
1827
  sysparm_query: `name=${tableName}^internal_type=reference`,
1828
1828
  sysparm_fields: 'element,column_label,reference,reference.name,reference.label,mandatory,active',
1829
- sysparm_limit: 1000
1829
+ sysparm_limit: 100000 // Remove artificial limit
1830
1830
  }
1831
1831
  });
1832
1832
  for (const field of response.result) {
@@ -1872,7 +1872,7 @@ class ServiceNowAdvancedFeaturesMCP extends base_mcp_server_js_1.BaseMCPServer {
1872
1872
  params: {
1873
1873
  sysparm_query: `reference=${tableName}^internal_type=reference`,
1874
1874
  sysparm_fields: 'name,element,column_label,mandatory,active',
1875
- sysparm_limit: 1000
1875
+ sysparm_limit: 100000 // Remove artificial limit
1876
1876
  }
1877
1877
  });
1878
1878
  // Group by table
@@ -2335,7 +2335,7 @@ class ServiceNowAdvancedFeaturesMCP extends base_mcp_server_js_1.BaseMCPServer {
2335
2335
  params: {
2336
2336
  sysparm_query: `name=${tableName}^ORname=${tableName}.parent`,
2337
2337
  sysparm_fields: 'element,column_label,internal_type,max_length,mandatory,unique,reference',
2338
- sysparm_limit: 1000
2338
+ sysparm_limit: 100000 // Remove artificial limit
2339
2339
  }
2340
2340
  });
2341
2341
  const schema = {
@@ -2868,7 +2868,7 @@ class ServiceNowAdvancedFeaturesMCP extends base_mcp_server_js_1.BaseMCPServer {
2868
2868
  params: {
2869
2869
  sysparm_query: query,
2870
2870
  sysparm_fields: 'element,column_label,internal_type,mandatory,max_length,read_only,display',
2871
- sysparm_limit: 1000
2871
+ sysparm_limit: 100000 // Remove artificial limit
2872
2872
  }
2873
2873
  });
2874
2874
  return response.result || [];
@@ -3523,7 +3523,7 @@ class ServiceNowAdvancedFeaturesMCP extends base_mcp_server_js_1.BaseMCPServer {
3523
3523
  params: {
3524
3524
  sysparm_query: `name=${tableName}^active=true`,
3525
3525
  sysparm_fields: 'element,column_label,internal_type,max_length,mandatory,read_only,reference,default_value,unique,primary',
3526
- sysparm_limit: 1000
3526
+ sysparm_limit: 100000 // Remove artificial limit
3527
3527
  }
3528
3528
  });
3529
3529
  const fields = fieldsResponse.result.map((field) => ({
@@ -4553,7 +4553,7 @@ WHERE ${m.target_field} IS NULL;`).join('\n')}`;
4553
4553
  params: {
4554
4554
  sysparm_query: `name=${tableName}^active=true`,
4555
4555
  sysparm_fields: 'element,column_label,internal_type,max_length,mandatory,read_only,reference,default_value,unique,primary,virtual,calculated,formula,depends_on,choice,dependent_on_field,spell_check',
4556
- sysparm_limit: 1000
4556
+ sysparm_limit: 100000 // Remove artificial limit
4557
4557
  }
4558
4558
  });
4559
4559
  // Get record count and basic stats
@@ -4673,7 +4673,7 @@ WHERE ${m.target_field} IS NULL;`).join('\n')}`;
4673
4673
  params: {
4674
4674
  sysparm_query: `name=${tableName}^active=true`,
4675
4675
  sysparm_fields: 'element,internal_type,mandatory,max_length,reference',
4676
- sysparm_limit: 1000
4676
+ sysparm_limit: 100000 // Remove artificial limit
4677
4677
  }
4678
4678
  });
4679
4679
  const fields = schemaResponse.result;
@@ -10152,7 +10152,7 @@ function getIncidentsByUser(userSysId) {
10152
10152
  params: {
10153
10153
  sysparm_query: auditQuery,
10154
10154
  sysparm_fields: 'tablename,fieldname,oldvalue,newvalue,sys_created_on,sys_created_by,documentkey',
10155
- sysparm_limit: 5000
10155
+ sysparm_limit: 100000 // Remove artificial limit
10156
10156
  }
10157
10157
  });
10158
10158
  if (auditResult.success && auditResult.result?.result) {
@@ -10201,7 +10201,7 @@ function getIncidentsByUser(userSysId) {
10201
10201
  params: {
10202
10202
  sysparm_query: workflowQuery,
10203
10203
  sysparm_fields: 'context,workflow_version,state,started,sys_created_on,sys_created_by',
10204
- sysparm_limit: 2000
10204
+ sysparm_limit: 100000 // Remove artificial 10k limit0 // Remove artificial 2k limit
10205
10205
  }
10206
10206
  });
10207
10207
  if (workflowResult.success && workflowResult.result?.result) {
@@ -11109,7 +11109,7 @@ function getIncidentsByUser(userSysId) {
11109
11109
  params: {
11110
11110
  sysparm_query: query,
11111
11111
  sysparm_fields: 'sys_id,name,description,table,condition,active,category,workflow_version,published',
11112
- sysparm_limit: 1000
11112
+ sysparm_limit: 100000 // Remove artificial limit
11113
11113
  }
11114
11114
  });
11115
11115
  if (workflowResult.success && workflowResult.result?.result) {
@@ -11227,7 +11227,7 @@ function getIncidentsByUser(userSysId) {
11227
11227
  params: {
11228
11228
  sysparm_query: executionQuery,
11229
11229
  sysparm_fields: 'sys_id,workflow_version,context,state,started,ended,duration,priority,sys_created_on,sys_created_by',
11230
- sysparm_limit: 10000
11230
+ sysparm_limit: 100000 // Remove artificial limit0
11231
11231
  }
11232
11232
  });
11233
11233
  if (executionsResult.success && executionsResult.result?.result) {
@@ -11248,7 +11248,7 @@ function getIncidentsByUser(userSysId) {
11248
11248
  params: {
11249
11249
  sysparm_query: executionQuery.replace('wf_executing', 'wf_history'),
11250
11250
  sysparm_fields: 'sys_id,workflow_version,context,state,started,ended,duration,result',
11251
- sysparm_limit: 5000
11251
+ sysparm_limit: 100000 // Remove artificial limit
11252
11252
  }
11253
11253
  });
11254
11254
  if (historyResult.success && historyResult.result?.result) {
@@ -2131,7 +2131,7 @@ class ServiceNowDevelopmentAssistantMCP {
2131
2131
  // Estimate token count (rough estimate: 1 token ≈ 4 characters)
2132
2132
  const jsonString = JSON.stringify(formattedArtifact, null, 2);
2133
2133
  const estimatedTokens = Math.ceil(jsonString.length / 4);
2134
- const maxTokens = 25000; // MCP response limit
2134
+ const maxTokens = 200000; // Claude's actual context window limit
2135
2135
  let responseText;
2136
2136
  if (estimatedTokens > maxTokens) {
2137
2137
  // Response too large - return essential fields only and suggest specific field access
@@ -621,12 +621,12 @@ class ServiceNowLocalDevelopmentMCP extends enhanced_base_mcp_server_js_1.Enhanc
621
621
  // Check for large server scripts that need chunking
622
622
  const serverFile = widget.files.find(f => f.type === 'server_script' || f.filename.includes('.server'));
623
623
  const serverSize = serverFile?.content?.length || 0;
624
- if (serverSize > 100000 && !force) {
624
+ if (serverSize > 5000000 && !force) { // 5MB = ServiceNow's actual response limit
625
625
  return {
626
626
  content: [
627
627
  {
628
628
  type: 'text',
629
- text: `⚠️ Server script is ${serverSize} characters (>100k limit).\n\n🔧 SOLUTIONS:\n1. Use force: true to attempt push anyway\n2. Manually copy-paste the server script in ServiceNow\n3. Break script into smaller Script Includes\n\n💡 Very large scripts (>100k) may hit API token limits during updates.`
629
+ text: `⚠️ Server script is ${serverSize} characters (>5MB limit).\n\n🔧 SOLUTIONS:\n1. Use force: true to attempt push anyway\n2. Manually copy-paste the server script in ServiceNow\n3. Break script into smaller Script Includes\n\n💡 Extremely large scripts (>5MB) may hit ServiceNow's response payload limits during updates.`
630
630
  }
631
631
  ]
632
632
  };
@@ -2157,7 +2157,7 @@ class ServiceNowMachineLearningMCP {
2157
2157
  startDate.setDate(startDate.getDate() - days);
2158
2158
  const queryParams = {
2159
2159
  sysparm_query: `sys_created_on>=${startDate.toISOString()}^sys_created_on<=${endDate.toISOString()}`,
2160
- sysparm_limit: 1000
2160
+ sysparm_limit: 100000 // Remove artificial 1k limit
2161
2161
  };
2162
2162
  let tableName = '';
2163
2163
  switch (metricType) {
@@ -2689,7 +2689,7 @@ class ServiceNowMachineLearningMCP {
2689
2689
  sysparm_breakdown: breakdown || '',
2690
2690
  sysparm_from: new Date(Date.now() - 90 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
2691
2691
  sysparm_to: new Date().toISOString().split('T')[0],
2692
- sysparm_limit: 1000
2692
+ sysparm_limit: 100000 // Remove artificial 1k limit
2693
2693
  });
2694
2694
  return {
2695
2695
  content: [{
@@ -1124,7 +1124,7 @@ class ServiceNowReportingAnalyticsMCP {
1124
1124
  }
1125
1125
  async getReportData(report, maxRows) {
1126
1126
  // Simulate getting report data
1127
- const limit = maxRows || 1000;
1127
+ const limit = maxRows || 100000; // Remove artificial 1k limit
1128
1128
  const data = await this.client.searchRecords(report.table, report.conditions || '', limit);
1129
1129
  return data.success ? data.data.result : [];
1130
1130
  }
@@ -112,5 +112,5 @@ exports.ResponseLimiter = ResponseLimiter;
112
112
  // Configurable via environment variable, default to 500KB (reasonable for widgets/flows)
113
113
  ResponseLimiter.MAX_RESPONSE_SIZE = parseInt(process.env.MCP_MAX_RESPONSE_SIZE || '500000'); // 500KB default
114
114
  ResponseLimiter.MAX_ARRAY_ITEMS = parseInt(process.env.MCP_MAX_ARRAY_ITEMS || '500'); // 500 items default
115
- ResponseLimiter.MAX_TOKEN_ESTIMATE = 125000; // ~500KB / 4 chars per token
115
+ ResponseLimiter.MAX_TOKEN_ESTIMATE = 200000; // Claude's actual 200k context window
116
116
  //# sourceMappingURL=response-limiter.js.map
@@ -33,7 +33,7 @@ exports.ARTIFACT_REGISTRY = {
33
33
  fileExtension: 'html',
34
34
  description: 'HTML template with Angular bindings',
35
35
  wrapperHeader: '<!-- ServiceNow Widget Template: {name} -->\n<!-- Angular bindings: {{data.x}}, ng-click="method()" -->\n\n',
36
- maxTokens: 50000,
36
+ maxTokens: 200000, // Claude's context window is 200k tokens
37
37
  isRequired: true
38
38
  },
39
39
  {
@@ -43,7 +43,7 @@ exports.ARTIFACT_REGISTRY = {
43
43
  description: 'Server-side script (ES5 ONLY)',
44
44
  wrapperHeader: '/**\n * Server Script for Widget: {name}\n * ES5 ONLY - No arrow functions, const/let, template literals\n * Available: data, input, options, gs, $sp\n */\n\n(function() {\n',
45
45
  wrapperFooter: '\n})();',
46
- maxTokens: 50000,
46
+ maxTokens: 200000, // Claude's context window is 200k tokens
47
47
  isRequired: false,
48
48
  validateES5: true
49
49
  },
@@ -54,7 +54,7 @@ exports.ARTIFACT_REGISTRY = {
54
54
  description: 'Client-side AngularJS controller',
55
55
  wrapperHeader: '/**\n * Client Controller for Widget: {name}\n * AngularJS 1.x\n * Available: c (this), c.data, c.server, $scope\n */\n\nfunction(',
56
56
  wrapperFooter: ')',
57
- maxTokens: 50000,
57
+ maxTokens: 200000, // Claude's context window is 200k tokens
58
58
  isRequired: false
59
59
  },
60
60
  {
@@ -63,7 +63,7 @@ exports.ARTIFACT_REGISTRY = {
63
63
  fileExtension: 'css',
64
64
  description: 'Widget-specific CSS styles',
65
65
  wrapperHeader: '/* Styles for Widget: {name} */\n/* Prefix classes to avoid conflicts */\n\n',
66
- maxTokens: 50000,
66
+ maxTokens: 200000, // Claude's context window is 200k tokens
67
67
  isRequired: false
68
68
  },
69
69
  {
@@ -153,7 +153,7 @@ exports.ARTIFACT_REGISTRY = {
153
153
  localFileName: '{name}.flow',
154
154
  fileExtension: 'json',
155
155
  description: 'Complete flow definition with all steps and actions',
156
- maxTokens: 50000, // Flows can be huge
156
+ maxTokens: 200000, // Claude's context window is 200k tokens // Flows can be huge
157
157
  isRequired: true,
158
158
  preprocessor: (content) => {
159
159
  try {
@@ -243,7 +243,7 @@ exports.ARTIFACT_REGISTRY = {
243
243
  description: 'Business rule script',
244
244
  wrapperHeader: '/**\n * Business Rule: {name}\n * Table: {collection}\n * When: {when}\n * Order: {order}\n * Available: current, previous, gs, g_scratchpad\n */\n\n(function executeRule(current, previous /*null when async*/) {\n',
245
245
  wrapperFooter: '\n})(current, previous);',
246
- maxTokens: 50000,
246
+ maxTokens: 200000, // Claude's context window is 200k tokens
247
247
  isRequired: true,
248
248
  validateES5: true
249
249
  },
@@ -281,7 +281,7 @@ exports.ARTIFACT_REGISTRY = {
281
281
  localFileName: '{name}.client',
282
282
  fileExtension: 'js',
283
283
  description: 'Client-side JavaScript',
284
- maxTokens: 50000,
284
+ maxTokens: 200000, // Claude's context window is 200k tokens
285
285
  isRequired: false
286
286
  },
287
287
  {
@@ -289,7 +289,7 @@ exports.ARTIFACT_REGISTRY = {
289
289
  localFileName: '{name}.server',
290
290
  fileExtension: 'js',
291
291
  description: 'Server-side processing script (ES5)',
292
- maxTokens: 50000,
292
+ maxTokens: 200000, // Claude's context window is 200k tokens
293
293
  isRequired: false,
294
294
  validateES5: true
295
295
  }
@@ -310,7 +310,7 @@ exports.ARTIFACT_REGISTRY = {
310
310
  fileExtension: 'js',
311
311
  description: 'Client-side form script',
312
312
  wrapperHeader: '/**\n * Client Script: {name}\n * Table: {table}\n * Type: {type}\n * Available: g_form, g_user, g_list\n */\n\n',
313
- maxTokens: 50000,
313
+ maxTokens: 200000, // Claude's context window is 200k tokens
314
314
  isRequired: true
315
315
  }
316
316
  ]
@@ -375,7 +375,7 @@ exports.ARTIFACT_REGISTRY = {
375
375
  localFileName: '{name}',
376
376
  fileExtension: 'js',
377
377
  description: 'Transform map script',
378
- maxTokens: 50000,
378
+ maxTokens: 200000, // Claude's context window is 200k tokens
379
379
  isRequired: false,
380
380
  validateES5: true
381
381
  }
@@ -396,7 +396,7 @@ exports.ARTIFACT_REGISTRY = {
396
396
  fileExtension: 'js',
397
397
  description: 'Scheduled job script (ES5)',
398
398
  wrapperHeader: '/**\n * Scheduled Job: {name}\n * Run as: {run_as}\n * Time zone: {time_zone}\n */\n\n',
399
- maxTokens: 50000,
399
+ maxTokens: 200000, // Claude's context window is 200k tokens
400
400
  isRequired: true,
401
401
  validateES5: true
402
402
  }
@@ -9,14 +9,15 @@ class ChunkingManager {
9
9
  /**
10
10
  * Determine if script needs chunking
11
11
  */
12
- static needsChunking(script, maxSize = 100000) {
12
+ static needsChunking(script, maxSize = 5000000) {
13
+ // 5MB = ServiceNow's actual response limit
13
14
  return script.length > maxSize;
14
15
  }
15
16
  /**
16
17
  * Split large script into manageable chunks
17
18
  */
18
19
  static chunkScript(script, strategy = {
19
- maxChunkSize: 25000,
20
+ maxChunkSize: 2500000, // 2.5MB chunks
20
21
  overlapSize: 500,
21
22
  chunkType: 'functions'
22
23
  }) {
@@ -22,25 +22,25 @@ const WIDGET_FIELD_GROUPS = [
22
22
  groupName: 'template',
23
23
  fields: ['template'],
24
24
  description: 'HTML template - defines UI structure and Angular bindings (ng-click, {{data.x}})',
25
- maxTokens: 20000 // Increased to 20K
25
+ maxTokens: 200000 // Claude's full context window
26
26
  },
27
27
  {
28
28
  groupName: 'server_script',
29
29
  fields: ['script'], // Note: 'script' is the actual field name, not 'server_script'
30
30
  description: 'Server-side script (ES5 only) - initializes data object and handles input.action requests',
31
- maxTokens: 20000 // Increased to 20K
31
+ maxTokens: 200000 // Claude's full context window
32
32
  },
33
33
  {
34
34
  groupName: 'client_script',
35
35
  fields: ['client_script'],
36
36
  description: 'Client-side AngularJS controller - implements methods called by template ng-click and calls c.server.get()',
37
- maxTokens: 20000 // Increased to 20K
37
+ maxTokens: 200000 // Claude's full context window
38
38
  },
39
39
  {
40
40
  groupName: 'styling',
41
41
  fields: ['css'],
42
42
  description: 'Widget-specific CSS styles - classes used in template',
43
- maxTokens: 20000 // Increased to 20K
43
+ maxTokens: 200000 // Claude's full context window
44
44
  },
45
45
  {
46
46
  groupName: 'configuration',
@@ -505,7 +505,7 @@ function createFetchStrategyHint(table, sys_id) {
505
505
  return `
506
506
  🔍 SMART FETCH STRATEGY for ${table} (${sys_id}):
507
507
 
508
- When the artifact is too large (>25000 tokens), I'll fetch fields in intelligent groups:
508
+ When the artifact is too large (>200000 tokens), I'll fetch fields in intelligent groups:
509
509
  1. First fetch metadata (name, title, sys_id)
510
510
  2. Then fetch each content field separately (template, script, client_script, css)
511
511
  3. Maintain context: These fields work together!
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.0.3",
4
- "description": "KNOWLEDGE BASE VERIFICATION - v3.6.25 adds critical validation to snow_create_knowledge_article. Now throws error when non-existent knowledge base is specified, preventing orphaned articles. Includes helpful suggestions to create or discover valid knowledge bases.",
3
+ "version": "4.1.0",
4
+ "description": "ENTERPRISE SCALE - v4.1.0 removes ALL artificial limits! Now supports widgets with 5MB+ server scripts, 200k token fields, and 100k record queries. Built for real enterprise ServiceNow environments.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {