@uipath/resourcecatalog-tool 1.197.0-preview.65 → 1.197.0-preview.67

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 (3) hide show
  1. package/dist/index.js +578 -9
  2. package/dist/tool.js +578 -9
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -21247,7 +21247,7 @@ var {
21247
21247
  var package_default = {
21248
21248
  name: "@uipath/resourcecatalog-tool",
21249
21249
  license: "MIT",
21250
- version: "1.197.0-preview.65",
21250
+ version: "1.197.0-preview.67",
21251
21251
  description: "CLI plugin for the UiPath Resource Catalog Service.",
21252
21252
  private: false,
21253
21253
  repository: {
@@ -26597,9 +26597,228 @@ function getOutputFilter() {
26597
26597
  return filterSlot.get();
26598
26598
  }
26599
26599
 
26600
+ // ../../common/src/telemetry/command-terminal.ts
26601
+ var recordedFailureSlot = singleton("CommandTelemetryFailure");
26602
+ var AUTH_ERROR_CODES = new Set([
26603
+ "authentication_required",
26604
+ "permission_denied"
26605
+ ]);
26606
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
26607
+ var NETWORK_HTTP_ERROR_CODES = new Set([
26608
+ "network_error",
26609
+ "rate_limited",
26610
+ "server_error",
26611
+ "not_found",
26612
+ "method_not_allowed"
26613
+ ]);
26614
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
26615
+ var NETWORK_OS_ERROR_CODES = new Set([
26616
+ "ECONNREFUSED",
26617
+ "ECONNRESET",
26618
+ "ENOTFOUND",
26619
+ "EAI_AGAIN",
26620
+ "EPIPE",
26621
+ "EHOSTUNREACH",
26622
+ "ENETUNREACH",
26623
+ "EAI_FAIL"
26624
+ ]);
26625
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
26626
+ var TLS_ERROR_CODES2 = new Set([
26627
+ "SELF_SIGNED_CERT_IN_CHAIN",
26628
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
26629
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
26630
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
26631
+ "UNABLE_TO_GET_ISSUER_CERT",
26632
+ "CERT_HAS_EXPIRED",
26633
+ "CERT_UNTRUSTED",
26634
+ "ERR_TLS_CERT_ALTNAME_INVALID"
26635
+ ]);
26636
+ var MISSING_DEPENDENCY_CODES = new Set([
26637
+ "MODULE_NOT_FOUND",
26638
+ "ERR_MODULE_NOT_FOUND"
26639
+ ]);
26640
+ var INTERNAL_ERROR_NAMES = new Set([
26641
+ "TypeError",
26642
+ "ReferenceError",
26643
+ "SyntaxError",
26644
+ "RangeError"
26645
+ ]);
26646
+ function isRecord(value) {
26647
+ return value !== null && typeof value === "object";
26648
+ }
26649
+ function stringField(value, field) {
26650
+ if (!isRecord(value)) {
26651
+ return;
26652
+ }
26653
+ const raw = value[field];
26654
+ return typeof raw === "string" ? raw : undefined;
26655
+ }
26656
+ function numberField(value, field) {
26657
+ if (!isRecord(value)) {
26658
+ return;
26659
+ }
26660
+ const raw = value[field];
26661
+ return typeof raw === "number" ? raw : undefined;
26662
+ }
26663
+ function findStringInCauseChain(error, field) {
26664
+ let current = error;
26665
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
26666
+ const value = stringField(current, field);
26667
+ if (value) {
26668
+ return value;
26669
+ }
26670
+ current = current.cause;
26671
+ }
26672
+ return;
26673
+ }
26674
+ function findCodeInCauseChain(error) {
26675
+ return findStringInCauseChain(error, "code");
26676
+ }
26677
+ function isSpawnEnoent(error) {
26678
+ const code = findCodeInCauseChain(error);
26679
+ if (code !== "ENOENT") {
26680
+ return false;
26681
+ }
26682
+ const syscall = findStringInCauseChain(error, "syscall");
26683
+ return syscall?.startsWith("spawn") === true;
26684
+ }
26685
+ function isCancellationError(error, exitCode, pollSignal) {
26686
+ if (exitCode === 130) {
26687
+ return true;
26688
+ }
26689
+ if (!isRecord(error)) {
26690
+ return false;
26691
+ }
26692
+ if (numberField(error, "exitCode") === 130) {
26693
+ return true;
26694
+ }
26695
+ const name = stringField(error, "name");
26696
+ if (name === "ExitPromptError") {
26697
+ return true;
26698
+ }
26699
+ if (name === "AbortError" && pollSignal?.aborted) {
26700
+ return true;
26701
+ }
26702
+ const message = stringField(error, "message");
26703
+ return message?.includes("SIGINT") === true;
26704
+ }
26705
+ function terminalSignalFor(input, outcome) {
26706
+ if (input.recordedFailure?.terminalSignal) {
26707
+ return input.recordedFailure.terminalSignal;
26708
+ }
26709
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
26710
+ if (explicit) {
26711
+ return explicit;
26712
+ }
26713
+ return outcome === "cancelled" ? "SIGINT" : undefined;
26714
+ }
26715
+ function classifyHttpStatus(status) {
26716
+ if (status === 401 || status === 403) {
26717
+ return "auth";
26718
+ }
26719
+ if (status === 400 || status === 409 || status === 422) {
26720
+ return "validation";
26721
+ }
26722
+ if (status === 408) {
26723
+ return "timeout";
26724
+ }
26725
+ return "network_http";
26726
+ }
26727
+ function classifyFromResult(result) {
26728
+ switch (result) {
26729
+ case "AuthenticationError":
26730
+ return "auth";
26731
+ case "ValidationError":
26732
+ return "validation";
26733
+ case "TimeoutError":
26734
+ return "timeout";
26735
+ default:
26736
+ return;
26737
+ }
26738
+ }
26739
+ function classifyFromErrorCode(errorCode) {
26740
+ if (!errorCode) {
26741
+ return;
26742
+ }
26743
+ if (AUTH_ERROR_CODES.has(errorCode)) {
26744
+ return "auth";
26745
+ }
26746
+ if (VALIDATION_ERROR_CODES.has(errorCode)) {
26747
+ return "validation";
26748
+ }
26749
+ if (TIMEOUT_ERROR_CODES.has(errorCode)) {
26750
+ return "timeout";
26751
+ }
26752
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
26753
+ return "network_http";
26754
+ }
26755
+ return;
26756
+ }
26757
+ function classifyFromError(error) {
26758
+ const code = findCodeInCauseChain(error);
26759
+ if (code) {
26760
+ if (code.startsWith("commander.")) {
26761
+ return "validation";
26762
+ }
26763
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
26764
+ return "network_http";
26765
+ }
26766
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
26767
+ return "timeout";
26768
+ }
26769
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
26770
+ return "missing_dependency";
26771
+ }
26772
+ }
26773
+ const message = stringField(error, "message");
26774
+ if (message?.includes("fetch failed") === true) {
26775
+ return "network_http";
26776
+ }
26777
+ const name = stringField(error, "name");
26778
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
26779
+ return "internal";
26780
+ }
26781
+ return;
26782
+ }
26783
+ function classifyError2(input) {
26784
+ const recorded = input.recordedFailure;
26785
+ if (recorded?.errorClass) {
26786
+ return recorded.errorClass;
26787
+ }
26788
+ const status = recorded?.context?.httpStatus;
26789
+ if (status !== undefined) {
26790
+ return classifyHttpStatus(status);
26791
+ }
26792
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
26793
+ }
26794
+ function recordCommandFailureTelemetry(failure) {
26795
+ recordedFailureSlot.set(failure);
26796
+ }
26797
+ function clearRecordedCommandFailureTelemetry() {
26798
+ recordedFailureSlot.clear();
26799
+ }
26800
+ function takeRecordedCommandFailureTelemetry() {
26801
+ const failure = recordedFailureSlot.get();
26802
+ recordedFailureSlot.clear();
26803
+ return failure;
26804
+ }
26805
+ function buildCommandTerminalTelemetryProperties(input) {
26806
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
26807
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
26808
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
26809
+ const terminalSignal = terminalSignalFor(input, outcome);
26810
+ return {
26811
+ exit_code: input.exitCode,
26812
+ terminal_outcome: outcome,
26813
+ ...errorClass ? { error_class: errorClass } : {},
26814
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
26815
+ };
26816
+ }
26817
+
26600
26818
  // ../../common/src/telemetry/telemetry-events.ts
