@uipath/admin-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 +1156 -27
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -23633,7 +23633,7 @@ var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
23633
23633
  var package_default = {
23634
23634
  name: "@uipath/admin-vpngateway-tool",
23635
23635
  license: "MIT",
23636
- version: "1.197.0-preview.64",
23636
+ version: "1.197.0-preview.66",
23637
23637
  description: "CLI plugin for UiPath VPN Gateway management (Hypervisor service).",
23638
23638
  private: false,
23639
23639
  repository: {
@@ -50683,8 +50683,225 @@ function getOutputFormat() {
50683
50683
  function getOutputFilter() {
50684
50684
  return filterSlot.get();
50685
50685
  }
50686
+ var recordedFailureSlot = singleton2("CommandTelemetryFailure");
50687
+ var AUTH_ERROR_CODES = new Set([
50688
+ "authentication_required",
50689
+ "permission_denied"
50690
+ ]);
50691
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
50692
+ var NETWORK_HTTP_ERROR_CODES = new Set([
50693
+ "network_error",
50694
+ "rate_limited",
50695
+ "server_error",
50696
+ "not_found",
50697
+ "method_not_allowed"
50698
+ ]);
50699
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
50700
+ var NETWORK_OS_ERROR_CODES = new Set([
50701
+ "ECONNREFUSED",
50702
+ "ECONNRESET",
50703
+ "ENOTFOUND",
50704
+ "EAI_AGAIN",
50705
+ "EPIPE",
50706
+ "EHOSTUNREACH",
50707
+ "ENETUNREACH",
50708
+ "EAI_FAIL"
50709
+ ]);
50710
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
50711
+ var TLS_ERROR_CODES2 = new Set([
50712
+ "SELF_SIGNED_CERT_IN_CHAIN",
50713
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
50714
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
50715
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
50716
+ "UNABLE_TO_GET_ISSUER_CERT",
50717
+ "CERT_HAS_EXPIRED",
50718
+ "CERT_UNTRUSTED",
50719
+ "ERR_TLS_CERT_ALTNAME_INVALID"
50720
+ ]);
50721
+ var MISSING_DEPENDENCY_CODES = new Set([
50722
+ "MODULE_NOT_FOUND",
50723
+ "ERR_MODULE_NOT_FOUND"
50724
+ ]);
50725
+ var INTERNAL_ERROR_NAMES = new Set([
50726
+ "TypeError",
50727
+ "ReferenceError",
50728
+ "SyntaxError",
50729
+ "RangeError"
50730
+ ]);
50731
+ function isRecord(value) {
50732
+ return value !== null && typeof value === "object";
50733
+ }
50734
+ function stringField(value, field) {
50735
+ if (!isRecord(value)) {
50736
+ return;
50737
+ }
50738
+ const raw = value[field];
50739
+ return typeof raw === "string" ? raw : undefined;
50740
+ }
50741
+ function numberField(value, field) {
50742
+ if (!isRecord(value)) {
50743
+ return;
50744
+ }
50745
+ const raw = value[field];
50746
+ return typeof raw === "number" ? raw : undefined;
50747
+ }
50748
+ function findStringInCauseChain(error, field) {
50749
+ let current = error;
50750
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
50751
+ const value = stringField(current, field);
50752
+ if (value) {
50753
+ return value;
50754
+ }
50755
+ current = current.cause;
50756
+ }
50757
+ return;
50758
+ }
50759
+ function findCodeInCauseChain(error) {
50760
+ return findStringInCauseChain(error, "code");
50761
+ }
50762
+ function isSpawnEnoent(error) {
50763
+ const code = findCodeInCauseChain(error);
50764
+ if (code !== "ENOENT") {
50765
+ return false;
50766
+ }
50767
+ const syscall = findStringInCauseChain(error, "syscall");
50768
+ return syscall?.startsWith("spawn") === true;
50769
+ }
50770
+ function isCancellationError(error, exitCode, pollSignal) {
50771
+ if (exitCode === 130) {
50772
+ return true;
50773
+ }
50774
+ if (!isRecord(error)) {
50775
+ return false;
50776
+ }
50777
+ if (numberField(error, "exitCode") === 130) {
50778
+ return true;
50779
+ }
50780
+ const name = stringField(error, "name");
50781
+ if (name === "ExitPromptError") {
50782
+ return true;
50783
+ }
50784
+ if (name === "AbortError" && pollSignal?.aborted) {
50785
+ return true;
50786
+ }
50787
+ const message = stringField(error, "message");
50788
+ return message?.includes("SIGINT") === true;
50789
+ }
50790
+ function terminalSignalFor(input, outcome) {
50791
+ if (input.recordedFailure?.terminalSignal) {
50792
+ return input.recordedFailure.terminalSignal;
50793
+ }
50794
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
50795
+ if (explicit) {
50796
+ return explicit;
50797
+ }
50798
+ return outcome === "cancelled" ? "SIGINT" : undefined;
50799
+ }
50800
+ function classifyHttpStatus(status) {
50801
+ if (status === 401 || status === 403) {
50802
+ return "auth";
50803
+ }
50804
+ if (status === 400 || status === 409 || status === 422) {
50805
+ return "validation";
50806
+ }
50807
+ if (status === 408) {
50808
+ return "timeout";
50809
+ }
50810
+ return "network_http";
50811
+ }
50812
+ function classifyFromResult(result) {
50813
+ switch (result) {
50814
+ case "AuthenticationError":
50815
+ return "auth";
50816
+ case "ValidationError":
50817
+ return "validation";
50818
+ case "TimeoutError":
50819
+ return "timeout";
50820
+ default:
50821
+ return;
50822
+ }
50823
+ }
50824
+ function classifyFromErrorCode(errorCode2) {
50825
+ if (!errorCode2) {
50826
+ return;
50827
+ }
50828
+ if (AUTH_ERROR_CODES.has(errorCode2)) {
50829
+ return "auth";
50830
+ }
50831
+ if (VALIDATION_ERROR_CODES.has(errorCode2)) {
50832
+ return "validation";
50833
+ }
50834
+ if (TIMEOUT_ERROR_CODES.has(errorCode2)) {
50835
+ return "timeout";
50836
+ }
50837
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode2)) {
50838
+ return "network_http";
50839
+ }
50840
+ return;
50841
+ }
50842
+ function classifyFromError(error) {
50843
+ const code = findCodeInCauseChain(error);
50844
+ if (code) {
50845
+ if (code.startsWith("commander.")) {
50846
+ return "validation";
50847
+ }
50848
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
50849
+ return "network_http";
50850
+ }
50851
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
50852
+ return "timeout";
50853
+ }
50854
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
50855
+ return "missing_dependency";
50856
+ }
50857
+ }
50858
+ const message = stringField(error, "message");
50859
+ if (message?.includes("fetch failed") === true) {
50860
+ return "network_http";
50861
+ }
50862
+ const name = stringField(error, "name");
50863
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
50864
+ return "internal";
50865
+ }
50866
+ return;
50867
+ }
50868
+ function classifyError2(input) {
50869
+ const recorded = input.recordedFailure;
50870
+ if (recorded?.errorClass) {
50871
+ return recorded.errorClass;
50872
+ }
50873
+ const status = recorded?.context?.httpStatus;
50874
+ if (status !== undefined) {
50875
+ return classifyHttpStatus(status);
50876
+ }
50877
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
50878
+ }
50879
+ function recordCommandFailureTelemetry(failure) {
50880
+ recordedFailureSlot.set(failure);
50881
+ }
50882
+ function clearRecordedCommandFailureTelemetry() {
50883
+ recordedFailureSlot.clear();
50884
+ }
50885
+ function takeRecordedCommandFailureTelemetry() {
50886
+ const failure = recordedFailureSlot.get();
50887
+ recordedFailureSlot.clear();
50888
+ return failure;
50889
+ }
50890
+ function buildCommandTerminalTelemetryProperties(input) {
50891
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
50892
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
50893
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
50894
+ const terminalSignal = terminalSignalFor(input, outcome);
50895
+ return {
50896
+ exit_code: input.exitCode,
50897
+ terminal_outcome: outcome,
50898
+ ...errorClass ? { error_class: errorClass } : {},
50899
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
50900
+ };
50901
+ }
50686
50902
  var CommonTelemetryEvents = {
50687
- Error: "uip.error"
50903
+ Error: "uip.error",
50904
+ ShipSucceeded: "ship_succeeded"
50688
50905
  };
