@uipath/conversational-tool 1.198.0-preview.95 → 1.198.0

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 (2) hide show
  1. package/dist/tool.js +268 -161
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -29316,9 +29316,9 @@ var init_has_cors = __esm(() => {
29316
29316
  // ../../node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js
29317
29317
  function empty() {}
29318
29318
  function unloadHandler() {
29319
- for (let i in Request.requests) {
29320
- if (Request.requests.hasOwnProperty(i)) {
29321
- Request.requests[i].abort();
29319
+ for (let i in Request2.requests) {
29320
+ if (Request2.requests.hasOwnProperty(i)) {
29321
+ Request2.requests[i].abort();
29322
29322
  }
29323
29323
  }
29324
29324
  }
@@ -29335,7 +29335,7 @@ function newRequest(opts) {
29335
29335
  } catch (e) {}
29336
29336
  }
29337
29337
  }
29338
- var import_debug3, debug3, BaseXHR, Request, hasXHR2;
29338
+ var import_debug3, debug3, BaseXHR, Request2, hasXHR2;
29339
29339
  var init_polling_xhr = __esm(() => {
29340
29340
  init_polling();
29341
29341
  init_cjs();
@@ -29376,7 +29376,7 @@ var init_polling_xhr = __esm(() => {
29376
29376
  this.pollXhr = req;
29377
29377
  }
29378
29378
  };
29379
- Request = class Request extends $Emitter {
29379
+ Request2 = class Request2 extends $Emitter {
29380
29380
  constructor(createRequest, uri, opts) {
29381
29381
  super();
29382
29382
  this.createRequest = createRequest;
@@ -29444,8 +29444,8 @@ var init_polling_xhr = __esm(() => {
29444
29444
  return;
29445
29445
  }
29446
29446
  if (typeof document !== "undefined") {
29447
- this._index = Request.requestsCount++;
29448
- Request.requests[this._index] = this;
29447
+ this._index = Request2.requestsCount++;
29448
+ Request2.requests[this._index] = this;
29449
29449
  }
29450
29450
  }
29451
29451
  _onError(err) {
@@ -29463,7 +29463,7 @@ var init_polling_xhr = __esm(() => {
29463
29463
  } catch (e) {}
29464
29464
  }
29465
29465
  if (typeof document !== "undefined") {
29466
- delete Request.requests[this._index];
29466
+ delete Request2.requests[this._index];
29467
29467
  }
29468
29468
  this._xhr = null;
29469
29469
  }
@@ -29479,8 +29479,8 @@ var init_polling_xhr = __esm(() => {
29479
29479
  this._cleanup();
29480
29480
  }
29481
29481
  };
29482
- Request.requestsCount = 0;
29483
- Request.requests = {};
29482
+ Request2.requestsCount = 0;
29483
+ Request2.requests = {};
29484
29484
  if (typeof document !== "undefined") {
29485
29485
  if (typeof attachEvent === "function") {
29486
29486
  attachEvent("onunload", unloadHandler);
@@ -29507,7 +29507,7 @@ var init_polling_xhr_node = __esm(() => {
29507
29507
  request(opts = {}) {
29508
29508
  var _a2;
29509
29509
  Object.assign(opts, { xd: this.xd, cookieJar: (_a2 = this.socket) === null || _a2 === undefined ? undefined : _a2._cookieJar }, this.opts);
29510
- return new Request((opts2) => new XMLHttpRequest2(opts2), this.uri(), opts);
29510
+ return new Request2((opts2) => new XMLHttpRequest2(opts2), this.uri(), opts);
29511
29511
  }
29512
29512
  };
29513
29513
  });
@@ -38313,7 +38313,7 @@ var init_conversational_agent = __esm(() => {
38313
38313
  var package_default = {
38314
38314
  name: "@uipath/conversational-tool",
38315
38315
  license: "MIT",
38316
- version: "1.198.0-preview.95",
38316
+ version: "1.198.0",
38317
38317
  description: "Handle conversations with deployed UiPath conversational processes.",
38318
38318
  type: "module",
38319
38319
  main: "./dist/tool.js",
@@ -44219,11 +44219,36 @@ class NodeContextStorage {
44219
44219
  return this.storage.getStore();
44220
44220
  }
44221
44221
  }
44222
+ // ../common/src/telemetry/trace-context.ts
44223
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
44224
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
44225
+ function getProcessEnv() {
44226
+ return globalThis.process?.env;
44227
+ }
44228
+ function parseInboundTraceparent(value) {
44229
+ if (!value) {
44230
+ return;
44231
+ }
44232
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
44233
+ if (!match) {
44234
+ return;
44235
+ }
44236
+ const [, traceId, parentSpanId] = match;
44237
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
44238
+ return;
44239
+ }
44240
+ return { traceId, parentSpanId };
44241
+ }
44242
+ function getInboundTraceContext() {
44243
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
44244
+ }
44245
+
44222
44246
  // ../common/src/telemetry/session-id.ts
44223
44247
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
44224
44248
  var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
44225
44249
  var telemetrySessionIdSlot = singleton("TelemetrySessionId");
44226
- function getProcessEnv() {
44250
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
44251
+ function getProcessEnv2() {
44227
44252
  return globalThis.process?.env;
44228
44253
  }
44229
44254
  function normalizeSessionId(value) {
@@ -44234,18 +44259,165 @@ function normalizeSessionId(value) {
44234
44259
  return trimmed || undefined;
44235
44260
  }
44236
44261
  function getConfiguredTelemetrySessionId() {
44237
- return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
44262
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
44238
44263
  }
44239
44264
  function resolveTelemetrySessionId(existingSessionId) {
44240
44265
  return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
44241
44266
  }
44267
+ function getTelemetryOperationId() {
44268
+ const existing = telemetryOperationIdSlot.get();
44269
+ if (existing) {
44270
+ return existing;
44271
+ }
44272
+ const inboundTraceId = getInboundTraceContext()?.traceId;
44273
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
44274
+ telemetryOperationIdSlot.set(generated);
44275
+ return generated;
44276
+ }
44242
44277
  // ../common/src/telemetry/global-telemetry-properties.ts
44243
44278
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
44244
44279
  function getGlobalTelemetryProperties() {
44245
44280
  return telemetryPropsSlot.get();
44246
44281
  }
44247
44282
 
44283
+ // ../common/src/telemetry/pii-redactor.ts
44284
+ var REDACTED = "[REDACTED]";
44285
+ var MAX_VALUE_LENGTH = 200;
44286
+ var SENSITIVE_NAME_TOKENS = new Set([
44287
+ "token",
44288
+ "tokens",
44289
+ "secret",
44290
+ "secrets",
44291
+ "password",
44292
+ "passwords",
44293
+ "pwd",
44294
+ "credential",
44295
+ "credentials",
44296
+ "auth",
44297
+ "authentication",
44298
+ "authorization",
44299
+ "authority",
44300
+ "cert",
44301
+ "certificate",
44302
+ "certificates"
44303
+ ]);
44304
+ var SENSITIVE_KEY_PREFIXES = new Set([
44305
+ "api",
44306
+ "access",
44307
+ "client",
44308
+ "private",
44309
+ "public",
44310
+ "signing",
44311
+ "encryption",
44312
+ "session",
44313
+ "master",
44314
+ "shared",
44315
+ "root",
44316
+ "ssh",
44317
+ "rsa",
44318
+ "aes",
44319
+ "hmac",
44320
+ "oauth"
44321
+ ]);
44322
+ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
44323
+ var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
44324
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
44325
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
44326
+ var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
44327
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
44328
+ var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
44329
+ function shortHash(input) {
44330
+ let hash = 2166136261;
44331
+ for (let i = 0;i < input.length; i++) {
44332
+ hash ^= input.charCodeAt(i);
44333
+ hash = Math.imul(hash, 16777619);
44334
+ }
44335
+ return (hash >>> 0).toString(16).padStart(8, "0");
44336
+ }
44337
+ function redactUrl(raw) {
44338
+ try {
44339
+ const url = new URL(raw);
44340
+ return `${url.protocol}//${url.host}`;
44341
+ } catch {
44342
+ return `url#${shortHash(raw)}`;
44343
+ }
44344
+ }
44345
+ function redactValueDetectors(value) {
44346
+ let out = value;
44347
+ out = out.replace(JWT_PATTERN, () => REDACTED);
44348
+ out = out.replace(URL_PATTERN, (match) => {
44349
+ const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
44350
+ const core2 = trailing ? match.slice(0, -trailing.length) : match;
44351
+ return `${redactUrl(core2)}${trailing}`;
44352
+ });
44353
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
44354
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
44355
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
44356
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
44357
+ if (out.length > MAX_VALUE_LENGTH) {
44358
+ out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
44359
+ }
44360
+ return out;
44361
+ }
44362
+ function redactValue(value) {
44363
+ return redactValueDetectors(value);
44364
+ }
44365
+ function redactError(error) {
44366
+ const safe = new Error(redactValueDetectors(error.message ?? ""));
44367
+ safe.name = error.name;
44368
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
44369
+ return safe;
44370
+ }
44371
+ function nameTokens(name) {
44372
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
44373
+ }
44374
+ function isSensitiveName(name) {
44375
+ const tokens = nameTokens(name);
44376
+ for (let i = 0;i < tokens.length; i++) {
44377
+ const token = tokens[i];
44378
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
44379
+ return true;
44380
+ }
44381
+ if (token === "key" || token === "keys") {
44382
+ const prev = tokens[i - 1];
44383
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
44384
+ return true;
44385
+ }
44386
+ }
44387
+ }
44388
+ return false;
44389
+ }
44390
+ function redactProperty(name, value) {
44391
+ if (value === undefined || value === null) {
44392
+ return;
44393
+ }
44394
+ if (isSensitiveName(name)) {
44395
+ return REDACTED;
44396
+ }
44397
+ if (typeof value === "boolean" || typeof value === "number") {
44398
+ return value;
44399
+ }
44400
+ if (typeof value !== "string") {
44401
+ return "[OBJECT]";
44402
+ }
44403
+ return redactValueDetectors(value);
44404
+ }
44405
+ function redactProperties(properties) {
44406
+ const out = {};
44407
+ for (const [name, value] of Object.entries(properties)) {
44408
+ const redacted = redactProperty(name, value);
44409
+ if (redacted !== undefined) {
44410
+ out[name] = redacted;
44411
+ }
44412
+ }
44413
+ return out;
44414
+ }
44415
+
44248
44416
  // ../common/src/telemetry/telemetry-service.ts
44417
+ var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
44418
+ var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
44419
+ var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
44420
+
44249
44421
  class TelemetryService {
44250
44422
  telemetryProvider;
44251
44423
  contextStorage;
@@ -44272,11 +44444,15 @@ class TelemetryService {
44272
44444
  trackException(error, properties) {
44273
44445
  const context = this.getCurrentContext();
44274
44446
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
44275
- this.telemetryProvider.trackException(error, enrichedProperties);
44447
+ this.telemetryProvider.trackException(redactError(error), enrichedProperties);
44276
44448
  }
44277
44449
  async trackRequest(name, fn, properties) {
44450
+ const parentContext = this.getCurrentContext();
44451
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
44452
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
44278
44453
  const context = {
44279
- operationId: this.operationId ?? this.generateId(),
44454
+ operationId,
44455
+ ...parentId !== undefined ? { parentId } : {},
44280
44456
  id: this.generateId()
44281
44457
  };
44282
44458
  const startTime = performance.now();
@@ -44294,6 +44470,45 @@ class TelemetryService {
44294
44470
  throw error;
44295
44471
  }
44296
44472
  }
44473
+ trackRequestResult(name, durationMs, success, properties, context) {
44474
+ const requestContext = context ?? {
44475
+ operationId: this.operationId ?? getTelemetryOperationId(),
44476
+ id: this.generateId()
44477
+ };
44478
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
44479
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
44480
+ }
44481
+ createRequestContext() {
44482
+ const operationId = this.operationId ?? getTelemetryOperationId();
44483
+ const parentId = this.inboundParentIdFor(operationId);
44484
+ return {
44485
+ operationId,
44486
+ ...parentId !== undefined ? { parentId } : {},
44487
+ id: this.generateId()
44488
+ };
44489
+ }
44490
+ inboundParentIdFor(operationId) {
44491
+ const inbound = getInboundTraceContext();
44492
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
44493
+ }
44494
+ runWithContext(context, fn) {
44495
+ return this.contextStorage.run(context, fn);
44496
+ }
44497
+ createDependencyContext() {
44498
+ const parentContext = this.getCurrentContext();
44499
+ if (!parentContext) {
44500
+ return;
44501
+ }
44502
+ return {
44503
+ operationId: parentContext.operationId,
44504
+ parentId: parentContext.id,
44505
+ id: this.generateId()
44506
+ };
44507
+ }
44508
+ trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
44509
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
44510
+ this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
44511
+ }
44297
44512
  async trackDependencyOperation(name, type2, fn, properties) {
44298
44513
  const parentContext = this.getCurrentContext();
44299
44514
  if (!parentContext) {
@@ -44330,8 +44545,12 @@ class TelemetryService {
44330
44545
  ...getExecutionContextTelemetryProperties(),
44331
44546
  ...globalProperties,
44332
44547
  ...this.defaultProperties,
44333
- ...properties,
44334
- ...context
44548
+ ...redactProperties(properties ?? {}),
44549
+ ...context ? {
44550
+ [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
44551
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
44552
+ [TELEMETRY_SPAN_ID_PROPERTY]: context.id
44553
+ } : {}
44335
44554
  };
44336
44555
  if (sessionId === undefined) {
44337
44556
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
@@ -44341,7 +44560,16 @@ class TelemetryService {
44341
44560
  return enriched;
44342
44561
  }
44343
44562
  generateId() {
44344
- return crypto.randomUUID().replaceAll("-", "");
44563
+ const bytes = new Uint8Array(8);
44564
+ let hex = "";
44565
+ do {
44566
+ crypto.getRandomValues(bytes);
44567
+ hex = "";
44568
+ for (const byte of bytes) {
44569
+ hex += byte.toString(16).padStart(2, "0");
44570
+ }
44571
+ } while (/^0+$/.test(hex));
44572
+ return hex;
44345
44573
  }
44346
44574
  }
44347
44575
  // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
@@ -45043,134 +45271,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
45043
45271
  };
45044
45272
  }
45045
45273
 
45046
- // ../common/src/telemetry/pii-redactor.ts
45047
- var REDACTED = "[REDACTED]";
45048
- var MAX_VALUE_LENGTH = 200;
45049
- var SENSITIVE_NAME_TOKENS = new Set([
45050
- "token",
45051
- "tokens",
45052
- "secret",
45053
- "secrets",
45054
- "password",
45055
- "passwords",
45056
- "pwd",
45057
- "credential",
45058
- "credentials",
45059
- "auth",
45060
- "authentication",
45061
- "authorization",
45062
- "authority",
45063
- "cert",
45064
- "certificate",
45065
- "certificates"
45066
- ]);
45067
- var SENSITIVE_KEY_PREFIXES = new Set([
45068
- "api",
45069
- "access",
45070
- "client",
45071
- "private",
45072
- "public",
45073
- "signing",
45074
- "encryption",
45075
- "session",
45076
- "master",
45077
- "shared",
45078
- "root",
45079
- "ssh",
45080
- "rsa",
45081
- "aes",
45082
- "hmac",
45083
- "oauth"
45084
- ]);
45085
- var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
45086
- var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
45087
- var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
45088
- var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
45089
- var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
45090
- var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
45091
- var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
45092
- function shortHash(input) {
45093
- let hash = 2166136261;
45094
- for (let i = 0;i < input.length; i++) {
45095
- hash ^= input.charCodeAt(i);
45096
- hash = Math.imul(hash, 16777619);
45097
- }
45098
- return (hash >>> 0).toString(16).padStart(8, "0");
45099
- }
45100
- function redactUrl(raw) {
45101
- try {
45102
- const url = new URL(raw);
45103
- return `${url.protocol}//${url.host}`;
45104
- } catch {
45105
- return `url#${shortHash(raw)}`;
45106
- }
45107
- }
45108
- function redactValueDetectors(value) {
45109
- let out = value;
45110
- out = out.replace(JWT_PATTERN, () => REDACTED);
45111
- out = out.replace(URL_PATTERN, (match) => {
45112
- const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
45113
- const core2 = trailing ? match.slice(0, -trailing.length) : match;
45114
- return `${redactUrl(core2)}${trailing}`;
45115
- });
45116
- out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
45117
- out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
45118
- out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
45119
- out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
45120
- if (out.length > MAX_VALUE_LENGTH) {
45121
- out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
45122
- }
45123
- return out;
45124
- }
45125
- function nameTokens(name) {
45126
- return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((t) => t.toLowerCase()).filter(Boolean);
45127
- }
45128
- function isSensitiveName(name) {
45129
- const tokens = nameTokens(name);
45130
- for (let i = 0;i < tokens.length; i++) {
45131
- const token = tokens[i];
45132
- if (SENSITIVE_NAME_TOKENS.has(token)) {
45133
- return true;
45134
- }
45135
- if (token === "key" || token === "keys") {
45136
- const prev = tokens[i - 1];
45137
- if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
45138
- return true;
45139
- }
45140
- }
45141
- }
45142
- return false;
45143
- }
45144
- function redactProperty(name, value) {
45145
- if (value === undefined || value === null) {
45146
- return;
45147
- }
45148
- if (isSensitiveName(name)) {
45149
- return REDACTED;
45150
- }
45151
- if (typeof value === "boolean" || typeof value === "number") {
45152
- return value;
45153
- }
45154
- if (typeof value !== "string") {
45155
- return "[OBJECT]";
45156
- }
45157
- return redactValueDetectors(value);
45158
- }
45159
- function redactProperties(properties) {
45160
- const out = {};
45161
- for (const [name, value] of Object.entries(properties)) {
45162
- const redacted = redactProperty(name, value);
45163
- if (redacted !== undefined) {
45164
- out[name] = redacted;
45165
- }
45166
- }
45167
- return out;
45168
- }
45169
-
45170
45274
  // ../common/src/trackedAction.ts
45171
45275
  var pollSignalSlot = singleton("PollSignal");
45172
45276
  var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
45173
45277
  var retryHintValues = new Set(RETRY_HINTS);
45278
+ var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
45174
45279
  var processContext = {
45175
45280
  exit: (code) => {
45176
45281
  process.exitCode = code;
@@ -45181,22 +45286,18 @@ var processContext = {
45181
45286
  };
45182
45287
  function extractCommandParams(cmd) {
45183
45288
  const params = {};
45289
+ const add2 = (name, value) => {
45290
+ if (name && value !== undefined) {
45291
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
45292
+ }
45293
+ };
45184
45294
  const registered = cmd.registeredArguments ?? [];
45185
45295
  const processed = cmd.processedArgs ?? [];
45186
45296
  for (let i = 0;i < registered.length; i++) {
45187
- const value = processed[i];
45188
- if (value === undefined) {
45189
- continue;
45190
- }
45191
- const name = registered[i].name();
45192
- if (name) {
45193
- params[name] = value;
45194
- }
45297
+ add2(registered[i].name(), processed[i]);
45195
45298
  }
45196
45299
  for (const [key, value] of Object.entries(cmd.opts())) {
45197
- if (value !== undefined) {
45198
- params[key] = value;
45199
- }
45300
+ add2(key, value);
45200
45301
  }
45201
45302
  return params;
45202
45303
  }
@@ -45239,11 +45340,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
45239
45340
  return this.action(async (...args) => {
45240
45341
  const telemetryName = deriveCommandPath(command);
45241
45342
  const props = typeof properties === "function" ? properties(...args) : properties;
45343
+ const requestContext = telemetry.createRequestContext();
45242
45344
  const startTime = performance.now();
45243
45345
  let errorMessage;
45244
45346
  let fallbackExitCode = EXIT_CODES.Success;
45245
45347
  clearRecordedCommandFailureTelemetry();
45246
- const [error] = await catchError(fn(...args));
45348
+ const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
45247
45349
  if (error) {
45248
45350
  errorMessage = error instanceof Error ? error.message : String(error);
45249
45351
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
@@ -45279,16 +45381,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
45279
45381
  recordedFailure,
45280
45382
  pollSignal: context.pollSignal
45281
45383
  });
45282
- telemetry.trackEvent(telemetryName, redactProperties({
45283
- ...extractCommandParams(command),
45384
+ const commandParams = extractCommandParams(command);
45385
+ if (props) {
45386
+ for (const key of Object.keys(props)) {
45387
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
45388
+ }
45389
+ }
45390
+ const baseProperties = redactProperties({
45391
+ ...commandParams,
45284
45392
  ...props,
45285
45393
  ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
45286
45394
  command: "true",
45287
- duration: String(durationMs),
45288
- success: String(success),
45289
45395
  ...terminalTelemetry,
45290
45396
  ...errorMessage ? { errorMessage } : {}
45291
- }));
45397
+ });
45398
+ telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
45292
45399
  });
45293
45400
  };
45294
45401
 
@@ -57682,4 +57789,4 @@ export {
57682
57789
  metadata
57683
57790
  };
57684
57791
 
57685
- //# debugId=CD0EDD3ECE0A8E3164756E2164756E21
57792
+ //# debugId=FEA70C6B49A4118A64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/conversational-tool",
3
3
  "license": "MIT",
4
- "version": "1.198.0-preview.95",
4
+ "version": "1.198.0",
5
5
  "description": "Handle conversations with deployed UiPath conversational processes.",
6
6
  "type": "module",
7
7
  "main": "./dist/tool.js",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "registry": "https://registry.npmjs.org/"
19
19
  },
20
- "gitHead": "7f6f14e06688fe417ecaac94186ab795a9106caa"
20
+ "gitHead": "1fadf03d7a8dd102742571dff569fdac11808afb"
21
21
  }