@uipath/agent-tool 1.200.0-preview.120 → 1.201.0-preview.121

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.
Files changed (48) hide show
  1. package/dist/{agent-project-service-j3sst5cf.js → agent-project-service-j4pgc7gk.js} +3 -3
  2. package/dist/agent-tool-OK5DK57D-mxt5stp9.js +12 -0
  3. package/dist/{browser-strategy-v4n9zxyf.js → browser-strategy-16yagjhr.js} +1 -1
  4. package/dist/{de-LVBY3VVG-tc58p3x6.js → de-WMKOGI7B-r1821wpe.js} +16 -7
  5. package/dist/{en-4UFXRW7N-mqabr9tf.js → en-X4DLPKLJ-dt1wtdm7.js} +17 -5
  6. package/dist/{es-CI4AE5B5-55sgqk64.js → es-BVPGJUWA-9gk2g9yb.js} +16 -7
  7. package/dist/{es-MX-OLZNAYY5-30cmv1dx.js → es-MX-U6YL5KQX-ynwxdjr8.js} +16 -7
  8. package/dist/executor-tool.js +297 -0
  9. package/dist/{fr-CCN6ZO5E-x2akzsjt.js → fr-EKTTDR7Z-bmpwp31r.js} +16 -7
  10. package/dist/index-26bymy67.js +17359 -0
  11. package/dist/index-9f8q2ege.js +2058 -0
  12. package/dist/{index-b13x0rpx.js → index-byw2z4xp.js} +12 -9
  13. package/dist/{index-m7vpyg6b.js → index-f97359cb.js} +5 -5
  14. package/dist/{packager-tool-mf36zc9b.js → index-hsadteg4.js} +41 -253
  15. package/dist/{index-w23k88b5.js → index-p50kx6jv.js} +202 -64
  16. package/dist/{index-08fsnqg0.js → index-rqfxg3fq.js} +1 -1
  17. package/dist/index.js +15 -12
  18. package/dist/{integration-tool-service-z414k85p.js → integration-tool-service-n214kzdn.js} +4 -4
  19. package/dist/{is-client-y2fkfgb9.js → is-client-9b6sp9ag.js} +3 -3
  20. package/dist/{ja-O2NEV5D6-nt9rhd8c.js → ja-Y2YBTXNN-96cvy5av.js} +16 -7
  21. package/dist/js-yaml-cggj6w7q.js +3145 -0
  22. package/dist/{ko-7XWV2SEQ-chk3y7aj.js → ko-S33XAV26-cxf4dn2t.js} +16 -7
  23. package/dist/{packager-tool-jmzese1s.js → node-strategy-1r3qegaf.js} +62 -32
  24. package/dist/{packager-tool-973f0r2g.js → packager-tool-1yy9x4vk.js} +17 -5
  25. package/dist/packager-tool-4fge2k9c.js +419 -0
  26. package/dist/{packager-tool-yet9qmnt.js → packager-tool-5xdkh3vm.js} +110 -24
  27. package/dist/{packager-tool-9tv93r4w.js → packager-tool-b098y4a2.js} +2 -418
  28. package/dist/packager-tool-bpegrcj1.js +5336 -0
  29. package/dist/{packager-tool-dcazs5r7.js → packager-tool-expj850v.js} +6 -4
  30. package/dist/packager-tool-fhrpdder.js +4492 -0
  31. package/dist/{packager-tool-99cr74s9.js → packager-tool-fpj7v9y3.js} +7 -7
  32. package/dist/{packager-tool-k52eeaqa.js → packager-tool-ggg5bx2h.js} +42767 -28246
  33. package/dist/{packager-tool-wfbw3w4y.js → packager-tool-gkvdytpj.js} +282 -5275
  34. package/dist/{packager-tool-1snc64g4.js → packager-tool-q42rrs00.js} +3 -2
  35. package/dist/packager-tool-qa9gftnj.js +31 -0
  36. package/dist/{packager-tool-fzq5y98q.js → packager-tool-wzknj3dr.js} +2 -2
  37. package/dist/packager-tool-yv3rvyas.js +239 -0
  38. package/dist/packager-tool.js +5 -4
  39. package/dist/{pt-BR-Z4J3LEEO-cf33d2zv.js → pt-BR-JO45SCNI-4kbfnzc4.js} +16 -7
  40. package/dist/{pt-CRSN3TCU-txxbbcxm.js → pt-W3NA4LIZ-f02gapvs.js} +16 -7
  41. package/dist/{ro-WMQEVD7D-6mtq0e6b.js → ro-WLKX6HF5-fcbe2zz8.js} +16 -7
  42. package/dist/tool.js +15 -12
  43. package/dist/{tr-UCMB7W3T-xmxp2naq.js → tr-3U2W2XCA-zg3zcmq3.js} +15 -6
  44. package/dist/{zh-CN-2QOHEFC5-ryjb2byk.js → zh-CN-IPZYQR3P-1h76csc4.js} +16 -7
  45. package/dist/{zh-TW-Q5QSSTS6-6y7yjbbn.js → zh-TW-YPVSQVGT-wbybwpwt.js} +16 -7
  46. package/package.json +4 -3
  47. package/dist/agent-tool-OK5DK57D-8nt05j7t.js +0 -11
  48. package/dist/node-strategy-cvesesna.js +0 -65
