@uipath/traces-tool 1.197.0-preview.64 → 1.197.0-preview.66

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 +578 -9
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -21230,7 +21230,7 @@ var init_server = __esm(() => {
21230
21230
  var package_default = {
21231
21231
  name: "@uipath/traces-tool",
21232
21232
  license: "MIT",
21233
- version: "1.197.0-preview.64",
21233
+ version: "1.197.0-preview.66",
21234
21234
  description: "Query execution traces for UiPath jobs",
21235
21235
  private: false,
21236
21236
  keywords: [
@@ -26589,9 +26589,228 @@ function getOutputFilter() {
26589
26589
  return filterSlot.get();
26590
26590
  }
26591
26591
 
26592
+ // ../common/src/telemetry/command-terminal.ts
26593
+ var recordedFailureSlot = singleton("CommandTelemetryFailure");
26594
+ var AUTH_ERROR_CODES = new Set([
26595
+ "authentication_required",
26596
+ "permission_denied"
26597
+ ]);
26598
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
26599
+ var NETWORK_HTTP_ERROR_CODES = new Set([
26600
+ "network_error",
26601
+ "rate_limited",
26602
+ "server_error",
26603
+ "not_found",
26604
+ "method_not_allowed"
26605
+ ]);
26606
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
26607
+ var NETWORK_OS_ERROR_CODES = new Set([
26608
+ "ECONNREFUSED",
26609
+ "ECONNRESET",
26610
+ "ENOTFOUND",
26611
+ "EAI_AGAIN",
26612
+ "EPIPE",
26613
+ "EHOSTUNREACH",
26614
+ "ENETUNREACH",
26615
+ "EAI_FAIL"
26616
+ ]);
26617
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
26618
+ var TLS_ERROR_CODES2 = new Set([
26619
+ "SELF_SIGNED_CERT_IN_CHAIN",
26620
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
26621
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
26622
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
26623
+ "UNABLE_TO_GET_ISSUER_CERT",
26624
+ "CERT_HAS_EXPIRED",
26625
+ "CERT_UNTRUSTED",
26626
+ "ERR_TLS_CERT_ALTNAME_INVALID"
26627
+ ]);
26628
+ var MISSING_DEPENDENCY_CODES = new Set([
26629
+ "MODULE_NOT_FOUND",
26630
+ "ERR_MODULE_NOT_FOUND"
26631
+ ]);
26632
+ var INTERNAL_ERROR_NAMES = new Set([
26633
+ "TypeError",
26634
+ "ReferenceError",
26635
+ "SyntaxError",
26636
+ "RangeError"
26637
+ ]);
26638
+ function isRecord(value) {
26639
+ return value !== null && typeof value === "object";
26640
+ }
26641
+ function stringField(value, field) {
26642
+ if (!isRecord(value)) {
26643
+ return;
26644
+ }
26645
+ const raw = value[field];
26646
+ return typeof raw === "string" ? raw : undefined;
26647
+ }
26648
+ function numberField(value, field) {
26649
+ if (!isRecord(value)) {
26650
+ return;
26651
+ }
26652
+ const raw = value[field];
26653
+ return typeof raw === "number" ? raw : undefined;
26654
+ }
26655
+ function findStringInCauseChain(error, field) {
26656
+ let current = error;
26657
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
26658
+ const value = stringField(current, field);
26659
+ if (value) {
26660
+ return value;
26661
+ }
26662
+ current = current.cause;
26663
+ }
26664
+ return;
26665
+ }
26666
+ function findCodeInCauseChain(error) {
26667
+ return findStringInCauseChain(error, "code");
26668
+ }
26669
+ function isSpawnEnoent(error) {
26670
+ const code = findCodeInCauseChain(error);
26671
+ if (code !== "ENOENT") {
26672
+ return false;
26673
+ }
26674
+ const syscall = findStringInCauseChain(error, "syscall");
26675
+ return syscall?.startsWith("spawn") === true;
26676
+ }
26677
+ function isCancellationError(error, exitCode, pollSignal) {
26678
+ if (exitCode === 130) {
26679
+ return true;
26680
+ }
26681
+ if (!isRecord(error)) {
26682
+ return false;
26683
+ }
26684
+ if (numberField(error, "exitCode") === 130) {
26685
+ return true;
26686
+ }
26687
+ const name = stringField(error, "name");
26688
+ if (name === "ExitPromptError") {
26689
+ return true;
26690
+ }
26691
+ if (name === "AbortError" && pollSignal?.aborted) {
26692
+ return true;
26693
+ }
26694
+ const message = stringField(error, "message");
26695
+ return message?.includes("SIGINT") === true;
26696
+ }
26697
+ function terminalSignalFor(input, outcome) {
26698
+ if (input.recordedFailure?.terminalSignal) {
26699
+ return input.recordedFailure.terminalSignal;
26700
+ }
26701
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
26702
+ if (explicit) {
26703
+ return explicit;
26704
+ }
26705
+ return outcome === "cancelled" ? "SIGINT" : undefined;
26706
+ }
26707
+ function classifyHttpStatus(status) {
26708
+ if (status === 401 || status === 403) {
26709
+ return "auth";
26710
+ }
26711
+ if (status === 400 || status === 409 || status === 422) {
26712
+ return "validation";
26713
+ }
26714
+ if (status === 408) {
26715
+ return "timeout";
26716
+ }
26717
+ return "network_http";
26718
+ }
26719
+ function classifyFromResult(result) {
26720
+ switch (result) {
26721
+ case "AuthenticationError":
26722
+ return "auth";
26723
+ case "ValidationError":
26724
+ return "validation";
26725
+ case "TimeoutError":
26726
+ return "timeout";
26727
+ default:
26728
+ return;
26729
+ }
26730
+ }
26731
+ function classifyFromErrorCode(errorCode) {
26732
+ if (!errorCode) {
26733
+ return;
26734
+ }
26735
+ if (AUTH_ERROR_CODES.has(errorCode)) {
26736
+ return "auth";
26737
+ }
26738
+ if (VALIDATION_ERROR_CODES.has(errorCode)) {
26739
+ return "validation";
26740
+ }
26741
+ if (TIMEOUT_ERROR_CODES.has(errorCode)) {
26742
+ return "timeout";
26743
+ }
26744
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
26745
+ return "network_http";
26746
+ }
26747
+ return;
26748
+ }
26749
+ function classifyFromError(error) {
26750
+ const code = findCodeInCauseChain(error);
26751
+ if (code) {
26752
+ if (code.startsWith("commander.")) {
26753
+ return "validation";
26754
+ }
26755
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
26756
+ return "network_http";
26757
+ }
26758
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
26759
+ return "timeout";
26760
+ }
26761
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
26762
+ return "missing_dependency";
26763
+ }
26764
+ }
26765
+ const message = stringField(error, "message");
26766
+ if (message?.includes("fetch failed") === true) {
26767
+ return "network_http";
26768
+ }
26769
+ const name = stringField(error, "name");
26770
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
26771
+ return "internal";
26772
+ }
26773
+ return;
26774
+ }
26775
+ function classifyError2(input) {
26776
+ const recorded = input.recordedFailure;
26777
+ if (recorded?.errorClass) {
26778
+ return recorded.errorClass;
26779
+ }
26780
+ const status = recorded?.context?.httpStatus;
26781
+ if (status !== undefined) {
26782
+ return classifyHttpStatus(status);
26783
+ }
26784
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
26785
+ }
26786
+ function recordCommandFailureTelemetry(failure) {
26787
+ recordedFailureSlot.set(failure);
26788
+ }
26789
+ function clearRecordedCommandFailureTelemetry() {
26790
+ recordedFailureSlot.clear();
26791
+ }
26792
+ function takeRecordedCommandFailureTelemetry() {
26793
+ const failure = recordedFailureSlot.get();
26794
+ recordedFailureSlot.clear();
26795
+ return failure;
26796
+ }
26797
+ function buildCommandTerminalTelemetryProperties(input) {
26798
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
26799
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
26800
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
26801
+ const terminalSignal = terminalSignalFor(input, outcome);
26802
+ return {
26803
+ exit_code: input.exitCode,
26804
+ terminal_outcome: outcome,
26805
+ ...errorClass ? { error_class: errorClass } : {},
26806
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
26807
+ };
26808
+ }
26809
+
26592
26810
  // ../common/src/telemetry/telemetry-events.ts
