@uipath/api-workflow-tool 1.199.0-preview.91 → 1.199.0-preview.97

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 +749 -444
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -28603,7 +28603,27 @@ class NodeContextStorage2 {
28603
28603
  return this.storage.getStore();
28604
28604
  }
28605
28605
  }
28606
- function getProcessEnv2() {
28606
+ function getProcessEnv3() {
28607
+ return globalThis.process?.env;
28608
+ }
28609
+ function parseInboundTraceparent2(value) {
28610
+ if (!value) {
28611
+ return;
28612
+ }
28613
+ const match = TRACEPARENT_PATTERN2.exec(value.trim().toLowerCase());
28614
+ if (!match) {
28615
+ return;
28616
+ }
28617
+ const [, traceId, parentSpanId] = match;
28618
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
28619
+ return;
28620
+ }
28621
+ return { traceId, parentSpanId };
28622
+ }
28623
+ function getInboundTraceContext2() {
28624
+ return parseInboundTraceparent2(getProcessEnv3()?.[TELEMETRY_TRACEPARENT_ENV2]);
28625
+ }
28626
+ function getProcessEnv22() {
28607
28627
  return globalThis.process?.env;
28608
28628
  }
28609
28629
  function normalizeSessionId2(value) {
@@ -28614,14 +28634,110 @@ function normalizeSessionId2(value) {
28614
28634
  return trimmed || undefined;
28615
28635
  }
28616
28636
  function getConfiguredTelemetrySessionId2() {
28617
- return normalizeSessionId2(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV2]);
28637
+ return normalizeSessionId2(getProcessEnv22()?.[TELEMETRY_SESSION_ID_ENV2]);
28618
28638
  }
28619
28639
  function resolveTelemetrySessionId2(existingSessionId) {
28620
28640
  return getConfiguredTelemetrySessionId2() ?? normalizeSessionId2(existingSessionId);
28621
28641
  }
28642
+ function getTelemetryOperationId2() {
28643
+ const existing = telemetryOperationIdSlot2.get();
28644
+ if (existing) {
28645
+ return existing;
28646
+ }
28647
+ const inboundTraceId = getInboundTraceContext2()?.traceId;
28648
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
28649
+ telemetryOperationIdSlot2.set(generated);
28650
+ return generated;
28651
+ }
28622
28652
  function getGlobalTelemetryProperties2() {
28623
28653
  return telemetryPropsSlot2.get();
28624
28654
  }
28655
+ function shortHash2(input) {
28656
+ let hash = 2166136261;
28657
+ for (let i2 = 0;i2 < input.length; i2++) {
28658
+ hash ^= input.charCodeAt(i2);
28659
+ hash = Math.imul(hash, 16777619);
28660
+ }
28661
+ return (hash >>> 0).toString(16).padStart(8, "0");
28662
+ }
28663
+ function redactUrl2(raw) {
28664
+ try {
28665
+ const url = new URL(raw);
28666
+ return `${url.protocol}//${url.host}`;
28667
+ } catch {
28668
+ return `url#${shortHash2(raw)}`;
28669
+ }
28670
+ }
28671
+ function redactValueDetectors2(value) {
28672
+ let out = value;
28673
+ out = out.replace(JWT_PATTERN2, () => REDACTED2);
28674
+ out = out.replace(URL_PATTERN2, (match) => {
28675
+ const trailing = match.match(URL_TRAILING_PUNCT2)?.[0] ?? "";
28676
+ const core22 = trailing ? match.slice(0, -trailing.length) : match;
28677
+ return `${redactUrl2(core22)}${trailing}`;
28678
+ });
28679
+ out = out.replace(USER_HOME_PATTERN2, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
28680
+ out = out.replace(EMAIL_PATTERN2, (match) => `email#${shortHash2(match)}`);
28681
+ out = out.replace(UUID_PATTERN2, (match) => `uuid#${shortHash2(match)}`);
28682
+ out = out.replace(LONG_TOKEN_PATTERN2, () => REDACTED2);
28683
+ if (out.length > MAX_VALUE_LENGTH2) {
28684
+ out = `${out.slice(0, MAX_VALUE_LENGTH2)}…`;
28685
+ }
28686
+ return out;
28687
+ }
28688
+ function redactValue2(value) {
28689
+ return redactValueDetectors2(value);
28690
+ }
28691
+ function redactError2(error) {
28692
+ const safe = new Error(redactValueDetectors2(error.message ?? ""));
28693
+ safe.name = error.name;
28694
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors2(error.stack) : undefined;
28695
+ return safe;
28696
+ }
28697
+ function nameTokens2(name) {
28698
+ 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);
28699
+ }
28700
+ function isSensitiveName2(name) {
28701
+ const tokens = nameTokens2(name);
28702
+ for (let i2 = 0;i2 < tokens.length; i2++) {
28703
+ const token = tokens[i2];
28704
+ if (SENSITIVE_NAME_TOKENS2.has(token)) {
28705
+ return true;
28706
+ }
28707
+ if (token === "key" || token === "keys") {
28708
+ const prev = tokens[i2 - 1];
28709
+ if (prev && SENSITIVE_KEY_PREFIXES2.has(prev)) {
28710
+ return true;
28711
+ }
28712
+ }
28713
+ }
28714
+ return false;
28715
+ }
28716
+ function redactProperty2(name, value) {
28717
+ if (value === undefined || value === null) {
28718
+ return;
28719
+ }
28720
+ if (isSensitiveName2(name)) {
28721
+ return REDACTED2;
28722
+ }
28723
+ if (typeof value === "boolean" || typeof value === "number") {
28724
+ return value;
28725
+ }
28726
+ if (typeof value !== "string") {
28727
+ return "[OBJECT]";
28728
+ }
28729
+ return redactValueDetectors2(value);
28730
+ }
28731
+ function redactProperties2(properties) {
28732
+ const out = {};
28733
+ for (const [name, value] of Object.entries(properties)) {
28734
+ const redacted = redactProperty2(name, value);
28735
+ if (redacted !== undefined) {
28736
+ out[name] = redacted;
28737
+ }
28738
+ }
28739
+ return out;
28740
+ }
28625
28741
 