26601
26819
  var CommonTelemetryEvents = {
26602
- Error: "uip.error"
26820
+ Error: "uip.error",
26821
+ ShipSucceeded: "ship_succeeded"
26603
26822
  };
26604
26823
 
26605
26824
  // ../../common/src/registry.ts
@@ -26666,6 +26885,136 @@ function formatMessage(category, name, properties) {
26666
26885
  }
26667
26886
  return message;
26668
26887
  }
26888
+ // ../../common/src/telemetry/detect-agent.ts
26889
+ var KNOWN_AGENTS = [
26890
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
26891
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
26892
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
26893
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
26894
+ { envVar: "CODEX_SANDBOX", id: "codex" },
26895
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
26896
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
26897
+ ];
26898
+ function detectAgentFromEnv(env) {
26899
+ for (const agent of KNOWN_AGENTS) {
26900
+ const envValue = env[agent.envVar];
26901
+ if (agent.value !== undefined) {
26902
+ if (envValue === agent.value)
26903
+ return agent.id;
26904
+ } else {
26905
+ if (envValue)
26906
+ return agent.id;
26907
+ }
26908
+ }
26909
+ const agentEnv = env.AGENT;
26910
+ if (agentEnv) {
26911
+ if (agentEnv === "1" || agentEnv === "true")
26912
+ return "unknown";
26913
+ if (agentEnv.length <= 32)
26914
+ return agentEnv.toLowerCase();
26915
+ }
26916
+ return;
26917
+ }
26918
+ // ../../common/src/telemetry/environment-info.ts
26919
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
26920
+ // ../../common/src/telemetry/execution-context.ts
26921
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
26922
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
26923
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
26924
+ var CI_SIGNATURES = [
26925
+ {
26926
+ provider: "github_actions",
26927
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
26928
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
26929
+ },
26930
+ {
26931
+ provider: "azure_devops",
26932
+ matches: (env) => isTruthy(env.TF_BUILD),
26933
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
26934
+ },
26935
+ {
26936
+ provider: "gitlab",
26937
+ matches: (env) => isTruthy(env.GITLAB_CI),
26938
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
26939
+ },
26940
+ {
26941
+ provider: "circleci",
26942
+ matches: (env) => isTruthy(env.CIRCLECI),
26943
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
26944
+ },
26945
+ {
26946
+ provider: "jenkins",
26947
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
26948
+ },
26949
+ {
26950
+ provider: "teamcity",
26951
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
26952
+ },
26953
+ {
26954
+ provider: "buildkite",
26955
+ matches: (env) => isTruthy(env.BUILDKITE),
26956
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
26957
+ },
26958
+ {
26959
+ provider: "bitbucket",
26960
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
26961
+ },
26962
+ {
26963
+ provider: "travis",
26964
+ matches: (env) => isTruthy(env.TRAVIS)
26965
+ },
26966
+ {
26967
+ provider: "appveyor",
26968
+ matches: (env) => isTruthy(env.APPVEYOR)
26969
+ },
26970
+ {
26971
+ provider: "generic",
26972
+ matches: (env) => isTruthy(env.CI)
26973
+ }
26974
+ ];
26975
+ function currentEnv() {
26976
+ return typeof process === "undefined" ? {} : process.env;
26977
+ }
26978
+ function currentTtyState() {
26979
+ if (typeof process === "undefined")
26980
+ return false;
26981
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
26982
+ }
26983
+ function detectCi(env) {
26984
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
26985
+ if (!signature)
26986
+ return;
26987
+ return {
26988
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
26989
+ ciProvider: signature.provider
26990
+ };
26991
+ }
26992
+ function detectExecutionContext(options = {}) {
26993
+ const env = options.env ?? currentEnv();
26994
+ const ci = detectCi(env);
26995
+ if (ci)
26996
+ return ci;
26997
+ const agent = options.agent ?? detectAgentFromEnv(env);
26998
+ if (agent) {
26999
+ return { executionContext: "agent" };
27000
+ }
27001
+ const authSignal = options.authSignal ?? authSignalSlot.get();
27002
+ if (authSignal === "service_account") {
27003
+ return { executionContext: "service_account" };
27004
+ }
27005
+ const isTty = options.isTty ?? currentTtyState();
27006
+ if (isTty) {
27007
+ return { executionContext: "manual" };
27008
+ }
27009
+ return { executionContext: "unknown" };
27010
+ }
27011
+ function getExecutionContextTelemetryProperties() {
27012
+ const detected = detectExecutionContext();
27013
+ return {
27014
+ execution_context: detected.executionContext,
27015
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
27016
+ };
27017
+ }
26669
27018
  // ../../common/src/telemetry/node-context-storage.ts
