snow-flow 4.1.0 → 4.1.2

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 (44) hide show
  1. package/README.md +15 -40
  2. package/dist/cli.js +0 -81
  3. package/dist/dynamic-version.js +1 -1
  4. package/dist/index.js +3 -1
  5. package/dist/intelligence/performance-recommendations-engine.js +1 -0
  6. package/dist/mcp/advanced/servicenow-advanced-features-mcp.js +12 -12
  7. package/dist/mcp/servicenow-development-assistant-mcp.js +1 -1
  8. package/dist/mcp/servicenow-local-development-mcp.d.ts +0 -3
  9. package/dist/mcp/servicenow-local-development-mcp.js +7 -204
  10. package/dist/mcp/servicenow-machine-learning-mcp.js +2 -2
  11. package/dist/mcp/servicenow-reporting-analytics-mcp.js +1 -1
  12. package/dist/mcp/shared/response-limiter.js +1 -1
  13. package/dist/memory/snow-flow-memory-patterns.d.ts +29 -30
  14. package/dist/memory/snow-flow-memory-patterns.js +26 -37
  15. package/dist/snow-flow-system.js +1 -0
  16. package/dist/testing/integration-test-suite.js +1 -0
  17. package/dist/utils/artifact-local-sync.js +0 -17
  18. package/dist/utils/artifact-sync/artifact-registry.js +11 -11
  19. package/dist/utils/smart-field-fetcher.js +9 -11
  20. package/package.json +2 -2
  21. package/dist/agent/interactive.d.ts +0 -11
  22. package/dist/agent/interactive.js +0 -190
  23. package/dist/agent/session.d.ts +0 -12
  24. package/dist/agent/session.js +0 -106
  25. package/dist/cli/auth.d.ts +0 -3
  26. package/dist/cli/auth.js +0 -59
  27. package/dist/cli/session.d.ts +0 -3
  28. package/dist/cli/session.js +0 -46
  29. package/dist/llm/keys.d.ts +0 -5
  30. package/dist/llm/keys.js +0 -29
  31. package/dist/llm/providers.d.ts +0 -11
  32. package/dist/llm/providers.js +0 -77
  33. package/dist/mcp/bridge.d.ts +0 -10
  34. package/dist/mcp/bridge.js +0 -31
  35. package/dist/mcp/shared/mcp-types.d.ts +0 -37
  36. package/dist/mcp/shared/mcp-types.js +0 -7
  37. package/dist/memory/hierarchical-memory-system.d.ts +0 -32
  38. package/dist/memory/hierarchical-memory-system.js +0 -60
  39. package/dist/memory/memory-system.d.ts +0 -25
  40. package/dist/memory/memory-system.js +0 -36
  41. package/dist/session/store.d.ts +0 -47
  42. package/dist/session/store.js +0 -74
  43. package/dist/utils/chunking-manager.d.ts +0 -39
  44. package/dist/utils/chunking-manager.js +0 -143
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  <div align="center">
2
2
  <img src="assets/snow-flow-logo.svg" alt="Snow-Flow Logo" width="200" height="200">
3
3
 
4
- # ❄️ Snow-Flow v4.0.0 - Final Claude Code CLI Edition ❄️
4
+ # ❄️ Snow-Flow v3.6.25 ❄️
5
5
 
6
6
  <p align="center">
7
7
  <strong>🚀 Revolutionary ServiceNow Development Framework with AI-Powered Automation</strong>
8
8
  </p>
9
9
 
10
10
  <p align="center">
11
- <a href="https://www.npmjs.com/package/snow-flow"><img src="https://img.shields.io/badge/npm-v4.0.0--final--claude-CB3837?style=for-the-badge&logo=npm" alt="npm version"></a>
11
+ <a href="https://www.npmjs.com/package/snow-flow"><img src="https://img.shields.io/npm/v/snow-flow.svg?style=for-the-badge&logo=npm&color=CB3837" alt="npm version"></a>
12
12
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge" alt="License: MIT"></a>
13
13
  <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/snow-flow.svg?style=for-the-badge&logo=node.js&color=339933" alt="Node.js Version"></a>