50689
50906
  function readRegistryValue(keyPath, valueName) {
50690
50907
  if (process.platform !== "win32") {
@@ -50747,6 +50964,133 @@ function formatMessage(category, name, properties) {
50747
50964
  }
50748
50965
  return message;
50749
50966
  }
50967
+ var KNOWN_AGENTS = [
50968
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
50969
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
50970
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
50971
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
50972
+ { envVar: "CODEX_SANDBOX", id: "codex" },
50973
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
50974
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
50975
+ ];
50976
+ function detectAgentFromEnv(env) {
50977
+ for (const agent of KNOWN_AGENTS) {
50978
+ const envValue = env[agent.envVar];
50979
+ if (agent.value !== undefined) {
50980
+ if (envValue === agent.value)
50981
+ return agent.id;
50982
+ } else {
50983
+ if (envValue)
50984
+ return agent.id;
50985
+ }
50986
+ }
50987
+ const agentEnv = env.AGENT;
50988
+ if (agentEnv) {
50989
+ if (agentEnv === "1" || agentEnv === "true")
50990
+ return "unknown";
50991
+ if (agentEnv.length <= 32)
50992
+ return agentEnv.toLowerCase();
50993
+ }
50994
+ return;
50995
+ }
50996
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
50997
+ var authSignalSlot = singleton2("TelemetryExecutionContextAuthSignal");
50998
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
50999
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
51000
+ var CI_SIGNATURES = [
51001
+ {
51002
+ provider: "github_actions",
51003
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
51004
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
51005
+ },
51006
+ {
51007
+ provider: "azure_devops",
51008
+ matches: (env) => isTruthy(env.TF_BUILD),
51009
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
51010
+ },
51011
+ {
51012
+ provider: "gitlab",
51013
+ matches: (env) => isTruthy(env.GITLAB_CI),
51014
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
51015
+ },
51016
+ {
51017
+ provider: "circleci",
51018
+ matches: (env) => isTruthy(env.CIRCLECI),
51019
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
51020
+ },
51021
+ {
51022
+ provider: "jenkins",
51023
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
51024
+ },
51025
+ {
51026
+ provider: "teamcity",
51027
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
51028
+ },
51029
+ {
51030
+ provider: "buildkite",
51031
+ matches: (env) => isTruthy(env.BUILDKITE),
51032
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
51033
+ },
51034
+ {
51035
+ provider: "bitbucket",
51036
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
51037
+ },
51038
+ {
51039
+ provider: "travis",
51040
+ matches: (env) => isTruthy(env.TRAVIS)
51041
+ },
51042
+ {
51043
+ provider: "appveyor",
51044
+ matches: (env) => isTruthy(env.APPVEYOR)
51045
+ },
51046
+ {
51047
+ provider: "generic",
51048
+ matches: (env) => isTruthy(env.CI)
51049
+ }
51050
+ ];
51051
+ function currentEnv() {
51052
+ return typeof process === "undefined" ? {} : process.env;
51053
+ }
51054
+ function currentTtyState() {
51055
+ if (typeof process === "undefined")
51056
+ return false;
51057
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
51058
+ }
51059
+ function detectCi(env) {
51060
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
51061
+ if (!signature)
51062
+ return;
51063
+ return {
51064
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
51065
+ ciProvider: signature.provider
51066
+ };
51067
+ }
51068
+ function detectExecutionContext(options = {}) {
51069
+ const env = options.env ?? currentEnv();
51070
+ const ci = detectCi(env);
51071
+ if (ci)
51072
+ return ci;
51073
+ const agent = options.agent ?? detectAgentFromEnv(env);
51074
+ if (agent) {
51075
+ return { executionContext: "agent" };
51076
+ }
51077
+ const authSignal = options.authSignal ?? authSignalSlot.get();
51078
+ if (authSignal === "service_account") {
51079
+ return { executionContext: "service_account" };
51080
+ }
51081
+ const isTty = options.isTty ?? currentTtyState();
51082
+ if (isTty) {
51083
+ return { executionContext: "manual" };
51084
+ }
51085
+ return { executionContext: "unknown" };
51086
+ }
51087
+ function getExecutionContextTelemetryProperties() {
51088
+ const detected = detectExecutionContext();
51089
+ return {
51090
+ execution_context: detected.executionContext,
51091
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
51092
+ };
51093
+ }
50750
51094
 
50751
51095
  class NodeContextStorage {
50752
51096
  storage = new AsyncLocalStorage;
@@ -50757,6 +51101,25 @@ class NodeContextStorage {
50757
51101
  return this.storage.getStore();
50758
51102
  }
50759
51103
  }
51104
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
51105
+ var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
51106
+ var telemetrySessionIdSlot = singleton2("TelemetrySessionId");
51107
+ function getProcessEnv() {
51108
+ return globalThis.process?.env;
51109
+ }
51110
+ function normalizeSessionId(value) {
51111
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
51112
+ return;
51113
+ }
51114
+ const trimmed = String(value).trim();
51115
+ return trimmed || undefined;
51116
+ }
51117
+ function getConfiguredTelemetrySessionId() {
51118
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
51119
+ }
51120
+ function resolveTelemetrySessionId(existingSessionId) {
51121
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
51122
+ }
50760
51123
  var telemetryPropsSlot2 = singleton2("TelemetryDefaultProps");