@@ -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
@@ -4,16 +4,16 @@ import {
4
4
  } from "./packager-tool-0gctz400.js";
5
5
  import {
6
6
  catchError
7
- } from "./packager-tool-jmzese1s.js";
7
+ } from "./packager-tool-qa9gftnj.js";
8
8
  import {
9
9
  getFileSystem
10
- } from "./packager-tool-mf36zc9b.js";
10
+ } from "./packager-tool-yv3rvyas.js";
11
11
  import {
12
12
  AUTH_FILENAME,
13
13
  DEFAULT_BASE_URL,
14
14
  DEFAULT_REDIRECT_URI,
15
15
  UIPATH_HOME_DIR
16
- } from "./packager-tool-1snc64g4.js";
16
+ } from "./packager-tool-q42rrs00.js";
17
17
  import {
18
18
  __require
19
19
  } from "./packager-tool-wckvcay0.js";
@@ -913,6 +913,67 @@ var getTokenExpiration = (accessToken) => {
913
913
  }
914
914
  };
915
915
 
916
+ // ../auth/src/sessionIdentity.ts
917
+ var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
918
+ var decodeClaims = (accessToken) => {
919
+ const [error, claims] = catchError(() => parseJWT(accessToken));
920
+ return error ? undefined : claims;
921
+ };
922
+ var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
923
+ var resolveIdentityType = (claims, authFlow, email) => {
924
+ const subType = asString(claims?.sub_type);
925
+ if (subType) {
926
+ return subType.startsWith("service") ? "Application" : "User";
927
+ }
928
+ if (authFlow) {
929
+ return authFlow === "authorization_code" ? "User" : "Application";
930
+ }
931
+ if (email)
932
+ return "User";
933
+ if (asString(claims?.client_id) && !asString(claims?.sub)) {
934
+ return "Application";
935
+ }
936
+ return;
937
+ };
938
+ var looksLikeEmail = (value) => value?.includes("@") ?? false;
939
+ var pickEmail = (claims) => {
940
+ for (const candidate of [claims?.email, claims?.preferred_username]) {
941
+ const value = asString(candidate);
942
+ if (looksLikeEmail(value))
943
+ return value;
944
+ }
945
+ return;
946
+ };
947
+ var pickName = (claims) => {
948
+ const username = asString(claims?.preferred_username);
949
+ return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
950
+ };
951
+ var resolveSessionIdentity = (accessToken, authFlow) => {
952
+ const claims = accessToken ? decodeClaims(accessToken) : undefined;
953
+ const email = pickEmail(claims);
954
+ const type = resolveIdentityType(claims, authFlow, email);
955
+ if (!type)
956
+ return;
957
+ const identity = { type };
958
+ if (authFlow)
959
+ identity.authFlow = authFlow;
960
+ if (type === "User") {
961
+ const userId = asString(claims?.sub);
962
+ if (userId)
963
+ identity.userId = userId;
964
+ if (email)
965
+ identity.userEmail = email;
966
+ const name = pickName(claims);
967
+ if (name)
968
+ identity.userName = name;
969
+ return identity;
970
+ }
971
+ const clientId = asString(claims?.client_id);
972
+ if (clientId)
973
+ identity.clientId = clientId;
974
+ return identity;
975
+ };
976
+
916
977
  // ../auth/src/envAuth.ts
917
978
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
918
979
  var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