26670
27019
  import { AsyncLocalStorage } from "node:async_hooks";
26671
27020
 
@@ -26678,6 +27027,26 @@ class NodeContextStorage {
26678
27027
  return this.storage.getStore();
26679
27028
  }
26680
27029
  }
27030
+ // ../../common/src/telemetry/session-id.ts
27031
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
27032
+ var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
27033
+ var telemetrySessionIdSlot = singleton("TelemetrySessionId");
27034
+ function getProcessEnv() {
27035
+ return globalThis.process?.env;
27036
+ }
27037
+ function normalizeSessionId(value) {
27038
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
27039
+ return;
27040
+ }
27041
+ const trimmed = String(value).trim();
27042
+ return trimmed || undefined;
27043
+ }
27044
+ function getConfiguredTelemetrySessionId() {
27045
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
27046
+ }
27047
+ function resolveTelemetrySessionId(existingSessionId) {
27048
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
27049
+ }
26681
27050
  // ../../common/src/telemetry/global-telemetry-properties.ts
26682
27051
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
26683
27052
  function getGlobalTelemetryProperties() {
@@ -26762,12 +27131,22 @@ class TelemetryService {
26762
27131
  return this.contextStorage.getContext();
26763
27132
  }
26764
27133
  enrichPropertiesWithContext(properties, context) {
26765
- return {
26766
- ...getGlobalTelemetryProperties(),
27134
+ const globalProperties = getGlobalTelemetryProperties();
27135
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
27136
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
27137
+ const enriched = {
27138
+ ...getExecutionContextTelemetryProperties(),
27139
+ ...globalProperties,
26767
27140
  ...this.defaultProperties,
26768
27141
  ...properties,
26769
27142
  ...context
26770
27143
  };
27144
+ if (sessionId === undefined) {
27145
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
27146
+ } else {
27147
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
27148
+ }
27149
+ return enriched;
26771
27150
  }
26772
27151
  generateId() {
26773
27152
  return crypto.randomUUID().replaceAll("-", "");
@@ -27237,8 +27616,24 @@ var OutputFormatter;
27237
27616
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
27238
27617
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
27239
27618
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
27240
- const { SuppressTelemetry, ...envelope } = data;
27241
- if (!SuppressTelemetry) {
27619
+ recordCommandFailureTelemetry({
27620
+ result: data.Result,
27621
+ errorCode: data.ErrorCode,
27622
+ retry: data.Retry,
27623
+ message: data.Message,
27624
+ context: data.Context,
27625
+ exitCode: process.exitCode,
27626
+ errorClass: data.TelemetryErrorClass,
27627
+ terminalOutcome: data.TelemetryTerminalOutcome,
27628
+ terminalSignal: data.TelemetryTerminalSignal
27629
+ });
27630
+ const suppressTelemetry = data.SuppressTelemetry === true;
27631
+ const envelope = { ...data };
27632
+ delete envelope.SuppressTelemetry;
27633
+ delete envelope.TelemetryErrorClass;
27634
+ delete envelope.TelemetryTerminalOutcome;
27635
+ delete envelope.TelemetryTerminalSignal;
27636
+ if (!suppressTelemetry) {
27242
27637
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
27243
27638
  result: data.Result,
27244
27639
  errorCode: data.ErrorCode,
@@ -27301,6 +27696,158 @@ var OutputFormatter;
27301
27696
  OutputFormatter.formatToString = formatToString;
27302
27697
  })(OutputFormatter ||= {});
27303
27698
 
27699
+ // ../../common/src/telemetry/command-attribution.ts
27700
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
27701
+ var MAX_SKILL_NAME_LENGTH = 80;
27702
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
27703
+ function productMode(productArea, mode) {
27704
+ return { product_area: productArea, mode };
27705
+ }
27706
+ function attributionRecord(groups) {
27707
+ const record = {};
27708
+ for (const [productArea, mode, names] of groups) {
27709
+ const attribution = productMode(productArea, mode);
27710
+ for (const name of names) {
27711
+ record[name] = attribution;
27712
+ }
27713
+ }
27714
+ return record;
27715
+ }
27716
+ function commandAttribution(groups) {
27717
+ const entries = [];
27718
+ for (const [productArea, mode, prefixes] of groups) {
27719
+ const attribution = productMode(productArea, mode);
27720
+ for (const prefix of prefixes) {
27721
+ entries.push({ prefix, attribution });
27722
+ }
27723
+ }
27724
+ return entries;
27725
+ }
27726
+ var SKILL_ATTRIBUTION = attributionRecord([
27727
+ ["admin", "operate", ["uipath-admin"]],
27728
+ ["agents", "build", ["uipath-agents"]],
27729
+ ["api-workflow", "build", ["uipath-api-workflow"]],
27730
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
27731
+ ["coded-apps", "build", ["uipath-coded-apps"]],
27732
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
27733
+ ["cli", "troubleshoot", ["uipath-feedback"]],
27734
+ ["governance", "operate", ["uipath-governance"]],
27735
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
27736
+ ["document-understanding", "build", ["uipath-ixp"]],
27737
+ [
27738
+ "maestro",
27739
+ "build",
27740
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
27741
+ ],
27742
+ ["agenthub", "build", ["uipath-mcp-servers"]],
27743
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
27744
+ ["platform", "operate", ["uipath-platform"]],
27745
+ ["quality", "troubleshoot", ["uipath-review"]],
27746
+ ["rpa", "build", ["uipath-rpa"]],
27747
+ ["cli", "operate", ["uipath-skill-catalog"]],
27748
+ ["action-center", "operate", ["uipath-tasks"]],
27749
+ ["test-manager", "operate", ["uipath-test"]],
27750
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
27751
+ ]);
27752
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
27753
+ var COMMAND_ATTRIBUTION = commandAttribution([
27754
+ ["cli", "troubleshoot", ["uip.feedback"]],
27755
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
27756
+ ["context-grounding", "build", ["uip.context-grounding"]],
27757
+ ["api-workflow", "build", ["uip.api-workflow"]],
27758
+ ["rpa", "build", ["uip.rpa-legacy"]],
27759
+ ["conversational", "operate", ["uip.conversational"]],
27760
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
27761
+ ["agenthub", "build", ["uip.agenthub"]],
27762
+ ["coded-apps", "build", ["uip.codedapp"]],
27763
+ ["functions", "build", ["uip.functions"]],
27764
+ ["solution", "build", ["uip.solution"]],
27765
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
27766
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
27767
+ ["platform", "operate", ["uip.platform"]],
27768
+ ["admin", "operate", ["uip.admin"]],
27769
+ ["automation-ops", "operate", ["uip.aops"]],
27770
+ ["documentation", "troubleshoot", ["uip.docsai"]],
27771
+ ["governance", "operate", ["uip.gov"]],
27772
+ ["insights", "operate", ["uip.insights"]],
27773
+ ["document-understanding", "build", ["uip.ixp"]],
27774
+ ["process-mining", "operate", ["uip.pm"]],
27775
+ ["action-center", "operate", ["uip.tasks"]],
27776
+ ["test-manager", "operate", ["uip.tm"]],
27777
+ ["vertical-solutions", "build", ["uip.vss"]],
27778
+ ["data-fabric", "operate", ["uip.df"]],
27779
+ ["integration-service", "build", ["uip.is"]],
27780
+ ["orchestrator", "operate", ["uip.or"]],
27781
+ [
27782
+ "cli",
27783
+ "operate",
27784
+ [
27785
+ "uip.login",
27786
+ "uip.logout",
27787
+ "uip.user",
27788
+ "uip.config",
27789
+ "uip.tools",
27790
+ "uip.skills",
27791
+ "uip.completion",
27792
+ "uip.update",
27793
+ "uip.mcp",
27794
+ "uip.track"
27795
+ ]
27796
+ ]
27797
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
27798
+ function normalizeCommandPath(value) {
27799
+ if (typeof value !== "string") {
27800
+ return;
27801
+ }
27802
+ const trimmed = value.trim().toLowerCase();
27803
+ if (!trimmed) {
27804
+ return;
27805
+ }
27806
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
27807
+ if (tokens.length === 0) {
27808
+ return;
27809
+ }
27810
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
27811
+ return commandTokens.join(".");
27812
+ }
27813
+ function getCommandProductModeAttribution(commandPath) {
27814
+ const normalized = normalizeCommandPath(commandPath);
27815
+ if (!normalized) {
27816
+ return;
27817
+ }
27818
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
27819
+ }
27820
+ function normalizeSkillNameWithOptions(value, options) {
27821
+ if (typeof value !== "string") {
27822
+ return;
27823
+ }
27824
+ const normalized = value.trim().toLowerCase();
27825
+ if (!normalized) {
27826
+ return;
27827
+ }
27828
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
27829
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
27830
+ return;
27831
+ }
27832
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
27833
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
27834
+ return;
27835
+ }
27836
+ return skillName;
27837
+ }
27838
+ function normalizeSkillName(value) {
27839
+ return normalizeSkillNameWithOptions(value, {
27840
+ allowLegacyNamespace: false
27841
+ });
27842
+ }
27843
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
27844
+ const skillName = normalizeSkillName(skillSource);
27845
+ return {
27846
+ ...skillName ? { skill_name: skillName } : {},
27847
+ ...getCommandProductModeAttribution(commandPath)
27848
+ };
27849
+ }
27850
+
27304
27851
  // ../../common/src/telemetry/pii-redactor.ts
27305
27852
  var REDACTED = "[REDACTED]";
27306
27853
  var MAX_VALUE_LENGTH = 200;
@@ -27486,6 +28033,12 @@ function commandHelpHint(commandPath) {
27486
28033
  const command = commandPath.replace(/\./g, " ");
27487
28034
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
27488
28035
  }
28036
+ function isPromptCancellation(error) {
28037
+ return error instanceof Error && error.name === "ExitPromptError";
28038
+ }
28039
+ function exitCodeFromProcess(fallback) {
28040
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
28041
+ }
27489
28042
  Command.prototype.trackedAction = function(context, fn, properties) {
27490
28043
  const command = this;
27491
28044
  return this.action(async (...args) => {
@@ -27493,6 +28046,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27493
28046
  const props = typeof properties === "function" ? properties(...args) : properties;
27494
28047
  const startTime = performance.now();
27495
28048
  let errorMessage;
28049
+ let fallbackExitCode = EXIT_CODES.Success;
28050
+ clearRecordedCommandFailureTelemetry();
27496
28051
  const [error] = await catchError(fn(...args));
27497
28052
  if (error) {
27498
28053
  errorMessage = error instanceof Error ? error.message : String(error);
@@ -27507,6 +28062,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27507
28062
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
27508
28063
  const typedContext = typed.context ?? typed.Context;
27509
28064
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
28065
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
28066
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
27510
28067
  OutputFormatter.error({
27511
28068
  Result: finalResult,
27512
28069
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -27515,16 +28072,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27515
28072
  ...customRetry ? { Retry: customRetry } : {},
27516
28073
  ...customContext ? { Context: customContext } : {}
27517
28074
  });
27518
- context.exit(EXIT_CODES[finalResult]);
28075
+ context.exit(fallbackExitCode);
27519
28076
  }
27520
28077
  const durationMs = performance.now() - startTime;
27521
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
28078
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
28079
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
28080
+ const success = !error && exitCode === 0;
28081
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
28082
+ error,
28083
+ exitCode,
28084
+ recordedFailure,
28085
+ pollSignal: context.pollSignal
28086
+ });
27522
28087
  telemetry.trackEvent(telemetryName, redactProperties({
27523
28088
  ...extractCommandParams(command),
27524
28089
  ...props,
28090
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
27525
28091
  command: "true",
27526
28092
  duration: String(durationMs),
27527
28093
  success: String(success),
28094
+ ...terminalTelemetry,
27528
28095
  ...errorMessage ? { errorMessage } : {}
27529
28096
  }));
27530
28097
  });
@@ -27705,6 +28272,8 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
27705
28272
  function installSdkUserAgentHeader(BaseApiClass, userAgent) {
27706
28273
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
27707
28274
  }
28275
+ // ../../common/src/telemetry/ship-succeeded.ts
28276
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
27708
28277
  // ../../common/src/tool-provider.ts
27709
28278
  var factorySlot = singleton("PackagerFactoryProvider");
27710
28279
  // ../resourcecatalog-sdk/generated/src/runtime.ts
@@ -30798,4 +31367,4 @@ program2.name(metadata.commandPrefix).description(metadata.description).version(
30798
31367
  await registerCommands(program2);
30799
31368
  program2.parse(process.argv);
30800
31369
 
30801
- //# debugId=E5F695B71F5A4E6264756E2164756E21
31370
+ //# debugId=2515DB2657FDB22464756E2164756E21
package/dist/tool.js CHANGED
@@ -19137,7 +19137,7 @@ var init_server = __esm(() => {
19137
19137
  var package_default = {
19138
19138
  name: "@uipath/resourcecatalog-tool",
19139
19139
  license: "MIT",
19140
- version: "1.197.0-preview.65",
19140
+ version: "1.197.0-preview.67",
19141
19141
  description: "CLI plugin for the UiPath Resource Catalog Service.",
19142
19142
  private: false,
19143
19143
  repository: {
@@ -24488,9 +24488,228 @@ function getOutputFilter() {
24488
24488
  return filterSlot.get();
24489
24489
  }
24490
24490
 
24491
+ // ../../common/src/telemetry/command-terminal.ts
24492
+ var recordedFailureSlot = singleton("CommandTelemetryFailure");
24493
+ var AUTH_ERROR_CODES = new Set([
24494
+ "authentication_required",
24495
+ "permission_denied"
24496
+ ]);
24497
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
24498
+ var NETWORK_HTTP_ERROR_CODES = new Set([
24499
+ "network_error",
24500
+ "rate_limited",
24501
+ "server_error",
24502
+ "not_found",
24503
+ "method_not_allowed"
24504
+ ]);
24505
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
24506
+ var NETWORK_OS_ERROR_CODES = new Set([
24507
+ "ECONNREFUSED",
24508
+ "ECONNRESET",
24509
+ "ENOTFOUND",
24510
+ "EAI_AGAIN",
24511
+ "EPIPE",
24512
+ "EHOSTUNREACH",
24513
+ "ENETUNREACH",
24514
+ "EAI_FAIL"
24515
+ ]);
24516
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
24517
+ var TLS_ERROR_CODES2 = new Set([
24518
+ "SELF_SIGNED_CERT_IN_CHAIN",
24519
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
24520
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
24521
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
24522
+ "UNABLE_TO_GET_ISSUER_CERT",
24523
+ "CERT_HAS_EXPIRED",
24524
+ "CERT_UNTRUSTED",
24525
+ "ERR_TLS_CERT_ALTNAME_INVALID"
24526
+ ]);
24527
+ var MISSING_DEPENDENCY_CODES = new Set([
24528
+ "MODULE_NOT_FOUND",
24529
+ "ERR_MODULE_NOT_FOUND"
24530
+ ]);
24531
+ var INTERNAL_ERROR_NAMES = new Set([
24532
+ "TypeError",
24533
+ "ReferenceError",
24534
+ "SyntaxError",
24535
+ "RangeError"
24536
+ ]);
24537
+ function isRecord(value) {
24538
+ return value !== null && typeof value === "object";
24539
+ }
24540
+ function stringField(value, field) {
24541
+ if (!isRecord(value)) {
24542
+ return;
24543
+ }
24544
+ const raw = value[field];
24545
+ return typeof raw === "string" ? raw : undefined;
24546
+ }
24547
+ function numberField(value, field) {
24548
+ if (!isRecord(value)) {
24549
+ return;
24550
+ }
24551
+ const raw = value[field];
24552
+ return typeof raw === "number" ? raw : undefined;
24553
+ }
24554
+ function findStringInCauseChain(error, field) {
24555
+ let current = error;
24556
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
24557
+ const value = stringField(current, field);
24558
+ if (value) {
24559
+ return value;
24560
+ }
24561
+ current = current.cause;
24562
+ }
24563
+ return;
24564
+ }
24565
+ function findCodeInCauseChain(error) {
24566
+ return findStringInCauseChain(error, "code");
24567
+ }
24568
+ function isSpawnEnoent(error) {
24569
+ const code = findCodeInCauseChain(error);
24570
+ if (code !== "ENOENT") {
24571
+ return false;
24572
+ }
24573
+ const syscall = findStringInCauseChain(error, "syscall");
24574
+ return syscall?.startsWith("spawn") === true;
24575
+ }
24576
+ function isCancellationError(error, exitCode, pollSignal) {
24577
+ if (exitCode === 130) {
24578
+ return true;
24579
+ }
24580
+ if (!isRecord(error)) {
24581
+ return false;
24582
+ }
24583
+ if (numberField(error, "exitCode") === 130) {
24584
+ return true;
24585
+ }
24586
+ const name = stringField(error, "name");
24587
+ if (name === "ExitPromptError") {
24588
+ return true;
24589
+ }
24590
+ if (name === "AbortError" && pollSignal?.aborted) {
24591
+ return true;
24592
+ }
24593
+ const message = stringField(error, "message");
24594
+ return message?.includes("SIGINT") === true;
24595
+ }
24596
+ function terminalSignalFor(input, outcome) {
24597
+ if (input.recordedFailure?.terminalSignal) {
24598
+ return input.recordedFailure.terminalSignal;
24599
+ }
24600
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
24601
+ if (explicit) {
24602
+ return explicit;
24603
+ }
24604
+ return outcome === "cancelled" ? "SIGINT" : undefined;
24605
+ }
24606
+ function classifyHttpStatus(status) {
24607
+ if (status === 401 || status === 403) {
24608
+ return "auth";
24609
+ }
24610
+ if (status === 400 || status === 409 || status === 422) {
24611
+ return "validation";
24612
+ }
24613
+ if (status === 408) {
24614
+ return "timeout";
24615
+ }
24616
+ return "network_http";
24617
+ }
24618
+ function classifyFromResult(result) {
24619
+ switch (result) {
24620
+ case "AuthenticationError":
24621
+ return "auth";
24622
+ case "ValidationError":
24623
+ return "validation";
24624
+ case "TimeoutError":
24625
+ return "timeout";
24626
+ default:
24627
+ return;
24628
+ }
24629
+ }
24630
+ function classifyFromErrorCode(errorCode) {
24631
+ if (!errorCode) {
24632
+ return;
24633
+ }
24634
+ if (AUTH_ERROR_CODES.has(errorCode)) {
24635
+ return "auth";
24636
+ }
24637
+ if (VALIDATION_ERROR_CODES.has(errorCode)) {
24638
+ return "validation";
24639
+ }
24640
+ if (TIMEOUT_ERROR_CODES.has(errorCode)) {
24641
+ return "timeout";
24642
+ }
24643
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
24644
+ return "network_http";
24645
+ }
24646
+ return;
24647
+ }
24648
+ function classifyFromError(error) {
24649
+ const code = findCodeInCauseChain(error);
24650
+ if (code) {
24651
+ if (code.startsWith("commander.")) {
24652
+ return "validation";
24653
+ }
24654
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
24655
+ return "network_http";
24656
+ }
24657
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
24658
+ return "timeout";
24659
+ }
24660
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
24661
+ return "missing_dependency";
24662
+ }
24663
+ }
24664
+ const message = stringField(error, "message");
24665
+ if (message?.includes("fetch failed") === true) {
24666
+ return "network_http";
24667
+ }
24668
+ const name = stringField(error, "name");
24669
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
24670
+ return "internal";
24671
+ }
24672
+ return;
24673
+ }
24674
+ function classifyError2(input) {
24675
+ const recorded = input.recordedFailure;
24676
+ if (recorded?.errorClass) {
24677
+ return recorded.errorClass;
24678
+ }
24679
+ const status = recorded?.context?.httpStatus;
24680
+ if (status !== undefined) {
24681
+ return classifyHttpStatus(status);
24682
+ }
24683
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
24684
+ }
24685
+ function recordCommandFailureTelemetry(failure) {
24686
+ recordedFailureSlot.set(failure);
24687
+ }
24688
+ function clearRecordedCommandFailureTelemetry() {
24689
+ recordedFailureSlot.clear();
24690
+ }
24691
+ function takeRecordedCommandFailureTelemetry() {
24692
+ const failure = recordedFailureSlot.get();
24693
+ recordedFailureSlot.clear();
24694
+ return failure;
24695
+ }
24696
+ function buildCommandTerminalTelemetryProperties(input) {
24697
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
24698
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
24699
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
24700
+ const terminalSignal = terminalSignalFor(input, outcome);
24701
+ return {
24702
+ exit_code: input.exitCode,
24703
+ terminal_outcome: outcome,
24704
+ ...errorClass ? { error_class: errorClass } : {},
24705
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
24706
+ };
24707
+ }
24708
+
24491
24709
  // ../../common/src/telemetry/telemetry-events.ts
