snow-flow 4.0.3 → 4.1.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.
- package/README.md +15 -40
- package/dist/cli.js +0 -81
- package/dist/dynamic-version.js +1 -1
- package/dist/index.js +3 -1
- package/dist/intelligence/performance-recommendations-engine.js +1 -0
- package/dist/mcp/servicenow-local-development-mcp.d.ts +0 -3
- package/dist/mcp/servicenow-local-development-mcp.js +7 -204
- package/dist/memory/snow-flow-memory-patterns.d.ts +29 -30
- package/dist/memory/snow-flow-memory-patterns.js +26 -37
- package/dist/snow-flow-system.js +1 -0
- package/dist/testing/integration-test-suite.js +1 -0
- package/dist/utils/artifact-local-sync.js +0 -17
- package/dist/utils/artifact-sync/artifact-registry.js +10 -10
- package/dist/utils/smart-field-fetcher.js +4 -6
- package/package.json +2 -2
- package/dist/agent/interactive.d.ts +0 -11
- package/dist/agent/interactive.js +0 -190
- package/dist/agent/session.d.ts +0 -12
- package/dist/agent/session.js +0 -106
- package/dist/cli/auth.d.ts +0 -3
- package/dist/cli/auth.js +0 -59
- package/dist/cli/session.d.ts +0 -3
- package/dist/cli/session.js +0 -46
- package/dist/llm/keys.d.ts +0 -5
- package/dist/llm/keys.js +0 -29
- package/dist/llm/providers.d.ts +0 -11
- package/dist/llm/providers.js +0 -77
- package/dist/mcp/bridge.d.ts +0 -10
- package/dist/mcp/bridge.js +0 -31
- package/dist/mcp/shared/mcp-types.d.ts +0 -37
- package/dist/mcp/shared/mcp-types.js +0 -7
- package/dist/memory/hierarchical-memory-system.d.ts +0 -32
- package/dist/memory/hierarchical-memory-system.js +0 -60
- package/dist/memory/memory-system.d.ts +0 -25
- package/dist/memory/memory-system.js +0 -36
- package/dist/session/store.d.ts +0 -47
- package/dist/session/store.js +0 -74
- package/dist/utils/chunking-manager.d.ts +0 -39
- package/dist/utils/chunking-manager.js +0 -142
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
|
|
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/
|
|
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
|
-
##
|
|
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
|
|
30
|
+
<h3>🚀 Major Features</h3>
|
|
55
31
|
<ul align="left">
|
|
56
|
-
<li><strong
|
|
57
|
-
<li><strong
|
|
58
|
-
<li><strong
|
|
59
|
-
<li><strong
|
|
60
|
-
<li><strong
|
|
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
|
|
40
|
+
<h3>🔧 Critical Fixes</h3>
|
|
65
41
|
<ul align="left">
|
|
66
|
-
<li>✅ Catalog variables
|
|
67
|
-
<li>✅ UI policy
|
|
68
|
-
<li>✅
|
|
69
|
-
<li>✅ MCP transport 3x faster</li>
|
|
70
|
-
<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
|
package/dist/dynamic-version.js
CHANGED
|
@@ -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 '
|
|
39
|
+
return '3.6.25';
|
|
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();
|
|
@@ -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
|
|
160
|
+
// Legacy compatibility tools
|
|
161
161
|
{
|
|
162
162
|
name: 'snow_pull_widget',
|
|
163
|
-
description: 'Pull ServiceNow widget
|
|
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
|
|
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
|
|
229
|
+
// Legacy compatibility
|
|
254
230
|
case 'snow_pull_widget':
|
|
255
|
-
result = await this.
|
|
231
|
+
result = await this.pullWidget(args);
|
|
256
232
|
break;
|
|
257
233
|
case 'snow_push_widget':
|
|
258
|
-
result = await this.
|
|
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
|
|
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 > 100000 && !force) {
|
|
625
|
-
return {
|
|
626
|
-
content: [
|
|
627
|
-
{
|
|
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.`
|
|
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
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Snow-Flow Memory Patterns
|
|
3
|
-
*
|
|
2
|
+
* Snow-Flow Memory Patterns - Stub Implementation
|
|
3
|
+
* Minimal implementation to support Queen Memory System
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export declare class SnowFlowMemoryOrganizer {
|
|
6
|
+
static getWidgetMemoryStructure(name: string): {
|
|
7
|
+
key: string;
|
|
8
|
+
patterns: string[];
|
|
9
|
+
context: {
|
|
10
|
+
type: string;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
static getFlowMemoryStructure(name: string): {
|
|
15
|
+
key: string;
|
|
16
|
+
patterns: string[];
|
|
17
|
+
context: {
|
|
18
|
+
type: string;
|
|
19
|
+
name: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
static getScriptMemoryStructure(name: string, scriptType?: string): {
|
|
23
|
+
key: string;
|
|
24
|
+
patterns: string[];
|
|
25
|
+
context: {
|
|
26
|
+
type: string;
|
|
27
|
+
name: string;
|
|
28
|
+
scriptType: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
static generateKey(category: string, type: string, name: string): string;
|
|
9
32
|
}
|
|
10
|
-
export declare const MEMORY_PATTERNS: {
|
|
11
|
-
readonly AGENT: "agent/*";
|
|
12
|
-
readonly TASK: "task/*";
|
|
13
|
-
readonly SESSION: "session/*";
|
|
14
|
-
readonly ARTIFACT: "artifact/*";
|
|
15
|
-
readonly CONFIG: "config/*";
|
|
16
|
-
readonly TEMP: "temp/*";
|
|
17
|
-
};
|
|
18
|
-
export declare const MEMORY_NAMESPACES: {
|
|
19
|
-
readonly QUEEN: "queen";
|
|
20
|
-
readonly AGENTS: "agents";
|
|
21
|
-
readonly TASKS: "tasks";
|
|
22
|
-
readonly SESSIONS: "sessions";
|
|
23
|
-
readonly ARTIFACTS: "artifacts";
|
|
24
|
-
readonly CONFIG: "config";
|
|
25
|
-
readonly TEMP: "temp";
|
|
26
|
-
};
|
|
27
|
-
export declare function createMemoryKey(namespace: string, type: string, id: string): string;
|
|
28
|
-
export declare function parseMemoryKey(key: string): {
|
|
29
|
-
namespace: string;
|
|
30
|
-
type: string;
|
|
31
|
-
id: string;
|
|
32
|
-
} | null;
|
|
33
|
-
export declare function matchesPattern(key: string, pattern: string): boolean;
|
|
34
33
|
//# sourceMappingURL=snow-flow-memory-patterns.d.ts.map
|
|
@@ -1,46 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Snow-Flow Memory Patterns
|
|
4
|
-
*
|
|
3
|
+
* Snow-Flow Memory Patterns - Stub Implementation
|
|
4
|
+
* Minimal implementation to support Queen Memory System
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.matchesPattern = matchesPattern;
|
|
11
|
-
exports.MEMORY_PATTERNS = {
|
|
12
|
-
AGENT: 'agent/*',
|
|
13
|
-
TASK: 'task/*',
|
|
14
|
-
SESSION: 'session/*',
|
|
15
|
-
ARTIFACT: 'artifact/*',
|
|
16
|
-
CONFIG: 'config/*',
|
|
17
|
-
TEMP: 'temp/*'
|
|
18
|
-
};
|
|
19
|
-
exports.MEMORY_NAMESPACES = {
|
|
20
|
-
QUEEN: 'queen',
|
|
21
|
-
AGENTS: 'agents',
|
|
22
|
-
TASKS: 'tasks',
|
|
23
|
-
SESSIONS: 'sessions',
|
|
24
|
-
ARTIFACTS: 'artifacts',
|
|
25
|
-
CONFIG: 'config',
|
|
26
|
-
TEMP: 'temp'
|
|
27
|
-
};
|
|
28
|
-
function createMemoryKey(namespace, type, id) {
|
|
29
|
-
return `${namespace}/${type}/${id}`;
|
|
30
|
-
}
|
|
31
|
-
function parseMemoryKey(key) {
|
|
32
|
-
const parts = key.split('/');
|
|
33
|
-
if (parts.length >= 3) {
|
|
7
|
+
exports.SnowFlowMemoryOrganizer = void 0;
|
|
8
|
+
class SnowFlowMemoryOrganizer {
|
|
9
|
+
static getWidgetMemoryStructure(name) {
|
|
34
10
|
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
key: this.generateKey('artifacts', 'widget', name),
|
|
12
|
+
patterns: ['template', 'script', 'client_script'],
|
|
13
|
+
context: { type: 'widget', name }
|
|
38
14
|
};
|
|
39
15
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
16
|
+
static getFlowMemoryStructure(name) {
|
|
17
|
+
return {
|
|
18
|
+
key: this.generateKey('artifacts', 'flow', name),
|
|
19
|
+
patterns: ['actions', 'conditions', 'variables'],
|
|
20
|
+
context: { type: 'flow', name }
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
static getScriptMemoryStructure(name, scriptType = 'server') {
|
|
24
|
+
return {
|
|
25
|
+
key: this.generateKey('artifacts', 'script', name),
|
|
26
|
+
patterns: ['functions', 'variables', 'dependencies'],
|
|
27
|
+
context: { type: 'script', name, scriptType }
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static generateKey(category, type, name) {
|
|
31
|
+
return `${category}:${type}:${name}`;
|
|
32
|
+
}
|
|
45
33
|
}
|
|
34
|
+
exports.SnowFlowMemoryOrganizer = SnowFlowMemoryOrganizer;
|
|
46
35
|
//# sourceMappingURL=snow-flow-memory-patterns.js.map
|
package/dist/snow-flow-system.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.snowFlowSystem = exports.SnowFlowSystem = void 0;
|
|
|
11
11
|
const events_1 = require("events");
|
|
12
12
|
const snow_flow_config_1 = require("./config/snow-flow-config");
|
|
13
13
|
const servicenow_queen_1 = require("./queen/servicenow-queen");
|
|
14
|
+
const memory_system_1 = require("./memory/memory-system");
|
|
14
15
|
const mcp_server_manager_1 = require("./utils/mcp-server-manager");
|
|
15
16
|
const performance_tracker_1 = require("./monitoring/performance-tracker");
|
|
16
17
|
const system_health_1 = require("./health/system-health");
|