14
14
  <a href="https://github.com/groeimetai/snow-flow"><img src="https://img.shields.io/github/stars/groeimetai/snow-flow?style=for-the-badge&logo=github" alt="GitHub Stars"></a>
@@ -21,54 +21,29 @@
21
21
 
22
22
  ---
23
23
 
24
- ## 🚨 Important Announcement: Final Claude Code CLI Edition
25
-
26
- <div align="center">
27
- <table>
28
- <tr>
29
- <td align="center">
30
- <h3>⚡ This is the Final Claude Code CLI Version ⚡</h3>
31
- <p>Snow-Flow v4.0.0 marks the end of an era. This is the last version designed specifically for Claude Code CLI.</p>
32
- <p><strong>🔮 What's Coming Next:</strong></p>
33
- <ul align="left">
34
- <li>🤖 Support for <strong>ANY LLM</strong>: OpenAI, Google Gemini, Anthropic Claude, Ollama, and more</li>
35
- <li>🔌 Modular provider system with unified interface</li>
36
- <li>💻 Native CLI with interactive chat interface</li>
37
- <li>🔄 Seamless switching between LLM providers</li>
38
- <li>📊 Same great ServiceNow tools, now LLM-agnostic</li>
39
- </ul>
40
- <p><strong>Thank you to all Claude Code users who made this journey possible! 🙏</strong></p>
41
- </td>
42
- </tr>
43
- </table>
44
- </div>
45
-
46
- ---
47
-
48
- ## 🎉 What's New in v4.0.0-final-claude
24
+ ## 🎉 What's New in v3.6.25
49
25
 
50
26
  <div align="center">
51
27
  <table>
52
28
  <tr>
53
29
  <td align="center" width="50%">
54
- <h3>🏁 Final Release Features</h3>
30
+ <h3>🚀 Major Features</h3>
55
31
  <ul align="left">
56
- <li><strong>🔚 Final Claude Code CLI Version</strong><br/>Last release for Claude Code users</li>
57
- <li><strong>📚 Complete Feature Set</strong><br/>All 18 MCP servers, 200+ tools</li>
58
- <li><strong>🎯 Catalog UI Policy Support</strong><br/>Deploy via unified <code>snow_deploy</code> tool</li>
59
- <li><strong>🔒 Knowledge Base Verification</strong><br/>Prevents orphaned articles</li>
60
- <li><strong>✨ Beautiful Documentation</strong><br/>Enhanced README and website</li>
32
+ <li><strong>Catalog UI Policy Deployment</strong><br/>Deploy via unified <code>snow_deploy</code> tool</li>
33
+ <li><strong>Knowledge Base Verification</strong><br/>Prevents orphaned articles with strict validation</li>
34
+ <li><strong>Catalog Variable Table Fix</strong><br/>Variables now use correct <code>item_option_new</code></li>
35
+ <li><strong>Enhanced UI Policy Debugging</strong><br/>Comprehensive reference field debugging</li>
36
+ <li><strong>18th MCP Server</strong><br/>Local Development Server for artifact syncing</li>
61
37
  </ul>
62
38
  </td>
63
39
  <td align="center" width="50%">
64
- <h3>🚀 Latest Improvements</h3>
40
+ <h3>🔧 Critical Fixes</h3>
65
41
  <ul align="left">
66
- <li>✅ Catalog variables table fix (v3.6.23)</li>
67
- <li>✅ UI policy debugging enhanced (v3.6.22)</li>
68
- <li>✅ Knowledge validation added (v3.6.25)</li>
69
- <li>✅ MCP transport 3x faster</li>
70
- <li>✅ ES5 validation throughout</li>
71
- <li>🎁 All previous fixes included</li>
42
+ <li>✅ Catalog variables now visible in ServiceNow</li>
43
+ <li>✅ UI policy actions reference fields fixed</li>
44
+ <li>✅ Non-existent KB error handling added</li>
45
+ <li>✅ MCP transport 3x faster operations</li>
46
+ <li>✅ Widget coherence validation improved</li>
72
47
  </ul>
73
48
  </td>
74
49
  </tr>
package/dist/cli.js CHANGED
@@ -53,11 +53,6 @@ const agent_detector_js_1 = require("./utils/agent-detector.js");
53
53
  const version_js_1 = require("./version.js");