24492
24710
  var CommonTelemetryEvents = {
24493
- Error: "uip.error"
24711
+ Error: "uip.error",
24712
+ ShipSucceeded: "ship_succeeded"
24494
24713
  };
24495
24714
 
24496
24715
  // ../../common/src/registry.ts
@@ -24557,6 +24776,136 @@ function formatMessage(category, name, properties) {
24557
24776
  }
24558
24777
  return message;
24559
24778
  }
24779
+ // ../../common/src/telemetry/detect-agent.ts
24780
+ var KNOWN_AGENTS = [
24781
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
24782
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
24783
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
24784
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
24785
+ { envVar: "CODEX_SANDBOX", id: "codex" },
24786
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
24787
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
24788
+ ];
24789
+ function detectAgentFromEnv(env) {
24790
+ for (const agent of KNOWN_AGENTS) {
24791
+ const envValue = env[agent.envVar];
24792
+ if (agent.value !== undefined) {
24793
+ if (envValue === agent.value)
24794
+ return agent.id;
24795
+ } else {
24796
+ if (envValue)
24797
+ return agent.id;
24798
+ }
24799
+ }
24800
+ const agentEnv = env.AGENT;
24801
+ if (agentEnv) {
24802
+ if (agentEnv === "1" || agentEnv === "true")
24803
+ return "unknown";
24804
+ if (agentEnv.length <= 32)
24805
+ return agentEnv.toLowerCase();
24806
+ }
24807
+ return;
24808
+ }
24809
+ // ../../common/src/telemetry/environment-info.ts
24810
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
24811
+ // ../../common/src/telemetry/execution-context.ts
24812
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
24813
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
24814
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
24815
+ var CI_SIGNATURES = [
24816
+ {
24817
+ provider: "github_actions",
24818
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
24819
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
24820
+ },
24821
+ {
24822
+ provider: "azure_devops",
24823
+ matches: (env) => isTruthy(env.TF_BUILD),
24824
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
24825
+ },
24826
+ {
24827
+ provider: "gitlab",
24828
+ matches: (env) => isTruthy(env.GITLAB_CI),
24829
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
24830
+ },
24831
+ {
24832
+ provider: "circleci",
24833
+ matches: (env) => isTruthy(env.CIRCLECI),
24834
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
24835
+ },
24836
+ {
24837
+ provider: "jenkins",
24838
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
24839
+ },
24840
+ {
24841
+ provider: "teamcity",
24842
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
24843
+ },
24844
+ {
24845
+ provider: "buildkite",
24846
+ matches: (env) => isTruthy(env.BUILDKITE),
24847
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
24848
+ },
24849
+ {
24850
+ provider: "bitbucket",
24851
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
24852
+ },
24853
+ {
24854
+ provider: "travis",
24855
+ matches: (env) => isTruthy(env.TRAVIS)
24856
+ },
24857
+ {
24858
+ provider: "appveyor",
24859
+ matches: (env) => isTruthy(env.APPVEYOR)
24860
+ },
24861
+ {
24862
+ provider: "generic",
24863
+ matches: (env) => isTruthy(env.CI)
24864
+ }
24865
+ ];
24866
+ function currentEnv() {
24867
+ return typeof process === "undefined" ? {} : process.env;
24868
+ }
24869
+ function currentTtyState() {
24870
+ if (typeof process === "undefined")
24871
+ return false;
24872
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
24873
+ }
24874
+ function detectCi(env) {
24875
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
24876
+ if (!signature)
24877
+ return;
24878
+ return {
24879
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
24880
+ ciProvider: signature.provider
24881
+ };
24882
+ }
24883
+ function detectExecutionContext(options = {}) {
24884
+ const env = options.env ?? currentEnv();
24885
+ const ci = detectCi(env);
24886
+ if (ci)
24887
+ return ci;
24888
+ const agent = options.agent ?? detectAgentFromEnv(env);
24889
+ if (agent) {
24890
+ return { executionContext: "agent" };
24891
+ }
24892
+ const authSignal = options.authSignal ?? authSignalSlot.get();
24893
+ if (authSignal === "service_account") {
24894
+ return { executionContext: "service_account" };
24895
+ }
24896
+ const isTty = options.isTty ?? currentTtyState();
24897
+ if (isTty) {
24898
+ return { executionContext: "manual" };
24899
+ }
24900
+ return { executionContext: "unknown" };
24901
+ }
24902
+ function getExecutionContextTelemetryProperties() {
24903
+ const detected = detectExecutionContext();
24904
+ return {
24905
+ execution_context: detected.executionContext,
24906
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
24907
+ };
24908
+ }
24560
24909
  // ../../common/src/telemetry/node-context-storage.ts
