@uipath/agent-tool 1.200.0-preview.109 → 1.201.0-preview.115
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/{agent-project-service-j3sst5cf.js → agent-project-service-wyh0r5cb.js} +3 -3
- package/dist/agent-tool-OK5DK57D-mxt5stp9.js +12 -0
- package/dist/{browser-strategy-v4n9zxyf.js → browser-strategy-16yagjhr.js} +1 -1
- package/dist/executor-tool.js +296 -0
- package/dist/{index-b13x0rpx.js → index-3pq4x5b7.js} +12 -9
- package/dist/index-9f8q2ege.js +2058 -0
- package/dist/{packager-tool-mf36zc9b.js → index-hsadteg4.js} +41 -253
- package/dist/{index-p0nmgr54.js → index-p052hv12.js} +5 -5
- package/dist/{index-08fsnqg0.js → index-rqfxg3fq.js} +1 -1
- package/dist/index.js +14 -12
- package/dist/{integration-tool-service-z414k85p.js → integration-tool-service-dgk5br9n.js} +4 -4
- package/dist/{is-client-m0srzs8p.js → is-client-7pyb4pet.js} +3 -3
- package/dist/js-yaml-cggj6w7q.js +3145 -0
- package/dist/{packager-tool-jmzese1s.js → node-strategy-1r3qegaf.js} +62 -32
- package/dist/packager-tool-4fge2k9c.js +419 -0
- package/dist/{packager-tool-9tv93r4w.js → packager-tool-b098y4a2.js} +2 -418
- package/dist/{packager-tool-dcazs5r7.js → packager-tool-expj850v.js} +6 -4
- package/dist/{packager-tool-fzq5y98q.js → packager-tool-ftfbnjpc.js} +2 -2
- package/dist/{packager-tool-yet9qmnt.js → packager-tool-fz1pzt1z.js} +93 -21
- package/dist/{packager-tool-wfbw3w4y.js → packager-tool-hxd8e3e6.js} +120 -5152
- package/dist/{packager-tool-1snc64g4.js → packager-tool-q42rrs00.js} +3 -2
- package/dist/packager-tool-qa9gftnj.js +31 -0
- package/dist/packager-tool-rev4tnf6.js +8340 -0
- package/dist/{packager-tool-k0e3bv7y.js → packager-tool-ty88v0fy.js} +5 -5
- package/dist/{packager-tool-wywyn3hw.js → packager-tool-xz142g61.js} +807 -8956
- package/dist/packager-tool-yv3rvyas.js +239 -0
- package/dist/packager-tool.js +5 -4
- package/dist/tool.js +14 -12
- package/package.json +4 -3
- package/dist/agent-tool-OK5DK57D-8nt05j7t.js +0 -11
- package/dist/node-strategy-cvesesna.js +0 -65
|
@@ -1,39 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
catchError
|
|
3
|
+
} from "./packager-tool-qa9gftnj.js";
|
|
4
|
+
import {
|
|
5
|
+
getFileSystem
|
|
6
|
+
} from "./packager-tool-yv3rvyas.js";
|
|
1
7
|
import {
|
|
2
8
|
AUTH_CANCELLED_ERROR_CODE,
|
|
9
|
+
AUTH_TIMEOUT_ERROR_CODE,
|
|
3
10
|
DEFAULT_AUTH_TIMEOUT_MS
|
|
4
|
-
} from "./packager-tool-
|
|
11
|
+
} from "./packager-tool-q42rrs00.js";
|
|
5
12
|
import {
|
|
6
13
|
__require
|
|
7
14
|
} from "./packager-tool-wckvcay0.js";
|
|
8
15
|
|
|
9
|
-
// ../auth/src/catch-error.ts
|
|
10
|
-
function isPromiseLike(value) {
|
|
11
|
-
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
12
|
-
}
|
|
13
|
-
function catchError(fnOrPromise) {
|
|
14
|
-
if (isPromiseLike(fnOrPromise)) {
|
|
15
|
-
return settlePromiseLike(fnOrPromise);
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const result = fnOrPromise();
|
|
19
|
-
if (isPromiseLike(result)) {
|
|
20
|
-
return settlePromiseLike(result);
|
|
21
|
-
}
|
|
22
|
-
return [undefined, result];
|
|
23
|
-
} catch (error) {
|
|
24
|
-
return [
|
|
25
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
26
|
-
undefined
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function settlePromiseLike(thenable) {
|
|
31
|
-
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
32
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
33
|
-
undefined
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
16
|
// ../auth/src/getBaseHtml.ts
|
|
38
17
|
var escapeHtml = (value) => value.replace(/[&<>"']/g, (char) => {
|
|
39
18
|
switch (char) {
|
|
@@ -198,7 +177,6 @@ var getBaseHtml = ({ title, message, type }) => {
|
|
|
198
177
|
};
|
|
199
178
|
|
|
200
179
|
// ../auth/src/server.ts
|
|
201
|
-
var AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT";
|
|
202
180
|
var startServer = async ({
|
|
203
181
|
redirectUri,
|
|
204
182
|
timeoutMs = DEFAULT_AUTH_TIMEOUT_MS,
|
|
@@ -315,6 +293,58 @@ var startServer = async ({
|
|
|
315
293
|
});
|
|
316
294
|
};
|
|
317
295
|
|
|
318
|
-
|
|
296
|
+
// ../auth/src/strategies/node-strategy.ts
|
|
297
|
+
class NodeAuthStrategy {
|
|
298
|
+
async execute(url, redirectUri, expectedState, opts) {
|
|
299
|
+
const fs = getFileSystem();
|
|
300
|
+
const callbackUrl = await startServer({
|
|
301
|
+
redirectUri,
|
|
302
|
+
timeoutMs: opts?.timeoutMs,
|
|
303
|
+
signal: opts?.signal,
|
|
304
|
+
onListening: async () => {
|
|
305
|
+
let safeUrl = "";
|
|
306
|
+
for (const ch of url) {
|
|
307
|
+
const c = ch.charCodeAt(0);
|
|
308
|
+
if (c > 31 && (c < 128 || c > 159))
|
|
309
|
+
safeUrl += ch;
|
|
310
|
+
}
|
|
311
|
+
if (opts?.noBrowser) {
|
|
312
|
+
if (!opts.onAuthUrl) {
|
|
313
|
+
throw new Error("Headless login (noBrowser) requires an onAuthUrl handler " + "to surface the authorize URL, but none was provided.");
|
|
314
|
+
}
|
|
315
|
+
opts.onAuthUrl(safeUrl);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const [openError] = await catchError(fs.utils.open(url));
|
|
319
|
+
if (!openError)
|
|
320
|
+
return;
|
|
321
|
+
const isSpawnError = "code" in openError && openError.code === "ENOENT";
|
|
322
|
+
if (isSpawnError) {
|
|
323
|
+
throw new Error("Could not open a browser. No supported browser launcher was found. " + `On a headless or minimal system, use non-interactive login instead:
|
|
324
|
+
|
|
325
|
+
` + ` uip login --client-id <id> --client-secret <secret> -t <tenant>
|
|
326
|
+
|
|
327
|
+
` + "Or install a browser opener for your OS (e.g. xdg-utils on Linux).", { cause: openError });
|
|
328
|
+
}
|
|
329
|
+
throw new Error("Could not open the browser automatically. " + `Visit this URL to authenticate:
|
|
330
|
+
|
|
331
|
+
${safeUrl}
|
|
332
|
+
`, { cause: openError });
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
const returnedState = callbackUrl.searchParams.get("state");
|
|
336
|
+
if (returnedState !== expectedState) {
|
|
337
|
+
throw new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again.");
|
|
338
|
+
}
|
|
339
|
+
const code = callbackUrl.searchParams.get("code");
|
|
340
|
+
if (!code) {
|
|
341
|
+
throw new Error("No authorization code received");
|
|
342
|
+
}
|
|
343
|
+
return code;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
export {
|
|
347
|
+
NodeAuthStrategy
|
|
348
|
+
};
|
|
319
349
|
|
|
320
|
-
//# debugId=
|
|
350
|
+
//# debugId=0F4DA8833B84D12264756E2164756E21
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
// ../../node_modules/@uipath/tool-agent/dist/chunk-UWHPEJIJ.js
|
|
2
|
+
var BindingsConstants = {
|
|
3
|
+
ProcessResource: "process",
|
|
4
|
+
ConnectionResource: "connection",
|
|
5
|
+
IndexResource: "index",
|
|
6
|
+
McpResource: "mcpServer",
|
|
7
|
+
MemorySpaceResource: "memorySpace",
|
|
8
|
+
AppResource: "app",
|
|
9
|
+
AssetResource: "asset",
|
|
10
|
+
BucketResource: "bucket",
|
|
11
|
+
IxpResource: "ixp",
|
|
12
|
+
DataFabricEntityResource: "entity",
|
|
13
|
+
RemoteA2aAgentResource: "remoteA2aAgent",
|
|
14
|
+
VsEscalationType: 1,
|
|
15
|
+
BindingsModelVersion: "2.0",
|
|
16
|
+
BindingsValueNameKey: "name",
|
|
17
|
+
BindingsValueVersionKey: "version",
|
|
18
|
+
BindingsValueConnectionIdKey: "connectionId",
|
|
19
|
+
BindingsValueProcessNameDisplayName: "Process name",
|
|
20
|
+
BindingsValueConnectionIdDisplayName: "Connection ID",
|
|
21
|
+
BindingsValueByomConnectionIdDisplayName: "Model connection ID",
|
|
22
|
+
BindingsValueIndexNameDisplayName: "Index Name",
|
|
23
|
+
BindingsValueSlugDisplayName: "Slug",
|
|
24
|
+
BindingsValueMemoryNameDisplayName: "Memory name",
|
|
25
|
+
BindingsValueAppNameDisplayName: "App name",
|
|
26
|
+
BindingsValueAssetNameDisplayName: "Asset Name",
|
|
27
|
+
BindingsValueBucketNameDisplayName: "Storage Bucket Name",
|
|
28
|
+
BindingsValueIxpProjectNameDisplayName: "IXP project name",
|
|
29
|
+
BindingsValueIxpProjectVersionDisplayName: "IXP project version",
|
|
30
|
+
BindingsValueDataFabricEntityNameDisplayName: "Entity name",
|
|
31
|
+
BindingsValueFolderPathKey: "folderPath",
|
|
32
|
+
BindingsValueFolderPathDisplayName: "Folder path",
|
|
33
|
+
BindingsMetadataSubTypeKey: "subType",
|
|
34
|
+
BindingsMetadataConnectorKey: "connector",
|
|
35
|
+
BindingsMetadataUseConnectionServiceKey: "useConnectionService",
|
|
36
|
+
BindingsMetadataVersionKey: "bindingsVersion",
|
|
37
|
+
BindingsMetadataSolutionsSupport: "solutionsSupport",
|
|
38
|
+
BindingsMetadataAgentSubType: "agent",
|
|
39
|
+
BindingsMetadataProcessSubType: "process",
|
|
40
|
+
BindingsMetadataApiWorkflowSubType: "api",
|
|
41
|
+
BindingsMetadataAgenticProcessSubType: "processOrchestration",
|
|
42
|
+
BindingsMetadataFlowSubType: "flow",
|
|
43
|
+
BindingsMetadataFunctionSubType: "function",
|
|
44
|
+
BindingsMetadataVersion: "2.2",
|
|
45
|
+
BindingsMetadataTrue: "true"
|
|
46
|
+
};
|
|
47
|
+
var ASSET_RECIPIENT_TYPES = /* @__PURE__ */ new Set([4, 6]);
|
|
48
|
+
var SOLUTION_FOLDER_SENTINEL = "solution_folder";
|
|
49
|
+
function isAssetRecipientType(type) {
|
|
50
|
+
return ASSET_RECIPIENT_TYPES.has(type);
|
|
51
|
+
}
|
|
52
|
+
function createBindingValue(defaultValue, displayName) {
|
|
53
|
+
return { defaultValue, isExpression: false, displayName };
|
|
54
|
+
}
|
|
55
|
+
function defaultMetadata() {
|
|
56
|
+
return {
|
|
57
|
+
[BindingsConstants.BindingsMetadataVersionKey]: BindingsConstants.BindingsMetadataVersion,
|
|
58
|
+
[BindingsConstants.BindingsMetadataSolutionsSupport]: BindingsConstants.BindingsMetadataTrue
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function resolveFolderPathBindingValue(raw) {
|
|
62
|
+
if (!raw || raw === SOLUTION_FOLDER_SENTINEL)
|
|
63
|
+
return;
|
|
64
|
+
return raw;
|
|
65
|
+
}
|
|
66
|
+
function addFolderPathToValue(value, raw) {
|
|
67
|
+
const resolved = resolveFolderPathBindingValue(raw);
|
|
68
|
+
if (resolved === undefined)
|
|
69
|
+
return;
|
|
70
|
+
value[BindingsConstants.BindingsValueFolderPathKey] = createBindingValue(resolved, BindingsConstants.BindingsValueFolderPathDisplayName);
|
|
71
|
+
}
|
|
72
|
+
function createProcessBinding(processName, subType, rawFolderPath) {
|
|
73
|
+
const value = {
|
|
74
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(processName, BindingsConstants.BindingsValueProcessNameDisplayName)
|
|
75
|
+
};
|
|
76
|
+
addFolderPathToValue(value, rawFolderPath);
|
|
77
|
+
return {
|
|
78
|
+
resource: BindingsConstants.ProcessResource,
|
|
79
|
+
key: processName,
|
|
80
|
+
value,
|
|
81
|
+
metadata: {
|
|
82
|
+
[BindingsConstants.BindingsMetadataSubTypeKey]: subType,
|
|
83
|
+
...defaultMetadata()
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function createConnectionBinding(connectionId, connectorKey, displayName) {
|
|
88
|
+
return {
|
|
89
|
+
resource: BindingsConstants.ConnectionResource,
|
|
90
|
+
key: connectionId,
|
|
91
|
+
value: {
|
|
92
|
+
[BindingsConstants.BindingsValueConnectionIdKey]: createBindingValue(connectionId, displayName)
|
|
93
|
+
},
|
|
94
|
+
metadata: {
|
|
95
|
+
[BindingsConstants.BindingsMetadataConnectorKey]: connectorKey,
|
|
96
|
+
[BindingsConstants.BindingsMetadataUseConnectionServiceKey]: BindingsConstants.BindingsMetadataTrue,
|
|
97
|
+
...defaultMetadata()
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function createIndexBinding(indexName, rawFolderPath) {
|
|
102
|
+
const value = {
|
|
103
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(indexName, BindingsConstants.BindingsValueIndexNameDisplayName)
|
|
104
|
+
};
|
|
105
|
+
addFolderPathToValue(value, rawFolderPath);
|
|
106
|
+
return {
|
|
107
|
+
resource: BindingsConstants.IndexResource,
|
|
108
|
+
key: indexName,
|
|
109
|
+
value,
|
|
110
|
+
metadata: defaultMetadata()
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function createAppBinding(appName, rawFolderPath) {
|
|
114
|
+
const value = {
|
|
115
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(appName, BindingsConstants.BindingsValueAppNameDisplayName)
|
|
116
|
+
};
|
|
117
|
+
addFolderPathToValue(value, rawFolderPath);
|
|
118
|
+
return {
|
|
119
|
+
resource: BindingsConstants.AppResource,
|
|
120
|
+
key: appName,
|
|
121
|
+
value,
|
|
122
|
+
metadata: defaultMetadata()
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function createAssetBinding(assetName, rawFolderPath) {
|
|
126
|
+
const value = {
|
|
127
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(assetName, BindingsConstants.BindingsValueAssetNameDisplayName)
|
|
128
|
+
};
|
|
129
|
+
addFolderPathToValue(value, rawFolderPath);
|
|
130
|
+
return {
|
|
131
|
+
resource: BindingsConstants.AssetResource,
|
|
132
|
+
key: assetName,
|
|
133
|
+
value,
|
|
134
|
+
metadata: defaultMetadata()
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function createBucketBinding(bucketName, rawFolderPath) {
|
|
138
|
+
const value = {
|
|
139
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(bucketName, BindingsConstants.BindingsValueBucketNameDisplayName)
|
|
140
|
+
};
|
|
141
|
+
addFolderPathToValue(value, rawFolderPath);
|
|
142
|
+
return {
|
|
143
|
+
resource: BindingsConstants.BucketResource,
|
|
144
|
+
key: bucketName,
|
|
145
|
+
value,
|
|
146
|
+
metadata: defaultMetadata()
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function generateAgentSettingsBindings(agent) {
|
|
150
|
+
if (agent.type !== "lowCode")
|
|
151
|
+
return [];
|
|
152
|
+
const byom = agent.settings.byomProperties;
|
|
153
|
+
if (!byom)
|
|
154
|
+
return [];
|
|
155
|
+
return [
|
|
156
|
+
createConnectionBinding(byom.connectionId, byom.connectorKey, BindingsConstants.BindingsValueByomConnectionIdDisplayName)
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
function generateAgentGuardrailBindings(agent) {
|
|
160
|
+
if (agent.type !== "lowCode" || !agent.guardrails)
|
|
161
|
+
return [];
|
|
162
|
+
const bindings = [];
|
|
163
|
+
for (const guardrail of agent.guardrails) {
|
|
164
|
+
if (guardrail.action?.$actionType === "escalate") {
|
|
165
|
+
const { action } = guardrail;
|
|
166
|
+
const appName = action.app?.name;
|
|
167
|
+
if (appName) {
|
|
168
|
+
bindings.push(createAppBinding(appName, action.app?.folderName));
|
|
169
|
+
}
|
|
170
|
+
const recipient = action.recipient;
|
|
171
|
+
if (recipient && isAssetRecipientType(recipient.type) && "assetName" in recipient && recipient.assetName) {
|
|
172
|
+
bindings.push(createAssetBinding(recipient.assetName, "folderPath" in recipient ? recipient.folderPath : undefined));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return bindings;
|
|
177
|
+
}
|
|
178
|
+
function generateAgentBindings(agent) {
|
|
179
|
+
return [...generateAgentSettingsBindings(agent), ...generateAgentGuardrailBindings(agent)];
|
|
180
|
+
}
|
|
181
|
+
function generateFeatureBindings(feature) {
|
|
182
|
+
if (feature.$featureType === "memorySpace") {
|
|
183
|
+
const value = {
|
|
184
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(feature.memorySpaceName, BindingsConstants.BindingsValueMemoryNameDisplayName)
|
|
185
|
+
};
|
|
186
|
+
addFolderPathToValue(value, feature.folderPath);
|
|
187
|
+
return [
|
|
188
|
+
{
|
|
189
|
+
resource: BindingsConstants.MemorySpaceResource,
|
|
190
|
+
key: feature.memorySpaceName,
|
|
191
|
+
value,
|
|
192
|
+
metadata: defaultMetadata()
|
|
193
|
+
}
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
function createProcessToolBinding(tool, subType) {
|
|
199
|
+
return [createProcessBinding(tool.properties.processName, subType, tool.properties.folderPath)];
|
|
200
|
+
}
|
|
201
|
+
function createIntegrationToolBindings(tool) {
|
|
202
|
+
return [
|
|
203
|
+
createConnectionBinding(tool.properties.connection.id, tool.properties.connection.connector.key, BindingsConstants.BindingsValueConnectionIdDisplayName)
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
function createIxpToolBindings(tool) {
|
|
207
|
+
return [
|
|
208
|
+
{
|
|
209
|
+
resource: BindingsConstants.IxpResource,
|
|
210
|
+
key: tool.properties.projectName,
|
|
211
|
+
value: {
|
|
212
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(tool.properties.projectName, BindingsConstants.BindingsValueIxpProjectNameDisplayName),
|
|
213
|
+
[BindingsConstants.BindingsValueVersionKey]: createBindingValue(tool.properties.versionTag, BindingsConstants.BindingsValueIxpProjectVersionDisplayName)
|
|
214
|
+
},
|
|
215
|
+
metadata: {
|
|
216
|
+
[BindingsConstants.BindingsMetadataVersionKey]: BindingsConstants.BindingsMetadataVersion
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
var DEFAULT_TOOL_BINDING_HANDLER_REGISTRY = {
|
|
222
|
+
process: (tool) => createProcessToolBinding(tool, BindingsConstants.BindingsMetadataProcessSubType),
|
|
223
|
+
agent: (tool) => createProcessToolBinding(tool, BindingsConstants.BindingsMetadataAgentSubType),
|
|
224
|
+
api: (tool) => createProcessToolBinding(tool, BindingsConstants.BindingsMetadataApiWorkflowSubType),
|
|
225
|
+
processOrchestration: (tool) => createProcessToolBinding(tool, BindingsConstants.BindingsMetadataAgenticProcessSubType),
|
|
226
|
+
flow: (tool) => createProcessToolBinding(tool, BindingsConstants.BindingsMetadataFlowSubType),
|
|
227
|
+
function: (tool) => createProcessToolBinding(tool, BindingsConstants.BindingsMetadataFunctionSubType),
|
|
228
|
+
integration: createIntegrationToolBindings,
|
|
229
|
+
ixp: createIxpToolBindings
|
|
230
|
+
};
|
|
231
|
+
function deepRagIndexName(tool) {
|
|
232
|
+
if (tool.type !== "internal")
|
|
233
|
+
return;
|
|
234
|
+
if (tool.properties.toolType !== "deep-rag")
|
|
235
|
+
return;
|
|
236
|
+
const { settings } = tool.properties;
|
|
237
|
+
if (!("indexName" in settings) || typeof settings.indexName !== "string" || settings.indexName.length === 0) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
return settings.indexName;
|
|
241
|
+
}
|
|
242
|
+
function generateFallbackToolBindings(tool) {
|
|
243
|
+
const indexName = deepRagIndexName(tool);
|
|
244
|
+
if (indexName) {
|
|
245
|
+
return [createIndexBinding(indexName)];
|
|
246
|
+
}
|
|
247
|
+
return [];
|
|
248
|
+
}
|
|
249
|
+
function unhandledBindingsType(_value) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
function resolveToolBindingsFromRegistry(tool, registry) {
|
|
253
|
+
switch (tool.type) {
|
|
254
|
+
case "process":
|
|
255
|
+
return registry.process?.(tool);
|
|
256
|
+
case "agent":
|
|
257
|
+
return registry.agent?.(tool);
|
|
258
|
+
case "api":
|
|
259
|
+
return registry.api?.(tool);
|
|
260
|
+
case "processOrchestration":
|
|
261
|
+
return registry.processOrchestration?.(tool);
|
|
262
|
+
case "flow":
|
|
263
|
+
return registry.flow?.(tool);
|
|
264
|
+
case "function":
|
|
265
|
+
return registry.function?.(tool);
|
|
266
|
+
case "integration":
|
|
267
|
+
return registry.integration?.(tool);
|
|
268
|
+
case "ixp":
|
|
269
|
+
return registry.ixp?.(tool);
|
|
270
|
+
case "internal":
|
|
271
|
+
return;
|
|
272
|
+
case "clientSide":
|
|
273
|
+
return registry.clientSide?.(tool);
|
|
274
|
+
default:
|
|
275
|
+
return unhandledBindingsType(tool);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function generateToolBindings(tool, registry = DEFAULT_TOOL_BINDING_HANDLER_REGISTRY) {
|
|
279
|
+
const bindings = resolveToolBindingsFromRegistry(tool, registry) ?? generateFallbackToolBindings(tool);
|
|
280
|
+
if (tool.guardrail?.policies) {
|
|
281
|
+
for (const policy of tool.guardrail.policies) {
|
|
282
|
+
if (policy.action?.$actionType === "escalate" && policy.action.app?.name) {
|
|
283
|
+
bindings.push(createAppBinding(policy.action.app.name, policy.action.app.folderName));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return bindings;
|
|
288
|
+
}
|
|
289
|
+
function generateDataFabricEntitySetBindings(context) {
|
|
290
|
+
if (context.entitySet.length === 0) {
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
return context.entitySet.map((entity) => {
|
|
294
|
+
const value = {
|
|
295
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(entity.name, BindingsConstants.BindingsValueDataFabricEntityNameDisplayName)
|
|
296
|
+
};
|
|
297
|
+
addFolderPathToValue(value, entity.folderId);
|
|
298
|
+
return {
|
|
299
|
+
resource: BindingsConstants.DataFabricEntityResource,
|
|
300
|
+
key: entity.referenceKey ?? entity.id,
|
|
301
|
+
value,
|
|
302
|
+
metadata: {
|
|
303
|
+
...defaultMetadata(),
|
|
304
|
+
scope: "folder"
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function generateContextBindings(context) {
|
|
310
|
+
if (context.contextType === "datafabricentityset") {
|
|
311
|
+
return generateDataFabricEntitySetBindings(context);
|
|
312
|
+
}
|
|
313
|
+
return [createIndexBinding(context.indexName, context.folderPath)];
|
|
314
|
+
}
|
|
315
|
+
function generateEscalationBindings(escalation) {
|
|
316
|
+
const bindings = [];
|
|
317
|
+
if (escalation.escalationType === BindingsConstants.VsEscalationType) {
|
|
318
|
+
const bucketName = escalation.vsEscalationProperties?.storageBucketName;
|
|
319
|
+
if (bucketName) {
|
|
320
|
+
bindings.push(createBucketBinding(bucketName, escalation.vsEscalationProperties?.storageBucketFolderPath));
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
for (const channel of escalation.channels ?? []) {
|
|
324
|
+
if (channel.type === "actionCenter") {
|
|
325
|
+
const appName = channel.properties?.appName;
|
|
326
|
+
if (appName) {
|
|
327
|
+
bindings.push(createAppBinding(appName, channel.properties?.folderName));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
for (const recipient of channel.recipients ?? []) {
|
|
331
|
+
if (isAssetRecipientType(recipient.type) && "assetName" in recipient && recipient.assetName) {
|
|
332
|
+
bindings.push(createAssetBinding(recipient.assetName, "folderPath" in recipient ? recipient.folderPath : undefined));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return bindings;
|
|
338
|
+
}
|
|
339
|
+
function generateMcpBindings(mcp) {
|
|
340
|
+
const value = {
|
|
341
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(mcp.slug, BindingsConstants.BindingsValueSlugDisplayName)
|
|
342
|
+
};
|
|
343
|
+
addFolderPathToValue(value, mcp.folderPath);
|
|
344
|
+
return [
|
|
345
|
+
{
|
|
346
|
+
resource: BindingsConstants.McpResource,
|
|
347
|
+
key: mcp.slug,
|
|
348
|
+
value,
|
|
349
|
+
metadata: defaultMetadata()
|
|
350
|
+
}
|
|
351
|
+
];
|
|
352
|
+
}
|
|
353
|
+
function generateA2aBindings(a2a) {
|
|
354
|
+
const value = {
|
|
355
|
+
[BindingsConstants.BindingsValueNameKey]: createBindingValue(a2a.slug, BindingsConstants.BindingsValueSlugDisplayName)
|
|
356
|
+
};
|
|
357
|
+
addFolderPathToValue(value, a2a.folderPath);
|
|
358
|
+
return [
|
|
359
|
+
{
|
|
360
|
+
resource: BindingsConstants.RemoteA2aAgentResource,
|
|
361
|
+
key: a2a.slug,
|
|
362
|
+
value,
|
|
363
|
+
metadata: defaultMetadata()
|
|
364
|
+
}
|
|
365
|
+
];
|
|
366
|
+
}
|
|
367
|
+
var DEFAULT_RESOURCE_BINDING_HANDLER_REGISTRY = {
|
|
368
|
+
tool: (resource) => generateToolBindings(resource),
|
|
369
|
+
context: (resource) => generateContextBindings(resource),
|
|
370
|
+
escalation: (resource) => generateEscalationBindings(resource),
|
|
371
|
+
mcp: (resource) => generateMcpBindings(resource),
|
|
372
|
+
a2a: (resource) => generateA2aBindings(resource)
|
|
373
|
+
};
|
|
374
|
+
function resolveResourceBindingsFromRegistry(resource, registry) {
|
|
375
|
+
switch (resource.$resourceType) {
|
|
376
|
+
case "tool":
|
|
377
|
+
return registry.tool?.(resource);
|
|
378
|
+
case "context":
|
|
379
|
+
return registry.context?.(resource);
|
|
380
|
+
case "escalation":
|
|
381
|
+
return registry.escalation?.(resource);
|
|
382
|
+
case "mcp":
|
|
383
|
+
return registry.mcp?.(resource);
|
|
384
|
+
case "a2a":
|
|
385
|
+
return registry.a2a?.(resource);
|
|
386
|
+
default:
|
|
387
|
+
return unhandledBindingsType(resource);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
function generateResourceBindings(resource, registry = DEFAULT_RESOURCE_BINDING_HANDLER_REGISTRY) {
|
|
391
|
+
return resolveResourceBindingsFromRegistry(resource, registry) ?? [];
|
|
392
|
+
}
|
|
393
|
+
function generateBindings(agent, resources, features) {
|
|
394
|
+
const allBindings = [];
|
|
395
|
+
for (const resource of resources) {
|
|
396
|
+
allBindings.push(...generateResourceBindings(resource));
|
|
397
|
+
}
|
|
398
|
+
for (const feature of features) {
|
|
399
|
+
allBindings.push(...generateFeatureBindings(feature));
|
|
400
|
+
}
|
|
401
|
+
allBindings.push(...generateAgentBindings(agent));
|
|
402
|
+
const seen = /* @__PURE__ */ new Set;
|
|
403
|
+
const uniqueBindings = [];
|
|
404
|
+
for (const binding of allBindings) {
|
|
405
|
+
const key = `${binding.resource}_${binding.key}`;
|
|
406
|
+
if (!seen.has(key)) {
|
|
407
|
+
seen.add(key);
|
|
408
|
+
uniqueBindings.push(binding);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return {
|
|
412
|
+
version: BindingsConstants.BindingsModelVersion,
|
|
413
|
+
resources: uniqueBindings
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export { generateBindings };
|
|
418
|
+
|
|
419
|
+
//# debugId=45E9220E0E4BB6ED64756E2164756E21
|