@uipath/codedagent-tool 1.197.0-preview.65 → 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 (3) hide show
  1. package/dist/init.js +577 -8
  2. package/dist/tool.js +636 -10
  3. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -26299,9 +26299,228 @@ function getOutputFilter() {
26299
26299
  return filterSlot.get();
26300
26300
  }
26301
26301
 
26302
+ // ../common/src/telemetry/command-terminal.ts
26303
+ var recordedFailureSlot = singleton("CommandTelemetryFailure");
26304
+ var AUTH_ERROR_CODES = new Set([
26305
+ "authentication_required",
26306
+ "permission_denied"
26307
+ ]);
26308
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
26309
+ var NETWORK_HTTP_ERROR_CODES = new Set([
26310
+ "network_error",
26311
+ "rate_limited",
26312
+ "server_error",
26313
+ "not_found",
26314
+ "method_not_allowed"
26315
+ ]);
26316
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
26317
+ var NETWORK_OS_ERROR_CODES = new Set([
26318
+ "ECONNREFUSED",
26319
+ "ECONNRESET",
26320
+ "ENOTFOUND",
26321
+ "EAI_AGAIN",
26322
+ "EPIPE",
26323
+ "EHOSTUNREACH",
26324
+ "ENETUNREACH",
26325
+ "EAI_FAIL"
26326
+ ]);
26327
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
26328
+ var TLS_ERROR_CODES2 = new Set([
26329
+ "SELF_SIGNED_CERT_IN_CHAIN",
26330
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
26331
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
26332
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
26333
+ "UNABLE_TO_GET_ISSUER_CERT",
26334
+ "CERT_HAS_EXPIRED",
26335
+ "CERT_UNTRUSTED",
26336
+ "ERR_TLS_CERT_ALTNAME_INVALID"
26337
+ ]);
26338
+ var MISSING_DEPENDENCY_CODES = new Set([
26339
+ "MODULE_NOT_FOUND",
26340
+ "ERR_MODULE_NOT_FOUND"
26341
+ ]);
26342
+ var INTERNAL_ERROR_NAMES = new Set([
26343
+ "TypeError",
26344
+ "ReferenceError",
26345
+ "SyntaxError",
26346
+ "RangeError"
26347
+ ]);
26348
+ function isRecord(value) {
26349
+ return value !== null && typeof value === "object";
26350
+ }
26351
+ function stringField(value, field) {
26352
+ if (!isRecord(value)) {
26353
+ return;
26354
+ }
26355
+ const raw = value[field];
26356
+ return typeof raw === "string" ? raw : undefined;
26357
+ }
26358
+ function numberField(value, field) {
26359
+ if (!isRecord(value)) {
26360
+ return;
26361
+ }
26362
+ const raw = value[field];
26363
+ return typeof raw === "number" ? raw : undefined;
26364
+ }
26365
+ function findStringInCauseChain(error, field) {
26366
+ let current = error;
26367
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
26368
+ const value = stringField(current, field);
26369
+ if (value) {
26370
+ return value;
26371
+ }
26372
+ current = current.cause;
26373
+ }
26374
+ return;
26375
+ }
26376
+ function findCodeInCauseChain(error) {
26377
+ return findStringInCauseChain(error, "code");
26378
+ }
26379
+ function isSpawnEnoent(error) {
26380
+ const code = findCodeInCauseChain(error);
26381
+ if (code !== "ENOENT") {
26382
+ return false;
26383
+ }
26384
+ const syscall = findStringInCauseChain(error, "syscall");
26385
+ return syscall?.startsWith("spawn") === true;
26386
+ }
26387
+ function isCancellationError(error, exitCode, pollSignal) {
26388
+ if (exitCode === 130) {
26389
+ return true;
26390
+ }
26391
+ if (!isRecord(error)) {
26392
+ return false;
26393
+ }
26394
+ if (numberField(error, "exitCode") === 130) {
26395
+ return true;
26396
+ }
26397
+ const name = stringField(error, "name");
26398
+ if (name === "ExitPromptError") {
26399
+ return true;
26400
+ }
26401
+ if (name === "AbortError" && pollSignal?.aborted) {
26402
+ return true;
26403
+ }
26404
+ const message = stringField(error, "message");
26405
+ return message?.includes("SIGINT") === true;
26406
+ }
26407
+ function terminalSignalFor(input, outcome) {
26408
+ if (input.recordedFailure?.terminalSignal) {
26409
+ return input.recordedFailure.terminalSignal;
26410
+ }
26411
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
26412
+ if (explicit) {
26413
+ return explicit;
26414
+ }
26415
+ return outcome === "cancelled" ? "SIGINT" : undefined;
26416
+ }
26417
+ function classifyHttpStatus(status) {
26418
+ if (status === 401 || status === 403) {
26419
+ return "auth";
26420
+ }
26421
+ if (status === 400 || status === 409 || status === 422) {
26422
+ return "validation";
26423
+ }
26424
+ if (status === 408) {
26425
+ return "timeout";
26426
+ }
26427
+ return "network_http";
26428
+ }
26429
+ function classifyFromResult(result) {
26430
+ switch (result) {
26431
+ case "AuthenticationError":
26432
+ return "auth";
26433
+ case "ValidationError":
26434
+ return "validation";
26435
+ case "TimeoutError":
26436
+ return "timeout";
26437
+ default:
26438
+ return;
26439
+ }
26440
+ }
26441
+ function classifyFromErrorCode(errorCode) {
26442
+ if (!errorCode) {
26443
+ return;
26444
+ }
26445
+ if (AUTH_ERROR_CODES.has(errorCode)) {
26446
+ return "auth";
26447
+ }
26448
+ if (VALIDATION_ERROR_CODES.has(errorCode)) {
26449
+ return "validation";
26450
+ }
26451
+ if (TIMEOUT_ERROR_CODES.has(errorCode)) {
26452
+ return "timeout";
26453
+ }
26454
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
26455
+ return "network_http";
26456
+ }
26457
+ return;
26458
+ }
26459
+ function classifyFromError(error) {
26460
+ const code = findCodeInCauseChain(error);
26461
+ if (code) {
26462
+ if (code.startsWith("commander.")) {
26463
+ return "validation";
26464
+ }
26465
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
26466
+ return "network_http";
26467
+ }
26468
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
26469
+ return "timeout";
26470
+ }
26471
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
26472
+ return "missing_dependency";
26473
+ }
26474
+ }
26475
+ const message = stringField(error, "message");
26476
+ if (message?.includes("fetch failed") === true) {
26477
+ return "network_http";
26478
+ }
26479
+ const name = stringField(error, "name");
26480
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
26481
+ return "internal";
26482
+ }
26483
+ return;
26484
+ }
26485
+ function classifyError(input) {
26486
+ const recorded = input.recordedFailure;
26487
+ if (recorded?.errorClass) {
26488
+ return recorded.errorClass;
26489
+ }
26490
+ const status = recorded?.context?.httpStatus;
26491
+ if (status !== undefined) {
26492
+ return classifyHttpStatus(status);
26493
+ }
26494
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
26495
+ }
26496
+ function recordCommandFailureTelemetry(failure) {
26497
+ recordedFailureSlot.set(failure);
26498
+ }
26499
+ function clearRecordedCommandFailureTelemetry() {
26500
+ recordedFailureSlot.clear();
26501
+ }
26502
+ function takeRecordedCommandFailureTelemetry() {
26503
+ const failure = recordedFailureSlot.get();
26504
+ recordedFailureSlot.clear();
26505
+ return failure;
26506
+ }
26507
+ function buildCommandTerminalTelemetryProperties(input) {
26508
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
26509
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
26510
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
26511
+ const terminalSignal = terminalSignalFor(input, outcome);
26512
+ return {
26513
+ exit_code: input.exitCode,
26514
+ terminal_outcome: outcome,
26515
+ ...errorClass ? { error_class: errorClass } : {},
26516
+ ...terminalSignal ? { terminal_signal: terminalSignal } : {}
26517
+ };
26518
+ }
26519
+
26302
26520
  // ../common/src/telemetry/telemetry-events.ts
