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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/tool.js +578 -9
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -27802,7 +27802,7 @@ var require_dist2 = __commonJS((exports, module) => {
27802
27802
  var package_default = {
27803
27803
  name: "@uipath/docsai-tool",
27804
27804
  license: "MIT",
27805
- version: "1.197.0-preview.64",
27805
+ version: "1.197.0-preview.66",
27806
27806
  description: "Search UiPath documentation with AI-powered answers.",
27807
27807
  private: false,
27808
27808
  repository: {
@@ -32914,9 +32914,228 @@ function getOutputFilter() {
32914
32914
  return filterSlot.get();
32915
32915
  }
32916
32916
 
32917
+ // ../common/src/telemetry/command-terminal.ts
32918
+ var recordedFailureSlot = singleton("CommandTelemetryFailure");
32919
+ var AUTH_ERROR_CODES = new Set([
32920
+ "authentication_required",
32921
+ "permission_denied"
32922
+ ]);
32923
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
32924
+ var NETWORK_HTTP_ERROR_CODES = new Set([
32925
+ "network_error",
32926
+ "rate_limited",
32927
+ "server_error",
32928
+ "not_found",
32929
+ "method_not_allowed"
32930
+ ]);
32931
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
32932
+ var NETWORK_OS_ERROR_CODES = new Set([
32933
+ "ECONNREFUSED",
32934
+ "ECONNRESET",
32935
+ "ENOTFOUND",
32936
+ "EAI_AGAIN",
32937
+ "EPIPE",
32938
+ "EHOSTUNREACH",
32939
+ "ENETUNREACH",
32940
+ "EAI_FAIL"
32941
+ ]);
32942
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
32943
+ var TLS_ERROR_CODES2 = new Set([
32944
+ "SELF_SIGNED_CERT_IN_CHAIN",
32945
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
32946
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
32947
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
32948
+ "UNABLE_TO_GET_ISSUER_CERT",
32949
+ "CERT_HAS_EXPIRED",
32950
+ "CERT_UNTRUSTED",
32951
+ "ERR_TLS_CERT_ALTNAME_INVALID"
32952
+ ]);
32953
+ var MISSING_DEPENDENCY_CODES = new Set([
32954
+ "MODULE_NOT_FOUND",
32955
+ "ERR_MODULE_NOT_FOUND"
32956
+ ]);
32957
+ var INTERNAL_ERROR_NAMES = new Set([
32958
+ "TypeError",
32959
+ "ReferenceError",
32960
+ "SyntaxError",
32961
+ "RangeError"
32962
+ ]);
32963
+ function isRecord(value) {
32964
+ return value !== null && typeof value === "object";
32965
+ }
32966
+ function stringField(value, field) {
32967
+ if (!isRecord(value)) {
32968
+ return;
32969
+ }
32970
+ const raw = value[field];
32971
+ return typeof raw === "string" ? raw : undefined;
32972
+ }
32973
+ function numberField(value, field) {
32974
+ if (!isRecord(value)) {
32975
+ return;
32976
+ }
32977
+ const raw = value[field];
32978
+ return typeof raw === "number" ? raw : undefined;
32979
+ }
32980
+ function findStringInCauseChain(error, field) {
32981
+ let current = error;
32982
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
32983
+ const value = stringField(current, field);
32984
+ if (value) {
32985
+ return value;
32986
+ }
32987
+ current = current.cause;
32988
+ }
32989
+ return;
32990
+ }
32991
+ function findCodeInCauseChain(error) {
32992
+ return findStringInCauseChain(error, "code");
32993
+ }
32994
+ function isSpawnEnoent(error) {
32995
+ const code = findCodeInCauseChain(error);
32996
+ if (code !== "ENOENT") {
32997
+ return false;
32998
+ }
32999
+ const syscall = findStringInCauseChain(error, "syscall");
33000
+ return syscall?.startsWith("spawn") === true;
33001
+ }
33002
+ function isCancellationError(error, exitCode, pollSignal) {
33003
+ if (exitCode === 130) {
33004
+ return true;
33005
+ }
33006
+ if (!isRecord(error)) {
33007
+ return false;
33008
+ }
33009
+ if (numberField(error, "exitCode") === 130) {
33010
+ return true;
33011
+ }
33012
+ const name = stringField(error, "name");
33013
+ if (name === "ExitPromptError") {
33014
+ return true;
33015
+ }
33016
+ if (name === "AbortError" && pollSignal?.aborted) {
33017
+ return true;
33018
+ }
33019
+ const message = stringField(error, "message");
33020
+ return message?.includes("SIGINT") === true;
33021
+ }
33022
+ function terminalSignalFor(input, outcome) {
33023
+ if (input.recordedFailure?.terminalSignal) {
33024
+ return input.recordedFailure.terminalSignal;
33025
+ }
33026
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
33027
+ if (explicit) {
33028
+ return explicit;
33029
+ }
33030
+ return outcome === "cancelled" ? "SIGINT" : undefined;
33031
+ }
33032
+ function classifyHttpStatus(status) {
33033
+ if (status === 401 || status === 403) {
33034
+ return "auth";
33035
+ }
33036
+ if (status === 400 || status === 409 || status === 422) {
33037
+ return "validation";
33038
+ }
33039
+ if (status === 408) {
33040
+ return "timeout";
33041
+ }
33042
+ return "network_http";
33043
+ }
33044
+ function classifyFromResult(result) {
33045
+ switch (result) {
33046
+ case "AuthenticationError":
33047
+ return "auth";
33048
+ case "ValidationError":
33049
+ return "validation";
33050
+ case "TimeoutError":
33051
+ return "timeout";
33052
+ default:
33053
+ return;
33054
+ }
33055
+ }
33056
+ function classifyFromErrorCode(errorCode) {
33057
+ if (!errorCode) {
33058
+ return;
33059
+ }
33060
+ if (AUTH_ERROR_CODES.has(errorCode)) {
33061
+ return "auth";
33062
+ }
33063
+ if (VALIDATION_ERROR_CODES.has(errorCode)) {
33064
+ return "validation";
33065
+ }
33066
+ if (TIMEOUT_ERROR_CODES.has(errorCode)) {
33067
+ return "timeout";
33068
+ }
33069
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
33070
+ return "network_http";
33071
+ }
33072
+ return;
33073
+ }
33074
+ function classifyFromError(error) {
33075
+ const code = findCodeInCauseChain(error);
33076
+ if (code) {
33077
+ if (code.startsWith("commander.")) {
33078
+ return "validation";
33079
+ }
33080
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
33081
+ return "network_http";
33082
+ }
33083
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
33084
+ return "timeout";
33085
+ }
33086
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
33087
+ return "missing_dependency";
33088
+ }
33089
+ }
33090
+ const message = stringField(error, "message");
33091
+ if (message?.includes("fetch failed") === true) {
33092
+ return "network_http";
33093
+ }
33094
+ const name = stringField(error, "name");
33095
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
33096
+ return "internal";
33097
+ }
33098
+ return;
33099
+ }
33100
+ function classifyError(input) {
33101
+ const recorded = input.recordedFailure;
33102
+ if (recorded?.errorClass) {
33103
+ return recorded.errorClass;
33104
+ }
33105
+ const status = recorded?.context?.httpStatus;
33106
+ if (status !== undefined) {
33107
+ return classifyHttpStatus(status);
33108
+ }
33109
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
33110
+ }
33111
+ function recordCommandFailureTelemetry(failure) {
33112
+ recordedFailureSlot.set(failure);
33113
+ }
33114
+ function clearRecordedCommandFailureTelemetry() {
33115
+ recordedFailureSlot.clear();
33116
+ }
33117
+ function takeRecordedCommandFailureTelemetry() {
33118
+ const failure = recordedFailureSlot.get();
33119
+ recordedFailureSlot.clear();
33120
+ return failure;
33121
+ }
33122
+ function buildCommandTerminalTelemetryProperties(input) {
33123
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
33124
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
33125
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
33126
+ const terminalSignal = terminalSignalFor(input, outcome);
33127
+ return {
33128
+ exit_code: input.exitCode,
33129
+ terminal_outcome: outcome,
33130
+ ...errorClass ? { error_class: errorClass } : {},
33131
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
33132
+ };
33133
+ }
33134
+
32917
33135
  // ../common/src/telemetry/telemetry-events.ts