50761
51124
  function getGlobalTelemetryProperties() {
50762
51125
  return telemetryPropsSlot2.get();
@@ -50839,12 +51202,22 @@ class TelemetryService {
50839
51202
  return this.contextStorage.getContext();
50840
51203
  }
50841
51204
  enrichPropertiesWithContext(properties, context) {
50842
- return {
50843
- ...getGlobalTelemetryProperties(),
51205
+ const globalProperties = getGlobalTelemetryProperties();
51206
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
51207
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
51208
+ const enriched = {
51209
+ ...getExecutionContextTelemetryProperties(),
51210
+ ...globalProperties,
50844
51211
  ...this.defaultProperties,
50845
51212
  ...properties,
50846
51213
  ...context
50847
51214
  };
51215
+ if (sessionId === undefined) {
51216
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
51217
+ } else {
51218
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
51219
+ }
51220
+ return enriched;
50848
51221
  }
50849
51222
  generateId() {
50850
51223
  return crypto.randomUUID().replaceAll("-", "");
@@ -51311,8 +51684,24 @@ var OutputFormatter;
51311
51684
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
51312
51685
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
51313
51686
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
51314
- const { SuppressTelemetry, ...envelope } = data;
51315
- if (!SuppressTelemetry) {
51687
+ recordCommandFailureTelemetry({
51688
+ result: data.Result,
51689
+ errorCode: data.ErrorCode,
51690
+ retry: data.Retry,
51691
+ message: data.Message,
51692
+ context: data.Context,
51693
+ exitCode: process.exitCode,
51694
+ errorClass: data.TelemetryErrorClass,
51695
+ terminalOutcome: data.TelemetryTerminalOutcome,
51696
+ terminalSignal: data.TelemetryTerminalSignal
51697
+ });
51698
+ const suppressTelemetry = data.SuppressTelemetry === true;
51699
+ const envelope = { ...data };
51700
+ delete envelope.SuppressTelemetry;
51701
+ delete envelope.TelemetryErrorClass;
51702
+ delete envelope.TelemetryTerminalOutcome;
51703
+ delete envelope.TelemetryTerminalSignal;
51704
+ if (!suppressTelemetry) {
51316
51705
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
51317
51706
  result: data.Result,
51318
51707
  errorCode: data.ErrorCode,
@@ -51374,6 +51763,156 @@ var OutputFormatter;
51374
51763
  }
51375
51764
  OutputFormatter2.formatToString = formatToString;
51376
51765
  })(OutputFormatter ||= {});
51766
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
51767
+ var MAX_SKILL_NAME_LENGTH = 80;
51768
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
51769
+ function productMode(productArea, mode) {
51770
+ return { product_area: productArea, mode };
51771
+ }
51772
+ function attributionRecord(groups) {
51773
+ const record = {};
51774
+ for (const [productArea, mode, names] of groups) {
51775
+ const attribution = productMode(productArea, mode);
51776
+ for (const name of names) {
51777
+ record[name] = attribution;
51778
+ }
51779
+ }
51780
+ return record;
51781
+ }
51782
+ function commandAttribution(groups) {
51783
+ const entries = [];
51784
+ for (const [productArea, mode, prefixes] of groups) {
51785
+ const attribution = productMode(productArea, mode);
51786
+ for (const prefix of prefixes) {
51787
+ entries.push({ prefix, attribution });
51788
+ }
51789
+ }
51790
+ return entries;
51791
+ }
51792
+ var SKILL_ATTRIBUTION = attributionRecord([
51793
+ ["admin", "operate", ["uipath-admin"]],
51794
+ ["agents", "build", ["uipath-agents"]],
51795
+ ["api-workflow", "build", ["uipath-api-workflow"]],
51796
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
51797
+ ["coded-apps", "build", ["uipath-coded-apps"]],
51798
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
51799
+ ["cli", "troubleshoot", ["uipath-feedback"]],
51800
+ ["governance", "operate", ["uipath-governance"]],
51801
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
51802
+ ["document-understanding", "build", ["uipath-ixp"]],
51803
+ [
51804
+ "maestro",
51805
+ "build",
51806
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
51807
+ ],
51808
+ ["agenthub", "build", ["uipath-mcp-servers"]],
51809
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
51810
+ ["platform", "operate", ["uipath-platform"]],
51811
+ ["quality", "troubleshoot", ["uipath-review"]],
51812
+ ["rpa", "build", ["uipath-rpa"]],
51813
+ ["cli", "operate", ["uipath-skill-catalog"]],
51814
+ ["action-center", "operate", ["uipath-tasks"]],
51815
+ ["test-manager", "operate", ["uipath-test"]],
51816
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
51817
+ ]);
51818
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
51819
+ var COMMAND_ATTRIBUTION = commandAttribution([
51820
+ ["cli", "troubleshoot", ["uip.feedback"]],
51821
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
51822
+ ["context-grounding", "build", ["uip.context-grounding"]],
51823
+ ["api-workflow", "build", ["uip.api-workflow"]],
51824
+ ["rpa", "build", ["uip.rpa-legacy"]],
51825
+ ["conversational", "operate", ["uip.conversational"]],
51826
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
51827
+ ["agenthub", "build", ["uip.agenthub"]],
51828
+ ["coded-apps", "build", ["uip.codedapp"]],
51829
+ ["functions", "build", ["uip.functions"]],
51830
+ ["solution", "build", ["uip.solution"]],
51831
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
51832
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
51833
+ ["platform", "operate", ["uip.platform"]],
51834
+ ["admin", "operate", ["uip.admin"]],
51835
+ ["automation-ops", "operate", ["uip.aops"]],
51836
+ ["documentation", "troubleshoot", ["uip.docsai"]],
51837
+ ["governance", "operate", ["uip.gov"]],
51838
+ ["insights", "operate", ["uip.insights"]],
51839
+ ["document-understanding", "build", ["uip.ixp"]],
51840
+ ["process-mining", "operate", ["uip.pm"]],
51841
+ ["action-center", "operate", ["uip.tasks"]],
51842
+ ["test-manager", "operate", ["uip.tm"]],
51843
+ ["vertical-solutions", "build", ["uip.vss"]],
51844
+ ["data-fabric", "operate", ["uip.df"]],
51845
+ ["integration-service", "build", ["uip.is"]],
51846
+ ["orchestrator", "operate", ["uip.or"]],
51847
+ [
51848
+ "cli",
51849
+ "operate",
51850
+ [
51851
+ "uip.login",
51852
+ "uip.logout",
51853
+ "uip.user",
51854
+ "uip.config",
51855
+ "uip.tools",
51856
+ "uip.skills",
51857
+ "uip.completion",
51858
+ "uip.update",
51859
+ "uip.mcp",
51860
+ "uip.track"
51861
+ ]
51862
+ ]
51863
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
51864
+ function normalizeCommandPath(value) {
51865
+ if (typeof value !== "string") {
51866
+ return;
51867
+ }
51868
+ const trimmed = value.trim().toLowerCase();
51869
+ if (!trimmed) {
51870
+ return;
51871
+ }
51872
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
51873
+ if (tokens.length === 0) {
51874
+ return;
51875
+ }
51876
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
51877
+ return commandTokens.join(".");
51878
+ }
51879
+ function getCommandProductModeAttribution(commandPath) {
51880
+ const normalized = normalizeCommandPath(commandPath);
51881
+ if (!normalized) {
51882
+ return;
51883
+ }
51884
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
51885
+ }
51886
+ function normalizeSkillNameWithOptions(value, options) {
51887
+ if (typeof value !== "string") {
51888
+ return;
51889
+ }
51890
+ const normalized = value.trim().toLowerCase();
51891
+ if (!normalized) {
51892
+ return;
51893
+ }
51894
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
51895
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
51896
+ return;
51897
+ }
51898
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
51899
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
51900
+ return;
51901
+ }
51902
+ return skillName;
51903
+ }
51904
+ function normalizeSkillName(value) {
51905
+ return normalizeSkillNameWithOptions(value, {
51906
+ allowLegacyNamespace: false
51907
+ });
51908
+ }
51909
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
51910
+ const skillName = normalizeSkillName(skillSource);
51911
+ return {
51912
+ ...skillName ? { skill_name: skillName } : {},
51913
+ ...getCommandProductModeAttribution(commandPath)
51914
+ };
51915
+ }
51377
51916
  var REDACTED = "[REDACTED]";
51378
51917
  var MAX_VALUE_LENGTH = 200;
51379
51918
  var SENSITIVE_NAME_TOKENS = new Set([
@@ -51556,6 +52095,12 @@ function commandHelpHint(commandPath) {
51556
52095
  const command = commandPath.replace(/\./g, " ");
51557
52096
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
51558
52097
  }
52098
+ function isPromptCancellation(error) {
52099
+ return error instanceof Error && error.name === "ExitPromptError";
52100
+ }
52101
+ function exitCodeFromProcess(fallback) {
52102
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
52103
+ }
51559
52104
  Command.prototype.trackedAction = function(context, fn, properties) {
51560
52105
  const command = this;
51561
52106
  return this.action(async (...args) => {
@@ -51563,6 +52108,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
51563
52108
  const props = typeof properties === "function" ? properties(...args) : properties;
51564
52109
  const startTime = performance.now();
51565
52110
  let errorMessage2;
52111
+ let fallbackExitCode = EXIT_CODES.Success;
52112
+ clearRecordedCommandFailureTelemetry();
51566
52113
  const [error] = await catchError2(fn(...args));
51567
52114
  if (error) {
51568
52115
  errorMessage2 = error instanceof Error ? error.message : String(error);
@@ -51577,6 +52124,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
51577
52124
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
51578
52125
  const typedContext = typed.context ?? typed.Context;
51579
52126
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
52127
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
52128
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
51580
52129
  OutputFormatter.error({
51581
52130
  Result: finalResult,
51582
52131
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -51585,16 +52134,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
51585
52134
  ...customRetry ? { Retry: customRetry } : {},
51586
52135
  ...customContext ? { Context: customContext } : {}
51587
52136
  });
51588
- context.exit(EXIT_CODES[finalResult]);
52137
+ context.exit(fallbackExitCode);
51589
52138
  }
51590
52139
  const durationMs = performance.now() - startTime;
51591
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
52140
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
52141
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
52142
+ const success = !error && exitCode === 0;
52143
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
52144
+ error,
52145
+ exitCode,
52146
+ recordedFailure,
52147
+ pollSignal: context.pollSignal
52148
+ });
51592
52149
  telemetry.trackEvent(telemetryName, redactProperties({
51593
52150
  ...extractCommandParams(command),
51594
52151
  ...props,
52152
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
51595
52153
  command: "true",
51596
52154
  duration: String(durationMs),
51597
52155
  success: String(success),
52156
+ ...terminalTelemetry,
51598
52157
  ...errorMessage2 ? { errorMessage: errorMessage2 } : {}
51599
52158
  }));
51600
52159
  });
@@ -51697,6 +52256,7 @@ var ScreenLogger;
51697
52256
  ScreenLogger2.progress = progress;
51698
52257
  })(ScreenLogger ||= {});