28626
28742
  class TelemetryService2 {
28627
28743
  telemetryProvider;
@@ -28649,11 +28765,15 @@ class TelemetryService2 {
28649
28765
  trackException(error, properties) {
28650
28766
  const context = this.getCurrentContext();
28651
28767
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
28652
- this.telemetryProvider.trackException(error, enrichedProperties);
28768
+ this.telemetryProvider.trackException(redactError2(error), enrichedProperties);
28653
28769
  }
28654
28770
  async trackRequest(name, fn, properties) {
28771
+ const parentContext = this.getCurrentContext();
28772
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId2();
28773
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
28655
28774
  const context = {
28656
- operationId: this.operationId ?? this.generateId(),
28775
+ operationId,
28776
+ ...parentId !== undefined ? { parentId } : {},
28657
28777
  id: this.generateId()
28658
28778
  };
28659
28779
  const startTime = performance.now();
@@ -28671,6 +28791,45 @@ class TelemetryService2 {
28671
28791
  throw error;
28672
28792
  }
28673
28793
  }
28794
+ trackRequestResult(name, durationMs, success, properties, context) {
28795
+ const requestContext = context ?? {
28796
+ operationId: this.operationId ?? getTelemetryOperationId2(),
28797
+ id: this.generateId()
28798
+ };
28799
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
28800
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
28801
+ }
28802
+ createRequestContext() {
28803
+ const operationId = this.operationId ?? getTelemetryOperationId2();
28804
+ const parentId = this.inboundParentIdFor(operationId);
28805
+ return {
28806
+ operationId,
28807
+ ...parentId !== undefined ? { parentId } : {},
28808
+ id: this.generateId()
28809
+ };
28810
+ }
28811
+ inboundParentIdFor(operationId) {
28812
+ const inbound = getInboundTraceContext2();
28813
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
28814
+ }
28815
+ runWithContext(context, fn) {
28816
+ return this.contextStorage.run(context, fn);
28817
+ }
28818
+ createDependencyContext() {
28819
+ const parentContext = this.getCurrentContext();
28820
+ if (!parentContext) {
28821
+ return;
28822
+ }
28823
+ return {
28824
+ operationId: parentContext.operationId,
28825
+ parentId: parentContext.id,
28826
+ id: this.generateId()
28827
+ };
28828
+ }
28829
+ trackDependencyResult(name, type22, durationMs, success, properties, context, resultCode) {
28830
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
28831
+ this.telemetryProvider.trackDependency(redactValue2(name), type22, durationMs, success, enrichedProperties, resultCode);
28832
+ }
28674
28833
  async trackDependencyOperation(name, type22, fn, properties) {
28675
28834
  const parentContext = this.getCurrentContext();
28676
28835
  if (!parentContext) {
@@ -28707,8 +28866,12 @@ class TelemetryService2 {
28707
28866
  ...getExecutionContextTelemetryProperties2(),
28708
28867
  ...globalProperties,
28709
28868
  ...this.defaultProperties,
28710
- ...properties,
28711
- ...context
28869
+ ...redactProperties2(properties ?? {}),
28870
+ ...context ? {
28871
+ [TELEMETRY_OPERATION_ID_PROPERTY2]: context.operationId,
28872
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY2]: context.parentId } : {},
28873
+ [TELEMETRY_SPAN_ID_PROPERTY2]: context.id
28874
+ } : {}
28712
28875
  };
28713
28876
  if (sessionId === undefined) {
28714
28877
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY2];
@@ -28718,7 +28881,16 @@ class TelemetryService2 {
28718
28881
  return enriched;
28719
28882
  }
28720
28883
  generateId() {
28721
- return crypto.randomUUID().replaceAll("-", "");
28884
+ const bytes = new Uint8Array(8);
28885
+ let hex = "";
28886
+ do {
28887
+ crypto.getRandomValues(bytes);
28888
+ hex = "";
28889
+ for (const byte of bytes) {
28890
+ hex += byte.toString(16).padStart(2, "0");
28891
+ }
28892
+ } while (/^0+$/.test(hex));
28893
+ return hex;
28722
28894
  }
28723
28895
  }
28724
28896
  function getGlobalTelemetryInstance2() {
@@ -29172,101 +29344,20 @@ function buildCommandTelemetryAttribution2(commandPath, skillSource) {
29172
29344
  ...getCommandProductModeAttribution2(commandPath)
29173
29345
  };
29174
29346
  }
29175
- function shortHash2(input) {
29176
- let hash = 2166136261;
29177
- for (let i2 = 0;i2 < input.length; i2++) {
29178
- hash ^= input.charCodeAt(i2);
29179
- hash = Math.imul(hash, 16777619);
29180
- }
29181
- return (hash >>> 0).toString(16).padStart(8, "0");
29182
- }
29183
- function redactUrl2(raw) {
29184
- try {
29185
- const url = new URL(raw);
29186
- return `${url.protocol}//${url.host}`;
29187
- } catch {
29188
- return `url#${shortHash2(raw)}`;
29189
- }
29190
- }
29191
- function redactValueDetectors2(value) {
29192
- let out = value;
29193
- out = out.replace(JWT_PATTERN2, () => REDACTED2);
29194
- out = out.replace(URL_PATTERN2, (match) => {
29195
- const trailing = match.match(URL_TRAILING_PUNCT2)?.[0] ?? "";
29196
- const core22 = trailing ? match.slice(0, -trailing.length) : match;
29197
- return `${redactUrl2(core22)}${trailing}`;
29198
- });
29199
- out = out.replace(USER_HOME_PATTERN2, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
29200
- out = out.replace(EMAIL_PATTERN2, (match) => `email#${shortHash2(match)}`);
29201
- out = out.replace(UUID_PATTERN2, (match) => `uuid#${shortHash2(match)}`);
29202
- out = out.replace(LONG_TOKEN_PATTERN2, () => REDACTED2);
29203
- if (out.length > MAX_VALUE_LENGTH2) {
29204
- out = `${out.slice(0, MAX_VALUE_LENGTH2)}…`;
29205
- }
29206
- return out;
29207
- }
29208
- function nameTokens2(name) {
29209
- 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);
29210
- }
29211
- function isSensitiveName2(name) {
29212
- const tokens = nameTokens2(name);
29213
- for (let i2 = 0;i2 < tokens.length; i2++) {
29214
- const token = tokens[i2];
29215
- if (SENSITIVE_NAME_TOKENS2.has(token)) {
29216
- return true;
29217
- }
29218
- if (token === "key" || token === "keys") {
29219
- const prev = tokens[i2 - 1];
29220
- if (prev && SENSITIVE_KEY_PREFIXES2.has(prev)) {
29221
- return true;
29222
- }
29223
- }
29224
- }
29225
- return false;
29226
- }
29227
- function redactProperty2(name, value) {
29228
- if (value === undefined || value === null) {
29229
- return;
29230
- }
29231
- if (isSensitiveName2(name)) {
29232
- return REDACTED2;
29233
- }
29234
- if (typeof value === "boolean" || typeof value === "number") {
29235
- return value;
29236
- }
29237
- if (typeof value !== "string") {
29238
- return "[OBJECT]";
29239
- }
29240
- return redactValueDetectors2(value);
29241
- }
29242
- function redactProperties2(properties) {
29243
- const out = {};
29244
- for (const [name, value] of Object.entries(properties)) {
29245
- const redacted = redactProperty2(name, value);
29246
- if (redacted !== undefined) {
29247
- out[name] = redacted;
29248
- }
29249
- }
29250
- return out;
29251
- }
29252
29347
  function extractCommandParams2(cmd) {
29253
29348
  const params = {};
29349
+ const add22 = (name, value) => {
29350
+ if (name && value !== undefined) {
29351
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX2}${name}`] = value;
29352
+ }
29353
+ };
29254
29354
  const registered = cmd.registeredArguments ?? [];
29255
29355
  const processed = cmd.processedArgs ?? [];
29256
29356
  for (let i2 = 0;i2 < registered.length; i2++) {
29257
- const value = processed[i2];
29258
- if (value === undefined) {
29259
- continue;
29260
- }
29261
- const name = registered[i2].name();
29262
- if (name) {
29263
- params[name] = value;
29264
- }
29357
+ add22(registered[i2].name(), processed[i2]);
29265
29358
  }
29266
29359
  for (const [key, value] of Object.entries(cmd.opts())) {
29267
- if (value !== undefined) {
29268
- params[key] = value;
29269
- }
29360
+ add22(key, value);
29270
29361
  }
29271
29362
  return params;
29272
29363
  }
@@ -31478,7 +31569,7 @@ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __t
31478
31569
  }
31479
31570
  return result;
31480
31571
  }
31481
- }, TreeInterpreterInstance2, TreeInterpreter_default2, jsYaml2, loader2, common2, hasRequiredCommon2, exception2, hasRequiredException2, snippet2, hasRequiredSnippet2, type2, hasRequiredType2, schema2, hasRequiredSchema2, str2, hasRequiredStr2, seq2, hasRequiredSeq2, map2, hasRequiredMap2, failsafe2, hasRequiredFailsafe2, _null2, hasRequired_null2, bool2, hasRequiredBool2, int2, hasRequiredInt2, float2, hasRequiredFloat2, json2, hasRequiredJson2, core2, hasRequiredCore2, timestamp2, hasRequiredTimestamp2, merge2, hasRequiredMerge2, binary2, hasRequiredBinary2, omap2, hasRequiredOmap2, pairs2, hasRequiredPairs2, set2, hasRequiredSet2, _default2, hasRequired_default2, hasRequiredLoader2, dumper2, hasRequiredDumper2, hasRequiredJsYaml2, jsYamlExports2, yaml2, Type2, Schema2, FAILSAFE_SCHEMA2, JSON_SCHEMA2, CORE_SCHEMA2, DEFAULT_SCHEMA2, load2, loadAll2, dump2, YAMLException2, types2, safeLoad2, safeLoadAll2, safeDump2, logFilePathSlot2, LogLevel3, DEFAULT_LOG_LEVEL2 = 3, SimpleLogger2, loggerSingleton2, logger3, formatSlot2, formatExplicitSlot2, helpRequestedSlot2, filterSlot2, recordedFailureSlot2, AUTH_ERROR_CODES2, VALIDATION_ERROR_CODES2, NETWORK_HTTP_ERROR_CODES2, TIMEOUT_ERROR_CODES2, NETWORK_OS_ERROR_CODES2, TIMEOUT_OS_ERROR_CODES2, TLS_ERROR_CODES22, MISSING_DEPENDENCY_CODES2, INTERNAL_ERROR_NAMES2, CommonTelemetryEvents2, KNOWN_AGENTS2, LOCAL_HOSTS2, authSignalSlot2, isTruthy2 = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false", isEqual2 = (value, expected) => value?.toLowerCase() === expected, CI_SIGNATURES2, TELEMETRY_SESSION_ID_ENV2 = "UIPATH_SESSION_ID", TELEMETRY_SESSION_ID_PROPERTY2 = "session_id", telemetrySessionIdSlot2, telemetryPropsSlot2, providerSlot2, telemetryInstanceSlot2, DEFAULT_AI_CONNECTION_STRING2, _localTelemetryInstance2, telemetry2, CLI_ERROR_CODES2, RETRY_HINTS2, RESULTS2, EXIT_CODES2, FilterEvaluationError2, OutputFormatter2, LEGACY_SKILL_NAMESPACE2 = "uipath:", MAX_SKILL_NAME_LENGTH2 = 80, SKILL_NAME_PATTERN2, SKILL_ATTRIBUTION2, KNOWN_SKILL_NAMES2, COMMAND_ATTRIBUTION2, REDACTED2 = "[REDACTED]", MAX_VALUE_LENGTH2 = 200, SENSITIVE_NAME_TOKENS2, SENSITIVE_KEY_PREFIXES2, UUID_PATTERN2, EMAIL_PATTERN2, JWT_PATTERN2, LONG_TOKEN_PATTERN2, USER_HOME_PATTERN2, URL_PATTERN2, URL_TRAILING_PUNCT2, pollSignalSlot2, cliErrorCodeValues2, retryHintValues2, guardInstalledSlot2, savedOriginalsSlot2, DEFAULT_AUTH_TIMEOUT_MS3, modeSlot2, interactiveFlagSlot2, PollOutcome2, REASON_BY_OUTCOME2, TERMINAL_STATUSES2, FAILURE_STATUSES2, previewSlot2, ScreenLogger2, sdkUserAgentHostToken2, shippedKeysSlot2, factorySlot2;
31572
+ }, TreeInterpreterInstance2, TreeInterpreter_default2, jsYaml2, loader2, common2, hasRequiredCommon2, exception2, hasRequiredException2, snippet2, hasRequiredSnippet2, type2, hasRequiredType2, schema2, hasRequiredSchema2, str2, hasRequiredStr2, seq2, hasRequiredSeq2, map2, hasRequiredMap2, failsafe2, hasRequiredFailsafe2, _null2, hasRequired_null2, bool2, hasRequiredBool2, int2, hasRequiredInt2, float2, hasRequiredFloat2, json2, hasRequiredJson2, core2, hasRequiredCore2, timestamp2, hasRequiredTimestamp2, merge2, hasRequiredMerge2, binary2, hasRequiredBinary2, omap2, hasRequiredOmap2, pairs2, hasRequiredPairs2, set2, hasRequiredSet2, _default2, hasRequired_default2, hasRequiredLoader2, dumper2, hasRequiredDumper2, hasRequiredJsYaml2, jsYamlExports2, yaml2, Type2, Schema2, FAILSAFE_SCHEMA2, JSON_SCHEMA2, CORE_SCHEMA2, DEFAULT_SCHEMA2, load2, loadAll2, dump2, YAMLException2, types2, safeLoad2, safeLoadAll2, safeDump2, logFilePathSlot2, LogLevel3, DEFAULT_LOG_LEVEL2 = 3, SimpleLogger2, loggerSingleton2, logger3, formatSlot2, formatExplicitSlot2, helpRequestedSlot2, filterSlot2, recordedFailureSlot2, AUTH_ERROR_CODES2, VALIDATION_ERROR_CODES2, NETWORK_HTTP_ERROR_CODES2, TIMEOUT_ERROR_CODES2, NETWORK_OS_ERROR_CODES2, TIMEOUT_OS_ERROR_CODES2, TLS_ERROR_CODES22, MISSING_DEPENDENCY_CODES2, INTERNAL_ERROR_NAMES2, CommonTelemetryEvents2, KNOWN_AGENTS2, LOCAL_HOSTS2, authSignalSlot2, isTruthy2 = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false", isEqual2 = (value, expected) => value?.toLowerCase() === expected, CI_SIGNATURES2, TELEMETRY_TRACEPARENT_ENV2 = "TRACEPARENT", TRACEPARENT_PATTERN2, TELEMETRY_SESSION_ID_ENV2 = "UIPATH_SESSION_ID", TELEMETRY_SESSION_ID_PROPERTY2 = "session_id", telemetrySessionIdSlot2, telemetryOperationIdSlot2, telemetryPropsSlot2, REDACTED2 = "[REDACTED]", MAX_VALUE_LENGTH2 = 200, SENSITIVE_NAME_TOKENS2, SENSITIVE_KEY_PREFIXES2, UUID_PATTERN2, EMAIL_PATTERN2, JWT_PATTERN2, LONG_TOKEN_PATTERN2, USER_HOME_PATTERN2, URL_PATTERN2, URL_TRAILING_PUNCT2, TELEMETRY_OPERATION_ID_PROPERTY2 = "uip.trace.operation_id", TELEMETRY_PARENT_ID_PROPERTY2 = "uip.trace.parent_id", TELEMETRY_SPAN_ID_PROPERTY2 = "uip.trace.span_id", providerSlot2, telemetryInstanceSlot2, DEFAULT_AI_CONNECTION_STRING2, _localTelemetryInstance2, telemetry2, CLI_ERROR_CODES2, RETRY_HINTS2, RESULTS2, EXIT_CODES2, FilterEvaluationError2, OutputFormatter2, LEGACY_SKILL_NAMESPACE2 = "uipath:", MAX_SKILL_NAME_LENGTH2 = 80, SKILL_NAME_PATTERN2, SKILL_ATTRIBUTION2, KNOWN_SKILL_NAMES2, COMMAND_ATTRIBUTION2, pollSignalSlot2, cliErrorCodeValues2, retryHintValues2, TELEMETRY_COMMAND_ARG_PREFIX2 = "uip.cmd.arg.", guardInstalledSlot2, savedOriginalsSlot2, DEFAULT_AUTH_TIMEOUT_MS3, modeSlot2, interactiveFlagSlot2, PollOutcome2, REASON_BY_OUTCOME2, TERMINAL_STATUSES2, FAILURE_STATUSES2, previewSlot2, ScreenLogger2, sdkUserAgentHostToken2, shippedKeysSlot2, factorySlot2;
31482
31573
  var init_dist2 = __esm(() => {
31483
31574
  __create2 = Object.create;
31484
31575
  __getProtoOf2 = Object.getPrototypeOf;
@@ -34137,8 +34228,53 @@ Expecting one of '${allowedValues.join("', '")}'`);
34137
34228
  matches: (env) => isTruthy2(env.CI)
34138
34229
  }
34139
34230
  ];