24561
24910
  import { AsyncLocalStorage } from "node:async_hooks";
24562
24911
 
@@ -24569,6 +24918,26 @@ class NodeContextStorage {
24569
24918
  return this.storage.getStore();
24570
24919
  }
24571
24920
  }
24921
+ // ../../common/src/telemetry/session-id.ts
24922
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
24923
+ var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
24924
+ var telemetrySessionIdSlot = singleton("TelemetrySessionId");
24925
+ function getProcessEnv() {
24926
+ return globalThis.process?.env;
24927
+ }
24928
+ function normalizeSessionId(value) {
24929
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
24930
+ return;
24931
+ }
24932
+ const trimmed = String(value).trim();
24933
+ return trimmed || undefined;
24934
+ }
24935
+ function getConfiguredTelemetrySessionId() {
24936
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
24937
+ }
24938
+ function resolveTelemetrySessionId(existingSessionId) {
24939
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
24940
+ }
24572
24941
  // ../../common/src/telemetry/global-telemetry-properties.ts
24573
24942
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
24574
24943
  function getGlobalTelemetryProperties() {
@@ -24653,12 +25022,22 @@ class TelemetryService {
24653
25022
  return this.contextStorage.getContext();
24654
25023
  }
24655
25024
  enrichPropertiesWithContext(properties, context) {
24656
- return {
24657
- ...getGlobalTelemetryProperties(),
25025
+ const globalProperties = getGlobalTelemetryProperties();
25026
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
25027
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
25028
+ const enriched = {
25029
+ ...getExecutionContextTelemetryProperties(),
25030
+ ...globalProperties,
24658
25031
  ...this.defaultProperties,
24659
25032
  ...properties,
24660
25033
  ...context
24661
25034
  };
25035
+ if (sessionId === undefined) {
25036
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
25037
+ } else {
25038
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
25039
+ }
25040
+ return enriched;
24662
25041
  }
24663
25042
  generateId() {
24664
25043
  return crypto.randomUUID().replaceAll("-", "");
@@ -25128,8 +25507,24 @@ var OutputFormatter;
25128
25507
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
25129
25508
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
25130
25509
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
25131
- const { SuppressTelemetry, ...envelope } = data;
25132
- if (!SuppressTelemetry) {
25510
+ recordCommandFailureTelemetry({
25511
+ result: data.Result,
25512
+ errorCode: data.ErrorCode,
25513
+ retry: data.Retry,
25514
+ message: data.Message,
25515
+ context: data.Context,
25516
+ exitCode: process.exitCode,
25517
+ errorClass: data.TelemetryErrorClass,
25518
+ terminalOutcome: data.TelemetryTerminalOutcome,
25519
+ terminalSignal: data.TelemetryTerminalSignal
25520
+ });
25521
+ const suppressTelemetry = data.SuppressTelemetry === true;
25522
+ const envelope = { ...data };
25523
+ delete envelope.SuppressTelemetry;
25524
+ delete envelope.TelemetryErrorClass;
25525
+ delete envelope.TelemetryTerminalOutcome;
25526
+ delete envelope.TelemetryTerminalSignal;
25527
+ if (!suppressTelemetry) {
25133
25528
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
25134
25529
  result: data.Result,
25135
25530
  errorCode: data.ErrorCode,
@@ -25195,6 +25590,158 @@ var OutputFormatter;
25195
25590
  // ../../common/src/trackedAction.ts
25196
25591
  import { Command as Command2 } from "commander";
25197
25592
 
25593
+ // ../../common/src/telemetry/command-attribution.ts
25594
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
25595
+ var MAX_SKILL_NAME_LENGTH = 80;
25596
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
25597
+ function productMode(productArea, mode) {
25598
+ return { product_area: productArea, mode };
25599
+ }
25600
+ function attributionRecord(groups) {
25601
+ const record = {};
25602
+ for (const [productArea, mode, names] of groups) {
25603
+ const attribution = productMode(productArea, mode);
25604
+ for (const name of names) {
25605
+ record[name] = attribution;
25606
+ }
25607
+ }
25608
+ return record;
25609
+ }
25610
+ function commandAttribution(groups) {
25611
+ const entries = [];
25612
+ for (const [productArea, mode, prefixes] of groups) {
25613
+ const attribution = productMode(productArea, mode);
25614
+ for (const prefix of prefixes) {
25615
+ entries.push({ prefix, attribution });
25616
+ }
25617
+ }
25618
+ return entries;
25619
+ }
25620
+ var SKILL_ATTRIBUTION = attributionRecord([
25621
+ ["admin", "operate", ["uipath-admin"]],
25622
+ ["agents", "build", ["uipath-agents"]],
25623
+ ["api-workflow", "build", ["uipath-api-workflow"]],
25624
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
25625
+ ["coded-apps", "build", ["uipath-coded-apps"]],
25626
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
25627
+ ["cli", "troubleshoot", ["uipath-feedback"]],
25628
+ ["governance", "operate", ["uipath-governance"]],
25629
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
25630
+ ["document-understanding", "build", ["uipath-ixp"]],
25631
+ [
25632
+ "maestro",
25633
+ "build",
25634
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
25635
+ ],
25636
+ ["agenthub", "build", ["uipath-mcp-servers"]],
25637
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
25638
+ ["platform", "operate", ["uipath-platform"]],
25639
+ ["quality", "troubleshoot", ["uipath-review"]],
25640
+ ["rpa", "build", ["uipath-rpa"]],
25641
+ ["cli", "operate", ["uipath-skill-catalog"]],
25642
+ ["action-center", "operate", ["uipath-tasks"]],
25643
+ ["test-manager", "operate", ["uipath-test"]],
25644
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
25645
+ ]);
25646
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
25647
+ var COMMAND_ATTRIBUTION = commandAttribution([
25648
+ ["cli", "troubleshoot", ["uip.feedback"]],
25649
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
25650
+ ["context-grounding", "build", ["uip.context-grounding"]],
25651
+ ["api-workflow", "build", ["uip.api-workflow"]],
25652
+ ["rpa", "build", ["uip.rpa-legacy"]],
25653
+ ["conversational", "operate", ["uip.conversational"]],
25654
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
25655
+ ["agenthub", "build", ["uip.agenthub"]],
25656
+ ["coded-apps", "build", ["uip.codedapp"]],
25657
+ ["functions", "build", ["uip.functions"]],
25658
+ ["solution", "build", ["uip.solution"]],
25659
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
25660
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
25661
+ ["platform", "operate", ["uip.platform"]],
25662
+ ["admin", "operate", ["uip.admin"]],
25663
+ ["automation-ops", "operate", ["uip.aops"]],
25664
+ ["documentation", "troubleshoot", ["uip.docsai"]],
25665
+ ["governance", "operate", ["uip.gov"]],
25666
+ ["insights", "operate", ["uip.insights"]],
25667
+ ["document-understanding", "build", ["uip.ixp"]],
25668
+ ["process-mining", "operate", ["uip.pm"]],
25669
+ ["action-center", "operate", ["uip.tasks"]],
25670
+ ["test-manager", "operate", ["uip.tm"]],
25671
+ ["vertical-solutions", "build", ["uip.vss"]],
25672
+ ["data-fabric", "operate", ["uip.df"]],
25673
+ ["integration-service", "build", ["uip.is"]],
25674
+ ["orchestrator", "operate", ["uip.or"]],
25675
+ [
25676
+ "cli",
25677
+ "operate",
25678
+ [
25679
+ "uip.login",
25680
+ "uip.logout",
25681
+ "uip.user",
25682
+ "uip.config",
25683
+ "uip.tools",
25684
+ "uip.skills",
25685
+ "uip.completion",
25686
+ "uip.update",
25687
+ "uip.mcp",
25688
+ "uip.track"
25689
+ ]
25690
+ ]
25691
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
25692
+ function normalizeCommandPath(value) {
25693
+ if (typeof value !== "string") {
25694
+ return;
25695
+ }
25696
+ const trimmed = value.trim().toLowerCase();
25697
+ if (!trimmed) {
25698
+ return;
25699
+ }
25700
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
25701
+ if (tokens.length === 0) {
25702
+ return;
25703
+ }
25704
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
25705
+ return commandTokens.join(".");
25706
+ }
25707
+ function getCommandProductModeAttribution(commandPath) {
25708
+ const normalized = normalizeCommandPath(commandPath);
25709
+ if (!normalized) {
25710
+ return;
25711
+ }
25712
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
25713
+ }
25714
+ function normalizeSkillNameWithOptions(value, options) {
25715
+ if (typeof value !== "string") {
25716
+ return;
25717
+ }
25718
+ const normalized = value.trim().toLowerCase();
25719
+ if (!normalized) {
25720
+ return;
25721
+ }
25722
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
25723
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
25724
+ return;
25725
+ }
25726
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
25727
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
25728
+ return;
25729
+ }
25730
+ return skillName;
25731
+ }
25732
+ function normalizeSkillName(value) {
25733
+ return normalizeSkillNameWithOptions(value, {
25734
+ allowLegacyNamespace: false
25735
+ });
25736
+ }
25737
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
25738
+ const skillName = normalizeSkillName(skillSource);
25739
+ return {
25740
+ ...skillName ? { skill_name: skillName } : {},
25741
+ ...getCommandProductModeAttribution(commandPath)
25742
+ };
25743
+ }
25744
+
25198
25745
  // ../../common/src/telemetry/pii-redactor.ts
25199
25746
  var REDACTED = "[REDACTED]";
25200
25747
  var MAX_VALUE_LENGTH = 200;
@@ -25380,6 +25927,12 @@ function commandHelpHint(commandPath) {
25380
25927
  const command = commandPath.replace(/\./g, " ");
25381
25928
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
25382
25929
  }
25930
+ function isPromptCancellation(error) {
25931
+ return error instanceof Error && error.name === "ExitPromptError";
25932
+ }
25933
+ function exitCodeFromProcess(fallback) {
25934
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
25935
+ }
25383
25936
  Command2.prototype.trackedAction = function(context, fn, properties) {
25384
25937
  const command = this;
25385
25938
  return this.action(async (...args) => {
@@ -25387,6 +25940,8 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
25387
25940
  const props = typeof properties === "function" ? properties(...args) : properties;
25388
25941
  const startTime = performance.now();
25389
25942
  let errorMessage;
25943
+ let fallbackExitCode = EXIT_CODES.Success;
25944
+ clearRecordedCommandFailureTelemetry();
25390
25945
  const [error] = await catchError(fn(...args));
25391
25946
  if (error) {
25392
25947
  errorMessage = error instanceof Error ? error.message : String(error);
@@ -25401,6 +25956,8 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
25401
25956
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
25402
25957
  const typedContext = typed.context ?? typed.Context;
25403
25958
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
25959
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
25960
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
25404
25961
  OutputFormatter.error({
25405
25962
  Result: finalResult,
25406
25963
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -25409,16 +25966,26 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
25409
25966
  ...customRetry ? { Retry: customRetry } : {},
25410
25967
  ...customContext ? { Context: customContext } : {}
25411
25968
  });
25412
- context.exit(EXIT_CODES[finalResult]);
25969
+ context.exit(fallbackExitCode);
25413
25970
  }
25414
25971
  const durationMs = performance.now() - startTime;
25415
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
25972
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
25973
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
25974
+ const success = !error && exitCode === 0;
25975
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
25976
+ error,
25977
+ exitCode,
25978
+ recordedFailure,
25979
+ pollSignal: context.pollSignal
25980
+ });
25416
25981
  telemetry.trackEvent(telemetryName, redactProperties({
25417
25982
  ...extractCommandParams(command),
25418
25983
  ...props,
25984
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
25419
25985
  command: "true",
25420
25986
  duration: String(durationMs),
25421
25987
  success: String(success),
25988
+ ...terminalTelemetry,
25422
25989
  ...errorMessage ? { errorMessage } : {}
25423
25990
  }));
25424
25991
  });
@@ -25603,6 +26170,8 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
25603
26170
  function installSdkUserAgentHeader(BaseApiClass, userAgent) {
25604
26171
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
25605
26172
  }
26173
+ // ../../common/src/telemetry/ship-succeeded.ts
26174
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
25606
26175
  // ../../common/src/tool-provider.ts
25607
26176
  var factorySlot = singleton("PackagerFactoryProvider");
25608
26177
  // ../resourcecatalog-sdk/generated/src/runtime.ts
@@ -28696,4 +29265,4 @@ export {
28696
29265
  metadata
28697
29266
  };
28698
29267
 
28699
- //# debugId=7A04A5B44552C2EB64756E2164756E21
29268
+ //# debugId=AC119E0FAECB4FB664756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/resourcecatalog-tool",
3
3
  "license": "MIT",
4
- "version": "1.197.0-preview.65",
4
+ "version": "1.197.0-preview.67",
5
5
  "description": "CLI plugin for the UiPath Resource Catalog Service.",
6
6
  "private": false,
7
7
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
- "gitHead": "9388ccbe5e739c9578bfd9b5395980fb63e11d9c"
29
+ "gitHead": "579e7d41cb100fcb8130eec8ed1c9b5b55feaf0b"
30
30
  }