snow-flow 8.40.1 → 8.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.d.ts +14 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.js +220 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.js +236 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts +1 -3
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js +5 -10
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.d.ts +7 -5
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.js +195 -34
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.d.ts +20 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.js +474 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_create_artifact.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_create_artifact.js +7 -1
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_create_artifact.js.map +1 -1
- package/dist/templates/agents-md-template.d.ts +1 -1
- package/dist/templates/agents-md-template.d.ts.map +1 -1
- package/dist/templates/agents-md-template.js +4 -4
- package/dist/templates/claude-md-template.d.ts +1 -1
- package/dist/templates/claude-md-template.d.ts.map +1 -1
- package/dist/templates/claude-md-template.js +17 -12
- package/dist/templates/claude-md-template.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* snow_confirm_script_execution - Confirm and execute approved
|
|
3
|
+
* snow_confirm_script_execution - Confirm and execute approved script
|
|
4
4
|
*
|
|
5
|
-
* Executes a
|
|
6
|
-
* explicitly approves script execution from
|
|
5
|
+
* Executes a script after user approval. Only call this after user
|
|
6
|
+
* explicitly approves script execution from snow_execute_script with requireConfirmation=true.
|
|
7
|
+
*
|
|
8
|
+
* Uses sysauto_script + sys_trigger approach for reliable execution.
|
|
7
9
|
*
|
|
8
10
|
* ⚠️ CRITICAL: ALL SCRIPTS MUST BE ES5 ONLY!
|
|
9
11
|
*/
|
|
@@ -14,15 +16,14 @@ const auth_js_1 = require("../../shared/auth.js");
|
|
|
14
16
|
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
15
17
|
exports.toolDefinition = {
|
|
16
18
|
name: 'snow_confirm_script_execution',
|
|
17
|
-
description: '⚡
|
|
19
|
+
description: '⚡ Confirms and executes script after user approval (use after snow_execute_script with requireConfirmation=true)',
|
|
18
20
|
// Metadata for tool discovery (not sent to LLM)
|
|
19
21
|
category: 'automation',
|
|
20
22
|
subcategory: 'script-execution',
|
|
21
23
|
use_cases: ['automation', 'scripts', 'execution'],
|
|
22
24
|
complexity: 'advanced',
|
|
23
|
-
frequency: '
|
|
25
|
+
frequency: 'medium',
|
|
24
26
|
// Permission enforcement
|
|
25
|
-
// Classification: WRITE - Write operation based on name pattern
|
|
26
27
|
permission: 'write',
|
|
27
28
|
allowedRoles: ['developer', 'admin'],
|
|
28
29
|
inputSchema: {
|
|
@@ -39,46 +40,206 @@ exports.toolDefinition = {
|
|
|
39
40
|
userConfirmed: {
|
|
40
41
|
type: 'boolean',
|
|
41
42
|
description: 'User confirmation (must be true)'
|
|
43
|
+
},
|
|
44
|
+
description: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Description of what the script does',
|
|
47
|
+
default: 'Confirmed script execution'
|
|
48
|
+
},
|
|
49
|
+
timeout: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
description: 'Timeout in milliseconds for polling execution results',
|
|
52
|
+
default: 30000
|
|
42
53
|
}
|
|
43
54
|
},
|
|
44
55
|
required: ['script', 'executionId', 'userConfirmed']
|
|
45
56
|
}
|
|
46
57
|
};
|
|
47
58
|
async function execute(args, context) {
|
|
48
|
-
const { script, executionId, userConfirmed } = args;
|
|
59
|
+
const { script, executionId, userConfirmed, description = 'Confirmed script execution', timeout = 30000 } = args;
|
|
49
60
|
try {
|
|
50
61
|
// Security check - must have user confirmation
|
|
51
62
|
if (!userConfirmed) {
|
|
52
63
|
throw new error_handler_js_1.SnowFlowError(error_handler_js_1.ErrorType.INVALID_REQUEST, 'User confirmation required for script execution', { retryable: false });
|
|
53
64
|
}
|
|
54
65
|
const client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
const outputMarker = `SNOW_FLOW_CONFIRM_${executionId}`;
|
|
67
|
+
// Wrap script with output capture
|
|
68
|
+
const wrappedScript = `
|
|
69
|
+
// Snow-Flow Confirmed Execution - ID: ${executionId}
|
|
70
|
+
// Description: ${description.replace(/'/g, "\\'")}
|
|
71
|
+
var __sfOutput = [];
|
|
72
|
+
var __sfStartTime = new GlideDateTime();
|
|
73
|
+
var __sfResult = null;
|
|
74
|
+
var __sfError = null;
|
|
75
|
+
|
|
76
|
+
var __sfOrigPrint = gs.print;
|
|
77
|
+
var __sfOrigInfo = gs.info;
|
|
78
|
+
var __sfOrigWarn = gs.warn;
|
|
79
|
+
var __sfOrigError = gs.error;
|
|
80
|
+
|
|
81
|
+
gs.print = function(msg) {
|
|
82
|
+
var m = String(msg);
|
|
83
|
+
__sfOutput.push({level: 'print', message: m});
|
|
84
|
+
__sfOrigPrint(m);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
gs.info = function(msg) {
|
|
88
|
+
var m = String(msg);
|
|
89
|
+
__sfOutput.push({level: 'info', message: m});
|
|
90
|
+
__sfOrigInfo(m);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
gs.warn = function(msg) {
|
|
94
|
+
var m = String(msg);
|
|
95
|
+
__sfOutput.push({level: 'warn', message: m});
|
|
96
|
+
__sfOrigWarn(m);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
gs.error = function(msg) {
|
|
100
|
+
var m = String(msg);
|
|
101
|
+
__sfOutput.push({level: 'error', message: m});
|
|
102
|
+
__sfOrigError(m);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
gs.info('=== Snow-Flow Confirmed Execution Started ===');
|
|
107
|
+
__sfResult = (function() {
|
|
108
|
+
${script}
|
|
109
|
+
})();
|
|
110
|
+
gs.info('=== Snow-Flow Confirmed Execution Completed ===');
|
|
111
|
+
} catch(e) {
|
|
112
|
+
__sfError = e.toString();
|
|
113
|
+
gs.error('Error: ' + e.toString());
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
gs.print = __sfOrigPrint;
|
|
117
|
+
gs.info = __sfOrigInfo;
|
|
118
|
+
gs.warn = __sfOrigWarn;
|
|
119
|
+
gs.error = __sfOrigError;
|
|
120
|
+
|
|
121
|
+
var __sfEndTime = new GlideDateTime();
|
|
122
|
+
var __sfExecTimeMs = Math.abs(GlideDateTime.subtract(__sfStartTime, __sfEndTime).getNumericValue());
|
|
123
|
+
|
|
124
|
+
var __sfResultObj = {
|
|
125
|
+
executionId: '${executionId}',
|
|
126
|
+
success: __sfError === null,
|
|
127
|
+
result: __sfResult,
|
|
128
|
+
error: __sfError,
|
|
129
|
+
output: __sfOutput,
|
|
130
|
+
executionTimeMs: __sfExecTimeMs
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
gs.setProperty('${outputMarker}', JSON.stringify(__sfResultObj));
|
|
134
|
+
gs.info('${outputMarker}:DONE');
|
|
135
|
+
`;
|
|
136
|
+
// Create Scheduled Script Job
|
|
137
|
+
const jobName = `Snow-Flow Confirm - ${executionId}`;
|
|
138
|
+
const createResponse = await client.post('/api/now/table/sysauto_script', {
|
|
139
|
+
name: jobName,
|
|
140
|
+
script: wrappedScript,
|
|
61
141
|
active: true,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// Execute script using sys_script table (Background Scripts)
|
|
65
|
-
const scriptResponse = await client.post('/api/now/table/sys_script', executionRecord);
|
|
66
|
-
if (!scriptResponse.data.result) {
|
|
67
|
-
throw new Error('Failed to create background script execution record');
|
|
68
|
-
}
|
|
69
|
-
const scriptSysId = scriptResponse.data.result.sys_id;
|
|
70
|
-
return (0, error_handler_js_1.createSuccessResult)({
|
|
71
|
-
executed: true,
|
|
72
|
-
execution_id: executionId,
|
|
73
|
-
script_sys_id: scriptSysId,
|
|
74
|
-
executed_at: executionTimestamp,
|
|
75
|
-
status: 'Script saved for execution',
|
|
76
|
-
message: 'Script was saved to ServiceNow Background Scripts module. Run manually from the ServiceNow interface.',
|
|
77
|
-
access_url: 'System Administration > Scripts - Background'
|
|
78
|
-
}, {
|
|
79
|
-
operation: 'background_script_execution',
|
|
80
|
-
audit_id: executionId
|
|
142
|
+
run_type: 'on_demand',
|
|
143
|
+
conditional: false
|
|
81
144
|
});
|
|
145
|
+
if (!createResponse.data?.result?.sys_id) {
|
|
146
|
+
throw new error_handler_js_1.SnowFlowError(error_handler_js_1.ErrorType.SERVICENOW_API_ERROR, 'Failed to create scheduled script job', { details: createResponse.data });
|
|
147
|
+
}
|
|
148
|
+
const jobSysId = createResponse.data.result.sys_id;
|
|
149
|
+
// Create sys_trigger to execute immediately
|
|
150
|
+
const now = new Date();
|
|
151
|
+
const triggerTime = new Date(now.getTime() + 2000);
|
|
152
|
+
const triggerTimeStr = triggerTime.toISOString().replace('T', ' ').substring(0, 19);
|
|
153
|
+
try {
|
|
154
|
+
await client.post('/api/now/table/sys_trigger', {
|
|
155
|
+
name: jobName,
|
|
156
|
+
next_action: triggerTimeStr,
|
|
157
|
+
trigger_type: 0,
|
|
158
|
+
state: 0,
|
|
159
|
+
document: 'sysauto_script',
|
|
160
|
+
document_key: jobSysId,
|
|
161
|
+
claimed_by: '',
|
|
162
|
+
system_id: 'snow-flow'
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
catch (triggerError) {
|
|
166
|
+
// Continue anyway
|
|
167
|
+
}
|
|
168
|
+
// Poll for execution results
|
|
169
|
+
const startTime = Date.now();
|
|
170
|
+
let result = null;
|
|
171
|
+
let attempts = 0;
|
|
172
|
+
const maxAttempts = Math.ceil(timeout / 2000);
|
|
173
|
+
while (Date.now() - startTime < timeout && attempts < maxAttempts) {
|
|
174
|
+
attempts++;
|
|
175
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
176
|
+
try {
|
|
177
|
+
const propResponse = await client.get('/api/now/table/sys_properties', {
|
|
178
|
+
params: {
|
|
179
|
+
sysparm_query: `name=${outputMarker}`,
|
|
180
|
+
sysparm_fields: 'value,sys_id',
|
|
181
|
+
sysparm_limit: 1
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
if (propResponse.data?.result?.[0]?.value) {
|
|
185
|
+
try {
|
|
186
|
+
result = JSON.parse(propResponse.data.result[0].value);
|
|
187
|
+
const propSysId = propResponse.data.result[0].sys_id;
|
|
188
|
+
if (propSysId) {
|
|
189
|
+
await client.delete(`/api/now/table/sys_properties/${propSysId}`).catch(() => { });
|
|
190
|
+
}
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
catch (parseErr) {
|
|
194
|
+
// Continue polling
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch (pollError) {
|
|
199
|
+
// Continue polling
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Cleanup scheduled job
|
|
203
|
+
try {
|
|
204
|
+
await client.delete(`/api/now/table/sysauto_script/${jobSysId}`);
|
|
205
|
+
}
|
|
206
|
+
catch (cleanupError) {
|
|
207
|
+
// Ignore
|
|
208
|
+
}
|
|
209
|
+
if (result) {
|
|
210
|
+
const organized = {
|
|
211
|
+
print: result.output.filter((o) => o.level === 'print').map((o) => o.message),
|
|
212
|
+
info: result.output.filter((o) => o.level === 'info').map((o) => o.message),
|
|
213
|
+
warn: result.output.filter((o) => o.level === 'warn').map((o) => o.message),
|
|
214
|
+
error: result.output.filter((o) => o.level === 'error').map((o) => o.message)
|
|
215
|
+
};
|
|
216
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
217
|
+
executed: true,
|
|
218
|
+
execution_id: executionId,
|
|
219
|
+
success: result.success,
|
|
220
|
+
result: result.result,
|
|
221
|
+
error: result.error,
|
|
222
|
+
output: organized,
|
|
223
|
+
raw_output: result.output,
|
|
224
|
+
execution_time_ms: result.executionTimeMs,
|
|
225
|
+
user_confirmed: true
|
|
226
|
+
}, {
|
|
227
|
+
operation: 'confirmed_script_execution',
|
|
228
|
+
method: 'sysauto_script_with_trigger'
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
233
|
+
executed: false,
|
|
234
|
+
execution_id: executionId,
|
|
235
|
+
scheduled_job_sys_id: jobSysId,
|
|
236
|
+
message: 'Script was saved but execution could not be confirmed.',
|
|
237
|
+
action_required: `Navigate to System Scheduler > Scheduled Jobs and run: ${jobName}`
|
|
238
|
+
}, {
|
|
239
|
+
operation: 'confirmed_script_pending',
|
|
240
|
+
method: 'scheduled_job_pending'
|
|
241
|
+
});
|
|
242
|
+
}
|
|
82
243
|
}
|
|
83
244
|
catch (error) {
|
|
84
245
|
return (0, error_handler_js_1.createErrorResult)(error instanceof error_handler_js_1.SnowFlowError
|
|
@@ -86,6 +247,6 @@ async function execute(args, context) {
|
|
|
86
247
|
: new error_handler_js_1.SnowFlowError(error_handler_js_1.ErrorType.UNKNOWN_ERROR, error.message, { originalError: error }));
|
|
87
248
|
}
|
|
88
249
|
}
|
|
89
|
-
exports.version = '
|
|
90
|
-
exports.author = 'Snow-Flow SDK
|
|
250
|
+
exports.version = '2.0.0';
|
|
251
|
+
exports.author = 'Snow-Flow SDK';
|
|
91
252
|
//# sourceMappingURL=snow_confirm_script_execution.js.map
|
package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snow_confirm_script_execution.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"snow_confirm_script_execution.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAiDH,0BAoNC;AAlQD,kDAA8D;AAC9D,oEAAiH;AAEpG,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,kHAAkH;IAC/H,gDAAgD;IAChD,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,kBAAkB;IAC/B,SAAS,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC;IACjD,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE,QAAQ;IAEnB,yBAAyB;IACzB,UAAU,EAAE,OA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Q,EAAE,IAAI;gBACd,YAAY,EAAE,WAAW;gBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,MAAM,CAAC,MAAM;gBACzB,iBAAiB,EAAE,MAAM,CAAC,eAAe;gBACzC,cAAc,EAAE,IAAI;aACrB,EAAE;gBACD,SAAS,EAAE,4BAA4B;gBACvC,MAAM,EAAE,6BAA6B;aACtC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,IAAA,sCAAmB,EAAC;gBACzB,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,WAAW;gBACzB,oBAAoB,EAAE,QAAQ;gBAC9B,OAAO,EAAE,wDAAwD;gBACjE,eAAe,EAAE,0DAA0D,OAAO,EAAE;aACrF,EAAE;gBACD,SAAS,EAAE,0BAA0B;gBACrC,MAAM,EAAE,uBAAuB;aAChC,CAAC,CAAC;QACL,CAAC;IAEH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oCAAiB,EACtB,KAAK,YAAY,gCAAa;YAC5B,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,gCAAa,CAAC,4BAAS,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CACxF,CAAC;IACJ,CAAC;AACH,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snow_execute_script - Unified script execution tool
|
|
3
|
+
*
|
|
4
|
+
* Executes server-side JavaScript in ServiceNow with comprehensive output capture.
|
|
5
|
+
* Combines functionality of:
|
|
6
|
+
* - snow_execute_script_sync (deprecated)
|
|
7
|
+
* - snow_execute_script_with_output (deprecated)
|
|
8
|
+
* - snow_execute_background_script (deprecated)
|
|
9
|
+
*
|
|
10
|
+
* Uses sysauto_script + sys_trigger approach for reliable execution.
|
|
11
|
+
*
|
|
12
|
+
* ⚠️ CRITICAL: ALL SCRIPTS MUST BE ES5 ONLY!
|
|
13
|
+
* ServiceNow runs on Rhino engine - no const/let/arrow functions/template literals.
|
|
14
|
+
*/
|
|
15
|
+
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
16
|
+
export declare const toolDefinition: MCPToolDefinition;
|
|
17
|
+
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
18
|
+
export declare const version = "2.0.0";
|
|
19
|
+
export declare const author = "Snow-Flow SDK";
|
|
20
|
+
//# sourceMappingURL=snow_execute_script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_execute_script.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBA8D5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CA6ExF;AAsXD,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,kBAAkB,CAAC"}
|