34231
+ TRACEPARENT_PATTERN2 = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
34140
34232
  telemetrySessionIdSlot2 = singleton3("TelemetrySessionId");
34233
+ telemetryOperationIdSlot2 = singleton3("TelemetryOperationId");
34141
34234
  telemetryPropsSlot2 = singleton3("TelemetryDefaultProps");
34235
+ SENSITIVE_NAME_TOKENS2 = new Set([
34236
+ "token",
34237
+ "tokens",
34238
+ "secret",
34239
+ "secrets",
34240
+ "password",
34241
+ "passwords",
34242
+ "pwd",
34243
+ "credential",
34244
+ "credentials",
34245
+ "auth",
34246
+ "authentication",
34247
+ "authorization",
34248
+ "authority",
34249
+ "cert",
34250
+ "certificate",
34251
+ "certificates"
34252
+ ]);
34253
+ SENSITIVE_KEY_PREFIXES2 = new Set([
34254
+ "api",
34255
+ "access",
34256
+ "client",
34257
+ "private",
34258
+ "public",
34259
+ "signing",
34260
+ "encryption",
34261
+ "session",
34262
+ "master",
34263
+ "shared",
34264
+ "root",
34265
+ "ssh",
34266
+ "rsa",
34267
+ "aes",
34268
+ "hmac",
34269
+ "oauth"
34270
+ ]);
34271
+ UUID_PATTERN2 = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
34272
+ EMAIL_PATTERN2 = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
34273
+ JWT_PATTERN2 = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
34274
+ LONG_TOKEN_PATTERN2 = /\b[A-Za-z0-9_-]{40,}\b/g;
34275
+ USER_HOME_PATTERN2 = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
34276
+ URL_PATTERN2 = /\bhttps?:\/\/[^\s,;]+/gi;
34277
+ URL_TRAILING_PUNCT2 = /[.,;:!?)\]}>'"]+$/;
34142
34278
  providerSlot2 = singleton3("TelemetryProvider");
34143
34279
  telemetryInstanceSlot2 = singleton3("TelemetryService");
34144
34280
  DEFAULT_AI_CONNECTION_STRING2 = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
@@ -34377,49 +34513,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
34377
34513
  ]
34378
34514
  ]
34379
34515
  ]).sort((a, b) => b.prefix.length - a.prefix.length);
34380
- SENSITIVE_NAME_TOKENS2 = new Set([
34381
- "token",
34382
- "tokens",
34383
- "secret",
34384
- "secrets",
34385
- "password",
34386
- "passwords",
34387
- "pwd",
34388
- "credential",
34389
- "credentials",
34390
- "auth",
34391
- "authentication",
34392
- "authorization",
34393
- "authority",
34394
- "cert",
34395
- "certificate",
34396
- "certificates"
34397
- ]);
34398
- SENSITIVE_KEY_PREFIXES2 = new Set([
34399
- "api",
34400
- "access",
34401
- "client",
34402
- "private",
34403
- "public",
34404
- "signing",
34405
- "encryption",
34406
- "session",
34407
- "master",
34408
- "shared",
34409
- "root",
34410
- "ssh",
34411
- "rsa",
34412
- "aes",
34413
- "hmac",
34414
- "oauth"
34415
- ]);
34416
- UUID_PATTERN2 = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
34417
- EMAIL_PATTERN2 = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
34418
- JWT_PATTERN2 = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
34419
- LONG_TOKEN_PATTERN2 = /\b[A-Za-z0-9_-]{40,}\b/g;
34420
- USER_HOME_PATTERN2 = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
34421
- URL_PATTERN2 = /\bhttps?:\/\/[^\s,;]+/gi;
34422
- URL_TRAILING_PUNCT2 = /[.,;:!?)\]}>'"]+$/;
34423
34516
  pollSignalSlot2 = singleton3("PollSignal");
34424
34517
  cliErrorCodeValues2 = new Set(CLI_ERROR_CODES2);
34425
34518
  retryHintValues2 = new Set(RETRY_HINTS2);
@@ -34428,11 +34521,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
34428
34521
  return this.action(async (...args) => {
34429
34522
  const telemetryName = deriveCommandPath2(command);
34430
34523
  const props = typeof properties === "function" ? properties(...args) : properties;
34524
+ const requestContext = telemetry2.createRequestContext();
34431
34525
  const startTime = performance.now();
34432
34526
  let errorMessage2;
34433
34527
  let fallbackExitCode = EXIT_CODES2.Success;
34434
34528
  clearRecordedCommandFailureTelemetry2();
34435
- const [error] = await catchError3(fn(...args));
34529
+ const [error] = await catchError3(telemetry2.runWithContext(requestContext, () => fn(...args)));
34436
34530
  if (error) {
34437
34531
  errorMessage2 = error instanceof Error ? error.message : String(error);
34438
34532
  logger3.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage2}`);
@@ -34468,16 +34562,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
34468
34562
  recordedFailure,
34469
34563
  pollSignal: context.pollSignal
34470
34564
  });
34471
- telemetry2.trackEvent(telemetryName, redactProperties2({
34472
- ...extractCommandParams2(command),
34565
+ const commandParams = extractCommandParams2(command);
34566
+ if (props) {
34567
+ for (const key of Object.keys(props)) {
34568
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX2}${key}`];
34569
+ }
34570
+ }
34571
+ const baseProperties = redactProperties2({
34572
+ ...commandParams,
34473
34573
  ...props,
34474
34574
  ...buildCommandTelemetryAttribution2(telemetryName, process.env.UIPATH_SKILL),
34475
34575
  command: "true",
34476
- duration: String(durationMs),
34477
- success: String(success),
34478
34576
  ...terminalTelemetry,
34479
34577
  ...errorMessage2 ? { errorMessage: errorMessage2 } : {}
34480
- }));
34578
+ });
34579
+ telemetry2.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
34481
34580
  });
34482
34581
  };
34483
34582
  guardInstalledSlot2 = singleton3("ConsoleGuardInstalled");
@@ -41969,7 +42068,27 @@ class NodeContextStorage3 {
41969
42068
  return this.storage.getStore();
41970
42069
  }