54
54
  const logger_js_1 = require("./utils/logger.js");
55
55
  const chalk_1 = __importDefault(require("chalk"));
56
- // New provider-agnostic engine imports (compile-safe placeholders)
57
- const llm_config_loader_js_1 = require("./config/llm-config-loader.js");
58
- const interactive_js_1 = require("./agent/interactive.js");
59
- const auth_js_1 = require("./cli/auth.js");
60
- const session_js_1 = require("./cli/session.js");
61
56
  // Load environment variables
62
57
  dotenv_1.default.config();
63
58
  // Create CLI logger instance
@@ -67,10 +62,6 @@ program
67
62
  .name('snow-flow')
68
63
  .description('ServiceNow Multi-Agent Development Framework')
69
64
  .version(version_js_1.VERSION);
70
- // Register auth commands (API key management)
71
- (0, auth_js_1.registerAuthCommands)(program);
72
- // Register session inspection commands
73
- (0, session_js_1.registerSessionCommands)(program);
74
65
  // Flow deprecation handler - check for flow-related commands
75
66
  function checkFlowDeprecation(command, objective) {
76
67
  const flowKeywords = ['flow', 'create-flow', 'xml-flow', 'flow-designer'];
@@ -99,18 +90,6 @@ function checkFlowDeprecation(command, objective) {
99
90
  program
100
91
  .command('swarm <objective>')
101
92
  .description('Execute multi-agent orchestration for a ServiceNow task - één command voor alles!')
102
- // New engine selector: defaults to auto (uses config-driven agent when available)
103
- .option('--engine <engine>', 'Execution engine (auto|agent|claude)', 'auto')
104
- .option('--config <path>', 'Path to snowflow.config file')
105
- .option('--show-reasoning', 'Show LLM reasoning in a different color (default)', true)
106
- .option('--no-show-reasoning', 'Hide LLM reasoning blocks')
107
- .option('--save-output <path>', 'Save full assistant output to a file')
108
- .option('--resume <sessionId>', 'Resume an existing interactive session')
109
- // Provider overrides (optional, config-driven by default)
110
- .option('--provider <provider>', 'LLM provider override')
111
- .option('--model <model>', 'Model override')
112
- .option('--base-url <url>', 'Base URL override for openai-compatible or gateways')
113
- .option('--api-key-env <name>', 'Use specific API key env var')
114
93
  .option('--strategy <strategy>', 'Execution strategy (development, _analysis, research)', 'development')
115
94
  .option('--mode <mode>', 'Coordination mode (hierarchical, mesh, distributed)', 'hierarchical')
116
95
  .option('--max-agents <number>', 'Maximum number of agents', '5')
@@ -287,66 +266,6 @@ program
287
266
  cliLogger.info(`🤖 Autonomous Systems: ❌ All Disabled`);
288
267
  }
289
268
  }