32918
33136
  var CommonTelemetryEvents = {
32919
- Error: "uip.error"
33137
+ Error: "uip.error",
33138
+ ShipSucceeded: "ship_succeeded"
32920
33139
  };
32921
33140
 
32922
33141
  // ../common/src/registry.ts
@@ -32983,6 +33202,136 @@ function formatMessage(category, name, properties) {
32983
33202
  }
32984
33203
  return message;
32985
33204
  }
33205
+ // ../common/src/telemetry/detect-agent.ts
33206
+ var KNOWN_AGENTS = [
33207
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
33208
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
33209
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
33210
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
33211
+ { envVar: "CODEX_SANDBOX", id: "codex" },
33212
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
33213
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
33214
+ ];
33215
+ function detectAgentFromEnv(env) {
33216
+ for (const agent of KNOWN_AGENTS) {
33217
+ const envValue = env[agent.envVar];
33218
+ if (agent.value !== undefined) {
33219
+ if (envValue === agent.value)
33220
+ return agent.id;
33221
+ } else {
33222
+ if (envValue)
33223
+ return agent.id;
33224
+ }
33225
+ }
33226
+ const agentEnv = env.AGENT;
33227
+ if (agentEnv) {
33228
+ if (agentEnv === "1" || agentEnv === "true")
33229
+ return "unknown";
33230
+ if (agentEnv.length <= 32)
33231
+ return agentEnv.toLowerCase();
33232
+ }
33233
+ return;
33234
+ }
33235
+ // ../common/src/telemetry/environment-info.ts
33236
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
33237
+ // ../common/src/telemetry/execution-context.ts
33238
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
33239
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
33240
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
33241
+ var CI_SIGNATURES = [
33242
+ {
33243
+ provider: "github_actions",
33244
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
33245
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
33246
+ },
33247
+ {
33248
+ provider: "azure_devops",
33249
+ matches: (env) => isTruthy(env.TF_BUILD),
33250
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
33251
+ },
33252
+ {
33253
+ provider: "gitlab",
33254
+ matches: (env) => isTruthy(env.GITLAB_CI),
33255
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
33256
+ },
33257
+ {
33258
+ provider: "circleci",
33259
+ matches: (env) => isTruthy(env.CIRCLECI),
33260
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
33261
+ },
33262
+ {
33263
+ provider: "jenkins",
33264
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
33265
+ },
33266
+ {
33267
+ provider: "teamcity",
33268
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
33269
+ },
33270
+ {
33271
+ provider: "buildkite",
33272
+ matches: (env) => isTruthy(env.BUILDKITE),
33273
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
33274
+ },
33275
+ {
33276
+ provider: "bitbucket",
33277
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
33278
+ },
33279
+ {
33280
+ provider: "travis",
33281
+ matches: (env) => isTruthy(env.TRAVIS)
33282
+ },
33283
+ {
33284
+ provider: "appveyor",
33285
+ matches: (env) => isTruthy(env.APPVEYOR)
33286
+ },
33287
+ {
33288
+ provider: "generic",
33289
+ matches: (env) => isTruthy(env.CI)
33290
+ }
33291
+ ];
33292
+ function currentEnv() {
33293
+ return typeof process === "undefined" ? {} : process.env;
33294
+ }
33295
+ function currentTtyState() {
33296
+ if (typeof process === "undefined")
33297
+ return false;
33298
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
33299
+ }
33300
+ function detectCi(env) {
33301
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
33302
+ if (!signature)
33303
+ return;
33304
+ return {
33305
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
33306
+ ciProvider: signature.provider
33307
+ };
33308
+ }
33309
+ function detectExecutionContext(options = {}) {
33310
+ const env = options.env ?? currentEnv();
33311
+ const ci = detectCi(env);
33312
+ if (ci)
33313
+ return ci;
33314
+ const agent = options.agent ?? detectAgentFromEnv(env);
33315
+ if (agent) {
33316
+ return { executionContext: "agent" };
33317
+ }
33318
+ const authSignal = options.authSignal ?? authSignalSlot.get();
33319
+ if (authSignal === "service_account") {
33320
+ return { executionContext: "service_account" };
33321
+ }
33322
+ const isTty = options.isTty ?? currentTtyState();
33323
+ if (isTty) {
33324
+ return { executionContext: "manual" };
33325
+ }
33326
+ return { executionContext: "unknown" };
33327
+ }
33328
+ function getExecutionContextTelemetryProperties() {
33329
+ const detected = detectExecutionContext();
33330
+ return {
33331
+ execution_context: detected.executionContext,
33332
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
33333
+ };
33334
+ }
32986
33335
  // ../common/src/telemetry/node-context-storage.ts