26303
26521
  var CommonTelemetryEvents = {
26304
- Error: "uip.error"
26522
+ Error: "uip.error",
26523
+ ShipSucceeded: "ship_succeeded"
26305
26524
  };
26306
26525
 
26307
26526
  // ../common/src/registry.ts
@@ -26368,6 +26587,136 @@ function formatMessage(category, name, properties) {
26368
26587
  }
26369
26588
  return message;
26370
26589
  }
26590
+ // ../common/src/telemetry/detect-agent.ts
26591
+ var KNOWN_AGENTS = [
26592
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
26593
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
26594
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
26595
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
26596
+ { envVar: "CODEX_SANDBOX", id: "codex" },
26597
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
26598
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
26599
+ ];
26600
+ function detectAgentFromEnv(env) {
26601
+ for (const agent of KNOWN_AGENTS) {
26602
+ const envValue = env[agent.envVar];
26603
+ if (agent.value !== undefined) {
26604
+ if (envValue === agent.value)
26605
+ return agent.id;
26606
+ } else {
26607
+ if (envValue)
26608
+ return agent.id;
26609
+ }
26610
+ }
26611
+ const agentEnv = env.AGENT;
26612
+ if (agentEnv) {
26613
+ if (agentEnv === "1" || agentEnv === "true")
26614
+ return "unknown";
26615
+ if (agentEnv.length <= 32)
26616
+ return agentEnv.toLowerCase();
26617
+ }
26618
+ return;
26619
+ }
26620
+ // ../common/src/telemetry/environment-info.ts
26621
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
26622
+ // ../common/src/telemetry/execution-context.ts
26623
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
26624
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
26625
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
26626
+ var CI_SIGNATURES = [
26627
+ {
26628
+ provider: "github_actions",
26629
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
26630
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
26631
+ },
26632
+ {
26633
+ provider: "azure_devops",
26634
+ matches: (env) => isTruthy(env.TF_BUILD),
26635
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
26636
+ },
26637
+ {
26638
+ provider: "gitlab",
26639
+ matches: (env) => isTruthy(env.GITLAB_CI),
26640
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
26641
+ },
26642
+ {
26643
+ provider: "circleci",
26644
+ matches: (env) => isTruthy(env.CIRCLECI),
26645
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
26646
+ },
26647
+ {
26648
+ provider: "jenkins",
26649
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
26650
+ },
26651
+ {
26652
+ provider: "teamcity",
26653
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
26654
+ },
26655
+ {
26656
+ provider: "buildkite",
26657
+ matches: (env) => isTruthy(env.BUILDKITE),
26658
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
26659
+ },
26660
+ {
26661
+ provider: "bitbucket",
26662
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
26663
+ },
26664
+ {
26665
+ provider: "travis",
26666
+ matches: (env) => isTruthy(env.TRAVIS)
26667
+ },
26668
+ {
26669
+ provider: "appveyor",
26670
+ matches: (env) => isTruthy(env.APPVEYOR)
26671
+ },
26672
+ {
26673
+ provider: "generic",
26674
+ matches: (env) => isTruthy(env.CI)
26675
+ }
26676
+ ];
26677
+ function currentEnv() {
26678
+ return typeof process === "undefined" ? {} : process.env;
26679
+ }
26680
+ function currentTtyState() {
26681
+ if (typeof process === "undefined")
26682
+ return false;
26683
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
26684
+ }
26685
+ function detectCi(env) {
26686
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
26687
+ if (!signature)
26688
+ return;
26689
+ return {
26690
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
26691
+ ciProvider: signature.provider
26692
+ };
26693
+ }
26694
+ function detectExecutionContext(options = {}) {
26695
+ const env = options.env ?? currentEnv();
26696
+ const ci = detectCi(env);
26697
+ if (ci)
26698
+ return ci;
26699
+ const agent = options.agent ?? detectAgentFromEnv(env);
26700
+ if (agent) {
26701
+ return { executionContext: "agent" };
26702
+ }
26703
+ const authSignal = options.authSignal ?? authSignalSlot.get();
26704
+ if (authSignal === "service_account") {
26705
+ return { executionContext: "service_account" };
26706
+ }
26707
+ const isTty = options.isTty ?? currentTtyState();
26708
+ if (isTty) {
26709
+ return { executionContext: "manual" };
26710
+ }
26711
+ return { executionContext: "unknown" };
26712
+ }
26713
+ function getExecutionContextTelemetryProperties() {
26714
+ const detected = detectExecutionContext();
26715
+ return {
26716
+ execution_context: detected.executionContext,
26717
+ ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
26718
+ };
26719
+ }
26371
26720
  // ../common/src/telemetry/node-context-storage.ts