26593
26811
  var CommonTelemetryEvents = {
26594
- Error: "uip.error"
26812
+ Error: "uip.error",
26813
+ ShipSucceeded: "ship_succeeded"
26595
26814
  };
26596
26815
 
26597
26816
  // ../common/src/registry.ts
@@ -26658,6 +26877,136 @@ function formatMessage(category, name, properties) {
26658
26877
  }
26659
26878
  return message;
26660
26879
  }
26880
+ // ../common/src/telemetry/detect-agent.ts
26881
+ var KNOWN_AGENTS = [
26882
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
26883
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
26884
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
26885
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
26886
+ { envVar: "CODEX_SANDBOX", id: "codex" },
26887
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
26888
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
26889
+ ];
26890
+ function detectAgentFromEnv(env) {
26891
+ for (const agent of KNOWN_AGENTS) {
26892
+ const envValue = env[agent.envVar];
26893
+ if (agent.value !== undefined) {
26894
+ if (envValue === agent.value)
26895
+ return agent.id;
26896
+ } else {
26897
+ if (envValue)
26898
+ return agent.id;
26899
+ }
26900
+ }
26901
+ const agentEnv = env.AGENT;
26902
+ if (agentEnv) {
26903
+ if (agentEnv === "1" || agentEnv === "true")
26904
+ return "unknown";
26905
+ if (agentEnv.length <= 32)
26906
+ return agentEnv.toLowerCase();
26907
+ }
26908
+ return;
26909
+ }
26910
+ // ../common/src/telemetry/environment-info.ts
26911
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
26912
+ // ../common/src/telemetry/execution-context.ts
26913
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
26914
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
26915
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
26916
+ var CI_SIGNATURES = [
26917
+ {
26918
+ provider: "github_actions",
26919
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
26920
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
26921
+ },
26922
+ {
26923
+ provider: "azure_devops",
26924
+ matches: (env) => isTruthy(env.TF_BUILD),
26925
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
26926
+ },
26927
+ {
26928
+ provider: "gitlab",
26929
+ matches: (env) => isTruthy(env.GITLAB_CI),
26930
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
26931
+ },
26932
+ {
26933
+ provider: "circleci",
26934
+ matches: (env) => isTruthy(env.CIRCLECI),
26935
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
26936
+ },
26937
+ {
26938
+ provider: "jenkins",
26939
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
26940
+ },
26941
+ {
26942
+ provider: "teamcity",
26943
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
26944
+ },
26945
+ {
26946
+ provider: "buildkite",
26947
+ matches: (env) => isTruthy(env.BUILDKITE),
26948
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
26949
+ },
26950
+ {
26951
+ provider: "bitbucket",
26952
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
26953
+ },
26954
+ {
26955
+ provider: "travis",
26956
+ matches: (env) => isTruthy(env.TRAVIS)
26957
+ },
26958
+ {
26959
+ provider: "appveyor",
26960
+ matches: (env) => isTruthy(env.APPVEYOR)
26961
+ },
26962
+ {
26963
+ provider: "generic",
26964
+ matches: (env) => isTruthy(env.CI)
26965
+ }
26966
+ ];
26967
+ function currentEnv() {
26968
+ return typeof process === "undefined" ? {} : process.env;
26969
+ }
26970
+ function currentTtyState() {
26971
+ if (typeof process === "undefined")
26972
+ return false;
26973
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
26974
+ }
26975
+ function detectCi(env) {
26976
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
26977
+ if (!signature)
26978
+ return;
26979
+ return {
26980
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
26981
+ ciProvider: signature.provider
26982
+ };
26983
+ }
26984
+ function detectExecutionContext(options = {}) {
26985
+ const env = options.env ?? currentEnv();
26986
+ const ci = detectCi(env);
26987
+ if (ci)
26988
+ return ci;
26989
+ const agent = options.agent ?? detectAgentFromEnv(env);
26990
+ if (agent) {
26991
+ return { executionContext: "agent" };
26992
+ }
26993
+ const authSignal = options.authSignal ?? authSignalSlot.get();
26994
+ if (authSignal === "service_account") {
26995
+ return { executionContext: "service_account" };
26996
+ }
26997
+ const isTty = options.isTty ?? currentTtyState();
26998
+ if (isTty) {
26999
+ return { executionContext: "manual" };
27000
+ }
27001
+ return { executionContext: "unknown" };
27002
+ }
27003
+ function getExecutionContextTelemetryProperties() {
27004
+ const detected = detectExecutionContext();
27005
+ return {
27006
+ execution_context: detected.executionContext,
27007
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
27008
+ };
27009
+ }
26661
27010
  // ../common/src/telemetry/node-context-storage.ts
