sap-ai-dev-toolkit 0.9.9922 → 0.9.9923
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/.github/agents/sap-btp-infrastructure-admin.agent.md +23 -0
- package/.github/agents/sap-bw-datasphere-migration-specialist.agent.md +22 -0
- package/.github/agents/sap-datasphere-developer.agent.md +22 -0
- package/.github/agents/sap-devops-observability-specialist.agent.md +54 -0
- package/.github/agents/sap-process-automation-developer.agent.md +50 -0
- package/.github/skills/btp-platform-administration/SKILL.md +53 -0
- package/.github/skills/bw-datasphere-migration/SKILL.md +66 -0
- package/.github/skills/cloud-alm-operations/SKILL.md +135 -0
- package/.github/skills/datasphere-administration/SKILL.md +40 -0
- package/.github/skills/datasphere-development/SKILL.md +55 -0
- package/.github/skills/process-automation-development/SKILL.md +113 -0
- package/README.md +152 -8
- package/inventory.md +60 -0
- package/package.json +8 -2
- package/src/btp-cli.mjs +199 -0
- package/src/btp-server.mjs +125 -0
- package/src/btp-tools.mjs +776 -0
- package/src/cloud-alm-client.mjs +44 -0
- package/src/cloud-alm-config.mjs +92 -0
- package/src/cloud-alm-credentials.mjs +29 -0
- package/src/cloud-alm-data.mjs +129 -0
- package/src/cloud-alm-server.mjs +115 -0
- package/src/cloud-alm-tools.mjs +682 -0
- package/src/datasphere-auth.mjs +279 -0
- package/src/datasphere-cli.mjs +220 -0
- package/src/datasphere-command.mjs +236 -0
- package/src/datasphere-config.mjs +154 -0
- package/src/datasphere-credentials.mjs +37 -0
- package/src/datasphere-csn.mjs +73 -0
- package/src/datasphere-discovery.mjs +151 -0
- package/src/datasphere-server.mjs +249 -0
- package/src/datasphere-tools.mjs +809 -0
- package/src/hana-database.mjs +3 -3
- package/src/hana-inspector.mjs +2 -2
- package/src/harnesses.mjs +31 -1
- package/src/install-user-assets.mjs +1 -1
- package/src/integration-common.mjs +7 -7
- package/src/integration-config.mjs +5 -0
- package/src/integration-credentials.mjs +25 -16
- package/src/integration-http.mjs +24 -7
- package/src/launcher.mjs +56 -4
- package/src/mcp-config.mjs +37 -1
- package/src/process-automation-automation-tools.mjs +125 -0
- package/src/process-automation-client.mjs +36 -0
- package/src/process-automation-common.mjs +69 -0
- package/src/process-automation-config.mjs +142 -0
- package/src/process-automation-credentials.mjs +37 -0
- package/src/process-automation-inbox-tools.mjs +246 -0
- package/src/process-automation-server.mjs +139 -0
- package/src/process-automation-tools.mjs +727 -0
- package/src/process-automation-visibility-tools.mjs +182 -0
- package/src/setup.mjs +623 -11
- package/tools.md +138 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// SAP Build Process Automation process visibility tools (SPA_Visibility_Scenario + SPA_Visibility_Workspace).
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
CREATE_ANNOTATIONS,
|
|
5
|
+
OVERWRITE_ANNOTATIONS,
|
|
6
|
+
READ_ONLY_ANNOTATIONS,
|
|
7
|
+
confirmation,
|
|
8
|
+
requireConfirmation
|
|
9
|
+
} from './integration-common.mjs';
|
|
10
|
+
import { VISIBILITY, enc, identifier, odataString, payload, skip, timestamp, top } from './process-automation-common.mjs';
|
|
11
|
+
|
|
12
|
+
export const VISIBILITY_TOOL_NAMES = Object.freeze([
|
|
13
|
+
'bpa_list_visibility_scenarios',
|
|
14
|
+
'bpa_get_visibility_scenario',
|
|
15
|
+
'bpa_process_visibility_scenario',
|
|
16
|
+
'bpa_clear_visibility_data',
|
|
17
|
+
'bpa_list_visibility_events',
|
|
18
|
+
'bpa_push_visibility_events',
|
|
19
|
+
'bpa_list_visibility_workspace_scenarios',
|
|
20
|
+
'bpa_list_visibility_instances',
|
|
21
|
+
'bpa_get_visibility_instance'
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const REST = `${VISIBILITY}/rest/v1`;
|
|
25
|
+
const ODATA = `${VISIBILITY}/odata/v1`;
|
|
26
|
+
const text = max => z.string().min(1).max(max);
|
|
27
|
+
const scenarioId = identifier('visibility scenario id');
|
|
28
|
+
|
|
29
|
+
const EVENT_PARAMS = ['process_definition_id', 'process_instance_id', 'event_type', 'environment_id', 'acquired_from', 'acquired_up_to'];
|
|
30
|
+
const ERROR_PARAMS = ['log_id', 'start_date_time', 'end_date_time'];
|
|
31
|
+
|
|
32
|
+
const visibilityEvent = z.object({
|
|
33
|
+
processDefinitionId: text(255),
|
|
34
|
+
processInstanceId: text(255),
|
|
35
|
+
eventType: text(255),
|
|
36
|
+
timestamp: text(64),
|
|
37
|
+
eventId: text(255).optional(),
|
|
38
|
+
activityDefinitionId: text(255).optional(),
|
|
39
|
+
activityInstanceId: text(255).optional(),
|
|
40
|
+
activityType: text(255).optional(),
|
|
41
|
+
activityName: text(255).optional(),
|
|
42
|
+
activityStatus: text(255).optional(),
|
|
43
|
+
eventName: text(255).optional(),
|
|
44
|
+
processVersionId: text(255).optional(),
|
|
45
|
+
userDisplayName: text(255).optional(),
|
|
46
|
+
userId: text(255).optional(),
|
|
47
|
+
context: payload.optional()
|
|
48
|
+
}).strict();
|
|
49
|
+
|
|
50
|
+
export function registerVisibilityTools(register, { rest }) {
|
|
51
|
+
const scenarioPath = id => `${REST}/scenario-definitions/${enc(id)}`;
|
|
52
|
+
const instancePath = (scenario, id) => `${ODATA}/${enc(scenario)}/Instances(${enc(odataString(id))})`;
|
|
53
|
+
|
|
54
|
+
register('bpa_list_visibility_scenarios', 'List visibility scenarios',
|
|
55
|
+
'List deployed process visibility scenario definitions. Requires the PVAdmin role.',
|
|
56
|
+
{}, READ_ONLY_ANNOTATIONS,
|
|
57
|
+
() => rest.request('GET', `${REST}/scenario-definitions`));
|
|
58
|
+
|
|
59
|
+
register('bpa_get_visibility_scenario', 'Get visibility scenario',
|
|
60
|
+
'Get a deployed visibility scenario definition, optionally with its model and its 20 most recent data-processing executions. Requires PVAdmin.',
|
|
61
|
+
{
|
|
62
|
+
scenario_id: scenarioId,
|
|
63
|
+
include: z.array(z.enum(['model', 'executions'])).max(2).default([]),
|
|
64
|
+
execution_status: text(64).optional().describe('Filter executions by status.')
|
|
65
|
+
}, READ_ONLY_ANNOTATIONS,
|
|
66
|
+
async ({ scenario_id, include, execution_status }) => {
|
|
67
|
+
const base = scenarioPath(scenario_id);
|
|
68
|
+
const result = { scenario: await rest.request('GET', base) };
|
|
69
|
+
if (include.includes('model')) result.model = await rest.request('GET', `${base}/model`);
|
|
70
|
+
if (include.includes('executions')) {
|
|
71
|
+
result.executions = await rest.request('GET', `${base}/data-executions`, execution_status ? { query: { status: execution_status } } : {});
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
register('bpa_process_visibility_scenario', 'Process visibility scenario data',
|
|
77
|
+
'Trigger processing of the attributes and visibility patterns of a scenario model (asynchronous, HTTP 202). Requires PVAdmin.',
|
|
78
|
+
{ scenario_id: scenarioId, confirmation }, CREATE_ANNOTATIONS,
|
|
79
|
+
async ({ scenario_id, confirmation: given }) => {
|
|
80
|
+
requireConfirmation(given, `PROCESS BPA VISIBILITY ${scenario_id}`);
|
|
81
|
+
const { status } = await rest.request('POST', `${scenarioPath(scenario_id)}/data-executions`, {
|
|
82
|
+
expect: [202], responseType: 'none', withStatus: true
|
|
83
|
+
});
|
|
84
|
+
return { accepted: true, status, scenario_id };
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
register('bpa_clear_visibility_data', 'Clear visibility data',
|
|
88
|
+
'Clear processed visibility data of the given scenario instances. Requires PVAdmin.',
|
|
89
|
+
{ scenario_id: scenarioId, instance_ids: z.array(text(255)).min(1).max(1000), confirmation }, OVERWRITE_ANNOTATIONS,
|
|
90
|
+
async ({ scenario_id, instance_ids, confirmation: given }) => {
|
|
91
|
+
requireConfirmation(given, `CLEAR BPA VISIBILITY DATA ${scenario_id}`);
|
|
92
|
+
await rest.request('PATCH', `${scenarioPath(scenario_id)}/data`, {
|
|
93
|
+
json: instance_ids.map(id => ({ id, deleted: true })), expect: [200, 204], responseType: 'none'
|
|
94
|
+
});
|
|
95
|
+
return { cleared: instance_ids.length, scenario_id };
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
register('bpa_list_visibility_events', 'List acquired visibility events',
|
|
99
|
+
'List acquired visibility events (kind events, max 5000; PVAdmin or PVTenantOperator) or data-acquisition errors (kind errors; PVAdmin).',
|
|
100
|
+
z.object({
|
|
101
|
+
kind: z.enum(['events', 'errors']).default('events'),
|
|
102
|
+
process_definition_id: text(255).optional(),
|
|
103
|
+
process_instance_id: text(255).optional(),
|
|
104
|
+
event_type: text(255).optional(),
|
|
105
|
+
environment_id: text(128).optional(),
|
|
106
|
+
acquired_from: timestamp.optional(),
|
|
107
|
+
acquired_up_to: timestamp.optional(),
|
|
108
|
+
log_id: text(255).optional(),
|
|
109
|
+
start_date_time: timestamp.optional(),
|
|
110
|
+
end_date_time: timestamp.optional()
|
|
111
|
+
}).superRefine((value, ctx) => {
|
|
112
|
+
const foreign = (value.kind === 'events' ? ERROR_PARAMS : EVENT_PARAMS).filter(key => value[key] !== undefined);
|
|
113
|
+
if (foreign.length) {
|
|
114
|
+
ctx.addIssue({ code: 'custom', path: [foreign[0]], message: `${foreign.join(', ')} not allowed with kind ${value.kind}` });
|
|
115
|
+
}
|
|
116
|
+
}), READ_ONLY_ANNOTATIONS,
|
|
117
|
+
async args => {
|
|
118
|
+
if (args.kind === 'errors') {
|
|
119
|
+
return rest.request('GET', `${REST}/data-acquisition/error-messages`, { query: {
|
|
120
|
+
logId: args.log_id, startDateTime: args.start_date_time, endDateTime: args.end_date_time
|
|
121
|
+
} });
|
|
122
|
+
}
|
|
123
|
+
return rest.request('GET', `${REST}/data-acquisition/data`, { query: {
|
|
124
|
+
processDefinitionId: args.process_definition_id,
|
|
125
|
+
processInstanceId: args.process_instance_id,
|
|
126
|
+
eventType: args.event_type,
|
|
127
|
+
environmentId: args.environment_id,
|
|
128
|
+
acquiredFrom: args.acquired_from,
|
|
129
|
+
acquiredUpto: args.acquired_up_to
|
|
130
|
+
} });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
register('bpa_push_visibility_events', 'Push visibility events',
|
|
134
|
+
'Push process events to process visibility. Requires the PVEventSender role.',
|
|
135
|
+
{ events: z.array(visibilityEvent).min(1).max(1000), confirmation }, CREATE_ANNOTATIONS,
|
|
136
|
+
async ({ events, confirmation: given }) => {
|
|
137
|
+
requireConfirmation(given, `PUSH BPA VISIBILITY EVENTS ${events.length}`);
|
|
138
|
+
await rest.request('POST', `${REST}/data-acquisition/data`, { json: events, expect: [204], responseType: 'none' });
|
|
139
|
+
return { pushed: events.length };
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
register('bpa_list_visibility_workspace_scenarios', 'List visibility workspace scenarios',
|
|
143
|
+
'List metadata of visibility scenarios the user can access in the workspace. Requires PVOperator or PVRestrictedOperator.',
|
|
144
|
+
{ select: text(500).optional() }, READ_ONLY_ANNOTATIONS,
|
|
145
|
+
({ select }) => rest.request('GET', `${ODATA}/metadata/Scenarios`, { query: { $select: select } }));
|
|
146
|
+
|
|
147
|
+
register('bpa_list_visibility_instances', 'List visibility scenario instances',
|
|
148
|
+
'List instances of a visibility scenario with OData options. Requires PVOperator or PVRestrictedOperator.',
|
|
149
|
+
{
|
|
150
|
+
scenario_id: scenarioId,
|
|
151
|
+
filter: text(2000).optional().describe("OData $filter, e.g. status eq 'RUNNING'."),
|
|
152
|
+
select: text(500).optional(),
|
|
153
|
+
orderby: text(200).optional(),
|
|
154
|
+
expand: text(200).optional(),
|
|
155
|
+
search: text(255).optional().describe('Free-text search (sent as search=\'text\').'),
|
|
156
|
+
top: top(200, 50),
|
|
157
|
+
skip,
|
|
158
|
+
inline_count: z.boolean().default(false)
|
|
159
|
+
}, READ_ONLY_ANNOTATIONS,
|
|
160
|
+
({ scenario_id, filter, select, orderby, expand, search, top: $top, skip: $skip, inline_count }) =>
|
|
161
|
+
rest.request('GET', `${ODATA}/${enc(scenario_id)}/Instances`, { query: {
|
|
162
|
+
$filter: filter, $select: select, $orderby: orderby, $expand: expand,
|
|
163
|
+
search: search === undefined ? undefined : odataString(search),
|
|
164
|
+
$top, $skip, ...(inline_count ? { $inlinecount: 'allpages' } : {}), $format: 'json'
|
|
165
|
+
} }));
|
|
166
|
+
|
|
167
|
+
register('bpa_get_visibility_instance', 'Get visibility scenario instance',
|
|
168
|
+
'Get a visibility scenario instance, optionally with its phases, paths and steps. Requires PVOperator or PVRestrictedOperator.',
|
|
169
|
+
{
|
|
170
|
+
scenario_id: scenarioId,
|
|
171
|
+
instance_id: text(255),
|
|
172
|
+
include: z.array(z.enum(['phases', 'paths', 'steps'])).max(3).default([])
|
|
173
|
+
}, READ_ONLY_ANNOTATIONS,
|
|
174
|
+
async ({ scenario_id, instance_id, include }) => {
|
|
175
|
+
const base = instancePath(scenario_id, instance_id);
|
|
176
|
+
const result = { instance: await rest.request('GET', base) };
|
|
177
|
+
for (const part of ['phases', 'paths', 'steps']) {
|
|
178
|
+
if (include.includes(part)) result[part] = await rest.request('GET', `${base}/${part[0].toUpperCase()}${part.slice(1)}`);
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
181
|
+
});
|
|
182
|
+
}
|