@uipath/agenthub-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 (2) hide show
  1. package/dist/tool.js +618 -12
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -8332,11 +8332,234 @@ var init_output_format_context = __esm(() => {
8332
8332
  filterSlot = singleton2("OutputFilter");
8333
8333
  });
8334
8334
 
8335
+ // ../common/src/telemetry/command-terminal.ts
8336
+ function isRecord(value) {
8337
+ return value !== null && typeof value === "object";
8338
+ }
8339
+ function stringField(value, field) {
8340
+ if (!isRecord(value)) {
8341
+ return;
8342
+ }
8343
+ const raw = value[field];
8344
+ return typeof raw === "string" ? raw : undefined;
8345
+ }
8346
+ function numberField(value, field) {
8347
+ if (!isRecord(value)) {
8348
+ return;
8349
+ }
8350
+ const raw = value[field];
8351
+ return typeof raw === "number" ? raw : undefined;
8352
+ }
8353
+ function findStringInCauseChain(error, field) {
8354
+ let current = error;
8355
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
8356
+ const value = stringField(current, field);
8357
+ if (value) {
8358
+ return value;
8359
+ }
8360
+ current = current.cause;
8361
+ }
8362
+ return;
8363
+ }
8364
+ function findCodeInCauseChain(error) {
8365
+ return findStringInCauseChain(error, "code");
8366
+ }
8367
+ function isSpawnEnoent(error) {
8368
+ const code = findCodeInCauseChain(error);
8369
+ if (code !== "ENOENT") {
8370
+ return false;
8371
+ }
8372
+ const syscall = findStringInCauseChain(error, "syscall");
8373
+ return syscall?.startsWith("spawn") === true;
8374
+ }
8375
+ function isCancellationError(error, exitCode, pollSignal) {
8376
+ if (exitCode === 130) {
8377
+ return true;
8378
+ }
8379
+ if (!isRecord(error)) {
8380
+ return false;
8381
+ }
8382
+ if (numberField(error, "exitCode") === 130) {
8383
+ return true;
8384
+ }
8385
+ const name = stringField(error, "name");
8386
+ if (name === "ExitPromptError") {
8387
+ return true;
8388
+ }
8389
+ if (name === "AbortError" && pollSignal?.aborted) {
8390
+ return true;
8391
+ }
8392
+ const message = stringField(error, "message");
8393
+ return message?.includes("SIGINT") === true;
8394
+ }
8395
+ function terminalSignalFor(input, outcome) {
8396
+ if (input.recordedFailure?.terminalSignal) {
8397
+ return input.recordedFailure.terminalSignal;
8398
+ }
8399
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
8400
+ if (explicit) {
8401
+ return explicit;
8402
+ }
8403
+ return outcome === "cancelled" ? "SIGINT" : undefined;
8404
+ }
8405
+ function classifyHttpStatus(status) {
8406
+ if (status === 401 || status === 403) {
8407
+ return "auth";
8408
+ }
8409
+ if (status === 400 || status === 409 || status === 422) {
8410
+ return "validation";
8411
+ }
8412
+ if (status === 408) {
8413
+ return "timeout";
8414
+ }
8415
+ return "network_http";
8416
+ }
8417
+ function classifyFromResult(result) {
8418
+ switch (result) {
8419
+ case "AuthenticationError":
8420
+ return "auth";
8421
+ case "ValidationError":
8422
+ return "validation";
8423
+ case "TimeoutError":
8424
+ return "timeout";
8425
+ default:
8426
+ return;
8427
+ }
8428
+ }
8429
+ function classifyFromErrorCode(errorCode2) {
8430
+ if (!errorCode2) {
8431
+ return;
8432
+ }
8433
+ if (AUTH_ERROR_CODES.has(errorCode2)) {
8434
+ return "auth";
8435
+ }
8436
+ if (VALIDATION_ERROR_CODES.has(errorCode2)) {
8437
+ return "validation";
8438
+ }
8439
+ if (TIMEOUT_ERROR_CODES.has(errorCode2)) {
8440
+ return "timeout";
8441
+ }
8442
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode2)) {
8443
+ return "network_http";
8444
+ }
8445
+ return;
8446
+ }
8447
+ function classifyFromError(error) {
8448
+ const code = findCodeInCauseChain(error);
8449
+ if (code) {
8450
+ if (code.startsWith("commander.")) {
8451
+ return "validation";
8452
+ }
8453
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
8454
+ return "network_http";
8455
+ }
8456
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
8457
+ return "timeout";
8458
+ }
8459
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
8460
+ return "missing_dependency";
8461
+ }
8462
+ }
8463
+ const message = stringField(error, "message");
8464
+ if (message?.includes("fetch failed") === true) {
8465
+ return "network_http";
8466
+ }
8467
+ const name = stringField(error, "name");
8468
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
8469
+ return "internal";
8470
+ }
8471
+ return;
8472
+ }
8473
+ function classifyError2(input) {
8474
+ const recorded = input.recordedFailure;
8475
+ if (recorded?.errorClass) {
8476
+ return recorded.errorClass;
8477
+ }
8478
+ const status = recorded?.context?.httpStatus;
8479
+ if (status !== undefined) {
8480
+ return classifyHttpStatus(status);
8481
+ }
8482
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
8483
+ }
8484
+ function recordCommandFailureTelemetry(failure) {
8485
+ recordedFailureSlot.set(failure);
8486
+ }
8487
+ function clearRecordedCommandFailureTelemetry() {
8488
+ recordedFailureSlot.clear();
8489
+ }
8490
+ function takeRecordedCommandFailureTelemetry() {
8491
+ const failure = recordedFailureSlot.get();
8492
+ recordedFailureSlot.clear();
8493
+ return failure;
8494
+ }
8495
+ function buildCommandTerminalTelemetryProperties(input) {
8496
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
8497
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
8498
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
8499
+ const terminalSignal = terminalSignalFor(input, outcome);
8500
+ return {
8501
+ exit_code: input.exitCode,
8502
+ terminal_outcome: outcome,
8503
+ ...errorClass ? { error_class: errorClass } : {},
8504
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
8505
+ };
8506
+ }
8507
+ var recordedFailureSlot, AUTH_ERROR_CODES, VALIDATION_ERROR_CODES, NETWORK_HTTP_ERROR_CODES, TIMEOUT_ERROR_CODES, NETWORK_OS_ERROR_CODES, TIMEOUT_OS_ERROR_CODES, TLS_ERROR_CODES2, MISSING_DEPENDENCY_CODES, INTERNAL_ERROR_NAMES;
8508
+ var init_command_terminal = __esm(() => {
8509
+ init_singleton();
8510
+ recordedFailureSlot = singleton2("CommandTelemetryFailure");
8511
+ AUTH_ERROR_CODES = new Set([
8512
+ "authentication_required",
8513
+ "permission_denied"
8514
+ ]);
8515
+ VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
8516
+ NETWORK_HTTP_ERROR_CODES = new Set([
8517
+ "network_error",
8518
+ "rate_limited",
8519
+ "server_error",
8520
+ "not_found",
8521
+ "method_not_allowed"
8522
+ ]);
8523
+ TIMEOUT_ERROR_CODES = new Set(["timeout"]);
8524
+ NETWORK_OS_ERROR_CODES = new Set([
8525
+ "ECONNREFUSED",
8526
+ "ECONNRESET",
8527
+ "ENOTFOUND",
8528
+ "EAI_AGAIN",
8529
+ "EPIPE",
8530
+ "EHOSTUNREACH",
8531
+ "ENETUNREACH",
8532
+ "EAI_FAIL"
8533
+ ]);
8534
+ TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
8535
+ TLS_ERROR_CODES2 = new Set([
8536
+ "SELF_SIGNED_CERT_IN_CHAIN",
8537
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
8538
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
8539
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
8540
+ "UNABLE_TO_GET_ISSUER_CERT",
8541
+ "CERT_HAS_EXPIRED",
8542
+ "CERT_UNTRUSTED",
8543
+ "ERR_TLS_CERT_ALTNAME_INVALID"
8544
+ ]);
8545
+ MISSING_DEPENDENCY_CODES = new Set([
8546
+ "MODULE_NOT_FOUND",
8547
+ "ERR_MODULE_NOT_FOUND"
8548
+ ]);
8549
+ INTERNAL_ERROR_NAMES = new Set([
8550
+ "TypeError",
8551
+ "ReferenceError",
8552
+ "SyntaxError",
8553
+ "RangeError"
8554
+ ]);
8555
+ });
8556
+
8335
8557
  // ../common/src/telemetry/telemetry-events.ts
