@uipath/context-grounding-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 +579 -9
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -26284,9 +26284,228 @@ function getOutputFilter() {
26284
26284
  return filterSlot.get();
26285
26285
  }
26286
26286
 
26287
+ // ../common/src/telemetry/command-terminal.ts
26288
+ var recordedFailureSlot = singleton("CommandTelemetryFailure");
26289
+ var AUTH_ERROR_CODES = new Set([
26290
+ "authentication_required",
26291
+ "permission_denied"
26292
+ ]);
26293
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
26294
+ var NETWORK_HTTP_ERROR_CODES = new Set([
26295
+ "network_error",
26296
+ "rate_limited",
26297
+ "server_error",
26298
+ "not_found",
26299
+ "method_not_allowed"
26300
+ ]);
26301
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
26302
+ var NETWORK_OS_ERROR_CODES = new Set([
26303
+ "ECONNREFUSED",
26304
+ "ECONNRESET",
26305
+ "ENOTFOUND",
26306
+ "EAI_AGAIN",
26307
+ "EPIPE",
26308
+ "EHOSTUNREACH",
26309
+ "ENETUNREACH",
26310
+ "EAI_FAIL"
26311
+ ]);
26312
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
26313
+ var TLS_ERROR_CODES2 = new Set([
26314
+ "SELF_SIGNED_CERT_IN_CHAIN",
26315
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
26316
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
26317
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
26318
+ "UNABLE_TO_GET_ISSUER_CERT",
26319
+ "CERT_HAS_EXPIRED",
26320
+ "CERT_UNTRUSTED",
26321
+ "ERR_TLS_CERT_ALTNAME_INVALID"
26322
+ ]);
26323
+ var MISSING_DEPENDENCY_CODES = new Set([
26324
+ "MODULE_NOT_FOUND",
26325
+ "ERR_MODULE_NOT_FOUND"
26326
+ ]);
26327
+ var INTERNAL_ERROR_NAMES = new Set([
26328
+ "TypeError",
26329
+ "ReferenceError",
26330
+ "SyntaxError",
26331
+ "RangeError"
26332
+ ]);
26333
+ function isRecord(value) {
26334
+ return value !== null && typeof value === "object";
26335
+ }
26336
+ function stringField(value, field) {
26337
+ if (!isRecord(value)) {
26338
+ return;
26339
+ }
26340
+ const raw = value[field];
26341
+ return typeof raw === "string" ? raw : undefined;
26342
+ }
26343
+ function numberField(value, field) {
26344
+ if (!isRecord(value)) {
26345
+ return;
26346
+ }
26347
+ const raw = value[field];
26348
+ return typeof raw === "number" ? raw : undefined;
26349
+ }
26350
+ function findStringInCauseChain(error, field) {
26351
+ let current = error;
26352
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
26353
+ const value = stringField(current, field);
26354
+ if (value) {
26355
+ return value;
26356
+ }
26357
+ current = current.cause;
26358
+ }
26359
+ return;
26360
+ }
26361
+ function findCodeInCauseChain(error) {
26362
+ return findStringInCauseChain(error, "code");
26363
+ }
26364
+ function isSpawnEnoent(error) {
26365
+ const code = findCodeInCauseChain(error);
26366
+ if (code !== "ENOENT") {
26367
+ return false;
26368
+ }
26369
+ const syscall = findStringInCauseChain(error, "syscall");
26370
+ return syscall?.startsWith("spawn") === true;
26371
+ }
26372
+ function isCancellationError(error, exitCode, pollSignal) {
26373
+ if (exitCode === 130) {
26374
+ return true;
26375
+ }
26376
+ if (!isRecord(error)) {
26377
+ return false;
26378
+ }
26379
+ if (numberField(error, "exitCode") === 130) {
26380
+ return true;
26381
+ }
26382
+ const name = stringField(error, "name");
26383
+ if (name === "ExitPromptError") {
26384
+ return true;
26385
+ }
26386
+ if (name === "AbortError" && pollSignal?.aborted) {
26387
+ return true;
26388
+ }
26389
+ const message = stringField(error, "message");
26390
+ return message?.includes("SIGINT") === true;
26391
+ }
26392
+ function terminalSignalFor(input, outcome) {
26393
+ if (input.recordedFailure?.terminalSignal) {
26394
+ return input.recordedFailure.terminalSignal;
26395
+ }
26396
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
26397
+ if (explicit) {
26398
+ return explicit;
26399
+ }
26400
+ return outcome === "cancelled" ? "SIGINT" : undefined;
26401
+ }
26402
+ function classifyHttpStatus(status) {
26403
+ if (status === 401 || status === 403) {
26404
+ return "auth";
26405
+ }
26406
+ if (status === 400 || status === 409 || status === 422) {
26407
+ return "validation";
26408
+ }
26409
+ if (status === 408) {
26410
+ return "timeout";
26411
+ }
26412
+ return "network_http";
26413
+ }
26414
+ function classifyFromResult(result) {
26415
+ switch (result) {
26416
+ case "AuthenticationError":
26417
+ return "auth";
26418
+ case "ValidationError":
26419
+ return "validation";
26420
+ case "TimeoutError":
26421
+ return "timeout";
26422
+ default:
26423
+ return;
26424
+ }
26425
+ }
26426
+ function classifyFromErrorCode(errorCode) {
26427
+ if (!errorCode) {
26428
+ return;
26429
+ }
26430
+ if (AUTH_ERROR_CODES.has(errorCode)) {
26431
+ return "auth";
26432
+ }
26433
+ if (VALIDATION_ERROR_CODES.has(errorCode)) {
26434
+ return "validation";
26435
+ }
26436
+ if (TIMEOUT_ERROR_CODES.has(errorCode)) {
26437
+ return "timeout";
26438
+ }
26439
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
26440
+ return "network_http";
26441
+ }
26442
+ return;
26443
+ }
26444
+ function classifyFromError(error) {
26445
+ const code = findCodeInCauseChain(error);
26446
+ if (code) {
26447
+ if (code.startsWith("commander.")) {
26448
+ return "validation";
26449
+ }
26450
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
26451
+ return "network_http";
26452
+ }
26453
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
26454
+ return "timeout";
26455
+ }
26456
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
26457
+ return "missing_dependency";
26458
+ }
26459
+ }
26460
+ const message = stringField(error, "message");
26461
+ if (message?.includes("fetch failed") === true) {
26462
+ return "network_http";
26463
+ }
26464
+ const name = stringField(error, "name");
26465
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
26466
+ return "internal";
26467
+ }
26468
+ return;
26469
+ }
26470
+ function classifyError(input) {
26471
+ const recorded = input.recordedFailure;
26472
+ if (recorded?.errorClass) {
26473
+ return recorded.errorClass;
26474
+ }
26475
+ const status = recorded?.context?.httpStatus;
26476
+ if (status !== undefined) {
26477
+ return classifyHttpStatus(status);
26478
+ }
26479
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
26480
+ }
26481
+ function recordCommandFailureTelemetry(failure) {
26482
+ recordedFailureSlot.set(failure);
26483
+ }
26484
+ function clearRecordedCommandFailureTelemetry() {
26485
+ recordedFailureSlot.clear();
26486
+ }
26487
+ function takeRecordedCommandFailureTelemetry() {
26488
+ const failure = recordedFailureSlot.get();
26489
+ recordedFailureSlot.clear();
26490
+ return failure;
26491
+ }
26492
+ function buildCommandTerminalTelemetryProperties(input) {
26493
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
26494
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
26495
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
26496
+ const terminalSignal = terminalSignalFor(input, outcome);
26497
+ return {
26498
+ exit_code: input.exitCode,
26499
+ terminal_outcome: outcome,
26500
+ ...errorClass ? { error_class: errorClass } : {},
26501
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
26502
+ };
26503
+ }
26504
+
26287
26505
  // ../common/src/telemetry/telemetry-events.ts