41971
42070
  }
41972
- function getProcessEnv3() {
42071
+ function getProcessEnv4() {
42072
+ return globalThis.process?.env;
42073
+ }
42074
+ function parseInboundTraceparent3(value) {
42075
+ if (!value) {
42076
+ return;
42077
+ }
42078
+ const match = TRACEPARENT_PATTERN3.exec(value.trim().toLowerCase());
42079
+ if (!match) {
42080
+ return;
42081
+ }
42082
+ const [, traceId, parentSpanId] = match;
42083
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
42084
+ return;
42085
+ }
42086
+ return { traceId, parentSpanId };
42087
+ }
42088
+ function getInboundTraceContext3() {
42089
+ return parseInboundTraceparent3(getProcessEnv4()?.[TELEMETRY_TRACEPARENT_ENV3]);
42090
+ }
42091
+ function getProcessEnv23() {
41973
42092
  return globalThis.process?.env;
41974
42093
  }
41975
42094
  function normalizeSessionId3(value) {
@@ -41980,14 +42099,110 @@ function normalizeSessionId3(value) {
41980
42099
  return trimmed || undefined;
41981
42100
  }
41982
42101
  function getConfiguredTelemetrySessionId3() {
41983
- return normalizeSessionId3(getProcessEnv3()?.[TELEMETRY_SESSION_ID_ENV3]);
42102
+ return normalizeSessionId3(getProcessEnv23()?.[TELEMETRY_SESSION_ID_ENV3]);
41984
42103
  }
41985
42104
  function resolveTelemetrySessionId3(existingSessionId) {
41986
42105
  return getConfiguredTelemetrySessionId3() ?? normalizeSessionId3(existingSessionId);
41987
42106
  }
42107
+ function getTelemetryOperationId3() {
42108
+ const existing = telemetryOperationIdSlot3.get();
42109
+ if (existing) {
42110
+ return existing;
42111
+ }
42112
+ const inboundTraceId = getInboundTraceContext3()?.traceId;
42113
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
42114
+ telemetryOperationIdSlot3.set(generated);
42115
+ return generated;
42116
+ }
41988
42117
  function getGlobalTelemetryProperties3() {
41989
42118
  return telemetryPropsSlot3.get();
41990
42119
  }
42120
+ function shortHash3(input) {
42121
+ let hash = 2166136261;
42122
+ for (let i2 = 0;i2 < input.length; i2++) {
42123
+ hash ^= input.charCodeAt(i2);
42124
+ hash = Math.imul(hash, 16777619);
42125
+ }
42126
+ return (hash >>> 0).toString(16).padStart(8, "0");
42127
+ }
42128
+ function redactUrl3(raw) {
42129
+ try {
42130
+ const url = new URL(raw);
42131
+ return `${url.protocol}//${url.host}`;
42132
+ } catch {
42133
+ return `url#${shortHash3(raw)}`;
42134
+ }
42135
+ }
42136
+ function redactValueDetectors3(value) {
42137
+ let out = value;
42138
+ out = out.replace(JWT_PATTERN3, () => REDACTED3);
42139
+ out = out.replace(URL_PATTERN3, (match) => {
42140
+ const trailing = match.match(URL_TRAILING_PUNCT3)?.[0] ?? "";
42141
+ const core22 = trailing ? match.slice(0, -trailing.length) : match;
42142
+ return `${redactUrl3(core22)}${trailing}`;
42143
+ });
42144
+ out = out.replace(USER_HOME_PATTERN3, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
42145
+ out = out.replace(EMAIL_PATTERN3, (match) => `email#${shortHash3(match)}`);
42146
+ out = out.replace(UUID_PATTERN3, (match) => `uuid#${shortHash3(match)}`);
42147
+ out = out.replace(LONG_TOKEN_PATTERN3, () => REDACTED3);
42148
+ if (out.length > MAX_VALUE_LENGTH3) {
42149
+ out = `${out.slice(0, MAX_VALUE_LENGTH3)}…`;
42150
+ }
42151
+ return out;
42152
+ }
42153
+ function redactValue3(value) {
42154
+ return redactValueDetectors3(value);
42155
+ }
42156
+ function redactError3(error) {
42157
+ const safe = new Error(redactValueDetectors3(error.message ?? ""));
42158
+ safe.name = error.name;
42159
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors3(error.stack) : undefined;
42160
+ return safe;
42161
+ }
42162
+ function nameTokens3(name) {
42163
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t2) => t2.toLowerCase()).filter(Boolean);
42164
+ }
42165
+ function isSensitiveName3(name) {
42166
+ const tokens = nameTokens3(name);
42167
+ for (let i2 = 0;i2 < tokens.length; i2++) {
42168
+ const token = tokens[i2];
42169
+ if (SENSITIVE_NAME_TOKENS3.has(token)) {
42170
+ return true;
42171
+ }
42172
+ if (token === "key" || token === "keys") {
42173
+ const prev = tokens[i2 - 1];
42174
+ if (prev && SENSITIVE_KEY_PREFIXES3.has(prev)) {
42175
+ return true;
42176
+ }
42177
+ }
42178
+ }
42179
+ return false;
42180
+ }
42181
+ function redactProperty3(name, value) {
42182
+ if (value === undefined || value === null) {
42183
+ return;
42184
+ }
42185
+ if (isSensitiveName3(name)) {
42186
+ return REDACTED3;
42187
+ }
42188
+ if (typeof value === "boolean" || typeof value === "number") {
42189
+ return value;
42190
+ }
42191
+ if (typeof value !== "string") {
42192
+ return "[OBJECT]";
42193
+ }
42194
+ return redactValueDetectors3(value);
42195
+ }
42196
+ function redactProperties3(properties) {
42197
+ const out = {};
42198
+ for (const [name, value] of Object.entries(properties)) {
42199
+ const redacted = redactProperty3(name, value);
42200
+ if (redacted !== undefined) {
42201
+ out[name] = redacted;
42202
+ }
42203
+ }
42204
+ return out;
42205
+ }
41991
42206
 
