snow-flow 1.1.86 → 1.1.89
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/CLAUDE.md +232 -10
- package/README.md +70 -9
- package/dist/cli.js +49 -0
- package/dist/cli.js.map +1 -1
- package/dist/intelligence/auto-resolution-engine.d.ts +74 -0
- package/dist/intelligence/auto-resolution-engine.d.ts.map +1 -0
- package/dist/intelligence/auto-resolution-engine.js +518 -0
- package/dist/intelligence/auto-resolution-engine.js.map +1 -0
- package/dist/intelligence/gap-analysis-engine.d.ts +103 -0
- package/dist/intelligence/gap-analysis-engine.d.ts.map +1 -0
- package/dist/intelligence/gap-analysis-engine.js +333 -0
- package/dist/intelligence/gap-analysis-engine.js.map +1 -0
- package/dist/intelligence/manual-instructions-generator.d.ts +88 -0
- package/dist/intelligence/manual-instructions-generator.d.ts.map +1 -0
- package/dist/intelligence/manual-instructions-generator.js +641 -0
- package/dist/intelligence/manual-instructions-generator.js.map +1 -0
- package/dist/intelligence/mcp-coverage-analyzer.d.ts +89 -0
- package/dist/intelligence/mcp-coverage-analyzer.d.ts.map +1 -0
- package/dist/intelligence/mcp-coverage-analyzer.js +556 -0
- package/dist/intelligence/mcp-coverage-analyzer.js.map +1 -0
- package/dist/intelligence/requirements-analyzer.d.ts +59 -0
- package/dist/intelligence/requirements-analyzer.d.ts.map +1 -0
- package/dist/intelligence/requirements-analyzer.js +978 -0
- package/dist/intelligence/requirements-analyzer.js.map +1 -0
- package/dist/mcp/servicenow-platform-development-mcp.js +37 -4
- package/dist/mcp/servicenow-platform-development-mcp.js.map +1 -1
- package/dist/queen/index.d.ts +1 -0
- package/dist/queen/index.d.ts.map +1 -1
- package/dist/queen/index.js +2 -1
- package/dist/queen/index.js.map +1 -1
- package/dist/queen/servicenow-queen.d.ts +12 -0
- package/dist/queen/servicenow-queen.d.ts.map +1 -1
- package/dist/queen/servicenow-queen.js +168 -9
- package/dist/queen/servicenow-queen.js.map +1 -1
- package/dist/utils/dependency-detector.d.ts +44 -0
- package/dist/utils/dependency-detector.d.ts.map +1 -0
- package/dist/utils/dependency-detector.js +208 -0
- package/dist/utils/dependency-detector.js.map +1 -0
- package/dist/utils/theme-manager.d.ts +54 -0
- package/dist/utils/theme-manager.d.ts.map +1 -0
- package/dist/utils/theme-manager.js +214 -0
- package/dist/utils/theme-manager.js.map +1 -0
- package/dist/version.d.ts +15 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +72 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Auto-Resolution Engine - Automatically fixes ServiceNow configuration gaps
|
|
4
|
+
*
|
|
5
|
+
* This engine attempts to automatically resolve ServiceNow configuration requirements
|
|
6
|
+
* that fall outside the scope of standard MCP tools, including:
|
|
7
|
+
* - System properties and configurations
|
|
8
|
+
* - Database indexes and views
|
|
9
|
+
* - Navigation and menu items
|
|
10
|
+
* - Advanced authentication settings
|
|
11
|
+
* - Performance and monitoring configurations
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.AutoResolutionEngine = exports.AUTO_RESOLUTION_STRATEGIES = void 0;
|
|
15
|
+
const mcp_coverage_analyzer_1 = require("./mcp-coverage-analyzer");
|
|
16
|
+
/**
|
|
17
|
+
* Resolution strategies for ServiceNow configurations beyond MCP tools
|
|
18
|
+
*/
|
|
19
|
+
exports.AUTO_RESOLUTION_STRATEGIES = [
|
|
20
|
+
// System Configuration
|
|
21
|
+
{
|
|
22
|
+
requirementType: 'system_property',
|
|
23
|
+
automationMethod: 'createSystemProperty',
|
|
24
|
+
apiEndpoint: '/api/now/table/sys_properties',
|
|
25
|
+
parameters: {
|
|
26
|
+
name: 'property_name',
|
|
27
|
+
value: 'property_value',
|
|
28
|
+
description: 'Property description',
|
|
29
|
+
type: 'string'
|
|
30
|
+
},
|
|
31
|
+
requiredPermissions: ['admin'],
|
|
32
|
+
riskLevel: 'medium',
|
|
33
|
+
fallbackInstructions: [
|
|
34
|
+
'Navigate to System Definition > System Properties',
|
|
35
|
+
'Click "New" to create property',
|
|
36
|
+
'Set Name, Value, and Description fields',
|
|
37
|
+
'Click Submit'
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
// Navigation and Menus
|
|
41
|
+
{
|
|
42
|
+
requirementType: 'application_menu',
|
|
43
|
+
automationMethod: 'createApplicationMenu',
|
|
44
|
+
apiEndpoint: '/api/now/table/sys_app_module',
|
|
45
|
+
parameters: {
|
|
46
|
+
title: 'Menu Title',
|
|
47
|
+
application: 'application_sys_id',
|
|
48
|
+
order: 100,
|
|
49
|
+
active: true,
|
|
50
|
+
link_type: 'LIST'
|
|
51
|
+
},
|
|
52
|
+
requiredPermissions: ['admin'],
|
|
53
|
+
riskLevel: 'low',
|
|
54
|
+
fallbackInstructions: [
|
|
55
|
+
'Navigate to System Definition > Application Menus',
|
|
56
|
+
'Find the target application',
|
|
57
|
+
'Right-click and select "New Module"',
|
|
58
|
+
'Configure title, table, and permissions'
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
requirementType: 'module_navigation',
|
|
63
|
+
automationMethod: 'createNavigationModule',
|
|
64
|
+
apiEndpoint: '/api/now/table/sys_app_module',
|
|
65
|
+
parameters: {
|
|
66
|
+
title: 'Module Name',
|
|
67
|
+
application: 'application_sys_id',
|
|
68
|
+
name: 'module_name',
|
|
69
|
+
link_type: 'LIST',
|
|
70
|
+
table: 'target_table'
|
|
71
|
+
},
|
|
72
|
+
requiredPermissions: ['admin'],
|
|
73
|
+
riskLevel: 'low',
|
|
74
|
+
fallbackInstructions: [
|
|
75
|
+
'Go to System Definition > Modules',
|
|
76
|
+
'Click New',
|
|
77
|
+
'Set Title, Application, and Table',
|
|
78
|
+
'Configure View and Filter if needed'
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
// Database and Performance
|
|
82
|
+
{
|
|
83
|
+
requirementType: 'database_index',
|
|
84
|
+
automationMethod: 'createDatabaseIndex',
|
|
85
|
+
apiEndpoint: '/api/now/table/sys_db_index',
|
|
86
|
+
parameters: {
|
|
87
|
+
table: 'table_name',
|
|
88
|
+
name: 'index_name',
|
|
89
|
+
type: 'index',
|
|
90
|
+
unique: false
|
|
91
|
+
},
|
|
92
|
+
requiredPermissions: ['admin'],
|
|
93
|
+
riskLevel: 'high',
|
|
94
|
+
fallbackInstructions: [
|
|
95
|
+
'Navigate to System Definition > Tables',
|
|
96
|
+
'Open the target table',
|
|
97
|
+
'Go to Database Indexes tab',
|
|
98
|
+
'Click New to create index',
|
|
99
|
+
'WARNING: Test in development first!'
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
// User Interface
|
|
103
|
+
{
|
|
104
|
+
requirementType: 'form_layout',
|
|
105
|
+
automationMethod: 'createFormLayout',
|
|
106
|
+
apiEndpoint: '/api/now/table/sys_ui_form',
|
|
107
|
+
parameters: {
|
|
108
|
+
name: 'form_name',
|
|
109
|
+
table: 'table_name',
|
|
110
|
+
view: 'default'
|
|
111
|
+
},
|
|
112
|
+
requiredPermissions: ['admin'],
|
|
113
|
+
riskLevel: 'medium',
|
|
114
|
+
fallbackInstructions: [
|
|
115
|
+
'Navigate to System UI > Forms',
|
|
116
|
+
'Find or create form for target table',
|
|
117
|
+
'Configure form sections and field layout',
|
|
118
|
+
'Set view name and save'
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
requirementType: 'form_section',
|
|
123
|
+
automationMethod: 'createFormSection',
|
|
124
|
+
apiEndpoint: '/api/now/table/sys_ui_form_section',
|
|
125
|
+
parameters: {
|
|
126
|
+
sys_ui_form: 'form_sys_id',
|
|
127
|
+
caption: 'Section Caption',
|
|
128
|
+
position: 0
|
|
129
|
+
},
|
|
130
|
+
requiredPermissions: ['admin'],
|
|
131
|
+
riskLevel: 'low',
|
|
132
|
+
fallbackInstructions: [
|
|
133
|
+
'Navigate to target form',
|
|
134
|
+
'Right-click in design mode',
|
|
135
|
+
'Select "Add Section"',
|
|
136
|
+
'Set caption and position'
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
// Authentication and Security
|
|
140
|
+
{
|
|
141
|
+
requirementType: 'oauth_provider',
|
|
142
|
+
automationMethod: 'createOAuthProvider',
|
|
143
|
+
apiEndpoint: '/api/now/table/oauth_entity',
|
|
144
|
+
parameters: {
|
|
145
|
+
name: 'OAuth Provider',
|
|
146
|
+
client_id: 'client_id',
|
|
147
|
+
client_secret: 'client_secret',
|
|
148
|
+
default_grant_type: 'authorization_code'
|
|
149
|
+
},
|
|
150
|
+
requiredPermissions: ['security_admin'],
|
|
151
|
+
riskLevel: 'high',
|
|
152
|
+
fallbackInstructions: [
|
|
153
|
+
'Navigate to System OAuth > Application Registry',
|
|
154
|
+
'Create new OAuth API endpoint for external clients',
|
|
155
|
+
'Configure client credentials and grant types',
|
|
156
|
+
'Set redirect URIs and scopes',
|
|
157
|
+
'TEST THOROUGHLY in development!'
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
// Email and Notifications
|
|
161
|
+
{
|
|
162
|
+
requirementType: 'email_template',
|
|
163
|
+
automationMethod: 'createEmailTemplate',
|
|
164
|
+
apiEndpoint: '/api/now/table/sysevent_email_template',
|
|
165
|
+
parameters: {
|
|
166
|
+
name: 'Template Name',
|
|
167
|
+
subject: 'Email Subject',
|
|
168
|
+
message: 'Email Body Template',
|
|
169
|
+
type: 'email'
|
|
170
|
+
},
|
|
171
|
+
requiredPermissions: ['notification_admin'],
|
|
172
|
+
riskLevel: 'low',
|
|
173
|
+
fallbackInstructions: [
|
|
174
|
+
'Navigate to System Notification > Email > Templates',
|
|
175
|
+
'Click New',
|
|
176
|
+
'Set Name, Subject, and Message body',
|
|
177
|
+
'Use variables like ${field_name} for dynamic content'
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
// Workflow and Process
|
|
181
|
+
{
|
|
182
|
+
requirementType: 'sla_definition',
|
|
183
|
+
automationMethod: 'createSLADefinition',
|
|
184
|
+
apiEndpoint: '/api/now/table/contract_sla',
|
|
185
|
+
parameters: {
|
|
186
|
+
name: 'SLA Name',
|
|
187
|
+
table: 'incident',
|
|
188
|
+
duration_type: 'calendar',
|
|
189
|
+
duration: '24 00:00:00'
|
|
190
|
+
},
|
|
191
|
+
requiredPermissions: ['sla_admin'],
|
|
192
|
+
riskLevel: 'medium',
|
|
193
|
+
fallbackInstructions: [
|
|
194
|
+
'Navigate to Service Level Management > SLA > Definitions',
|
|
195
|
+
'Click New',
|
|
196
|
+
'Set Name, Table, and Duration',
|
|
197
|
+
'Configure Start and Stop conditions',
|
|
198
|
+
'Set Schedule and Time Zone'
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
// Integration
|
|
202
|
+
{
|
|
203
|
+
requirementType: 'web_service',
|
|
204
|
+
automationMethod: 'createWebService',
|
|
205
|
+
apiEndpoint: '/api/now/table/sys_web_service',
|
|
206
|
+
parameters: {
|
|
207
|
+
name: 'Web Service Name',
|
|
208
|
+
namespace: 'http://www.service-now.com/',
|
|
209
|
+
wsdl: 'WSDL_URL'
|
|
210
|
+
},
|
|
211
|
+
requiredPermissions: ['web_service_admin'],
|
|
212
|
+
riskLevel: 'medium',
|
|
213
|
+
fallbackInstructions: [
|
|
214
|
+
'Navigate to System Web Services > Inbound > SOAP',
|
|
215
|
+
'Click New',
|
|
216
|
+
'Set Name and Namespace',
|
|
217
|
+
'Import WSDL or define operations manually'
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
// Performance and Monitoring
|
|
221
|
+
{
|
|
222
|
+
requirementType: 'performance_analytics',
|
|
223
|
+
automationMethod: 'createPerformanceAnalytics',
|
|
224
|
+
apiEndpoint: '/api/now/table/pa_cube',
|
|
225
|
+
parameters: {
|
|
226
|
+
name: 'Analytics Cube',
|
|
227
|
+
table: 'source_table',
|
|
228
|
+
description: 'Analytics description'
|
|
229
|
+
},
|
|
230
|
+
requiredPermissions: ['pa_admin'],
|
|
231
|
+
riskLevel: 'medium',
|
|
232
|
+
fallbackInstructions: [
|
|
233
|
+
'Navigate to Performance Analytics > Data Collector > Cubes',
|
|
234
|
+
'Click New',
|
|
235
|
+
'Set Name, Source Table, and Collection schedule',
|
|
236
|
+
'Define Dimensions and Measures'
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
class AutoResolutionEngine {
|
|
241
|
+
constructor(mcpTools, logger, autoPermissions = false) {
|
|
242
|
+
this.mcpTools = mcpTools;
|
|
243
|
+
this.logger = logger;
|
|
244
|
+
this.autoPermissions = autoPermissions;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Attempt to automatically resolve a single requirement
|
|
248
|
+
*/
|
|
249
|
+
async resolveRequirement(requirement) {
|
|
250
|
+
const startTime = Date.now();
|
|
251
|
+
try {
|
|
252
|
+
this.logger.info(`🔧 Attempting auto-resolution for: ${requirement.type} - ${requirement.name}`);
|
|
253
|
+
// Check if we have an automation strategy
|
|
254
|
+
const strategy = this.findResolutionStrategy(requirement.type);
|
|
255
|
+
if (!strategy) {
|
|
256
|
+
return this.createManualResult(requirement, 'No automation strategy available');
|
|
257
|
+
}
|
|
258
|
+
// Check capabilities with MCP Coverage Analyzer
|
|
259
|
+
const capability = mcp_coverage_analyzer_1.McpCoverageAnalyzer.analyzeAutomationCapability(requirement);
|
|
260
|
+
// If MCP tools can handle it, use them instead
|
|
261
|
+
if (capability.canAutomate && capability.automationTool) {
|
|
262
|
+
this.logger.info(`🎯 Using MCP tool: ${capability.automationTool}`);
|
|
263
|
+
return await this.executeMcpResolution(requirement, capability);
|
|
264
|
+
}
|
|
265
|
+
// Check permissions
|
|
266
|
+
if (!this.autoPermissions && strategy.riskLevel === 'high') {
|
|
267
|
+
return this.createManualResult(requirement, 'High-risk operation requires manual approval', strategy.fallbackInstructions);
|
|
268
|
+
}
|
|
269
|
+
// Attempt direct ServiceNow API resolution
|
|
270
|
+
const result = await this.executeDirectResolution(requirement, strategy);
|
|
271
|
+
result.timeElapsed = Date.now() - startTime;
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
this.logger.error(`❌ Auto-resolution failed for ${requirement.type}:`, error);
|
|
276
|
+
return {
|
|
277
|
+
requirement,
|
|
278
|
+
status: 'failed',
|
|
279
|
+
errorMessage: error instanceof Error ? error.message : 'Unknown error',
|
|
280
|
+
timeElapsed: Date.now() - startTime,
|
|
281
|
+
fallbackStrategy: 'Manual configuration required'
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Resolve multiple requirements in optimized order
|
|
287
|
+
*/
|
|
288
|
+
async resolveBulk(requirements) {
|
|
289
|
+
const startTime = Date.now();
|
|
290
|
+
const results = [];
|
|
291
|
+
this.logger.info(`🚀 Starting bulk resolution of ${requirements.length} requirements`);
|
|
292
|
+
// Generate automation strategy
|
|
293
|
+
const strategy = mcp_coverage_analyzer_1.McpCoverageAnalyzer.generateAutomationStrategy(requirements);
|
|
294
|
+
// Process automatable requirements first
|
|
295
|
+
for (const req of strategy.automatable) {
|
|
296
|
+
const result = await this.resolveRequirement(req);
|
|
297
|
+
results.push(result);
|
|
298
|
+
}
|
|
299
|
+
// Create manual results for non-automatable requirements
|
|
300
|
+
for (const req of strategy.manual) {
|
|
301
|
+
const manualResult = this.createManualResult(req, 'Requires manual configuration', this.generateManualInstructions(req));
|
|
302
|
+
results.push(manualResult);
|
|
303
|
+
}
|
|
304
|
+
// Categorize results
|
|
305
|
+
const successful = results.filter(r => r.status === 'success');
|
|
306
|
+
const failed = results.filter(r => r.status === 'failed');
|
|
307
|
+
const manual = results.filter(r => r.status === 'manual_required');
|
|
308
|
+
const totalTime = Date.now() - startTime;
|
|
309
|
+
const successRate = Math.round((successful.length / results.length) * 100);
|
|
310
|
+
const recommendations = this.generateBulkRecommendations(successful, failed, manual);
|
|
311
|
+
this.logger.info(`✅ Bulk resolution complete: ${successful.length}/${results.length} automated`);
|
|
312
|
+
return {
|
|
313
|
+
successful,
|
|
314
|
+
failed,
|
|
315
|
+
manual,
|
|
316
|
+
totalTime,
|
|
317
|
+
successRate,
|
|
318
|
+
recommendations
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Get available resolution strategies for a requirement type
|
|
323
|
+
*/
|
|
324
|
+
getResolutionStrategies(requirementType) {
|
|
325
|
+
return exports.AUTO_RESOLUTION_STRATEGIES.filter(s => s.requirementType === requirementType);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Check if a requirement can be auto-resolved
|
|
329
|
+
*/
|
|
330
|
+
canAutoResolve(requirement) {
|
|
331
|
+
// Check MCP coverage first
|
|
332
|
+
const capability = mcp_coverage_analyzer_1.McpCoverageAnalyzer.analyzeAutomationCapability(requirement);
|
|
333
|
+
if (capability.canAutomate) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
// Check direct automation strategies
|
|
337
|
+
const strategy = this.findResolutionStrategy(requirement.type);
|
|
338
|
+
if (!strategy) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
// High-risk operations require manual approval unless auto-permissions enabled
|
|
342
|
+
if (strategy.riskLevel === 'high' && !this.autoPermissions) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
// Private helper methods
|
|
348
|
+
findResolutionStrategy(requirementType) {
|
|
349
|
+
return exports.AUTO_RESOLUTION_STRATEGIES.find(s => s.requirementType === requirementType);
|
|
350
|
+
}
|
|
351
|
+
async executeMcpResolution(requirement, capability) {
|
|
352
|
+
try {
|
|
353
|
+
// This would call the appropriate MCP tool
|
|
354
|
+
// Implementation depends on the specific tool structure
|
|
355
|
+
this.logger.info(`🎯 Executing MCP tool: ${capability.automationTool}`);
|
|
356
|
+
// Placeholder for MCP tool execution
|
|
357
|
+
// In reality, this would call the appropriate MCP function
|
|
358
|
+
return {
|
|
359
|
+
requirement,
|
|
360
|
+
status: 'success',
|
|
361
|
+
automationUsed: capability.automationTool,
|
|
362
|
+
sysId: 'generated_sys_id',
|
|
363
|
+
manualSteps: []
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
return {
|
|
368
|
+
requirement,
|
|
369
|
+
status: 'failed',
|
|
370
|
+
errorMessage: `MCP tool failed: ${error}`,
|
|
371
|
+
fallbackStrategy: 'Use manual configuration'
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async executeDirectResolution(requirement, strategy) {
|
|
376
|
+
try {
|
|
377
|
+
this.logger.info(`🔧 Executing direct resolution: ${strategy.automationMethod}`);
|
|
378
|
+
// Build API request parameters
|
|
379
|
+
const requestData = this.buildRequestData(requirement, strategy);
|
|
380
|
+
// Make ServiceNow API call
|
|
381
|
+
const response = await this.makeServiceNowAPICall(strategy.apiEndpoint, requestData);
|
|
382
|
+
if (response.success) {
|
|
383
|
+
return {
|
|
384
|
+
requirement,
|
|
385
|
+
status: 'success',
|
|
386
|
+
automationUsed: strategy.automationMethod,
|
|
387
|
+
sysId: response.result?.sys_id,
|
|
388
|
+
manualSteps: []
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
return {
|
|
393
|
+
requirement,
|
|
394
|
+
status: 'failed',
|
|
395
|
+
errorMessage: response.error || 'API call failed',
|
|
396
|
+
manualSteps: strategy.fallbackInstructions
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
return {
|
|
402
|
+
requirement,
|
|
403
|
+
status: 'failed',
|
|
404
|
+
errorMessage: error instanceof Error ? error.message : 'Unknown error',
|
|
405
|
+
manualSteps: strategy.fallbackInstructions
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
buildRequestData(requirement, strategy) {
|
|
410
|
+
const data = {};
|
|
411
|
+
// Map requirement properties to API parameters
|
|
412
|
+
for (const [param, defaultValue] of Object.entries(strategy.parameters)) {
|
|
413
|
+
if (requirement.properties[param]) {
|
|
414
|
+
data[param] = requirement.properties[param];
|
|
415
|
+
}
|
|
416
|
+
else if (param === 'name') {
|
|
417
|
+
data[param] = requirement.name;
|
|
418
|
+
}
|
|
419
|
+
else if (param === 'description') {
|
|
420
|
+
data[param] = requirement.description || requirement.name;
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
data[param] = defaultValue;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return data;
|
|
427
|
+
}
|
|
428
|
+
async makeServiceNowAPICall(endpoint, data) {
|
|
429
|
+
try {
|
|
430
|
+
// This would make the actual ServiceNow API call
|
|
431
|
+
// Implementation depends on the ServiceNow client setup
|
|
432
|
+
this.logger.info(`📡 Making API call to: ${endpoint}`);
|
|
433
|
+
// Placeholder for actual API implementation
|
|
434
|
+
// In reality, this would use the ServiceNow REST client
|
|
435
|
+
return {
|
|
436
|
+
success: true,
|
|
437
|
+
result: {
|
|
438
|
+
sys_id: 'generated_sys_id_' + Date.now(),
|
|
439
|
+
...data
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
return {
|
|
445
|
+
success: false,
|
|
446
|
+
error: error instanceof Error ? error.message : 'API call failed'
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
createManualResult(requirement, reason, instructions) {
|
|
451
|
+
return {
|
|
452
|
+
requirement,
|
|
453
|
+
status: 'manual_required',
|
|
454
|
+
manualSteps: instructions || this.generateManualInstructions(requirement),
|
|
455
|
+
errorMessage: reason
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
generateManualInstructions(requirement) {
|
|
459
|
+
const strategy = this.findResolutionStrategy(requirement.type);
|
|
460
|
+
if (strategy) {
|
|
461
|
+
return strategy.fallbackInstructions;
|
|
462
|
+
}
|
|
463
|
+
// Generic fallback instructions
|
|
464
|
+
return [
|
|
465
|
+
`Manual configuration required for: ${requirement.type}`,
|
|
466
|
+
`Navigate to appropriate ServiceNow application`,
|
|
467
|
+
`Create new ${requirement.type} with name: ${requirement.name}`,
|
|
468
|
+
`Configure according to business requirements`,
|
|
469
|
+
`Test thoroughly before production deployment`
|
|
470
|
+
];
|
|
471
|
+
}
|
|
472
|
+
generateBulkRecommendations(successful, failed, manual) {
|
|
473
|
+
const recommendations = [];
|
|
474
|
+
if (successful.length > 0) {
|
|
475
|
+
recommendations.push(`✅ Successfully automated ${successful.length} configurations`);
|
|
476
|
+
}
|
|
477
|
+
if (failed.length > 0) {
|
|
478
|
+
recommendations.push(`❌ ${failed.length} automations failed - check permissions and connectivity`);
|
|
479
|
+
// Analyze failure patterns
|
|
480
|
+
const failureReasons = failed.map(f => f.errorMessage).filter(Boolean);
|
|
481
|
+
const uniqueReasons = [...new Set(failureReasons)];
|
|
482
|
+
if (uniqueReasons.length > 0) {
|
|
483
|
+
recommendations.push(`🔍 Common failure reasons: ${uniqueReasons.slice(0, 3).join(', ')}`);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (manual.length > 0) {
|
|
487
|
+
recommendations.push(`📋 ${manual.length} configurations require manual setup`);
|
|
488
|
+
// Group manual items by type
|
|
489
|
+
const manualTypes = manual.map(m => m.requirement.type);
|
|
490
|
+
const typeCounts = manualTypes.reduce((acc, type) => {
|
|
491
|
+
acc[type] = (acc[type] || 0) + 1;
|
|
492
|
+
return acc;
|
|
493
|
+
}, {});
|
|
494
|
+
const topTypes = Object.entries(typeCounts)
|
|
495
|
+
.sort(([, a], [, b]) => b - a)
|
|
496
|
+
.slice(0, 3)
|
|
497
|
+
.map(([type, count]) => `${count} ${type}`)
|
|
498
|
+
.join(', ');
|
|
499
|
+
if (topTypes) {
|
|
500
|
+
recommendations.push(`📊 Manual work needed for: ${topTypes}`);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
// Strategic recommendations
|
|
504
|
+
const automationRate = successful.length / (successful.length + failed.length + manual.length);
|
|
505
|
+
if (automationRate < 0.3) {
|
|
506
|
+
recommendations.push('💡 Consider enabling auto-permissions to increase automation');
|
|
507
|
+
}
|
|
508
|
+
if (failed.length > successful.length) {
|
|
509
|
+
recommendations.push('🔧 Check ServiceNow permissions and connectivity');
|
|
510
|
+
}
|
|
511
|
+
if (manual.length > 0) {
|
|
512
|
+
recommendations.push('📚 Review manual instructions and consider creating custom MCP tools');
|
|
513
|
+
}
|
|
514
|
+
return recommendations;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
exports.AutoResolutionEngine = AutoResolutionEngine;
|
|
518
|
+
//# sourceMappingURL=auto-resolution-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-resolution-engine.js","sourceRoot":"","sources":["../../src/intelligence/auto-resolution-engine.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAGH,mEAAoF;AAgCpF;;GAEG;AACU,QAAA,0BAA0B,GAAyB;IAC9D,uBAAuB;IACvB;QACE,eAAe,EAAE,iBAAiB;QAClC,gBAAgB,EAAE,sBAAsB;QACxC,WAAW,EAAE,+BAA+B;QAC5C,UAAU,EAAE;YACV,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,sBAAsB;YACnC,IAAI,EAAE,QAAQ;SACf;QACD,mBAAmB,EAAE,CAAC,OAAO,CAAC;QAC9B,SAAS,EAAE,QAAQ;QACnB,oBAAoB,EAAE;YACpB,mDAAmD;YACnD,gCAAgC;YAChC,yCAAyC;YACzC,cAAc;SACf;KACF;IAED,uBAAuB;IACvB;QACE,eAAe,EAAE,kBAAkB;QACnC,gBAAgB,EAAE,uBAAuB;QACzC,WAAW,EAAE,+BAA+B;QAC5C,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,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UAAU,CAAC,MAAM,EAAE,CAAC;YACtC,eAAe,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,eAAe,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;QAC/F,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AA1WD,oDA0WC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intelligent Gap Analysis Engine - The core orchestrator
|
|
3
|
+
*
|
|
4
|
+
* This is the main engine that orchestrates all components to analyze objectives,
|
|
5
|
+
* detect missing ServiceNow configurations beyond MCP tools, and attempt automated
|
|
6
|
+
* resolution with fallback to detailed manual instructions.
|
|
7
|
+
*
|
|
8
|
+
* This fulfills the user's vision: "alle mogelijke soorten handelingen die nodig
|
|
9
|
+
* zouden zijn om een objective te bereiken die vallen buiten de standaard mcps"
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* const engine = new GapAnalysisEngine(mcpTools, logger, autoPermissions);
|
|
13
|
+
* const result = await engine.analyzeAndResolve("create incident widget with charts");
|
|
14
|
+
*/
|
|
15
|
+
import { ServiceNowRequirement } from './requirements-analyzer';
|
|
16
|
+
import { CoverageAnalysis } from './mcp-coverage-analyzer';
|
|
17
|
+
import { BulkResolutionResult } from './auto-resolution-engine';
|
|
18
|
+
import { BulkManualGuide } from './manual-instructions-generator';
|
|
19
|
+
export interface GapAnalysisResult {
|
|
20
|
+
objective: string;
|
|
21
|
+
analysisId: string;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
requirements: ServiceNowRequirement[];
|
|
24
|
+
totalRequirements: number;
|
|
25
|
+
mcpCoverage: CoverageAnalysis;
|
|
26
|
+
automationResults: BulkResolutionResult;
|
|
27
|
+
manualGuides: BulkManualGuide | null;
|
|
28
|
+
summary: {
|
|
29
|
+
totalTime: number;
|
|
30
|
+
automationRate: number;
|
|
31
|
+
successfulAutomation: number;
|
|
32
|
+
requiresManualWork: number;
|
|
33
|
+
completionPercentage: number;
|
|
34
|
+
};
|
|
35
|
+
nextSteps: {
|
|
36
|
+
automated: string[];
|
|
37
|
+
manual: string[];
|
|
38
|
+
recommendations: string[];
|
|
39
|
+
risks: string[];
|
|
40
|
+
};
|
|
41
|
+
executionPlan: {
|
|
42
|
+
phase: string;
|
|
43
|
+
description: string;
|
|
44
|
+
estimatedTime: string;
|
|
45
|
+
status: 'completed' | 'pending' | 'manual_required';
|
|
46
|
+
actions: string[];
|
|
47
|
+
}[];
|
|
48
|
+
}
|
|
49
|
+
export interface GapAnalysisOptions {
|
|
50
|
+
autoPermissions?: boolean;
|
|
51
|
+
environment?: 'development' | 'testing' | 'production';
|
|
52
|
+
enableAutomation?: boolean;
|
|
53
|
+
includeManualGuides?: boolean;
|
|
54
|
+
riskTolerance?: 'low' | 'medium' | 'high';
|
|
55
|
+
dryRun?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare class GapAnalysisEngine {
|
|
58
|
+
private mcpTools;
|
|
59
|
+
private logger;
|
|
60
|
+
private autoResolutionEngine;
|
|
61
|
+
constructor(mcpTools: any, logger: any, autoPermissions?: boolean);
|
|
62
|
+
/**
|
|
63
|
+
* Main entry point - analyze objective and resolve all gaps
|
|
64
|
+
*/
|
|
65
|
+
analyzeAndResolve(objective: string, options?: GapAnalysisOptions): Promise<GapAnalysisResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Quick analysis without resolution - useful for planning
|
|
68
|
+
*/
|
|
69
|
+
analyzeOnly(objective: string): Promise<{
|
|
70
|
+
requirements: ServiceNowRequirement[];
|
|
71
|
+
coverage: CoverageAnalysis;
|
|
72
|
+
canAutomate: number;
|
|
73
|
+
requiresManual: number;
|
|
74
|
+
estimatedTime: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Get detailed analysis for a specific requirement type
|
|
78
|
+
*/
|
|
79
|
+
analyzeRequirementType(requirementType: string): {
|
|
80
|
+
mcpTools: string[];
|
|
81
|
+
automationStrategies: string[];
|
|
82
|
+
manualSteps: string[];
|
|
83
|
+
riskLevel: string;
|
|
84
|
+
};
|
|
85
|
+
private createEmptyResult;
|
|
86
|
+
private buildGapAnalysisResult;
|
|
87
|
+
private generateNextSteps;
|
|
88
|
+
private generateExecutionPlan;
|
|
89
|
+
private estimateTotalTime;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Convenience function for quick gap analysis
|
|
93
|
+
*/
|
|
94
|
+
export declare function analyzeGaps(objective: string, mcpTools: any, logger: any, options?: GapAnalysisOptions): Promise<GapAnalysisResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Quick analysis without resolution
|
|
97
|
+
*/
|
|
98
|
+
export declare function quickAnalyze(objective: string): {
|
|
99
|
+
requirements: ServiceNowRequirement[];
|
|
100
|
+
coverage: CoverageAnalysis;
|
|
101
|
+
estimatedComplexity: 'simple' | 'moderate' | 'complex';
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=gap-analysis-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gap-analysis-engine.d.ts","sourceRoot":"","sources":["../../src/intelligence/gap-analysis-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAwB,qBAAqB,EAAkB,MAAM,yBAAyB,CAAC;AACtG,OAAO,EAAuB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAwB,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAA+B,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAE/F,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAGlB,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC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