26662
27011
  import { AsyncLocalStorage } from "node:async_hooks";
26663
27012
 
@@ -26670,6 +27019,26 @@ class NodeContextStorage {
26670
27019
  return this.storage.getStore();
26671
27020
  }
26672
27021
  }
27022
+ // ../common/src/telemetry/session-id.ts
27023
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
27024
+ var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
27025
+ var telemetrySessionIdSlot = singleton("TelemetrySessionId");
27026
+ function getProcessEnv() {
27027
+ return globalThis.process?.env;
27028
+ }
27029
+ function normalizeSessionId(value) {
27030
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
27031
+ return;
27032
+ }
27033
+ const trimmed = String(value).trim();
27034
+ return trimmed || undefined;
27035
+ }
27036
+ function getConfiguredTelemetrySessionId() {
27037
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
27038
+ }
27039
+ function resolveTelemetrySessionId(existingSessionId) {
27040
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
27041
+ }
26673
27042
  // ../common/src/telemetry/global-telemetry-properties.ts
26674
27043
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
26675
27044
  function getGlobalTelemetryProperties() {
@@ -26754,12 +27123,22 @@ class TelemetryService {
26754
27123
  return this.contextStorage.getContext();
26755
27124
  }
26756
27125
  enrichPropertiesWithContext(properties, context) {
26757
- return {
26758
- ...getGlobalTelemetryProperties(),
27126
+ const globalProperties = getGlobalTelemetryProperties();
27127
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
27128
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
27129
+ const enriched = {
27130
+ ...getExecutionContextTelemetryProperties(),
27131
+ ...globalProperties,
26759
27132
  ...this.defaultProperties,
26760
27133
  ...properties,
26761
27134
  ...context
26762
27135
  };
27136
+ if (sessionId === undefined) {
27137
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
27138
+ } else {
27139
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
27140
+ }
27141
+ return enriched;
26763
27142
  }
26764
27143
  generateId() {
26765
27144
  return crypto.randomUUID().replaceAll("-", "");
@@ -27229,8 +27608,24 @@ var OutputFormatter;
27229
27608
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
27230
27609
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
27231
27610
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
27232
- const { SuppressTelemetry, ...envelope } = data;
27233
- if (!SuppressTelemetry) {
27611
+ recordCommandFailureTelemetry({
27612
+ result: data.Result,
27613
+ errorCode: data.ErrorCode,
27614
+ retry: data.Retry,
27615
+ message: data.Message,
27616
+ context: data.Context,
27617
+ exitCode: process.exitCode,
27618
+ errorClass: data.TelemetryErrorClass,
27619
+ terminalOutcome: data.TelemetryTerminalOutcome,
27620
+ terminalSignal: data.TelemetryTerminalSignal
27621
+ });
27622
+ const suppressTelemetry = data.SuppressTelemetry === true;
27623
+ const envelope = { ...data };
27624
+ delete envelope.SuppressTelemetry;
27625
+ delete envelope.TelemetryErrorClass;
27626
+ delete envelope.TelemetryTerminalOutcome;
27627
+ delete envelope.TelemetryTerminalSignal;
27628
+ if (!suppressTelemetry) {
27234
27629
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
27235
27630
  result: data.Result,
27236
27631
  errorCode: data.ErrorCode,
@@ -27293,6 +27688,158 @@ var OutputFormatter;
27293
27688
  OutputFormatter.formatToString = formatToString;
27294
27689
  })(OutputFormatter ||= {});
27295
27690
 
27691
+ // ../common/src/telemetry/command-attribution.ts
27692
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
27693
+ var MAX_SKILL_NAME_LENGTH = 80;
27694
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
27695
+ function productMode(productArea, mode) {
27696
+ return { product_area: productArea, mode };
27697
+ }
27698
+ function attributionRecord(groups) {
27699
+ const record = {};
27700
+ for (const [productArea, mode, names] of groups) {
27701
+ const attribution = productMode(productArea, mode);
27702
+ for (const name of names) {
27703
+ record[name] = attribution;
27704
+ }
27705
+ }
27706
+ return record;
27707
+ }
27708
+ function commandAttribution(groups) {
27709
+ const entries = [];
27710
+ for (const [productArea, mode, prefixes] of groups) {
27711
+ const attribution = productMode(productArea, mode);
27712
+ for (const prefix of prefixes) {
27713
+ entries.push({ prefix, attribution });
27714
+ }
27715
+ }
27716
+ return entries;
27717
+ }
27718
+ var SKILL_ATTRIBUTION = attributionRecord([
27719
+ ["admin", "operate", ["uipath-admin"]],
27720
+ ["agents", "build", ["uipath-agents"]],
27721
+ ["api-workflow", "build", ["uipath-api-workflow"]],
27722
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
27723
+ ["coded-apps", "build", ["uipath-coded-apps"]],
27724
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
27725
+ ["cli", "troubleshoot", ["uipath-feedback"]],
27726
+ ["governance", "operate", ["uipath-governance"]],
27727
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
27728
+ ["document-understanding", "build", ["uipath-ixp"]],
27729
+ [
27730
+ "maestro",
27731
+ "build",
27732
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
27733
+ ],
27734
+ ["agenthub", "build", ["uipath-mcp-servers"]],
27735
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
27736
+ ["platform", "operate", ["uipath-platform"]],
27737
+ ["quality", "troubleshoot", ["uipath-review"]],
27738
+ ["rpa", "build", ["uipath-rpa"]],
27739
+ ["cli", "operate", ["uipath-skill-catalog"]],
27740
+ ["action-center", "operate", ["uipath-tasks"]],
27741
+ ["test-manager", "operate", ["uipath-test"]],
27742
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
27743
+ ]);
27744
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
27745
+ var COMMAND_ATTRIBUTION = commandAttribution([
27746
+ ["cli", "troubleshoot", ["uip.feedback"]],
27747
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
27748
+ ["context-grounding", "build", ["uip.context-grounding"]],
27749
+ ["api-workflow", "build", ["uip.api-workflow"]],
27750
+ ["rpa", "build", ["uip.rpa-legacy"]],
27751
+ ["conversational", "operate", ["uip.conversational"]],
27752
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
27753
+ ["agenthub", "build", ["uip.agenthub"]],
27754
+ ["coded-apps", "build", ["uip.codedapp"]],
27755
+ ["functions", "build", ["uip.functions"]],
27756
+ ["solution", "build", ["uip.solution"]],
27757
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
27758
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
27759
+ ["platform", "operate", ["uip.platform"]],
27760
+ ["admin", "operate", ["uip.admin"]],
27761
+ ["automation-ops", "operate", ["uip.aops"]],
27762
+ ["documentation", "troubleshoot", ["uip.docsai"]],
27763
+ ["governance", "operate", ["uip.gov"]],
27764
+ ["insights", "operate", ["uip.insights"]],
27765
+ ["document-understanding", "build", ["uip.ixp"]],
27766
+ ["process-mining", "operate", ["uip.pm"]],
27767
+ ["action-center", "operate", ["uip.tasks"]],
27768
+ ["test-manager", "operate", ["uip.tm"]],
27769
+ ["vertical-solutions", "build", ["uip.vss"]],
27770
+ ["data-fabric", "operate", ["uip.df"]],
27771
+ ["integration-service", "build", ["uip.is"]],
27772
+ ["orchestrator", "operate", ["uip.or"]],
27773
+ [
27774
+ "cli",
27775
+ "operate",
27776
+ [
27777
+ "uip.login",
27778
+ "uip.logout",
27779
+ "uip.user",
27780
+ "uip.config",
27781
+ "uip.tools",
27782
+ "uip.skills",
27783
+ "uip.completion",
27784
+ "uip.update",
27785
+ "uip.mcp",
27786
+ "uip.track"
27787
+ ]
27788
+ ]
27789
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
27790
+ function normalizeCommandPath(value) {
27791
+ if (typeof value !== "string") {
27792
+ return;
27793
+ }
27794
+ const trimmed = value.trim().toLowerCase();
27795
+ if (!trimmed) {
27796
+ return;
27797
+ }
27798
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
27799
+ if (tokens.length === 0) {
27800
+ return;
27801
+ }
27802
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
27803
+ return commandTokens.join(".");
27804
+ }
27805
+ function getCommandProductModeAttribution(commandPath) {
27806
+ const normalized = normalizeCommandPath(commandPath);
27807
+ if (!normalized) {
27808
+ return;
27809
+ }
27810
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
27811
+ }
27812
+ function normalizeSkillNameWithOptions(value, options) {
27813
+ if (typeof value !== "string") {
27814
+ return;
27815
+ }
27816
+ const normalized = value.trim().toLowerCase();
27817
+ if (!normalized) {
27818
+ return;
27819
+ }
27820
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
27821
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
27822
+ return;
27823
+ }
27824
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
27825
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
27826
+ return;
27827
+ }
27828
+ return skillName;
27829
+ }
27830
+ function normalizeSkillName(value) {
27831
+ return normalizeSkillNameWithOptions(value, {
27832
+ allowLegacyNamespace: false
27833
+ });
27834
+ }
27835
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
27836
+ const skillName = normalizeSkillName(skillSource);
27837
+ return {
27838
+ ...skillName ? { skill_name: skillName } : {},
27839
+ ...getCommandProductModeAttribution(commandPath)
27840
+ };
27841
+ }
27842
+
27296
27843
  // ../common/src/telemetry/pii-redactor.ts
27297
27844
  var REDACTED = "[REDACTED]";
27298
27845
  var MAX_VALUE_LENGTH = 200;
@@ -27478,6 +28025,12 @@ function commandHelpHint(commandPath) {
27478
28025
  const command = commandPath.replace(/\./g, " ");
27479
28026
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
27480
28027
  }
28028
+ function isPromptCancellation(error) {
28029
+ return error instanceof Error && error.name === "ExitPromptError";
28030
+ }
28031
+ function exitCodeFromProcess(fallback) {
28032
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
28033
+ }
27481
28034
  Command.prototype.trackedAction = function(context, fn, properties) {
27482
28035
  const command = this;
27483
28036
  return this.action(async (...args) => {
@@ -27485,6 +28038,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27485
28038
  const props = typeof properties === "function" ? properties(...args) : properties;
27486
28039
  const startTime = performance.now();
27487
28040
  let errorMessage;
28041
+ let fallbackExitCode = EXIT_CODES.Success;
28042
+ clearRecordedCommandFailureTelemetry();
27488
28043
  const [error] = await catchError(fn(...args));
27489
28044
  if (error) {
27490
28045
  errorMessage = error instanceof Error ? error.message : String(error);
@@ -27499,6 +28054,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27499
28054
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
27500
28055
  const typedContext = typed.context ?? typed.Context;
27501
28056
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
28057
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
28058
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
27502
28059
  OutputFormatter.error({
27503
28060
  Result: finalResult,
27504
28061
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -27507,16 +28064,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27507
28064
  ...customRetry ? { Retry: customRetry } : {},
27508
28065
  ...customContext ? { Context: customContext } : {}
27509
28066
  });
27510
- context.exit(EXIT_CODES[finalResult]);
28067
+ context.exit(fallbackExitCode);
27511
28068
  }
27512
28069
  const durationMs = performance.now() - startTime;
27513
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
28070
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
28071
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
28072
+ const success = !error && exitCode === 0;
28073
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
28074
+ error,
28075
+ exitCode,
28076
+ recordedFailure,
28077
+ pollSignal: context.pollSignal
28078
+ });
27514
28079
  telemetry.trackEvent(telemetryName, redactProperties({
27515
28080
  ...extractCommandParams(command),
27516
28081
  ...props,
28082
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
27517
28083
  command: "true",
27518
28084
  duration: String(durationMs),
27519
28085
  success: String(success),
28086
+ ...terminalTelemetry,
27520
28087
  ...errorMessage ? { errorMessage } : {}
27521
28088
  }));
27522
28089
  });
@@ -27710,6 +28277,8 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
27710
28277
  function installSdkUserAgentHeader(BaseApiClass, userAgent) {
27711
28278
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
27712
28279
  }
28280
+ // ../common/src/telemetry/ship-succeeded.ts
28281
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
27713
28282
  // ../common/src/tool-provider.ts
27714
28283
  var factorySlot = singleton("PackagerFactoryProvider");
27715
28284
  // ../auth/src/config.ts
@@ -33876,4 +34445,4 @@ export {
33876
34445
  metadata
33877
34446
  };
33878
34447
 
33879
- //# debugId=6D913F6DAE169D6A64756E2164756E21
34448
+ //# debugId=D6F86749862DC06264756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/traces-tool",
3
3
  "license": "MIT",
4
- "version": "1.197.0-preview.64",
4
+ "version": "1.197.0-preview.66",
5
5
  "description": "Query execution traces for UiPath jobs",
6
6
  "private": false,
7
7
  "keywords": [
@@ -21,5 +21,5 @@
21
21
  "publishConfig": {
22
22
  "registry": "https://registry.npmjs.org/"
23
23
  },
24
- "gitHead": "3977b977945bf519336258da69fd271433eaaef4"
24
+ "gitHead": "386b0837882b19062bf744c74949cdf9c5e48dea"
25
25
  }