290
- // Detect agent engine via config (provider-agnostic) when requested or available
291
- const shouldUseAgent = (() => {
292
- if (options.engine === 'agent')
293
- return true;
294
- if (options.engine === 'claude')
295
- return false;
296
- // auto: use agent when config file is present and valid
297
- const cfg = (0, llm_config_loader_js_1.loadSnowFlowConfig)({
298
- configPath: options.config,
299
- overrides: {
300
- llm: {
301
- provider: options.provider || undefined,
302
- model: options.model || undefined,
303
- baseURL: options.baseUrl || options.baseURL || undefined,
304
- apiKeyEnv: options.apiKeyEnv || undefined,
305
- },
306
- },
307
- });
308
- return Boolean(cfg && cfg.llm && cfg.llm.provider && cfg.llm.model);
309
- })();
310
- if (shouldUseAgent) {
311
- const cfg = (0, llm_config_loader_js_1.loadSnowFlowConfig)({
312
- configPath: options.config,
313
- overrides: {
314
- llm: {
315
- provider: options.provider || undefined,
316
- model: options.model || undefined,
317
- baseURL: options.baseUrl || options.baseURL || undefined,
318
- apiKeyEnv: options.apiKeyEnv || undefined,
319
- },
320
- },
321
- });
322
- if (!cfg) {
323
- cliLogger.error('❌ Geen snowflow.config.(json|js|cjs) gevonden. Voeg config toe of gebruik --engine claude.');
324
- process.exit(1);
325
- }
326
- // Basic validation for MVP
327
- if (!cfg.llm?.provider || !cfg.llm?.model) {
328
- cliLogger.error('❌ Config mist llm.provider of llm.model');
329
- process.exit(1);
330
- }
331
- cliLogger.info('\n🤖 Using provider-agnostic Snow-Flow agent (interactive)');
332
- try {
333
- await (0, interactive_js_1.runInteractive)({
334
- provider: cfg.llm.provider,
335
- model: String(cfg.llm.model),
336
- baseURL: cfg.llm.baseURL,
337
- apiKeyEnv: cfg.llm.apiKeyEnv,
338
- mcp: cfg.mcp,
339
- system: cfg.agent?.system,
340
- maxSteps: cfg.agent?.maxSteps ?? 40,
341
- showReasoning: options.showReasoning !== false,
342
- resumeId: options.resume || undefined,
343
- });
344
- }
345
- catch (e) {
346
- cliLogger.error('❌ Interactive agent error:', e instanceof Error ? e.message : String(e));
347
- }
348
- return; // end here; skip legacy Claude path
349
- }
350
269
  // Analyze the objective using intelligent agent detection
351
270
  const taskAnalysis = analyzeObjective(objective, parseInt(options.maxAgents));
352
271
  // Debug logging to understand task type detection
@@ -36,7 +36,7 @@ function getDynamicVersion() {
36
36
  console.warn('Warning: Could not read version from package.json:', error);
37
37
  }
38
38
  // Fallback to hardcoded version
39
- return '4.0.0';
39
+ return '4.1.1';
40
40
  }
41
41
  // Export a constant that uses the dynamic version
42
42
  exports.VERSION = getDynamicVersion();
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.SystemHealth = exports.PerformanceTracker = exports.FALLBACK_STRATEGIES = exports.ErrorRecovery = exports.snowFlowConfig = exports.SnowFlowConfig = exports.snowFlowSystem = exports.SnowFlowSystem = exports.ServiceNowLocalDevelopmentMCP = exports.ServiceNowMCPServer = exports.SmartFieldFetcher = exports.ArtifactLocalSync = exports.Logger = exports.ServiceNowClient = exports.ServiceNowOAuth = void 0;
21
+ exports.SystemHealth = exports.PerformanceTracker = exports.FALLBACK_STRATEGIES = exports.ErrorRecovery = exports.MemorySystem = exports.snowFlowConfig = exports.SnowFlowConfig = exports.snowFlowSystem = exports.SnowFlowSystem = exports.ServiceNowLocalDevelopmentMCP = exports.ServiceNowMCPServer = exports.SmartFieldFetcher = exports.ArtifactLocalSync = exports.Logger = exports.ServiceNowClient = exports.ServiceNowOAuth = void 0;
22
22
  // Export main types
23
23
  __exportStar(require("./types/index.js"), exports);
24
24
  // Export utilities
