@uipath/conversational-tool 1.202.0 → 1.202.1-preview.167

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.
@@ -5,7 +5,7 @@ compiled into its `dist/` output rather than installed alongside it.
5
5
  Their licences and copyright notices are reproduced here in full, as
6
6
  those licences require.
7
7
 
8
- 32 bundled dependencies:
8
+ 34 bundled dependencies:
9
9
 
10
10
  - @opentelemetry/api@1.9.1 — Apache-2.0
11
11
  - @opentelemetry/api-logs@0.204.0 — Apache-2.0
@@ -14,6 +14,8 @@ those licences require.
14
14
  - @opentelemetry/sdk-logs@0.204.0 — Apache-2.0
15
15
  - @opentelemetry/semantic-conventions@1.43.0 — Apache-2.0
16
16
  - @socket.io/component-emitter@3.1.2 — MIT
17
+ - @uipath/core-telemetry@1.0.0-beta.3 — MIT
18
+ - @uipath/uipath-typescript@1.7.1 — MIT
17
19
  - bundle-name@4.1.0 — MIT
18
20
  - commander@14.0.3 — MIT
19
21
  - debug@4.4.3 — MIT
@@ -38,7 +40,7 @@ those licences require.
38
40
  - supports-color@7.2.0 — MIT
39
41
  - ws@8.21.1 — MIT
40
42
  - wsl-utils@0.3.1 — MIT
41
- - xmlhttprequest-ssl@2.1.2 —
43
+ - xmlhttprequest-ssl@2.1.2 — MIT
42
44
 
43
45
  ---
44
46
 
@@ -1335,6 +1337,34 @@ OTHER DEALINGS IN THE SOFTWARE.
1335
1337
 
1336
1338
  ---
1337
1339
 
1340
+ ## @uipath/core-telemetry@1.0.0-beta.3
1341
+
1342
+ SPDX: MIT
1343
+
1344
+ The upstream package ships no licence file here; `MIT` is the
1345
+ licence it is distributed under. The canonical text of that licence
1346
+ applies, with copyright held by the package's authors.
1347
+
1348
+ ---
1349
+
1350
+ ## @uipath/uipath-typescript@1.7.1
1351
+
1352
+ SPDX: MIT
1353
+
1354
+ ```
1355
+ MIT License
1356
+
1357
+ Copyright 2025-present UiPath
1358
+
1359
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1360
+
1361
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1362
+
1363
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1364
+ ```
1365
+
1366
+ ---
1367
+
1338
1368
  ## bundle-name@4.1.0
1339
1369
 
1340
1370
  SPDX: MIT
@@ -1880,7 +1910,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1880
1910
 
1881
1911
  ## xmlhttprequest-ssl@2.1.2
1882
1912
 
1883
- SPDX: not declared; see the text below
1913
+ Licence decision: Ships the MIT text with no `license` field; taken from the text it actually ships rather than assumed.
1914
+
1915
+ SPDX: MIT
1884
1916
 