41992
42207
  class TelemetryService3 {
41993
42208
  telemetryProvider;
@@ -42015,11 +42230,15 @@ class TelemetryService3 {
42015
42230
  trackException(error, properties) {
42016
42231
  const context = this.getCurrentContext();
42017
42232
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
42018
- this.telemetryProvider.trackException(error, enrichedProperties);
42233
+ this.telemetryProvider.trackException(redactError3(error), enrichedProperties);
42019
42234
  }
42020
42235
  async trackRequest(name, fn, properties) {
42236
+ const parentContext = this.getCurrentContext();
42237
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId3();
42238
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
42021
42239
  const context = {
42022
- operationId: this.operationId ?? this.generateId(),
42240
+ operationId,
42241
+ ...parentId !== undefined ? { parentId } : {},
42023
42242
  id: this.generateId()
42024
42243
  };
42025
42244
  const startTime = performance.now();
@@ -42037,6 +42256,45 @@ class TelemetryService3 {
42037
42256
  throw error;
42038
42257
  }
42039
42258
  }
42259
+ trackRequestResult(name, durationMs, success, properties, context) {
42260
+ const requestContext = context ?? {
42261
+ operationId: this.operationId ?? getTelemetryOperationId3(),
42262
+ id: this.generateId()
42263
+ };
42264
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
42265
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
42266
+ }
42267
+ createRequestContext() {
42268
+ const operationId = this.operationId ?? getTelemetryOperationId3();
42269
+ const parentId = this.inboundParentIdFor(operationId);
42270
+ return {
42271
+ operationId,
42272
+ ...parentId !== undefined ? { parentId } : {},
42273
+ id: this.generateId()
42274
+ };
42275
+ }
42276
+ inboundParentIdFor(operationId) {
42277
+ const inbound = getInboundTraceContext3();
42278
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
42279
+ }
42280
+ runWithContext(context, fn) {
42281
+ return this.contextStorage.run(context, fn);
42282
+ }
42283
+ createDependencyContext() {
42284
+ const parentContext = this.getCurrentContext();
42285
+ if (!parentContext) {
42286
+ return;
42287
+ }
42288
+ return {
42289
+ operationId: parentContext.operationId,
42290
+ parentId: parentContext.id,
42291
+ id: this.generateId()
42292
+ };
42293
+ }
42294
+ trackDependencyResult(name, type22, durationMs, success, properties, context, resultCode) {
42295
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
42296
+ this.telemetryProvider.trackDependency(redactValue3(name), type22, durationMs, success, enrichedProperties, resultCode);
42297
+ }
42040
42298
  async trackDependencyOperation(name, type22, fn, properties) {
42041
42299
  const parentContext = this.getCurrentContext();
42042
42300
  if (!parentContext) {
@@ -42073,8 +42331,12 @@ class TelemetryService3 {
42073
42331
  ...getExecutionContextTelemetryProperties3(),
42074
42332
  ...globalProperties,
42075
42333
  ...this.defaultProperties,
42076
- ...properties,
42077
- ...context
42334
+ ...redactProperties3(properties ?? {}),
42335
+ ...context ? {
42336
+ [TELEMETRY_OPERATION_ID_PROPERTY3]: context.operationId,
42337
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY3]: context.parentId } : {},
42338
+ [TELEMETRY_SPAN_ID_PROPERTY3]: context.id
42339
+ } : {}
42078
42340
  };
42079
42341
  if (sessionId === undefined) {
42080
42342
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY3];
@@ -42084,7 +42346,16 @@ class TelemetryService3 {
42084
42346
  return enriched;
42085
42347
  }
42086
42348
  generateId() {
42087
- return crypto.randomUUID().replaceAll("-", "");
42349
+ const bytes = new Uint8Array(8);
42350
+ let hex = "";
42351
+ do {
42352
+ crypto.getRandomValues(bytes);
42353
+ hex = "";
42354
+ for (const byte of bytes) {
42355
+ hex += byte.toString(16).padStart(2, "0");
42356
+ }
42357
+ } while (/^0+$/.test(hex));
42358
+ return hex;
42088
42359
  }
42089
42360
  }
42090
42361
  function getGlobalTelemetryInstance3() {
@@ -42538,101 +42809,20 @@ function buildCommandTelemetryAttribution3(commandPath, skillSource) {
42538
42809
  ...getCommandProductModeAttribution3(commandPath)
42539
42810
  };
42540
42811
  }
42541
- function shortHash3(input) {
42542
- let hash = 2166136261;
42543
- for (let i2 = 0;i2 < input.length; i2++) {
42544
- hash ^= input.charCodeAt(i2);
42545
- hash = Math.imul(hash, 16777619);
42546
- }
42547
- return (hash >>> 0).toString(16).padStart(8, "0");
42548
- }
42549
- function redactUrl3(raw) {
42550
- try {
42551
- const url = new URL(raw);
42552
- return `${url.protocol}//${url.host}`;
42553
- } catch {
42554
- return `url#${shortHash3(raw)}`;
42555
- }
42556
- }
42557
- function redactValueDetectors3(value) {
42558
- let out = value;
42559
- out = out.replace(JWT_PATTERN3, () => REDACTED3);
42560
- out = out.replace(URL_PATTERN3, (match) => {
42561
- const trailing = match.match(URL_TRAILING_PUNCT3)?.[0] ?? "";
42562
- const core22 = trailing ? match.slice(0, -trailing.length) : match;
42563
- return `${redactUrl3(core22)}${trailing}`;
42564
- });
42565
- out = out.replace(USER_HOME_PATTERN3, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
42566
- out = out.replace(EMAIL_PATTERN3, (match) => `email#${shortHash3(match)}`);
42567
- out = out.replace(UUID_PATTERN3, (match) => `uuid#${shortHash3(match)}`);
42568
- out = out.replace(LONG_TOKEN_PATTERN3, () => REDACTED3);
42569
- if (out.length > MAX_VALUE_LENGTH3) {
42570
- out = `${out.slice(0, MAX_VALUE_LENGTH3)}…`;
42571
- }
42572
- return out;
42573
- }
42574
- function nameTokens3(name) {
42575
- return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((t2) => t2.toLowerCase()).filter(Boolean);
42576
- }
42577
- function isSensitiveName3(name) {
42578
- const tokens = nameTokens3(name);
42579
- for (let i2 = 0;i2 < tokens.length; i2++) {
42580
- const token = tokens[i2];
42581
- if (SENSITIVE_NAME_TOKENS3.has(token)) {
42582
- return true;
42583
- }
42584
- if (token === "key" || token === "keys") {
42585
- const prev = tokens[i2 - 1];
42586
- if (prev && SENSITIVE_KEY_PREFIXES3.has(prev)) {
42587
- return true;
42588
- }
42589
- }
42590
- }
42591
- return false;
42592
- }
42593
- function redactProperty3(name, value) {
42594
- if (value === undefined || value === null) {
42595
- return;
42596
- }
42597
- if (isSensitiveName3(name)) {
42598
- return REDACTED3;
42599
- }
42600
- if (typeof value === "boolean" || typeof value === "number") {
42601
- return value;
42602
- }
42603
- if (typeof value !== "string") {
42604
- return "[OBJECT]";
42605
- }
42606
- return redactValueDetectors3(value);
42607
- }
42608
- function redactProperties3(properties) {
42609
- const out = {};
42610
- for (const [name, value] of Object.entries(properties)) {
42611
- const redacted = redactProperty3(name, value);
42612
- if (redacted !== undefined) {
42613
- out[name] = redacted;
42614
- }
42615
- }
42616
- return out;
42617
- }
42618
42812
  function extractCommandParams3(cmd) {
42619
42813
  const params = {};
42814
+ const add22 = (name, value) => {
42815
+ if (name && value !== undefined) {
42816
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX3}${name}`] = value;
42817
+ }
42818
+ };
42620
42819
  const registered = cmd.registeredArguments ?? [];
42621
42820
  const processed = cmd.processedArgs ?? [];
42622
42821
  for (let i2 = 0;i2 < registered.length; i2++) {
42623
- const value = processed[i2];
42624
- if (value === undefined) {
42625
- continue;
42626
- }
42627
- const name = registered[i2].name();
42628
- if (name) {
42629
- params[name] = value;
42630
- }
42822
+ add22(registered[i2].name(), processed[i2]);
42631
42823
  }
42632
42824
  for (const [key, value] of Object.entries(cmd.opts())) {
42633
- if (value !== undefined) {
42634
- params[key] = value;
42635
- }
42825
+ add22(key, value);
42636
42826
  }
42637
42827
  return params;
42638
42828
  }
@@ -46267,7 +46457,7 @@ var de_default2, en4, es_default2, es_MX_default2, fr_default2, ja_default2, ko_
46267
46457
  }
46268
46458
  return result;
46269
46459
  }
46270
- }, TreeInterpreterInstance3, TreeInterpreter_default3, jsYaml3, loader3, common3, hasRequiredCommon3, exception3, hasRequiredException3, snippet3, hasRequiredSnippet3, type3, hasRequiredType3, schema3, hasRequiredSchema3, str3, hasRequiredStr3, seq3, hasRequiredSeq3, map3, hasRequiredMap3, failsafe3, hasRequiredFailsafe3, _null3, hasRequired_null3, bool3, hasRequiredBool3, int3, hasRequiredInt3, float3, hasRequiredFloat3, json3, hasRequiredJson3, core3, hasRequiredCore3, timestamp3, hasRequiredTimestamp3, merge3, hasRequiredMerge3, binary3, hasRequiredBinary3, omap3, hasRequiredOmap3, pairs3, hasRequiredPairs3, set3, hasRequiredSet3, _default3, hasRequired_default3, hasRequiredLoader3, dumper3, hasRequiredDumper3, hasRequiredJsYaml3, jsYamlExports3, yaml3, Type3, Schema3, FAILSAFE_SCHEMA3, JSON_SCHEMA3, CORE_SCHEMA3, DEFAULT_SCHEMA3, load3, loadAll3, dump3, YAMLException3, types3, safeLoad3, safeLoadAll3, safeDump3, logFilePathSlot3, LogLevel4, DEFAULT_LOG_LEVEL3 = 3, SimpleLogger3, loggerSingleton3, logger4, formatSlot3, formatExplicitSlot3, helpRequestedSlot3, filterSlot3, recordedFailureSlot3, AUTH_ERROR_CODES3, VALIDATION_ERROR_CODES3, NETWORK_HTTP_ERROR_CODES3, TIMEOUT_ERROR_CODES3, NETWORK_OS_ERROR_CODES3, TIMEOUT_OS_ERROR_CODES3, TLS_ERROR_CODES23, MISSING_DEPENDENCY_CODES3, INTERNAL_ERROR_NAMES3, CommonTelemetryEvents3, KNOWN_AGENTS3, LOCAL_HOSTS3, authSignalSlot3, isTruthy3 = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false", isEqual3 = (value, expected) => value?.toLowerCase() === expected, CI_SIGNATURES3, TELEMETRY_SESSION_ID_ENV3 = "UIPATH_SESSION_ID", TELEMETRY_SESSION_ID_PROPERTY3 = "session_id", telemetrySessionIdSlot3, telemetryPropsSlot3, providerSlot3, telemetryInstanceSlot3, DEFAULT_AI_CONNECTION_STRING3, _localTelemetryInstance3, telemetry3, CLI_ERROR_CODES3, RETRY_HINTS3, RESULTS3, EXIT_CODES3, FilterEvaluationError3, OutputFormatter3, LEGACY_SKILL_NAMESPACE3 = "uipath:", MAX_SKILL_NAME_LENGTH3 = 80, SKILL_NAME_PATTERN3, SKILL_ATTRIBUTION3, KNOWN_SKILL_NAMES3, COMMAND_ATTRIBUTION3, REDACTED3 = "[REDACTED]", MAX_VALUE_LENGTH3 = 200, SENSITIVE_NAME_TOKENS3, SENSITIVE_KEY_PREFIXES3, UUID_PATTERN3, EMAIL_PATTERN3, JWT_PATTERN3, LONG_TOKEN_PATTERN3, USER_HOME_PATTERN3, URL_PATTERN3, URL_TRAILING_PUNCT3, pollSignalSlot3, cliErrorCodeValues3, retryHintValues3, guardInstalledSlot3, savedOriginalsSlot3, DEFAULT_AUTH_TIMEOUT_MS4, modeSlot3, interactiveFlagSlot3, PollOutcome3, REASON_BY_OUTCOME3, TERMINAL_STATUSES3, FAILURE_STATUSES3, previewSlot3, ScreenLogger3, sdkUserAgentHostToken3, shippedKeysSlot3, factorySlot3, globalLogHandler2 = (logMessage) => {
46460
+ }, TreeInterpreterInstance3, TreeInterpreter_default3, jsYaml3, loader3, common3, hasRequiredCommon3, exception3, hasRequiredException3, snippet3, hasRequiredSnippet3, type3, hasRequiredType3, schema3, hasRequiredSchema3, str3, hasRequiredStr3, seq3, hasRequiredSeq3, map3, hasRequiredMap3, failsafe3, hasRequiredFailsafe3, _null3, hasRequired_null3, bool3, hasRequiredBool3, int3, hasRequiredInt3, float3, hasRequiredFloat3, json3, hasRequiredJson3, core3, hasRequiredCore3, timestamp3, hasRequiredTimestamp3, merge3, hasRequiredMerge3, binary3, hasRequiredBinary3, omap3, hasRequiredOmap3, pairs3, hasRequiredPairs3, set3, hasRequiredSet3, _default3, hasRequired_default3, hasRequiredLoader3, dumper3, hasRequiredDumper3, hasRequiredJsYaml3, jsYamlExports3, yaml3, Type3, Schema3, FAILSAFE_SCHEMA3, JSON_SCHEMA3, CORE_SCHEMA3, DEFAULT_SCHEMA3, load3, loadAll3, dump3, YAMLException3, types3, safeLoad3, safeLoadAll3, safeDump3, logFilePathSlot3, LogLevel4, DEFAULT_LOG_LEVEL3 = 3, SimpleLogger3, loggerSingleton3, logger4, formatSlot3, formatExplicitSlot3, helpRequestedSlot3, filterSlot3, recordedFailureSlot3, AUTH_ERROR_CODES3, VALIDATION_ERROR_CODES3, NETWORK_HTTP_ERROR_CODES3, TIMEOUT_ERROR_CODES3, NETWORK_OS_ERROR_CODES3, TIMEOUT_OS_ERROR_CODES3, TLS_ERROR_CODES23, MISSING_DEPENDENCY_CODES3, INTERNAL_ERROR_NAMES3, CommonTelemetryEvents3, KNOWN_AGENTS3, LOCAL_HOSTS3, authSignalSlot3, isTruthy3 = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false", isEqual3 = (value, expected) => value?.toLowerCase() === expected, CI_SIGNATURES3, TELEMETRY_TRACEPARENT_ENV3 = "TRACEPARENT", TRACEPARENT_PATTERN3, TELEMETRY_SESSION_ID_ENV3 = "UIPATH_SESSION_ID", TELEMETRY_SESSION_ID_PROPERTY3 = "session_id", telemetrySessionIdSlot3, telemetryOperationIdSlot3, telemetryPropsSlot3, REDACTED3 = "[REDACTED]", MAX_VALUE_LENGTH3 = 200, SENSITIVE_NAME_TOKENS3, SENSITIVE_KEY_PREFIXES3, UUID_PATTERN3, EMAIL_PATTERN3, JWT_PATTERN3, LONG_TOKEN_PATTERN3, USER_HOME_PATTERN3, URL_PATTERN3, URL_TRAILING_PUNCT3, TELEMETRY_OPERATION_ID_PROPERTY3 = "uip.trace.operation_id", TELEMETRY_PARENT_ID_PROPERTY3 = "uip.trace.parent_id", TELEMETRY_SPAN_ID_PROPERTY3 = "uip.trace.span_id", providerSlot3, telemetryInstanceSlot3, DEFAULT_AI_CONNECTION_STRING3, _localTelemetryInstance3, telemetry3, CLI_ERROR_CODES3, RETRY_HINTS3, RESULTS3, EXIT_CODES3, FilterEvaluationError3, OutputFormatter3, LEGACY_SKILL_NAMESPACE3 = "uipath:", MAX_SKILL_NAME_LENGTH3 = 80, SKILL_NAME_PATTERN3, SKILL_ATTRIBUTION3, KNOWN_SKILL_NAMES3, COMMAND_ATTRIBUTION3, pollSignalSlot3, cliErrorCodeValues3, retryHintValues3, TELEMETRY_COMMAND_ARG_PREFIX3 = "uip.cmd.arg.", guardInstalledSlot3, savedOriginalsSlot3, DEFAULT_AUTH_TIMEOUT_MS4, modeSlot3, interactiveFlagSlot3, PollOutcome3, REASON_BY_OUTCOME3, TERMINAL_STATUSES3, FAILURE_STATUSES3, previewSlot3, ScreenLogger3, sdkUserAgentHostToken3, shippedKeysSlot3, factorySlot3, globalLogHandler2 = (logMessage) => {
46271
46461
  const formattedMessage = logMessage.toFormattedString();
46272
46462
  switch (logMessage.logLevel) {
46273
46463
  case LogLevel2.Debug:
@@ -50219,8 +50409,53 @@ Expecting one of '${allowedValues.join("', '")}'`);
50219
50409
  matches: (env) => isTruthy3(env.CI)
50220
50410
  }
50221
50411
  ];
50412
+ TRACEPARENT_PATTERN3 = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
50222
50413
  telemetrySessionIdSlot3 = singleton4("TelemetrySessionId");
50414
+ telemetryOperationIdSlot3 = singleton4("TelemetryOperationId");
50223
50415
  telemetryPropsSlot3 = singleton4("TelemetryDefaultProps");
50416
+ SENSITIVE_NAME_TOKENS3 = new Set([
50417
+ "token",
50418
+ "tokens",
50419
+ "secret",
50420
+ "secrets",
50421
+ "password",
50422
+ "passwords",
50423
+ "pwd",
50424
+ "credential",
50425
+ "credentials",
50426
+ "auth",
50427
+ "authentication",
50428
+ "authorization",
50429
+ "authority",
50430
+ "cert",
50431
+ "certificate",
50432
+ "certificates"
50433
+ ]);
50434
+ SENSITIVE_KEY_PREFIXES3 = new Set([
50435
+ "api",
50436
+ "access",
50437
+ "client",
50438
+ "private",
50439
+ "public",
50440
+ "signing",
50441
+ "encryption",
50442
+ "session",
50443
+ "master",
50444
+ "shared",
50445
+ "root",
50446
+ "ssh",
50447
+ "rsa",
50448
+ "aes",
50449
+ "hmac",
50450
+ "oauth"
50451
+ ]);
50452
+ UUID_PATTERN3 = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
50453
+ EMAIL_PATTERN3 = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
50454
+ JWT_PATTERN3 = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
50455
+ LONG_TOKEN_PATTERN3 = /\b[A-Za-z0-9_-]{40,}\b/g;
50456
+ USER_HOME_PATTERN3 = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
50457
+ URL_PATTERN3 = /\bhttps?:\/\/[^\s,;]+/gi;
50458
+ URL_TRAILING_PUNCT3 = /[.,;:!?)\]}>'"]+$/;
50224
50459
  providerSlot3 = singleton4("TelemetryProvider");