@@ -962,6 +1023,7 @@ var readAuthFromEnv = () => {
962
1023
  }
963
1024
  const expiration = getTokenExpiration(accessToken);
964
1025
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
1026
+ const identity = resolveSessionIdentity(accessToken);
965
1027
  return {
966
1028
  loginStatus,
967
1029
  accessToken,
@@ -971,7 +1033,8 @@ var readAuthFromEnv = () => {
971
1033
  tenantName,
972
1034
  tenantId,
973
1035
  expiration,
974
- source: "env" /* Env */
1036
+ source: "env-vars" /* EnvironmentVariables */,
1037
+ ...identity ? { identity } : {}
975
1038
  };
976
1039
  };
977
1040
 
@@ -1225,6 +1288,9 @@ var refreshAccessToken = async ({
1225
1288
  return { accessToken: newAccessToken, refreshToken: newRefreshToken };
1226
1289
  };
1227
1290
 
1291
+ // ../auth/src/types.ts
1292
+ var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
1293
+
1228
1294
  // ../auth/src/utils/envFile.ts
1229
1295
  var DEFAULT_AUTH_FILENAME = AUTH_FILENAME;
1230
1296
  var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
@@ -1386,12 +1452,12 @@ var saveEnvFileAsync = async ({
1386
1452
  };
1387
1453
 
1388
1454
  // ../auth/src/loginStatus.ts
1389
- var LoginStatusSource;
1390
- ((LoginStatusSource2) => {
1391
- LoginStatusSource2["File"] = "file";
1392
- LoginStatusSource2["Robot"] = "robot";
1393
- LoginStatusSource2["Env"] = "env";
1394
- })(LoginStatusSource ||= {});
1455
+ var CredentialSource;
1456
+ ((CredentialSource2) => {
1457
+ CredentialSource2["SavedLogin"] = "saved-login";
1458
+ CredentialSource2["Robot"] = "robot";
1459
+ CredentialSource2["EnvironmentVariables"] = "env-vars";
1460
+ })(CredentialSource ||= {});
1395
1461
  var getLoginStatusAsync = async (options = {}) => {
1396
1462
  return getLoginStatusWithDeps(options);
1397
1463
  };
@@ -1597,7 +1663,8 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1597
1663
  tenantName: credentials.UIPATH_TENANT_NAME,
1598
1664
  tenantId: credentials.UIPATH_TENANT_ID,
1599
1665
  expiration: tokens.expiration,
1600
- source: "file" /* File */,
1666
+ source: "saved-login" /* SavedLogin */,
1667
+ ...identityFields(tokens.accessToken, credentials),
1601
1668
  ...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
1602
1669
  ...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
1603
1670
  ...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
@@ -1610,7 +1677,12 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1610
1677
  }
1611
1678
  return result;
1612
1679
  }
