@uipath/conversational-tool 1.199.0-preview.99 → 1.199.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 +50 -19
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -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.99",
38461
+ version: "1.199.0",
38462
38462
  description: "Handle conversations with deployed UiPath conversational processes.",
38463
38463
  type: "module",
38464
38464
  main: "./dist/tool.js",
@@ -41508,7 +41508,7 @@ function requireOmap() {
41508
41508
  function resolveYamlOmap(data) {
41509
41509
  if (data === null)
41510
41510
  return true;
41511
- const objectKeys = [];
41511
+ const objectKeys = {};
41512
41512
  const object = data;
41513
41513
  for (let index = 0, length = object.length;index < length; index += 1) {
41514
41514
  const pair = object[index];
@@ -41526,10 +41526,9 @@ function requireOmap() {
41526
41526
  }
41527
41527
  if (!pairHasKey)
41528
41528
  return false;
41529
- if (objectKeys.indexOf(pairKey) === -1)
41530
- objectKeys.push(pairKey);
41531
- else
41529
+ if (_hasOwnProperty.call(objectKeys, pairKey))
41532
41530
  return false;
41531
+ Object.defineProperty(objectKeys, pairKey, { value: true });
41533
41532
  }
41534
41533
  return true;
41535
41534
  }
@@ -44390,8 +44389,18 @@ function getInboundTraceContext() {
44390
44389
 
44391
44390
  // ../common/src/telemetry/session-id.ts
44392
44391
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
44393
- var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
44394
- var telemetrySessionIdSlot = singleton("TelemetrySessionId");
44392
+ var SESSION_ID_MAX_LENGTH = 64;
44393
+ var RANDOM_SESSION_ID_LENGTH = 32;
44394
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
44395
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
44396
+ var INHERITED_SESSION_SOURCES = [
44397
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
44398
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
44399
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
44400
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
44401
+ { envVar: "WT_SESSION", source: "terminal" }
44402
+ ];
44403
+ var telemetrySessionSlot = singleton("TelemetrySession");
44395
44404
  var telemetryOperationIdSlot = singleton("TelemetryOperationId");
44396
44405
  function getProcessEnv2() {
44397
44406
  return globalThis.process?.env;
@@ -44400,14 +44409,42 @@ function normalizeSessionId(value) {
44400
44409
  if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
44401
44410
  return;
44402
44411
  }
44403
- const trimmed = String(value).trim();
44404
- return trimmed || undefined;
44412
+ const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
44413
+ return cleaned || undefined;
44405
44414
  }
44406
44415
  function getConfiguredTelemetrySessionId() {
44407
44416
  return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
44408
44417
  }
44409
- function resolveTelemetrySessionId(existingSessionId) {
44410
- return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
44418
+ function getInheritedSession(env) {
44419
+ for (const candidate of INHERITED_SESSION_SOURCES) {
44420
+ const handle = normalizeSessionId(env[candidate.envVar]);
44421
+ if (handle) {
44422
+ return { id: handle, source: candidate.source };
44423
+ }
44424
+ }
44425
+ return;
44426
+ }
44427
+ function generateRandomSession() {
44428
+ const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
44429
+ crypto.getRandomValues(bytes);
44430
+ let hex = "";
44431
+ for (const byte of bytes) {
44432
+ hex += byte.toString(16).padStart(2, "0");
44433
+ }
44434
+ return { id: hex, source: "random" };
44435
+ }
44436
+ function resolveTelemetrySession() {
44437
+ const existing = telemetrySessionSlot.get();
44438
+ if (existing) {
44439
+ return existing;
44440
+ }
44441
+ const declaredHandle = getConfiguredTelemetrySessionId();
44442
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
44443
+ telemetrySessionSlot.set(resolved);
44444
+ return resolved;
44445
+ }
44446
+ function getTelemetrySessionSource() {
44447
+ return resolveTelemetrySession().source;
44411
44448
  }
44412
44449
  function getTelemetryOperationId() {
44413
44450
  const existing = telemetryOperationIdSlot.get();
@@ -44684,24 +44721,18 @@ class TelemetryService {
44684
44721
  }
44685
44722
  enrichPropertiesWithContext(properties, context) {
44686
44723
  const globalProperties = getGlobalTelemetryProperties();
44687
- const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
44688
- const sessionId = resolveTelemetrySessionId(existingSessionId);
44689
44724
  const enriched = {
44690
44725
  ...getExecutionContextTelemetryProperties(),
44691
44726
  ...globalProperties,
44692
44727
  ...this.defaultProperties,
44693
44728
  ...redactProperties(properties ?? {}),
44729
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
44694
44730
  ...context ? {
44695
44731
  [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
44696
44732
  ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
44697
44733
  [TELEMETRY_SPAN_ID_PROPERTY]: context.id
44698
44734
  } : {}
44699
44735
  };
44700
- if (sessionId === undefined) {
44701
- delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
44702
- } else {
44703
- enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
44704
- }
44705
44736
  return enriched;
44706
44737
  }
44707
44738
  generateId() {
@@ -57949,4 +57980,4 @@ export {
57949
57980
  metadata
57950
57981
  };
57951
57982
 
57952
- //# debugId=7CFA94F2CA6B4BFC64756E2164756E21
57983
+ //# debugId=CA62084D23975BE464756E2164756E21
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.99",
4
+ "version": "1.199.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": "6ba217cddceb86e3fa39ed82e49c5062878a85c6"
20
+ "gitHead": "723e6801b77b5926ba75e75b6a756cc38b1b7adc"
21
21
  }