26372
26721
  import { AsyncLocalStorage } from "node:async_hooks";
26373
26722
 
@@ -26380,6 +26729,26 @@ class NodeContextStorage {
26380
26729
  return this.storage.getStore();
26381
26730
  }
26382
26731
  }
26732
+ // ../common/src/telemetry/session-id.ts
26733
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
26734
+ var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
26735
+ var telemetrySessionIdSlot = singleton("TelemetrySessionId");
26736
+ function getProcessEnv() {
26737
+ return globalThis.process?.env;
26738
+ }
26739
+ function normalizeSessionId(value) {
26740
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
26741
+ return;
26742
+ }
26743
+ const trimmed = String(value).trim();
26744
+ return trimmed || undefined;
26745
+ }
26746
+ function getConfiguredTelemetrySessionId() {
26747
+ return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
26748
+ }
26749
+ function resolveTelemetrySessionId(existingSessionId) {
26750
+ return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
26751
+ }
26383
26752
  // ../common/src/telemetry/global-telemetry-properties.ts
26384
26753
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
26385
26754
  function getGlobalTelemetryProperties() {
@@ -26464,12 +26833,22 @@ class TelemetryService {
26464
26833
  return this.contextStorage.getContext();
26465
26834
  }
26466
26835
  enrichPropertiesWithContext(properties, context) {
26467
- return {
26468
- ...getGlobalTelemetryProperties(),
26836
+ const globalProperties = getGlobalTelemetryProperties();
26837
+ const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
26838
+ const sessionId = resolveTelemetrySessionId(existingSessionId);
26839
+ const enriched = {
26840
+ ...getExecutionContextTelemetryProperties(),
26841
+ ...globalProperties,
26469
26842
  ...this.defaultProperties,
26470
26843
  ...properties,
26471
26844
  ...context
26472
26845
  };
26846
+ if (sessionId === undefined) {
26847
+ delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
26848
+ } else {
26849
+ enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
26850
+ }
26851
+ return enriched;
26473
26852
  }
26474
26853
  generateId() {
26475
26854
  return crypto.randomUUID().replaceAll("-", "");
@@ -26939,8 +27318,24 @@ var OutputFormatter;
26939
27318
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
26940
27319
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
26941
27320
  process.exitCode = EXIT_CODES[data.Result] ?? 1;
26942
- const { SuppressTelemetry, ...envelope } = data;
26943
- if (!SuppressTelemetry) {
27321
+ recordCommandFailureTelemetry({
27322
+ result: data.Result,
27323
+ errorCode: data.ErrorCode,
27324
+ retry: data.Retry,
27325
+ message: data.Message,
27326
+ context: data.Context,
27327
+ exitCode: process.exitCode,
27328
+ errorClass: data.TelemetryErrorClass,
27329
+ terminalOutcome: data.TelemetryTerminalOutcome,
27330
+ terminalSignal: data.TelemetryTerminalSignal
27331
+ });
27332
+ const suppressTelemetry = data.SuppressTelemetry === true;
27333
+ const envelope = { ...data };
27334
+ delete envelope.SuppressTelemetry;
27335
+ delete envelope.TelemetryErrorClass;
27336
+ delete envelope.TelemetryTerminalOutcome;
27337
+ delete envelope.TelemetryTerminalSignal;
27338
+ if (!suppressTelemetry) {
26944
27339
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
26945
27340
  result: data.Result,
26946
27341
  errorCode: data.ErrorCode,
@@ -27003,6 +27398,158 @@ var OutputFormatter;
27003
27398
  OutputFormatter.formatToString = formatToString;
27004
27399
  })(OutputFormatter ||= {});
27005
27400
 
27401
+ // ../common/src/telemetry/command-attribution.ts
27402
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
27403
+ var MAX_SKILL_NAME_LENGTH = 80;
27404
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
27405
+ function productMode(productArea, mode) {
27406
+ return { product_area: productArea, mode };
27407
+ }
27408
+ function attributionRecord(groups) {
27409
+ const record = {};
27410
+ for (const [productArea, mode, names] of groups) {
27411
+ const attribution = productMode(productArea, mode);
27412
+ for (const name of names) {
27413
+ record[name] = attribution;
27414
+ }
27415
+ }
27416
+ return record;
27417
+ }
27418
+ function commandAttribution(groups) {
27419
+ const entries = [];
27420
+ for (const [productArea, mode, prefixes] of groups) {
27421
+ const attribution = productMode(productArea, mode);
27422
+ for (const prefix of prefixes) {
27423
+ entries.push({ prefix, attribution });
27424
+ }
27425
+ }
27426
+ return entries;
27427
+ }
27428
+ var SKILL_ATTRIBUTION = attributionRecord([
27429
+ ["admin", "operate", ["uipath-admin"]],
27430
+ ["agents", "build", ["uipath-agents"]],
27431
+ ["api-workflow", "build", ["uipath-api-workflow"]],
27432
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
27433
+ ["coded-apps", "build", ["uipath-coded-apps"]],
27434
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
27435
+ ["cli", "troubleshoot", ["uipath-feedback"]],
27436
+ ["governance", "operate", ["uipath-governance"]],
27437
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
27438
+ ["document-understanding", "build", ["uipath-ixp"]],
27439
+ [
27440
+ "maestro",
27441
+ "build",
27442
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
27443
+ ],
27444
+ ["agenthub", "build", ["uipath-mcp-servers"]],
27445
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
27446
+ ["platform", "operate", ["uipath-platform"]],
27447
+ ["quality", "troubleshoot", ["uipath-review"]],
27448
+ ["rpa", "build", ["uipath-rpa"]],
27449
+ ["cli", "operate", ["uipath-skill-catalog"]],
27450
+ ["action-center", "operate", ["uipath-tasks"]],
27451
+ ["test-manager", "operate", ["uipath-test"]],
27452
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
27453
+ ]);
27454
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
27455
+ var COMMAND_ATTRIBUTION = commandAttribution([
27456
+ ["cli", "troubleshoot", ["uip.feedback"]],
27457
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
27458
+ ["context-grounding", "build", ["uip.context-grounding"]],
27459
+ ["api-workflow", "build", ["uip.api-workflow"]],
27460
+ ["rpa", "build", ["uip.rpa-legacy"]],
27461
+ ["conversational", "operate", ["uip.conversational"]],
27462
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
27463
+ ["agenthub", "build", ["uip.agenthub"]],
27464
+ ["coded-apps", "build", ["uip.codedapp"]],
27465
+ ["functions", "build", ["uip.functions"]],
27466
+ ["solution", "build", ["uip.solution"]],
27467
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
27468
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
27469
+ ["platform", "operate", ["uip.platform"]],
27470
+ ["admin", "operate", ["uip.admin"]],
27471
+ ["automation-ops", "operate", ["uip.aops"]],
27472
+ ["documentation", "troubleshoot", ["uip.docsai"]],
27473
+ ["governance", "operate", ["uip.gov"]],
27474
+ ["insights", "operate", ["uip.insights"]],
27475
+ ["document-understanding", "build", ["uip.ixp"]],
27476
+ ["process-mining", "operate", ["uip.pm"]],
27477
+ ["action-center", "operate", ["uip.tasks"]],
27478
+ ["test-manager", "operate", ["uip.tm"]],
27479
+ ["vertical-solutions", "build", ["uip.vss"]],
27480
+ ["data-fabric", "operate", ["uip.df"]],
27481
+ ["integration-service", "build", ["uip.is"]],
27482
+ ["orchestrator", "operate", ["uip.or"]],
27483
+ [
27484
+ "cli",
27485
+ "operate",
27486
+ [
27487
+ "uip.login",
27488
+ "uip.logout",
27489
+ "uip.user",
27490
+ "uip.config",
27491
+ "uip.tools",
27492
+ "uip.skills",
27493
+ "uip.completion",
27494
+ "uip.update",
27495
+ "uip.mcp",
27496
+ "uip.track"
27497
+ ]
27498
+ ]
27499
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
27500
+ function normalizeCommandPath(value) {
27501
+ if (typeof value !== "string") {
27502
+ return;
27503
+ }
27504
+ const trimmed = value.trim().toLowerCase();
27505
+ if (!trimmed) {
27506
+ return;
27507
+ }
27508
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
27509
+ if (tokens.length === 0) {
27510
+ return;
27511
+ }
27512
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
27513
+ return commandTokens.join(".");
27514
+ }
27515
+ function getCommandProductModeAttribution(commandPath) {
27516
+ const normalized = normalizeCommandPath(commandPath);
27517
+ if (!normalized) {
27518
+ return;
27519
+ }
27520
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
27521
+ }
27522
+ function normalizeSkillNameWithOptions(value, options) {
27523
+ if (typeof value !== "string") {
27524
+ return;
27525
+ }
27526
+ const normalized = value.trim().toLowerCase();
27527
+ if (!normalized) {
27528
+ return;
27529
+ }
27530
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
27531
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
27532
+ return;
27533
+ }
27534
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
27535
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
27536
+ return;
27537
+ }
27538
+ return skillName;
27539
+ }
27540
+ function normalizeSkillName(value) {
27541
+ return normalizeSkillNameWithOptions(value, {
27542
+ allowLegacyNamespace: false
27543
+ });
27544
+ }
27545
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
27546
+ const skillName = normalizeSkillName(skillSource);
27547
+ return {
27548
+ ...skillName ? { skill_name: skillName } : {},
27549
+ ...getCommandProductModeAttribution(commandPath)
27550
+ };
27551
+ }
27552
+
27006
27553
  // ../common/src/telemetry/pii-redactor.ts
27007
27554
  var REDACTED = "[REDACTED]";
27008
27555
  var MAX_VALUE_LENGTH = 200;
@@ -27188,6 +27735,12 @@ function commandHelpHint(commandPath) {
27188
27735
  const command = commandPath.replace(/\./g, " ");
27189
27736
  return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
27190
27737
  }
27738
+ function isPromptCancellation(error) {
27739
+ return error instanceof Error && error.name === "ExitPromptError";
27740
+ }
27741
+ function exitCodeFromProcess(fallback) {
27742
+ return typeof process.exitCode === "number" ? process.exitCode : fallback;
27743
+ }
27191
27744
  Command.prototype.trackedAction = function(context, fn, properties) {
27192
27745
  const command = this;
27193
27746
  return this.action(async (...args) => {
@@ -27195,6 +27748,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27195
27748
  const props = typeof properties === "function" ? properties(...args) : properties;
27196
27749
  const startTime = performance.now();
27197
27750
  let errorMessage;
27751
+ let fallbackExitCode = EXIT_CODES.Success;
27752
+ clearRecordedCommandFailureTelemetry();
27198
27753
  const [error] = await catchError(fn(...args));
27199
27754
  if (error) {
27200
27755
  errorMessage = error instanceof Error ? error.message : String(error);
@@ -27209,6 +27764,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27209
27764
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
27210
27765
  const typedContext = typed.context ?? typed.Context;
27211
27766
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
27767
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
27768
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
27212
27769
  OutputFormatter.error({
27213
27770
  Result: finalResult,
27214
27771
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
@@ -27217,16 +27774,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
27217
27774
  ...customRetry ? { Retry: customRetry } : {},
27218
27775
  ...customContext ? { Context: customContext } : {}
27219
27776
  });
27220
- context.exit(EXIT_CODES[finalResult]);
27777
+ context.exit(fallbackExitCode);
27221
27778
  }
27222
27779
  const durationMs = performance.now() - startTime;
27223
- const success = !error && (process.exitCode === undefined || process.exitCode === 0);
27780
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
27781
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
27782
+ const success = !error && exitCode === 0;
27783
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
27784
+ error,
27785
+ exitCode,
27786
+ recordedFailure,
27787
+ pollSignal: context.pollSignal
27788
+ });
27224
27789
  telemetry.trackEvent(telemetryName, redactProperties({
27225
27790
  ...extractCommandParams(command),
27226
27791
  ...props,
27792
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
27227
27793
  command: "true",
27228
27794
  duration: String(durationMs),
27229
27795
  success: String(success),
27796
+ ...terminalTelemetry,
27230
27797
  ...errorMessage ? { errorMessage } : {}
27231
27798
  }));
27232
27799
  });
@@ -27295,6 +27862,36 @@ var ScreenLogger;
27295
27862
  })(ScreenLogger ||= {});
