snow-flow 4.1.2 → 4.2.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.
Files changed (92) hide show
  1. package/README.md +186 -555
  2. package/cloudbuild-npm.yaml +132 -0
  3. package/cloudbuild-website.yaml +92 -0
  4. package/cloudbuild.yaml +141 -0
  5. package/dist/agent/interactive.d.ts +11 -0
  6. package/dist/agent/interactive.js +190 -0
  7. package/dist/agent/session.d.ts +12 -0
  8. package/dist/agent/session.js +106 -0
  9. package/dist/cli/auth.d.ts +3 -0
  10. package/dist/cli/auth.js +59 -0
  11. package/dist/cli/session.d.ts +3 -0
  12. package/dist/cli/session.js +46 -0
  13. package/dist/cli.js +81 -0
  14. package/dist/config/llm-config-loader.d.ts +45 -0
  15. package/dist/config/llm-config-loader.js +49 -0
  16. package/dist/index.js +1 -3
  17. package/dist/intelligence/performance-recommendations-engine.js +0 -1
  18. package/dist/llm/keys.d.ts +5 -0
  19. package/dist/llm/keys.js +29 -0
  20. package/dist/llm/providers.d.ts +11 -0
  21. package/dist/llm/providers.js +77 -0
  22. package/dist/mcp/advanced/servicenow-advanced-features-mcp.js +12 -12
  23. package/dist/mcp/bridge.d.ts +10 -0
  24. package/dist/mcp/bridge.js +31 -0
  25. package/dist/mcp/servicenow-development-assistant-mcp.js +1 -1
  26. package/dist/mcp/servicenow-itam-mcp.d.ts +29 -0
  27. package/dist/mcp/servicenow-itam-mcp.js +537 -0
  28. package/dist/mcp/servicenow-local-development-mcp.d.ts +0 -2
  29. package/dist/mcp/servicenow-local-development-mcp.js +0 -43
  30. package/dist/mcp/servicenow-machine-learning-mcp.js +2 -2
  31. package/dist/mcp/servicenow-notifications-mcp.d.ts +24 -0
  32. package/dist/mcp/servicenow-notifications-mcp.js +327 -0
  33. package/dist/mcp/servicenow-reporting-analytics-mcp.js +1 -1
  34. package/dist/mcp/servicenow-secops-mcp.d.ts +28 -0
  35. package/dist/mcp/servicenow-secops-mcp.js +560 -0
  36. package/dist/mcp/shared/mcp-types.d.ts +37 -0
  37. package/dist/mcp/shared/mcp-types.js +7 -0
  38. package/dist/mcp/shared/response-limiter.js +1 -1
  39. package/dist/memory/hierarchical-memory-system.d.ts +42 -0
  40. package/dist/memory/hierarchical-memory-system.js +60 -0
  41. package/dist/memory/memory-system.d.ts +34 -0
  42. package/dist/memory/memory-system.js +36 -0
  43. package/dist/memory/snow-flow-memory-patterns.d.ts +47 -28
  44. package/dist/memory/snow-flow-memory-patterns.js +46 -25
  45. package/dist/session/store.d.ts +47 -0
  46. package/dist/session/store.js +74 -0
  47. package/dist/snow-flow-system.js +0 -1
  48. package/dist/testing/integration-test-suite.js +0 -1
  49. package/dist/utils/artifact-local-sync.js +17 -0
  50. package/dist/utils/artifact-sync/artifact-registry.js +11 -11
  51. package/dist/utils/chunking-manager.d.ts +39 -0
  52. package/dist/utils/chunking-manager.js +143 -0
  53. package/dist/utils/memory-pool.d.ts +56 -0
  54. package/dist/utils/memory-pool.js +103 -0
  55. package/dist/utils/smart-field-fetcher.js +11 -9
  56. package/package.json +3 -3
  57. package/website/Dockerfile +3 -2
  58. package/website/cloudbuild.yaml +4 -3
  59. package/website/complete-mcp-reference.html +1040 -0
  60. package/website/components/hero/Hero.html +9 -9
  61. package/website/components/hero/Hero.jsx +3 -3
  62. package/website/css/button-contrast-fixes.css +133 -0
  63. package/website/css/button-fixes.css +49 -0
  64. package/website/css/enterprise-section-update.css +38 -0
  65. package/website/css/font-standardization.css +54 -0
  66. package/website/css/footer-hero-styling.css +73 -0
  67. package/website/css/hero-compact-spacing.css +60 -0
  68. package/website/css/hero-contrast-fixes.css +195 -0
  69. package/website/css/hero-inspired-design.css +135 -0
  70. package/website/css/hero-size-optimization.css +146 -0
  71. package/website/css/hero-spacing-improvements.css +139 -0
  72. package/website/css/hero-stats-visibility.css +98 -0
  73. package/website/css/mobile-hero-fix.css +215 -0
  74. package/website/css/navbar-hero-styling.css +70 -0
  75. package/website/css/reference-text-contrast.css +101 -0
  76. package/website/css/scroll-overlap-nuclear-fix.css +127 -0
  77. package/website/css/section-layering-fix.css +85 -0
  78. package/website/css/style.css +37 -10
  79. package/website/css/title-layout-fix.css +58 -0
  80. package/website/css/ultimate-overlap-fix.css +101 -0
  81. package/website/css/website-hero-consistency.css +101 -0
  82. package/website/enterprise-features.html +147 -0
  83. package/website/index.html +264 -39
  84. package/website/js/animations.js +20 -23
  85. package/website/js/main.js +73 -7
  86. package/website/mcp-reference-link.html +16 -0
  87. package/website/mcp-servers.html +2 -2
  88. package/website/tools.js +125 -6
  89. package/website/what-is-snow-flow-section.html +144 -0
  90. package/assets/logo.txt +0 -8
  91. package/assets/snow-flow-logo.svg +0 -51
  92. package/src/cli.ts.backup-20250809-125529 +0 -4773
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ /**
3
+ * Chunking Manager for Large ServiceNow Artifacts
4
+ * Handles scripts >30k characters that exceed API token limits
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ChunkingManager = void 0;
8
+ class ChunkingManager {
9
+ /**
10
+ * Determine if script needs chunking
11
+ */
12
+ static needsChunking(script, maxSize = 5000000) {
13
+ // 5MB = ServiceNow's actual response limit
14
+ return script.length > maxSize;
15
+ }
16
+ /**
17
+ * Split large script into manageable chunks
18
+ */
19
+ static chunkScript(script, strategy = {
20
+ maxChunkSize: 2500000, // 2.5MB chunks
21
+ overlapSize: 500,
22
+ chunkType: 'functions'
23
+ }) {
24
+ const lines = script.split('\n');
25
+ const chunks = [];
26
+ if (!this.needsChunking(script)) {
27
+ return [{
28
+ index: 0,
29
+ content: script,
30
+ startLine: 1,
31
+ endLine: lines.length,
32
+ type: 'complete',
33
+ hasContext: true
34
+ }];
35
+ }
36
+ let currentChunk = '';
37
+ let currentStartLine = 1;
38
+ let chunkIndex = 0;
39
+ for (let i = 0; i < lines.length; i++) {
40
+ const line = lines[i];
41
+ const potentialChunk = currentChunk + line + '\n';
42
+ if (potentialChunk.length > strategy.maxChunkSize) {
43
+ // Current chunk is full, save it
44
+ if (currentChunk.trim()) {
45
+ chunks.push({
46
+ index: chunkIndex++,
47
+ content: currentChunk.trim(),
48
+ startLine: currentStartLine,
49
+ endLine: i,
50
+ type: chunkIndex === 0 ? 'partial_start' : 'partial_middle',
51
+ hasContext: true
52
+ });
53
+ }
54
+ // Start new chunk with overlap
55
+ const overlapLines = Math.min(Math.floor(strategy.overlapSize / 50), // Assume ~50 chars per line
56
+ 10 // Max 10 lines overlap
57
+ );
58
+ const overlapStart = Math.max(0, i - overlapLines);
59
+ currentChunk = lines.slice(overlapStart, i + 1).join('\n') + '\n';
60
+ currentStartLine = overlapStart + 1;
61
+ }
62
+ else {
63
+ currentChunk += line + '\n';
64
+ }
65
+ }
66
+ // Add final chunk
67
+ if (currentChunk.trim()) {
68
+ chunks.push({
69
+ index: chunkIndex,
70
+ content: currentChunk.trim(),
71
+ startLine: currentStartLine,
72
+ endLine: lines.length,
73
+ type: 'partial_end',
74
+ hasContext: true
75
+ });
76
+ }
77
+ return chunks;
78
+ }
79
+ /**
80
+ * Generate instructions for manual large script handling
81
+ */
82
+ static generateManualInstructions(scriptName, scriptSize, chunks) {
83
+ return `
84
+ 🚨 LARGE SCRIPT DETECTED: ${scriptName} (${scriptSize.toLocaleString()} characters)
85
+
86
+ ⚠️ This script exceeds API token limits and cannot be updated automatically.
87
+
88
+ 🔧 MANUAL UPDATE REQUIRED:
89
+
90
+ 1. **Navigate to ServiceNow**:
91
+ - Go to Service Portal → Widgets
92
+ - Find and edit your widget
93
+ - Click on "Server Script" tab
94
+
95
+ 2. **Copy the updated script**:
96
+ - Script has been split into ${chunks.length} chunks below
97
+ - Copy ALL chunks in order and paste into ServiceNow
98
+
99
+ 3. **Chunks to copy**:
100
+ ${chunks.map(chunk => `
101
+ **Chunk ${chunk.index + 1}/${chunks.length}** (Lines ${chunk.startLine}-${chunk.endLine}):
102
+ \`\`\`javascript
103
+ ${chunk.content.substring(0, 500)}${chunk.content.length > 500 ? '...\n[truncated for display]' : ''}
104
+ \`\`\`
105
+ `).join('')}
106
+
107
+ 4. **Validation**:
108
+ - Ensure no syntax errors after pasting
109
+ - Test widget functionality
110
+ - Consider breaking into smaller Script Includes
111
+
112
+ 💡 **Prevention for future**:
113
+ - Keep server scripts under 30,000 characters
114
+ - Use Script Includes for reusable functions
115
+ - Move complex logic to business rules where appropriate
116
+ `;
117
+ }
118
+ /**
119
+ * Attempt smart chunked update for large scripts
120
+ */
121
+ static async attemptChunkedUpdate(client, table, sys_id, field, script) {
122
+ if (!this.needsChunking(script)) {
123
+ // Not chunked, do normal update
124
+ try {
125
+ await client.updateRecord(table, sys_id, { [field]: script });
126
+ return { success: true, message: 'Script updated successfully' };
127
+ }
128
+ catch (error) {
129
+ return { success: false, message: `Update failed: ${error}` };
130
+ }
131
+ }
132
+ // For large scripts, we can't actually chunk the API call
133
+ // But we can provide intelligent guidance
134
+ const chunks = this.chunkScript(script);
135
+ const instructions = this.generateManualInstructions(field, script.length, chunks);
136
+ return {
137
+ success: false,
138
+ message: `Script too large for automatic update. Manual steps required:\n${instructions}`
139
+ };
140
+ }
141
+ }
142
+ exports.ChunkingManager = ChunkingManager;
143
+ //# sourceMappingURL=chunking-manager.js.map
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Memory Pool Manager
3
+ * Optimizes Map/Set allocations and reuses objects for better memory efficiency
4
+ */
5
+ export declare class MemoryPoolManager {
6
+ private static mapPool;
7
+ private static setPool;
8
+ private static objectPool;
9
+ private static readonly MAX_POOL_SIZE;
10
+ /**
11
+ * Get a reusable Map instance
12
+ */
13
+ static getMap<K, V>(): Map<K, V>;
14
+ /**
15
+ * Return a Map to the pool for reuse
16
+ */
17
+ static releaseMap(map: Map<any, any>): void;
18
+ /**
19
+ * Get a reusable Set instance
20
+ */
21
+ static getSet<T>(): Set<T>;
22
+ /**
23
+ * Return a Set to the pool for reuse
24
+ */
25
+ static releaseSet(set: Set<any>): void;
26
+ /**
27
+ * Get a reusable object
28
+ */
29
+ static getObject(): any;
30
+ /**
31
+ * Return an object to the pool
32
+ */
33
+ static releaseObject(obj: any): void;
34
+ /**
35
+ * Get pool statistics for monitoring
36
+ */
37
+ static getStats(): {
38
+ maps: {
39
+ available: number;
40
+ maxSize: number;
41
+ };
42
+ sets: {
43
+ available: number;
44
+ maxSize: number;
45
+ };
46
+ objects: {
47
+ available: number;
48
+ maxSize: number;
49
+ };
50
+ };
51
+ /**
52
+ * Clear all pools (for testing/cleanup)
53
+ */
54
+ static clearPools(): void;
55
+ }
56
+ //# sourceMappingURL=memory-pool.d.ts.map
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ /**
3
+ * Memory Pool Manager
4
+ * Optimizes Map/Set allocations and reuses objects for better memory efficiency
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MemoryPoolManager = void 0;
8
+ class MemoryPoolManager {
9
+ /**
10
+ * Get a reusable Map instance
11
+ */
12
+ static getMap() {
13
+ if (this.mapPool.length > 0) {
14
+ const map = this.mapPool.pop();
15
+ map.clear(); // Ensure it's clean
16
+ return map;
17
+ }
18
+ return new Map();
19
+ }
20
+ /**
21
+ * Return a Map to the pool for reuse
22
+ */
23
+ static releaseMap(map) {
24
+ if (this.mapPool.length < this.MAX_POOL_SIZE) {
25
+ map.clear();
26
+ this.mapPool.push(map);
27
+ }
28
+ }
29
+ /**
30
+ * Get a reusable Set instance
31
+ */
32
+ static getSet() {
33
+ if (this.setPool.length > 0) {
34
+ const set = this.setPool.pop();
35
+ set.clear(); // Ensure it's clean
36
+ return set;
37
+ }
38
+ return new Set();
39
+ }
40
+ /**
41
+ * Return a Set to the pool for reuse
42
+ */
43
+ static releaseSet(set) {
44
+ if (this.setPool.length < this.MAX_POOL_SIZE) {
45
+ set.clear();
46
+ this.setPool.push(set);
47
+ }
48
+ }
49
+ /**
50
+ * Get a reusable object
51
+ */
52
+ static getObject() {
53
+ if (this.objectPool.length > 0) {
54
+ return this.objectPool.pop();
55
+ }
56
+ return {};
57
+ }
58
+ /**
59
+ * Return an object to the pool
60
+ */
61
+ static releaseObject(obj) {
62
+ if (this.objectPool.length < this.MAX_POOL_SIZE) {
63
+ // Clear all properties
64
+ for (const key in obj) {
65
+ delete obj[key];
66
+ }
67
+ this.objectPool.push(obj);
68
+ }
69
+ }
70
+ /**
71
+ * Get pool statistics for monitoring
72
+ */
73
+ static getStats() {
74
+ return {
75
+ maps: {
76
+ available: this.mapPool.length,
77
+ maxSize: this.MAX_POOL_SIZE
78
+ },
79
+ sets: {
80
+ available: this.setPool.length,
81
+ maxSize: this.MAX_POOL_SIZE
82
+ },
83
+ objects: {
84
+ available: this.objectPool.length,
85
+ maxSize: this.MAX_POOL_SIZE
86
+ }
87
+ };
88
+ }
89
+ /**
90
+ * Clear all pools (for testing/cleanup)
91
+ */
92
+ static clearPools() {
93
+ this.mapPool.length = 0;
94
+ this.setPool.length = 0;
95
+ this.objectPool.length = 0;
96
+ }
97
+ }
98
+ exports.MemoryPoolManager = MemoryPoolManager;
99
+ MemoryPoolManager.mapPool = [];
100
+ MemoryPoolManager.setPool = [];
101
+ MemoryPoolManager.objectPool = [];
102
+ MemoryPoolManager.MAX_POOL_SIZE = 50;
103
+ //# sourceMappingURL=memory-pool.js.map
@@ -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',
@@ -130,8 +130,8 @@ class SmartFieldFetcher {
130
130
  description: group.description,
131
131
  fields: group.fields
132
132
  };
133
- // Add to flat structure for easy access
134
- Object.assign(results, response.result[0]);
133
+ // FIX: getRecord returns direct object, not response.result[0]
134
+ Object.assign(results, response);
135
135
  }
136
136
  }
137
137
  catch (error) {
@@ -232,8 +232,9 @@ class SmartFieldFetcher {
232
232
  // Try using getRecord instead of searchRecords with short timeout
233
233
  const directResponse = await (0, mcp_timeout_config_js_1.withMCPTimeout)(this.client.getRecord('sp_widget', sys_id), 5000, // 5 second timeout for direct fetch
234
234
  `Direct widget fetch ${sys_id}`);
235
- if (directResponse && directResponse.success && directResponse.data && directResponse.data.result) {
236
- const directData = directResponse.data.result;
235
+ if (directResponse) {
236
+ // FIX: getRecord returns direct object, not nested structure
237
+ const directData = directResponse;
237
238
  // Merge any new data we got
238
239
  Object.assign(results, directData);
239
240
  console.log(`📊 Direct API retrieved:`);
@@ -292,6 +293,7 @@ class SmartFieldFetcher {
292
293
  console.log(` 📄 Fetching field: ${field}`);
293
294
  const response = await this.client.getRecord(table, sys_id);
294
295
  if (response) {
296
+ // FIX: getRecord returns direct object
295
297
  result.data[field] = response[field];
296
298
  result._field_status[field] = 'success';
297
299
  }
@@ -503,7 +505,7 @@ function createFetchStrategyHint(table, sys_id) {
503
505
  return `