8336
8558
  var CommonTelemetryEvents;
8337
8559
  var init_telemetry_events = __esm(() => {
8338
8560
  CommonTelemetryEvents = {
8339
- Error: "uip.error"
8561
+ Error: "uip.error",
8562
+ ShipSucceeded: "ship_succeeded"
8340
8563
  };
8341
8564
  });
8342
8565
 
@@ -8416,7 +8639,146 @@ var init_debug_telemetry_provider = __esm(() => {
8416
8639
  });
8417
8640
 
8418
8641
  // ../common/src/telemetry/detect-agent.ts
8419
- var init_detect_agent = () => {};
8642
+ function detectAgentFromEnv(env) {
8643
+ for (const agent of KNOWN_AGENTS) {
8644
+ const envValue = env[agent.envVar];
8645
+ if (agent.value !== undefined) {
8646
+ if (envValue === agent.value)
8647
+ return agent.id;
8648
+ } else {
8649
+ if (envValue)
8650
+ return agent.id;
8651
+ }
8652
+ }
8653
+ const agentEnv = env.AGENT;
8654
+ if (agentEnv) {
8655
+ if (agentEnv === "1" || agentEnv === "true")
8656
+ return "unknown";
8657
+ if (agentEnv.length <= 32)
8658
+ return agentEnv.toLowerCase();
8659
+ }
8660
+ return;
8661
+ }
8662
+ var KNOWN_AGENTS;
8663
+ var init_detect_agent = __esm(() => {
8664
+ KNOWN_AGENTS = [
8665
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
8666
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
8667
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
8668
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
8669
+ { envVar: "CODEX_SANDBOX", id: "codex" },
8670
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
8671
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
8672
+ ];
8673
+ });
8674
+
8675
+ // ../common/src/telemetry/environment-info.ts
8676
+ var LOCAL_HOSTS;
8677
+ var init_environment_info = __esm(() => {
8678
+ LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
8679
+ });
8680
+
8681
+ // ../common/src/telemetry/execution-context.ts
8682
+ function currentEnv() {
8683
+ return typeof process === "undefined" ? {} : process.env;
8684
+ }
8685
+ function currentTtyState() {
8686
+ if (typeof process === "undefined")
8687
+ return false;
8688
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
8689
+ }
8690
+ function detectCi(env) {
8691
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
8692
+ if (!signature)
8693
+ return;
8694
+ return {
8695
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
8696
+ ciProvider: signature.provider
8697
+ };
8698
+ }
8699
+ function detectExecutionContext(options = {}) {
8700
+ const env = options.env ?? currentEnv();
8701
+ const ci = detectCi(env);
8702
+ if (ci)
8703
+ return ci;
8704
+ const agent = options.agent ?? detectAgentFromEnv(env);
8705
+ if (agent) {
8706
+ return { executionContext: "agent" };
8707
+ }
8708
+ const authSignal = options.authSignal ?? authSignalSlot.get();
8709
+ if (authSignal === "service_account") {
8710
+ return { executionContext: "service_account" };
8711
+ }
8712
+ const isTty = options.isTty ?? currentTtyState();
8713
+ if (isTty) {
8714
+ return { executionContext: "manual" };
8715
+ }
8716
+ return { executionContext: "unknown" };
8717
+ }
8718
+ function getExecutionContextTelemetryProperties() {
8719
+ const detected = detectExecutionContext();
8720
+ return {
8721
+ execution_context: detected.executionContext,
8722
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
8723
+ };
8724
+ }
8725
+ var authSignalSlot, isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false", isEqual = (value, expected) => value?.toLowerCase() === expected, CI_SIGNATURES;
8726
+ var init_execution_context = __esm(() => {
8727
+ init_singleton();
8728
+ init_detect_agent();
8729
+ authSignalSlot = singleton2("TelemetryExecutionContextAuthSignal");
8730
+ CI_SIGNATURES = [
8731
+ {
8732
+ provider: "github_actions",
8733
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
8734
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
8735
+ },
8736
+ {
8737
+ provider: "azure_devops",
8738
+ matches: (env) => isTruthy(env.TF_BUILD),
8739
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
8740
+ },
8741
+ {
8742
+ provider: "gitlab",
8743
+ matches: (env) => isTruthy(env.GITLAB_CI),
8744
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
8745
+ },
8746
+ {
8747
+ provider: "circleci",
8748
+ matches: (env) => isTruthy(env.CIRCLECI),
8749
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
8750
+ },
8751
+ {
8752
+ provider: "jenkins",
8753
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
8754
+ },
8755
+ {
8756
+ provider: "teamcity",
8757
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
8758
+ },
8759
+ {
8760
+ provider: "buildkite",
8761
+ matches: (env) => isTruthy(env.BUILDKITE),
8762
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
8763
+ },
8764
+ {
8765
+ provider: "bitbucket",
8766
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
8767
+ },
8768
+ {
8769
+ provider: "travis",
8770
+ matches: (env) => isTruthy(env.TRAVIS)
8771
+ },
8772
+ {
8773
+ provider: "appveyor",
8774
+ matches: (env) => isTruthy(env.APPVEYOR)
8775
+ },
8776
+ {
8777
+ provider: "generic",
8778
+ matches: (env) => isTruthy(env.CI)
8779
+ }
8780
+ ];
8781
+ });
8420
8782
 
