@uipath/conversational-tool 1.199.0-preview.92 → 1.199.0-preview.99

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
@@ -29382,9 +29382,9 @@ var init_has_cors = __esm(() => {
29382
29382
  // ../../node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js
29383
29383
  function empty() {}
29384
29384
  function unloadHandler() {
29385
- for (let i in Request.requests) {
29386
- if (Request.requests.hasOwnProperty(i)) {
29387
- Request.requests[i].abort();
29385
+ for (let i in Request2.requests) {
29386
+ if (Request2.requests.hasOwnProperty(i)) {
29387
+ Request2.requests[i].abort();
29388
29388
  }
29389
29389
  }
29390
29390
  }
@@ -29401,7 +29401,7 @@ function newRequest(opts) {
29401
29401
  } catch (e) {}
29402
29402
  }
29403
29403
  }
29404
- var import_debug3, debug3, BaseXHR, Request, hasXHR2;
29404
+ var import_debug3, debug3, BaseXHR, Request2, hasXHR2;
29405
29405
  var init_polling_xhr = __esm(() => {
29406
29406
  init_polling();
29407
29407
  init_cjs();
@@ -29442,7 +29442,7 @@ var init_polling_xhr = __esm(() => {
29442
29442
  this.pollXhr = req;
29443
29443
  }
29444
29444
  };
29445
- Request = class Request extends $Emitter {
29445
+ Request2 = class Request2 extends $Emitter {
29446
29446
  constructor(createRequest, uri, opts) {
29447
29447
  super();
29448
29448
  this.createRequest = createRequest;
@@ -29510,8 +29510,8 @@ var init_polling_xhr = __esm(() => {
29510
29510
  return;
29511
29511
  }
29512
29512
  if (typeof document !== "undefined") {
29513
- this._index = Request.requestsCount++;
29514
- Request.requests[this._index] = this;
29513
+ this._index = Request2.requestsCount++;
29514
+ Request2.requests[this._index] = this;
29515
29515
  }
29516
29516
  }
29517
29517
  _onError(err) {
@@ -29529,7 +29529,7 @@ var init_polling_xhr = __esm(() => {
29529
29529
  } catch (e) {}
29530
29530
  }
29531
29531
  if (typeof document !== "undefined") {
29532
- delete Request.requests[this._index];
29532
+ delete Request2.requests[this._index];
29533
29533
  }
29534
29534
  this._xhr = null;
29535
29535
  }
@@ -29545,8 +29545,8 @@ var init_polling_xhr = __esm(() => {
29545
29545
  this._cleanup();
29546
29546
  }
29547
29547
  };
29548
- Request.requestsCount = 0;
29549
- Request.requests = {};
29548
+ Request2.requestsCount = 0;
29549
+ Request2.requests = {};
29550
29550
  if (typeof document !== "undefined") {
29551
29551
  if (typeof attachEvent === "function") {
29552
29552
  attachEvent("onunload", unloadHandler);
@@ -29573,7 +29573,7 @@ var init_polling_xhr_node = __esm(() => {
29573
29573
  request(opts = {}) {
29574
29574
  var _a2;
29575
29575
  Object.assign(opts, { xd: this.xd, cookieJar: (_a2 = this.socket) === null || _a2 === undefined ? undefined : _a2._cookieJar }, this.opts);
29576
- return new Request((opts2) => new XMLHttpRequest2(opts2), this.uri(), opts);
29576
+ return new Request2((opts2) => new XMLHttpRequest2(opts2), this.uri(), opts);
29577
29577
  }
29578
29578
  };
29579
29579
  });
@@ -38458,7 +38458,7 @@ var init_conversational_agent = __esm(() => {
38458
38458
  var package_default = {
38459
38459
  name: "@uipath/conversational-tool",
38460
38460
  license: "MIT",
38461
- version: "1.199.0-preview.92",
38461
+ version: "1.199.0-preview.99",
38462
38462
  description: "Handle conversations with deployed UiPath conversational processes.",
38463
38463
  type: "module",
38464
38464
  main: "./dist/tool.js",
@@ -44364,11 +44364,36 @@ class NodeContextStorage {
44364
44364
  return this.storage.getStore();
44365
44365
  }
44366
44366
  }
44367
+ // ../common/src/telemetry/trace-context.ts
44368
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
44369
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
44370
+ function getProcessEnv() {
44371
+ return globalThis.process?.env;
44372
+ }
44373
+ function parseInboundTraceparent(value) {
44374
+ if (!value) {
44375
+ return;
44376
+ }
44377
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
44378
+ if (!match) {
44379
+ return;
44380
+ }
44381
+ const [, traceId, parentSpanId] = match;
44382
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
44383
+ return;
44384
+ }
44385
+ return { traceId, parentSpanId };
44386
+ }
44387
+ function getInboundTraceContext() {
44388
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
44389
+ }
44390
+
44367
44391
  // ../common/src/telemetry/session-id.ts
44368
44392
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
44369
44393
  var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
44370
44394
  var telemetrySessionIdSlot = singleton("TelemetrySessionId");
44371
- function getProcessEnv() {
44395
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
44396
+ function getProcessEnv2() {
44372
44397
  return globalThis.process?.env;
44373
44398
  }
44374
44399
  function normalizeSessionId(value) {
@@ -44379,18 +44404,165 @@ function normalizeSessionId(value) {
44379
44404
  return trimmed || undefined;
44380
44405
  }
44381
44406
  function getConfiguredTelemetrySessionId() {
44382
- return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
44407
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
44383
44408
  }
44384
44409
  function resolveTelemetrySessionId(existingSessionId) {
44385
44410
  return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
44386
44411
  }
44412
+ function getTelemetryOperationId() {
44413
+ const existing = telemetryOperationIdSlot.get();
44414
+ if (existing) {
44415
+ return existing;
44416
+ }
44417
+ const inboundTraceId = getInboundTraceContext()?.traceId;
44418
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
44419
+ telemetryOperationIdSlot.set(generated);
44420
+ return generated;
44421
+ }
44387
44422
  // ../common/src/telemetry/global-telemetry-properties.ts
44388
44423
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
44389
44424
  function getGlobalTelemetryProperties() {
44390
44425
  return telemetryPropsSlot.get();
44391
44426
  }
44392
44427
 
44428
+ // ../common/src/telemetry/pii-redactor.ts
44429
+ var REDACTED = "[REDACTED]";
44430
+ var MAX_VALUE_LENGTH = 200;
44431
+ var SENSITIVE_NAME_TOKENS = new Set([
44432
+ "token",
44433
+ "tokens",
44434
+ "secret",
44435
+ "secrets",
44436
+ "password",
44437
+ "passwords",
44438
+ "pwd",
44439
+ "credential",
44440
+ "credentials",
44441
+ "auth",
44442
+ "authentication",
44443
+ "authorization",
44444
+ "authority",
44445
+ "cert",
44446
+ "certificate",
44447
+ "certificates"
44448
+ ]);
44449
+ var SENSITIVE_KEY_PREFIXES = new Set([
44450
+ "api",
44451
+ "access",
44452
+ "client",
44453
+ "private",
44454
+ "public",
44455
+ "signing",
44456
+ "encryption",
44457
+ "session",
44458
+ "master",
44459
+ "shared",
44460
+ "root",
44461
+ "ssh",
44462
+ "rsa",
44463
+ "aes",
44464
+ "hmac",
44465
+ "oauth"
44466
+ ]);
44467
+ 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;
44468
+ var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
44469
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
44470
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
44471
+ var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
44472
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
44473
+ var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
44474
+ function shortHash(input) {
44475
+ let hash = 2166136261;
44476
+ for (let i = 0;i < input.length; i++) {
44477
+ hash ^= input.charCodeAt(i);
44478
+ hash = Math.imul(hash, 16777619);
44479
+ }
44480
+ return (hash >>> 0).toString(16).padStart(8, "0");
44481
+ }
44482
+ function redactUrl(raw) {
44483
+ try {
44484
+ const url = new URL(raw);
44485
+ return `${url.protocol}//${url.host}`;
44486
+ } catch {
44487
+ return `url#${shortHash(raw)}`;
44488
+ }
44489
+ }
44490
+ function redactValueDetectors(value) {
44491
+ let out = value;
44492
+ out = out.replace(JWT_PATTERN, () => REDACTED);
44493
+ out = out.replace(URL_PATTERN, (match) => {
44494
+ const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
44495
+ const core2 = trailing ? match.slice(0, -trailing.length) : match;
44496
+ return `${redactUrl(core2)}${trailing}`;
44497
+ });
44498
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
44499
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
44500
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
44501
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
44502
+ if (out.length > MAX_VALUE_LENGTH) {
44503
+ out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
44504
+ }
44505
+ return out;
44506
+ }
44507
+ function redactValue(value) {
44508
+ return redactValueDetectors(value);
44509
+ }
44510
+ function redactError(error) {
44511
+ const safe = new Error(redactValueDetectors(error.message ?? ""));
44512
+ safe.name = error.name;
44513
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
44514
+ return safe;
44515
+ }
44516
+ function nameTokens(name) {
44517
+ 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);
44518
+ }
44519
+ function isSensitiveName(name) {
44520
+ const tokens = nameTokens(name);
44521
+ for (let i = 0;i < tokens.length; i++) {
44522
+ const token = tokens[i];
44523
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
44524
+ return true;
44525
+ }
44526
+ if (token === "key" || token === "keys") {
44527
+ const prev = tokens[i - 1];
44528
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
44529
+ return true;
44530
+ }
44531
+ }
44532
+ }
44533
+ return false;
44534
+ }
44535
+ function redactProperty(name, value) {
44536
+ if (value === undefined || value === null) {
44537
+ return;
44538
+ }
44539
+ if (isSensitiveName(name)) {
44540
+ return REDACTED;
44541
+ }
44542
+ if (typeof value === "boolean" || typeof value === "number") {
44543
+ return value;
44544
+ }
44545
+ if (typeof value !== "string") {
44546
+ return "[OBJECT]";
44547
+ }
44548
+ return redactValueDetectors(value);
44549
+ }
44550
+ function redactProperties(properties) {
44551
+ const out = {};
44552
+ for (const [name, value] of Object.entries(properties)) {
44553
+ const redacted = redactProperty(name, value);
44554
+ if (redacted !== undefined) {
44555
+ out[name] = redacted;
44556
+ }
44557
+ }
44558
+ return out;
44559
+ }
44560
+
44393
44561
  // ../common/src/telemetry/telemetry-service.ts
44562
+ var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
44563
+ var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
44564
+ var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
44565
+
44394
44566
  class TelemetryService {
44395
44567
  telemetryProvider;
44396
44568
  contextStorage;
@@ -44417,11 +44589,15 @@ class TelemetryService {
44417
44589
  trackException(error, properties) {
44418
44590
  const context = this.getCurrentContext();
44419
44591
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
44420
- this.telemetryProvider.trackException(error, enrichedProperties);
44592
+ this.telemetryProvider.trackException(redactError(error), enrichedProperties);
44421
44593
  }
44422
44594
  async trackRequest(name, fn, properties) {
44595
+ const parentContext = this.getCurrentContext();
44596
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
44597
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
44423
44598
  const context = {
44424
- operationId: this.operationId ?? this.generateId(),
44599
+ operationId,
44600
+ ...parentId !== undefined ? { parentId } : {},
44425
44601
  id: this.generateId()
44426
44602
  };
44427
44603
  const startTime = performance.now();
@@ -44439,6 +44615,45 @@ class TelemetryService {
44439
44615
  throw error;
44440
44616
  }
44441
44617
  }
44618
+ trackRequestResult(name, durationMs, success, properties, context) {
44619
+ const requestContext = context ?? {
44620
+ operationId: this.operationId ?? getTelemetryOperationId(),
44621
+ id: this.generateId()
44622
+ };
44623
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
44624
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
44625
+ }
44626
+ createRequestContext() {
44627
+ const operationId = this.operationId ?? getTelemetryOperationId();
44628
+ const parentId = this.inboundParentIdFor(operationId);
44629
+ return {
44630
+ operationId,
44631
+ ...parentId !== undefined ? { parentId } : {},
44632
+ id: this.generateId()
44633
+ };
44634
+ }
44635
+ inboundParentIdFor(operationId) {
44636
+ const inbound = getInboundTraceContext();
44637
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
44638
+ }
44639
+ runWithContext(context, fn) {
44640
+ return this.contextStorage.run(context, fn);
44641
+ }
44642
+ createDependencyContext() {
44643
+ const parentContext = this.getCurrentContext();
44644
+ if (!parentContext) {
44645
+ return;
44646
+ }
44647
+ return {
44648
+ operationId: parentContext.operationId,
44649
+ parentId: parentContext.id,
44650
+ id: this.generateId()
44651
+ };
44652
+ }
44653
+ trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
44654
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
44655
+ this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
44656
+ }
44442
44657
  async trackDependencyOperation(name, type2, fn, properties) {
44443
44658
  const parentContext = this.getCurrentContext();
44444
44659
  if (!parentContext) {
@@ -44475,8 +44690,12 @@ class TelemetryService {
44475
44690
  ...getExecutionContextTelemetryProperties(),
44476
44691
  ...globalProperties,
44477
44692
  ...this.defaultProperties,
44478
- ...properties,
44479
- ...context
44693
+ ...redactProperties(properties ?? {}),
44694
+ ...context ? {
44695
+ [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
44696
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
44697
+ [TELEMETRY_SPAN_ID_PROPERTY]: context.id
44698
+ } : {}
44480
44699
  };
44481
44700
  if (sessionId === undefined) {
44482
44701
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
@@ -44486,7 +44705,16 @@ class TelemetryService {
44486
44705
  return enriched;
44487
44706
  }
44488
44707
  generateId() {
44489
- return crypto.randomUUID().replaceAll("-", "");
44708
+ const bytes = new Uint8Array(8);
44709
+ let hex = "";
44710
+ do {
44711
+ crypto.getRandomValues(bytes);
44712
+ hex = "";
44713
+ for (const byte of bytes) {
44714
+ hex += byte.toString(16).padStart(2, "0");
44715
+ }
44716
+ } while (/^0+$/.test(hex));
44717
+ return hex;
44490
44718
  }
44491
44719
  }
44492
44720
  // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
@@ -45189,134 +45417,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
45189
45417
  };
45190
45418
  }
45191
45419
 
45192
- // ../common/src/telemetry/pii-redactor.ts
45193
- var REDACTED = "[REDACTED]";
45194
- var MAX_VALUE_LENGTH = 200;
45195
- var SENSITIVE_NAME_TOKENS = new Set([
45196
- "token",
45197
- "tokens",
45198
- "secret",
45199
- "secrets",
45200
- "password",
45201
- "passwords",
45202
- "pwd",
45203
- "credential",
45204
- "credentials",
45205
- "auth",
45206
- "authentication",
45207
- "authorization",
45208
- "authority",
45209
- "cert",
45210
- "certificate",
45211
- "certificates"
45212
- ]);
45213
- var SENSITIVE_KEY_PREFIXES = new Set([
45214
- "api",
45215
- "access",
45216
- "client",
45217
- "private",
45218
- "public",
45219
- "signing",
45220
- "encryption",
45221
- "session",
45222
- "master",
45223
- "shared",
45224
- "root",
45225
- "ssh",
45226
- "rsa",
45227
- "aes",
45228
- "hmac",
45229
- "oauth"
45230
- ]);
45231
- 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;
45232
- var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
45233
- var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
45234
- var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
45235
- var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
45236
- var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
45237
- var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
45238
- function shortHash(input) {
45239
- let hash = 2166136261;
45240
- for (let i = 0;i < input.length; i++) {
45241
- hash ^= input.charCodeAt(i);
45242
- hash = Math.imul(hash, 16777619);
45243
- }
45244
- return (hash >>> 0).toString(16).padStart(8, "0");
45245
- }
45246
- function redactUrl(raw) {
45247
- try {
45248
- const url = new URL(raw);
45249
- return `${url.protocol}//${url.host}`;
45250
- } catch {
45251
- return `url#${shortHash(raw)}`;
45252
- }
45253
- }
45254
- function redactValueDetectors(value) {
45255
- let out = value;
45256
- out = out.replace(JWT_PATTERN, () => REDACTED);
45257
- out = out.replace(URL_PATTERN, (match) => {
45258
- const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
45259
- const core2 = trailing ? match.slice(0, -trailing.length) : match;
45260
- return `${redactUrl(core2)}${trailing}`;
45261
- });
45262
- out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
45263
- out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
45264
- out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
45265
- out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
45266
- if (out.length > MAX_VALUE_LENGTH) {
45267
- out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
45268
- }
45269
- return out;
45270
- }
45271
- function nameTokens(name) {
45272
- 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);
45273
- }
45274
- function isSensitiveName(name) {
45275
- const tokens = nameTokens(name);
45276
- for (let i = 0;i < tokens.length; i++) {
45277
- const token = tokens[i];
45278
- if (SENSITIVE_NAME_TOKENS.has(token)) {
45279
- return true;
45280
- }
45281
- if (token === "key" || token === "keys") {
45282
- const prev = tokens[i - 1];
45283
- if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
45284
- return true;
45285
- }
45286
- }
45287
- }
45288
- return false;
45289
- }
45290
- function redactProperty(name, value) {
45291
- if (value === undefined || value === null) {
45292
- return;
45293
- }
45294
- if (isSensitiveName(name)) {
45295
- return REDACTED;
45296
- }
45297
- if (typeof value === "boolean" || typeof value === "number") {
45298
- return value;
45299
- }
45300
- if (typeof value !== "string") {
45301
- return "[OBJECT]";
45302
- }
45303
- return redactValueDetectors(value);
45304
- }
45305
- function redactProperties(properties) {
45306
- const out = {};
45307
- for (const [name, value] of Object.entries(properties)) {
45308
- const redacted = redactProperty(name, value);
45309
- if (redacted !== undefined) {
45310
- out[name] = redacted;
45311
- }
45312
- }
45313
- return out;
45314
- }
45315
-
45316
45420
  // ../common/src/trackedAction.ts
45317
45421
  var pollSignalSlot = singleton("PollSignal");
45318
45422
  var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
45319
45423
  var retryHintValues = new Set(RETRY_HINTS);
45424
+ var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
45320
45425
  var processContext = {
45321
45426
  exit: (code) => {
45322
45427
  process.exitCode = code;
@@ -45327,22 +45432,18 @@ var processContext = {
45327
45432
  };
45328
45433
  function extractCommandParams(cmd) {
45329
45434
  const params = {};
45435
+ const add2 = (name, value) => {
45436
+ if (name && value !== undefined) {
45437
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
45438
+ }
45439
+ };
45330
45440
  const registered = cmd.registeredArguments ?? [];
45331
45441
  const processed = cmd.processedArgs ?? [];
45332
45442
  for (let i = 0;i < registered.length; i++) {
45333
- const value = processed[i];
45334
- if (value === undefined) {
45335
- continue;
45336
- }
45337
- const name = registered[i].name();
45338
- if (name) {
45339
- params[name] = value;
45340
- }
45443
+ add2(registered[i].name(), processed[i]);
45341
45444
  }
45342
45445
  for (const [key, value] of Object.entries(cmd.opts())) {
45343
- if (value !== undefined) {
45344
- params[key] = value;
45345
- }
45446
+ add2(key, value);
45346
45447
  }
45347
45448
  return params;
45348
45449
  }
@@ -45385,11 +45486,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
45385
45486
  return this.action(async (...args) => {
45386
45487
  const telemetryName = deriveCommandPath(command);
45387
45488
  const props = typeof properties === "function" ? properties(...args) : properties;
45489
+ const requestContext = telemetry.createRequestContext();
45388
45490
  const startTime = performance.now();
45389
45491
  let errorMessage;
45390
45492
  let fallbackExitCode = EXIT_CODES.Success;
45391
45493
  clearRecordedCommandFailureTelemetry();
45392
- const [error] = await catchError(fn(...args));
45494
+ const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
45393
45495
  if (error) {
45394
45496
  errorMessage = error instanceof Error ? error.message : String(error);
45395
45497
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
@@ -45425,16 +45527,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
45425
45527
  recordedFailure,
45426
45528
  pollSignal: context.pollSignal
45427
45529
  });
45428
- telemetry.trackEvent(telemetryName, redactProperties({
45429
- ...extractCommandParams(command),
45530
+ const commandParams = extractCommandParams(command);
45531
+ if (props) {
45532
+ for (const key of Object.keys(props)) {
45533
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
45534
+ }
45535
+ }
45536
+ const baseProperties = redactProperties({
45537
+ ...commandParams,
45430
45538
  ...props,
45431
45539
  ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
45432
45540
  command: "true",
45433
- duration: String(durationMs),
45434
- success: String(success),
45435
45541
  ...terminalTelemetry,
45436
45542
  ...errorMessage ? { errorMessage } : {}
45437
- }));
45543
+ });
45544
+ telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
45438
45545
  });
45439
45546
  };
45440
45547
 
@@ -57842,4 +57949,4 @@ export {
57842
57949
  metadata
57843
57950
  };
57844
57951
 
57845
- //# debugId=CB4EA59FBF7C8B5964756E2164756E21
57952
+ //# debugId=7CFA94F2CA6B4BFC64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/conversational-tool",
3
3
  "license": "MIT",
4
- "version": "1.199.0-preview.92",
4
+ "version": "1.199.0-preview.99",
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": "d7b66f18f30e2e80a17293b6a0b656b54da35d49"
20
+ "gitHead": "6ba217cddceb86e3fa39ed82e49c5062878a85c6"
21
21
  }