26288
26506
  var CommonTelemetryEvents = {
26289
- Error: "uip.error"
26507
+ Error: "uip.error",
26508
+ ShipSucceeded: "ship_succeeded"
26290
26509
  };
26291
26510
 
26292
26511
  // ../common/src/registry.ts
@@ -26353,6 +26572,136 @@ function formatMessage(category, name, properties) {
26353
26572
  }
26354
26573
  return message;
26355
26574
  }
26575
+ // ../common/src/telemetry/detect-agent.ts
26576
+ var KNOWN_AGENTS = [
26577
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
26578
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
26579
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
26580
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
26581
+ { envVar: "CODEX_SANDBOX", id: "codex" },
26582
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
26583
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
26584
+ ];
26585
+ function detectAgentFromEnv(env) {
26586
+ for (const agent of KNOWN_AGENTS) {
26587
+ const envValue = env[agent.envVar];
26588
+ if (agent.value !== undefined) {
26589
+ if (envValue === agent.value)
26590
+ return agent.id;
26591
+ } else {
26592
+ if (envValue)
26593
+ return agent.id;
26594
+ }
26595
+ }
26596
+ const agentEnv = env.AGENT;
26597
+ if (agentEnv) {
26598
+ if (agentEnv === "1" || agentEnv === "true")
26599
+ return "unknown";
26600
+ if (agentEnv.length <= 32)
26601
+ return agentEnv.toLowerCase();
26602
+ }
26603
+ return;
26604
+ }
26605
+ // ../common/src/telemetry/environment-info.ts
26606
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
26607
+ // ../common/src/telemetry/execution-context.ts
26608
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
26609
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
26610
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
26611
+ var CI_SIGNATURES = [
26612
+ {
26613
+ provider: "github_actions",
26614
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
26615
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
26616
+ },
26617
+ {
26618
+ provider: "azure_devops",
26619
+ matches: (env) => isTruthy(env.TF_BUILD),
26620
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
26621
+ },
26622
+ {
26623
+ provider: "gitlab",
26624
+ matches: (env) => isTruthy(env.GITLAB_CI),
26625
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
26626
+ },
26627
+ {
26628
+ provider: "circleci",
26629
+ matches: (env) => isTruthy(env.CIRCLECI),
26630
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
26631
+ },
26632
+ {
26633
+ provider: "jenkins",
26634
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
26635
+ },
26636
+ {
26637
+ provider: "teamcity",
26638
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
26639
+ },
26640
+ {
26641
+ provider: "buildkite",
26642
+ matches: (env) => isTruthy(env.BUILDKITE),
26643
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
26644
+ },
26645
+ {
26646
+ provider: "bitbucket",
26647
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
26648
+ },
26649
+ {
26650
+ provider: "travis",
26651
+ matches: (env) => isTruthy(env.TRAVIS)
26652
+ },
26653
+ {
26654
+ provider: "appveyor",
26655
+ matches: (env) => isTruthy(env.APPVEYOR)
26656
+ },
26657
+ {
26658
+ provider: "generic",
26659
+ matches: (env) => isTruthy(env.CI)
26660
+ }
26661
+ ];
26662
+ function currentEnv() {
26663
+ return typeof process === "undefined" ? {} : process.env;
26664
+ }
26665
+ function currentTtyState() {
26666
+ if (typeof process === "undefined")
26667
+ return false;
26668
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
26669
+ }
26670
+ function detectCi(env) {
26671
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
26672
+ if (!signature)
26673
+ return;
26674
+ return {
26675
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
26676
+ ciProvider: signature.provider
26677
+ };
26678
+ }
26679
+ function detectExecutionContext(options = {}) {
26680
+ const env = options.env ?? currentEnv();
26681
+ const ci = detectCi(env);
26682
+ if (ci)
26683
+ return ci;
26684
+ const agent = options.agent ?? detectAgentFromEnv(env);
26685
+ if (agent) {
26686
+ return { executionContext: "agent" };
26687
+ }
26688
+ const authSignal = options.authSignal ?? authSignalSlot.get();
26689
+ if (authSignal === "service_account") {
26690
+ return { executionContext: "service_account" };
26691
+ }
26692
+ const isTty = options.isTty ?? currentTtyState();
26693
+ if (isTty) {
26694
+ return { executionContext: "manual" };
26695
+ }
26696
+ return { executionContext: "unknown" };
26697
+ }
26698
+ function getExecutionContextTelemetryProperties() {
26699
+ const detected = detectExecutionContext();
26700
+ return {
26701
+ execution_context: detected.executionContext,
26702
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
26703
+ };
26704
+ }
26356
26705
  // ../common/src/telemetry/node-context-storage.ts