51699
52258
  var sdkUserAgentHostToken2 = singleton2("SdkUserAgentHostToken");
52259
+ var shippedKeysSlot = singleton2("ShipSucceededDedupeKeys");
51700
52260
  var factorySlot = singleton2("PackagerFactoryProvider");
51701
52261
  var LOCAL_THROW_INSTRUCTIONS = "Review the message above and adjust the command. Run with --help for usage.";
51702
52262
  async function reportError(error, loginInstructions) {
@@ -52885,7 +53445,7 @@ var registerCommands = async (program2) => {
52885
53445
  var package_default3 = {
52886
53446
  name: "@uipath/apms-tool",
52887
53447
  license: "MIT",
52888
- version: "1.197.0-preview.64",
53448
+ version: "1.197.0-preview.66",
52889
53449
  description: "CLI plugin for the UiPath Access Policy Management Service.",
52890
53450
  private: false,
52891
53451
  repository: {
@@ -55623,7 +56183,7 @@ var NETWORK_ERROR_CODES2 = new Set([
55623
56183
  "ENETUNREACH",
55624
56184
  "EAI_FAIL"
55625
56185
  ]);
55626
- var TLS_ERROR_CODES2 = new Set([
56186
+ var TLS_ERROR_CODES3 = new Set([
55627
56187
  "SELF_SIGNED_CERT_IN_CHAIN",
55628
56188
  "DEPTH_ZERO_SELF_SIGNED_CERT",
55629
56189
  "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
@@ -55641,7 +56201,7 @@ function describeConnectivityError2(error) {
55641
56201
  const cur = current;
55642
56202
  const code = typeof cur.code === "string" ? cur.code : undefined;
55643
56203
  const message = typeof cur.message === "string" ? cur.message : undefined;
55644
- if (code && TLS_ERROR_CODES2.has(code)) {
56204
+ if (code && TLS_ERROR_CODES3.has(code)) {
55645
56205
  return {
55646
56206
  code,
55647
56207
  kind: "tls",
@@ -55683,7 +56243,7 @@ function retryHintForRetryAfter2(seconds) {
55683
56243
  }
55684
56244
  return "RetryAfter60Seconds";
55685
56245
  }
55686
- function classifyError2(status, error) {
56246
+ function classifyError3(status, error) {
55687
56247
  if (status === 400 || status === 409 || status === 422) {
55688
56248
  return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
55689
56249
  }
@@ -55769,7 +56329,7 @@ async function extractErrorDetails2(error, options) {
55769
56329
  }
55770
56330
  let message;
55771
56331
  let result = "Failure";
55772
- const classification = classifyError2(status, error);
56332
+ const classification = classifyError3(status, error);
55773
56333
  let retry = classification.retry;
55774
56334
  if (status === 401) {
55775
56335
  message = DEFAULT_4012;
@@ -60854,9 +61414,228 @@ function getOutputFilter2() {
60854
61414
  return filterSlot2.get();
60855
61415
  }
60856
61416
 
61417
+ // ../../common/src/telemetry/command-terminal.ts
61418
+ var recordedFailureSlot2 = singleton3("CommandTelemetryFailure");
61419
+ var AUTH_ERROR_CODES2 = new Set([
61420
+ "authentication_required",
61421
+ "permission_denied"
61422
+ ]);
61423
+ var VALIDATION_ERROR_CODES2 = new Set(["invalid_argument"]);
61424
+ var NETWORK_HTTP_ERROR_CODES2 = new Set([
61425
+ "network_error",
61426
+ "rate_limited",
61427
+ "server_error",
61428
+ "not_found",
61429
+ "method_not_allowed"
61430
+ ]);
61431
+ var TIMEOUT_ERROR_CODES2 = new Set(["timeout"]);
61432
+ var NETWORK_OS_ERROR_CODES2 = new Set([
61433
+ "ECONNREFUSED",
61434
+ "ECONNRESET",
61435
+ "ENOTFOUND",
61436
+ "EAI_AGAIN",
61437
+ "EPIPE",
61438
+ "EHOSTUNREACH",
61439
+ "ENETUNREACH",
61440
+ "EAI_FAIL"
61441
+ ]);
61442
+ var TIMEOUT_OS_ERROR_CODES2 = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
61443
+ var TLS_ERROR_CODES5 = new Set([
61444
+ "SELF_SIGNED_CERT_IN_CHAIN",
61445
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
61446
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
61447
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
61448
+ "UNABLE_TO_GET_ISSUER_CERT",
61449
+ "CERT_HAS_EXPIRED",
61450
+ "CERT_UNTRUSTED",
61451
+ "ERR_TLS_CERT_ALTNAME_INVALID"
61452
+ ]);
61453
+ var MISSING_DEPENDENCY_CODES2 = new Set([
61454
+ "MODULE_NOT_FOUND",
61455
+ "ERR_MODULE_NOT_FOUND"
61456
+ ]);
61457
+ var INTERNAL_ERROR_NAMES2 = new Set([
61458
+ "TypeError",
61459
+ "ReferenceError",
61460
+ "SyntaxError",
61461
+ "RangeError"
61462
+ ]);
61463
+ function isRecord2(value) {
61464
+ return value !== null && typeof value === "object";
61465
+ }
61466
+ function stringField2(value, field) {
61467
+ if (!isRecord2(value)) {
61468
+ return;
61469
+ }
61470
+ const raw = value[field];
61471
+ return typeof raw === "string" ? raw : undefined;
61472
+ }
61473
+ function numberField2(value, field) {
61474
+ if (!isRecord2(value)) {
61475
+ return;
61476
+ }
61477
+ const raw = value[field];
61478
+ return typeof raw === "number" ? raw : undefined;
61479
+ }
61480
+ function findStringInCauseChain2(error, field) {
61481
+ let current = error;
61482
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
61483
+ const value = stringField2(current, field);
61484
+ if (value) {
61485
+ return value;
61486
+ }
61487
+ current = current.cause;
61488
+ }
61489
+ return;
61490
+ }
61491
+ function findCodeInCauseChain2(error) {
61492
+ return findStringInCauseChain2(error, "code");
61493
+ }
61494
+ function isSpawnEnoent2(error) {
61495
+ const code = findCodeInCauseChain2(error);
61496
+ if (code !== "ENOENT") {
61497
+ return false;
61498
+ }
61499
+ const syscall = findStringInCauseChain2(error, "syscall");
61500
+ return syscall?.startsWith("spawn") === true;
61501
+ }
61502
+ function isCancellationError2(error, exitCode, pollSignal) {
61503
+ if (exitCode === 130) {
61504
+ return true;
61505
+ }
61506
+ if (!isRecord2(error)) {
61507
+ return false;
61508
+ }
61509
+ if (numberField2(error, "exitCode") === 130) {
61510
+ return true;
61511
+ }
61512
+ const name = stringField2(error, "name");
61513
+ if (name === "ExitPromptError") {
61514
+ return true;
61515
+ }
61516
+ if (name === "AbortError" && pollSignal?.aborted) {
61517
+ return true;
61518
+ }
61519
+ const message = stringField2(error, "message");
61520
+ return message?.includes("SIGINT") === true;
61521
+ }
61522
+ function terminalSignalFor2(input, outcome) {
61523
+ if (input.recordedFailure?.terminalSignal) {
61524
+ return input.recordedFailure.terminalSignal;
61525
+ }
61526
+ const explicit = findStringInCauseChain2(input.error, "terminalSignal") ?? findStringInCauseChain2(input.error, "signal");
61527
+ if (explicit) {
61528
+ return explicit;
61529
+ }
61530
+ return outcome === "cancelled" ? "SIGINT" : undefined;
61531
+ }
61532
+ function classifyHttpStatus2(status) {
61533
+ if (status === 401 || status === 403) {
61534
+ return "auth";
61535
+ }
61536
+ if (status === 400 || status === 409 || status === 422) {
61537
+ return "validation";
61538
+ }
61539
+ if (status === 408) {
61540
+ return "timeout";
61541
+ }
61542
+ return "network_http";
61543
+ }
61544
+ function classifyFromResult2(result) {
61545
+ switch (result) {
61546
+ case "AuthenticationError":
61547
+ return "auth";
61548
+ case "ValidationError":
61549
+ return "validation";
61550
+ case "TimeoutError":
61551
+ return "timeout";
61552
+ default:
61553
+ return;
61554
+ }
61555
+ }
61556
+ function classifyFromErrorCode2(errorCode3) {
61557
+ if (!errorCode3) {
61558
+ return;
61559
+ }
61560
+ if (AUTH_ERROR_CODES2.has(errorCode3)) {
61561
+ return "auth";
61562
+ }
61563
+ if (VALIDATION_ERROR_CODES2.has(errorCode3)) {
61564
+ return "validation";
61565
+ }
61566
+ if (TIMEOUT_ERROR_CODES2.has(errorCode3)) {
61567
+ return "timeout";
61568
+ }
61569
+ if (NETWORK_HTTP_ERROR_CODES2.has(errorCode3)) {
61570
+ return "network_http";
61571
+ }
61572
+ return;
61573
+ }
61574
+ function classifyFromError2(error) {
61575
+ const code = findCodeInCauseChain2(error);
61576
+ if (code) {
61577
+ if (code.startsWith("commander.")) {
61578
+ return "validation";
61579
+ }
61580
+ if (NETWORK_OS_ERROR_CODES2.has(code) || TLS_ERROR_CODES5.has(code)) {
61581
+ return "network_http";
61582
+ }
61583
+ if (TIMEOUT_OS_ERROR_CODES2.has(code)) {
61584
+ return "timeout";
61585
+ }
61586
+ if (MISSING_DEPENDENCY_CODES2.has(code) || isSpawnEnoent2(error)) {
61587
+ return "missing_dependency";
61588
+ }
61589
+ }
61590
+ const message = stringField2(error, "message");
61591
+ if (message?.includes("fetch failed") === true) {
61592
+ return "network_http";
61593
+ }
61594
+ const name = stringField2(error, "name");
61595
+ if (name && INTERNAL_ERROR_NAMES2.has(name)) {
61596
+ return "internal";
61597
+ }
61598
+ return;
61599
+ }
61600
+ function classifyError5(input) {
61601
+ const recorded = input.recordedFailure;
61602
+ if (recorded?.errorClass) {
61603
+ return recorded.errorClass;
61604
+ }
61605
+ const status = recorded?.context?.httpStatus;
61606
+ if (status !== undefined) {
61607
+ return classifyHttpStatus2(status);
61608
+ }
61609
+ return classifyFromResult2(recorded?.result) ?? classifyFromErrorCode2(recorded?.errorCode) ?? classifyFromError2(input.error) ?? "unknown";
61610
+ }
61611
+ function recordCommandFailureTelemetry2(failure) {
61612
+ recordedFailureSlot2.set(failure);
61613
+ }
61614
+ function clearRecordedCommandFailureTelemetry2() {
61615
+ recordedFailureSlot2.clear();
61616
+ }
61617
+ function takeRecordedCommandFailureTelemetry2() {
61618
+ const failure = recordedFailureSlot2.get();
61619
+ recordedFailureSlot2.clear();
61620
+ return failure;
61621
+ }
61622
+ function buildCommandTerminalTelemetryProperties2(input) {
61623
+ const cancelled = isCancellationError2(input.error, input.exitCode, input.pollSignal);
61624
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
61625
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError5(input);
61626
+ const terminalSignal = terminalSignalFor2(input, outcome);
61627
+ return {
61628
+ exit_code: input.exitCode,
61629
+ terminal_outcome: outcome,
61630
+ ...errorClass ? { error_class: errorClass } : {},
61631
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
61632
+ };
61633
+ }
61634
+
60857
61635
  // ../../common/src/telemetry/telemetry-events.ts
60858
61636
  var CommonTelemetryEvents2 = {
60859
- Error: "uip.error"
61637
+ Error: "uip.error",
61638
+ ShipSucceeded: "ship_succeeded"
60860
61639
  };
60861
61640
 
60862
61641
  // ../../common/src/registry.ts
@@ -60923,6 +61702,136 @@ function formatMessage2(category, name, properties) {
60923
61702
  }
60924
61703
  return message;
60925
61704
  }
61705
+ // ../../common/src/telemetry/detect-agent.ts
61706
+ var KNOWN_AGENTS2 = [
61707
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
61708
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
61709
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
61710
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
61711
+ { envVar: "CODEX_SANDBOX", id: "codex" },
61712
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
61713
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
61714
+ ];
61715
+ function detectAgentFromEnv2(env) {
61716
+ for (const agent of KNOWN_AGENTS2) {
61717
+ const envValue = env[agent.envVar];
61718
+ if (agent.value !== undefined) {
61719
+ if (envValue === agent.value)
61720
+ return agent.id;
61721
+ } else {
61722
+ if (envValue)
61723
+ return agent.id;
61724
+ }
61725
+ }
61726
+ const agentEnv = env.AGENT;
61727
+ if (agentEnv) {
61728
+ if (agentEnv === "1" || agentEnv === "true")
61729
+ return "unknown";
61730
+ if (agentEnv.length <= 32)
61731
+ return agentEnv.toLowerCase();
61732
+ }
61733
+ return;
61734
+ }
61735
+ // ../../common/src/telemetry/environment-info.ts
61736
+ var LOCAL_HOSTS2 = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
61737
+ // ../../common/src/telemetry/execution-context.ts
61738
+ var authSignalSlot2 = singleton3("TelemetryExecutionContextAuthSignal");
61739
+ var isTruthy2 = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
61740
+ var isEqual2 = (value, expected) => value?.toLowerCase() === expected;
61741
+ var CI_SIGNATURES2 = [
61742
+ {
61743
+ provider: "github_actions",
61744
+ matches: (env) => isTruthy2(env.GITHUB_ACTIONS),
61745
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
61746
+ },
61747
+ {
61748
+ provider: "azure_devops",
61749
+ matches: (env) => isTruthy2(env.TF_BUILD),
61750
+ isScheduler: (env) => isEqual2(env.BUILD_REASON, "schedule")
61751
+ },
61752
+ {
61753
+ provider: "gitlab",
61754
+ matches: (env) => isTruthy2(env.GITLAB_CI),
61755
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
61756
+ },
61757
+ {
61758
+ provider: "circleci",
61759
+ matches: (env) => isTruthy2(env.CIRCLECI),
61760
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
61761
+ },
61762
+ {
61763
+ provider: "jenkins",
61764
+ matches: (env) => isTruthy2(env.JENKINS_URL) || isTruthy2(env.JENKINS_HOME)
61765
+ },
61766
+ {
61767
+ provider: "teamcity",
61768
+ matches: (env) => isTruthy2(env.TEAMCITY_VERSION)
61769
+ },
61770
+ {
61771
+ provider: "buildkite",
61772
+ matches: (env) => isTruthy2(env.BUILDKITE),
61773
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
61774
+ },
61775
+ {
61776
+ provider: "bitbucket",
61777
+ matches: (env) => isTruthy2(env.BITBUCKET_BUILD_NUMBER)
61778
+ },
61779
+ {
61780
+ provider: "travis",
61781
+ matches: (env) => isTruthy2(env.TRAVIS)
61782
+ },
61783
+ {
61784
+ provider: "appveyor",
61785
+ matches: (env) => isTruthy2(env.APPVEYOR)
61786
+ },
61787
+ {
61788
+ provider: "generic",
61789
+ matches: (env) => isTruthy2(env.CI)
61790
+ }
61791
+ ];
61792
+ function currentEnv2() {
61793
+ return typeof process === "undefined" ? {} : process.env;
61794
+ }
61795
+ function currentTtyState2() {
61796
+ if (typeof process === "undefined")
61797
+ return false;
61798
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
61799
+ }
61800
+ function detectCi2(env) {
61801
+ const signature = CI_SIGNATURES2.find((candidate) => candidate.matches(env));
61802
+ if (!signature)
61803
+ return;
61804
+ return {
61805
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
61806
+ ciProvider: signature.provider
61807
+ };
61808
+ }
61809
+ function detectExecutionContext2(options = {}) {
61810
+ const env = options.env ?? currentEnv2();
61811
+ const ci = detectCi2(env);
61812
+ if (ci)
61813
+ return ci;
61814
+ const agent = options.agent ?? detectAgentFromEnv2(env);
61815
+ if (agent) {
61816
+ return { executionContext: "agent" };
61817
+ }
61818
+ const authSignal = options.authSignal ?? authSignalSlot2.get();
61819
+ if (authSignal === "service_account") {
61820
+ return { executionContext: "service_account" };
61821
+ }
61822
+ const isTty = options.isTty ?? currentTtyState2();
61823
+ if (isTty) {
61824
+ return { executionContext: "manual" };
61825
+ }
61826
+ return { executionContext: "unknown" };
61827
+ }
61828
+ function getExecutionContextTelemetryProperties2() {
61829
+ const detected = detectExecutionContext2();
61830
+ return {
61831
+ execution_context: detected.executionContext,
61832
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
61833
+ };
61834
+ }
60926
61835
  // ../../common/src/telemetry/node-context-storage.ts
60927
61836
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
60928
61837
 
@@ -60935,6 +61844,26 @@ class NodeContextStorage2 {
60935
61844
  return this.storage.getStore();
60936
61845
  }
60937
61846
  }
61847
+ // ../../common/src/telemetry/session-id.ts
61848
+ var TELEMETRY_SESSION_ID_ENV2 = "UIPATH_SESSION_ID";
61849
+ var TELEMETRY_SESSION_ID_PROPERTY2 = "session_id";
61850
+ var telemetrySessionIdSlot2 = singleton3("TelemetrySessionId");
61851
+ function getProcessEnv2() {
61852
+ return globalThis.process?.env;
61853
+ }
61854
+ function normalizeSessionId2(value) {
61855
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
61856
+ return;
61857
+ }
61858
+ const trimmed = String(value).trim();
61859
+ return trimmed || undefined;
61860
+ }
61861
+ function getConfiguredTelemetrySessionId2() {
61862
+ return normalizeSessionId2(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV2]);
61863
+ }
61864
+ function resolveTelemetrySessionId2(existingSessionId) {
61865
+ return getConfiguredTelemetrySessionId2() ?? normalizeSessionId2(existingSessionId);
61866
+ }
60938
61867
  // ../../common/src/telemetry/telemetry-service.ts
60939
61868
  class TelemetryService2 {
60940
61869
  telemetryProvider;
@@ -61013,12 +61942,22 @@ class TelemetryService2 {
61013
61942
  return this.contextStorage.getContext();
61014
61943
  }
61015
61944
  enrichPropertiesWithContext(properties, context) {
61016
- return {
61017
- ...getGlobalTelemetryProperties2(),
61945
+ const globalProperties = getGlobalTelemetryProperties2();
61946
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY2] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY2] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY2];
61947
+ const sessionId = resolveTelemetrySessionId2(existingSessionId);
61948
+ const enriched = {
61949
+ ...getExecutionContextTelemetryProperties2(),
61950
+ ...globalProperties,
61018
61951
  ...this.defaultProperties,
61019
61952
  ...properties,
61020
61953
  ...context
61021
61954
  };
61955
+ if (sessionId === undefined) {
61956
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY2];
61957
+ } else {
61958
+ enriched[TELEMETRY_SESSION_ID_PROPERTY2] = sessionId;
61959
+ }
61960
+ return enriched;
61022
61961
  }
61023
61962
  generateId() {
61024
61963
  return crypto.randomUUID().replaceAll("-", "");
@@ -61488,8 +62427,24 @@ var OutputFormatter2;
61488
62427
  data.ErrorCode ??= defaultErrorCodeForFailure2(data);
61489
62428
  data.Retry ??= defaultRetryForErrorCode2(data.ErrorCode);
61490
62429
  process.exitCode = EXIT_CODES2[data.Result] ?? 1;
61491
- const { SuppressTelemetry, ...envelope } = data;
61492
- if (!SuppressTelemetry) {
62430
+ recordCommandFailureTelemetry2({
62431
+ result: data.Result,
62432
+ errorCode: data.ErrorCode,
62433
+ retry: data.Retry,
62434
+ message: data.Message,
62435
+ context: data.Context,
62436
+ exitCode: process.exitCode,
62437
+ errorClass: data.TelemetryErrorClass,
62438
+ terminalOutcome: data.TelemetryTerminalOutcome,
62439
+ terminalSignal: data.TelemetryTerminalSignal
62440
+ });
62441
+ const suppressTelemetry = data.SuppressTelemetry === true;
62442
+ const envelope = { ...data };
62443
+ delete envelope.SuppressTelemetry;
62444
+ delete envelope.TelemetryErrorClass;
62445
+ delete envelope.TelemetryTerminalOutcome;
62446
+ delete envelope.TelemetryTerminalSignal;
62447
+ if (!suppressTelemetry) {
61493
62448
  telemetry2.trackEvent(CommonTelemetryEvents2.Error, {
61494
62449
  result: data.Result,
61495
62450
  errorCode: data.ErrorCode,
@@ -61552,6 +62507,158 @@ var OutputFormatter2;
61552
62507
  OutputFormatter.formatToString = formatToString;
61553
62508
  })(OutputFormatter2 ||= {});
61554
62509
 
62510
+ // ../../common/src/telemetry/command-attribution.ts
62511
+ var LEGACY_SKILL_NAMESPACE2 = "uipath:";
62512
+ var MAX_SKILL_NAME_LENGTH2 = 80;
62513
+ var SKILL_NAME_PATTERN2 = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
62514
+ function productMode2(productArea, mode) {
62515
+ return { product_area: productArea, mode };
62516
+ }
62517
+ function attributionRecord2(groups) {
62518
+ const record = {};
62519
+ for (const [productArea, mode, names] of groups) {
62520
+ const attribution = productMode2(productArea, mode);
62521
+ for (const name of names) {
62522
+ record[name] = attribution;
62523
+ }
62524
+ }
62525
+ return record;
62526
+ }
62527
+ function commandAttribution2(groups) {
62528
+ const entries = [];
62529
+ for (const [productArea, mode, prefixes] of groups) {
62530
+ const attribution = productMode2(productArea, mode);
62531
+ for (const prefix of prefixes) {
62532
+ entries.push({ prefix, attribution });
62533
+ }
62534
+ }
62535
+ return entries;
62536
+ }
62537
+ var SKILL_ATTRIBUTION2 = attributionRecord2([
62538
+ ["admin", "operate", ["uipath-admin"]],
62539
+ ["agents", "build", ["uipath-agents"]],
62540
+ ["api-workflow", "build", ["uipath-api-workflow"]],
62541
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
62542
+ ["coded-apps", "build", ["uipath-coded-apps"]],
62543
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
62544
+ ["cli", "troubleshoot", ["uipath-feedback"]],
62545
+ ["governance", "operate", ["uipath-governance"]],
62546
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
62547
+ ["document-understanding", "build", ["uipath-ixp"]],
62548
+ [
62549
+ "maestro",
62550
+ "build",
62551
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
62552
+ ],
62553
+ ["agenthub", "build", ["uipath-mcp-servers"]],
62554
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
62555
+ ["platform", "operate", ["uipath-platform"]],
62556
+ ["quality", "troubleshoot", ["uipath-review"]],
62557
+ ["rpa", "build", ["uipath-rpa"]],
62558
+ ["cli", "operate", ["uipath-skill-catalog"]],
62559
+ ["action-center", "operate", ["uipath-tasks"]],
62560
+ ["test-manager", "operate", ["uipath-test"]],
62561
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
62562
+ ]);
62563
+ var KNOWN_SKILL_NAMES2 = new Set(Object.keys(SKILL_ATTRIBUTION2));
62564
+ var COMMAND_ATTRIBUTION2 = commandAttribution2([
62565
+ ["cli", "troubleshoot", ["uip.feedback"]],
62566
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
62567
+ ["context-grounding", "build", ["uip.context-grounding"]],
62568
+ ["api-workflow", "build", ["uip.api-workflow"]],
62569
+ ["rpa", "build", ["uip.rpa-legacy"]],
62570
+ ["conversational", "operate", ["uip.conversational"]],
62571
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
62572
+ ["agenthub", "build", ["uip.agenthub"]],
62573
+ ["coded-apps", "build", ["uip.codedapp"]],
62574
+ ["functions", "build", ["uip.functions"]],
62575
+ ["solution", "build", ["uip.solution"]],
62576
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
62577
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
62578
+ ["platform", "operate", ["uip.platform"]],
62579
+ ["admin", "operate", ["uip.admin"]],
62580
+ ["automation-ops", "operate", ["uip.aops"]],
62581
+ ["documentation", "troubleshoot", ["uip.docsai"]],
62582
+ ["governance", "operate", ["uip.gov"]],
62583
+ ["insights", "operate", ["uip.insights"]],
62584
+ ["document-understanding", "build", ["uip.ixp"]],
62585
+ ["process-mining", "operate", ["uip.pm"]],
62586
+ ["action-center", "operate", ["uip.tasks"]],
62587
+ ["test-manager", "operate", ["uip.tm"]],
62588
+ ["vertical-solutions", "build", ["uip.vss"]],
62589
+ ["data-fabric", "operate", ["uip.df"]],
62590
+ ["integration-service", "build", ["uip.is"]],
62591
+ ["orchestrator", "operate", ["uip.or"]],
62592
+ [
62593
+ "cli",
62594
+ "operate",
62595
+ [
62596
+ "uip.login",
62597
+ "uip.logout",
62598
+ "uip.user",
62599
+ "uip.config",
62600
+ "uip.tools",
62601
+ "uip.skills",
62602
+ "uip.completion",
62603
+ "uip.update",
62604
+ "uip.mcp",
62605
+ "uip.track"
62606
+ ]
62607
+ ]
62608
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
62609
+ function normalizeCommandPath2(value) {
62610
+ if (typeof value !== "string") {
62611
+ return;
62612
+ }
62613
+ const trimmed = value.trim().toLowerCase();
62614
+ if (!trimmed) {
62615
+ return;
62616
+ }
62617
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
62618
+ if (tokens.length === 0) {
62619
+ return;
62620
+ }
62621
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
62622
+ return commandTokens.join(".");
62623
+ }
62624
+ function getCommandProductModeAttribution2(commandPath) {
62625
+ const normalized = normalizeCommandPath2(commandPath);
62626
+ if (!normalized) {
62627
+ return;
62628
+ }
62629
+ return COMMAND_ATTRIBUTION2.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
62630
+ }
62631
+ function normalizeSkillNameWithOptions2(value, options) {
62632
+ if (typeof value !== "string") {
62633
+ return;
62634
+ }
62635
+ const normalized = value.trim().toLowerCase();
62636
+ if (!normalized) {
62637
+ return;
62638
+ }
62639
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE2);
62640
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
62641
+ return;
62642
+ }
62643
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE2.length) : normalized;
62644
+ if (skillName.length > MAX_SKILL_NAME_LENGTH2 || !SKILL_NAME_PATTERN2.test(skillName) || !KNOWN_SKILL_NAMES2.has(skillName)) {
62645
+ return;
62646
+ }
62647
+ return skillName;
62648
+ }
62649
+ function normalizeSkillName2(value) {
62650
+ return normalizeSkillNameWithOptions2(value, {
62651
+ allowLegacyNamespace: false
62652
+ });
62653
+ }
62654
+ function buildCommandTelemetryAttribution2(commandPath, skillSource) {
62655
+ const skillName = normalizeSkillName2(skillSource);
62656
+ return {
62657
+ ...skillName ? { skill_name: skillName } : {},
62658
+ ...getCommandProductModeAttribution2(commandPath)
62659
+ };
62660
+ }
62661
+
61555
62662
  // ../../common/src/telemetry/pii-redactor.ts
61556
62663
  var REDACTED2 = "[REDACTED]";
61557
62664
  var MAX_VALUE_LENGTH2 = 200;
@@ -61737,6 +62844,12 @@ function commandHelpHint2(commandPath) {
61737
62844
  const command = commandPath.replace(/\./g, " ");
61738
62845
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
61739
62846
  }
62847
+ function isPromptCancellation2(error) {
62848
+ return error instanceof Error && error.name === "ExitPromptError";
62849
+ }
62850
+ function exitCodeFromProcess2(fallback) {
62851
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
62852
+ }
61740
62853
  Command.prototype.trackedAction = function(context, fn, properties) {
61741
62854
  const command = this;
61742
62855
  return this.action(async (...args) => {
@@ -61744,6 +62857,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
61744
62857
  const props = typeof properties === "function" ? properties(...args) : properties;
61745
62858
  const startTime = performance.now();
61746
62859
  let errorMessage4;
62860
+ let fallbackExitCode = EXIT_CODES2.Success;
62861
+ clearRecordedCommandFailureTelemetry2();
61747
62862
  const [error] = await catchError5(fn(...args));
61748
62863
  if (error) {
61749
62864
  errorMessage4 = error instanceof Error ? error.message : String(error);
@@ -61758,6 +62873,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
61758
62873
  const customRetry = isRetryHint2(typedRetry) ? typedRetry : undefined;
61759
62874
  const typedContext = typed.context ?? typed.Context;
61760
62875
  const customContext = isErrorContext2(typedContext) ? typedContext : undefined;
62876
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation2(error) ? 130 : undefined;
62877
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES2[finalResult];
61761
62878
  OutputFormatter2.error({
61762
62879
  Result: finalResult,
61763
62880
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -61766,16 +62883,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
61766
62883
  ...customRetry ? { Retry: customRetry } : {},
61767
62884
  ...customContext ? { Context: customContext } : {}
61768
62885
  });
61769
- context.exit(EXIT_CODES2[finalResult]);
62886
+ context.exit(fallbackExitCode);
61770
62887
  }
61771
62888
  const durationMs = performance.now() - startTime;
61772
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
62889
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess2(fallbackExitCode);
62890
+ const recordedFailure = takeRecordedCommandFailureTelemetry2();
62891
+ const success = !error && exitCode === 0;
62892
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties2({
62893
+ error,
62894
+ exitCode,
62895
+ recordedFailure,
62896
+ pollSignal: context.pollSignal
62897
+ });
61773
62898
  telemetry2.trackEvent(telemetryName, redactProperties2({
61774
62899
  ...extractCommandParams2(command),
61775
62900
  ...props,
62901
+ ...buildCommandTelemetryAttribution2(telemetryName, process.env.UIPATH_SKILL),
61776
62902
  command: "true",
61777
62903
  duration: String(durationMs),
61778
62904
  success: String(success),
62905
+ ...terminalTelemetry,
61779
62906
  ...errorMessage4 ? { errorMessage: errorMessage4 } : {}
61780
62907
  }));
61781
62908
  });
@@ -61900,6 +63027,8 @@ var ScreenLogger2;
61900
63027
  }
61901
63028
  ScreenLogger.progress = progress;
61902
63029
  })(ScreenLogger2 ||= {});
63030
+ // ../../common/src/telemetry/ship-succeeded.ts
63031
+ var shippedKeysSlot2 = singleton3("ShipSucceededDedupeKeys");
61903
63032
  // ../../common/src/tool-provider.ts
61904
63033
  var factorySlot2 = singleton3("PackagerFactoryProvider");
61905
63034
  // ../apms-tool/src/commands/_shared.ts
@@ -63041,7 +64170,7 @@ var registerCommands2 = async (program2) => {
63041
64170
  var package_default6 = {
63042
64171
  name: "@uipath/audit-tool",
63043
64172
  license: "MIT",
63044
- version: "1.197.0-preview.64",
64173
+ version: "1.197.0-preview.66",
63045
64174
  description: "CLI plugin for the UiPath Audit Service — query event sources, paginate events, and export ZIPs from the long-term store.",
63046
64175
  private: false,
63047
64176
  repository: {
@@ -64298,7 +65427,7 @@ var registerCommands3 = async (program2) => {
64298
65427
  var package_default8 = {
64299
65428
  name: "@uipath/authz-tool",
64300
65429
  license: "MIT",
64301
- version: "1.197.0-preview.64",
65430
+ version: "1.197.0-preview.66",
64302
65431
  description: "CLI plugin for the UiPath Authorization service.",
64303
65432
  private: false,
64304
65433
  repository: {
@@ -69909,7 +71038,7 @@ var registerCommands4 = async (program2) => {
69909
71038
  var package_default11 = {
69910
71039
  name: "@uipath/identity-tool",
69911
71040
  license: "MIT",
69912
- version: "1.197.0-preview.64",
71041
+ version: "1.197.0-preview.66",
69913
71042
  description: "Manage Identity Server users, groups, robot accounts, and external apps.",
69914
71043
  private: false,
69915
71044
  repository: {
@@ -72278,7 +73407,7 @@ var registerCommands5 = async (program2) => {
72278
73407
  var package_default12 = {
72279
73408
  name: "@uipath/oms-tool",
72280
73409
  license: "MIT",
72281
- version: "1.197.0-preview.64",
73410
+ version: "1.197.0-preview.66",
72282
73411
  description: "CLI plugin for the UiPath Organization Management Service.",
72283
73412
  private: false,
72284
73413
  repository: {
@@ -78809,7 +79938,7 @@ var registerCommands6 = async (program2) => {
78809
79938
  var package_default14 = {
78810
79939
  name: "@uipath/resourcecatalog-tool",
78811
79940
  license: "MIT",
78812
- version: "1.197.0-preview.64",
79941
+ version: "1.197.0-preview.66",
78813
79942
  description: "CLI plugin for the UiPath Resource Catalog Service.",
78814
79943
  private: false,
78815
79944
  repository: {
@@ -80757,7 +81886,7 @@ var registerCommands7 = async (program2) => {
80757
81886
  var package_default16 = {
80758
81887
  name: "@uipath/admin-tool",
80759
81888
  license: "MIT",
80760
- version: "1.197.0-preview.64",
81889
+ version: "1.197.0-preview.66",
80761
81890
  description: "Manage UiPath admin resources — Identity Server, Resource Catalog Service, Audit Service, VPN Gateway.",
80762
81891
  private: false,
80763
81892
  repository: {
@@ -80822,4 +81951,4 @@ export {
80822
81951
  metadata8 as metadata
80823
81952
  };
80824
81953
 
80825
- //# debugId=5F1D18DAE957EF8364756E2164756E21
81954
+ //# debugId=DDF87A51BD6B37DC64756E2164756E21