504
506
  🔍 SMART FETCH STRATEGY for ${table} (${sys_id}):
505
507
 
506
- 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:
507
509
  1. First fetch metadata (name, title, sys_id)
508
510
  2. Then fetch each content field separately (template, script, client_script, css)
509
511
  3. Maintain context: These fields work together!
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.1.2",
4
- "description": "ENTERPRISE SCALE - v4.1.0 removes ALL artificial limits! Built on stable v3.6.25 with enterprise-grade support for massive widgets (5MB+ scripts), 200k token fields, and 100k record queries.",
3
+ "version": "4.2.1",
4
+ "description": "ENTERPRISE OPTIMIZED - v4.2.1 perfect mobile experience + complete website redesign. Beautiful hero, mobile-optimized, comprehensive MCP reference, and 355+ tools. Professional enterprise presentation.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {
8
8
  "snow-flow": "bin/snow-flow"
9
9
  },
10
10
  "scripts": {
11
- "build": "tsc || true",
11
+ "build": "tsc --noEmitOnError false || true",
12
12
  "dev": "tsc --watch",
13
13
  "start": "node dist/index.js",
14
14
  "test": "jest",
@@ -29,8 +29,9 @@ EXPOSE 80
29
29
 
30
30
  # Add metadata
31
31
  LABEL maintainer="Snow-Flow Team" \
32
- description="Snow-Flow Documentation Website" \
33
- version="3.4.39"
32
+ description="Snow-Flow Enterprise Website v4.2.0" \
33
+ version="4.2.0" \
34
+ features="23 MCP Servers, 355+ Tools, ITAM, SecOps, Notifications"
34
35
 
35
36
  # Start nginx
36
37
  CMD ["nginx", "-g", "daemon off;"]
@@ -1,15 +1,16 @@
1
1
  # Snow-Flow Website - Google Cloud Build Configuration
2
2
  steps:
3
- # Build the Docker image
3
+ # Build the Docker image (FIXED PATH)
4
4
  - name: 'gcr.io/cloud-builders/docker'
5
5
  args: [
6
6
  'build',
7
7
  '-t', 'gcr.io/$PROJECT_ID/snow-flow-website:$COMMIT_SHA',
8
8
  '-t', 'gcr.io/$PROJECT_ID/snow-flow-website:latest',
9
9
  '--cache-from', 'gcr.io/$PROJECT_ID/snow-flow-website:latest',
10
- '.'
10
+ '-f', 'website/Dockerfile', # Specify Dockerfile location from root
11
+ 'website/' # Build context is website directory
11
12
  ]
12
- dir: 'website'
13
+ # Remove dir: 'website' to run from root
13
14
 
14
15
  # Push the Docker image to Container Registry
15
16
  - name: 'gcr.io/cloud-builders/docker'