@@ -46,6 +46,8 @@ Object.defineProperty(exports, "snowFlowSystem", { enumerable: true, get: functi
46
46
  var snow_flow_config_js_1 = require("./config/snow-flow-config.js");
47
47
  Object.defineProperty(exports, "SnowFlowConfig", { enumerable: true, get: function () { return snow_flow_config_js_1.SnowFlowConfig; } });
48
48
  Object.defineProperty(exports, "snowFlowConfig", { enumerable: true, get: function () { return snow_flow_config_js_1.snowFlowConfig; } });
49
+ var memory_system_js_1 = require("./memory/memory-system.js");
50
+ Object.defineProperty(exports, "MemorySystem", { enumerable: true, get: function () { return memory_system_js_1.MemorySystem; } });
49
51
  var error_recovery_js_1 = require("./utils/error-recovery.js");
50
52
  Object.defineProperty(exports, "ErrorRecovery", { enumerable: true, get: function () { return error_recovery_js_1.ErrorRecovery; } });
51
53
  Object.defineProperty(exports, "FALLBACK_STRATEGIES", { enumerable: true, get: function () { return error_recovery_js_1.FALLBACK_STRATEGIES; } });
@@ -14,6 +14,7 @@
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.PerformanceRecommendationsEngine = void 0;
16
16
  const logger_js_1 = require("../utils/logger.js");
17
+ const memory_system_js_1 = require("../memory/memory-system.js");
17
18
  class PerformanceRecommendationsEngine {
18
19
  constructor(memory) {
19
20
  this.performancePatterns = new Map();
@@ -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: 100000 // Remove artificial limit
1829
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit
1875
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit
2338
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit
2871
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit
3526
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit
4556
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit
4676
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit
10155
+ sysparm_limit: 5000
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: 100000 // Remove artificial 10k limit0 // Remove artificial 2k limit
10204
+ sysparm_limit: 2000
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: 100000 // Remove artificial limit
11112
+ sysparm_limit: 1000
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: 100000 // Remove artificial limit0
11230
+ sysparm_limit: 10000
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: 100000 // Remove artificial limit
11251
+ sysparm_limit: 5000
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 = 200000; // Claude's actual context window limit
2134
+ const maxTokens = 25000; // MCP response limit
2135
2135
  let responseText;
2136
2136
  if (estimatedTokens > maxTokens) {
2137
2137
  // Response too large - return essential fields only and suggest specific field access
@@ -24,8 +24,5 @@ export declare class ServiceNowLocalDevelopmentMCP extends EnhancedBaseMCPServer
24
24
  private debugWidgetFetch;
25
25
  private pullWidget;
26
26
  private pushWidget;
27
- private pullWidgetEnhanced;
28
- private pushWidgetEnhanced;
29
- private pullWidgetComplete;
30
27
  }
31
28
  //# sourceMappingURL=servicenow-local-development-mcp.d.ts.map
@@ -157,21 +157,16 @@ class ServiceNowLocalDevelopmentMCP extends enhanced_base_mcp_server_js_1.Enhanc
157
157
  required: ['sys_id']
158
158
  }
159
159
  },
160
- // Legacy compatibility tools - ENHANCED
160
+ // Legacy compatibility tools
161
161
  {
162
162
  name: 'snow_pull_widget',
163
- description: 'Pull ServiceNow widget with ALL components (HTML, server script, client script, CSS, options) to local files for full editing capabilities',
163
+ description: 'Pull a ServiceNow widget to local files (legacy - use snow_pull_artifact instead)',
164
164
  inputSchema: {
165
165
  type: 'object',
166
166
  properties: {
167
167
  sys_id: {
168
168
  type: 'string',
169
169
  description: 'Widget sys_id to pull'
170
- },
171
- debug: {
172
- type: 'boolean',
173
- description: 'Enable debug mode to see which fields are retrieved',
174
- default: false
175
170
  }
176
171
  },
177
172
  required: ['sys_id']
@@ -179,32 +174,13 @@ class ServiceNowLocalDevelopmentMCP extends enhanced_base_mcp_server_js_1.Enhanc
179
174
  },
180
175
  {
181
176
  name: 'snow_push_widget',
182
- description: 'Push widget changes back with chunking support for large server scripts (>30k tokens)',
177
+ description: 'Push widget changes back to ServiceNow (legacy - use snow_push_artifact instead)',
183
178
  inputSchema: {
184
179
  type: 'object',
185
180
  properties: {
186
181
  sys_id: {
187
182
  type: 'string',
188
183
  description: 'Widget sys_id to push'
189
- },
190
- force: {
191
- type: 'boolean',
192
- description: 'Force push despite token size warnings',
193
- default: false
194
- }
195
- },
196
- required: ['sys_id']
197
- }
198
- },
199
- {
200
- name: 'snow_pull_widget_complete',
201
- description: 'Enhanced widget puller that guarantees ALL widget fields are retrieved with explicit field fetching',
202
- inputSchema: {
203
- type: 'object',
204
- properties: {
205
- sys_id: {
206
- type: 'string',
207
- description: 'Widget sys_id to pull'
208
184
  }
209
185
  },
210
186
  required: ['sys_id']
@@ -250,15 +226,12 @@ class ServiceNowLocalDevelopmentMCP extends enhanced_base_mcp_server_js_1.Enhanc
250
226
  case 'snow_debug_widget_fetch':
251
227
  result = await this.debugWidgetFetch(args);
252
228
  break;
253
- // Legacy compatibility - ENHANCED
229
+ // Legacy compatibility
254
230
  case 'snow_pull_widget':
255
- result = await this.pullWidgetEnhanced(args);
231
+ result = await this.pullWidget(args);
256
232
  break;
257
233
  case 'snow_push_widget':
258
- result = await this.pushWidgetEnhanced(args);
259
- break;
260
- case 'snow_pull_widget_complete':
261
- result = await this.pullWidgetComplete(args);
234
+ result = await this.pushWidget(args);
262
235
  break;
263
236
  default:
264
237
  throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
@@ -566,183 +539,13 @@ class ServiceNowLocalDevelopmentMCP extends enhanced_base_mcp_server_js_1.Enhanc
566
539
  };
567
540
  }
568
541
  }
569
- // Legacy compatibility methods - ENHANCED
542
+ // Legacy compatibility methods
570
543
  async pullWidget(args) {
571
544
  return this.pullArtifact({ ...args, table: 'sp_widget' });
572
545
  }
573
546
  async pushWidget(args) {
574
547
  return this.pushArtifact(args);
575
548
  }
576
- async pullWidgetEnhanced(args) {
577
- const { sys_id, debug = false } = args;
578
- try {
579
- this.logger.info(`🎯 Enhanced widget pull for ${sys_id} (debug: ${debug})`);
580
- // First try the standard pull
581
- const result = await this.pullArtifact({ sys_id, table: 'sp_widget' });
582
- if (debug) {
583
- // Add debug information about what was retrieved
584
- const artifacts = this.syncManager.listLocalArtifacts();
585
- const widget = artifacts.find(a => a.sys_id === sys_id);
586
- if (widget) {
587
- const debugInfo = `\n\n🔍 DEBUG INFO:\n${widget.files.map(f => ` ✅ ${f.filename} (${f.type}) - ${f.content?.length || 0} chars`).join('\n')}`;
588
- return {
589
- content: [
590
- {
591
- type: 'text',
592
- text: result.content[0].text + debugInfo
593
- }
594
- ]
595
- };
596
- }
597
- }
598
- return result;
599
- }
600
- catch (error) {
601
- this.logger.error('❌ Enhanced widget pull failed, falling back to complete method');
602
- return this.pullWidgetComplete(args);
603
- }
604
- }
605
- async pushWidgetEnhanced(args) {
606
- const { sys_id, force = false } = args;
607
- try {
608
- // Get the local artifact to check sizes
609
- const artifacts = this.syncManager.listLocalArtifacts();
610
- const widget = artifacts.find(a => a.sys_id === sys_id);
611
- if (!widget) {
612
- return {
613
- content: [
614
- {
615
- type: 'text',
616
- text: `❌ No local widget found for ${sys_id}. Use snow_pull_widget first.`
617
- }
618
- ]
619
- };
620
- }
621
- // Check for large server scripts that need chunking
622
- const serverFile = widget.files.find(f => f.type === 'server_script' || f.filename.includes('.server'));
623
- const serverSize = serverFile?.content?.length || 0;
624
- if (serverSize > 5000000 && !force) { // 5MB = ServiceNow's actual response limit
625
- return {
626
- content: [
627
- {
628
- type: 'text',
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
- }
631
- ]
632
- };
633
- }
634
- // Proceed with normal push
635
- return this.pushArtifact({ sys_id, force });
636
- }
637
- catch (error) {
638
- const errorMessage = error instanceof Error ? error.message : String(error);
639
- return {
640
- content: [
641
- {
642
- type: 'text',
643
- text: `❌ Enhanced push failed: ${errorMessage}\n\n💡 For large widgets, you may need to manually update the server script in ServiceNow.`
644
- }
645
- ]
646
- };
647
- }
648
- }
649
- async pullWidgetComplete(args) {
650
- const { sys_id } = args;
651
- try {
652
- this.logger.info(`🚀 Complete widget pull - explicit field fetching for ${sys_id}`);
653
- // Use explicit field querying to guarantee we get all widget components
654
- const widgetQuery = {
655
- table: 'sp_widget',
656
- query: `sys_id=${sys_id}`,
657
- fields: ['sys_id', 'name', 'title', 'template', 'script', 'client_script', 'css', 'option_schema', 'description'],
658
- limit: 1
659
- };
660
- const widgetData = await this.client.queryTable(widgetQuery);
661
- if (!widgetData?.result?.[0]) {
662
- return {
663
- content: [
664
- {
665
- type: 'text',
666
- text: `❌ Widget ${sys_id} not found`
667
- }
668
- ]
669
- };
670
- }
671
- const widget = widgetData.result[0];
672
- const name = widget.name || 'unnamed_widget';
673
- // Create directory structure
674
- const widgetPath = `/tmp/snow-flow-widgets/${name}`;
675
- let createdFiles = [];
676
- let summary = `📦 COMPLETE WIDGET PULL: ${name} (${sys_id})\n\n`;
677
- // Create HTML template
678
- if (widget.template) {
679
- const templatePath = `${widgetPath}/${name}.template.html`;
680
- summary += `✅ Template: ${widget.template.length} chars → ${templatePath}\n`;
681
- createdFiles.push(templatePath);
682
- }
683
- else {
684
- summary += `⚠️ Template: Empty\n`;
685
- }
686
- // Create server script
687
- if (widget.script) {
688
- const serverPath = `${widgetPath}/${name}.server.js`;
689
- summary += `✅ Server Script: ${widget.script.length} chars → ${serverPath}\n`;
690
- createdFiles.push(serverPath);
691
- }
692
- else {
693
- summary += `⚠️ Server Script: Empty\n`;
694
- }
695
- // Create client script
696
- if (widget.client_script) {
697
- const clientPath = `${widgetPath}/${name}.client.js`;
698
- summary += `✅ Client Script: ${widget.client_script.length} chars → ${clientPath}\n`;
699
- createdFiles.push(clientPath);
700
- }
701
- else {
702
- summary += `⚠️ Client Script: Empty\n`;
703
- }
704
- // Create CSS
705
- if (widget.css) {
706
- const cssPath = `${widgetPath}/${name}.css`;
707
- summary += `✅ CSS: ${widget.css.length} chars → ${cssPath}\n`;
708
- createdFiles.push(cssPath);
709
- }
710
- else {
711
- summary += `⚠️ CSS: Empty\n`;
712
- }
713
- // Create options schema
714
- if (widget.option_schema) {
715
- const optionsPath = `${widgetPath}/${name}.options.json`;
716
- summary += `✅ Options: ${widget.option_schema.length} chars → ${optionsPath}\n`;
717
- createdFiles.push(optionsPath);
718
- }
719
- else {
720
- summary += `⚠️ Options: Empty\n`;
721
- }
722
- summary += `\n💡 All widget components retrieved using explicit field fetching.\n`;
723
- summary += `📁 Files created: ${createdFiles.length}\n`;
724
- summary += `🛠️ You can now edit these files with Claude Code's native tools!`;
725
- return {
726
- content: [
727
- {
728
- type: 'text',
729
- text: summary
730
- }
731
- ]
732
- };
733
- }
734
- catch (error) {
735
- const errorMessage = error instanceof Error ? error.message : String(error);
736
- return {
737
- content: [
738
- {
739
- type: 'text',
740
- text: `❌ Complete widget pull failed: ${errorMessage}\n\n💡 Try using snow_debug_widget_fetch to diagnose the issue.`
741
- }
742
- ]
743
- };
744
- }
745
- }
746
549
  }
747
550
  exports.ServiceNowLocalDevelopmentMCP = ServiceNowLocalDevelopmentMCP;
748
551
  // Start the server with timeout protection
@@ -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: 100000 // Remove artificial 1k limit
2160
+ sysparm_limit: 1000
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: 100000 // Remove artificial 1k limit
2692
+ sysparm_limit: 1000
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 || 100000; // Remove artificial 1k limit
1127
+ const limit = maxRows || 1000;
1128
1128
  const data = await this.client.searchRecords(report.table, report.conditions || '', limit);
1129
1129
  return data.success ? data.data.result : [];
1130
1130
  }