nowaikit 4.11.0 → 4.12.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/desktop/renderer/dist/assets/index-DIXajM0H.js +55 -0
- package/desktop/renderer/dist/index.html +1 -1
- package/dist/cli/config-store.d.ts +1 -1
- package/dist/cli/config-store.d.ts.map +1 -1
- package/dist/cli/detect-clients.d.ts +1 -1
- package/dist/cli/detect-clients.d.ts.map +1 -1
- package/dist/cli/detect-clients.js +56 -12
- package/dist/cli/detect-clients.js.map +1 -1
- package/dist/cli/setup.js +2 -2
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/writers/index.d.ts.map +1 -1
- package/dist/cli/writers/index.js +20 -0
- package/dist/cli/writers/index.js.map +1 -1
- package/dist/direct/llm-client.js +2 -2
- package/dist/direct/llm-client.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -1
- package/dist/server.js.map +1 -1
- package/dist/servicenow/client.d.ts +12 -0
- package/dist/servicenow/client.d.ts.map +1 -1
- package/dist/servicenow/client.js +54 -0
- package/dist/servicenow/client.js.map +1 -1
- package/dist/tools/access-admin.d.ts +162 -0
- package/dist/tools/access-admin.d.ts.map +1 -0
- package/dist/tools/access-admin.js +216 -0
- package/dist/tools/access-admin.js.map +1 -0
- package/dist/tools/ai-agent-exec.d.ts +70 -0
- package/dist/tools/ai-agent-exec.d.ts.map +1 -0
- package/dist/tools/ai-agent-exec.js +73 -0
- package/dist/tools/ai-agent-exec.js.map +1 -0
- package/dist/tools/approvals-extra.d.ts +202 -0
- package/dist/tools/approvals-extra.d.ts.map +1 -0
- package/dist/tools/approvals-extra.js +212 -0
- package/dist/tools/approvals-extra.js.map +1 -0
- package/dist/tools/catalog-fulfillment.d.ts +349 -0
- package/dist/tools/catalog-fulfillment.d.ts.map +1 -0
- package/dist/tools/catalog-fulfillment.js +222 -0
- package/dist/tools/catalog-fulfillment.js.map +1 -0
- package/dist/tools/grc-extra.d.ts +149 -0
- package/dist/tools/grc-extra.d.ts.map +1 -0
- package/dist/tools/grc-extra.js +115 -0
- package/dist/tools/grc-extra.js.map +1 -0
- package/dist/tools/index.d.ts +1600 -107
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +38 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/oncall.d.ts +165 -0
- package/dist/tools/oncall.d.ts.map +1 -0
- package/dist/tools/oncall.js +155 -0
- package/dist/tools/oncall.js.map +1 -0
- package/dist/tools/platform-ops.d.ts +156 -0
- package/dist/tools/platform-ops.d.ts.map +1 -0
- package/dist/tools/platform-ops.js +141 -0
- package/dist/tools/platform-ops.js.map +1 -0
- package/dist/tools/service-mapping.d.ts +108 -0
- package/dist/tools/service-mapping.d.ts.map +1 -0
- package/dist/tools/service-mapping.js +144 -0
- package/dist/tools/service-mapping.js.map +1 -0
- package/dist/tools/service-portfolio.d.ts +93 -0
- package/dist/tools/service-portfolio.d.ts.map +1 -0
- package/dist/tools/service-portfolio.js +86 -0
- package/dist/tools/service-portfolio.js.map +1 -0
- package/dist/tools/sla.d.ts +222 -0
- package/dist/tools/sla.d.ts.map +1 -0
- package/dist/tools/sla.js +160 -0
- package/dist/tools/sla.js.map +1 -0
- package/dist/tools/sn-parity.d.ts +239 -0
- package/dist/tools/sn-parity.d.ts.map +1 -0
- package/dist/tools/sn-parity.js +236 -0
- package/dist/tools/sn-parity.js.map +1 -0
- package/dist/tools/survey.d.ts +140 -0
- package/dist/tools/survey.d.ts.map +1 -0
- package/dist/tools/survey.js +118 -0
- package/dist/tools/survey.js.map +1 -0
- package/dist/tools-manifest.json +1537 -0
- package/package.json +15 -8
- package/desktop/renderer/dist/assets/index-BQ4P9VJR.js +0 -49
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { ServiceNowError } from '../utils/errors.js';
|
|
2
|
+
import { requireWrite } from '../utils/permissions.js';
|
|
3
|
+
async function resolveUser(client, user) {
|
|
4
|
+
if (/^[0-9a-f]{32}$/i.test(user))
|
|
5
|
+
return user;
|
|
6
|
+
const resp = await client.queryRecords({ table: 'sys_user', query: `user_name=${user}^ORemail=${user}`, limit: 1 });
|
|
7
|
+
if (resp.count === 0)
|
|
8
|
+
throw new ServiceNowError(`User not found: ${user}`, 'NOT_FOUND');
|
|
9
|
+
return resp.records[0].sys_id;
|
|
10
|
+
}
|
|
11
|
+
async function resolveRole(client, role) {
|
|
12
|
+
if (/^[0-9a-f]{32}$/i.test(role))
|
|
13
|
+
return role;
|
|
14
|
+
const resp = await client.queryRecords({ table: 'sys_user_role', query: `name=${role}`, limit: 1 });
|
|
15
|
+
if (resp.count === 0)
|
|
16
|
+
throw new ServiceNowError(`Role not found: ${role}`, 'NOT_FOUND');
|
|
17
|
+
return resp.records[0].sys_id;
|
|
18
|
+
}
|
|
19
|
+
export function getAccessAdminToolDefinitions() {
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
name: 'list_user_roles',
|
|
23
|
+
description: 'List roles granted to a user (sys_user_has_role), including inherited flag',
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
user: { type: 'string', description: 'User sys_id, user_name, or email' },
|
|
28
|
+
},
|
|
29
|
+
required: ['user'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'grant_role',
|
|
34
|
+
description: 'Grant a role to a user (sys_user_has_role). Requires WRITE_ENABLED=true',
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
user: { type: 'string', description: 'User sys_id, user_name, or email' },
|
|
39
|
+
role: { type: 'string', description: 'Role sys_id or name (e.g. "itil")' },
|
|
40
|
+
},
|
|
41
|
+
required: ['user', 'role'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'revoke_role',
|
|
46
|
+
description: 'Revoke a directly-granted role from a user. Requires WRITE_ENABLED=true',
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
user: { type: 'string', description: 'User sys_id, user_name, or email' },
|
|
51
|
+
role: { type: 'string', description: 'Role sys_id or name' },
|
|
52
|
+
},
|
|
53
|
+
required: ['user', 'role'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'create_role',
|
|
58
|
+
description: 'Create a new role (sys_user_role). Requires WRITE_ENABLED=true',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
name: { type: 'string', description: 'Role name (e.g. "x_acme.approver")' },
|
|
63
|
+
description: { type: 'string', description: 'Role description' },
|
|
64
|
+
fields: { type: 'object', description: 'Additional field values' },
|
|
65
|
+
},
|
|
66
|
+
required: ['name'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'deactivate_user',
|
|
71
|
+
description: 'Deactivate (offboard) a user by setting active=false. Requires WRITE_ENABLED=true',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
user: { type: 'string', description: 'User sys_id, user_name, or email' },
|
|
76
|
+
},
|
|
77
|
+
required: ['user'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'create_delegation',
|
|
82
|
+
description: 'Create an approval/coverage delegation (sys_user_delegate). Requires WRITE_ENABLED=true',
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
properties: {
|
|
86
|
+
user: { type: 'string', description: 'User delegating (sys_id/user_name/email)' },
|
|
87
|
+
delegate: { type: 'string', description: 'User receiving the delegation' },
|
|
88
|
+
starts: { type: 'string', description: 'Start datetime (YYYY-MM-DD HH:MM:SS)' },
|
|
89
|
+
ends: { type: 'string', description: 'End datetime (YYYY-MM-DD HH:MM:SS)' },
|
|
90
|
+
approvals: { type: 'boolean', description: 'Delegate approvals (default true)' },
|
|
91
|
+
assignments: { type: 'boolean', description: 'Delegate assignments' },
|
|
92
|
+
},
|
|
93
|
+
required: ['user', 'delegate'],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'list_group_members',
|
|
98
|
+
description: 'List the members of a group (sys_user_grmember)',
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: {
|
|
102
|
+
group: { type: 'string', description: 'Group sys_id or name' },
|
|
103
|
+
limit: { type: 'number', description: 'Max records (default 100)' },
|
|
104
|
+
},
|
|
105
|
+
required: ['group'],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'get_user_entitlements',
|
|
110
|
+
description: 'Summarize what a user can access: their roles, groups, and active status',
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
user: { type: 'string', description: 'User sys_id, user_name, or email' },
|
|
115
|
+
},
|
|
116
|
+
required: ['user'],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
export async function executeAccessAdminToolCall(client, name, args) {
|
|
122
|
+
switch (name) {
|
|
123
|
+
case 'list_user_roles': {
|
|
124
|
+
const userId = await resolveUser(client, args.user);
|
|
125
|
+
return await client.queryRecords({
|
|
126
|
+
table: 'sys_user_has_role',
|
|
127
|
+
query: `user=${userId}`,
|
|
128
|
+
fields: 'role,role.name,inherited,granted_by,state',
|
|
129
|
+
limit: 200,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
case 'grant_role': {
|
|
133
|
+
requireWrite();
|
|
134
|
+
const userId = await resolveUser(client, args.user);
|
|
135
|
+
const roleId = await resolveRole(client, args.role);
|
|
136
|
+
const existing = await client.queryRecords({ table: 'sys_user_has_role', query: `user=${userId}^role=${roleId}`, limit: 1 });
|
|
137
|
+
if (existing.count > 0)
|
|
138
|
+
return { already_granted: true, summary: `User already has role ${args.role}` };
|
|
139
|
+
const result = await client.createRecord('sys_user_has_role', { user: userId, role: roleId });
|
|
140
|
+
return { ...result, summary: `Granted role ${args.role} to ${args.user}` };
|
|
141
|
+
}
|
|
142
|
+
case 'revoke_role': {
|
|
143
|
+
requireWrite();
|
|
144
|
+
const userId = await resolveUser(client, args.user);
|
|
145
|
+
const roleId = await resolveRole(client, args.role);
|
|
146
|
+
const existing = await client.queryRecords({ table: 'sys_user_has_role', query: `user=${userId}^role=${roleId}^inherited=false`, limit: 1 });
|
|
147
|
+
if (existing.count === 0)
|
|
148
|
+
throw new ServiceNowError(`No directly-granted role ${args.role} on ${args.user} to revoke`, 'NOT_FOUND');
|
|
149
|
+
await client.deleteRecord('sys_user_has_role', existing.records[0].sys_id);
|
|
150
|
+
return { success: true, summary: `Revoked role ${args.role} from ${args.user}` };
|
|
151
|
+
}
|
|
152
|
+
case 'create_role': {
|
|
153
|
+
requireWrite();
|
|
154
|
+
if (!args.name)
|
|
155
|
+
throw new ServiceNowError('name is required', 'INVALID_REQUEST');
|
|
156
|
+
const payload = { name: args.name, ...(args.fields ?? {}) };
|
|
157
|
+
if (args.description)
|
|
158
|
+
payload.description = args.description;
|
|
159
|
+
const result = await client.createRecord('sys_user_role', payload);
|
|
160
|
+
return { ...result, summary: `Created role "${args.name}"` };
|
|
161
|
+
}
|
|
162
|
+
case 'deactivate_user': {
|
|
163
|
+
requireWrite();
|
|
164
|
+
const userId = await resolveUser(client, args.user);
|
|
165
|
+
const result = await client.updateRecord('sys_user', userId, { active: 'false' });
|
|
166
|
+
return { ...result, summary: `Deactivated user ${args.user}` };
|
|
167
|
+
}
|
|
168
|
+
case 'create_delegation': {
|
|
169
|
+
requireWrite();
|
|
170
|
+
const userId = await resolveUser(client, args.user);
|
|
171
|
+
const delegateId = await resolveUser(client, args.delegate);
|
|
172
|
+
const payload = {
|
|
173
|
+
user: userId,
|
|
174
|
+
delegate: delegateId,
|
|
175
|
+
approvals: args.approvals === false ? 'false' : 'true',
|
|
176
|
+
};
|
|
177
|
+
if (args.assignments !== undefined)
|
|
178
|
+
payload.assignments = args.assignments ? 'true' : 'false';
|
|
179
|
+
if (args.starts)
|
|
180
|
+
payload.starts = args.starts;
|
|
181
|
+
if (args.ends)
|
|
182
|
+
payload.ends = args.ends;
|
|
183
|
+
const result = await client.createRecord('sys_user_delegate', payload);
|
|
184
|
+
return { ...result, summary: `Delegated from ${args.user} to ${args.delegate}` };
|
|
185
|
+
}
|
|
186
|
+
case 'list_group_members': {
|
|
187
|
+
let groupId = args.group;
|
|
188
|
+
if (!/^[0-9a-f]{32}$/i.test(groupId)) {
|
|
189
|
+
const g = await client.queryRecords({ table: 'sys_user_group', query: `name=${args.group}`, limit: 1 });
|
|
190
|
+
if (g.count === 0)
|
|
191
|
+
throw new ServiceNowError(`Group not found: ${args.group}`, 'NOT_FOUND');
|
|
192
|
+
groupId = g.records[0].sys_id;
|
|
193
|
+
}
|
|
194
|
+
return await client.queryRecords({
|
|
195
|
+
table: 'sys_user_grmember',
|
|
196
|
+
query: `group=${groupId}`,
|
|
197
|
+
fields: 'user,user.name,user.user_name,user.email,user.active',
|
|
198
|
+
limit: args.limit ?? 100,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
case 'get_user_entitlements': {
|
|
202
|
+
const userId = await resolveUser(client, args.user);
|
|
203
|
+
const user = await client.getRecord('sys_user', userId);
|
|
204
|
+
const roles = await client.queryRecords({ table: 'sys_user_has_role', query: `user=${userId}`, fields: 'role.name,inherited', limit: 200 }).catch(() => ({ records: [] }));
|
|
205
|
+
const groups = await client.queryRecords({ table: 'sys_user_grmember', query: `user=${userId}`, fields: 'group.name', limit: 200 }).catch(() => ({ records: [] }));
|
|
206
|
+
return {
|
|
207
|
+
user: { sys_id: userId, name: user.name, user_name: user.user_name, active: user.active },
|
|
208
|
+
roles: roles.records,
|
|
209
|
+
groups: groups.records,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
default:
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=access-admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-admin.js","sourceRoot":"","sources":["../../src/tools/access-admin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,KAAK,UAAU,WAAW,CAAC,MAAwB,EAAE,IAAY;IAC/D,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,IAAI,YAAY,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IACpH,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;QAAE,MAAM,IAAI,eAAe,CAAC,mBAAmB,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IACxF,OAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAS,CAAC,MAAM,CAAC;AACzC,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,MAAwB,EAAE,IAAY;IAC/D,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IACpG,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;QAAE,MAAM,IAAI,eAAe,CAAC,mBAAmB,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IACxF,OAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAS,CAA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;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Agent (Now Assist AI Agents) execution observability. Read-only: Tier 0.
|
|
3
|
+
* Strategic for an MCP product — surface how ServiceNow's own agents ran.
|
|
4
|
+
*
|
|
5
|
+
* Tables (Now Assist AI Agents, sn_aia scope; availability depends on release/plugins):
|
|
6
|
+
* sn_aia_execution_plan — agent execution plans/runs
|
|
7
|
+
* sn_aia_execution_plan_step — steps/tool calls within a plan
|
|
8
|
+
* sn_aia_usecase — AI Agent Studio use cases
|
|
9
|
+
*/
|
|
10
|
+
import type { ServiceNowClient } from '../servicenow/client.js';
|
|
11
|
+
export declare function getAiAgentExecToolDefinitions(): ({
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: string;
|
|
16
|
+
properties: {
|
|
17
|
+
status: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
query: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
limit: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
sys_id?: undefined;
|
|
30
|
+
};
|
|
31
|
+
required: never[];
|
|
32
|
+
};
|
|
33
|
+
} | {
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: string;
|
|
38
|
+
properties: {
|
|
39
|
+
sys_id: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
status?: undefined;
|
|
44
|
+
query?: undefined;
|
|
45
|
+
limit?: undefined;
|
|
46
|
+
};
|
|
47
|
+
required: string[];
|
|
48
|
+
};
|
|
49
|
+
} | {
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: string;
|
|
54
|
+
properties: {
|
|
55
|
+
query: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
limit: {
|
|
60
|
+
type: string;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
status?: undefined;
|
|
64
|
+
sys_id?: undefined;
|
|
65
|
+
};
|
|
66
|
+
required: never[];
|
|
67
|
+
};
|
|
68
|
+
})[];
|
|
69
|
+
export declare function executeAiAgentExecToolCall(client: ServiceNowClient, name: string, args: Record<string, any>): Promise<any>;
|
|
70
|
+
//# sourceMappingURL=ai-agent-exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent-exec.d.ts","sourceRoot":"","sources":["../../src/tools/ai-agent-exec.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,wBAAgB,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuC5C;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxB,OAAO,CAAC,GAAG,CAAC,CA2Bd"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ServiceNowError } from '../utils/errors.js';
|
|
2
|
+
export function getAiAgentExecToolDefinitions() {
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
name: 'list_ai_agent_executions',
|
|
6
|
+
description: 'List recent Now Assist AI Agent execution plans (sn_aia_execution_plan)',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
status: { type: 'string', description: 'Filter by execution status' },
|
|
11
|
+
query: { type: 'string', description: 'Encoded query for additional filtering' },
|
|
12
|
+
limit: { type: 'number', description: 'Max records (default 25)' },
|
|
13
|
+
},
|
|
14
|
+
required: [],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'get_ai_agent_execution',
|
|
19
|
+
description: 'Get an AI Agent execution plan with its steps/tool calls (sn_aia_execution_plan + _step)',
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
sys_id: { type: 'string', description: 'sys_id of the execution plan' },
|
|
24
|
+
},
|
|
25
|
+
required: ['sys_id'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'list_agent_use_cases',
|
|
30
|
+
description: 'List AI Agent Studio use cases (sn_aia_usecase) and their configuration',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
query: { type: 'string', description: 'Search use cases by name' },
|
|
35
|
+
limit: { type: 'number', description: 'Max records (default 50)' },
|
|
36
|
+
},
|
|
37
|
+
required: [],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
export async function executeAiAgentExecToolCall(client, name, args) {
|
|
43
|
+
switch (name) {
|
|
44
|
+
case 'list_ai_agent_executions': {
|
|
45
|
+
const parts = [];
|
|
46
|
+
if (args.status)
|
|
47
|
+
parts.push(`status=${args.status}`);
|
|
48
|
+
if (args.query)
|
|
49
|
+
parts.push(args.query);
|
|
50
|
+
return await client.queryRecords({
|
|
51
|
+
table: 'sn_aia_execution_plan',
|
|
52
|
+
query: parts.join('^') + (parts.length ? '^' : '') + 'ORDERBYDESCsys_created_on',
|
|
53
|
+
limit: args.limit ?? 25,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
case 'get_ai_agent_execution': {
|
|
57
|
+
if (!args.sys_id)
|
|
58
|
+
throw new ServiceNowError('sys_id is required', 'INVALID_REQUEST');
|
|
59
|
+
const plan = await client.getRecord('sn_aia_execution_plan', args.sys_id);
|
|
60
|
+
const steps = await client
|
|
61
|
+
.queryRecords({ table: 'sn_aia_execution_plan_step', query: `execution_plan=${args.sys_id}^ORDERBYorder`, limit: 200 })
|
|
62
|
+
.catch(() => ({ records: [] }));
|
|
63
|
+
return { execution_plan: plan, steps: steps.records };
|
|
64
|
+
}
|
|
65
|
+
case 'list_agent_use_cases': {
|
|
66
|
+
const query = args.query ? `nameCONTAINS${args.query}` : '';
|
|
67
|
+
return await client.queryRecords({ table: 'sn_aia_usecase', query, limit: args.limit ?? 50 });
|
|
68
|
+
}
|
|
69
|
+
default:
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=ai-agent-exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent-exec.js","sourceRoot":"","sources":["../../src/tools/ai-agent-exec.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,UAAU,6BAA6B;IAC3C,OAAO;QACL;YACE,IAAI,EAAE,0BAA0B;YAChC,WAAW,EAAE,yEAAyE;YACtF,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;oBACrE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;oBAChF,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;iBACnE;gBACD,QAAQ,EAAE,EAAE;aACb;SACF;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,WAAW,EAAE,0FAA0F;YACvG,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE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AAI,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,uBAAuB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1E,MAAM,KAAK,GAAG,MAAM,MAAM;iBACvB,YAAY,CAAC,EAAE,KAAK,EAAE,4BAA4B,EAAE,KAAK,EAAE,kBAAkB,IAAI,CAAC,MAAM,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;iBACtH,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAClC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAG,KAAa,CAAC,OAAO,EAAE,CAAC;QACjE,CAAC;QACD,KAAK,sBAAsB,CAAC,CAAC,CAAC;YAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,OAAO,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QAChG,CAAC;QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approval-management parity tools — matches ServiceNow's Advanced Approval Management AI
|
|
3
|
+
* MCP surface (quotes, ad-hoc approvers, routing preview, recall, history) but generalized
|
|
4
|
+
* to any approvable record, not just CPQ quotes. Read: Tier 0. Actions: Tier 1 (WRITE_ENABLED).
|
|
5
|
+
*
|
|
6
|
+
* Tables:
|
|
7
|
+
* sysapproval_approver — approval requests (the approver rows)
|
|
8
|
+
* sysapproval_group — approval groups
|
|
9
|
+
* sn_quote / sn_sales_quote / quote — CPQ quotes (name varies by version)
|
|
10
|
+
* wf_approval / sys_approval_rule — routing definitions
|
|
11
|
+
*/
|
|
12
|
+
import type { ServiceNowClient } from '../servicenow/client.js';
|
|
13
|
+
export declare function getApprovalsExtraToolDefinitions(): ({
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: string;
|
|
18
|
+
properties: {
|
|
19
|
+
number: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
sys_id: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
table: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
state?: undefined;
|
|
32
|
+
account?: undefined;
|
|
33
|
+
limit?: undefined;
|
|
34
|
+
record?: undefined;
|
|
35
|
+
approver?: undefined;
|
|
36
|
+
source_table?: undefined;
|
|
37
|
+
approval_field?: undefined;
|
|
38
|
+
};
|
|
39
|
+
required: never[];
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: string;
|
|
46
|
+
properties: {
|
|
47
|
+
table: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
state: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
account: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
limit: {
|
|
60
|
+
type: string;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
number?: undefined;
|
|
64
|
+
sys_id?: undefined;
|
|
65
|
+
record?: undefined;
|
|
66
|
+
approver?: undefined;
|
|
67
|
+
source_table?: undefined;
|
|
68
|
+
approval_field?: undefined;
|
|
69
|
+
};
|
|
70
|
+
required: never[];
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
name: string;
|
|
74
|
+
description: string;
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: string;
|
|
77
|
+
properties: {
|
|
78
|
+
record: {
|
|
79
|
+
type: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
limit: {
|
|
83
|
+
type: string;
|
|
84
|
+
description: string;
|
|
85
|
+
};
|
|
86
|
+
number?: undefined;
|
|
87
|
+
sys_id?: undefined;
|
|
88
|
+
table?: undefined;
|
|
89
|
+
state?: undefined;
|
|
90
|
+
account?: undefined;
|
|
91
|
+
approver?: undefined;
|
|
92
|
+
source_table?: undefined;
|
|
93
|
+
approval_field?: undefined;
|
|
94
|
+
};
|
|
95
|
+
required: string[];
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
name: string;
|
|
99
|
+
description: string;
|
|
100
|
+
inputSchema: {
|
|
101
|
+
type: string;
|
|
102
|
+
properties: {
|
|
103
|
+
record: {
|
|
104
|
+
type: string;
|
|
105
|
+
description: string;
|
|
106
|
+
};
|
|
107
|
+
table: {
|
|
108
|
+
type: string;
|
|
109
|
+
description: string;
|
|
110
|
+
};
|
|
111
|
+
number?: undefined;
|
|
112
|
+
sys_id?: undefined;
|
|
113
|
+
state?: undefined;
|
|
114
|
+
account?: undefined;
|
|
115
|
+
limit?: undefined;
|
|
116
|
+
approver?: undefined;
|
|
117
|
+
source_table?: undefined;
|
|
118
|
+
approval_field?: undefined;
|
|
119
|
+
};
|
|
120
|
+
required: string[];
|
|
121
|
+
};
|
|
122
|
+
} | {
|
|
123
|
+
name: string;
|
|
124
|
+
description: string;
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: string;
|
|
127
|
+
properties: {
|
|
128
|
+
record: {
|
|
129
|
+
type: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
approver: {
|
|
133
|
+
type: string;
|
|
134
|
+
description: string;
|
|
135
|
+
};
|
|
136
|
+
source_table: {
|
|
137
|
+
type: string;
|
|
138
|
+
description: string;
|
|
139
|
+
};
|
|
140
|
+
number?: undefined;
|
|
141
|
+
sys_id?: undefined;
|
|
142
|
+
table?: undefined;
|
|
143
|
+
state?: undefined;
|
|
144
|
+
account?: undefined;
|
|
145
|
+
limit?: undefined;
|
|
146
|
+
approval_field?: undefined;
|
|
147
|
+
};
|
|
148
|
+
required: string[];
|
|
149
|
+
};
|
|
150
|
+
} | {
|
|
151
|
+
name: string;
|
|
152
|
+
description: string;
|
|
153
|
+
inputSchema: {
|
|
154
|
+
type: string;
|
|
155
|
+
properties: {
|
|
156
|
+
record: {
|
|
157
|
+
type: string;
|
|
158
|
+
description: string;
|
|
159
|
+
};
|
|
160
|
+
number?: undefined;
|
|
161
|
+
sys_id?: undefined;
|
|
162
|
+
table?: undefined;
|
|
163
|
+
state?: undefined;
|
|
164
|
+
account?: undefined;
|
|
165
|
+
limit?: undefined;
|
|
166
|
+
approver?: undefined;
|
|
167
|
+
source_table?: undefined;
|
|
168
|
+
approval_field?: undefined;
|
|
169
|
+
};
|
|
170
|
+
required: string[];
|
|
171
|
+
};
|
|
172
|
+
} | {
|
|
173
|
+
name: string;
|
|
174
|
+
description: string;
|
|
175
|
+
inputSchema: {
|
|
176
|
+
type: string;
|
|
177
|
+
properties: {
|
|
178
|
+
table: {
|
|
179
|
+
type: string;
|
|
180
|
+
description: string;
|
|
181
|
+
};
|
|
182
|
+
sys_id: {
|
|
183
|
+
type: string;
|
|
184
|
+
description: string;
|
|
185
|
+
};
|
|
186
|
+
approval_field: {
|
|
187
|
+
type: string;
|
|
188
|
+
description: string;
|
|
189
|
+
};
|
|
190
|
+
number?: undefined;
|
|
191
|
+
state?: undefined;
|
|
192
|
+
account?: undefined;
|
|
193
|
+
limit?: undefined;
|
|
194
|
+
record?: undefined;
|
|
195
|
+
approver?: undefined;
|
|
196
|
+
source_table?: undefined;
|
|
197
|
+
};
|
|
198
|
+
required: string[];
|
|
199
|
+
};
|
|
200
|
+
})[];
|
|
201
|
+
export declare function executeApprovalsExtraToolCall(client: ServiceNowClient, name: string, args: Record<string, any>): Promise<any>;
|
|
202
|
+
//# sourceMappingURL=approvals-extra.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals-extra.d.ts","sourceRoot":"","sources":["../../src/tools/approvals-extra.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAMhE,wBAAgB,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2F/C;AAYD,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxB,OAAO,CAAC,GAAG,CAAC,CAuFd"}
|