26357
26706
  import { AsyncLocalStorage } from "node:async_hooks";
26358
26707
 
@@ -26365,6 +26714,26 @@ class NodeContextStorage {
26365
26714
  return this.storage.getStore();
26366
26715
  }
26367
26716
  }
26717
+ // ../common/src/telemetry/session-id.ts
26718
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
26719
+ var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
26720
+ var telemetrySessionIdSlot = singleton("TelemetrySessionId");
26721
+ function getProcessEnv() {
26722
+ return globalThis.process?.env;
26723
+ }
26724
+ function normalizeSessionId(value) {
26725
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
26726
+ return;
26727
+ }
26728
+ const trimmed = String(value).trim();
26729
+ return trimmed || undefined;
26730
+ }
26731
+ function getConfiguredTelemetrySessionId() {
26732
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
26733
+ }
26734
+ function resolveTelemetrySessionId(existingSessionId) {
26735
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
26736
+ }
26368
26737
  // ../common/src/telemetry/global-telemetry-properties.ts
26369
26738
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
26370
26739
  function getGlobalTelemetryProperties() {
@@ -26449,12 +26818,22 @@ class TelemetryService {
26449
26818
  return this.contextStorage.getContext();
26450
26819
  }
26451
26820
  enrichPropertiesWithContext(properties, context) {
26452
- return {
26453
- ...getGlobalTelemetryProperties(),
26821
+ const globalProperties = getGlobalTelemetryProperties();
26822
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
26823
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
26824
+ const enriched = {
26825
+ ...getExecutionContextTelemetryProperties(),
26826
+ ...globalProperties,
26454
26827
  ...this.defaultProperties,
26455
26828
  ...properties,
26456
26829
  ...context
26457
26830
  };
26831
+ if (sessionId === undefined) {
26832
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
26833
+ } else {
26834
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
26835
+ }
26836
+ return enriched;
26458
26837
  }
26459
26838
  generateId() {
26460
26839
  return crypto.randomUUID().replaceAll("-", "");
@@ -26924,8 +27303,24 @@ var OutputFormatter;
26924
27303
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
26925
27304
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
26926
27305
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
26927
- const { SuppressTelemetry, ...envelope } = data;
26928
- if (!SuppressTelemetry) {
27306
+ recordCommandFailureTelemetry({
27307
+ result: data.Result,
27308
+ errorCode: data.ErrorCode,
27309
+ retry: data.Retry,
27310
+ message: data.Message,
27311
+ context: data.Context,
27312
+ exitCode: process.exitCode,
27313
+ errorClass: data.TelemetryErrorClass,
27314
+ terminalOutcome: data.TelemetryTerminalOutcome,
27315
+ terminalSignal: data.TelemetryTerminalSignal
27316
+ });
27317
+ const suppressTelemetry = data.SuppressTelemetry === true;
27318
+ const envelope = { ...data };
27319
+ delete envelope.SuppressTelemetry;
27320
+ delete envelope.TelemetryErrorClass;
27321
+ delete envelope.TelemetryTerminalOutcome;
27322
+ delete envelope.TelemetryTerminalSignal;
27323
+ if (!suppressTelemetry) {
26929
27324
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
26930
27325
  result: data.Result,
26931
27326
  errorCode: data.ErrorCode,
@@ -26988,6 +27383,158 @@ var OutputFormatter;
26988
27383
  OutputFormatter.formatToString = formatToString;
26989
27384
  })(OutputFormatter ||= {});
26990
27385
 
27386
+ // ../common/src/telemetry/command-attribution.ts
27387
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
27388
+ var MAX_SKILL_NAME_LENGTH = 80;
27389
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
27390
+ function productMode(productArea, mode) {
27391
+ return { product_area: productArea, mode };
27392
+ }
27393
+ function attributionRecord(groups) {
27394
+ const record = {};
27395
+ for (const [productArea, mode, names] of groups) {
27396
+ const attribution = productMode(productArea, mode);
27397
+ for (const name of names) {
27398
+ record[name] = attribution;
27399
+ }
27400
+ }
27401
+ return record;
27402
+ }
27403
+ function commandAttribution(groups) {
27404
+ const entries = [];
27405
+ for (const [productArea, mode, prefixes] of groups) {
27406
+ const attribution = productMode(productArea, mode);
27407
+ for (const prefix of prefixes) {
27408
+ entries.push({ prefix, attribution });
27409
+ }
27410
+ }
27411
+ return entries;
27412
+ }
27413
+ var SKILL_ATTRIBUTION = attributionRecord([
27414
+ ["admin", "operate", ["uipath-admin"]],
27415
+ ["agents", "build", ["uipath-agents"]],
27416
+ ["api-workflow", "build", ["uipath-api-workflow"]],
27417
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
27418
+ ["coded-apps", "build", ["uipath-coded-apps"]],
27419
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
27420
+ ["cli", "troubleshoot", ["uipath-feedback"]],
27421
+ ["governance", "operate", ["uipath-governance"]],
27422
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
27423
+ ["document-understanding", "build", ["uipath-ixp"]],
27424
+ [
27425
+ "maestro",
27426
+ "build",
27427
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
27428
+ ],
27429
+ ["agenthub", "build", ["uipath-mcp-servers"]],
27430
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
27431
+ ["platform", "operate", ["uipath-platform"]],
27432
+ ["quality", "troubleshoot", ["uipath-review"]],
27433
+ ["rpa", "build", ["uipath-rpa"]],
27434
+ ["cli", "operate", ["uipath-skill-catalog"]],
27435
+ ["action-center", "operate", ["uipath-tasks"]],
27436
+ ["test-manager", "operate", ["uipath-test"]],
27437
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
27438
+ ]);
27439
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
27440
+ var COMMAND_ATTRIBUTION = commandAttribution([
27441
+ ["cli", "troubleshoot", ["uip.feedback"]],
27442
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
27443
+ ["context-grounding", "build", ["uip.context-grounding"]],
27444
+ ["api-workflow", "build", ["uip.api-workflow"]],
27445
+ ["rpa", "build", ["uip.rpa-legacy"]],
27446
+ ["conversational", "operate", ["uip.conversational"]],
27447
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
27448
+ ["agenthub", "build", ["uip.agenthub"]],
27449
+ ["coded-apps", "build", ["uip.codedapp"]],
27450
+ ["functions", "build", ["uip.functions"]],
27451
+ ["solution", "build", ["uip.solution"]],
27452
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
27453
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
27454
+ ["platform", "operate", ["uip.platform"]],
27455
+ ["admin", "operate", ["uip.admin"]],
27456
+ ["automation-ops", "operate", ["uip.aops"]],
27457
+ ["documentation", "troubleshoot", ["uip.docsai"]],
27458
+ ["governance", "operate", ["uip.gov"]],
27459
+ ["insights", "operate", ["uip.insights"]],
27460
+ ["document-understanding", "build", ["uip.ixp"]],
27461
+ ["process-mining", "operate", ["uip.pm"]],
27462
+ ["action-center", "operate", ["uip.tasks"]],
27463
+ ["test-manager", "operate", ["uip.tm"]],
27464
+ ["vertical-solutions", "build", ["uip.vss"]],
27465
+ ["data-fabric", "operate", ["uip.df"]],
27466
+ ["integration-service", "build", ["uip.is"]],
27467
+ ["orchestrator", "operate", ["uip.or"]],
27468
+ [
27469
+ "cli",
27470
+ "operate",
27471
+ [
27472
+ "uip.login",
27473
+ "uip.logout",
27474
+ "uip.user",
27475
+ "uip.config",
27476
+ "uip.tools",
27477
+ "uip.skills",
27478
+ "uip.completion",
27479
+ "uip.update",
27480
+ "uip.mcp",
27481
+ "uip.track"
27482
+ ]
27483
+ ]
27484
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
27485
+ function normalizeCommandPath(value) {
27486
+ if (typeof value !== "string") {
27487
+ return;
27488
+ }
27489
+ const trimmed = value.trim().toLowerCase();
27490
+ if (!trimmed) {
27491
+ return;
27492
+ }
27493
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
27494
+ if (tokens.length === 0) {
27495
+ return;
27496
+ }
27497
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
27498
+ return commandTokens.join(".");
27499
+ }
27500
+ function getCommandProductModeAttribution(commandPath) {
27501
+ const normalized = normalizeCommandPath(commandPath);
27502
+ if (!normalized) {
27503
+ return;
27504
+ }
27505
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
27506
+ }
27507
+ function normalizeSkillNameWithOptions(value, options) {
27508
+ if (typeof value !== "string") {
27509
+ return;
27510
+ }
27511
+ const normalized = value.trim().toLowerCase();
27512
+ if (!normalized) {
27513
+ return;
27514
+ }
27515
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
27516
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
27517
+ return;
27518
+ }
27519
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
27520
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
27521
+ return;
27522
+ }
27523
+ return skillName;
27524
+ }
27525
+ function normalizeSkillName(value) {
27526
+ return normalizeSkillNameWithOptions(value, {
27527
+ allowLegacyNamespace: false
27528
+ });
27529
+ }
27530
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
27531
+ const skillName = normalizeSkillName(skillSource);
27532
+ return {
27533
+ ...skillName ? { skill_name: skillName } : {},
27534
+ ...getCommandProductModeAttribution(commandPath)
27535
+ };
27536
+ }
27537
+
26991
27538
  // ../common/src/telemetry/pii-redactor.ts
26992
27539
  var REDACTED = "[REDACTED]";
26993
27540
  var MAX_VALUE_LENGTH = 200;
@@ -27173,6 +27720,12 @@ function commandHelpHint(commandPath) {
27173
27720
  const command = commandPath.replace(/\./g, " ");
27174
27721
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
27175
27722
  }
27723
+ function isPromptCancellation(error) {
27724
+ return error instanceof Error && error.name === "ExitPromptError";
27725
+ }
27726
+ function exitCodeFromProcess(fallback) {
27727
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
27728
+ }
27176
27729
  Command.prototype.trackedAction = function(context, fn, properties) {
27177
27730
  const command = this;
27178
27731
  return this.action(async (...args) => {
@@ -27180,6 +27733,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27180
27733
  const props = typeof properties === "function" ? properties(...args) : properties;
27181
27734
  const startTime = performance.now();
27182
27735
  let errorMessage;
27736
+ let fallbackExitCode = EXIT_CODES.Success;
27737
+ clearRecordedCommandFailureTelemetry();
27183
27738
  const [error] = await catchError(fn(...args));
27184
27739
  if (error) {
27185
27740
  errorMessage = error instanceof Error ? error.message : String(error);
@@ -27194,6 +27749,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27194
27749
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
27195
27750
  const typedContext = typed.context ?? typed.Context;
27196
27751
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
27752
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
27753
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
27197
27754
  OutputFormatter.error({
27198
27755
  Result: finalResult,
27199
27756
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -27202,16 +27759,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27202
27759
  ...customRetry ? { Retry: customRetry } : {},
27203
27760
  ...customContext ? { Context: customContext } : {}
27204
27761
  });
27205
- context.exit(EXIT_CODES[finalResult]);
27762
+ context.exit(fallbackExitCode);
27206
27763
  }
27207
27764
  const durationMs = performance.now() - startTime;
27208
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
27765
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
27766
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
27767
+ const success = !error && exitCode === 0;
27768
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
27769
+ error,
27770
+ exitCode,
27771
+ recordedFailure,
27772
+ pollSignal: context.pollSignal
27773
+ });
27209
27774
  telemetry.trackEvent(telemetryName, redactProperties({
27210
27775
  ...extractCommandParams(command),
27211
27776
  ...props,
27777
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
27212
27778
  command: "true",
27213
27779
  duration: String(durationMs),
27214
27780
  success: String(success),
27781
+ ...terminalTelemetry,
27215
27782
  ...errorMessage ? { errorMessage } : {}
27216
27783
  }));
27217
27784
  });
@@ -27280,6 +27847,8 @@ var ScreenLogger;
27280
27847
  })(ScreenLogger ||= {});
