nowaikit 4.1.5 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/embed.d.ts +37 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +75 -0
- package/dist/embed.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +52 -2
- package/dist/server.js.map +1 -1
- package/dist/servicenow/client.d.ts +13 -0
- package/dist/servicenow/client.d.ts.map +1 -1
- package/dist/servicenow/client.js +52 -1
- package/dist/servicenow/client.js.map +1 -1
- package/dist/servicenow/instances.d.ts.map +1 -1
- package/dist/servicenow/instances.js +20 -0
- package/dist/servicenow/instances.js.map +1 -1
- package/dist/tools/blast-radius.d.ts +75 -0
- package/dist/tools/blast-radius.d.ts.map +1 -0
- package/dist/tools/blast-radius.js +185 -0
- package/dist/tools/blast-radius.js.map +1 -0
- package/dist/tools/catalog.d.ts.map +1 -1
- package/dist/tools/catalog.js +20 -3
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/core.js +2 -2
- package/dist/tools/core.js.map +1 -1
- package/dist/tools/docs.d.ts +51 -0
- package/dist/tools/docs.d.ts.map +1 -0
- package/dist/tools/docs.js +274 -0
- package/dist/tools/docs.js.map +1 -0
- package/dist/tools/index.d.ts +188 -796
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +23 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/knowledge.d.ts.map +1 -1
- package/dist/tools/knowledge.js +9 -3
- package/dist/tools/knowledge.js.map +1 -1
- package/dist/tools/local-sync.d.ts +55 -0
- package/dist/tools/local-sync.d.ts.map +1 -0
- package/dist/tools/local-sync.js +210 -0
- package/dist/tools/local-sync.js.map +1 -0
- package/dist/tools/ml.d.ts +1 -1
- package/dist/tools/now-assist.d.ts +11 -145
- package/dist/tools/now-assist.d.ts.map +1 -1
- package/dist/tools/now-assist.js +50 -110
- package/dist/tools/now-assist.js.map +1 -1
- package/dist/tools/reporting.d.ts +55 -17
- package/dist/tools/reporting.d.ts.map +1 -1
- package/dist/tools/reporting.js +24 -15
- package/dist/tools/reporting.js.map +1 -1
- package/dist/tools-manifest.json +250 -95
- package/dist/transport/index.d.ts.map +1 -1
- package/dist/transport/index.js +18 -2
- package/dist/transport/index.js.map +1 -1
- package/dist/utils/permissions.d.ts +10 -5
- package/dist/utils/permissions.d.ts.map +1 -1
- package/dist/utils/permissions.js +43 -20
- package/dist/utils/permissions.js.map +1 -1
- package/dist/utils/request-context.d.ts +28 -0
- package/dist/utils/request-context.d.ts.map +1 -0
- package/dist/utils/request-context.js +49 -0
- package/dist/utils/request-context.js.map +1 -0
- package/package.json +8 -3
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* ServiceNow AI / Predictive Intelligence tools.
|
|
3
3
|
* All tools require NOW_ASSIST_ENABLED=true (Tier AI).
|
|
4
4
|
*
|
|
5
|
-
* ServiceNow
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
5
|
+
* A note on scope: ServiceNow does not expose a public inbound REST API for running
|
|
6
|
+
* Now Assist skills (summarize / resolution suggestion / work-note drafting) or for
|
|
7
|
+
* triggering Agentic workflows — those run through server-side script APIs
|
|
8
|
+
* (sn_one_extend.OneExtendUtil / AiAgentRuntimeUtil) that a customer must wrap in a
|
|
9
|
+
* Scripted REST resource. So instead of calling fabricated endpoints, the tools here
|
|
10
|
+
* read real ServiceNow tables:
|
|
11
|
+
* - Predictive Intelligence solutions: ml_solution table
|
|
12
|
+
* - Virtual Agent / Copilot topics: sys_cs_topic table
|
|
13
|
+
* - Incident categorization suggestion: similar resolved incidents (Table API heuristic)
|
|
14
|
+
* - AI Search / NLQ: ServiceNow search APIs
|
|
13
15
|
*/
|
|
14
16
|
import type { ServiceNowClient } from '../servicenow/client.js';
|
|
15
17
|
export declare function getNowAssistToolDefinitions(): ({
|
|
@@ -32,14 +34,10 @@ export declare function getNowAssistToolDefinitions(): ({
|
|
|
32
34
|
};
|
|
33
35
|
query?: undefined;
|
|
34
36
|
sources?: undefined;
|
|
35
|
-
sys_id?: undefined;
|
|
36
|
-
incident_sys_id?: undefined;
|
|
37
37
|
short_description?: undefined;
|
|
38
38
|
description?: undefined;
|
|
39
39
|
active?: undefined;
|
|
40
40
|
category?: undefined;
|
|
41
|
-
playbook_sys_id?: undefined;
|
|
42
|
-
context?: undefined;
|
|
43
41
|
};
|
|
44
42
|
required: string[];
|
|
45
43
|
};
|
|
@@ -66,67 +64,10 @@ export declare function getNowAssistToolDefinitions(): ({
|
|
|
66
64
|
};
|
|
67
65
|
question?: undefined;
|
|
68
66
|
table?: undefined;
|
|
69
|
-
sys_id?: undefined;
|
|
70
|
-
incident_sys_id?: undefined;
|
|
71
67
|
short_description?: undefined;
|
|
72
68
|
description?: undefined;
|
|
73
69
|
active?: undefined;
|
|
74
70
|
category?: undefined;
|
|
75
|
-
playbook_sys_id?: undefined;
|
|
76
|
-
context?: undefined;
|
|
77
|
-
};
|
|
78
|
-
required: string[];
|
|
79
|
-
};
|
|
80
|
-
} | {
|
|
81
|
-
name: string;
|
|
82
|
-
description: string;
|
|
83
|
-
inputSchema: {
|
|
84
|
-
type: string;
|
|
85
|
-
properties: {
|
|
86
|
-
table: {
|
|
87
|
-
type: string;
|
|
88
|
-
description: string;
|
|
89
|
-
};
|
|
90
|
-
sys_id: {
|
|
91
|
-
type: string;
|
|
92
|
-
description: string;
|
|
93
|
-
};
|
|
94
|
-
question?: undefined;
|
|
95
|
-
limit?: undefined;
|
|
96
|
-
query?: undefined;
|
|
97
|
-
sources?: undefined;
|
|
98
|
-
incident_sys_id?: undefined;
|
|
99
|
-
short_description?: undefined;
|
|
100
|
-
description?: undefined;
|
|
101
|
-
active?: undefined;
|
|
102
|
-
category?: undefined;
|
|
103
|
-
playbook_sys_id?: undefined;
|
|
104
|
-
context?: undefined;
|
|
105
|
-
};
|
|
106
|
-
required: string[];
|
|
107
|
-
};
|
|
108
|
-
} | {
|
|
109
|
-
name: string;
|
|
110
|
-
description: string;
|
|
111
|
-
inputSchema: {
|
|
112
|
-
type: string;
|
|
113
|
-
properties: {
|
|
114
|
-
incident_sys_id: {
|
|
115
|
-
type: string;
|
|
116
|
-
description: string;
|
|
117
|
-
};
|
|
118
|
-
question?: undefined;
|
|
119
|
-
table?: undefined;
|
|
120
|
-
limit?: undefined;
|
|
121
|
-
query?: undefined;
|
|
122
|
-
sources?: undefined;
|
|
123
|
-
sys_id?: undefined;
|
|
124
|
-
short_description?: undefined;
|
|
125
|
-
description?: undefined;
|
|
126
|
-
active?: undefined;
|
|
127
|
-
category?: undefined;
|
|
128
|
-
playbook_sys_id?: undefined;
|
|
129
|
-
context?: undefined;
|
|
130
71
|
};
|
|
131
72
|
required: string[];
|
|
132
73
|
};
|
|
@@ -149,12 +90,8 @@ export declare function getNowAssistToolDefinitions(): ({
|
|
|
149
90
|
limit?: undefined;
|
|
150
91
|
query?: undefined;
|
|
151
92
|
sources?: undefined;
|
|
152
|
-
sys_id?: undefined;
|
|
153
|
-
incident_sys_id?: undefined;
|
|
154
93
|
active?: undefined;
|
|
155
94
|
category?: undefined;
|
|
156
|
-
playbook_sys_id?: undefined;
|
|
157
|
-
context?: undefined;
|
|
158
95
|
};
|
|
159
96
|
required: string[];
|
|
160
97
|
};
|
|
@@ -180,43 +117,11 @@ export declare function getNowAssistToolDefinitions(): ({
|
|
|
180
117
|
table?: undefined;
|
|
181
118
|
query?: undefined;
|
|
182
119
|
sources?: undefined;
|
|
183
|
-
sys_id?: undefined;
|
|
184
|
-
incident_sys_id?: undefined;
|
|
185
120
|
short_description?: undefined;
|
|
186
121
|
description?: undefined;
|
|
187
|
-
playbook_sys_id?: undefined;
|
|
188
|
-
context?: undefined;
|
|
189
122
|
};
|
|
190
123
|
required: never[];
|
|
191
124
|
};
|
|
192
|
-
} | {
|
|
193
|
-
name: string;
|
|
194
|
-
description: string;
|
|
195
|
-
inputSchema: {
|
|
196
|
-
type: string;
|
|
197
|
-
properties: {
|
|
198
|
-
playbook_sys_id: {
|
|
199
|
-
type: string;
|
|
200
|
-
description: string;
|
|
201
|
-
};
|
|
202
|
-
context: {
|
|
203
|
-
type: string;
|
|
204
|
-
description: string;
|
|
205
|
-
};
|
|
206
|
-
question?: undefined;
|
|
207
|
-
table?: undefined;
|
|
208
|
-
limit?: undefined;
|
|
209
|
-
query?: undefined;
|
|
210
|
-
sources?: undefined;
|
|
211
|
-
sys_id?: undefined;
|
|
212
|
-
incident_sys_id?: undefined;
|
|
213
|
-
short_description?: undefined;
|
|
214
|
-
description?: undefined;
|
|
215
|
-
active?: undefined;
|
|
216
|
-
category?: undefined;
|
|
217
|
-
};
|
|
218
|
-
required: string[];
|
|
219
|
-
};
|
|
220
125
|
} | {
|
|
221
126
|
name: string;
|
|
222
127
|
description: string;
|
|
@@ -231,48 +136,13 @@ export declare function getNowAssistToolDefinitions(): ({
|
|
|
231
136
|
table?: undefined;
|
|
232
137
|
query?: undefined;
|
|
233
138
|
sources?: undefined;
|
|
234
|
-
sys_id?: undefined;
|
|
235
|
-
incident_sys_id?: undefined;
|
|
236
139
|
short_description?: undefined;
|
|
237
140
|
description?: undefined;
|
|
238
141
|
active?: undefined;
|
|
239
142
|
category?: undefined;
|
|
240
|
-
playbook_sys_id?: undefined;
|
|
241
|
-
context?: undefined;
|
|
242
143
|
};
|
|
243
144
|
required: never[];
|
|
244
145
|
};
|
|
245
|
-
} | {
|
|
246
|
-
name: string;
|
|
247
|
-
description: string;
|
|
248
|
-
inputSchema: {
|
|
249
|
-
type: string;
|
|
250
|
-
properties: {
|
|
251
|
-
table: {
|
|
252
|
-
type: string;
|
|
253
|
-
description: string;
|
|
254
|
-
};
|
|
255
|
-
sys_id: {
|
|
256
|
-
type: string;
|
|
257
|
-
description: string;
|
|
258
|
-
};
|
|
259
|
-
context: {
|
|
260
|
-
type: string;
|
|
261
|
-
description: string;
|
|
262
|
-
};
|
|
263
|
-
question?: undefined;
|
|
264
|
-
limit?: undefined;
|
|
265
|
-
query?: undefined;
|
|
266
|
-
sources?: undefined;
|
|
267
|
-
incident_sys_id?: undefined;
|
|
268
|
-
short_description?: undefined;
|
|
269
|
-
description?: undefined;
|
|
270
|
-
active?: undefined;
|
|
271
|
-
category?: undefined;
|
|
272
|
-
playbook_sys_id?: undefined;
|
|
273
|
-
};
|
|
274
|
-
required: string[];
|
|
275
|
-
};
|
|
276
146
|
} | {
|
|
277
147
|
name: string;
|
|
278
148
|
description: string;
|
|
@@ -284,14 +154,10 @@ export declare function getNowAssistToolDefinitions(): ({
|
|
|
284
154
|
limit?: undefined;
|
|
285
155
|
query?: undefined;
|
|
286
156
|
sources?: undefined;
|
|
287
|
-
sys_id?: undefined;
|
|
288
|
-
incident_sys_id?: undefined;
|
|
289
157
|
short_description?: undefined;
|
|
290
158
|
description?: undefined;
|
|
291
159
|
active?: undefined;
|
|
292
160
|
category?: undefined;
|
|
293
|
-
playbook_sys_id?: undefined;
|
|
294
|
-
context?: undefined;
|
|
295
161
|
};
|
|
296
162
|
required: never[];
|
|
297
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"now-assist.d.ts","sourceRoot":"","sources":["../../src/tools/now-assist.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"now-assist.d.ts","sourceRoot":"","sources":["../../src/tools/now-assist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,wBAAgB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0E1C;AAOD,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxB,OAAO,CAAC,GAAG,CAAC,CAqFd"}
|
package/dist/tools/now-assist.js
CHANGED
|
@@ -28,44 +28,21 @@ export function getNowAssistToolDefinitions() {
|
|
|
28
28
|
required: ['query'],
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
-
{
|
|
32
|
-
name: 'generate_summary',
|
|
33
|
-
description: 'Generate an AI summary of any record using Now Assist (latest release: sn_assist/skill/summarize)',
|
|
34
|
-
inputSchema: {
|
|
35
|
-
type: 'object',
|
|
36
|
-
properties: {
|
|
37
|
-
table: { type: 'string', description: 'Table name (e.g., "incident", "change_request")' },
|
|
38
|
-
sys_id: { type: 'string', description: 'System ID of the record' },
|
|
39
|
-
},
|
|
40
|
-
required: ['table', 'sys_id'],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'suggest_resolution',
|
|
45
|
-
description: 'Get AI-powered resolution suggestion for an incident based on similar past incidents',
|
|
46
|
-
inputSchema: {
|
|
47
|
-
type: 'object',
|
|
48
|
-
properties: {
|
|
49
|
-
incident_sys_id: { type: 'string', description: 'System ID of the incident' },
|
|
50
|
-
},
|
|
51
|
-
required: ['incident_sys_id'],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
31
|
{
|
|
55
32
|
name: 'categorize_incident',
|
|
56
|
-
description: '
|
|
33
|
+
description: 'Suggest category, assignment group, and priority for an incident by analysing similar resolved incidents (Table API). Predictive Intelligence has no public REST prediction endpoint; for model-based scoring run PI on-record and read the predicted field.',
|
|
57
34
|
inputSchema: {
|
|
58
35
|
type: 'object',
|
|
59
36
|
properties: {
|
|
60
37
|
short_description: { type: 'string', description: 'Incident short description' },
|
|
61
|
-
description: { type: 'string', description: 'Optional full description for
|
|
38
|
+
description: { type: 'string', description: 'Optional full description (not required for the heuristic)' },
|
|
62
39
|
},
|
|
63
40
|
required: ['short_description'],
|
|
64
41
|
},
|
|
65
42
|
},
|
|
66
43
|
{
|
|
67
44
|
name: 'get_virtual_agent_topics',
|
|
68
|
-
description: 'List Virtual Agent topics available in the instance (
|
|
45
|
+
description: 'List Virtual Agent topics available in the instance (sys_cs_topic)',
|
|
69
46
|
inputSchema: {
|
|
70
47
|
type: 'object',
|
|
71
48
|
properties: {
|
|
@@ -76,21 +53,9 @@ export function getNowAssistToolDefinitions() {
|
|
|
76
53
|
required: [],
|
|
77
54
|
},
|
|
78
55
|
},
|
|
79
|
-
{
|
|
80
|
-
name: 'trigger_agentic_playbook',
|
|
81
|
-
description: 'Invoke an Agentic Playbook — context-aware AI agents that complete tasks autonomously ',
|
|
82
|
-
inputSchema: {
|
|
83
|
-
type: 'object',
|
|
84
|
-
properties: {
|
|
85
|
-
playbook_sys_id: { type: 'string', description: 'System ID of the Agentic Playbook' },
|
|
86
|
-
context: { type: 'object', description: 'Context key-value pairs to pass to the playbook' },
|
|
87
|
-
},
|
|
88
|
-
required: ['playbook_sys_id'],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
56
|
{
|
|
92
57
|
name: 'get_ms_copilot_topics',
|
|
93
|
-
description: 'List
|
|
58
|
+
description: 'List the Virtual Agent topics (sys_cs_topic) that back a Microsoft Copilot integration. Copilot topic mapping itself is configured in Copilot Studio on the Microsoft side, not exposed via ServiceNow REST.',
|
|
94
59
|
inputSchema: {
|
|
95
60
|
type: 'object',
|
|
96
61
|
properties: {
|
|
@@ -99,19 +64,6 @@ export function getNowAssistToolDefinitions() {
|
|
|
99
64
|
required: [],
|
|
100
65
|
},
|
|
101
66
|
},
|
|
102
|
-
{
|
|
103
|
-
name: 'generate_work_notes',
|
|
104
|
-
description: 'Generate AI-drafted work notes for a record based on its current context',
|
|
105
|
-
inputSchema: {
|
|
106
|
-
type: 'object',
|
|
107
|
-
properties: {
|
|
108
|
-
table: { type: 'string', description: 'Table name' },
|
|
109
|
-
sys_id: { type: 'string', description: 'System ID of the record' },
|
|
110
|
-
context: { type: 'string', description: 'Additional context to include in the draft' },
|
|
111
|
-
},
|
|
112
|
-
required: ['table', 'sys_id'],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
67
|
{
|
|
116
68
|
name: 'get_pi_models',
|
|
117
69
|
description: 'List available Predictive Intelligence solutions (classification/similarity models)',
|
|
@@ -124,9 +76,8 @@ export function getNowAssistToolDefinitions() {
|
|
|
124
76
|
];
|
|
125
77
|
}
|
|
126
78
|
const NOW_ASSIST_TOOL_NAMES = new Set([
|
|
127
|
-
'nlq_query', 'ai_search', '
|
|
128
|
-
'
|
|
129
|
-
'get_ms_copilot_topics', 'generate_work_notes', 'get_pi_models',
|
|
79
|
+
'nlq_query', 'ai_search', 'categorize_incident', 'get_virtual_agent_topics',
|
|
80
|
+
'get_ms_copilot_topics', 'get_pi_models',
|
|
130
81
|
]);
|
|
131
82
|
export async function executeNowAssistToolCall(client, name, args) {
|
|
132
83
|
// Only gate Now Assist tools — return null for unrelated tools so dispatch continues
|
|
@@ -155,78 +106,67 @@ export async function executeNowAssistToolCall(client, name, args) {
|
|
|
155
106
|
const result = await client.callNowAssist(`/api/now/ai_search/search?${params.toString()}`, {});
|
|
156
107
|
return { query: args.query, ...result };
|
|
157
108
|
}
|
|
158
|
-
case 'generate_summary': {
|
|
159
|
-
if (!args.table || !args.sys_id)
|
|
160
|
-
throw new ServiceNowError('table and sys_id are required', 'INVALID_REQUEST');
|
|
161
|
-
// Now Assist Skill: POST /api/sn_assist/skill/invoke
|
|
162
|
-
const result = await client.callNowAssist('/api/sn_assist/skill/invoke', {
|
|
163
|
-
skill: 'summarize',
|
|
164
|
-
input: { table: args.table, sys_id: args.sys_id },
|
|
165
|
-
});
|
|
166
|
-
return { table: args.table, sys_id: args.sys_id, summary: result?.output?.summary || result };
|
|
167
|
-
}
|
|
168
|
-
case 'suggest_resolution': {
|
|
169
|
-
if (!args.incident_sys_id)
|
|
170
|
-
throw new ServiceNowError('incident_sys_id is required', 'INVALID_REQUEST');
|
|
171
|
-
const result = await client.callNowAssist('/api/sn_assist/skill/invoke', {
|
|
172
|
-
skill: 'resolution_suggestion',
|
|
173
|
-
input: { table: 'incident', sys_id: args.incident_sys_id },
|
|
174
|
-
});
|
|
175
|
-
return { incident_sys_id: args.incident_sys_id, suggestion: result?.output || result };
|
|
176
|
-
}
|
|
177
109
|
case 'categorize_incident': {
|
|
178
110
|
if (!args.short_description)
|
|
179
111
|
throw new ServiceNowError('short_description is required', 'INVALID_REQUEST');
|
|
180
|
-
// Predictive Intelligence
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
112
|
+
// No public REST exists to run a Predictive Intelligence prediction (sn_ml is
|
|
113
|
+
// script-only). Redirect to a real Table API heuristic: find similar resolved
|
|
114
|
+
// incidents by text and surface their most common category / assignment group /
|
|
115
|
+
// priority as a suggestion.
|
|
116
|
+
const terms = String(args.short_description).replace(/[^\w\s]/g, ' ').replace(/\s+/g, ' ').trim();
|
|
117
|
+
const resp = await client.queryRecords({
|
|
118
|
+
table: 'incident',
|
|
119
|
+
query: `short_descriptionLIKE${terms}^stateIN6,7`,
|
|
120
|
+
limit: 20,
|
|
121
|
+
fields: 'number,short_description,category,subcategory,assignment_group,priority',
|
|
190
122
|
});
|
|
191
|
-
|
|
123
|
+
const top = (key) => {
|
|
124
|
+
const counts = {};
|
|
125
|
+
for (const r of resp.records) {
|
|
126
|
+
const raw = r[key];
|
|
127
|
+
const v = raw && typeof raw === 'object' ? raw.display_value || raw.value : raw;
|
|
128
|
+
if (v)
|
|
129
|
+
counts[v] = (counts[v] || 0) + 1;
|
|
130
|
+
}
|
|
131
|
+
return Object.entries(counts)
|
|
132
|
+
.sort((a, b) => b[1] - a[1])
|
|
133
|
+
.map(([value, count]) => ({ value, count }));
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
136
|
+
short_description: args.short_description,
|
|
137
|
+
based_on_incidents: resp.count,
|
|
138
|
+
suggested_category: top('category')[0]?.value || null,
|
|
139
|
+
suggested_assignment_group: top('assignment_group')[0]?.value || null,
|
|
140
|
+
suggested_priority: top('priority')[0]?.value || null,
|
|
141
|
+
category_distribution: top('category'),
|
|
142
|
+
note: resp.count
|
|
143
|
+
? 'Suggestion derived from similar resolved incidents (Table API). For model-based scoring, run Predictive Intelligence on-record and read the predicted field.'
|
|
144
|
+
: 'No similar resolved incidents were found to base a suggestion on.',
|
|
145
|
+
};
|
|
192
146
|
}
|
|
193
147
|
case 'get_virtual_agent_topics': {
|
|
194
|
-
// VA API: GET /api/sn_cs/topic (streaming support added)
|
|
195
148
|
let query = '';
|
|
196
149
|
if (args.active !== false)
|
|
197
150
|
query = 'active=true';
|
|
198
151
|
if (args.category)
|
|
199
152
|
query = query ? `${query}^category.title=${args.category}` : `category.title=${args.category}`;
|
|
200
153
|
const resp = await client.queryRecords({ table: 'sys_cs_topic', query: query || undefined, limit: args.limit || 20, fields: 'sys_id,name,active,category,description' });
|
|
201
|
-
return { count: resp.count, topics: resp.records
|
|
202
|
-
}
|
|
203
|
-
case 'trigger_agentic_playbook': {
|
|
204
|
-
if (!args.playbook_sys_id)
|
|
205
|
-
throw new ServiceNowError('playbook_sys_id is required', 'INVALID_REQUEST');
|
|
206
|
-
// Agentic Playbooks API
|
|
207
|
-
const result = await client.callNowAssist('/api/sn_assist/playbook/trigger', {
|
|
208
|
-
playbook_sys_id: args.playbook_sys_id,
|
|
209
|
-
context: args.context || {},
|
|
210
|
-
});
|
|
211
|
-
return { playbook_sys_id: args.playbook_sys_id, result, note: 'Agentic Playbooks are a latest release feature' };
|
|
154
|
+
return { count: resp.count, topics: resp.records };
|
|
212
155
|
}
|
|
213
156
|
case 'get_ms_copilot_topics': {
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
input: { table: args.table, sys_id: args.sys_id, context: args.context },
|
|
224
|
-
});
|
|
225
|
-
return { table: args.table, sys_id: args.sys_id, draft: result?.output?.text || result };
|
|
157
|
+
// No ServiceNow REST endpoint lists "Copilot topics"; topic authoring lives in
|
|
158
|
+
// Copilot Studio on the Microsoft side. The real ServiceNow-side data is the VA
|
|
159
|
+
// topic table, which is what a Copilot integration surfaces.
|
|
160
|
+
const resp = await client.queryRecords({ table: 'sys_cs_topic', query: 'active=true', limit: args.limit || 20, fields: 'sys_id,name,active,category,description' });
|
|
161
|
+
return {
|
|
162
|
+
count: resp.count,
|
|
163
|
+
topics: resp.records,
|
|
164
|
+
note: 'These are Virtual Agent topics (sys_cs_topic). Microsoft Copilot topic mapping is configured in Copilot Studio, not exposed via ServiceNow REST.',
|
|
165
|
+
};
|
|
226
166
|
}
|
|
227
167
|
case 'get_pi_models': {
|
|
228
168
|
const resp = await client.queryRecords({ table: 'ml_solution', query: 'active=true', limit: 20, fields: 'sys_id,name,table_name,type,active,sys_updated_on' });
|
|
229
|
-
return { count: resp.count, models: resp.records
|
|
169
|
+
return { count: resp.count, models: resp.records };
|
|
230
170
|
}
|
|
231
171
|
default:
|
|
232
172
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"now-assist.js","sourceRoot":"","sources":["../../src/tools/now-assist.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"now-assist.js","sourceRoot":"","sources":["../../src/tools/now-assist.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL;YACE,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,yFAAyF;YACtG,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBAC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