50225
50460
  telemetryInstanceSlot3 = singleton4("TelemetryService");
50226
50461
  DEFAULT_AI_CONNECTION_STRING3 = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
@@ -50459,49 +50694,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
50459
50694
  ]
50460
50695
  ]
50461
50696
  ]).sort((a, b) => b.prefix.length - a.prefix.length);
50462
- SENSITIVE_NAME_TOKENS3 = new Set([
50463
- "token",
50464
- "tokens",
50465
- "secret",
50466
- "secrets",
50467
- "password",
50468
- "passwords",
50469
- "pwd",
50470
- "credential",
50471
- "credentials",
50472
- "auth",
50473
- "authentication",
50474
- "authorization",
50475
- "authority",
50476
- "cert",
50477
- "certificate",
50478
- "certificates"
50479
- ]);
50480
- SENSITIVE_KEY_PREFIXES3 = new Set([
50481
- "api",
50482
- "access",
50483
- "client",
50484
- "private",
50485
- "public",
50486
- "signing",
50487
- "encryption",
50488
- "session",
50489
- "master",
50490
- "shared",
50491
- "root",
50492
- "ssh",
50493
- "rsa",
50494
- "aes",
50495
- "hmac",
50496
- "oauth"
50497
- ]);
50498
- UUID_PATTERN3 = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
50499
- EMAIL_PATTERN3 = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
50500
- JWT_PATTERN3 = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
50501
- LONG_TOKEN_PATTERN3 = /\b[A-Za-z0-9_-]{40,}\b/g;
50502
- USER_HOME_PATTERN3 = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
50503
- URL_PATTERN3 = /\bhttps?:\/\/[^\s,;]+/gi;
50504
- URL_TRAILING_PUNCT3 = /[.,;:!?)\]}>'"]+$/;
50505
50697
  pollSignalSlot3 = singleton4("PollSignal");
50506
50698
  cliErrorCodeValues3 = new Set(CLI_ERROR_CODES3);
50507
50699
  retryHintValues3 = new Set(RETRY_HINTS3);
@@ -50510,11 +50702,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
50510
50702
  return this.action(async (...args) => {
50511
50703
  const telemetryName = deriveCommandPath3(command);
50512
50704
  const props = typeof properties === "function" ? properties(...args) : properties;
50705
+ const requestContext = telemetry3.createRequestContext();
50513
50706
  const startTime = performance.now();
50514
50707
  let errorMessage3;
50515
50708
  let fallbackExitCode = EXIT_CODES3.Success;
50516
50709
  clearRecordedCommandFailureTelemetry3();
50517
- const [error] = await catchError4(fn(...args));
50710
+ const [error] = await catchError4(telemetry3.runWithContext(requestContext, () => fn(...args)));
50518
50711
  if (error) {
50519
50712
  errorMessage3 = error instanceof Error ? error.message : String(error);
50520
50713
  logger4.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage3}`);
@@ -50550,16 +50743,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
50550
50743
  recordedFailure,
50551
50744
  pollSignal: context.pollSignal
50552
50745
  });
50553
- telemetry3.trackEvent(telemetryName, redactProperties3({
50554
- ...extractCommandParams3(command),
50746
+ const commandParams = extractCommandParams3(command);
50747
+ if (props) {
50748
+ for (const key of Object.keys(props)) {
50749
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX3}${key}`];
50750
+ }
50751
+ }
50752
+ const baseProperties = redactProperties3({
50753
+ ...commandParams,
50555
50754
  ...props,
50556
50755
  ...buildCommandTelemetryAttribution3(telemetryName, process.env.UIPATH_SKILL),
50557
50756
  command: "true",
50558
- duration: String(durationMs),
50559
- success: String(success),
50560
50757
  ...terminalTelemetry,
50561
50758
  ...errorMessage3 ? { errorMessage: errorMessage3 } : {}
50562
- }));
50759
+ });
50760
+ telemetry3.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
50563
50761
  });
50564
50762
  };