27281
27848
  // ../common/src/sdk-user-agent.ts
27282
27849
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
27850
+ // ../common/src/telemetry/ship-succeeded.ts
27851
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
27283
27852
  // ../common/src/tool-provider.ts
27284
27853
  var factorySlot = singleton("PackagerFactoryProvider");
27285
27854
  // ../uipath-python-bridge/src/cache.ts
@@ -28767,6 +29336,7 @@ function createExecuteCommand(config) {
28767
29336
  });
28768
29337
  }
28769
29338
  processContext.exit(result.exitCode);
29339
+ return result;
28770
29340
  };
28771
29341
  const registerExecCommand = (program2) => {
28772
29342
  program2.command("exec", { hidden: true }).description("Execute the uipath package with provided arguments").allowUnknownOption(true).allowExcessArguments(true).trackedAction(processContext, config.telemetryEvent, async (_options, cmd) => {
@@ -29267,7 +29837,7 @@ function createCommandForwarder(executeCommand) {
29267
29837
  var package_default = {
29268
29838
  name: "@uipath/context-grounding-tool",
29269
29839
  license: "MIT",
29270
- version: "1.197.0-preview.64",
29840
+ version: "1.197.0-preview.66",
29271
29841
  description: "Tool for context grounding operations via the UiPath Python SDK",
29272
29842
  keywords: [
29273
29843
  "uipcli-tool",
@@ -29370,4 +29940,4 @@ export {
29370
29940
  metadata
29371
29941
  };
29372
29942
 
29373
- //# debugId=17C7FC8510DD585464756E2164756E21
29943
+ //# debugId=1FFC0D07044F308164756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/context-grounding-tool",
3
3
  "license": "MIT",
4
- "version": "1.197.0-preview.64",
4
+ "version": "1.197.0-preview.66",
5
5
  "description": "Tool for context grounding operations via the UiPath Python SDK",
6
6
  "keywords": [
7
7
  "uipcli-tool",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "registry": "https://registry.npmjs.org/"
30
30
  },
31
- "gitHead": "3977b977945bf519336258da69fd271433eaaef4"
31
+ "gitHead": "386b0837882b19062bf744c74949cdf9c5e48dea"
32
32
  }