27296
27863
  // ../common/src/sdk-user-agent.ts
27297
27864
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
27865
+ // ../common/src/telemetry/ship-succeeded.ts
27866
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
27867
+ function getShippedKeys() {
27868
+ const existing = shippedKeysSlot.get();
27869
+ if (existing) {
27870
+ return existing;
27871
+ }
27872
+ const keys = new Set;
27873
+ shippedKeysSlot.set(keys);
27874
+ return keys;
27875
+ }
27876
+ function dedupeKey(payload) {
27877
+ return [
27878
+ payload.command_name,
27879
+ payload.ship_kind,
27880
+ payload.target,
27881
+ payload.project_type,
27882
+ payload.artifact_correlation_key ?? payload.package_version_key ?? payload.deployment_key ?? payload.solution_id ?? payload.package_name ?? ""
27883
+ ].join("|");
27884
+ }
27885
+ function trackShipSucceeded(payload) {
27886
+ const keys = getShippedKeys();
27887
+ const key = dedupeKey(payload);
27888
+ if (keys.has(key)) {
27889
+ return false;
27890
+ }
27891
+ keys.add(key);
27892
+ telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties({ ...payload }));
27893
+ return true;
27894
+ }
27298
27895
  // ../common/src/tool-provider.ts
27299
27896
  var factorySlot = singleton("PackagerFactoryProvider");