50565
50763
  guardInstalledSlot3 = singleton4("ConsoleGuardInstalled");
@@ -50736,7 +50934,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
50736
50934
  package_default3 = {
50737
50935
  name: "@uipath/project-packager",
50738
50936
  license: "MIT",
50739
- version: "1.199.0-preview.91",
50937
+ version: "1.199.0-preview.97",
50740
50938
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
50741
50939
  type: "module",
50742
50940
  main: "./dist/index.js",
@@ -51131,7 +51329,7 @@ var init_package = __esm(() => {
51131
51329
  package_default4 = {
51132
51330
  name: "@uipath/project-packager",
51133
51331
  license: "MIT",
51134
- version: "1.199.0-preview.91",
51332
+ version: "1.199.0-preview.97",
51135
51333
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
51136
51334
  type: "module",
51137
51335
  main: "./dist/index.js",
@@ -80585,7 +80783,7 @@ import"./packager-tool.js";
80585
80783
  var package_default = {
80586
80784
  name: "@uipath/api-workflow-tool",
80587
80785
  license: "MIT",
80588
- version: "1.199.0-preview.91",
80786
+ version: "1.199.0-preview.97",
80589
80787
  description: "Run UiPath API Workflows locally.",
80590
80788
  private: false,
80591
80789
  repository: {
@@ -86492,11 +86690,36 @@ class NodeContextStorage {
86492
86690
  return this.storage.getStore();
86493
86691
  }
86494
86692
  }
86693
+ // ../common/src/telemetry/trace-context.ts
86694
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
86695
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
86696
+ function getProcessEnv() {
86697
+ return globalThis.process?.env;
86698
+ }
86699
+ function parseInboundTraceparent(value) {
86700
+ if (!value) {
86701
+ return;
86702
+ }
86703
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
86704
+ if (!match) {
86705
+ return;
86706
+ }
86707
+ const [, traceId, parentSpanId] = match;
86708
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
86709
+ return;
86710
+ }
86711
+ return { traceId, parentSpanId };
86712
+ }
86713
+ function getInboundTraceContext() {
86714
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
86715
+ }
86716
+
86495
86717
  // ../common/src/telemetry/session-id.ts
86496
86718
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
86497
86719
  var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
86498
86720
  var telemetrySessionIdSlot = singleton("TelemetrySessionId");
86499
- function getProcessEnv() {
86721
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
86722
+ function getProcessEnv2() {
86500
86723
  return globalThis.process?.env;
86501
86724
  }
86502
86725
  function normalizeSessionId(value) {
@@ -86507,18 +86730,165 @@ function normalizeSessionId(value) {
86507
86730
  return trimmed || undefined;
86508
86731
  }
86509
86732
  function getConfiguredTelemetrySessionId() {
86510
- return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
86733
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
86511
86734
  }
86512
86735
  function resolveTelemetrySessionId(existingSessionId) {
86513
86736
  return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
86514
86737
  }
86738
+ function getTelemetryOperationId() {
86739
+ const existing = telemetryOperationIdSlot.get();
86740
+ if (existing) {
86741
+ return existing;
86742
+ }
86743
+ const inboundTraceId = getInboundTraceContext()?.traceId;
86744
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
86745
+ telemetryOperationIdSlot.set(generated);
86746
+ return generated;
86747
+ }
86515
86748
  // ../common/src/telemetry/global-telemetry-properties.ts
86516
86749
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
86517
86750
  function getGlobalTelemetryProperties() {
86518
86751
  return telemetryPropsSlot.get();
86519
86752
  }
86520
86753
 
86754
+ // ../common/src/telemetry/pii-redactor.ts
86755
+ var REDACTED = "[REDACTED]";
86756
+ var MAX_VALUE_LENGTH = 200;
86757
+ var SENSITIVE_NAME_TOKENS = new Set([
86758
+ "token",
86759
+ "tokens",
86760
+ "secret",
86761
+ "secrets",
86762
+ "password",
86763
+ "passwords",
86764
+ "pwd",
86765
+ "credential",
86766
+ "credentials",
86767
+ "auth",
86768
+ "authentication",
86769
+ "authorization",
86770
+ "authority",
86771
+ "cert",
86772
+ "certificate",
86773
+ "certificates"
86774
+ ]);
86775
+ var SENSITIVE_KEY_PREFIXES = new Set([
86776
+ "api",
86777
+ "access",
86778
+ "client",
86779
+ "private",
86780
+ "public",
86781
+ "signing",
86782
+ "encryption",
86783
+ "session",
86784
+ "master",
86785
+ "shared",
86786
+ "root",
86787
+ "ssh",
86788
+ "rsa",
86789
+ "aes",
86790
+ "hmac",
86791
+ "oauth"
86792
+ ]);
86793
+ 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;
86794
+ var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
86795
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
86796
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
86797
+ var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
86798
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
86799
+ var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
86800
+ function shortHash(input) {
86801
+ let hash = 2166136261;
86802
+ for (let i = 0;i < input.length; i++) {
86803
+ hash ^= input.charCodeAt(i);
86804
+ hash = Math.imul(hash, 16777619);
86805
+ }
86806
+ return (hash >>> 0).toString(16).padStart(8, "0");
86807
+ }
86808
+ function redactUrl(raw) {
86809
+ try {
86810
+ const url = new URL(raw);
86811
+ return `${url.protocol}//${url.host}`;
86812
+ } catch {
86813
+ return `url#${shortHash(raw)}`;
86814
+ }
86815
+ }
86816
+ function redactValueDetectors(value) {
86817
+ let out = value;
86818
+ out = out.replace(JWT_PATTERN, () => REDACTED);
86819
+ out = out.replace(URL_PATTERN, (match) => {
86820
+ const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
86821
+ const core2 = trailing ? match.slice(0, -trailing.length) : match;
86822
+ return `${redactUrl(core2)}${trailing}`;
86823
+ });
86824
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
86825
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
86826
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
86827
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
86828
+ if (out.length > MAX_VALUE_LENGTH) {
86829
+ out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
86830
+ }
86831
+ return out;
86832
+ }
86833
+ function redactValue(value) {
86834
+ return redactValueDetectors(value);
86835
+ }
86836
+ function redactError(error) {
86837
+ const safe = new Error(redactValueDetectors(error.message ?? ""));
86838
+ safe.name = error.name;
86839
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
86840
+ return safe;
86841
+ }
86842
+ function nameTokens(name) {
86843
+ 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);
86844
+ }
86845
+ function isSensitiveName(name) {
86846
+ const tokens = nameTokens(name);
86847
+ for (let i = 0;i < tokens.length; i++) {
86848
+ const token = tokens[i];
86849
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
86850
+ return true;
86851
+ }
86852
+ if (token === "key" || token === "keys") {
86853
+ const prev = tokens[i - 1];
86854
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
86855
+ return true;
86856
+ }
86857
+ }
86858
+ }
86859
+ return false;
86860
+ }
86861
+ function redactProperty(name, value) {
86862
+ if (value === undefined || value === null) {
86863
+ return;
86864
+ }
86865
+ if (isSensitiveName(name)) {
86866
+ return REDACTED;
86867
+ }
86868
+ if (typeof value === "boolean" || typeof value === "number") {
86869
+ return value;
86870
+ }
86871
+ if (typeof value !== "string") {
86872
+ return "[OBJECT]";
86873
+ }
86874
+ return redactValueDetectors(value);
86875
+ }
86876
+ function redactProperties(properties) {
86877
+ const out = {};
86878
+ for (const [name, value] of Object.entries(properties)) {
86879
+ const redacted = redactProperty(name, value);
86880
+ if (redacted !== undefined) {
86881
+ out[name] = redacted;
86882
+ }
86883
+ }
86884
+ return out;
86885
+ }
86886
+
86521
86887
  // ../common/src/telemetry/telemetry-service.ts
86888
+ var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
86889
+ var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
86890
+ var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
86891
+
86522
86892
  class TelemetryService {
86523
86893
  telemetryProvider;
86524
86894
  contextStorage;
@@ -86545,11 +86915,15 @@ class TelemetryService {
86545
86915
  trackException(error, properties) {
86546
86916
  const context = this.getCurrentContext();
86547
86917
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
86548
- this.telemetryProvider.trackException(error, enrichedProperties);
86918
+ this.telemetryProvider.trackException(redactError(error), enrichedProperties);
86549
86919
  }
86550
86920
  async trackRequest(name, fn, properties) {
86921
+ const parentContext = this.getCurrentContext();
86922
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
86923
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
86551
86924
  const context = {
86552
- operationId: this.operationId ?? this.generateId(),
86925
+ operationId,
86926
+ ...parentId !== undefined ? { parentId } : {},
86553
86927
  id: this.generateId()
86554
86928
  };
86555
86929
  const startTime = performance.now();
@@ -86567,6 +86941,45 @@ class TelemetryService {
86567
86941
  throw error;
86568
86942
  }
86569
86943
  }
86944
+ trackRequestResult(name, durationMs, success, properties, context) {
86945
+ const requestContext = context ?? {
86946
+ operationId: this.operationId ?? getTelemetryOperationId(),
86947
+ id: this.generateId()
86948
+ };
86949
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
86950
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
86951
+ }
86952
+ createRequestContext() {
86953
+ const operationId = this.operationId ?? getTelemetryOperationId();
86954
+ const parentId = this.inboundParentIdFor(operationId);
86955
+ return {
86956
+ operationId,
86957
+ ...parentId !== undefined ? { parentId } : {},
86958
+ id: this.generateId()
86959
+ };
86960
+ }
86961
+ inboundParentIdFor(operationId) {
86962
+ const inbound = getInboundTraceContext();
86963
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
86964
+ }
86965
+ runWithContext(context, fn) {
86966
+ return this.contextStorage.run(context, fn);
86967
+ }
86968
+ createDependencyContext() {
86969
+ const parentContext = this.getCurrentContext();
86970
+ if (!parentContext) {
86971
+ return;
86972
+ }
86973
+ return {
86974
+ operationId: parentContext.operationId,
86975
+ parentId: parentContext.id,
86976
+ id: this.generateId()
86977
+ };
86978
+ }
86979
+ trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
86980
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
86981
+ this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
86982
+ }
86570
86983
  async trackDependencyOperation(name, type2, fn, properties) {
86571
86984
  const parentContext = this.getCurrentContext();
86572
86985
  if (!parentContext) {
@@ -86603,8 +87016,12 @@ class TelemetryService {
86603
87016
  ...getExecutionContextTelemetryProperties(),
86604
87017
  ...globalProperties,
86605
87018
  ...this.defaultProperties,
86606
- ...properties,
86607
- ...context
87019
+ ...redactProperties(properties ?? {}),
87020
+ ...context ? {
87021
+ [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
87022
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
87023
+ [TELEMETRY_SPAN_ID_PROPERTY]: context.id
87024
+ } : {}
86608
87025
  };
86609
87026
  if (sessionId === undefined) {
86610
87027
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
@@ -86614,7 +87031,16 @@ class TelemetryService {
86614
87031
  return enriched;
86615
87032
  }
86616
87033
  generateId() {
86617
- return crypto.randomUUID().replaceAll("-", "");
87034
+ const bytes = new Uint8Array(8);
87035
+ let hex = "";
87036
+ do {
87037
+ crypto.getRandomValues(bytes);
87038
+ hex = "";
87039
+ for (const byte of bytes) {
87040
+ hex += byte.toString(16).padStart(2, "0");
87041
+ }
87042
+ } while (/^0+$/.test(hex));
87043
+ return hex;
86618
87044
  }
86619
87045
  }
86620
87046
  // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
@@ -87351,134 +87777,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
87351
87777
  };
87352
87778
  }
87353
87779
 
87354
- // ../common/src/telemetry/pii-redactor.ts
87355
- var REDACTED = "[REDACTED]";
87356
- var MAX_VALUE_LENGTH = 200;
87357
- var SENSITIVE_NAME_TOKENS = new Set([
87358
- "token",
87359
- "tokens",
87360
- "secret",
87361
- "secrets",
87362
- "password",
87363
- "passwords",
87364
- "pwd",
87365
- "credential",
87366
- "credentials",
87367
- "auth",
87368
- "authentication",
87369
- "authorization",
87370
- "authority",
87371
- "cert",
87372
- "certificate",
87373
- "certificates"
87374
- ]);
87375
- var SENSITIVE_KEY_PREFIXES = new Set([
87376
- "api",
87377
- "access",
87378
- "client",
87379
- "private",
87380
- "public",
87381
- "signing",
87382
- "encryption",
87383
- "session",
87384
- "master",
87385
- "shared",
87386
- "root",
87387
- "ssh",
87388
- "rsa",
87389
- "aes",
87390
- "hmac",
87391
- "oauth"
87392
- ]);
87393
- 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;
87394
- var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
87395
- var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
87396
- var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
87397
- var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
87398
- var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
87399
- var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
87400
- function shortHash(input) {
87401
- let hash = 2166136261;
87402
- for (let i = 0;i < input.length; i++) {
87403
- hash ^= input.charCodeAt(i);
87404
- hash = Math.imul(hash, 16777619);
87405
- }
87406
- return (hash >>> 0).toString(16).padStart(8, "0");
87407
- }
87408
- function redactUrl(raw) {
87409
- try {
87410
- const url = new URL(raw);
87411
- return `${url.protocol}//${url.host}`;
87412
- } catch {
87413
- return `url#${shortHash(raw)}`;
87414
- }
87415
- }
87416
- function redactValueDetectors(value) {
87417
- let out = value;
87418
- out = out.replace(JWT_PATTERN, () => REDACTED);
87419
- out = out.replace(URL_PATTERN, (match) => {
87420
- const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
87421
- const core2 = trailing ? match.slice(0, -trailing.length) : match;
87422
- return `${redactUrl(core2)}${trailing}`;
87423
- });
87424
- out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
87425
- out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
87426
- out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
87427
- out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
87428
- if (out.length > MAX_VALUE_LENGTH) {
87429
- out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
87430
- }
87431
- return out;
87432
- }
87433
- function nameTokens(name) {
87434
- 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);
87435
- }
87436
- function isSensitiveName(name) {
87437
- const tokens = nameTokens(name);
87438
- for (let i = 0;i < tokens.length; i++) {
87439
- const token = tokens[i];
87440
- if (SENSITIVE_NAME_TOKENS.has(token)) {
87441
- return true;
87442
- }
87443
- if (token === "key" || token === "keys") {
87444
- const prev = tokens[i - 1];
87445
- if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
87446
- return true;
87447
- }
87448
- }
87449
- }
87450
- return false;
87451
- }
87452
- function redactProperty(name, value) {
87453
- if (value === undefined || value === null) {
87454
- return;
87455
- }
87456
- if (isSensitiveName(name)) {
87457
- return REDACTED;
87458
- }
87459
- if (typeof value === "boolean" || typeof value === "number") {
87460
- return value;
87461
- }
87462
- if (typeof value !== "string") {
87463
- return "[OBJECT]";
87464
- }
87465
- return redactValueDetectors(value);
87466
- }
87467
- function redactProperties(properties) {
87468
- const out = {};
87469
- for (const [name, value] of Object.entries(properties)) {
87470
- const redacted = redactProperty(name, value);
87471
- if (redacted !== undefined) {
87472
- out[name] = redacted;
87473
- }
87474
- }
87475
- return out;
87476
- }
87477
-
87478
87780
  // ../common/src/trackedAction.ts
87479
87781
  var pollSignalSlot = singleton("PollSignal");
87480
87782
  var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
87481
87783
  var retryHintValues = new Set(RETRY_HINTS);
87784
+ var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
87482
87785
  var processContext = {
87483
87786
  exit: (code) => {
87484
87787
  process.exitCode = code;
@@ -87489,22 +87792,18 @@ var processContext = {
87489
87792
  };
87490
87793
  function extractCommandParams(cmd) {
87491
87794
  const params = {};
87795
+ const add2 = (name, value) => {
87796
+ if (name && value !== undefined) {
87797
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
87798
+ }
87799
+ };
87492
87800
  const registered = cmd.registeredArguments ?? [];
87493
87801
  const processed = cmd.processedArgs ?? [];
87494
87802
  for (let i = 0;i < registered.length; i++) {
87495
- const value = processed[i];
87496
- if (value === undefined) {
87497
- continue;
87498
- }
87499
- const name = registered[i].name();
87500
- if (name) {
87501
- params[name] = value;
87502
- }
87803
+ add2(registered[i].name(), processed[i]);
87503
87804
  }
87504
87805
  for (const [key, value] of Object.entries(cmd.opts())) {
87505
- if (value !== undefined) {
87506
- params[key] = value;
87507
- }
87806
+ add2(key, value);
87508
87807
  }
87509
87808
  return params;
87510
87809
  }
@@ -87547,11 +87846,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
87547
87846
  return this.action(async (...args) => {
87548
87847
  const telemetryName = deriveCommandPath(command);
87549
87848
  const props = typeof properties === "function" ? properties(...args) : properties;
87849
+ const requestContext = telemetry.createRequestContext();
87550
87850
  const startTime = performance.now();
87551
87851
  let errorMessage;
87552
87852
  let fallbackExitCode = EXIT_CODES.Success;
87553
87853
  clearRecordedCommandFailureTelemetry();
87554
- const [error] = await catchError(fn(...args));
87854
+ const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
87555
87855
  if (error) {
87556
87856
  errorMessage = error instanceof Error ? error.message : String(error);
87557
87857
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
@@ -87587,16 +87887,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
87587
87887
  recordedFailure,
87588
87888
  pollSignal: context.pollSignal
87589
87889
  });
87590
- telemetry.trackEvent(telemetryName, redactProperties({
87591
- ...extractCommandParams(command),
87890
+ const commandParams = extractCommandParams(command);
87891
+ if (props) {
87892
+ for (const key of Object.keys(props)) {
87893
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
87894
+ }
87895
+ }
87896
+ const baseProperties = redactProperties({
87897
+ ...commandParams,
87592
87898
  ...props,
87593
87899
  ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
87594
87900
  command: "true",
87595
- duration: String(durationMs),
87596
- success: String(success),
87597
87901
  ...terminalTelemetry,
87598
87902
  ...errorMessage ? { errorMessage } : {}
87599
- }));
87903
+ });
87904
+ telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
87600
87905
  });
87601
87906
  };
87602
87907
  // ../common/src/console-guard.ts
@@ -88299,7 +88604,7 @@ class TextApiResponse {
88299
88604
  var package_default2 = {
88300
88605
  name: "@uipath/integrationservice-sdk",
88301
88606
  license: "MIT",
88302
- version: "1.199.0-preview.91",
88607
+ version: "1.199.0-preview.97",
88303
88608
  repository: {
88304
88609
  type: "git",
88305
88610
  url: "https://github.com/UiPath/cli.git",
@@ -97848,7 +98153,7 @@ function querystringSingleKey3(key, value, keyPrefix = "") {
97848
98153
  var package_default5 = {
97849
98154
  name: "@uipath/solution-sdk",
97850
98155
  license: "MIT",
97851
- version: "1.199.0-preview.91",
98156
+ version: "1.199.0-preview.97",
97852
98157
  repository: {
97853
98158
  type: "git",
97854
98159
  url: "https://github.com/UiPath/cli.git",
@@ -100139,4 +100444,4 @@ export {
100139
100444
  metadata
100140
100445
  };
100141
100446
 
100142
- //# debugId=090898773DC3EDF664756E2164756E21
100447
+ //# debugId=FA0FE729762E2B1264756E2164756E21