snow-flow 8.39.2 → 8.39.3
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/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts +6 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js +19 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.js +185 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.js +280 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.js +233 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.js +218 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.js +276 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.js +340 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.d.ts +10 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.js +34 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.js +397 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.js +234 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.js +280 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.js +358 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.js +237 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.js +326 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.js +442 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.js +348 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.js +427 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.js +432 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.js.map +1 -0
- package/dist/templates/agents-md-template.d.ts +2 -2
- package/dist/templates/agents-md-template.d.ts.map +1 -1
- package/dist/templates/agents-md-template.js +57 -2
- package/dist/templates/agents-md-template.js.map +1 -1
- package/dist/templates/claude-md-template.d.ts +2 -2
- package/dist/templates/claude-md-template.d.ts.map +1 -1
- package/dist/templates/claude-md-template.js +17 -1
- package/dist/templates/claude-md-template.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* snow_test_mid_connectivity - Test MID Server connectivity
|
|
4
|
+
*
|
|
5
|
+
* Test connectivity from MID Servers to external endpoints,
|
|
6
|
+
* validate network paths, and diagnose connection issues.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
10
|
+
exports.execute = execute;
|
|
11
|
+
const auth_js_1 = require("../../shared/auth.js");
|
|
12
|
+
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
13
|
+
exports.toolDefinition = {
|
|
14
|
+
name: 'snow_test_mid_connectivity',
|
|
15
|
+
description: 'Test MID Server connectivity to external endpoints and diagnose network issues',
|
|
16
|
+
category: 'integration',
|
|
17
|
+
subcategory: 'mid-server',
|
|
18
|
+
use_cases: ['mid-server', 'connectivity', 'troubleshooting', 'network'],
|
|
19
|
+
complexity: 'intermediate',
|
|
20
|
+
frequency: 'medium',
|
|
21
|
+
permission: 'write',
|
|
22
|
+
allowedRoles: ['developer', 'admin'],
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
action: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
enum: ['test_endpoint', 'test_port', 'ping', 'dns_lookup', 'traceroute', 'full_diagnostic'],
|
|
29
|
+
description: 'Type of connectivity test to perform',
|
|
30
|
+
default: 'test_endpoint'
|
|
31
|
+
},
|
|
32
|
+
mid_server_name: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Name of the MID Server to test from'
|
|
35
|
+
},
|
|
36
|
+
mid_server_id: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'sys_id of the MID Server to test from'
|
|
39
|
+
},
|
|
40
|
+
target_host: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Target hostname or IP address'
|
|
43
|
+
},
|
|
44
|
+
target_port: {
|
|
45
|
+
type: 'number',
|
|
46
|
+
description: 'Target port number (for port test)',
|
|
47
|
+
default: 443
|
|
48
|
+
},
|
|
49
|
+
target_url: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Full URL to test (for endpoint test)'
|
|
52
|
+
},
|
|
53
|
+
timeout_seconds: {
|
|
54
|
+
type: 'number',
|
|
55
|
+
description: 'Timeout for the test in seconds',
|
|
56
|
+
default: 30
|
|
57
|
+
},
|
|
58
|
+
protocol: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
enum: ['tcp', 'udp', 'http', 'https'],
|
|
61
|
+
description: 'Protocol to use for port test',
|
|
62
|
+
default: 'tcp'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
required: ['action']
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
async function execute(args, context) {
|
|
69
|
+
var action = args.action || 'test_endpoint';
|
|
70
|
+
var mid_server_name = args.mid_server_name || '';
|
|
71
|
+
var mid_server_id = args.mid_server_id || '';
|
|
72
|
+
var target_host = args.target_host || '';
|
|
73
|
+
var target_port = args.target_port || 443;
|
|
74
|
+
var target_url = args.target_url || '';
|
|
75
|
+
var timeout_seconds = args.timeout_seconds || 30;
|
|
76
|
+
var protocol = args.protocol || 'tcp';
|
|
77
|
+
try {
|
|
78
|
+
var client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
79
|
+
// Resolve MID Server ID if name provided
|
|
80
|
+
var midId = mid_server_id;
|
|
81
|
+
if (!midId && mid_server_name) {
|
|
82
|
+
var lookupResponse = await client.get('/api/now/table/ecc_agent', {
|
|
83
|
+
params: {
|
|
84
|
+
sysparm_query: 'name=' + mid_server_name + '^status=Up',
|
|
85
|
+
sysparm_limit: 1,
|
|
86
|
+
sysparm_fields: 'sys_id,name,ip_address'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
if (lookupResponse.data.result && lookupResponse.data.result.length > 0) {
|
|
90
|
+
midId = lookupResponse.data.result[0].sys_id;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return (0, error_handler_js_1.createErrorResult)('MID Server not found or not running: ' + mid_server_name);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// If no MID Server specified, list available ones
|
|
97
|
+
if (!midId) {
|
|
98
|
+
var availableResponse = await client.get('/api/now/table/ecc_agent', {
|
|
99
|
+
params: {
|
|
100
|
+
sysparm_query: 'status=Up^validated=true',
|
|
101
|
+
sysparm_limit: 10,
|
|
102
|
+
sysparm_fields: 'sys_id,name,ip_address,host_name'
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
var available = availableResponse.data.result || [];
|
|
106
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
107
|
+
action: 'list_available',
|
|
108
|
+
message: 'No MID Server specified. Available MID Servers:',
|
|
109
|
+
mid_servers: available.map(function (m) {
|
|
110
|
+
return {
|
|
111
|
+
sys_id: m.sys_id,
|
|
112
|
+
name: m.name,
|
|
113
|
+
ip_address: m.ip_address,
|
|
114
|
+
host_name: m.host_name
|
|
115
|
+
};
|
|
116
|
+
}),
|
|
117
|
+
usage: 'Provide mid_server_name or mid_server_id to run connectivity tests'
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Get MID Server details
|
|
121
|
+
var midDetails = await client.get('/api/now/table/ecc_agent/' + midId, {
|
|
122
|
+
params: {
|
|
123
|
+
sysparm_fields: 'name,ip_address,host_name,status'
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
var midServer = midDetails.data.result;
|
|
127
|
+
if (action === 'test_endpoint') {
|
|
128
|
+
if (!target_url) {
|
|
129
|
+
return (0, error_handler_js_1.createErrorResult)('target_url is required for test_endpoint action');
|
|
130
|
+
}
|
|
131
|
+
// Queue an HTTP probe via ECC queue
|
|
132
|
+
var probeScript = `
|
|
133
|
+
var probe = new GlideRecord('ecc_queue');
|
|
134
|
+
probe.initialize();
|
|
135
|
+
probe.agent = ${JSON.stringify(midId)};
|
|
136
|
+
probe.topic = 'Probe';
|
|
137
|
+
probe.name = 'HTTPProbe';
|
|
138
|
+
probe.source = 'snow-flow-connectivity-test';
|
|
139
|
+
probe.queue = 'output';
|
|
140
|
+
|
|
141
|
+
var payload = {
|
|
142
|
+
url: ${JSON.stringify(target_url)},
|
|
143
|
+
timeout: ${timeout_seconds * 1000}
|
|
144
|
+
};
|
|
145
|
+
probe.payload = JSON.stringify(payload);
|
|
146
|
+
|
|
147
|
+
var sysId = probe.insert();
|
|
148
|
+
|
|
149
|
+
// Wait briefly for response
|
|
150
|
+
var response = new GlideRecord('ecc_queue');
|
|
151
|
+
response.addQuery('source', probe.sys_id);
|
|
152
|
+
response.addQuery('queue', 'input');
|
|
153
|
+
response.setLimit(1);
|
|
154
|
+
|
|
155
|
+
var maxWait = ${timeout_seconds};
|
|
156
|
+
var waited = 0;
|
|
157
|
+
var result = null;
|
|
158
|
+
|
|
159
|
+
while (waited < maxWait && !result) {
|
|
160
|
+
gs.sleep(1000);
|
|
161
|
+
waited++;
|
|
162
|
+
response.query();
|
|
163
|
+
if (response.next()) {
|
|
164
|
+
result = {
|
|
165
|
+
success: true,
|
|
166
|
+
response_received: true,
|
|
167
|
+
payload: response.payload.toString()
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (!result) {
|
|
173
|
+
result = {
|
|
174
|
+
success: true,
|
|
175
|
+
response_received: false,
|
|
176
|
+
message: 'Probe queued, check ECC queue for results',
|
|
177
|
+
ecc_queue_id: sysId
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
gs.print(JSON.stringify(result));
|
|
182
|
+
`;
|
|
183
|
+
var probeResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
184
|
+
script: probeScript,
|
|
185
|
+
description: 'Test endpoint from MID: ' + target_url
|
|
186
|
+
});
|
|
187
|
+
var probeOutput = probeResponse.data.result?.output || '';
|
|
188
|
+
var probeMatch = probeOutput.match(/\{[\s\S]*\}/);
|
|
189
|
+
var probeResult = probeMatch ? JSON.parse(probeMatch[0]) : { success: false, error: 'Unknown error' };
|
|
190
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
191
|
+
action: 'test_endpoint',
|
|
192
|
+
mid_server: {
|
|
193
|
+
name: midServer.name,
|
|
194
|
+
ip_address: midServer.ip_address
|
|
195
|
+
},
|
|
196
|
+
target: target_url,
|
|
197
|
+
result: probeResult
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else if (action === 'test_port') {
|
|
201
|
+
if (!target_host) {
|
|
202
|
+
return (0, error_handler_js_1.createErrorResult)('target_host is required for test_port action');
|
|
203
|
+
}
|
|
204
|
+
// Queue a port test via ECC queue
|
|
205
|
+
var portTestScript = `
|
|
206
|
+
var probe = new GlideRecord('ecc_queue');
|
|
207
|
+
probe.initialize();
|
|
208
|
+
probe.agent = ${JSON.stringify(midId)};
|
|
209
|
+
probe.topic = 'Probe';
|
|
210
|
+
probe.name = 'TCPProbe';
|
|
211
|
+
probe.source = 'snow-flow-port-test';
|
|
212
|
+
probe.queue = 'output';
|
|
213
|
+
|
|
214
|
+
var payload = {
|
|
215
|
+
host: ${JSON.stringify(target_host)},
|
|
216
|
+
port: ${target_port},
|
|
217
|
+
protocol: ${JSON.stringify(protocol)},
|
|
218
|
+
timeout: ${timeout_seconds * 1000}
|
|
219
|
+
};
|
|
220
|
+
probe.payload = JSON.stringify(payload);
|
|
221
|
+
|
|
222
|
+
var sysId = probe.insert();
|
|
223
|
+
|
|
224
|
+
gs.print(JSON.stringify({
|
|
225
|
+
success: true,
|
|
226
|
+
message: 'Port test queued',
|
|
227
|
+
ecc_queue_id: sysId,
|
|
228
|
+
target: ${JSON.stringify(target_host)} + ':' + ${target_port}
|
|
229
|
+
}));
|
|
230
|
+
`;
|
|
231
|
+
var portTestResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
232
|
+
script: portTestScript,
|
|
233
|
+
description: 'Test port from MID: ' + target_host + ':' + target_port
|
|
234
|
+
});
|
|
235
|
+
var portOutput = portTestResponse.data.result?.output || '';
|
|
236
|
+
var portMatch = portOutput.match(/\{[^}]+\}/);
|
|
237
|
+
var portResult = portMatch ? JSON.parse(portMatch[0]) : { success: false, error: 'Unknown error' };
|
|
238
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
239
|
+
action: 'test_port',
|
|
240
|
+
mid_server: {
|
|
241
|
+
name: midServer.name,
|
|
242
|
+
ip_address: midServer.ip_address
|
|
243
|
+
},
|
|
244
|
+
target: {
|
|
245
|
+
host: target_host,
|
|
246
|
+
port: target_port,
|
|
247
|
+
protocol: protocol
|
|
248
|
+
},
|
|
249
|
+
result: portResult,
|
|
250
|
+
note: 'Check ECC queue for actual test results'
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
else if (action === 'ping') {
|
|
254
|
+
if (!target_host) {
|
|
255
|
+
return (0, error_handler_js_1.createErrorResult)('target_host is required for ping action');
|
|
256
|
+
}
|
|
257
|
+
var pingScript = `
|
|
258
|
+
var probe = new GlideRecord('ecc_queue');
|
|
259
|
+
probe.initialize();
|
|
260
|
+
probe.agent = ${JSON.stringify(midId)};
|
|
261
|
+
probe.topic = 'Probe';
|
|
262
|
+
probe.name = 'ICMPProbe';
|
|
263
|
+
probe.source = 'snow-flow-ping-test';
|
|
264
|
+
probe.queue = 'output';
|
|
265
|
+
|
|
266
|
+
var payload = {
|
|
267
|
+
host: ${JSON.stringify(target_host)},
|
|
268
|
+
count: 4,
|
|
269
|
+
timeout: ${timeout_seconds * 1000}
|
|
270
|
+
};
|
|
271
|
+
probe.payload = JSON.stringify(payload);
|
|
272
|
+
|
|
273
|
+
var sysId = probe.insert();
|
|
274
|
+
|
|
275
|
+
gs.print(JSON.stringify({
|
|
276
|
+
success: true,
|
|
277
|
+
message: 'Ping test queued',
|
|
278
|
+
ecc_queue_id: sysId,
|
|
279
|
+
target: ${JSON.stringify(target_host)}
|
|
280
|
+
}));
|
|
281
|
+
`;
|
|
282
|
+
var pingResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
283
|
+
script: pingScript,
|
|
284
|
+
description: 'Ping from MID: ' + target_host
|
|
285
|
+
});
|
|
286
|
+
var pingOutput = pingResponse.data.result?.output || '';
|
|
287
|
+
var pingMatch = pingOutput.match(/\{[^}]+\}/);
|
|
288
|
+
var pingResult = pingMatch ? JSON.parse(pingMatch[0]) : { success: false, error: 'Unknown error' };
|
|
289
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
290
|
+
action: 'ping',
|
|
291
|
+
mid_server: {
|
|
292
|
+
name: midServer.name,
|
|
293
|
+
ip_address: midServer.ip_address
|
|
294
|
+
},
|
|
295
|
+
target: target_host,
|
|
296
|
+
result: pingResult,
|
|
297
|
+
note: 'Check ECC queue for ping results'
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
else if (action === 'dns_lookup') {
|
|
301
|
+
if (!target_host) {
|
|
302
|
+
return (0, error_handler_js_1.createErrorResult)('target_host is required for dns_lookup action');
|
|
303
|
+
}
|
|
304
|
+
var dnsScript = `
|
|
305
|
+
var probe = new GlideRecord('ecc_queue');
|
|
306
|
+
probe.initialize();
|
|
307
|
+
probe.agent = ${JSON.stringify(midId)};
|
|
308
|
+
probe.topic = 'Probe';
|
|
309
|
+
probe.name = 'DNSProbe';
|
|
310
|
+
probe.source = 'snow-flow-dns-test';
|
|
311
|
+
probe.queue = 'output';
|
|
312
|
+
|
|
313
|
+
var payload = {
|
|
314
|
+
hostname: ${JSON.stringify(target_host)},
|
|
315
|
+
timeout: ${timeout_seconds * 1000}
|
|
316
|
+
};
|
|
317
|
+
probe.payload = JSON.stringify(payload);
|
|
318
|
+
|
|
319
|
+
var sysId = probe.insert();
|
|
320
|
+
|
|
321
|
+
gs.print(JSON.stringify({
|
|
322
|
+
success: true,
|
|
323
|
+
message: 'DNS lookup queued',
|
|
324
|
+
ecc_queue_id: sysId,
|
|
325
|
+
hostname: ${JSON.stringify(target_host)}
|
|
326
|
+
}));
|
|
327
|
+
`;
|
|
328
|
+
var dnsResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
329
|
+
script: dnsScript,
|
|
330
|
+
description: 'DNS lookup from MID: ' + target_host
|
|
331
|
+
});
|
|
332
|
+
var dnsOutput = dnsResponse.data.result?.output || '';
|
|
333
|
+
var dnsMatch = dnsOutput.match(/\{[^}]+\}/);
|
|
334
|
+
var dnsResult = dnsMatch ? JSON.parse(dnsMatch[0]) : { success: false, error: 'Unknown error' };
|
|
335
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
336
|
+
action: 'dns_lookup',
|
|
337
|
+
mid_server: {
|
|
338
|
+
name: midServer.name,
|
|
339
|
+
ip_address: midServer.ip_address
|
|
340
|
+
},
|
|
341
|
+
hostname: target_host,
|
|
342
|
+
result: dnsResult,
|
|
343
|
+
note: 'Check ECC queue for DNS resolution results'
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
else if (action === 'full_diagnostic') {
|
|
347
|
+
if (!target_host && !target_url) {
|
|
348
|
+
return (0, error_handler_js_1.createErrorResult)('target_host or target_url is required for full_diagnostic action');
|
|
349
|
+
}
|
|
350
|
+
var diagTarget = target_host || new URL(target_url).hostname;
|
|
351
|
+
var diagPort = target_port || (target_url && target_url.startsWith('https') ? 443 : 80);
|
|
352
|
+
// Run multiple tests
|
|
353
|
+
var diagnosticScript = `
|
|
354
|
+
var results = {
|
|
355
|
+
mid_server: ${JSON.stringify(midServer.name)},
|
|
356
|
+
target: ${JSON.stringify(diagTarget)},
|
|
357
|
+
tests: {}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// Create probes for each test type
|
|
361
|
+
var probes = ['ICMPProbe', 'TCPProbe', 'DNSProbe'];
|
|
362
|
+
var eccIds = [];
|
|
363
|
+
|
|
364
|
+
for (var i = 0; i < probes.length; i++) {
|
|
365
|
+
var probe = new GlideRecord('ecc_queue');
|
|
366
|
+
probe.initialize();
|
|
367
|
+
probe.agent = ${JSON.stringify(midId)};
|
|
368
|
+
probe.topic = 'Probe';
|
|
369
|
+
probe.name = probes[i];
|
|
370
|
+
probe.source = 'snow-flow-diagnostic';
|
|
371
|
+
probe.queue = 'output';
|
|
372
|
+
|
|
373
|
+
var payload = {};
|
|
374
|
+
if (probes[i] === 'ICMPProbe') {
|
|
375
|
+
payload = { host: ${JSON.stringify(diagTarget)}, count: 2 };
|
|
376
|
+
} else if (probes[i] === 'TCPProbe') {
|
|
377
|
+
payload = { host: ${JSON.stringify(diagTarget)}, port: ${diagPort} };
|
|
378
|
+
} else if (probes[i] === 'DNSProbe') {
|
|
379
|
+
payload = { hostname: ${JSON.stringify(diagTarget)} };
|
|
380
|
+
}
|
|
381
|
+
probe.payload = JSON.stringify(payload);
|
|
382
|
+
|
|
383
|
+
var sysId = probe.insert();
|
|
384
|
+
eccIds.push({ probe: probes[i], ecc_id: sysId });
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
results.queued_probes = eccIds;
|
|
388
|
+
results.message = 'Diagnostic probes queued. Check ECC queue for results.';
|
|
389
|
+
results.success = true;
|
|
390
|
+
|
|
391
|
+
gs.print(JSON.stringify(results));
|
|
392
|
+
`;
|
|
393
|
+
var diagResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
394
|
+
script: diagnosticScript,
|
|
395
|
+
description: 'Full diagnostic from MID to: ' + diagTarget
|
|
396
|
+
});
|
|
397
|
+
var diagOutput = diagResponse.data.result?.output || '';
|
|
398
|
+
var diagMatch = diagOutput.match(/\{[\s\S]*\}/);
|
|
399
|
+
var diagResult = diagMatch ? JSON.parse(diagMatch[0]) : { success: false, error: 'Unknown error' };
|
|
400
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
401
|
+
action: 'full_diagnostic',
|
|
402
|
+
mid_server: {
|
|
403
|
+
name: midServer.name,
|
|
404
|
+
ip_address: midServer.ip_address
|
|
405
|
+
},
|
|
406
|
+
target: {
|
|
407
|
+
host: diagTarget,
|
|
408
|
+
port: diagPort
|
|
409
|
+
},
|
|
410
|
+
result: diagResult,
|
|
411
|
+
instructions: [
|
|
412
|
+
'DNS probe will resolve hostname to IP',
|
|
413
|
+
'ICMP probe will test basic connectivity (ping)',
|
|
414
|
+
'TCP probe will test port connectivity',
|
|
415
|
+
'Check ECC queue for detailed results',
|
|
416
|
+
'Use snow_get_logs to view any errors'
|
|
417
|
+
]
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return (0, error_handler_js_1.createErrorResult)('Unknown action: ' + action);
|
|
421
|
+
}
|
|
422
|
+
catch (error) {
|
|
423
|
+
if (error.response?.status === 403) {
|
|
424
|
+
return (0, error_handler_js_1.createErrorResult)('Permission denied (403): Your ServiceNow user lacks permissions to test MID connectivity. ' +
|
|
425
|
+
'Required roles: "mid_server" or "admin".');
|
|
426
|
+
}
|
|
427
|
+
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
exports.version = '1.0.0';
|
|
431
|
+
exports.author = 'Snow-Flow Team';
|
|
432
|
+
//# sourceMappingURL=snow_test_mid_connectivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_test_mid_connectivity.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA+DH,0BAyYC;AArcD,kDAA8D;AAC9D,oEAAuF;AAE1E,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,gFAAgF;IAC7F,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,YAAY;IACzB,SAAS,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,CAAC;IACvE,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,QAAQ;IAEnB,UAAU,EAAE,OAAO;IACnB,YAAY,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;IACpC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,CAAC;gBAC3F,WAAW,EAAE,sCAAsC;gBACnD,OAAO,EAAE,eAAe;aACzB;YACD,eAAe,EAAE;gBAC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YAChD,IAAI,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;YAEnG,OAAO,IAAA,sCAAmB,EAAC;gBACzB,MAAM,EAAE,iBAAiB;gBACzB,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS,CAAC,IAAI;oBACpB,UAAU,EAAE,SAAS,CAAC,UAAU;iBACjC;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,QAAQ;iBACf;gBACD,MAAM,EAAE,UAAU;gBAClB,YAAY,EAAE;oBACZ,uCAAuC;oBACvC,gDAAgD;oBAChD,uCAAuC;oBACvC,sCAAsC;oBACtC,sCAAsC;iBACvC;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAA,oCAAiB,EAAC,kBAAkB,GAAG,MAAM,CAAC,CAAC;IAExD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;YACnC,OAAO,IAAA,oCAAiB,EACtB,4FAA4F;gBAC5F,0CAA0C,CAC3C,CAAC;QACJ,CAAC;QACD,OAAO,IAAA,oCAAiB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,gBAAgB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const AGENTS_MD_TEMPLATE = "# Snow-Flow - ServiceNow Development AI Agent\n\n## \uD83D\uDEA8 CRITICAL: YOU MUST ACTUALLY CALL THE TOOLS!\n\n**MCP tools are JavaScript functions that you MUST call directly!**\n\n```javascript\n// \u2705 CORRECT - Actually call the function:\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: Incident Dashboard\"\n});\n// This EXECUTES the tool and returns real data from ServiceNow\n\n// \u274C WRONG - Just showing code without calling it:\nconsole.log(\"I will create an update set like this:\");\nconsole.log(`await snow_update_set_manage({ action: 'create' });`);\n// This does NOTHING - it's just a string!\n```\n\n**If you show code examples without calling tools, you are FAILING your task!**\n\nThe user wants you to:\n- \u2705 **Actually execute tools** and get real results\n- \u2705 **Make real changes** in their ServiceNow instance\n- \u274C **NOT just show code examples** or explain what you \"would\" do\n\n---\n\n## What is Snow-Flow?\n\n**Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.\n\n## Your Purpose\n\nYou help users:\n- **Develop** ServiceNow artifacts (widgets, business rules, UI pages, flows, etc.)\n- **Configure** ServiceNow instances (properties, update sets, integrations)\n- **Automate** tasks (scripts, workflows, scheduled jobs)\n- **Analyze** data (incidents, reports, performance analytics)\n\n**Remember:** These tools are AVAILABLE and WORKING - just call them!\n\n---\n\n## \uD83D\uDEA8 THE GOLDEN RULE: UPDATE SET WORKFLOW\n\n**EVERY ServiceNow development task MUST follow this workflow:**\n\n```javascript\n// 1. CREATE UPDATE SET (before ANY development!)\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: [Descriptive Name]\",\n description: \"What you're building and why\",\n application: \"global\"\n});\n\n// 2. VERIFY UPDATE SET IS ACTIVE\nconst current = await snow_update_set_query({ action: 'current' });\nconsole.log('Active Update Set:', current.name);\n\n// 3. NOW DEVELOP (all changes auto-tracked)\nawait snow_create_artifact({\n type: 'sp_widget',\n name: 'my_widget',\n title: 'My Widget',\n template: '<div>{{data.message}}</div>',\n server_script: 'data.message = \"Hello\";', // ES5 only!\n client_script: 'function($scope) { var c = this; }'\n});\n\n// 4. COMPLETE UPDATE SET when done\nawait snow_update_set_manage({\n action: 'complete',\n update_set_id: updateSet.sys_id\n});\n```\n\n### Update Set Rules:\n- \u2705 **ONE story/task/request = ONE update set** (critical for hygiene and traceability)\n- \u2705 **Create BEFORE any development** (not after!)\n- \u2705 **Descriptive names:** \"Feature: X\", \"Fix: Y\", or \"PROJ-123: Description\"\n- \u2705 **Verify it's active** before making changes\n- \u2705 **All changes tracked** automatically in active update set\n- \u2705 **Never mix unrelated changes** - each update set should be deployable independently\n- \u2705 **Ad-hoc requests too** - even user requests without tickets get their own update set\n\n### ServiceNow Best Practices (ALWAYS FOLLOW!):\n- \u2705 **Scoped Applications**: Use scoped apps for custom development when possible\n- \u2705 **No hardcoded sys_ids**: Use GlideRecord queries or system properties instead\n- \u2705 **Proper error handling**: Wrap GlideRecord operations in try/catch\n- \u2705 **Logging**: Use gs.info/gs.warn/gs.error (remove debug logs before production)\n- \u2705 **Performance**: Limit GlideRecord queries, avoid nested loops with queries\n- \u2705 **Security**: Never store credentials in scripts, use system properties\n- \u2705 **Testing**: Test in sub-production before deploying to production\n\n---\n\n## Core MCP Tools (v8.2.0)\n\n### Update Set Management (MANDATORY!)\n```javascript\n// Merged tools - use 'action' parameter:\nsnow_update_set_manage({ action: 'create' }) // Create new update set\nsnow_update_set_manage({ action: 'complete' }) // Mark as complete\nsnow_update_set_manage({ action: 'export' }) // Export to XML\nsnow_update_set_query({ action: 'current' }) // Get current active\nsnow_update_set_query({ action: 'list' }) // List all update sets\nsnow_ensure_active_update_set({ sys_id }) // Ensure specific set is active\n```\n\n### Record Operations\n```javascript\nsnow_record_manage({ action: 'create', table, data }) // Create record\nsnow_record_manage({ action: 'update', sys_id, data }) // Update record\nsnow_record_manage({ action: 'delete', sys_id }) // Delete record\nsnow_query_table({ table, query, fields }) // Query any table\nsnow_get_by_sysid({ table, sys_id }) // Get specific record\n```\n\n### Development & Deployment\n```javascript\nsnow_create_artifact({ type, name, ... }) // Universal artifact creation (widgets, pages, etc.)\nsnow_create_business_rule({ name, table, script }) // Business rules (ES5 only!)\nsnow_create_script_include({ name, script }) // Script includes\nsnow_create_client_script({ name, table, script }) // Client scripts\nsnow_create_ui_policy({ name, table, conditions }) // UI policies\n```\n\n### Widget Development (CRITICAL!)\n```javascript\n// ALWAYS use local sync for widgets - NEVER snow_query_table!\nsnow_pull_artifact({ sys_id, table: 'sp_widget' }) // Pull to local files\n// ... edit locally with native tools ...\nsnow_push_artifact({ sys_id }) // Push back to ServiceNow\n```\n\n### Change Management\n```javascript\nsnow_change_manage({ action: 'create', ... }) // Create change\nsnow_change_manage({ action: 'approve', ... }) // Approve change\nsnow_change_query({ action: 'search', ... }) // Search changes\n```\n\n### Knowledge Management\n```javascript\nsnow_knowledge_article_manage({ action: 'create' }) // Create article\nsnow_knowledge_article_manage({ action: 'publish' }) // Publish article\nsnow_knowledge_article_manage({ action: 'search' }) // Search articles\n```\n\n### Performance Analytics\n```javascript\nsnow_pa_create({ action: 'indicator', ... }) // Create PA indicator\nsnow_pa_operate({ action: 'collect_data', ... }) // Collect PA data\nsnow_pa_discover({ action: 'indicators' }) // Discover indicators\n```\n\n### UI Builder\n```javascript\nsnow_create_uib_page({ name, title }) // Create UIB page\nsnow_uib_component_manage({ action: 'create' }) // Create component\nsnow_add_uib_page_element({ page_sys_id, component }) // Add element\n```\n\n### Workspace\n```javascript\nsnow_create_complete_workspace({ workspace_name, tables }) // Complete workspace\nsnow_create_workspace_tab({ workspace, tab_config }) // Add tab\n```\n\n### Automation & Scripts\n```javascript\nsnow_execute_script_with_output({ script }) // Test/verify scripts (ES5 ONLY!)\nsnow_schedule_job({ name, script, interval }) // Scheduled jobs\nsnow_get_logs({ filter }) // View system logs\n```\n\n### System Properties\n```javascript\nsnow_property_manage({ action: 'get', name }) // Get property\nsnow_property_manage({ action: 'set', name, value }) // Set property\nsnow_property_query({ action: 'list', pattern }) // List properties\n```\n\n---\n\n## Critical Rules\n\n### 1. ES5 JavaScript Only (ServiceNow Rhino Engine)\n**NEVER USE:**\n- \u274C `const` / `let` (use `var`)\n- \u274C Arrow functions `() => {}` (use `function() {}`)\n- \u274C Template literals \\`${}\\` (use string concatenation `+`)\n- \u274C Destructuring `{a, b} = obj` (use `obj.a`, `obj.b`)\n- \u274C `for...of` loops (use traditional `for` loops)\n\n**ALWAYS USE ES5:**\n```javascript\nvar data = []; // NOT const or let\nfunction process() { return 'result'; } // NOT arrow functions\nvar msg = 'Hello ' + name; // NOT template literals\nfor (var i = 0; i < items.length; i++) { } // NOT for...of\n```\n\n### 2. Widget Debugging = Local Sync\n**ALWAYS use `snow_pull_artifact` for widgets** - NEVER `snow_query_table`!\n- Widget too large? \u2192 `snow_pull_artifact`\n- Widget not working? \u2192 `snow_pull_artifact`\n- Need to edit widget? \u2192 `snow_pull_artifact`\n\n### 3. MCP Tools Are Functions (NOT npm packages!)\n**\uD83D\uDEA8 CRITICAL:** MCP tools work via **Model Context Protocol** - they are **already available** as JavaScript functions!\n\n**\u2705 CORRECT: Just call them directly**\n```javascript\nawait snow_create_ui_page({ name: \"dashboard\", html: \"...\" });\nawait snow_update_set_manage({ action: 'create', name: \"Feature X\" });\n// That's it! No bash, no require(), no npm!\n```\n\n**\u274C FORBIDDEN: These ALWAYS fail!**\n```bash\n# \u274C NEVER DO THIS:\nnode -e \"const { snow_update_set_manage } = require('@snow-flow/mcp-client');\"\n# ERROR: Module '@snow-flow/mcp-client' DOES NOT EXIST!\n\nnode -e \"const { snow_query_table } = require('snow-flow');\"\n# ERROR: MCP tools are NOT exported from npm package!\n\nnode dist/index.js mcp execute snow_create_ui_page {...}\n# ERROR: This command DOES NOT EXIST!\n\nnpx snow-flow-mcp-client servicenow-unified snow_create_ui_page {...}\n# ERROR: This package DOES NOT EXIST!\n\necho \"...\" && node -e \"const { ... } = require(...);\"\n# ERROR: Parser3.init error - breaks SnowCode parser!\n```\n\n**Why?** MCP tools use the MCP protocol (server \u2194 client communication), NOT npm packages or bash commands!\n\n### 4. No Mock Data\n- **FORBIDDEN:** Placeholders, TODOs, \"this would normally...\", test values\n- **REQUIRED:** Complete, production-ready, fully functional code\n\n### 5. Verify First\n- Test before claiming something is broken\n- Check if resources exist before modifying\n- Use `snow_execute_script_with_output` to verify\n\n---\n\n## The Universal Workflow\n\n**Every task follows this pattern:**\n\n1. **\uD83D\uDCE6 UPDATE SET FIRST**\n - `snow_update_set_manage({ action: 'create', ... })`\n - `snow_update_set_query({ action: 'current' })` to verify\n\n2. **\uD83D\uDD0D USE RIGHT TOOL**\n - Creating? \u2192 `snow_create_artifact` or specific `snow_create_*` tool\n - Updating? \u2192 `snow_record_manage({ action: 'update' })`\n - Querying? \u2192 `snow_query_table` or specific query tool\n - Widget development? \u2192 `snow_pull_artifact` + `snow_push_artifact` (local sync!)\n\n3. **\u2705 VERIFY**\n - `snow_execute_script_with_output` for testing\n - Check logs with `snow_get_logs`\n - Validate with `snow_update_set_query({ action: 'current' })`\n\n4. **\u2714\uFE0F COMPLETE**\n - `snow_update_set_manage({ action: 'complete' })`\n\n---\n\n## Quick Reference\n\n| Task | Tool | Notes |\n|------|------|-------|\n| Create update set | `snow_update_set_manage({ action: 'create' })` | **DO THIS FIRST!** |\n| Create widget | `snow_create_artifact({ type: 'sp_widget' })` | Service Portal widget |\n| Fix widget | `snow_pull_artifact` + `snow_push_artifact` | Local sync workflow |\n| Create business rule | `snow_create_business_rule()` | ES5 only! |\n| Query incidents | `snow_query_incidents()` | Specialized tool |\n| Get property | `snow_property_manage({ action: 'get' })` | System properties |\n| Test script | `snow_execute_script_with_output()` | ES5 verification |\n| Complete work | `snow_update_set_manage({ action: 'complete' })` | **DO THIS LAST!** |\n\n---\n\n**Remember:** Update Set \u2192 Tool \u2192 Verify \u2192 Complete. Every. Single. Time.\n";
|
|
2
|
-
export declare const AGENTS_MD_TEMPLATE_VERSION = "8.
|
|
1
|
+
export declare const AGENTS_MD_TEMPLATE = "# Snow-Flow - ServiceNow Development AI Agent\n\n## \uD83D\uDEA8 CRITICAL: YOU MUST ACTUALLY CALL THE TOOLS!\n\n**MCP tools are JavaScript functions that you MUST call directly!**\n\n```javascript\n// \u2705 CORRECT - Actually call the function:\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: Incident Dashboard\"\n});\n// This EXECUTES the tool and returns real data from ServiceNow\n\n// \u274C WRONG - Just showing code without calling it:\nconsole.log(\"I will create an update set like this:\");\nconsole.log(`await snow_update_set_manage({ action: 'create' });`);\n// This does NOTHING - it's just a string!\n```\n\n**If you show code examples without calling tools, you are FAILING your task!**\n\nThe user wants you to:\n- \u2705 **Actually execute tools** and get real results\n- \u2705 **Make real changes** in their ServiceNow instance\n- \u274C **NOT just show code examples** or explain what you \"would\" do\n\n---\n\n## What is Snow-Flow?\n\n**Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.\n\n## Your Purpose\n\nYou help users:\n- **Develop** ServiceNow artifacts (widgets, business rules, UI pages, flows, etc.)\n- **Configure** ServiceNow instances (properties, update sets, integrations)\n- **Automate** tasks (scripts, workflows, scheduled jobs)\n- **Analyze** data (incidents, reports, performance analytics)\n\n**Remember:** These tools are AVAILABLE and WORKING - just call them!\n\n---\n\n## \uD83D\uDEA8 THE GOLDEN RULE: UPDATE SET WORKFLOW\n\n**EVERY ServiceNow development task MUST follow this workflow:**\n\n```javascript\n// 1. CREATE UPDATE SET (before ANY development!)\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: [Descriptive Name]\",\n description: \"What you're building and why\",\n application: \"global\"\n});\n\n// 2. VERIFY UPDATE SET IS ACTIVE\nconst current = await snow_update_set_query({ action: 'current' });\nconsole.log('Active Update Set:', current.name);\n\n// 3. NOW DEVELOP (all changes auto-tracked)\nawait snow_create_artifact({\n type: 'sp_widget',\n name: 'my_widget',\n title: 'My Widget',\n template: '<div>{{data.message}}</div>',\n server_script: 'data.message = \"Hello\";', // ES5 only!\n client_script: 'function($scope) { var c = this; }'\n});\n\n// 4. COMPLETE UPDATE SET when done\nawait snow_update_set_manage({\n action: 'complete',\n update_set_id: updateSet.sys_id\n});\n```\n\n### Update Set Rules:\n- \u2705 **ONE story/task/request = ONE update set** (critical for hygiene and traceability)\n- \u2705 **Create BEFORE any development** (not after!)\n- \u2705 **Descriptive names:** \"Feature: X\", \"Fix: Y\", or \"PROJ-123: Description\"\n- \u2705 **Verify it's active** before making changes\n- \u2705 **All changes tracked** automatically in active update set\n- \u2705 **Never mix unrelated changes** - each update set should be deployable independently\n- \u2705 **Ad-hoc requests too** - even user requests without tickets get their own update set\n\n### ServiceNow Best Practices (ALWAYS FOLLOW!):\n- \u2705 **Scoped Applications**: Use scoped apps for custom development when possible\n- \u2705 **No hardcoded sys_ids**: Use GlideRecord queries or system properties instead\n- \u2705 **Proper error handling**: Wrap GlideRecord operations in try/catch\n- \u2705 **Logging**: Use gs.info/gs.warn/gs.error (remove debug logs before production)\n- \u2705 **Performance**: Limit GlideRecord queries, avoid nested loops with queries\n- \u2705 **Security**: Never store credentials in scripts, use system properties\n- \u2705 **Testing**: Test in sub-production before deploying to production\n\n---\n\n## Core MCP Tools (v8.2.0)\n\n### Update Set Management (MANDATORY!)\n```javascript\n// Merged tools - use 'action' parameter:\nsnow_update_set_manage({ action: 'create' }) // Create new update set\nsnow_update_set_manage({ action: 'complete' }) // Mark as complete\nsnow_update_set_manage({ action: 'export' }) // Export to XML\nsnow_update_set_query({ action: 'current' }) // Get current active\nsnow_update_set_query({ action: 'list' }) // List all update sets\nsnow_ensure_active_update_set({ sys_id }) // Ensure specific set is active\n```\n\n### Record Operations\n```javascript\nsnow_record_manage({ action: 'create', table, data }) // Create record\nsnow_record_manage({ action: 'update', sys_id, data }) // Update record\nsnow_record_manage({ action: 'delete', sys_id }) // Delete record\nsnow_query_table({ table, query, fields }) // Query any table\nsnow_get_by_sysid({ table, sys_id }) // Get specific record\n```\n\n### Development & Deployment\n```javascript\nsnow_create_artifact({ type, name, ... }) // Universal artifact creation (widgets, pages, etc.)\nsnow_create_business_rule({ name, table, script }) // Business rules (ES5 only!)\nsnow_create_script_include({ name, script }) // Script includes\nsnow_create_client_script({ name, table, script }) // Client scripts\nsnow_create_ui_policy({ name, table, conditions }) // UI policies\n```\n\n### Widget Development (CRITICAL!)\n```javascript\n// ALWAYS use local sync for widgets - NEVER snow_query_table!\nsnow_pull_artifact({ sys_id, table: 'sp_widget' }) // Pull to local files\n// ... edit locally with native tools ...\nsnow_push_artifact({ sys_id }) // Push back to ServiceNow\n```\n\n### Change Management\n```javascript\nsnow_change_manage({ action: 'create', ... }) // Create change\nsnow_change_manage({ action: 'approve', ... }) // Approve change\nsnow_change_query({ action: 'search', ... }) // Search changes\n```\n\n### Knowledge Management\n```javascript\nsnow_knowledge_article_manage({ action: 'create' }) // Create article\nsnow_knowledge_article_manage({ action: 'publish' }) // Publish article\nsnow_knowledge_article_manage({ action: 'search' }) // Search articles\n```\n\n### Performance Analytics\n```javascript\nsnow_pa_create({ action: 'indicator', ... }) // Create PA indicator\nsnow_pa_operate({ action: 'collect_data', ... }) // Collect PA data\nsnow_pa_discover({ action: 'indicators' }) // Discover indicators\n```\n\n### UI Builder\n```javascript\nsnow_create_uib_page({ name, title }) // Create UIB page\nsnow_uib_component_manage({ action: 'create' }) // Create component\nsnow_add_uib_page_element({ page_sys_id, component }) // Add element\n```\n\n### Workspace\n```javascript\nsnow_create_complete_workspace({ workspace_name, tables }) // Complete workspace\nsnow_create_workspace_tab({ workspace, tab_config }) // Add tab\n```\n\n### Automation & Scripts\n```javascript\nsnow_execute_script_with_output({ script }) // Test/verify scripts (ES5 ONLY!)\nsnow_schedule_job({ name, script, interval }) // Scheduled jobs\nsnow_get_logs({ level, source, since }) // View system logs\nsnow_get_email_logs({ type, recipient, since }) // View sent/received emails\nsnow_get_outbound_http_logs({ status, endpoint }) // Monitor outgoing REST/SOAP calls\nsnow_get_inbound_http_logs({ status, url_path }) // Track incoming API requests\nsnow_get_flow_execution_logs({ status, flow_name }) // Flow Designer execution history\nsnow_get_scheduled_job_logs({ job_name, failed_only }) // Scheduled job runs and errors\nsnow_get_slow_queries({ table, min_duration }) // Database performance issues\n```\n\n### System Properties\n```javascript\nsnow_property_manage({ action: 'get', name }) // Get property\nsnow_property_manage({ action: 'set', name, value }) // Set property\nsnow_property_query({ action: 'list', pattern }) // List properties\n```\n\n### OAuth & Credentials Management\n```javascript\nsnow_create_oauth_profile({ name, client_id, token_url }) // Create OAuth 2.0 profile\nsnow_create_connection_alias({ name, connection_type }) // Create connection alias for IntegrationHub\nsnow_create_credential_alias({ name, type, basic_auth }) // Store API keys, passwords securely\nsnow_manage_oauth_tokens({ action: 'list' }) // View OAuth token status\nsnow_manage_oauth_tokens({ action: 'refresh', oauth_profile_id }) // Refresh expired tokens\nsnow_manage_oauth_tokens({ action: 'test', oauth_profile_id }) // Test OAuth connectivity\n```\n\n### IntegrationHub & Spokes\n```javascript\nsnow_install_spoke({ action: 'list' }) // List installed spokes\nsnow_install_spoke({ action: 'search', search_query }) // Search available spokes\nsnow_install_spoke({ action: 'status', spoke_name }) // Check spoke status & actions\nsnow_create_flow_action({ name, inputs, outputs }) // Create custom IntegrationHub action\nsnow_manage_spoke_connection({ action: 'list' }) // List spoke connections\nsnow_manage_spoke_connection({ action: 'test', connection_alias_id }) // Test spoke connection\nsnow_manage_spoke_connection({ action: 'troubleshoot', connection_alias_id }) // Diagnose issues\n```\n\n### MID Server Management\n```javascript\nsnow_configure_mid_server({ action: 'list' }) // List all MID Servers\nsnow_configure_mid_server({ action: 'status', mid_server_name }) // Detailed MID status\nsnow_configure_mid_server({ action: 'validate', mid_server_name }) // Validate MID Server\nsnow_test_mid_connectivity({ action: 'test_endpoint', mid_server_name, target_url }) // Test connectivity\nsnow_test_mid_connectivity({ action: 'ping', mid_server_name, target_host }) // Ping from MID\nsnow_test_mid_connectivity({ action: 'full_diagnostic', mid_server_name, target_host }) // Full network diagnostic\nsnow_manage_mid_capabilities({ action: 'list', mid_server_name }) // List MID capabilities\nsnow_manage_mid_capabilities({ action: 'add', mid_server_name, capability_name }) // Add capability\nsnow_manage_mid_capabilities({ action: 'recommend', use_case: 'discovery' }) // Get recommended capabilities\n```\n\n---\n\n## Critical Rules\n\n### 1. ES5 JavaScript Only (ServiceNow Rhino Engine)\n**NEVER USE:**\n- \u274C `const` / `let` (use `var`)\n- \u274C Arrow functions `() => {}` (use `function() {}`)\n- \u274C Template literals \\`${}\\` (use string concatenation `+`)\n- \u274C Destructuring `{a, b} = obj` (use `obj.a`, `obj.b`)\n- \u274C `for...of` loops (use traditional `for` loops)\n\n**ALWAYS USE ES5:**\n```javascript\nvar data = []; // NOT const or let\nfunction process() { return 'result'; } // NOT arrow functions\nvar msg = 'Hello ' + name; // NOT template literals\nfor (var i = 0; i < items.length; i++) { } // NOT for...of\n```\n\n### 2. Widget Debugging = Local Sync\n**ALWAYS use `snow_pull_artifact` for widgets** - NEVER `snow_query_table`!\n- Widget too large? \u2192 `snow_pull_artifact`\n- Widget not working? \u2192 `snow_pull_artifact`\n- Need to edit widget? \u2192 `snow_pull_artifact`\n\n### 3. MCP Tools Are Functions (NOT npm packages!)\n**\uD83D\uDEA8 CRITICAL:** MCP tools work via **Model Context Protocol** - they are **already available** as JavaScript functions!\n\n**\u2705 CORRECT: Just call them directly**\n```javascript\nawait snow_create_ui_page({ name: \"dashboard\", html: \"...\" });\nawait snow_update_set_manage({ action: 'create', name: \"Feature X\" });\n// That's it! No bash, no require(), no npm!\n```\n\n**\u274C FORBIDDEN: These ALWAYS fail!**\n```bash\n# \u274C NEVER DO THIS:\nnode -e \"const { snow_update_set_manage } = require('@snow-flow/mcp-client');\"\n# ERROR: Module '@snow-flow/mcp-client' DOES NOT EXIST!\n\nnode -e \"const { snow_query_table } = require('snow-flow');\"\n# ERROR: MCP tools are NOT exported from npm package!\n\nnode dist/index.js mcp execute snow_create_ui_page {...}\n# ERROR: This command DOES NOT EXIST!\n\nnpx snow-flow-mcp-client servicenow-unified snow_create_ui_page {...}\n# ERROR: This package DOES NOT EXIST!\n\necho \"...\" && node -e \"const { ... } = require(...);\"\n# ERROR: Parser3.init error - breaks SnowCode parser!\n```\n\n**Why?** MCP tools use the MCP protocol (server \u2194 client communication), NOT npm packages or bash commands!\n\n### 4. No Mock Data\n- **FORBIDDEN:** Placeholders, TODOs, \"this would normally...\", test values\n- **REQUIRED:** Complete, production-ready, fully functional code\n\n### 5. Verify First\n- Test before claiming something is broken\n- Check if resources exist before modifying\n- Use `snow_execute_script_with_output` to verify\n\n---\n\n## The Universal Workflow\n\n**Every task follows this pattern:**\n\n1. **\uD83D\uDCE6 UPDATE SET FIRST**\n - `snow_update_set_manage({ action: 'create', ... })`\n - `snow_update_set_query({ action: 'current' })` to verify\n\n2. **\uD83D\uDD0D USE RIGHT TOOL**\n - Creating? \u2192 `snow_create_artifact` or specific `snow_create_*` tool\n - Updating? \u2192 `snow_record_manage({ action: 'update' })`\n - Querying? \u2192 `snow_query_table` or specific query tool\n - Widget development? \u2192 `snow_pull_artifact` + `snow_push_artifact` (local sync!)\n\n3. **\u2705 VERIFY**\n - `snow_execute_script_with_output` for testing\n - Check logs with `snow_get_logs`\n - Validate with `snow_update_set_query({ action: 'current' })`\n\n4. **\u2714\uFE0F COMPLETE**\n - `snow_update_set_manage({ action: 'complete' })`\n\n---\n\n## Quick Reference\n\n| Task | Tool | Notes |\n|------|------|-------|\n| Create update set | `snow_update_set_manage({ action: 'create' })` | **DO THIS FIRST!** |\n| Create widget | `snow_create_artifact({ type: 'sp_widget' })` | Service Portal widget |\n| Fix widget | `snow_pull_artifact` + `snow_push_artifact` | Local sync workflow |\n| Create business rule | `snow_create_business_rule()` | ES5 only! |\n| Query incidents | `snow_query_incidents()` | Specialized tool |\n| Get property | `snow_property_manage({ action: 'get' })` | System properties |\n| Test script | `snow_execute_script_with_output()` | ES5 verification |\n| View emails | `snow_get_email_logs()` | Sent/received emails |\n| Debug integrations | `snow_get_outbound_http_logs()` | Outgoing HTTP calls |\n| Monitor API usage | `snow_get_inbound_http_logs()` | Incoming requests |\n| Debug flows | `snow_get_flow_execution_logs()` | Flow Designer runs |\n| Debug scheduled jobs | `snow_get_scheduled_job_logs()` | Job history & errors |\n| Find slow queries | `snow_get_slow_queries()` | Performance issues |\n| Create OAuth profile | `snow_create_oauth_profile()` | External API auth |\n| Store credentials | `snow_create_credential_alias()` | API keys, passwords |\n| Manage OAuth tokens | `snow_manage_oauth_tokens()` | List, refresh, test |\n| List spokes | `snow_install_spoke({ action: 'list' })` | IntegrationHub |\n| Create flow action | `snow_create_flow_action()` | Custom IH actions |\n| Test spoke connection | `snow_manage_spoke_connection()` | Diagnose issues |\n| List MID Servers | `snow_configure_mid_server()` | On-premise integration |\n| Test MID connectivity | `snow_test_mid_connectivity()` | Network diagnostics |\n| Manage MID capabilities | `snow_manage_mid_capabilities()` | Discovery, Orchestration |\n| Complete work | `snow_update_set_manage({ action: 'complete' })` | **DO THIS LAST!** |\n\n---\n\n**Remember:** Update Set \u2192 Tool \u2192 Verify \u2192 Complete. Every. Single. Time.\n";
|
|
2
|
+
export declare const AGENTS_MD_TEMPLATE_VERSION = "8.6.0-EXTERNAL-INTEGRATION";
|
|
3
3
|
//# sourceMappingURL=agents-md-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-md-template.d.ts","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"agents-md-template.d.ts","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,k1eA6V9B,CAAC;AAEF,eAAO,MAAM,0BAA0B,+BAA+B,CAAC"}
|
|
@@ -177,7 +177,13 @@ snow_create_workspace_tab({ workspace, tab_config }) // Add tab
|
|
|
177
177
|
\`\`\`javascript
|
|
178
178
|
snow_execute_script_with_output({ script }) // Test/verify scripts (ES5 ONLY!)
|
|
179
179
|
snow_schedule_job({ name, script, interval }) // Scheduled jobs
|
|
180
|
-
snow_get_logs({
|
|
180
|
+
snow_get_logs({ level, source, since }) // View system logs
|
|
181
|
+
snow_get_email_logs({ type, recipient, since }) // View sent/received emails
|
|
182
|
+
snow_get_outbound_http_logs({ status, endpoint }) // Monitor outgoing REST/SOAP calls
|
|
183
|
+
snow_get_inbound_http_logs({ status, url_path }) // Track incoming API requests
|
|
184
|
+
snow_get_flow_execution_logs({ status, flow_name }) // Flow Designer execution history
|
|
185
|
+
snow_get_scheduled_job_logs({ job_name, failed_only }) // Scheduled job runs and errors
|
|
186
|
+
snow_get_slow_queries({ table, min_duration }) // Database performance issues
|
|
181
187
|
\`\`\`
|
|
182
188
|
|
|
183
189
|
### System Properties
|
|
@@ -187,6 +193,40 @@ snow_property_manage({ action: 'set', name, value }) // Set property
|
|
|
187
193
|
snow_property_query({ action: 'list', pattern }) // List properties
|
|
188
194
|
\`\`\`
|
|
189
195
|
|
|
196
|
+
### OAuth & Credentials Management
|
|
197
|
+
\`\`\`javascript
|
|
198
|
+
snow_create_oauth_profile({ name, client_id, token_url }) // Create OAuth 2.0 profile
|
|
199
|
+
snow_create_connection_alias({ name, connection_type }) // Create connection alias for IntegrationHub
|
|
200
|
+
snow_create_credential_alias({ name, type, basic_auth }) // Store API keys, passwords securely
|
|
201
|
+
snow_manage_oauth_tokens({ action: 'list' }) // View OAuth token status
|
|
202
|
+
snow_manage_oauth_tokens({ action: 'refresh', oauth_profile_id }) // Refresh expired tokens
|
|
203
|
+
snow_manage_oauth_tokens({ action: 'test', oauth_profile_id }) // Test OAuth connectivity
|
|
204
|
+
\`\`\`
|
|
205
|
+
|
|
206
|
+
### IntegrationHub & Spokes
|
|
207
|
+
\`\`\`javascript
|
|
208
|
+
snow_install_spoke({ action: 'list' }) // List installed spokes
|
|
209
|
+
snow_install_spoke({ action: 'search', search_query }) // Search available spokes
|
|
210
|
+
snow_install_spoke({ action: 'status', spoke_name }) // Check spoke status & actions
|
|
211
|
+
snow_create_flow_action({ name, inputs, outputs }) // Create custom IntegrationHub action
|
|
212
|
+
snow_manage_spoke_connection({ action: 'list' }) // List spoke connections
|
|
213
|
+
snow_manage_spoke_connection({ action: 'test', connection_alias_id }) // Test spoke connection
|
|
214
|
+
snow_manage_spoke_connection({ action: 'troubleshoot', connection_alias_id }) // Diagnose issues
|
|
215
|
+
\`\`\`
|
|
216
|
+
|
|
217
|
+
### MID Server Management
|
|
218
|
+
\`\`\`javascript
|
|
219
|
+
snow_configure_mid_server({ action: 'list' }) // List all MID Servers
|
|
220
|
+
snow_configure_mid_server({ action: 'status', mid_server_name }) // Detailed MID status
|
|
221
|
+
snow_configure_mid_server({ action: 'validate', mid_server_name }) // Validate MID Server
|
|
222
|
+
snow_test_mid_connectivity({ action: 'test_endpoint', mid_server_name, target_url }) // Test connectivity
|
|
223
|
+
snow_test_mid_connectivity({ action: 'ping', mid_server_name, target_host }) // Ping from MID
|
|
224
|
+
snow_test_mid_connectivity({ action: 'full_diagnostic', mid_server_name, target_host }) // Full network diagnostic
|
|
225
|
+
snow_manage_mid_capabilities({ action: 'list', mid_server_name }) // List MID capabilities
|
|
226
|
+
snow_manage_mid_capabilities({ action: 'add', mid_server_name, capability_name }) // Add capability
|
|
227
|
+
snow_manage_mid_capabilities({ action: 'recommend', use_case: 'discovery' }) // Get recommended capabilities
|
|
228
|
+
\`\`\`
|
|
229
|
+
|
|
190
230
|
---
|
|
191
231
|
|
|
192
232
|
## Critical Rules
|
|
@@ -290,11 +330,26 @@ echo "..." && node -e "const { ... } = require(...);"
|
|
|
290
330
|
| Query incidents | \`snow_query_incidents()\` | Specialized tool |
|
|
291
331
|
| Get property | \`snow_property_manage({ action: 'get' })\` | System properties |
|
|
292
332
|
| Test script | \`snow_execute_script_with_output()\` | ES5 verification |
|
|
333
|
+
| View emails | \`snow_get_email_logs()\` | Sent/received emails |
|
|
334
|
+
| Debug integrations | \`snow_get_outbound_http_logs()\` | Outgoing HTTP calls |
|
|
335
|
+
| Monitor API usage | \`snow_get_inbound_http_logs()\` | Incoming requests |
|
|
336
|
+
| Debug flows | \`snow_get_flow_execution_logs()\` | Flow Designer runs |
|
|
337
|
+
| Debug scheduled jobs | \`snow_get_scheduled_job_logs()\` | Job history & errors |
|
|
338
|
+
| Find slow queries | \`snow_get_slow_queries()\` | Performance issues |
|
|
339
|
+
| Create OAuth profile | \`snow_create_oauth_profile()\` | External API auth |
|
|
340
|
+
| Store credentials | \`snow_create_credential_alias()\` | API keys, passwords |
|
|
341
|
+
| Manage OAuth tokens | \`snow_manage_oauth_tokens()\` | List, refresh, test |
|
|
342
|
+
| List spokes | \`snow_install_spoke({ action: 'list' })\` | IntegrationHub |
|
|
343
|
+
| Create flow action | \`snow_create_flow_action()\` | Custom IH actions |
|
|
344
|
+
| Test spoke connection | \`snow_manage_spoke_connection()\` | Diagnose issues |
|
|
345
|
+
| List MID Servers | \`snow_configure_mid_server()\` | On-premise integration |
|
|
346
|
+
| Test MID connectivity | \`snow_test_mid_connectivity()\` | Network diagnostics |
|
|
347
|
+
| Manage MID capabilities | \`snow_manage_mid_capabilities()\` | Discovery, Orchestration |
|
|
293
348
|
| Complete work | \`snow_update_set_manage({ action: 'complete' })\` | **DO THIS LAST!** |
|
|
294
349
|
|
|
295
350
|
---
|
|
296
351
|
|
|
297
352
|
**Remember:** Update Set → Tool → Verify → Complete. Every. Single. Time.
|
|
298
353
|
`;
|
|
299
|
-
exports.AGENTS_MD_TEMPLATE_VERSION = '8.
|
|
354
|
+
exports.AGENTS_MD_TEMPLATE_VERSION = '8.6.0-EXTERNAL-INTEGRATION';
|
|
300
355
|
//# sourceMappingURL=agents-md-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-md-template.js","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG
|
|
1
|
+
{"version":3,"file":"agents-md-template.js","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6VjC,CAAC;AAEW,QAAA,0BAA0B,GAAG,4BAA4B,CAAC"}
|