@uipath/uipath-typescript 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/index.cjs +204 -2
- package/dist/assets/index.d.ts +112 -13
- package/dist/assets/index.mjs +204 -2
- package/dist/attachments/index.cjs +3 -2
- package/dist/attachments/index.d.ts +7 -0
- package/dist/attachments/index.mjs +3 -2
- package/dist/buckets/index.cjs +172 -2
- package/dist/buckets/index.d.ts +56 -12
- package/dist/buckets/index.mjs +172 -2
- package/dist/cases/index.cjs +3 -2
- package/dist/cases/index.d.ts +7 -0
- package/dist/cases/index.mjs +3 -2
- package/dist/conversational-agent/index.cjs +196 -81
- package/dist/conversational-agent/index.d.ts +326 -80
- package/dist/conversational-agent/index.mjs +195 -80
- package/dist/core/index.cjs +44 -7
- package/dist/core/index.d.ts +11 -1
- package/dist/core/index.mjs +44 -7
- package/dist/entities/index.cjs +35 -6
- package/dist/entities/index.d.ts +101 -11
- package/dist/entities/index.mjs +36 -7
- package/dist/feedback/index.cjs +40 -5
- package/dist/feedback/index.d.ts +59 -1
- package/dist/feedback/index.mjs +40 -5
- package/dist/index.cjs +312 -14
- package/dist/index.d.ts +515 -32
- package/dist/index.mjs +313 -15
- package/dist/index.umd.js +312 -14
- package/dist/jobs/index.cjs +172 -2
- package/dist/jobs/index.d.ts +67 -23
- package/dist/jobs/index.mjs +172 -2
- package/dist/maestro-processes/index.cjs +3 -2
- package/dist/maestro-processes/index.d.ts +7 -0
- package/dist/maestro-processes/index.mjs +3 -2
- package/dist/processes/index.cjs +240 -3
- package/dist/processes/index.d.ts +124 -2
- package/dist/processes/index.mjs +240 -3
- package/dist/queues/index.cjs +172 -2
- package/dist/queues/index.d.ts +56 -12
- package/dist/queues/index.mjs +172 -2
- package/dist/tasks/index.cjs +3 -2
- package/dist/tasks/index.d.ts +7 -0
- package/dist/tasks/index.mjs +3 -2
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
49
49
|
// Connection string placeholder that will be replaced during build
|
|
50
50
|
const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
51
51
|
// SDK Version placeholder
|
|
52
|
-
const SDK_VERSION = "1.3.
|
|
52
|
+
const SDK_VERSION = "1.3.7";
|
|
53
53
|
const VERSION = "Version";
|
|
54
54
|
const SERVICE = "Service";
|
|
55
55
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -803,6 +803,21 @@ const RESPONSE_TYPES = {
|
|
|
803
803
|
* in Conversational Agents Service)
|
|
804
804
|
*/
|
|
805
805
|
const EXTERNAL_USER_ID = 'x-uipath-external-user-id';
|
|
806
|
+
/**
|
|
807
|
+
* Optional identifier used in UiPath logs to identify the implementing service
|
|
808
|
+
* of requests. External consumers do not need to set it; the server logs
|
|
809
|
+
* missing values as "unknown".
|
|
810
|
+
*
|
|
811
|
+
* @internal
|
|
812
|
+
*/
|
|
813
|
+
const CONVERSATIONAL_SURFACE_NAME = 'x-uipath-conversational-surfacename';
|
|
814
|
+
/**
|
|
815
|
+
* Optional version of the implementing service of requests. Paired with
|
|
816
|
+
* `surfaceName` for internal telemetry.
|
|
817
|
+
*
|
|
818
|
+
* @internal
|
|
819
|
+
*/
|
|
820
|
+
const CONVERSATIONAL_SURFACE_VERSION = 'x-uipath-conversational-surfaceversion';
|
|
806
821
|
/**
|
|
807
822
|
* Query parameter keys sent during WebSocket connection
|
|
808
823
|
*/
|
|
@@ -810,6 +825,8 @@ const WEBSOCKET_QUERY_PARAMS = {
|
|
|
810
825
|
ORGANIZATION_ID: 'x-uipath-internal-accountid',
|
|
811
826
|
TENANT_ID: 'x-uipath-internal-tenantid',
|
|
812
827
|
EXTERNAL_USER_ID,
|
|
828
|
+
CONVERSATIONAL_SURFACE_NAME,
|
|
829
|
+
CONVERSATIONAL_SURFACE_VERSION,
|
|
813
830
|
};
|
|
814
831
|
|
|
815
832
|
class ApiClient {
|
|
@@ -1731,8 +1748,9 @@ class BaseService {
|
|
|
1731
1748
|
constructor(instance, headers) {
|
|
1732
1749
|
// Private field - not visible via Object.keys() or any reflection
|
|
1733
1750
|
_BaseService_apiClient.set(this, void 0);
|
|
1734
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1751
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1735
1752
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1753
|
+
this.config = { folderKey };
|
|
1736
1754
|
}
|
|
1737
1755
|
/**
|
|
1738
1756
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -2178,7 +2196,7 @@ const AgentMap = {
|
|
|
2178
2196
|
};
|
|
2179
2197
|
|
|
2180
2198
|
/**
|
|
2181
|
-
* Constants for User Service
|
|
2199
|
+
* Constants for User Settings Service
|
|
2182
2200
|
*/
|
|
2183
2201
|
/**
|
|
2184
2202
|
* Maps fields for User Settings entities to ensure consistent SDK naming
|
|
@@ -2948,6 +2966,7 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
2948
2966
|
this.toolCallId = toolCallId;
|
|
2949
2967
|
this.startEventMaybe = startEventMaybe;
|
|
2950
2968
|
this._endHandlers = new Array();
|
|
2969
|
+
this._confirmHandlers = new Array();
|
|
2951
2970
|
this.addStartEventTimestamp(startEventMaybe);
|
|
2952
2971
|
}
|
|
2953
2972
|
/**
|
|
@@ -3009,6 +3028,29 @@ class ToolCallEventHelper extends ConversationEventHelperBase {
|
|
|
3009
3028
|
onEndToolCall(cb) {
|
|
3010
3029
|
this.onToolCallEnd(cb);
|
|
3011
3030
|
}
|
|
3031
|
+
/**
|
|
3032
|
+
* Registers a handler for tool call confirmation events. Fired when the
|
|
3033
|
+
* peer responds to a tool call that was emitted with `requireConfirmation`.
|
|
3034
|
+
* @returns Cleanup function to remove the handler.
|
|
3035
|
+
*/
|
|
3036
|
+
onToolCallConfirm(callback) {
|
|
3037
|
+
this._confirmHandlers.push(callback);
|
|
3038
|
+
return () => {
|
|
3039
|
+
const index = this._confirmHandlers.indexOf(callback);
|
|
3040
|
+
if (index >= 0)
|
|
3041
|
+
this._confirmHandlers.splice(index, 1);
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* Sends a tool call confirmation (approve/reject) for a tool call that was
|
|
3046
|
+
* emitted with `requireConfirmation: true`. Replaces the legacy
|
|
3047
|
+
* `sendInterruptEnd` flow for tool call confirmation.
|
|
3048
|
+
* @throws Error if tool call has already ended.
|
|
3049
|
+
*/
|
|
3050
|
+
sendToolCallConfirm(confirmToolCall) {
|
|
3051
|
+
this.assertNotEnded();
|
|
3052
|
+
this.emit({ confirmToolCall });
|
|
3053
|
+
}
|
|
3012
3054
|
/**
|
|
3013
3055
|
* Sends an error start event for this tool call.
|
|
3014
3056
|
*/
|
|
@@ -3084,6 +3126,10 @@ class ToolCallEventHelperImpl extends ToolCallEventHelper {
|
|
|
3084
3126
|
if (toolCallEvent.toolCallError?.endError) {
|
|
3085
3127
|
this.dispatchErrorEnd(toolCallEvent.toolCallError.errorId, toolCallEvent.toolCallError.endError);
|
|
3086
3128
|
}
|
|
3129
|
+
if (toolCallEvent.confirmToolCall) {
|
|
3130
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3131
|
+
this._confirmHandlers.forEach(cb => cb(toolCallEvent.confirmToolCall));
|
|
3132
|
+
}
|
|
3087
3133
|
if (toolCallEvent.endToolCall) {
|
|
3088
3134
|
this.setEnded();
|
|
3089
3135
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -3127,6 +3173,7 @@ class MessageEventHelper extends ConversationEventHelperBase {
|
|
|
3127
3173
|
this._toolCallMap = new Map();
|
|
3128
3174
|
this._interruptStartHandlers = new Array();
|
|
3129
3175
|
this._interruptEndHandlers = new Array();
|
|
3176
|
+
this._toolCallConfirmHandlers = new Array();
|
|
3130
3177
|
this.addStartEventTimestamp(startEventMaybe);
|
|
3131
3178
|
}
|
|
3132
3179
|
/**
|
|
@@ -3365,6 +3412,25 @@ class MessageEventHelper extends ConversationEventHelperBase {
|
|
|
3365
3412
|
this._interruptEndHandlers.splice(index, 1);
|
|
3366
3413
|
};
|
|
3367
3414
|
}
|
|
3415
|
+
/**
|
|
3416
|
+
* Registers a handler for tool-call confirmation events. Fired when a peer
|
|
3417
|
+
* responds to a tool call that was emitted with `requireConfirmation: true`.
|
|
3418
|
+
*
|
|
3419
|
+
* Fires at the message level before the event is delegated to the per-tool-call
|
|
3420
|
+
* helper, so this handler runs even when no `ToolCallEventHelper` exists for the
|
|
3421
|
+
* confirmed tool call (e.g. on the agent side after the originating helper has
|
|
3422
|
+
* been cleaned up, or on the client side if no `onToolCallStart` is registered).
|
|
3423
|
+
*
|
|
3424
|
+
* @returns Cleanup function to remove the handler.
|
|
3425
|
+
*/
|
|
3426
|
+
onToolCallConfirm(callback) {
|
|
3427
|
+
this._toolCallConfirmHandlers.push(callback);
|
|
3428
|
+
return () => {
|
|
3429
|
+
const index = this._toolCallConfirmHandlers.indexOf(callback);
|
|
3430
|
+
if (index >= 0)
|
|
3431
|
+
this._toolCallConfirmHandlers.splice(index, 1);
|
|
3432
|
+
};
|
|
3433
|
+
}
|
|
3368
3434
|
/**
|
|
3369
3435
|
* Sends an interrupt start event.
|
|
3370
3436
|
*/
|
|
@@ -3492,6 +3558,16 @@ class MessageEventHelperImpl extends MessageEventHelper {
|
|
|
3492
3558
|
contentPartHelper.dispatch(messageEvent.contentPart);
|
|
3493
3559
|
}
|
|
3494
3560
|
if (messageEvent.toolCall) {
|
|
3561
|
+
// Dispatch confirmToolCall at the message level (flat dispatch) before delegating
|
|
3562
|
+
// to the per-tool-call helper. Needed because the tool-call helper may not exist
|
|
3563
|
+
// for this id on the receiving side.
|
|
3564
|
+
if (messageEvent.toolCall.confirmToolCall) {
|
|
3565
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3566
|
+
this._toolCallConfirmHandlers.forEach(cb => cb({
|
|
3567
|
+
toolCallId: messageEvent.toolCall.toolCallId,
|
|
3568
|
+
confirmEvent: messageEvent.toolCall.confirmToolCall
|
|
3569
|
+
}));
|
|
3570
|
+
}
|
|
3495
3571
|
let toolCallHelper = this._toolCallMap.get(messageEvent.toolCall.toolCallId);
|
|
3496
3572
|
if (!toolCallHelper && this._toolCallStartHandlers.length > 0) {
|
|
3497
3573
|
toolCallHelper = new ToolCallEventHelperImpl(this, messageEvent.toolCall.toolCallId, messageEvent.toolCall.startToolCall);
|
|
@@ -4992,6 +5068,27 @@ function transformMessage(message) {
|
|
|
4992
5068
|
};
|
|
4993
5069
|
}
|
|
4994
5070
|
|
|
5071
|
+
/**
|
|
5072
|
+
* Header builder for Conversational Agent Services
|
|
5073
|
+
*
|
|
5074
|
+
* Builds the default request headers shared across the Conversational Agent
|
|
5075
|
+
* service constructors (`ConversationalAgentService`, `ConversationService`,
|
|
5076
|
+
* `ExchangeService`, `MessageService`) from a single set of options.
|
|
5077
|
+
*/
|
|
5078
|
+
/**
|
|
5079
|
+
* Builds the default request headers for Conversational Agent service calls
|
|
5080
|
+
* from the provided options. Returns `undefined` when no headers apply, so
|
|
5081
|
+
* the SDK does not pass an empty `headers` bag down to the HTTP layer.
|
|
5082
|
+
*/
|
|
5083
|
+
function buildConversationalAgentHeaders(options) {
|
|
5084
|
+
const headers = createHeaders({
|
|
5085
|
+
[EXTERNAL_USER_ID]: options?.externalUserId,
|
|
5086
|
+
[CONVERSATIONAL_SURFACE_NAME]: options?.surfaceName,
|
|
5087
|
+
[CONVERSATIONAL_SURFACE_VERSION]: options?.surfaceVersion,
|
|
5088
|
+
});
|
|
5089
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
5090
|
+
}
|
|
5091
|
+
|
|
4995
5092
|
/**
|
|
4996
5093
|
* ExchangeService - Exchange operations for Conversations
|
|
4997
5094
|
*
|
|
@@ -5031,7 +5128,7 @@ class ExchangeService extends BaseService {
|
|
|
5031
5128
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
5032
5129
|
*/
|
|
5033
5130
|
constructor(instance, options) {
|
|
5034
|
-
super(instance, options
|
|
5131
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
5035
5132
|
}
|
|
5036
5133
|
/**
|
|
5037
5134
|
* Gets all exchanges for a conversation with optional filtering and pagination
|
|
@@ -5694,6 +5791,8 @@ class WebSocketSession extends BaseWebSocket {
|
|
|
5694
5791
|
logLevel: options?.logLevel
|
|
5695
5792
|
}, context, tokenManager, WEBSOCKET_LOGGER_PREFIX);
|
|
5696
5793
|
this._externalUserId = options?.externalUserId;
|
|
5794
|
+
this._surfaceName = options?.surfaceName;
|
|
5795
|
+
this._surfaceVersion = options?.surfaceVersion;
|
|
5697
5796
|
}
|
|
5698
5797
|
/**
|
|
5699
5798
|
* Connects to WebSocket with organization and tenant headers
|
|
@@ -5712,6 +5811,12 @@ class WebSocketSession extends BaseWebSocket {
|
|
|
5712
5811
|
if (this._externalUserId) {
|
|
5713
5812
|
query[WEBSOCKET_QUERY_PARAMS.EXTERNAL_USER_ID] = this._externalUserId;
|
|
5714
5813
|
}
|
|
5814
|
+
if (this._surfaceName) {
|
|
5815
|
+
query[WEBSOCKET_QUERY_PARAMS.CONVERSATIONAL_SURFACE_NAME] = this._surfaceName;
|
|
5816
|
+
}
|
|
5817
|
+
if (this._surfaceVersion) {
|
|
5818
|
+
query[WEBSOCKET_QUERY_PARAMS.CONVERSATIONAL_SURFACE_VERSION] = this._surfaceVersion;
|
|
5819
|
+
}
|
|
5715
5820
|
this.connectWithOptions({ query });
|
|
5716
5821
|
}
|
|
5717
5822
|
/**
|
|
@@ -6008,7 +6113,7 @@ class ConversationService extends BaseService {
|
|
|
6008
6113
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6009
6114
|
*/
|
|
6010
6115
|
constructor(instance, options) {
|
|
6011
|
-
super(instance, options
|
|
6116
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
6012
6117
|
/** Event helper for conversation events */
|
|
6013
6118
|
this._eventHelper = null;
|
|
6014
6119
|
this._sessionManager = new SessionManager(instance, options);
|
|
@@ -6419,7 +6524,7 @@ class MessageService extends BaseService {
|
|
|
6419
6524
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6420
6525
|
*/
|
|
6421
6526
|
constructor(instance, options) {
|
|
6422
|
-
super(instance, options
|
|
6527
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
6423
6528
|
}
|
|
6424
6529
|
/**
|
|
6425
6530
|
* Gets a message by ID
|
|
@@ -6480,6 +6585,87 @@ __decorate([
|
|
|
6480
6585
|
track('ConversationalAgent.Messages.GetContentPartById')
|
|
6481
6586
|
], MessageService.prototype, "getContentPartById", null);
|
|
6482
6587
|
|
|
6588
|
+
/**
|
|
6589
|
+
* UserSettingsService - Service for managing user profile and context settings
|
|
6590
|
+
*/
|
|
6591
|
+
/**
|
|
6592
|
+
* Service for reading and updating the current user's profile and context settings.
|
|
6593
|
+
*
|
|
6594
|
+
* User settings are user-supplied profile fields (name, email, role, department, company,
|
|
6595
|
+
* country, timezone) that the SDK passes to a UiPath Conversational Agent on every conversation
|
|
6596
|
+
* so the agent can personalize its responses.
|
|
6597
|
+
*/
|
|
6598
|
+
class UserSettingsService extends BaseService {
|
|
6599
|
+
/**
|
|
6600
|
+
* Creates an instance of the UserSettingsService.
|
|
6601
|
+
*
|
|
6602
|
+
* @param instance - UiPath SDK instance providing authentication and configuration
|
|
6603
|
+
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6604
|
+
*/
|
|
6605
|
+
constructor(instance, options) {
|
|
6606
|
+
super(instance, options?.externalUserId ? { [EXTERNAL_USER_ID]: options.externalUserId } : undefined);
|
|
6607
|
+
}
|
|
6608
|
+
/**
|
|
6609
|
+
* Gets the current user's profile and context settings.
|
|
6610
|
+
*
|
|
6611
|
+
* Returns the full user settings record — profile fields the agent uses for personalization
|
|
6612
|
+
* (name, email, role, department, company, country, timezone) plus identifiers and timestamps.
|
|
6613
|
+
* Fields the user has not set are returned as `null`.
|
|
6614
|
+
*
|
|
6615
|
+
* @returns Promise resolving to the current user's settings
|
|
6616
|
+
* {@link UserSettingsGetResponse}
|
|
6617
|
+
*
|
|
6618
|
+
* @example
|
|
6619
|
+
* ```typescript
|
|
6620
|
+
* const settings = await conversationalAgent.user.getSettings();
|
|
6621
|
+
* console.log(settings.name); // e.g. 'John Doe' or null
|
|
6622
|
+
* console.log(settings.email); // e.g. 'john@example.com' or null
|
|
6623
|
+
* console.log(settings.timezone); // e.g. 'America/New_York' or null
|
|
6624
|
+
* ```
|
|
6625
|
+
*/
|
|
6626
|
+
async getSettings() {
|
|
6627
|
+
const response = await this.get(USER_ENDPOINTS.SETTINGS);
|
|
6628
|
+
return transformData(response.data, UserSettingsMap);
|
|
6629
|
+
}
|
|
6630
|
+
/**
|
|
6631
|
+
* Updates the current user's profile and context settings.
|
|
6632
|
+
*
|
|
6633
|
+
* Accepts a partial payload — only fields included in `options` are changed. Pass `null` to
|
|
6634
|
+
* explicitly clear a field. Omitting a field leaves it unchanged. Returns the full updated
|
|
6635
|
+
* settings record.
|
|
6636
|
+
*
|
|
6637
|
+
* @param options - Fields to update; omit fields to leave them unchanged, set to `null` to clear
|
|
6638
|
+
* @returns Promise resolving to the updated user settings
|
|
6639
|
+
* {@link UserSettingsUpdateResponse}
|
|
6640
|
+
*
|
|
6641
|
+
* @example Partial update
|
|
6642
|
+
* ```typescript
|
|
6643
|
+
* const updated = await conversationalAgent.user.updateSettings({
|
|
6644
|
+
* name: 'John Doe',
|
|
6645
|
+
* timezone: 'America/New_York'
|
|
6646
|
+
* });
|
|
6647
|
+
* ```
|
|
6648
|
+
*
|
|
6649
|
+
* @example Clear fields by setting to null
|
|
6650
|
+
* ```typescript
|
|
6651
|
+
* await conversationalAgent.user.updateSettings({
|
|
6652
|
+
* role: null,
|
|
6653
|
+
* department: null
|
|
6654
|
+
* });
|
|
6655
|
+
* ```
|
|
6656
|
+
*/
|
|
6657
|
+
async updateSettings(options) {
|
|
6658
|
+
const response = await this.patch(USER_ENDPOINTS.SETTINGS, options);
|
|
6659
|
+
return transformData(response.data, UserSettingsMap);
|
|
6660
|
+
}
|
|
6661
|
+
}
|
|
6662
|
+
__decorate([
|
|
6663
|
+
track('ConversationalAgent.UserSettings.GetSettings')
|
|
6664
|
+
], UserSettingsService.prototype, "getSettings", null);
|
|
6665
|
+
__decorate([
|
|
6666
|
+
track('ConversationalAgent.UserSettings.UpdateSettings')
|
|
6667
|
+
], UserSettingsService.prototype, "updateSettings", null);
|
|
6668
|
+
|
|
6483
6669
|
/**
|
|
6484
6670
|
* ConversationalAgentService - Main entry point for Conversational Agent functionality
|
|
6485
6671
|
*/
|
|
@@ -6494,9 +6680,10 @@ class ConversationalAgentService extends BaseService {
|
|
|
6494
6680
|
* @param options - Optional configuration (e.g. externalUserId for external app auth)
|
|
6495
6681
|
*/
|
|
6496
6682
|
constructor(instance, options) {
|
|
6497
|
-
super(instance, options
|
|
6683
|
+
super(instance, buildConversationalAgentHeaders(options));
|
|
6498
6684
|
// Create conversation service with WebSocket support
|
|
6499
6685
|
this.conversations = new ConversationService(instance, options);
|
|
6686
|
+
this.user = new UserSettingsService(instance, options);
|
|
6500
6687
|
}
|
|
6501
6688
|
/**
|
|
6502
6689
|
* Registers a handler that is called whenever the WebSocket connection status changes.
|
|
@@ -6582,76 +6769,4 @@ __decorate([
|
|
|
6582
6769
|
track('ConversationalAgent.GetById')
|
|
6583
6770
|
], ConversationalAgentService.prototype, "getById", null);
|
|
6584
6771
|
|
|
6585
|
-
|
|
6586
|
-
* UserService - Service for managing user profile and context settings
|
|
6587
|
-
*/
|
|
6588
|
-
/**
|
|
6589
|
-
* Service for managing user profile and context settings
|
|
6590
|
-
*
|
|
6591
|
-
* User settings are passed to the agent for all conversations
|
|
6592
|
-
* to provide user context (name, email, role, timezone, etc.).
|
|
6593
|
-
*
|
|
6594
|
-
* @internal
|
|
6595
|
-
*/
|
|
6596
|
-
class UserService extends BaseService {
|
|
6597
|
-
/**
|
|
6598
|
-
* Gets the current user's profile and context settings
|
|
6599
|
-
*
|
|
6600
|
-
* @returns Promise resolving to user settings object containing profile information
|
|
6601
|
-
*
|
|
6602
|
-
* @example
|
|
6603
|
-
* ```typescript
|
|
6604
|
-
* const userSettings = await userService.getSettings();
|
|
6605
|
-
* console.log(userSettings.name); // User's name
|
|
6606
|
-
* console.log(userSettings.email); // User's email
|
|
6607
|
-
* console.log(userSettings.timezone); // User's timezone
|
|
6608
|
-
* ```
|
|
6609
|
-
*/
|
|
6610
|
-
async getSettings() {
|
|
6611
|
-
const response = await this.get(USER_ENDPOINTS.SETTINGS);
|
|
6612
|
-
return transformData(response.data, UserSettingsMap);
|
|
6613
|
-
}
|
|
6614
|
-
/**
|
|
6615
|
-
* Updates the current user's profile and context settings
|
|
6616
|
-
*
|
|
6617
|
-
* All fields are optional - only send the fields you want to change.
|
|
6618
|
-
* Set fields to `null` to explicitly clear them.
|
|
6619
|
-
* Omitting fields means no change.
|
|
6620
|
-
*
|
|
6621
|
-
* @param options - Fields to update
|
|
6622
|
-
* @returns Promise resolving to updated user settings object
|
|
6623
|
-
*
|
|
6624
|
-
* @example
|
|
6625
|
-
* ```typescript
|
|
6626
|
-
* // Update specific fields
|
|
6627
|
-
* const updatedUserSettings = await userService.updateSettings({
|
|
6628
|
-
* name: 'John Doe',
|
|
6629
|
-
* email: 'john@example.com',
|
|
6630
|
-
* timezone: 'America/New_York'
|
|
6631
|
-
* });
|
|
6632
|
-
*
|
|
6633
|
-
* // Partial update - only change timezone
|
|
6634
|
-
* await userService.updateSettings({
|
|
6635
|
-
* timezone: 'Europe/London'
|
|
6636
|
-
* });
|
|
6637
|
-
*
|
|
6638
|
-
* // Clear fields by setting to null
|
|
6639
|
-
* await userService.updateSettings({
|
|
6640
|
-
* role: null,
|
|
6641
|
-
* department: null
|
|
6642
|
-
* });
|
|
6643
|
-
* ```
|
|
6644
|
-
*/
|
|
6645
|
-
async updateSettings(options) {
|
|
6646
|
-
const response = await this.patch(USER_ENDPOINTS.SETTINGS, options);
|
|
6647
|
-
return transformData(response.data, UserSettingsMap);
|
|
6648
|
-
}
|
|
6649
|
-
}
|
|
6650
|
-
__decorate([
|
|
6651
|
-
track('ConversationalAgent.User.GetSettings')
|
|
6652
|
-
], UserService.prototype, "getSettings", null);
|
|
6653
|
-
__decorate([
|
|
6654
|
-
track('ConversationalAgent.User.UpdateSettings')
|
|
6655
|
-
], UserService.prototype, "updateSettings", null);
|
|
6656
|
-
|
|
6657
|
-
export { AgentMap, AsyncInputStreamEventHelper, AsyncInputStreamEventHelperImpl, AsyncToolCallEventHelper, AsyncToolCallEventHelperImpl, CitationErrorType, ContentPartEventHelper, ContentPartEventHelperImpl, ContentPartHelper, ConversationEventHelperBase, ConversationEventHelperManager, ConversationEventHelperManagerImpl, ConversationEventInvalidOperationError, ConversationEventValidationError, ConversationMap, ConversationalAgentService as ConversationalAgent, ConversationalAgentService, EventErrorId, ExchangeEventHelper, ExchangeEventHelperImpl, ExchangeMap, ExchangeService, ExchangeService as Exchanges, FeedbackRating, InputStreamSpeechSensitivity, InterruptType, LogLevel, MessageEventHelper, MessageEventHelperImpl, MessageMap, MessageRole, MessageService, MessageService as Messages, SessionEventHelper, SessionEventHelperImpl, SortOrder, ToolCallEventHelper, ToolCallEventHelperImpl, UserService as User, UserService, UserSettingsMap, assertCitationSourceMedia, assertCitationSourceUrl, assertExternalValue, assertInlineValue, createAgentWithMethods, createConversationWithMethods, isCitationSourceMedia, isCitationSourceUrl, isExternalValue, isInlineValue, transformExchange, transformExchanges, transformMessage };
|
|
6772
|
+
export { AgentMap, AsyncInputStreamEventHelper, AsyncInputStreamEventHelperImpl, AsyncToolCallEventHelper, AsyncToolCallEventHelperImpl, CitationErrorType, ContentPartEventHelper, ContentPartEventHelperImpl, ContentPartHelper, ConversationEventHelperBase, ConversationEventHelperManager, ConversationEventHelperManagerImpl, ConversationEventInvalidOperationError, ConversationEventValidationError, ConversationMap, ConversationalAgentService as ConversationalAgent, ConversationalAgentService, EventErrorId, ExchangeEventHelper, ExchangeEventHelperImpl, ExchangeMap, ExchangeService, ExchangeService as Exchanges, FeedbackRating, InputStreamSpeechSensitivity, InterruptType, LogLevel, MessageEventHelper, MessageEventHelperImpl, MessageMap, MessageRole, MessageService, MessageService as Messages, SessionEventHelper, SessionEventHelperImpl, SortOrder, ToolCallEventHelper, ToolCallEventHelperImpl, UserSettingsService as UserSettings, UserSettingsMap, UserSettingsService, assertCitationSourceMedia, assertCitationSourceUrl, assertExternalValue, assertInlineValue, createAgentWithMethods, createConversationWithMethods, isCitationSourceMedia, isCitationSourceUrl, isExternalValue, isInlineValue, transformExchange, transformExchanges, transformMessage };
|
package/dist/core/index.cjs
CHANGED
|
@@ -4869,6 +4869,7 @@ class TokenManager {
|
|
|
4869
4869
|
const GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4870
4870
|
class AuthService {
|
|
4871
4871
|
constructor(config, executionContext) {
|
|
4872
|
+
this.skipAcrValues = false;
|
|
4872
4873
|
// Only use stored OAuth context when completing an active callback (URL has ?code=).
|
|
4873
4874
|
// If stored context exists but we're NOT in a callback, it's stale from a
|
|
4874
4875
|
// failed/abandoned flow (e.g. scope mismatch, invalid redirect URI) and must
|
|
@@ -4960,6 +4961,14 @@ class AuthService {
|
|
|
4960
4961
|
getTokenManager() {
|
|
4961
4962
|
return this.tokenManager;
|
|
4962
4963
|
}
|
|
4964
|
+
/**
|
|
4965
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
4966
|
+
*
|
|
4967
|
+
* @internal
|
|
4968
|
+
*/
|
|
4969
|
+
setMultiLogin() {
|
|
4970
|
+
this.skipAcrValues = true;
|
|
4971
|
+
}
|
|
4963
4972
|
/**
|
|
4964
4973
|
* Authenticates the user based on the provided SDK configuration.
|
|
4965
4974
|
* This method handles OAuth 2.0 authentication flow only.
|
|
@@ -5161,7 +5170,10 @@ class AuthService {
|
|
|
5161
5170
|
scope: params.scope + ' offline_access',
|
|
5162
5171
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
5163
5172
|
});
|
|
5164
|
-
|
|
5173
|
+
const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
5174
|
+
return this.skipAcrValues
|
|
5175
|
+
? authorizeUrl
|
|
5176
|
+
: `${authorizeUrl}&acr_values=${acrValues}`;
|
|
5165
5177
|
}
|
|
5166
5178
|
/**
|
|
5167
5179
|
* Exchanges the authorization code for an access token and automatically updates the current token
|
|
@@ -5295,7 +5307,7 @@ function normalizeBaseUrl(url) {
|
|
|
5295
5307
|
// Connection string placeholder that will be replaced during build
|
|
5296
5308
|
const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
5297
5309
|
// SDK Version placeholder
|
|
5298
|
-
const SDK_VERSION = "1.3.
|
|
5310
|
+
const SDK_VERSION = "1.3.7";
|
|
5299
5311
|
const VERSION = "Version";
|
|
5300
5312
|
const SERVICE = "Service";
|
|
5301
5313
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5642,6 +5654,8 @@ var UiPathMetaTags;
|
|
|
5642
5654
|
// Asset resolution and routing
|
|
5643
5655
|
UiPathMetaTags["CDN_BASE"] = "uipath:cdn-base";
|
|
5644
5656
|
UiPathMetaTags["APP_BASE"] = "uipath:app-base";
|
|
5657
|
+
// Folder context (injected during coded-app deployment)
|
|
5658
|
+
UiPathMetaTags["FOLDER_KEY"] = "uipath:folder-key";
|
|
5645
5659
|
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
5646
5660
|
|
|
5647
5661
|
/**
|
|
@@ -5670,12 +5684,13 @@ function loadFromMetaTags() {
|
|
|
5670
5684
|
tenantName: getMetaTagContent(UiPathMetaTags.TENANT_NAME),
|
|
5671
5685
|
baseUrl: getMetaTagContent(UiPathMetaTags.BASE_URL),
|
|
5672
5686
|
redirectUri: getMetaTagContent(UiPathMetaTags.REDIRECT_URI),
|
|
5687
|
+
folderKey: getMetaTagContent(UiPathMetaTags.FOLDER_KEY),
|
|
5673
5688
|
};
|
|
5674
5689
|
const hasAnyValue = Object.values(config).some(Boolean);
|
|
5675
5690
|
return hasAnyValue ? config : null;
|
|
5676
5691
|
}
|
|
5677
5692
|
|
|
5678
|
-
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5693
|
+
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_metaFolderKey, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5679
5694
|
/**
|
|
5680
5695
|
* UiPath - Core SDK class for authentication and configuration management.
|
|
5681
5696
|
*
|
|
@@ -5715,8 +5730,14 @@ class UiPath {
|
|
|
5715
5730
|
_UiPath_authService.set(this, void 0);
|
|
5716
5731
|
_UiPath_initialized.set(this, false);
|
|
5717
5732
|
_UiPath_partialConfig.set(this, void 0);
|
|
5733
|
+
_UiPath_multiLogin.set(this, false);
|
|
5734
|
+
// Folder key sourced only from `<meta name="uipath:folder-key">` (coded-app
|
|
5735
|
+
// deployments). Not accepted via the public constructor; lives here so the
|
|
5736
|
+
// SDK can flow it through to BaseService.config without polluting BaseConfig.
|
|
5737
|
+
_UiPath_metaFolderKey.set(this, void 0);
|
|
5718
5738
|
// Load configuration from meta tags
|
|
5719
5739
|
const configFromMetaTags = loadFromMetaTags();
|
|
5740
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
5720
5741
|
// Merge configuration: constructor config overrides meta tags
|
|
5721
5742
|
const mergedConfig = config ? { ...configFromMetaTags, ...config } : configFromMetaTags;
|
|
5722
5743
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
@@ -5765,6 +5786,15 @@ class UiPath {
|
|
|
5765
5786
|
throw new Error(`Failed to initialize UiPath SDK: ${errorMessage}`);
|
|
5766
5787
|
}
|
|
5767
5788
|
}
|
|
5789
|
+
/**
|
|
5790
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
5791
|
+
*
|
|
5792
|
+
* @internal
|
|
5793
|
+
*/
|
|
5794
|
+
setMultiLogin() {
|
|
5795
|
+
__classPrivateFieldSet(this, _UiPath_multiLogin, true, "f");
|
|
5796
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.setMultiLogin();
|
|
5797
|
+
}
|
|
5768
5798
|
/**
|
|
5769
5799
|
* Check if the SDK has been initialized
|
|
5770
5800
|
*/
|
|
@@ -5836,7 +5866,7 @@ class UiPath {
|
|
|
5836
5866
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
5837
5867
|
}
|
|
5838
5868
|
}
|
|
5839
|
-
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
|
|
5869
|
+
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_multiLogin = new WeakMap(), _UiPath_metaFolderKey = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
|
|
5840
5870
|
// Validate and normalize the configuration
|
|
5841
5871
|
validateConfig(config);
|
|
5842
5872
|
const hasSecretAuth = hasSecretConfig(config);
|
|
@@ -5849,16 +5879,22 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
5849
5879
|
secret: hasSecretAuth ? config.secret : undefined,
|
|
5850
5880
|
clientId: hasOAuthAuth ? config.clientId : undefined,
|
|
5851
5881
|
redirectUri: hasOAuthAuth ? config.redirectUri : undefined,
|
|
5852
|
-
scope: hasOAuthAuth ? config.scope : undefined
|
|
5882
|
+
scope: hasOAuthAuth ? config.scope : undefined,
|
|
5853
5883
|
});
|
|
5854
5884
|
const executionContext = new ExecutionContext();
|
|
5855
5885
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
5886
|
+
if (__classPrivateFieldGet(this, _UiPath_multiLogin, "f")) {
|
|
5887
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
|
|
5888
|
+
}
|
|
5856
5889
|
__classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
|
|
5857
|
-
// Store internals in SDKInternalsRegistry (not visible on instance)
|
|
5890
|
+
// Store internals in SDKInternalsRegistry (not visible on instance).
|
|
5891
|
+
// `folderKey` is meta-tag-only — kept off `UiPathConfig` (which mirrors
|
|
5892
|
+
// user-passed values) and lives here on the runtime registry instead.
|
|
5858
5893
|
SDKInternalsRegistry.set(this, {
|
|
5859
5894
|
config: internalConfig,
|
|
5860
5895
|
context: executionContext,
|
|
5861
|
-
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager()
|
|
5896
|
+
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
5897
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
5862
5898
|
});
|
|
5863
5899
|
// Expose read-only config for user convenience
|
|
5864
5900
|
this.config = {
|
|
@@ -5886,6 +5922,7 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
5886
5922
|
}, _UiPath_loadConfig = function _UiPath_loadConfig() {
|
|
5887
5923
|
// Load from meta tags
|
|
5888
5924
|
const metaConfig = loadFromMetaTags();
|
|
5925
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
5889
5926
|
// Merge with any partial config from constructor (constructor overrides meta tags)
|
|
5890
5927
|
const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
|
|
5891
5928
|
if (!isCompleteConfig(merged)) {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ interface IUiPath {
|
|
|
49
49
|
* For OAuth, this handles the authentication flow.
|
|
50
50
|
*/
|
|
51
51
|
initialize(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
54
|
+
*/
|
|
55
|
+
setMultiLogin(): void;
|
|
52
56
|
/**
|
|
53
57
|
* Check if the SDK has been initialized
|
|
54
58
|
*/
|
|
@@ -126,6 +130,12 @@ declare class UiPath implements IUiPath {
|
|
|
126
130
|
* If no config was provided in constructor, loads from meta tags.
|
|
127
131
|
*/
|
|
128
132
|
initialize(): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
135
|
+
*
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
setMultiLogin(): void;
|
|
129
139
|
/**
|
|
130
140
|
* Check if the SDK has been initialized
|
|
131
141
|
*/
|
|
@@ -519,7 +529,7 @@ declare const telemetryClient: TelemetryClient;
|
|
|
519
529
|
* SDK Telemetry constants
|
|
520
530
|
*/
|
|
521
531
|
declare const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
522
|
-
declare const SDK_VERSION = "1.3.
|
|
532
|
+
declare const SDK_VERSION = "1.3.7";
|
|
523
533
|
declare const VERSION = "Version";
|
|
524
534
|
declare const SERVICE = "Service";
|
|
525
535
|
declare const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|