32987
33336
  import { AsyncLocalStorage } from "node:async_hooks";
32988
33337
 
@@ -32995,6 +33344,26 @@ class NodeContextStorage {
32995
33344
  return this.storage.getStore();
32996
33345
  }
32997
33346
  }
33347
+ // ../common/src/telemetry/session-id.ts
33348
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
33349
+ var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
33350
+ var telemetrySessionIdSlot = singleton("TelemetrySessionId");
33351
+ function getProcessEnv() {
33352
+ return globalThis.process?.env;
33353
+ }
33354
+ function normalizeSessionId(value) {
33355
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
33356
+ return;
33357
+ }
33358
+ const trimmed = String(value).trim();
33359
+ return trimmed || undefined;
33360
+ }
33361
+ function getConfiguredTelemetrySessionId() {
33362
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
33363
+ }
33364
+ function resolveTelemetrySessionId(existingSessionId) {
33365
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
33366
+ }
32998
33367
  // ../common/src/telemetry/global-telemetry-properties.ts
32999
33368
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
33000
33369
  function getGlobalTelemetryProperties() {
@@ -33079,12 +33448,22 @@ class TelemetryService {
33079
33448
  return this.contextStorage.getContext();
33080
33449
  }
33081
33450
  enrichPropertiesWithContext(properties, context) {
33082
- return {
33083
- ...getGlobalTelemetryProperties(),
33451
+ const globalProperties = getGlobalTelemetryProperties();
33452
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
33453
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
33454
+ const enriched = {
33455
+ ...getExecutionContextTelemetryProperties(),
33456
+ ...globalProperties,
33084
33457
  ...this.defaultProperties,
33085
33458
  ...properties,
33086
33459
  ...context
33087
33460
  };
33461
+ if (sessionId === undefined) {
33462
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
33463
+ } else {
33464
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
33465
+ }
33466
+ return enriched;
33088
33467
  }
33089
33468
  generateId() {
33090
33469
  return crypto.randomUUID().replaceAll("-", "");
@@ -33554,8 +33933,24 @@ var OutputFormatter;
33554
33933
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
33555
33934
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
33556
33935
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
33557
- const { SuppressTelemetry, ...envelope } = data;
33558
- if (!SuppressTelemetry) {
33936
+ recordCommandFailureTelemetry({
33937
+ result: data.Result,
33938
+ errorCode: data.ErrorCode,
33939
+ retry: data.Retry,
33940
+ message: data.Message,
33941
+ context: data.Context,
33942
+ exitCode: process.exitCode,
33943
+ errorClass: data.TelemetryErrorClass,
33944
+ terminalOutcome: data.TelemetryTerminalOutcome,
33945
+ terminalSignal: data.TelemetryTerminalSignal
33946
+ });
33947
+ const suppressTelemetry = data.SuppressTelemetry === true;
33948
+ const envelope = { ...data };
33949
+ delete envelope.SuppressTelemetry;
33950
+ delete envelope.TelemetryErrorClass;
33951
+ delete envelope.TelemetryTerminalOutcome;
33952
+ delete envelope.TelemetryTerminalSignal;
33953
+ if (!suppressTelemetry) {
33559
33954
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
33560
33955
  result: data.Result,
33561
33956
  errorCode: data.ErrorCode,
@@ -33618,6 +34013,158 @@ var OutputFormatter;
33618
34013
  OutputFormatter.formatToString = formatToString;
33619
34014
  })(OutputFormatter ||= {});
33620
34015
 
34016
+ // ../common/src/telemetry/command-attribution.ts
34017
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
34018
+ var MAX_SKILL_NAME_LENGTH = 80;
34019
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
34020
+ function productMode(productArea, mode) {
34021
+ return { product_area: productArea, mode };
34022
+ }
34023
+ function attributionRecord(groups) {
34024
+ const record = {};
34025
+ for (const [productArea, mode, names] of groups) {
34026
+ const attribution = productMode(productArea, mode);
34027
+ for (const name of names) {
34028
+ record[name] = attribution;
34029
+ }
34030
+ }
34031
+ return record;
34032
+ }
34033
+ function commandAttribution(groups) {
34034
+ const entries = [];
34035
+ for (const [productArea, mode, prefixes] of groups) {
34036
+ const attribution = productMode(productArea, mode);
34037
+ for (const prefix of prefixes) {
34038
+ entries.push({ prefix, attribution });
34039
+ }
34040
+ }
34041
+ return entries;
34042
+ }
34043
+ var SKILL_ATTRIBUTION = attributionRecord([
34044
+ ["admin", "operate", ["uipath-admin"]],
34045
+ ["agents", "build", ["uipath-agents"]],
34046
+ ["api-workflow", "build", ["uipath-api-workflow"]],
34047
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
34048
+ ["coded-apps", "build", ["uipath-coded-apps"]],
34049
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
34050
+ ["cli", "troubleshoot", ["uipath-feedback"]],
34051
+ ["governance", "operate", ["uipath-governance"]],
34052
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
34053
+ ["document-understanding", "build", ["uipath-ixp"]],
34054
+ [
34055
+ "maestro",
34056
+ "build",
34057
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
34058
+ ],
34059
+ ["agenthub", "build", ["uipath-mcp-servers"]],
34060
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
34061
+ ["platform", "operate", ["uipath-platform"]],
34062
+ ["quality", "troubleshoot", ["uipath-review"]],
34063
+ ["rpa", "build", ["uipath-rpa"]],
34064
+ ["cli", "operate", ["uipath-skill-catalog"]],
34065
+ ["action-center", "operate", ["uipath-tasks"]],
34066
+ ["test-manager", "operate", ["uipath-test"]],
34067
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
34068
+ ]);
34069
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
34070
+ var COMMAND_ATTRIBUTION = commandAttribution([
34071
+ ["cli", "troubleshoot", ["uip.feedback"]],
34072
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
34073
+ ["context-grounding", "build", ["uip.context-grounding"]],
34074
+ ["api-workflow", "build", ["uip.api-workflow"]],
34075
+ ["rpa", "build", ["uip.rpa-legacy"]],
34076
+ ["conversational", "operate", ["uip.conversational"]],
34077
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
34078
+ ["agenthub", "build", ["uip.agenthub"]],
34079
+ ["coded-apps", "build", ["uip.codedapp"]],
34080
+ ["functions", "build", ["uip.functions"]],
34081
+ ["solution", "build", ["uip.solution"]],
34082
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
34083
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
34084
+ ["platform", "operate", ["uip.platform"]],
34085
+ ["admin", "operate", ["uip.admin"]],
34086
+ ["automation-ops", "operate", ["uip.aops"]],
34087
+ ["documentation", "troubleshoot", ["uip.docsai"]],
34088
+ ["governance", "operate", ["uip.gov"]],
34089
+ ["insights", "operate", ["uip.insights"]],
34090
+ ["document-understanding", "build", ["uip.ixp"]],
34091
+ ["process-mining", "operate", ["uip.pm"]],
34092
+ ["action-center", "operate", ["uip.tasks"]],
34093
+ ["test-manager", "operate", ["uip.tm"]],
34094
+ ["vertical-solutions", "build", ["uip.vss"]],
34095
+ ["data-fabric", "operate", ["uip.df"]],
34096
+ ["integration-service", "build", ["uip.is"]],
34097
+ ["orchestrator", "operate", ["uip.or"]],
34098
+ [
34099
+ "cli",
34100
+ "operate",
34101
+ [
34102
+ "uip.login",
34103
+ "uip.logout",
34104
+ "uip.user",
34105
+ "uip.config",
34106
+ "uip.tools",
34107
+ "uip.skills",
34108
+ "uip.completion",
34109
+ "uip.update",
34110
+ "uip.mcp",
34111
+ "uip.track"
34112
+ ]
34113
+ ]
34114
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
34115
+ function normalizeCommandPath(value) {
34116
+ if (typeof value !== "string") {
34117
+ return;
34118
+ }
34119
+ const trimmed = value.trim().toLowerCase();
34120
+ if (!trimmed) {
34121
+ return;
34122
+ }
34123
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
34124
+ if (tokens.length === 0) {
34125
+ return;
34126
+ }
34127
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
34128
+ return commandTokens.join(".");
34129
+ }
34130
+ function getCommandProductModeAttribution(commandPath) {
34131
+ const normalized = normalizeCommandPath(commandPath);
34132
+ if (!normalized) {
34133
+ return;
34134
+ }
34135
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
34136
+ }
34137
+ function normalizeSkillNameWithOptions(value, options) {
34138
+ if (typeof value !== "string") {
34139
+ return;
34140
+ }
34141
+ const normalized = value.trim().toLowerCase();
34142
+ if (!normalized) {
34143
+ return;
34144
+ }
34145
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
34146
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
34147
+ return;
34148
+ }
34149
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
34150
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
34151
+ return;
34152
+ }
34153
+ return skillName;
34154
+ }
34155
+ function normalizeSkillName(value) {
34156
+ return normalizeSkillNameWithOptions(value, {
34157
+ allowLegacyNamespace: false
34158
+ });
34159
+ }
34160
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
34161
+ const skillName = normalizeSkillName(skillSource);
34162
+ return {
34163
+ ...skillName ? { skill_name: skillName } : {},
34164
+ ...getCommandProductModeAttribution(commandPath)
34165
+ };
34166
+ }
34167
+
33621
34168
  // ../common/src/telemetry/pii-redactor.ts
33622
34169
  var REDACTED = "[REDACTED]";
33623
34170
  var MAX_VALUE_LENGTH = 200;
@@ -33803,6 +34350,12 @@ function commandHelpHint(commandPath) {
33803
34350
  const command = commandPath.replace(/\./g, " ");
33804
34351
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
33805
34352
  }
34353
+ function isPromptCancellation(error) {
34354
+ return error instanceof Error && error.name === "ExitPromptError";
34355
+ }
34356
+ function exitCodeFromProcess(fallback) {
34357
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
34358
+ }
33806
34359
  Command.prototype.trackedAction = function(context, fn, properties) {
33807
34360
  const command = this;
33808
34361
  return this.action(async (...args) => {
@@ -33810,6 +34363,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
33810
34363
  const props = typeof properties === "function" ? properties(...args) : properties;
33811
34364
  const startTime = performance.now();
33812
34365
  let errorMessage;
34366
+ let fallbackExitCode = EXIT_CODES.Success;
34367
+ clearRecordedCommandFailureTelemetry();
33813
34368
  const [error] = await catchError(fn(...args));
33814
34369
  if (error) {
33815
34370
  errorMessage = error instanceof Error ? error.message : String(error);
@@ -33824,6 +34379,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
33824
34379
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
33825
34380
  const typedContext = typed.context ?? typed.Context;
33826
34381
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
34382
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
34383
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
33827
34384
  OutputFormatter.error({
33828
34385
  Result: finalResult,
33829
34386
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -33832,16 +34389,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
33832
34389
  ...customRetry ? { Retry: customRetry } : {},
33833
34390
  ...customContext ? { Context: customContext } : {}
33834
34391
  });
33835
- context.exit(EXIT_CODES[finalResult]);
34392
+ context.exit(fallbackExitCode);
33836
34393
  }
33837
34394
  const durationMs = performance.now() - startTime;
33838
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
34395
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
34396
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
34397
+ const success = !error && exitCode === 0;
34398
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
34399
+ error,
34400
+ exitCode,
34401
+ recordedFailure,
34402
+ pollSignal: context.pollSignal
34403
+ });
33839
34404
  telemetry.trackEvent(telemetryName, redactProperties({
33840
34405
  ...extractCommandParams(command),
33841
34406
  ...props,
34407
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
33842
34408
  command: "true",
33843
34409
  duration: String(durationMs),
33844
34410
  success: String(success),
34411
+ ...terminalTelemetry,
33845
34412
  ...errorMessage ? { errorMessage } : {}
33846
34413
  }));
33847
34414
  });
@@ -33926,6 +34493,8 @@ var ScreenLogger;
33926
34493
  })(ScreenLogger ||= {});
33927
34494
  // ../common/src/sdk-user-agent.ts
33928
34495
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
34496
+ // ../common/src/telemetry/ship-succeeded.ts
34497
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
33929
34498
  // ../common/src/tool-provider.ts
33930
34499
  var factorySlot = singleton("PackagerFactoryProvider");
33931
34500
  // ../auth/src/config.ts
@@ -44403,4 +44972,4 @@ export {
44403
44972
  metadata
44404
44973
  };
44405
44974
 
44406
- //# debugId=8D63E09CBEEDE44164756E2164756E21
44975
+ //# debugId=394EEC5D1142D25A64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/docsai-tool",
3
3
  "license": "MIT",
4
- "version": "1.197.0-preview.64",
4
+ "version": "1.197.0-preview.66",
5
5
  "description": "Search UiPath documentation with AI-powered answers.",
6
6
  "private": false,
7
7
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
- "gitHead": "3977b977945bf519336258da69fd271433eaaef4"
29
+ "gitHead": "386b0837882b19062bf744c74949cdf9c5e48dea"
30
30
  }