1680
+ function identityFields(accessToken, credentials) {
1681
+ const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
1682
+ return identity ? { identity } : {};
1683
+ }
1613
1684
  function buildRobotStatus(robotCreds) {
1685
+ const identity = resolveSessionIdentity(robotCreds.accessToken);
1614
1686
  return {
1615
1687
  loginStatus: "Logged in",
1616
1688
  accessToken: robotCreds.accessToken,
@@ -1621,7 +1693,8 @@ function buildRobotStatus(robotCreds) {
1621
1693
  tenantId: robotCreds.tenantId,
1622
1694
  issuer: robotCreds.issuer,
1623
1695
  expiration: getTokenExpiration(robotCreds.accessToken),
1624
- source: "robot" /* Robot */
1696
+ source: "robot" /* Robot */,
1697
+ ...identity ? { identity } : {}
1625
1698
  };
1626
1699
  }
1627
1700
  var isFileNotFoundError = (error) => {
@@ -1672,7 +1745,8 @@ async function circuitBreakerShortCircuit(ctx) {
1672
1745
  tenantName: credentials.UIPATH_TENANT_NAME,
1673
1746
  tenantId: credentials.UIPATH_TENANT_ID,
1674
1747
  expiration,
1675
- source: "file" /* File */
1748
+ source: "saved-login" /* SavedLogin */,
1749
+ ...identityFields(accessToken, credentials)
1676
1750
  } : {},
1677
1751
  hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
1678
1752
  refreshCircuitOpen: true,
@@ -1694,7 +1768,8 @@ async function lockAcquireFailureStatus(ctx, error) {
1694
1768
  tenantName: ctx.credentials.UIPATH_TENANT_NAME,
1695
1769
  tenantId: ctx.credentials.UIPATH_TENANT_ID,
1696
1770
  expiration: ctx.expiration,
1697
- source: "file" /* File */,
1771
+ source: "saved-login" /* SavedLogin */,
1772
+ ...identityFields(ctx.accessToken, ctx.credentials),
1698
1773
  hint: globalHint,
1699
1774
  tokenRefresh: {
1700
1775
  attempted: false,
@@ -2088,6 +2163,16 @@ var federatedCredentialsLogin = async ({
2088
2163
  });
2089
2164
  };
2090
2165
  // ../auth/src/tenantSelection.ts
2166
+ var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
2167
+ var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
2168
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
2169
+ var describeNonJsonResponse = (organizationId, response, parseError) => {
2170
+ if (response.redirected) {
2171
+ return `Could not find organization '${organizationId}': the request was ` + `redirected to a sign-in page instead of the organization's tenant ` + `list. ${LOGIN_STATUS_HINT}`;
2172
+ }
2173
+ const contentType = response.headers.get("content-type") ?? "unknown";
2174
+ return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
2175
+ };
2091
2176
  var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId) => {
2092
2177
  const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
2093
2178
  const response = await fetch(url, {
@@ -2097,12 +2182,16 @@ var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId)
2097
2182
  });
2098
2183
  if (!response.ok) {
2099
2184
  if (response.status === 401) {
2100
- throw new Error("Unauthorized: Invalid or expired access token");
2185
+ throw new Error(`Unauthorized: the access token was rejected, it was not ` + `issued for organization '${organizationId}', or ` + `'${organizationId}' was not accepted as an organization ` + `URL segment in this environment. ` + LOGIN_STATUS_HINT);
2101
2186
  }
2102
2187
  const errorText = await response.text();
2103
- throw new Error(`Failed to get tenants and organizations: ${response.status} ${errorText}`);
2188
+ const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
2189
+ throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
2190
+ }
2191
+ const [parseError, data] = await catchError(response.json());
2192
+ if (parseError) {
2193
+ throw new Error(describeNonJsonResponse(organizationId, response, parseError));
2104
2194
  }
2105
- const data = await response.json();
2106
2195
  return data;
2107
2196
  };
2108
2197
 
@@ -2181,9 +2270,6 @@ var selectTenantWithDeps = async (baseUrl, accessToken, organizationId, targetTe
2181
2270
  return [selectedTenant.name, selectedTenant.id, organization.name];
2182
2271
  };
2183
2272
 
2184
- // ../auth/src/types.ts
2185
- var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
2186
-
2187
2273
  // ../auth/src/interactive.ts
2188
2274
  var interactiveLoginWithDeps = async (options, deps) => {
2189
2275
  const {
@@ -2460,10 +2546,10 @@ var authenticate = async ({
2460
2546
  const authUrl = `${authorizationEndpoint}?${authParams.toString()}`;
2461
2547
  let strategy;
2462
2548
  if (isBrowser()) {
2463
- const { BrowserAuthStrategy } = await import("./browser-strategy-v4n9zxyf.js");
2549
+ const { BrowserAuthStrategy } = await import("./browser-strategy-16yagjhr.js");
2464
2550
  strategy = new BrowserAuthStrategy;
2465
2551
  } else {
2466
- const { NodeAuthStrategy } = await import("./node-strategy-cvesesna.js");
2552
+ const { NodeAuthStrategy } = await import("./node-strategy-1r3qegaf.js");
2467
2553
  strategy = new NodeAuthStrategy;
2468
2554
  }
2469
2555
  const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, {
@@ -2482,6 +2568,6 @@ var authenticate = async ({
2482
2568
  });
2483
2569
  };
2484
2570
 
2485
- export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, parseJWT, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, LoginStatusSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, AUTH_FLOW_ENV_VAR, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2571
+ export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, parseJWT, parseAuthFlow, resolveSessionIdentity, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, AUTH_FLOW_ENV_VAR, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, CredentialSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2486
2572
 
2487
- //# debugId=A342771FA7DBDCE064756E2164756E21
2573
+ //# debugId=5D8E563B9619A42964756E2164756E21