8421
8783
  // ../common/src/telemetry/node-context-storage.ts
8422
8784
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -8432,6 +8794,29 @@ class NodeContextStorage {
8432
8794
  }
8433
8795
  var init_node_context_storage = () => {};
8434
8796
 
8797
+ // ../common/src/telemetry/session-id.ts
8798
+ function getProcessEnv() {
8799
+ return globalThis.process?.env;
8800
+ }
8801
+ function normalizeSessionId(value) {
8802
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
8803
+ return;
8804
+ }
8805
+ const trimmed = String(value).trim();
8806
+ return trimmed || undefined;
8807
+ }
8808
+ function getConfiguredTelemetrySessionId() {
8809
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
8810
+ }
8811
+ function resolveTelemetrySessionId(existingSessionId) {
8812
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
8813
+ }
8814
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID", TELEMETRY_SESSION_ID_PROPERTY = "session_id", telemetrySessionIdSlot;
8815
+ var init_session_id = __esm(() => {
8816
+ init_singleton();
8817
+ telemetrySessionIdSlot = singleton2("TelemetrySessionId");
8818
+ });
8819
+
8435
8820
  // ../common/src/telemetry/global-telemetry-properties.ts
8436
8821
  function getGlobalTelemetryProperties() {
8437
8822
  return telemetryPropsSlot2.get();
@@ -8520,26 +8905,41 @@ class TelemetryService {
8520
8905
  return this.contextStorage.getContext();
8521
8906
  }
8522
8907
  enrichPropertiesWithContext(properties, context) {
8523
- return {
8524
- ...getGlobalTelemetryProperties(),
8908
+ const globalProperties = getGlobalTelemetryProperties();
8909
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
8910
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
8911
+ const enriched = {
8912
+ ...getExecutionContextTelemetryProperties(),
8913
+ ...globalProperties,
8525
8914
  ...this.defaultProperties,
8526
8915
  ...properties,
8527
8916
  ...context
8528
8917
  };
8918
+ if (sessionId === undefined) {
8919
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
8920
+ } else {
8921
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
8922
+ }
8923
+ return enriched;
8529
8924
  }
8530
8925
  generateId() {
8531
8926
  return crypto.randomUUID().replaceAll("-", "");
8532
8927
  }
8533
8928
  }
8534
8929
  var init_telemetry_service = __esm(() => {
8930
+ init_execution_context();
8535
8931
  init_global_telemetry_properties();
8932
+ init_session_id();
8536
8933
  });
8537
8934
 
8538
8935
  // ../common/src/telemetry/node.ts
8539
8936
  var init_node3 = __esm(() => {
8540
8937
  init_debug_telemetry_provider();
8541
8938
  init_detect_agent();
8939
+ init_environment_info();
8940
+ init_execution_context();
8542
8941
  init_node_context_storage();
8942
+ init_session_id();
8543
8943
  init_telemetry_service();
8544
8944
  });
8545
8945
 
@@ -8549,6 +8949,7 @@ var init_node_appinsights_telemetry_provider = __esm(() => {
8549
8949
  init_logger();
8550
8950
  init_singleton();
8551
8951
  init_global_telemetry_properties();
8952
+ init_session_id();
8552
8953
  init_global_telemetry_properties();
8553
8954
  providerSlot = singleton2("TelemetryProvider");
8554
8955
  });
@@ -8954,6 +9355,7 @@ var init_formatter = __esm(() => {
8954
9355
  init_logger();
8955
9356
  init_output_context();
8956
9357
  init_output_format_context();
9358
+ init_command_terminal();
8957
9359
  init_telemetry_events();
8958
9360
  init_telemetry_init();
8959
9361
  CLI_ERROR_CODES = [
@@ -9028,8 +9430,24 @@ var init_formatter = __esm(() => {
9028
9430
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
9029
9431
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
9030
9432
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
9031
- const { SuppressTelemetry, ...envelope } = data;
9032
- if (!SuppressTelemetry) {
9433
+ recordCommandFailureTelemetry({
9434
+ result: data.Result,
9435
+ errorCode: data.ErrorCode,
9436
+ retry: data.Retry,
9437
+ message: data.Message,
9438
+ context: data.Context,
9439
+ exitCode: process.exitCode,
9440
+ errorClass: data.TelemetryErrorClass,
9441
+ terminalOutcome: data.TelemetryTerminalOutcome,
9442
+ terminalSignal: data.TelemetryTerminalSignal
9443
+ });
9444
+ const suppressTelemetry = data.SuppressTelemetry === true;
9445
+ const envelope = { ...data };
9446
+ delete envelope.SuppressTelemetry;
9447
+ delete envelope.TelemetryErrorClass;
9448
+ delete envelope.TelemetryTerminalOutcome;
9449
+ delete envelope.TelemetryTerminalSignal;
9450
+ if (!suppressTelemetry) {
9033
9451
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
9034
9452
  result: data.Result,
9035
9453
  errorCode: data.ErrorCode,
@@ -9093,6 +9511,159 @@ var init_formatter = __esm(() => {
9093
9511
  })(OutputFormatter ||= {});
9094
9512
  });
9095
9513
 
9514
+ // ../common/src/telemetry/command-attribution.ts
9515
+ function productMode(productArea, mode) {
9516
+ return { product_area: productArea, mode };
9517
+ }
9518
+ function attributionRecord(groups) {
9519
+ const record = {};
9520
+ for (const [productArea, mode, names] of groups) {
9521
+ const attribution = productMode(productArea, mode);
9522
+ for (const name of names) {
9523
+ record[name] = attribution;
9524
+ }
9525
+ }
9526
+ return record;
9527
+ }
9528
+ function commandAttribution(groups) {
9529
+ const entries = [];
9530
+ for (const [productArea, mode, prefixes] of groups) {
9531
+ const attribution = productMode(productArea, mode);
9532
+ for (const prefix of prefixes) {
9533
+ entries.push({ prefix, attribution });
9534
+ }
9535
+ }
9536
+ return entries;
9537
+ }
9538
+ function normalizeCommandPath(value) {
9539
+ if (typeof value !== "string") {
9540
+ return;
9541
+ }
9542
+ const trimmed = value.trim().toLowerCase();
9543
+ if (!trimmed) {
9544
+ return;
9545
+ }
9546
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
9547
+ if (tokens.length === 0) {
9548
+ return;
9549
+ }
9550
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
9551
+ return commandTokens.join(".");
9552
+ }
9553
+ function getCommandProductModeAttribution(commandPath) {
9554
+ const normalized = normalizeCommandPath(commandPath);
9555
+ if (!normalized) {
9556
+ return;
9557
+ }
9558
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
9559
+ }
9560
+ function normalizeSkillNameWithOptions(value, options) {
9561
+ if (typeof value !== "string") {
9562
+ return;
9563
+ }
9564
+ const normalized = value.trim().toLowerCase();
9565
+ if (!normalized) {
9566
+ return;
9567
+ }
9568
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
9569
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
9570
+ return;
9571
+ }
9572
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
9573
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
9574
+ return;
9575
+ }
9576
+ return skillName;
9577
+ }
9578
+ function normalizeSkillName(value) {
9579
+ return normalizeSkillNameWithOptions(value, {
9580
+ allowLegacyNamespace: false
9581
+ });
9582
+ }
9583
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
9584
+ const skillName = normalizeSkillName(skillSource);
9585
+ return {
9586
+ ...skillName ? { skill_name: skillName } : {},
9587
+ ...getCommandProductModeAttribution(commandPath)
9588
+ };
9589
+ }
9590
+ var LEGACY_SKILL_NAMESPACE = "uipath:", MAX_SKILL_NAME_LENGTH = 80, SKILL_NAME_PATTERN, SKILL_ATTRIBUTION, KNOWN_SKILL_NAMES, COMMAND_ATTRIBUTION;
9591
+ var init_command_attribution = __esm(() => {
9592
+ SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
9593
+ SKILL_ATTRIBUTION = attributionRecord([
9594
+ ["admin", "operate", ["uipath-admin"]],
9595
+ ["agents", "build", ["uipath-agents"]],
9596
+ ["api-workflow", "build", ["uipath-api-workflow"]],
9597
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
9598
+ ["coded-apps", "build", ["uipath-coded-apps"]],
9599
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
9600
+ ["cli", "troubleshoot", ["uipath-feedback"]],
9601
+ ["governance", "operate", ["uipath-governance"]],
9602
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
9603
+ ["document-understanding", "build", ["uipath-ixp"]],
9604
+ [
9605
+ "maestro",
9606
+ "build",
9607
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
9608
+ ],
9609
+ ["agenthub", "build", ["uipath-mcp-servers"]],
9610
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
9611
+ ["platform", "operate", ["uipath-platform"]],
9612
+ ["quality", "troubleshoot", ["uipath-review"]],
9613
+ ["rpa", "build", ["uipath-rpa"]],
9614
+ ["cli", "operate", ["uipath-skill-catalog"]],
9615
+ ["action-center", "operate", ["uipath-tasks"]],
9616
+ ["test-manager", "operate", ["uipath-test"]],
9617
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
9618
+ ]);
9619
+ KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
9620
+ COMMAND_ATTRIBUTION = commandAttribution([
9621
+ ["cli", "troubleshoot", ["uip.feedback"]],
9622
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
9623
+ ["context-grounding", "build", ["uip.context-grounding"]],
9624
+ ["api-workflow", "build", ["uip.api-workflow"]],
9625
+ ["rpa", "build", ["uip.rpa-legacy"]],
9626
+ ["conversational", "operate", ["uip.conversational"]],
9627
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
9628
+ ["agenthub", "build", ["uip.agenthub"]],
9629
+ ["coded-apps", "build", ["uip.codedapp"]],
9630
+ ["functions", "build", ["uip.functions"]],
9631
+ ["solution", "build", ["uip.solution"]],
9632
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
9633
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
9634
+ ["platform", "operate", ["uip.platform"]],
9635
+ ["admin", "operate", ["uip.admin"]],
9636
+ ["automation-ops", "operate", ["uip.aops"]],
9637
+ ["documentation", "troubleshoot", ["uip.docsai"]],
9638
+ ["governance", "operate", ["uip.gov"]],
9639
+ ["insights", "operate", ["uip.insights"]],
9640
+ ["document-understanding", "build", ["uip.ixp"]],
9641
+ ["process-mining", "operate", ["uip.pm"]],
9642
+ ["action-center", "operate", ["uip.tasks"]],
9643
+ ["test-manager", "operate", ["uip.tm"]],
9644
+ ["vertical-solutions", "build", ["uip.vss"]],
9645
+ ["data-fabric", "operate", ["uip.df"]],
9646
+ ["integration-service", "build", ["uip.is"]],
9647
+ ["orchestrator", "operate", ["uip.or"]],
9648
+ [
9649
+ "cli",
9650
+ "operate",
9651
+ [
9652
+ "uip.login",
9653
+ "uip.logout",
9654
+ "uip.user",
9655
+ "uip.config",
9656
+ "uip.tools",
9657
+ "uip.skills",
9658
+ "uip.completion",
9659
+ "uip.update",
9660
+ "uip.mcp",
9661
+ "uip.track"
9662
+ ]
9663
+ ]
9664
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
9665
+ });
9666
+
9096
9667
  // ../common/src/telemetry/pii-redactor.ts
9097
9668
  function shortHash(input) {
9098
9669
  let hash = 2166136261;
@@ -9268,12 +9839,20 @@ function commandHelpHint(commandPath) {
9268
9839
  const command = commandPath.replace(/\./g, " ");
9269
9840
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
9270
9841
  }
9842
+ function isPromptCancellation(error) {
9843
+ return error instanceof Error && error.name === "ExitPromptError";
9844
+ }
9845
+ function exitCodeFromProcess(fallback) {
9846
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
9847
+ }
9271
9848
  var pollSignalSlot, cliErrorCodeValues, retryHintValues, processContext;
9272
9849
  var init_trackedAction = __esm(() => {
9273
9850
  init_esm();
9274
9851
  init_formatter();
9275
9852
  init_logger();
9276
9853
  init_singleton();
9854
+ init_command_attribution();
9855
+ init_command_terminal();
9277
9856
  init_pii_redactor();
9278
9857
  init_telemetry_init();
9279
9858
  pollSignalSlot = singleton2("PollSignal");
@@ -9294,6 +9873,8 @@ var init_trackedAction = __esm(() => {
9294
9873
  const props = typeof properties === "function" ? properties(...args) : properties;
9295
9874
  const startTime = performance.now();
9296
9875
  let errorMessage2;
9876
+ let fallbackExitCode = EXIT_CODES.Success;
9877
+ clearRecordedCommandFailureTelemetry();
9297
9878
  const [error] = await catchError2(fn(...args));
9298
9879
  if (error) {
9299
9880
  errorMessage2 = error instanceof Error ? error.message : String(error);
@@ -9308,6 +9889,8 @@ var init_trackedAction = __esm(() => {
9308
9889
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
9309
9890
  const typedContext = typed.context ?? typed.Context;
9310
9891
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
9892
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
9893
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
9311
9894
  OutputFormatter.error({
9312
9895
  Result: finalResult,
9313
9896
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -9316,16 +9899,26 @@ var init_trackedAction = __esm(() => {
9316
9899
  ...customRetry ? { Retry: customRetry } : {},
9317
9900
  ...customContext ? { Context: customContext } : {}
9318
9901
  });
9319
- context.exit(EXIT_CODES[finalResult]);
9902
+ context.exit(fallbackExitCode);
9320
9903
  }
9321
9904
  const durationMs = performance.now() - startTime;
9322
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
9905
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
9906
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
9907
+ const success = !error && exitCode === 0;
9908
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
9909
+ error,
9910
+ exitCode,
9911
+ recordedFailure,
9912
+ pollSignal: context.pollSignal
9913
+ });
9323
9914
  telemetry.trackEvent(telemetryName, redactProperties({
9324
9915
  ...extractCommandParams(command),
9325
9916
  ...props,
9917
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
9326
9918
  command: "true",
9327
9919
  duration: String(durationMs),
9328
9920
  success: String(success),
9921
+ ...terminalTelemetry,
9329
9922
  ...errorMessage2 ? { errorMessage: errorMessage2 } : {}
9330
9923
  }));
9331
9924
  });
@@ -9602,6 +10195,16 @@ var init_sdk_user_agent = __esm(() => {
9602
10195
  init_global_telemetry_properties();
9603
10196
  sdkUserAgentHostToken2 = singleton2("SdkUserAgentHostToken");
9604
10197
  });
10198
+ // ../common/src/telemetry/ship-succeeded.ts
10199
+ var shippedKeysSlot;
10200
+ var init_ship_succeeded = __esm(() => {
10201
+ init_singleton();
10202
+ init_pii_redactor();
10203
+ init_telemetry_events();
10204
+ init_telemetry_init();
10205
+ shippedKeysSlot = singleton2("ShipSucceededDedupeKeys");
10206
+ });
10207
+
9605
10208
  // ../common/src/tool-provider.ts
9606
10209
  var factorySlot;
9607
10210
  var init_tool_provider = __esm(() => {
@@ -9613,6 +10216,8 @@ var init_tool_provider = __esm(() => {
9613
10216
  var init_src3 = __esm(() => {
9614
10217
  init_console_guard();
9615
10218
  init_node_appinsights_telemetry_provider();
10219
+ init_pii_redactor();
10220
+ init_ship_succeeded();
9616
10221
  init_attachment_binding();
9617
10222
  init_command_examples();
9618
10223
  init_command_help();
@@ -9635,6 +10240,8 @@ var init_src3 = __esm(() => {
9635
10240
  init_screen_logger();
9636
10241
  init_sdk_user_agent();
9637
10242
  init_singleton();
10243
+ init_command_attribution();
10244
+ init_command_terminal();
9638
10245
  init_node3();
9639
10246
  init_telemetry_events();
9640
10247
  init_telemetry_init();
@@ -63852,7 +64459,6 @@ var init_selectTenant = __esm(() => {
63852
64459
  INVALID_TENANT_CODE2
63853
64460
  ]);
63854
64461
  });
63855
-
63856
64462
  // ../auth/src/interactive.ts
63857
64463
  var init_interactive = __esm(() => {
63858
64464
  init_src2();
@@ -66560,7 +67166,7 @@ init_esm();
66560
67166
  var package_default = {
66561
67167
  name: "@uipath/agenthub-tool",
66562
67168
  license: "MIT",
66563
- version: "1.197.0-preview.65",
67169
+ version: "1.197.0-preview.67",
66564
67170
  description: "Manage UiPath AgentHub MCP server registrations, tools, and remote A2A agents.",
66565
67171
  private: false,
66566
67172
  repository: {
@@ -89795,7 +90401,7 @@ class TextApiResponse2 {
89795
90401
  var package_default4 = {
89796
90402
  name: "@uipath/integrationservice-sdk",
89797
90403
  license: "MIT",
89798
- version: "1.197.0-preview.65",
90404
+ version: "1.197.0-preview.67",
89799
90405
  repository: {
89800
90406
  type: "git",
89801
90407
  url: "https://github.com/UiPath/cli.git",
@@ -98460,4 +99066,4 @@ export {
98460
99066
  createStandaloneProgram
98461
99067
  };
98462
99068
 
98463
- //# debugId=518ECDB65CCA584164756E2164756E21
99069
+ //# debugId=61D0098AFEAE17AD64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/agenthub-tool",
3
3
  "license": "MIT",
4
- "version": "1.197.0-preview.65",
4
+ "version": "1.197.0-preview.67",
5
5
  "description": "Manage UiPath AgentHub MCP server registrations, tools, and remote A2A agents.",
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
  }