@uipath/context-grounding-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
@@ -24230,7 +24230,7 @@ function requireOmap() {
24230
24230
  function resolveYamlOmap(data) {
24231
24231
  if (data === null)
24232
24232
  return true;
24233
- const objectKeys = [];
24233
+ const objectKeys = {};
24234
24234
  const object = data;
24235
24235
  for (let index = 0, length = object.length;index < length; index += 1) {
24236
24236
  const pair = object[index];
@@ -24248,10 +24248,9 @@ function requireOmap() {
24248
24248
  }
24249
24249
  if (!pairHasKey)
24250
24250
  return false;
24251
- if (objectKeys.indexOf(pairKey) === -1)
24252
- objectKeys.push(pairKey);
24253
- else
24251
+ if (_hasOwnProperty.call(objectKeys, pairKey))
24254
24252
  return false;
24253
+ Object.defineProperty(objectKeys, pairKey, { value: true });
24255
24254
  }
24256
24255
  return true;
24257
24256
  }
@@ -27115,8 +27114,18 @@ function getInboundTraceContext() {
27115
27114
 
27116
27115
  // ../common/src/telemetry/session-id.ts
27117
27116
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
27118
- var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
27119
- var telemetrySessionIdSlot = singleton("TelemetrySessionId");
27117
+ var SESSION_ID_MAX_LENGTH = 64;
27118
+ var RANDOM_SESSION_ID_LENGTH = 32;
27119
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
27120
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
27121
+ var INHERITED_SESSION_SOURCES = [
27122
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
27123
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
27124
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
27125
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
27126
+ { envVar: "WT_SESSION", source: "terminal" }
27127
+ ];
27128
+ var telemetrySessionSlot = singleton("TelemetrySession");
27120
27129
  var telemetryOperationIdSlot = singleton("TelemetryOperationId");
27121
27130
  function getProcessEnv2() {
27122
27131
  return globalThis.process?.env;
@@ -27125,14 +27134,42 @@ function normalizeSessionId(value) {
27125
27134
  if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
27126
27135
  return;
27127
27136
  }
27128
- const trimmed = String(value).trim();
27129
- return trimmed || undefined;
27137
+ const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
27138
+ return cleaned || undefined;
27130
27139
  }
27131
27140
  function getConfiguredTelemetrySessionId() {
27132
27141
  return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
27133
27142
  }
27134
- function resolveTelemetrySessionId(existingSessionId) {
27135
- return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
27143
+ function getInheritedSession(env) {
27144
+ for (const candidate of INHERITED_SESSION_SOURCES) {
27145
+ const handle = normalizeSessionId(env[candidate.envVar]);
27146
+ if (handle) {
27147
+ return { id: handle, source: candidate.source };
27148
+ }
27149
+ }
27150
+ return;
27151
+ }
27152
+ function generateRandomSession() {
27153
+ const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
27154
+ crypto.getRandomValues(bytes);
27155
+ let hex = "";
27156
+ for (const byte of bytes) {
27157
+ hex += byte.toString(16).padStart(2, "0");
27158
+ }
27159
+ return { id: hex, source: "random" };
27160
+ }
27161
+ function resolveTelemetrySession() {
27162
+ const existing = telemetrySessionSlot.get();
27163
+ if (existing) {
27164
+ return existing;
27165
+ }
27166
+ const declaredHandle = getConfiguredTelemetrySessionId();
27167
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
27168
+ telemetrySessionSlot.set(resolved);
27169
+ return resolved;
27170
+ }
27171
+ function getTelemetrySessionSource() {
27172
+ return resolveTelemetrySession().source;
27136
27173
  }
27137
27174
  function getTelemetryOperationId() {
27138
27175
  const existing = telemetryOperationIdSlot.get();
@@ -27409,24 +27446,18 @@ class TelemetryService {
27409
27446
  }
27410
27447
  enrichPropertiesWithContext(properties, context) {
27411
27448
  const globalProperties = getGlobalTelemetryProperties();
27412
- const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
27413
- const sessionId = resolveTelemetrySessionId(existingSessionId);
27414
27449
  const enriched = {
27415
27450
  ...getExecutionContextTelemetryProperties(),
27416
27451
  ...globalProperties,
27417
27452
  ...this.defaultProperties,
27418
27453
  ...redactProperties(properties ?? {}),
27454
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
27419
27455
  ...context ? {
27420
27456
  [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
27421
27457
  ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
27422
27458
  [TELEMETRY_SPAN_ID_PROPERTY]: context.id
27423
27459
  } : {}
27424
27460
  };
27425
- if (sessionId === undefined) {
27426
- delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
27427
- } else {
27428
- enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
27429
- }
27430
27461
  return enriched;
27431
27462
  }
27432
27463
  generateId() {
@@ -30328,7 +30359,7 @@ function createCommandForwarder(executeCommand) {
30328
30359
  var package_default = {
30329
30360
  name: "@uipath/context-grounding-tool",
30330
30361
  license: "MIT",
30331
- version: "1.199.0-preview.99",
30362
+ version: "1.199.0",
30332
30363
  description: "Tool for context grounding operations via the UiPath Python SDK",
30333
30364
  keywords: [
30334
30365
  "uipcli-tool",
@@ -30431,4 +30462,4 @@ export {
30431
30462
  metadata
30432
30463
  };
30433
30464
 
30434
- //# debugId=908C765F29ACC6C864756E2164756E21
30465
+ //# debugId=92D3A963F908BD2264756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/context-grounding-tool",
3
3
  "license": "MIT",
4
- "version": "1.199.0-preview.99",
4
+ "version": "1.199.0",
5
5
  "description": "Tool for context grounding operations via the UiPath Python SDK",
6
6
  "keywords": [
7
7
  "uipcli-tool",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "registry": "https://registry.npmjs.org/"
30
30
  },
31
- "gitHead": "6ba217cddceb86e3fa39ed82e49c5062878a85c6"
31
+ "gitHead": "723e6801b77b5926ba75e75b6a756cc38b1b7adc"
32
32
  }