27300
27897
  // ../uipath-python-bridge/src/cache.ts
@@ -28782,6 +29379,7 @@ function createExecuteCommand(config) {
28782
29379
  });
28783
29380
  }
28784
29381
  processContext.exit(result.exitCode);
29382
+ return result;
28785
29383
  };
28786
29384
  const registerExecCommand = (program2) => {
28787
29385
  program2.command("exec", { hidden: true }).description("Execute the uipath package with provided arguments").allowUnknownOption(true).allowExcessArguments(true).trackedAction(processContext, config.telemetryEvent, async (_options, cmd) => {
@@ -29256,7 +29854,7 @@ Searching for Python installations: ${allowedVersions}`);
29256
29854
  var package_default = {
29257
29855
  name: "@uipath/codedagent-tool",
29258
29856
  license: "MIT",
29259
- version: "1.197.0-preview.65",
29857
+ version: "1.197.0-preview.66",
29260
29858
  description: "Build, run, deploy, and manage AI Agents.",
29261
29859
  keywords: [
29262
29860
  "cli-tool",
@@ -30038,9 +30636,37 @@ var registerSetupCommand = createSetupCommand({
30038
30636
  telemetryEvent: CodedAgentsTelemetryEvents.Setup,
30039
30637
  successCode: "CodedAgentsSetup"
30040
30638
  });
30639
+ function isHelpRequest(args) {
30640
+ return args.includes("--help") || args.includes("-h");
30641
+ }
30642
+ function isCodedAgentShipCommand(name) {
30643
+ return name === "deploy" || name === "publish";
30644
+ }
30645
+ function hasFlag2(args, ...flags) {
30646
+ return args.some((arg) => flags.includes(arg));
30647
+ }
30648
+ function getCodedAgentShipTarget(name, args) {
30649
+ const suffix = name === "publish" ? "feed" : "deployment";
30650
+ if (hasFlag2(args, "--my-workspace", "-w")) {
30651
+ return `personal_workspace_coded_agent_${suffix}`;
30652
+ }
30653
+ if (hasFlag2(args, "--tenant")) {
30654
+ return `tenant_coded_agent_${suffix}`;
30655
+ }
30656
+ return `coded_agent_${suffix}`;
30657
+ }
30041
30658
  var registerWhitelistedCommand = (program2, name, description) => {
30042
30659
  program2.command(name, { hidden: false }).description(description).helpOption(false).allowUnknownOption(true).allowExcessArguments(true).argument("[args...]").trackedAction(processContext, async (args = []) => {
30043
- await executeCommand(["_", "_", "exec", name, ...args], {});
30660
+ const result = await executeCommand(["_", "_", "exec", name, ...args], {});
30661
+ if (result.ok && isCodedAgentShipCommand(name) && !isHelpRequest(args)) {
30662
+ trackShipSucceeded({
30663
+ ship_kind: name,
30664
+ target: getCodedAgentShipTarget(name, args),
30665
+ project_type: "coded_agent",
30666
+ command_name: `uip.codedagent.${name}`,
30667
+ artifact_correlation_key: process.env[PROJECT_ID_ENV_NAME]
30668
+ });
30669
+ }
30044
30670
  });
30045
30671
  };
30046
30672
  var registerCommands = async (program2) => {
@@ -30056,4 +30682,4 @@ export {
30056
30682
  metadata
30057
30683
  };
30058
30684
 
30059
- //# debugId=CA0F91BCF0847FFA64756E2164756E21
30685
+ //# debugId=5D60D152BF64ED7864756E2164756E21