1885
1917
  ```
1886
1918
  Copyright (c) 2010 passive.ly LLC
@@ -4,7 +4,7 @@ import {
4
4
  getLoginStatusAsync,
5
5
  getSdkUserAgentToken,
6
6
  package_default
7
- } from "./tool-sz8zdfbv.js";
7
+ } from "./tool-azng6dhs.js";
8
8
  import"./tool-1yh8g550.js";
9
9
 
10
10
  // src/api/cas-client.ts
@@ -7154,7 +7154,8 @@ var RESPONSE_TYPES = {
7154
7154
  JSON: "json",
7155
7155
  TEXT: "text",
7156
7156
  BLOB: "blob",
7157
- ARRAYBUFFER: "arraybuffer"
7157
+ ARRAYBUFFER: "arraybuffer",
7158
+ STREAM: "stream"
7158
7159
  };
7159
7160
  var EXTERNAL_USER_ID = "x-uipath-external-user-id";
7160
7161
  var CONVERSATIONAL_SURFACE_NAME = "x-uipath-conversational-surfacename";
@@ -7166,6 +7167,165 @@ var WEBSOCKET_QUERY_PARAMS = {
7166
7167
  CONVERSATIONAL_SURFACE_NAME,
7167
7168
  CONVERSATIONAL_SURFACE_VERSION
7168
7169
  };
7170
+ function toSearchParams(params) {
7171
+ const searchParams = new URLSearchParams;
7172
+ if (!params)
7173
+ return searchParams;
7174
+ for (const [key, value2] of Object.entries(params)) {
7175
+ if (value2 === undefined || value2 === null)
7176
+ continue;
7177
+ if (Array.isArray(value2)) {
7178
+ value2.forEach((item) => {
7179
+ if (item !== undefined && item !== null)
7180
+ searchParams.append(key, String(item));
7181
+ });
7182
+ } else {
7183
+ searchParams.append(key, String(value2));
7184
+ }
7185
+ }
7186
+ return searchParams;
7187
+ }
7188
+ var DEFAULT_RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
7189
+ var DEFAULT_RETRY_METHODS = ["GET", "HEAD", "PUT", "DELETE", "OPTIONS"];
7190
+ var DEFAULT_RETRY_OPTIONS = {
7191
+ maxRetries: 2,
7192
+ initialDelayMs: 500,
7193
+ backoffStrategy: "exponential",
7194
+ backoffFactor: 2,
7195
+ backoffMaxDelayMs: 30000,
7196
+ retryableStatusCodes: DEFAULT_RETRYABLE_STATUS_CODES,
7197
+ retryMethods: DEFAULT_RETRY_METHODS,
7198
+ retryNetworkErrors: true,
7199
+ respectRetryAfter: true,
7200
+ maxRetryAfterMs: Infinity
7201
+ };
7202
+ var DEFAULT_API_CLIENT_RETRY = {
7203
+ ...DEFAULT_RETRY_OPTIONS,
7204
+ maxRetries: 0
7205
+ };
7206
+ function resolveRetryOptions(settings, defaults = DEFAULT_RETRY_OPTIONS) {
7207
+ if (!settings)
7208
+ return defaults;
7209
+ const { retryDelay, useExponentialBackoff, ...live } = settings;
7210
+ const resolved = { ...defaults };
7211
+ for (const [key, value2] of Object.entries(live)) {
7212
+ if (value2 !== undefined) {
7213
+ resolved[key] = value2;
7214
+ }
7215
+ }
7216
+ if (retryDelay !== undefined && live.initialDelayMs === undefined) {
7217
+ resolved.initialDelayMs = retryDelay;
7218
+ }
7219
+ if (useExponentialBackoff !== undefined && live.backoffStrategy === undefined) {
7220
+ resolved.backoffStrategy = useExponentialBackoff ? "exponential" : "constant";
7221
+ }
7222
+ return resolved;
7223
+ }
7224
+ function computeBackoffDelay(attempt, settings) {
7225
+ const base = Math.max(0, settings.initialDelayMs);
7226
+ let delay;
7227
+ switch (settings.backoffStrategy) {
7228
+ case "constant":
7229
+ delay = base;
7230
+ break;
7231
+ case "linear":
7232
+ delay = base * (attempt + 1);
7233
+ break;
7234
+ default:
7235
+ delay = base * Math.pow(settings.backoffFactor, attempt);
7236
+ }
7237
+ return Math.min(delay, settings.backoffMaxDelayMs);
7238
+ }
7239
+ function parseRetryAfter(value2, now = Date.now()) {
7240
+ const trimmed = value2?.trim();
7241
+ if (!trimmed)
7242
+ return;
7243
+ const seconds = Number(trimmed);
7244
+ if (Number.isFinite(seconds))
7245
+ return Math.max(0, seconds * 1000);
7246
+ const date = Date.parse(trimmed);
7247
+ if (Number.isNaN(date))
7248
+ return;
7249
+ return Math.max(0, date - now);
7250
+ }
7251
+ function wait(durationMs) {
7252
+ return new Promise((resolve) => setTimeout(resolve, Math.max(0, durationMs)));
7253
+ }
7254
+ var RETRY_AFTER = "retry-after";
7255
+ function createAttemptSignal(timeoutMs, external) {
7256
+ if (timeoutMs === undefined || !Number.isFinite(timeoutMs))
7257
+ return { signal: external, dispose: () => {} };
7258
+ const controller = new AbortController;
7259
+ const timer = setTimeout(() => controller.abort(new Error(`Request timeout after ${timeoutMs}ms`)), timeoutMs);
7260
+ const onExternalAbort = () => controller.abort(external?.reason);
7261
+ if (external) {
7262
+ if (external.aborted) {
7263
+ controller.abort(external.reason);
7264
+ } else {
7265
+ external.addEventListener("abort", onExternalAbort);
7266
+ }
7267
+ }
7268
+ return {
7269
+ signal: controller.signal,
7270
+ dispose: () => {
7271
+ clearTimeout(timer);
7272
+ external?.removeEventListener("abort", onExternalAbort);
7273
+ }
7274
+ };
7275
+ }
7276
+ function delayBeforeRetry(durationMs, signal) {
7277
+ if (!signal)
7278
+ return wait(durationMs);
7279
+ if (signal.aborted)
7280
+ return Promise.reject(signal.reason);
7281
+ return new Promise((resolve, reject) => {
7282
+ const onAbort = () => {
7283
+ clearTimeout(timer);
7284
+ reject(signal.reason);
7285
+ };
7286
+ const timer = setTimeout(() => {
7287
+ signal.removeEventListener("abort", onAbort);
7288
+ resolve();
7289
+ }, Math.max(0, durationMs));
7290
+ signal.addEventListener("abort", onAbort);
7291
+ });
7292
+ }
7293
+ async function fetchWithRetry(url2, init, options) {
7294
+ const settings = options.retry;
7295
+ const method = (init.method ?? "GET").toUpperCase();
7296
+ const retriesAllowed = settings.retryMethods.includes(method) ? Math.max(0, settings.maxRetries) : 0;
7297
+ let attempt = 0;
7298
+ for (;; ) {
7299
+ const { signal, dispose } = createAttemptSignal(options.timeoutMs, options.signal);
7300
+ let response;
7301
+ let failure;
7302
+ try {
7303
+ response = await fetch(url2, { ...init, signal });
7304
+ } catch (error) {
7305
+ failure = error;
7306
+ } finally {
7307
+ dispose();
7308
+ }
7309
+ if (options.signal?.aborted && failure !== undefined)
7310
+ throw failure;
7311
+ if (response && !settings.retryableStatusCodes.includes(response.status))
7312
+ return response;
7313
+ if (failure !== undefined && !settings.retryNetworkErrors)
7314
+ throw failure;
7315
+ if (attempt >= retriesAllowed) {
7316
+ if (response)
7317
+ return response;
7318
+ throw failure;
7319
+ }
7320
+ const retryAfter = settings.respectRetryAfter && response ? parseRetryAfter(response.headers.get(RETRY_AFTER)) : undefined;
7321
+ const delay = retryAfter !== undefined ? Math.min(retryAfter, settings.maxRetryAfterMs) : computeBackoffDelay(attempt, settings);
7322
+ response?.body?.cancel().catch((error) => {
7323
+ console.warn("[UiPath SDK] Could not release a discarded response body:", error);
7324
+ });
7325
+ await delayBeforeRetry(delay, options.signal);
7326
+ attempt++;
7327
+ }
7328
+ }
7169
7329
 
7170
7330
  class ApiClient {
7171
7331
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
@@ -7200,28 +7360,16 @@ class ApiClient {
7200
7360
  [UIPATH_TRACEPARENT_ID]: traceparentValue,
7201
7361
  ...options.headers
7202
7362
  };
7203
- const searchParams = new URLSearchParams;
7204
- if (options.params) {
7205
- Object.entries(options.params).forEach(([key, value2]) => {
7206
- if (Array.isArray(value2)) {
7207
- value2.forEach((item) => searchParams.append(key, String(item)));
7208
- } else {
7209
- searchParams.append(key, String(value2));
7210
- }
7211
- });
7212
- }
7363
+ const searchParams = toSearchParams(options.params);
7213
7364
  const fullUrl = searchParams.toString() ? `${url2}?${searchParams.toString()}` : url2;
7214
7365
  let body = undefined;
7215
7366
  if (options.body) {
7216
7367
  body = isFormData ? options.body : JSON.stringify(options.body);
7217
7368
  }
7369
+ const retrySettings = resolveRetryOptions(options.retry ?? options.retryOptions, DEFAULT_API_CLIENT_RETRY);
7370
+ const timeoutMs = options.timeoutMs ?? options.timeoutOptions?.timeout;
7218
7371
  try {
7219
- const response = await fetch(fullUrl, {
7220
- method,
7221
- headers,
7222
- body,
7223
- signal: options.signal
7224
- });
7372
+ const response = await fetchWithRetry(fullUrl, { method, headers, body }, { retry: retrySettings, timeoutMs, signal: options.signal });
7225
7373
  if (!response.ok) {
7226
7374
  const errorInfo = await errorResponseParser.parse(response);
7227
7375
  throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
@@ -7685,6 +7833,12 @@ class PaginationHelpers {
7685
7833
  });
7686
7834
  }
7687
7835
  }
7836
+ function missingConfigMessage() {
7837
+ if (isBrowser) {
7838
+ return "UiPath SDK configuration not found. " + "Ensure @uipath/coded-apps plugin is set up in your bundler to inject configuration during development and build.";
7839
+ }
7840
+ return "UiPath SDK configuration not found. " + "In a UiPath coded function, pass the handler context: new UiPath(ctx). " + "Otherwise pass { baseUrl, orgName, tenantName, secret }, " + "or set UIPATH_BASE_URL, UIPATH_ORG_NAME, UIPATH_TENANT_NAME and UIPATH_ACCESS_TOKEN.";
7841
+ }
7688
7842
  var REGISTRY_KEY = Symbol.for("@uipath/sdk-internals-registry");
7689
7843
  var getGlobalStore = () => {
7690
7844
  const globalObj = globalThis;
@@ -7693,6 +7847,7 @@ var getGlobalStore = () => {
7693
7847
  }
7694
7848
  return globalObj[REGISTRY_KEY];
7695
7849
  };
7850
+ var looksLikeUiPath = (instance) => typeof instance.initialize === "function";
7696
7851
 
7697
7852
  class SDKInternalsRegistry {
7698
7853
  static get store() {
@@ -7704,6 +7859,9 @@ class SDKInternalsRegistry {
7704
7859
  static get(instance) {
7705
7860
  const internals = this.store.get(instance);
7706
7861
  if (!internals) {
7862
+ if (looksLikeUiPath(instance)) {
7863
+ throw new Error("Cannot create a service: the UiPath instance was never configured. " + missingConfigMessage());
7864
+ }
7707
7865
  throw new Error("Invalid SDK instance. Make sure to pass a valid UiPath instance to the service constructor.");
7708
7866
  }
7709
7867
  return internals;
@@ -8027,6 +8185,16 @@ var AgentMap = {
8027
8185
  var UserSettingsMap = {
8028
8186
  ...CommonFieldMap
8029
8187
  };
8188
+ var ConnectionState;
8189
+ (function(ConnectionState2) {
8190
+ ConnectionState2["Enabled"] = "Enabled";
8191
+ ConnectionState2["Disabled"] = "Disabled";
8192
+ ConnectionState2["Expired"] = "Expired";
8193
+ ConnectionState2["Failed"] = "Failed";
8194
+ })(ConnectionState || (ConnectionState = {}));
8195
+ var ConnectionAuthMap = {
8196
+ expiresAt: "expiresTime"
8197
+ };
8030
8198
  var AUTOPILOT_BASE = "autopilotforeveryone_";
8031
8199
  var API_VERSION = "v1";
8032
8200
  var CONVERSATION_ENDPOINTS = {
@@ -8050,7 +8218,9 @@ var ATTACHMENT_ENDPOINTS = {
8050
8218
  };
8051
8219
  var AGENT_ENDPOINTS = {
8052
8220
  LIST: `${AUTOPILOT_BASE}/api/${API_VERSION}/agent`,
8053
- GET: (folderId, agentId) => `${AUTOPILOT_BASE}/api/${API_VERSION}/agent/${folderId}/${agentId}`
8221
+ GET: (folderId, agentId) => `${AUTOPILOT_BASE}/api/${API_VERSION}/agent/${folderId}/${agentId}`,
8222
+ CONNECTIONS: (folderId, agentId) => `${AUTOPILOT_BASE}/api/${API_VERSION}/agent/${folderId}/${agentId}/connections`,
8223
+ CONNECTION_AUTH: `${AUTOPILOT_BASE}/api/${API_VERSION}/agent/connections/auth`
8054
8224
  };
8055
8225
  var USER_ENDPOINTS = {
8056
8226
  SETTINGS: `${AUTOPILOT_BASE}/api/${API_VERSION}/user/settings`
@@ -10772,6 +10942,29 @@ class ConversationalAgentService extends BaseService {
10772
10942
  const mimeType = resolveCitationMimeType(source, blob.type);
10773
10943
  return mimeType && mimeType !== blob.type ? blob.slice(0, blob.size, mimeType) : blob;
10774
10944
  }
10945
+ async getAvailableConnections(agentId, folderId) {
10946
+ const response = await this.get(AGENT_ENDPOINTS.CONNECTIONS(folderId, agentId));
10947
+ return response.data;
10948
+ }
10949
+ async updateConnectionSelections(agentId, folderId, request) {
10950
+ const response = await this.put(AGENT_ENDPOINTS.CONNECTIONS(folderId, agentId), request);
10951
+ return response.data;
10952
+ }
10953
+ async getAddConnectionUrl(item) {
10954
+ try {
10955
+ const { authUrl } = await this.fetchConnectionAuthUrl(item.connectorKey);
10956
+ return authUrl;
10957
+ } catch {
10958
+ return item.connectionsUrl ?? item.configurationUrl ?? null;
10959
+ }
10960
+ }
10961
+ async getConnectionAuthUrl(connectorKey) {
10962
+ return this.fetchConnectionAuthUrl(connectorKey);
10963
+ }
10964
+ async fetchConnectionAuthUrl(connectorKey) {
10965
+ const response = await this.post(AGENT_ENDPOINTS.CONNECTION_AUTH, { connectorKey });
10966
+ return transformData(response.data, ConnectionAuthMap);
10967
+ }
10775
10968
  async getFeatureFlags() {
10776
10969
  const response = await this.get(FEATURE_ENDPOINTS.FEATURE_FLAGS);
10777
10970
  return response.data;
@@ -10786,6 +10979,18 @@ __decorate([
10786
10979
  __decorate([
10787
10980
  track("ConversationalAgent.DownloadCitationSource")
10788
10981
  ], ConversationalAgentService.prototype, "downloadCitationSource", null);
10982
+ __decorate([
10983
+ track("ConversationalAgent.GetAvailableConnections")
10984
+ ], ConversationalAgentService.prototype, "getAvailableConnections", null);
10985
+ __decorate([
10986
+ track("ConversationalAgent.UpdateConnectionSelections")
10987
+ ], ConversationalAgentService.prototype, "updateConnectionSelections", null);
10988
+ __decorate([
10989
+ track("ConversationalAgent.GetAddConnectionUrl")
10990
+ ], ConversationalAgentService.prototype, "getAddConnectionUrl", null);
10991
+ __decorate([
10992
+ track("ConversationalAgent.GetConnectionAuthUrl")
10993
+ ], ConversationalAgentService.prototype, "getConnectionAuthUrl", null);
10789
10994
  export {
10790
10995
  AgentMap,
10791
10996
  AsyncInputStreamEventHelper,
@@ -10793,6 +10998,8 @@ export {
10793
10998
  AsyncToolCallEventHelper,
10794
10999
  AsyncToolCallEventHelperImpl,
10795
11000
  CitationErrorType,
11001
+ ConnectionAuthMap,
11002
+ ConnectionState,
10796
11003
  ContentPartEventHelper,
10797
11004
  ContentPartEventHelperImpl,
10798
11005
  ContentPartHelper,
@@ -10844,4 +11051,4 @@ export {
10844
11051
  transformMessage
10845
11052
  };
10846
11053
 
10847
- //# debugId=EFB6E7334C72C1DA64756E2164756E21
11054
+ //# debugId=C2A4B4AA6694029164756E2164756E21
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  metadata,
4
4
  registerCommands
5
- } from "./tool-9mezv9yv.js";
5
+ } from "./tool-c5fdrxt4.js";
6
6
  import"./tool-nkyhbf79.js";
7
7
  import {
8
8
  Command
9
- } from "./tool-sz8zdfbv.js";
9
+ } from "./tool-azng6dhs.js";
10
10
  import"./tool-mpvp5rqs.js";
11
11
  import"./tool-1yh8g550.js";
12
12
 
@@ -2100,7 +2100,7 @@ var require_commander = __commonJS(function(exports) {
2100
2100
  var package_default = {
2101
2101
  name: "@uipath/conversational-tool",
2102
2102
  license: "SEE LICENSE IN LICENSE.txt",
2103
- version: "1.202.0",
2103
+ version: "1.202.1-preview.167",
2104
2104
  description: "Handle conversations with deployed UiPath conversational processes.",
2105
2105
  publishConfig: {
2106
2106
  registry: "https://npm.pkg.github.com/"
@@ -2129,7 +2129,7 @@ var package_default = {
2129
2129
  "@uipath/common": "workspace:*",
2130
2130
  "@uipath/auth": "workspace:*",
2131
2131
  "@uipath/filesystem": "workspace:*",
2132
- "@uipath/uipath-typescript": "^1.6.1",
2132
+ "@uipath/uipath-typescript": "^1.7.1",
2133
2133
  "@types/node": "^25.5.2",
2134
2134
  typescript: "^7.0.2"
2135
2135
  }
@@ -7159,4 +7159,4 @@ var CLI_EXTERNAL_USER_ID = "app-user-cli-cas";
7159
7159
 
7160
7160
  export { package_default, getFileSystem, catchError, extractErrorDetails, extractErrorMessageSync, RESULTS, EXIT_CODES, OutputFormatter, InvalidArgumentError, Command, processContext, requireConfirmation, instructionsFor, canPrompt, parseBoundedInt, getSdkUserAgentToken, addSdkUserAgentHeader, getLoginStatusAsync, CLI_EXTERNAL_USER_ID };
7161
7161
 
7162
- //# debugId=44488754EA5E27FA64756E2164756E21
7162
+ //# debugId=8CC7BEFD27FF80EA64756E2164756E21