@uipath/flow-tool 1.203.0-preview.205 → 1.204.0-preview.206

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 (117) hide show
  1. package/README.md +4 -0
  2. package/dist/THIRD-PARTY-NOTICES.md +237 -2
  3. package/dist/authoring-4kyzh1tf.js +23 -0
  4. package/dist/{binding-service-ft8mabkr.js → binding-service-815skxfx.js} +28 -30
  5. package/dist/{connector-service-qnpnwzpv.js → connector-service-xw4f8a7v.js} +34 -31
  6. package/dist/{conversion-FQTRFHRX-xh98wp2q.js → conversion-FQTRFHRX-1q7rk0te.js} +5 -5
  7. package/dist/{debug-conversation-trigger-fy19ygsm.js → debug-conversation-trigger-qdgvrekh.js} +14 -16
  8. package/dist/{debug-http-client-53qk6pc5.js → debug-http-client-s78gbtbn.js} +3 -3
  9. package/dist/{debug-service-nyk0s6mc.js → debug-service-0ppdzgzv.js} +4 -4
  10. package/dist/{edge-service-an71q4ry.js → edge-service-ttzfnxkf.js} +13 -14
  11. package/dist/{embedded-file-reader-0sjt4nkj.js → embedded-file-reader-v8c2yj2a.js} +2 -2
  12. package/dist/{flow-api-2phdajnk.js → flow-api-b7k5dtpm.js} +8 -8
  13. package/dist/{flow-debug-service-bnzgj53b.js → flow-debug-service-4we602jx.js} +38 -35
  14. package/dist/{flow-eval-node-target-2mjben3g.js → flow-eval-node-target-331vzbkw.js} +14 -15
  15. package/dist/{flow-eval-run-api-1bw5e0k4.js → flow-eval-run-api-yq18x5rb.js} +4 -4
  16. package/dist/{flow-eval-run-service-qv8j8fd1.js → flow-eval-run-service-36h1bnm8.js} +40 -37
  17. package/dist/{flow-eval-service-amd02ctw.js → flow-eval-service-ndtk9f9j.js} +19 -20
  18. package/dist/flow-init-sdk-source-9fy9p8ap.js +58 -0
  19. package/dist/{flow-init-service-rnygj5f8.js → flow-init-service-kwhbdtpc.js} +19 -18
  20. package/dist/{flow-io-hddhkve5.js → flow-io-pt392xct.js} +13 -14
  21. package/dist/{flow-migrate-service-e3hm99gp.js → flow-migrate-service-xvz8pbmp.js} +14 -15
  22. package/dist/{flow-pack-service-g8jebcts.js → flow-pack-service-wg1kt2bt.js} +72 -39
  23. package/dist/flow-validate-service-xbhrj47n.js +64 -0
  24. package/dist/{governance-fetcher-cswx2cw7.js → governance-fetcher-5yy89pfd.js} +6 -5
  25. package/dist/{headless-mmnrkzve.js → headless-1pdmae01.js} +2 -2
  26. package/dist/{hitl-service-a4fmjrzh.js → hitl-service-q2d39v5s.js} +13 -14
  27. package/dist/{index-3ts7y9d3.js → index-2s8rmmw6.js} +5 -3
  28. package/dist/index-3jpjaq1g.js +26 -0
  29. package/dist/{index-t5zedby6.js → index-41vyzws2.js} +59 -27
  30. package/dist/{index-b46bavh7.js → index-5yw15y73.js} +2 -2
  31. package/dist/{index-212q16sv.js → index-7qw3ttge.js} +416 -87
  32. package/dist/{index-t8e0ft8r.js → index-c1q6mnw1.js} +3 -3
  33. package/dist/{index-xa7gm52r.js → index-dqqg54v6.js} +601 -61
  34. package/dist/index.js +10 -10
  35. package/dist/init.d.ts +1 -1
  36. package/dist/init.js +19 -18
  37. package/dist/{input-reader-tw0j373f.js → input-reader-bv7kt19c.js} +2 -2
  38. package/dist/{known-types-b64as10y.js → known-types-jhyhnkt6.js} +4 -4
  39. package/dist/{maestro-automate-entry-pqy9xqm3.js → maestro-automate-entry-qak46eg0.js} +2 -2
  40. package/dist/node-2whm5wkf.js +4823 -0
  41. package/dist/{node-service-qnny15cm.js → node-service-js01ft95.js} +31 -30
  42. package/dist/{node-strategy-gc4sg6a2.js → node-strategy-fdnkvq4a.js} +1 -1
  43. package/dist/{node-sync-service-f1x1ak6q.js → node-sync-service-pb3m4dp2.js} +9 -9
  44. package/dist/{packager-tool-et7wj8kr.js → packager-tool-0w4es6rz.js} +2 -2
  45. package/dist/{packager-tool-dph5p2f5.js → packager-tool-1mnq1c97.js} +1 -1
  46. package/dist/packager-tool-225z77w9.js +52 -0
  47. package/dist/{packager-tool-de2txaxx.js → packager-tool-2hzsf1rc.js} +5 -5
  48. package/dist/{packager-tool-vbser1d9.js → packager-tool-2qr8z5ke.js} +4 -4
  49. package/dist/{packager-tool-0egkaa38.js → packager-tool-32czz9mq.js} +2 -2
  50. package/dist/{packager-tool-0v3s8r01.js → packager-tool-3h2ktz6q.js} +2 -2
  51. package/dist/{packager-tool-h9d8c9rf.js → packager-tool-4zdhy0c3.js} +2 -2
  52. package/dist/{packager-tool-afd1wwf2.js → packager-tool-53c81nnr.js} +440 -29
  53. package/dist/{packager-tool-2c688mdj.js → packager-tool-57fak54h.js} +4 -4
  54. package/dist/{packager-tool-qa2xzxez.js → packager-tool-59s95scr.js} +1 -1
  55. package/dist/{packager-tool-n8p9cay6.js → packager-tool-6azk3rex.js} +1 -1
  56. package/dist/{packager-tool-26ydwf12.js → packager-tool-6h69pd2a.js} +23 -8
  57. package/dist/{packager-tool-mnrbdn6a.js → packager-tool-6scjsgh6.js} +55 -17
  58. package/dist/{packager-tool-xzf4xc65.js → packager-tool-70cta0be.js} +4 -4
  59. package/dist/{packager-tool-tw3j5h3z.js → packager-tool-8hj7w7em.js} +5 -5
  60. package/dist/{packager-tool-795gzq9k.js → packager-tool-8pmgk4f6.js} +1 -1
  61. package/dist/{packager-tool-321a1806.js → packager-tool-8vmx4j2w.js} +1 -1
  62. package/dist/{packager-tool-cnftzx4c.js → packager-tool-a6ph7149.js} +40 -11
  63. package/dist/{packager-tool-s0mzv3sx.js → packager-tool-aw60v0et.js} +1 -1
  64. package/dist/{packager-tool-e89k4pjj.js → packager-tool-c0rtxezv.js} +1 -1
  65. package/dist/{packager-tool-1w4f09cq.js → packager-tool-d0ny3x3b.js} +141 -96
  66. package/dist/{packager-tool-gzpvdcnw.js → packager-tool-da1cmt0q.js} +2 -2
  67. package/dist/{packager-tool-p8j4zvrq.js → packager-tool-dp8vjby4.js} +4829 -1364
  68. package/dist/packager-tool-e5hj89zm.js +6 -0
  69. package/dist/{packager-tool-fwp34rqp.js → packager-tool-ev80vk13.js} +8 -8
  70. package/dist/{packager-tool-gctpkdzs.js → packager-tool-hhy1gr2k.js} +1 -1
  71. package/dist/{packager-tool-sf9f6jft.js → packager-tool-hygq2wy6.js} +1 -1
  72. package/dist/{packager-tool-0v3tzseq.js → packager-tool-jeb6xmgw.js} +2 -2
  73. package/dist/packager-tool-krzxg3ga.js +804 -0
  74. package/dist/{packager-tool-1r5dnt9q.js → packager-tool-mv4jav1h.js} +1 -1
  75. package/dist/{packager-tool-pppzgwfw.js → packager-tool-n4vdjmjx.js} +18079 -18079
  76. package/dist/{packager-tool-t9c77psy.js → packager-tool-p1tb6d4f.js} +955 -150
  77. package/dist/{packager-tool-gs28y1eq.js → packager-tool-qhhrq12s.js} +2 -2
  78. package/dist/{packager-tool-6k8s7pt9.js → packager-tool-r7xy9sew.js} +1090 -545
  79. package/dist/{packager-tool-b1xs6aty.js → packager-tool-stq8800d.js} +902 -897
  80. package/dist/{packager-tool-61r38k4d.js → packager-tool-t57d6pzz.js} +320 -200
  81. package/dist/{packager-tool-a7t9v5ss.js → packager-tool-v9v9ch04.js} +2 -2
  82. package/dist/{packager-tool-cdn59g60.js → packager-tool-ve5t7317.js} +2 -2
  83. package/dist/{packager-tool-yxv9mm8s.js → packager-tool-vtaqtf7f.js} +10 -10
  84. package/dist/{packager-tool-t39edv0g.js → packager-tool-w3dy6vnj.js} +184 -193
  85. package/dist/{packager-tool-9kx94sj5.js → packager-tool-x5qafkb7.js} +2 -2
  86. package/dist/{packager-tool-s841bbkr.js → packager-tool-yednpbbw.js} +2 -2
  87. package/dist/{packager-tool-yxnepq2j.js → packager-tool-ysbskrta.js} +1 -1
  88. package/dist/packager-tool-zgsvggdr.js +50 -0
  89. package/dist/packager-tool.js +12 -13
  90. package/dist/{serialization-BXU6AKAN-rhgmwp06.js → serialization-BXU6AKAN-c2ge8yvb.js} +5 -5
  91. package/dist/services/flow-init-sdk-source.d.ts +28 -0
  92. package/dist/services/flow-init-service.d.ts +25 -0
  93. package/dist/services/inline-activity-service.d.ts +135 -0
  94. package/dist/services/node-service.d.ts +14 -0
  95. package/dist/services/node-validators/index.d.ts +2 -0
  96. package/dist/services/node-validators/inline-activity-validator.d.ts +18 -0
  97. package/dist/services/node-validators/types.d.ts +6 -0
  98. package/dist/services/node-validators/unresolved-binding-placeholder-validator.d.ts +2 -0
  99. package/dist/services/preview-id-rule.d.ts +33 -0
  100. package/dist/services/ui-only-node-types.d.ts +1 -0
  101. package/dist/{shared-utils-wv356cvj.js → shared-utils-9vfmrxtx.js} +2 -2
  102. package/dist/{packager-tool-es0a755k.js → tidy-service-q2wwwans.js} +33 -7
  103. package/dist/tool.js +10 -10
  104. package/dist/utils/flow-io.d.ts +3 -16
  105. package/dist/validation.js +35 -36
  106. package/dist/{variable-service-bc7920kx.js → variable-service-nm9fdwsw.js} +13 -14
  107. package/dist/{wait-for-flow-job-v0njb0dk.js → wait-for-flow-job-yzyamptd.js} +8 -8
  108. package/package.json +2 -2
  109. package/dist/authoring-tv4dh80p.js +0 -360
  110. package/dist/flow-validate-service-x9dtdrc7.js +0 -65
  111. package/dist/node-xdgxafqs.js +0 -15600
  112. package/dist/packager-tool-2513jrxr.js +0 -898
  113. package/dist/packager-tool-5kt8tsq4.js +0 -85
  114. package/dist/packager-tool-w0kr4mbc.js +0 -996
  115. package/dist/services/tidy-service.d.ts +0 -26
  116. package/dist/tidy-service-8y2tjmb5.js +0 -39
  117. /package/dist/{localization-y790z9vm.js → localization-xecwjpe2.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getFileSystem
3
- } from "./packager-tool-0v3s8r01.js";
3
+ } from "./packager-tool-3h2ktz6q.js";
4
4
  import {
5
5
  __commonJS,
6
6
  __require,
@@ -2637,9 +2637,60 @@ function settlePromiseLike(thenable) {
2637
2637
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2638
2638
  }
2639
2639
 
2640
+ // ../common/src/error-graph.ts
2641
+ function* walkErrorGraph(error) {
2642
+ const queue = [error];
2643
+ const seen = new Set;
2644
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2645
+ const current = queue.shift();
2646
+ if (current === null || typeof current !== "object")
2647
+ continue;
2648
+ if (seen.has(current))
2649
+ continue;
2650
+ seen.add(current);
2651
+ const cur = current;
2652
+ yield cur;
2653
+ if (cur.cause !== undefined)
2654
+ queue.push(cur.cause);
2655
+ if (Array.isArray(cur.errors))
2656
+ queue.push(...cur.errors);
2657
+ }
2658
+ return;
2659
+ }
2660
+ function parseHttpStatusFromMessage(message) {
2661
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
2662
+ if (!match)
2663
+ return;
2664
+ const status = Number(match[1]);
2665
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
2666
+ }
2667
+ function findHttpStatusInGraph(error) {
2668
+ for (const node of walkErrorGraph(error)) {
2669
+ const response = node.response;
2670
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
2671
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
2672
+ return explicit;
2673
+ }
2674
+ if (typeof node.message === "string") {
2675
+ const parsed = parseHttpStatusFromMessage(node.message);
2676
+ if (parsed !== undefined && parsed >= 400) {
2677
+ return parsed;
2678
+ }
2679
+ }
2680
+ }
2681
+ return;
2682
+ }
2683
+
2684
+ // ../common/src/local-permission-codes.ts
2685
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
2686
+ "EACCES",
2687
+ "EPERM",
2688
+ "EROFS"
2689
+ ]);
2690
+
2640
2691
  // ../common/src/error-handler.ts
2641
- var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
2642
- var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
2692
+ var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its token carries no scope for this API. Run `uip login status --detailed` to see the session and its scopes.";
2693
+ var DEFAULT_403 = "Forbidden (403). The account lacks permission for this operation, or the token carries no scope for this API. Run `uip login status --detailed` to see the token's scopes.";
2643
2694
  var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
2644
2695
  var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
2645
2696
  var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
@@ -2666,16 +2717,22 @@ var TLS_ERROR_CODES = new Set([
2666
2717
  ]);
2667
2718
  var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
2668
2719
  var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
2669
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2670
- var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2720
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
2671
2721
  function localPermissionInstructions(code, path) {
2672
2722
  const target = path !== undefined ? `'${path}'` : "a local file or resource";
2673
2723
  if (code === "EROFS") {
2674
2724
  return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
2675
2725
  }
2676
- const remedy = process.platform === "win32" ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
2726
+ const onWindows = typeof process !== "undefined" && process.platform === "win32";
2727
+ const remedy = onWindows ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
2677
2728
  return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
2678
2729
  }
2730
+ function carriedInstructions(error) {
2731
+ if (!error || typeof error !== "object")
2732
+ return;
2733
+ const e = error;
2734
+ return typeof e.instructions === "string" ? e.instructions : undefined;
2735
+ }
2679
2736
  function describeConnectivityError(error) {
2680
2737
  for (const cur of walkErrorGraph(error)) {
2681
2738
  const code = typeof cur.code === "string" ? cur.code : undefined;
@@ -2727,48 +2784,6 @@ function localPermissionPath(path, message) {
2727
2784
  return path;
2728
2785
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2729
2786
  }
2730
- function* walkErrorGraph(error) {
2731
- const queue = [error];
2732
- const seen = new Set;
2733
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2734
- const current = queue.shift();
2735
- if (current === null || typeof current !== "object")
2736
- continue;
2737
- if (seen.has(current))
2738
- continue;
2739
- seen.add(current);
2740
- const cur = current;
2741
- yield cur;
2742
- if (cur.cause !== undefined)
2743
- queue.push(cur.cause);
2744
- if (Array.isArray(cur.errors))
2745
- queue.push(...cur.errors);
2746
- }
2747
- return;
2748
- }
2749
- function parseHttpStatusFromMessage(message) {
2750
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
2751
- if (!match)
2752
- return;
2753
- const status = Number(match[1]);
2754
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
2755
- }
2756
- function findHttpStatusInGraph(error) {
2757
- for (const node of walkErrorGraph(error)) {
2758
- const response = node.response;
2759
- const explicit = typeof node.status === "number" ? node.status : response?.status;
2760
- if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
2761
- return explicit;
2762
- }
2763
- if (typeof node.message === "string") {
2764
- const parsed = parseHttpStatusFromMessage(node.message);
2765
- if (parsed !== undefined && parsed >= 400) {
2766
- return parsed;
2767
- }
2768
- }
2769
- }
2770
- return;
2771
- }
2772
2787
  function isHtmlDocument(body) {
2773
2788
  return /^\s*(<!doctype html|<html\b)/i.test(body);
2774
2789
  }
@@ -3264,385 +3279,222 @@ function getLogFilePath() {
3264
3279
  return logger.getLogFilePath();
3265
3280
  }
3266
3281
 
3267
- // ../common/src/exit-code.ts
3268
- function setExitCode(code) {
3269
- process.exitCode = code;
3282
+ // ../common/src/telemetry/debug-telemetry-provider.ts
3283
+ class DebugTelemetryProvider {
3284
+ async trackEvent({ name }) {
3285
+ logger.debug(`[Telemetry] Event: ${name}`);
3286
+ }
3287
+ async trackException({ error }) {
3288
+ logger.error(`[Telemetry] Exception: ${error.message}`);
3289
+ }
3290
+ async trackRequest({
3291
+ name,
3292
+ durationMs,
3293
+ success
3294
+ }) {
3295
+ logger.debug(`[Telemetry] Request: ${name} (${durationMs}ms, ${success ? "ok" : "fail"})`);
3296
+ }
3297
+ async trackDependency({
3298
+ name,
3299
+ type,
3300
+ durationMs,
3301
+ success
3302
+ }) {
3303
+ logger.debug(`[Telemetry] Dependency: ${name} [${type}] (${durationMs}ms, ${success ? "ok" : "fail"})`);
3304
+ }
3270
3305
  }
3271
3306
 
3272
- // ../common/src/output-codecs.ts
3273
- var yamlSlot = singleton("YamlCodec");
3274
- var jmespathSlot = singleton("JmespathCodec");
3275
- async function loadOutputCodecsAsync(needed) {
3276
- const loads = [];
3277
- if (needed.yaml && yamlSlot.get() === undefined) {
3278
- loads.push(import("./js-yaml-87cdx6bm.js").then((mod) => {
3279
- yamlSlot.set(mod);
3280
- }));
3307
+ // ../common/src/telemetry/node-context-storage.ts
3308
+ import { AsyncLocalStorage } from "node:async_hooks";
3309
+
3310
+ class NodeContextStorage {
3311
+ storage = new AsyncLocalStorage;
3312
+ run(context, fn) {
3313
+ return this.storage.run(context, fn);
3281
3314
  }
3282
- if (needed.filter && jmespathSlot.get() === undefined) {
3283
- loads.push(import("./jmespath-e4a59c8w.js").then((m)=>__toESM(m.default,1)).then((mod) => {
3284
- jmespathSlot.set(mod);
3285
- }));
3315
+ getContext() {
3316
+ return this.storage.getStore();
3286
3317
  }
3287
- await Promise.all(loads);
3288
- }
3289
- function getYamlCodec() {
3290
- return yamlSlot.get();
3291
- }
3292
- function getJmespathCodec() {
3293
- return jmespathSlot.get();
3294
3318
  }
3295
3319
 
3296
- // ../common/src/output-format-context.ts
3297
- var formatSlot = singleton("OutputFormat");
3298
- var formatExplicitSlot = singleton("OutputFormatExplicit");
3299
- var helpRequestedSlot = singleton("HelpRequested");
3300
- var filterSlot = singleton("OutputFilter");
3301
- function getOutputFormat() {
3302
- return formatSlot.get("json");
3303
- }
3304
- function getOutputFormatExplicit() {
3305
- return formatExplicitSlot.get(false) ?? false;
3306
- }
3307
- function getOutputFilter() {
3308
- return filterSlot.get();
3320
+ // ../common/src/telemetry/detect-agent.ts
3321
+ var KNOWN_AGENTS = [
3322
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
3323
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
3324
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
3325
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
3326
+ { envVar: "CODEX_SANDBOX", id: "codex" },
3327
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
3328
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
3329
+ ];
3330
+ function detectAgentFromEnv(env) {
3331
+ for (const agent of KNOWN_AGENTS) {
3332
+ const envValue = env[agent.envVar];
3333
+ if (agent.value !== undefined) {
3334
+ if (envValue === agent.value)
3335
+ return agent.id;
3336
+ } else {
3337
+ if (envValue)
3338
+ return agent.id;
3339
+ }
3340
+ }
3341
+ const agentEnv = env.AGENT;
3342
+ if (agentEnv) {
3343
+ if (agentEnv === "1" || agentEnv === "true")
3344
+ return "unknown";
3345
+ if (agentEnv.length <= 32)
3346
+ return agentEnv.toLowerCase();
3347
+ }
3348
+ return;
3309
3349
  }
3310
3350
 
3311
- // ../common/src/telemetry/command-terminal.ts
3312
- var recordedFailureSlot = singleton("CommandTelemetryFailure");
3313
- var AUTH_ERROR_CODES = new Set([
3314
- "authentication_required",
3315
- "permission_denied"
3316
- ]);
3317
- var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
3318
- var NETWORK_HTTP_ERROR_CODES = new Set([
3319
- "network_error",
3320
- "rate_limited",
3321
- "server_error",
3322
- "not_found",
3323
- "method_not_allowed"
3324
- ]);
3325
- var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
3326
- var NETWORK_OS_ERROR_CODES = new Set([
3327
- "ECONNREFUSED",
3328
- "ECONNRESET",
3329
- "ENOTFOUND",
3330
- "EAI_AGAIN",
3331
- "EPIPE",
3332
- "EHOSTUNREACH",
3333
- "ENETUNREACH",
3334
- "EAI_FAIL"
3335
- ]);
3336
- var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
3337
- var TLS_ERROR_CODES2 = new Set([
3338
- "SELF_SIGNED_CERT_IN_CHAIN",
3339
- "DEPTH_ZERO_SELF_SIGNED_CERT",
3340
- "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
3341
- "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
3342
- "UNABLE_TO_GET_ISSUER_CERT",
3343
- "CERT_HAS_EXPIRED",
3344
- "CERT_UNTRUSTED",
3345
- "ERR_TLS_CERT_ALTNAME_INVALID"
3351
+ // ../common/src/telemetry/telemetry-dimensions.ts
3352
+ var BaseDimensions = {
3353
+ ApplicationName: "ApplicationName",
3354
+ ProductVersion: "ProductVersion",
3355
+ InstallationId: "InstallationId",
3356
+ CloudUserId: "CloudUserId",
3357
+ CloudTenantId: "CloudTenantId",
3358
+ CloudOrganizationId: "CloudOrganizationId",
3359
+ IsInternalUser: "IsInternalUser",
3360
+ Environment: "Environment",
3361
+ BaseUrl: "BaseUrl",
3362
+ Region: "Region",
3363
+ Agent: "Agent",
3364
+ AgentVersion: "AgentVersion",
3365
+ AgentModel: "AgentModel",
3366
+ ToolName: "ToolName",
3367
+ ToolVersion: "ToolVersion",
3368
+ ExecutionContext: "ExecutionContext",
3369
+ CiProvider: "CiProvider",
3370
+ SessionIdSource: "SessionIdSource",
3371
+ SessionId: "SessionId"
3372
+ };
3373
+ var CommandDimensions = {
3374
+ IsCommand: "IsCommand",
3375
+ IsReexec: "IsReexec",
3376
+ CommandName: "CommandName",
3377
+ ExitCode: "ExitCode",
3378
+ TerminalOutcome: "TerminalOutcome",
3379
+ ErrorClass: "ErrorClass",
3380
+ TerminalSignal: "TerminalSignal",
3381
+ ErrorMessage: "ErrorMessage",
3382
+ SkillName: "SkillName",
3383
+ ProductArea: "ProductArea",
3384
+ Mode: "Mode"
3385
+ };
3386
+ var ShipDimensions = {
3387
+ ShipKind: "ShipKind",
3388
+ Target: "Target",
3389
+ ProjectType: "ProjectType",
3390
+ ProjectTypes: "ProjectTypes",
3391
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
3392
+ PackageName: "PackageName",
3393
+ PackageVersion: "PackageVersion",
3394
+ PackageVersionKey: "PackageVersionKey",
3395
+ DeploymentKey: "DeploymentKey",
3396
+ SolutionId: "SolutionId",
3397
+ FolderKey: "FolderKey",
3398
+ FeedId: "FeedId"
3399
+ };
3400
+ var ErrorDimensions = {
3401
+ Result: "Result",
3402
+ ErrorCode: "ErrorCode",
3403
+ Retry: "Retry",
3404
+ ErrorMessage: "ErrorMessage"
3405
+ };
3406
+ var AuthDimensions = {
3407
+ AuthenticationMethod: "AuthenticationMethod",
3408
+ Success: "Success",
3409
+ Reason: "Reason"
3410
+ };
3411
+ var SkillsDimensions = {
3412
+ SchemaVersion: "SchemaVersion",
3413
+ AgentType: "AgentType",
3414
+ SkillsVersion: "SkillsVersion",
3415
+ UipSubcommand: "UipSubcommand",
3416
+ FileExtension: "FileExtension",
3417
+ SubagentModel: "SubagentModel",
3418
+ SubagentType: "SubagentType",
3419
+ PermissionMode: "PermissionMode",
3420
+ EffortLevel: "EffortLevel",
3421
+ SessionSource: "SessionSource",
3422
+ Outcome: "Outcome",
3423
+ DurationMs: "DurationMs",
3424
+ Source: "Source"
3425
+ };
3426
+ var PackagerDimensions = {
3427
+ ProjectId: "ProjectId",
3428
+ ProjectType: "ProjectType",
3429
+ SolutionId: "SolutionId"
3430
+ };
3431
+ var ScopeDimensions = {
3432
+ FolderId: "FolderId"
3433
+ };
3434
+ var ID_DIMENSIONS = new Set([
3435
+ BaseDimensions.CloudUserId,
3436
+ BaseDimensions.CloudTenantId,
3437
+ BaseDimensions.CloudOrganizationId,
3438
+ BaseDimensions.InstallationId,
3439
+ ShipDimensions.ArtifactCorrelationKey,
3440
+ ShipDimensions.PackageVersionKey,
3441
+ ShipDimensions.DeploymentKey,
3442
+ ShipDimensions.SolutionId,
3443
+ ShipDimensions.FolderKey,
3444
+ ShipDimensions.FeedId,
3445
+ PackagerDimensions.ProjectId
3346
3446
  ]);
3347
- var MISSING_DEPENDENCY_CODES = new Set([
3348
- "MODULE_NOT_FOUND",
3349
- "ERR_MODULE_NOT_FOUND"
3447
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
3448
+ var RESERVED_DIMENSION_NAMES = new Set([
3449
+ ...Object.values(BaseDimensions),
3450
+ ...Object.values(CommandDimensions),
3451
+ ...Object.values(ShipDimensions),
3452
+ ...Object.values(ErrorDimensions),
3453
+ ...Object.values(AuthDimensions),
3454
+ ...Object.values(SkillsDimensions),
3455
+ ...Object.values(PackagerDimensions),
3456
+ ...Object.values(ScopeDimensions)
3350
3457
  ]);
3351
- var INTERNAL_ERROR_NAMES = new Set([
3352
- "TypeError",
3353
- "ReferenceError",
3354
- "SyntaxError",
3355
- "RangeError"
3458
+ var CURATED_DIMENSIONS = new Set([
3459
+ BaseDimensions.ApplicationName,
3460
+ BaseDimensions.ProductVersion,
3461
+ BaseDimensions.InstallationId,
3462
+ BaseDimensions.CloudUserId,
3463
+ BaseDimensions.CloudTenantId,
3464
+ BaseDimensions.CloudOrganizationId,
3465
+ BaseDimensions.IsInternalUser,
3466
+ BaseDimensions.Environment,
3467
+ BaseDimensions.BaseUrl,
3468
+ BaseDimensions.Region,
3469
+ BaseDimensions.Agent,
3470
+ BaseDimensions.AgentVersion,
3471
+ BaseDimensions.ToolVersion,
3472
+ BaseDimensions.ExecutionContext,
3473
+ BaseDimensions.CiProvider,
3474
+ BaseDimensions.SessionIdSource,
3475
+ BaseDimensions.SessionId,
3476
+ ...Object.values(CommandDimensions),
3477
+ ...Object.values(ShipDimensions)
3356
3478
  ]);
3357
- function isRecord(value) {
3358
- return value !== null && typeof value === "object";
3359
- }
3360
- function stringField(value, field) {
3361
- if (!isRecord(value)) {
3362
- return;
3363
- }
3364
- const raw = value[field];
3365
- return typeof raw === "string" ? raw : undefined;
3366
- }
3367
- function numberField(value, field) {
3368
- if (!isRecord(value)) {
3369
- return;
3370
- }
3371
- const raw = value[field];
3372
- return typeof raw === "number" ? raw : undefined;
3373
- }
3374
- function findStringInCauseChain(error, field) {
3375
- let current = error;
3376
- for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
3377
- const value = stringField(current, field);
3378
- if (value) {
3379
- return value;
3479
+ function lowercaseIdDimensionValues(properties) {
3480
+ let changed = false;
3481
+ const result = {
3482
+ ...properties
3483
+ };
3484
+ for (const key of Object.keys(result)) {
3485
+ const value = result[key];
3486
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
3487
+ continue;
3488
+ }
3489
+ const lowered = value.toLowerCase();
3490
+ if (lowered !== value) {
3491
+ result[key] = lowered;
3492
+ changed = true;
3380
3493
  }
3381
- current = current.cause;
3382
3494
  }
3383
- return;
3384
- }
3385
- function findCodeInCauseChain(error) {
3386
- return findStringInCauseChain(error, "code");
3387
- }
3388
- function isSpawnEnoent(error) {
3389
- const code = findCodeInCauseChain(error);
3390
- if (code !== "ENOENT") {
3391
- return false;
3392
- }
3393
- const syscall = findStringInCauseChain(error, "syscall");
3394
- return syscall?.startsWith("spawn") === true;
3395
- }
3396
- function isCancellationError(error, exitCode, pollSignal) {
3397
- if (exitCode === 130) {
3398
- return true;
3399
- }
3400
- if (!isRecord(error)) {
3401
- return false;
3402
- }
3403
- if (numberField(error, "exitCode") === 130) {
3404
- return true;
3405
- }
3406
- const name = stringField(error, "name");
3407
- if (name === "ExitPromptError") {
3408
- return true;
3409
- }
3410
- if (name === "AbortError" && pollSignal?.aborted) {
3411
- return true;
3412
- }
3413
- const message = stringField(error, "message");
3414
- return message?.includes("SIGINT") === true;
3415
- }
3416
- function terminalSignalFor(input, outcome) {
3417
- if (input.recordedFailure?.terminalSignal) {
3418
- return input.recordedFailure.terminalSignal;
3419
- }
3420
- const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
3421
- if (explicit) {
3422
- return explicit;
3423
- }
3424
- return outcome === "cancelled" ? "SIGINT" : undefined;
3425
- }
3426
- function classifyHttpStatus(status) {
3427
- if (status === 401 || status === 403) {
3428
- return "auth";
3429
- }
3430
- if (status === 400 || status === 409 || status === 422) {
3431
- return "validation";
3432
- }
3433
- if (status === 408) {
3434
- return "timeout";
3435
- }
3436
- return "network_http";
3437
- }
3438
- function classifyFromResult(result) {
3439
- switch (result) {
3440
- case "AuthenticationError":
3441
- return "auth";
3442
- case "ValidationError":
3443
- return "validation";
3444
- case "TimeoutError":
3445
- return "timeout";
3446
- default:
3447
- return;
3448
- }
3449
- }
3450
- function classifyFromErrorCode(errorCode) {
3451
- if (!errorCode) {
3452
- return;
3453
- }
3454
- if (AUTH_ERROR_CODES.has(errorCode)) {
3455
- return "auth";
3456
- }
3457
- if (VALIDATION_ERROR_CODES.has(errorCode)) {
3458
- return "validation";
3459
- }
3460
- if (TIMEOUT_ERROR_CODES.has(errorCode)) {
3461
- return "timeout";
3462
- }
3463
- if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
3464
- return "network_http";
3465
- }
3466
- return;
3467
- }
3468
- function classifyFromError(error) {
3469
- const code = findCodeInCauseChain(error);
3470
- if (code) {
3471
- if (code.startsWith("commander.")) {
3472
- return "validation";
3473
- }
3474
- if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
3475
- return "network_http";
3476
- }
3477
- if (TIMEOUT_OS_ERROR_CODES.has(code)) {
3478
- return "timeout";
3479
- }
3480
- if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
3481
- return "missing_dependency";
3482
- }
3483
- }
3484
- const message = stringField(error, "message");
3485
- if (message?.includes("fetch failed") === true) {
3486
- return "network_http";
3487
- }
3488
- const name = stringField(error, "name");
3489
- if (name && INTERNAL_ERROR_NAMES.has(name)) {
3490
- return "internal";
3491
- }
3492
- return;
3493
- }
3494
- function classifyError2(input) {
3495
- const recorded = input.recordedFailure;
3496
- if (recorded?.errorClass) {
3497
- return recorded.errorClass;
3498
- }
3499
- const status = recorded?.context?.httpStatus;
3500
- if (status !== undefined) {
3501
- return classifyHttpStatus(status);
3502
- }
3503
- return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
3504
- }
3505
- function recordCommandFailureTelemetry(failure) {
3506
- recordedFailureSlot.set(failure);
3507
- }
3508
- function clearRecordedCommandFailureTelemetry() {
3509
- recordedFailureSlot.clear();
3510
- }
3511
- function takeRecordedCommandFailureTelemetry() {
3512
- const failure = recordedFailureSlot.get();
3513
- recordedFailureSlot.clear();
3514
- return failure;
3515
- }
3516
- function buildCommandTerminalTelemetryProperties(input) {
3517
- const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
3518
- const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
3519
- const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
3520
- const terminalSignal = terminalSignalFor(input, outcome);
3521
- return {
3522
- exit_code: input.exitCode,
3523
- terminal_outcome: outcome,
3524
- ...errorClass ? { error_class: errorClass } : {},
3525
- ...terminalSignal ? { terminal_signal: terminalSignal } : {}
3526
- };
3527
- }
3528
-
3529
- // ../common/src/telemetry/telemetry-events.ts
3530
- var CommonTelemetryEvents = {
3531
- Error: "uip.error",
3532
- ShipSucceeded: "uip.ship.succeeded"
3533
- };
3534
-
3535
- // ../common/src/registry.ts
3536
- import { execFileSync } from "node:child_process";
3537
- function readRegistryValue(keyPath, valueName) {
3538
- if (process.platform !== "win32") {
3539
- return "";
3540
- }
3541
- const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3542
- encoding: "utf-8",
3543
- stdio: ["pipe", "pipe", "pipe"],
3544
- windowsHide: true
3545
- }));
3546
- if (error) {
3547
- return "";
3548
- }
3549
- const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
3550
- return match?.[1]?.trim() ?? "";
3495
+ return changed ? result : properties;
3551
3496
  }
3552
3497
 
3553
- // ../common/src/telemetry/logger-telemetry-provider.ts
3554
- class LoggerTelemetryProvider {
3555
- analyticsUniqueId;
3556
- constructor() {
3557
- this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
3558
- }
3559
- enrich(properties) {
3560
- return {
3561
- ...properties,
3562
- ...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
3563
- };
3564
- }
3565
- async trackEvent({ name, properties }) {
3566
- logger.debug(formatMessage("Event", name, this.enrich(properties)));
3567
- }
3568
- async trackException({
3569
- error,
3570
- properties
3571
- }) {
3572
- logger.error(formatMessage("Exception", error.message, this.enrich({
3573
- ...properties,
3574
- stack: error.stack
3575
- })));
3576
- }
3577
- async trackRequest({
3578
- name,
3579
- durationMs,
3580
- success,
3581
- properties
3582
- }) {
3583
- logger.debug(formatMessage("Request", name, this.enrich({
3584
- ...properties,
3585
- duration: `${durationMs}ms`,
3586
- success
3587
- })));
3588
- }
3589
- async trackDependency({
3590
- name,
3591
- type,
3592
- durationMs,
3593
- success,
3594
- properties
3595
- }) {
3596
- logger.debug(formatMessage("Dependency", name, this.enrich({
3597
- ...properties,
3598
- type,
3599
- duration: `${durationMs}ms`,
3600
- success
3601
- })));
3602
- }
3603
- }
3604
- function formatMessage(category, name, properties) {
3605
- let message = `[Telemetry] [${category}] ${name}`;
3606
- if (properties && Object.keys(properties).length > 0) {
3607
- const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
3608
- if (propsStr) {
3609
- message += ` | ${propsStr}`;
3610
- }
3611
- }
3612
- return message;
3613
- }
3614
- // ../common/src/telemetry/detect-agent.ts
3615
- var KNOWN_AGENTS = [
3616
- { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
3617
- { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
3618
- { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
3619
- { envVar: "CODEX_THREAD_ID", id: "codex" },
3620
- { envVar: "CODEX_SANDBOX", id: "codex" },
3621
- { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
3622
- { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
3623
- ];
3624
- function detectAgentFromEnv(env) {
3625
- for (const agent of KNOWN_AGENTS) {
3626
- const envValue = env[agent.envVar];
3627
- if (agent.value !== undefined) {
3628
- if (envValue === agent.value)
3629
- return agent.id;
3630
- } else {
3631
- if (envValue)
3632
- return agent.id;
3633
- }
3634
- }
3635
- const agentEnv = env.AGENT;
3636
- if (agentEnv) {
3637
- if (agentEnv === "1" || agentEnv === "true")
3638
- return "unknown";
3639
- if (agentEnv.length <= 32)
3640
- return agentEnv.toLowerCase();
3641
- }
3642
- return;
3643
- }
3644
- // ../common/src/telemetry/environment-info.ts
3645
- var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
3646
3498
  // ../common/src/telemetry/execution-context.ts
3647
3499
  var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
3648
3500
  var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
@@ -3737,22 +3589,17 @@ function detectExecutionContext(options = {}) {
3737
3589
  function getExecutionContextTelemetryProperties() {
3738
3590
  const detected = detectExecutionContext();
3739
3591
  return {
3740
- execution_context: detected.executionContext,
3741
- ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
3592
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
3593
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
3742
3594
  };
3743
3595
  }
3744
- // ../common/src/telemetry/node-context-storage.ts
3745
- import { AsyncLocalStorage } from "node:async_hooks";
3746
3596
 
3747
- class NodeContextStorage {
3748
- storage = new AsyncLocalStorage;
3749
- run(context, fn) {
3750
- return this.storage.run(context, fn);
3751
- }
3752
- getContext() {
3753
- return this.storage.getStore();
3754
- }
3597
+ // ../common/src/telemetry/global-telemetry-properties.ts
3598
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
3599
+ function getGlobalTelemetryProperties() {
3600
+ return telemetryPropsSlot.get();
3755
3601
  }
3602
+
3756
3603
  // ../common/src/telemetry/trace-context.ts
3757
3604
  var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
3758
3605
  var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
@@ -3781,7 +3628,7 @@ function getInboundTraceContext() {
3781
3628
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
3782
3629
  var SESSION_ID_MAX_LENGTH = 64;
3783
3630
  var RANDOM_SESSION_ID_LENGTH = 32;
3784
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
3631
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
3785
3632
  var CONTROL_CHARACTERS = /\p{Cc}/gu;
3786
3633
  var INHERITED_SESSION_SOURCES = [
3787
3634
  { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
@@ -3833,6 +3680,9 @@ function resolveTelemetrySession() {
3833
3680
  telemetrySessionSlot.set(resolved);
3834
3681
  return resolved;
3835
3682
  }
3683
+ function getTelemetrySessionId() {
3684
+ return resolveTelemetrySession().id;
3685
+ }
3836
3686
  function getTelemetrySessionSource() {
3837
3687
  return resolveTelemetrySession().source;
3838
3688
  }
@@ -3846,11 +3696,6 @@ function getTelemetryOperationId() {
3846
3696
  telemetryOperationIdSlot.set(generated);
3847
3697
  return generated;
3848
3698
  }
3849
- // ../common/src/telemetry/global-telemetry-properties.ts
3850
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
3851
- function getGlobalTelemetryProperties() {
3852
- return telemetryPropsSlot.get();
3853
- }
3854
3699
 
3855
3700
  // ../common/src/telemetry/span-clock.ts
3856
3701
  function startSpanClock() {
@@ -3913,7 +3758,10 @@ class TelemetryService {
3913
3758
  } catch (error) {
3914
3759
  const durationMs = clock.elapsedMs();
3915
3760
  const err = error instanceof Error ? error : new Error(String(error));
3916
- await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
3761
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
3762
+ ...properties,
3763
+ [CommandDimensions.ErrorMessage]: err.message
3764
+ }, context));
3917
3765
  throw error;
3918
3766
  }
3919
3767
  }
@@ -3984,7 +3832,10 @@ class TelemetryService {
3984
3832
  const durationMs = clock.elapsedMs();
3985
3833
  const err = error instanceof Error ? error : new Error(String(error));
3986
3834
  await this.telemetryProvider.trackDependency({
3987
- ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
3835
+ ...this.spanFor(name, durationMs, false, {
3836
+ ...properties,
3837
+ [CommandDimensions.ErrorMessage]: err.message
3838
+ }, childContext),
3988
3839
  type
3989
3840
  });
3990
3841
  throw error;
@@ -4019,9 +3870,10 @@ class TelemetryService {
4019
3870
  ...globalProperties,
4020
3871
  ...this.defaultProperties,
4021
3872
  ...redactProperties(properties ?? {}),
4022
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
3873
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
3874
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
4023
3875
  };
4024
- return enriched;
3876
+ return lowercaseIdDimensionValues(enriched);
4025
3877
  }
4026
3878
  generateId() {
4027
3879
  const bytes = new Uint8Array(8);
@@ -4036,6 +3888,8 @@ class TelemetryService {
4036
3888
  return hex;
4037
3889
  }
4038
3890
  }
3891
+ // ../common/src/telemetry/environment-info.ts
3892
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
4039
3893
  // ../common/src/timings.ts
4040
3894
  var TIMINGS_ENV_VAR = "UIP_TIMINGS";
4041
3895
  function createStorage2() {
@@ -4084,74 +3938,438 @@ function timingsEnabled() {
4084
3938
  if (value === undefined) {
4085
3939
  return false;
4086
3940
  }
4087
- const normalized = value.trim().toLowerCase();
4088
- return normalized === "1" || normalized === "true";
3941
+ const normalized = value.trim().toLowerCase();
3942
+ return normalized === "1" || normalized === "true";
3943
+ }
3944
+ function recordExitCode(exitCode) {
3945
+ if (!timingsEnabled()) {
3946
+ return;
3947
+ }
3948
+ getState().exitCode = exitCode;
3949
+ }
3950
+ function invocationStartedAt() {
3951
+ return new Date(performance.timeOrigin + getState().baseline);
3952
+ }
3953
+ function invocationElapsedMs() {
3954
+ return performance.now() - getState().baseline;
3955
+ }
3956
+ function markCommandStart() {
3957
+ if (!timingsEnabled()) {
3958
+ return;
3959
+ }
3960
+ getState().commandStart = performance.now();
3961
+ }
3962
+ function recordCommandDuration(durationMs) {
3963
+ if (!timingsEnabled()) {
3964
+ return;
3965
+ }
3966
+ getState().commandMs = durationMs;
3967
+ }
3968
+
3969
+ // ../common/src/registry.ts
3970
+ import { execFileSync } from "node:child_process";
3971
+ function readRegistryValue(keyPath, valueName) {
3972
+ if (process.platform !== "win32") {
3973
+ return "";
3974
+ }
3975
+ const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3976
+ encoding: "utf-8",
3977
+ stdio: ["pipe", "pipe", "pipe"],
3978
+ windowsHide: true
3979
+ }));
3980
+ if (error) {
3981
+ return "";
3982
+ }
3983
+ const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
3984
+ return match?.[1]?.trim() ?? "";
3985
+ }
3986
+
3987
+ // ../common/src/telemetry/logger-telemetry-provider.ts
3988
+ class LoggerTelemetryProvider {
3989
+ analyticsUniqueId;
3990
+ constructor() {
3991
+ this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
3992
+ }
3993
+ enrich(properties) {
3994
+ return {
3995
+ ...properties,
3996
+ ...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
3997
+ };
3998
+ }
3999
+ async trackEvent({ name, properties }) {
4000
+ logger.debug(formatMessage("Event", name, this.enrich(properties)));
4001
+ }
4002
+ async trackException({
4003
+ error,
4004
+ properties
4005
+ }) {
4006
+ logger.error(formatMessage("Exception", error.message, this.enrich({
4007
+ ...properties,
4008
+ stack: error.stack
4009
+ })));
4010
+ }
4011
+ async trackRequest({
4012
+ name,
4013
+ durationMs,
4014
+ success,
4015
+ properties
4016
+ }) {
4017
+ logger.debug(formatMessage("Request", name, this.enrich({
4018
+ ...properties,
4019
+ duration: `${durationMs}ms`,
4020
+ success
4021
+ })));
4022
+ }
4023
+ async trackDependency({
4024
+ name,
4025
+ type,
4026
+ durationMs,
4027
+ success,
4028
+ properties
4029
+ }) {
4030
+ logger.debug(formatMessage("Dependency", name, this.enrich({
4031
+ ...properties,
4032
+ type,
4033
+ duration: `${durationMs}ms`,
4034
+ success
4035
+ })));
4036
+ }
4037
+ }
4038
+ function formatMessage(category, name, properties) {
4039
+ let message = `[Telemetry] [${category}] ${name}`;
4040
+ if (properties && Object.keys(properties).length > 0) {
4041
+ const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
4042
+ if (propsStr) {
4043
+ message += ` | ${propsStr}`;
4044
+ }
4045
+ }
4046
+ return message;
4047
+ }
4048
+
4049
+ // ../common/src/telemetry/proxy-http-agent.ts
4050
+ var slot = singleton("ProxyAuthHttpsAgent");
4051
+
4052
+ // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
4053
+ var providerSlot = singleton("TelemetryProvider");
4054
+
4055
+ // ../common/src/telemetry/telemetry-spool.ts
4056
+ var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
4057
+ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
4058
+
4059
+ // ../common/src/telemetry/telemetry-init.ts
4060
+ var telemetryInstanceSlot = singleton("TelemetryService");
4061
+ var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
4062
+ function getGlobalTelemetryInstance() {
4063
+ const existing = telemetryInstanceSlot.get();
4064
+ if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
4065
+ return existing;
4066
+ }
4067
+ return;
4068
+ }
4069
+ function setGlobalTelemetryInstance(instance) {
4070
+ telemetryInstanceSlot.set(instance);
4071
+ }
4072
+ var _localTelemetryInstance;
4073
+ function getTelemetryInstance() {
4074
+ const global = getGlobalTelemetryInstance();
4075
+ if (global)
4076
+ return global;
4077
+ if (!_localTelemetryInstance) {
4078
+ _localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
4079
+ setGlobalTelemetryInstance(_localTelemetryInstance);
4080
+ }
4081
+ return _localTelemetryInstance;
4082
+ }
4083
+ var telemetry = new Proxy({}, {
4084
+ get(_, prop) {
4085
+ const instance = getTelemetryInstance();
4086
+ const value = instance[prop];
4087
+ return typeof value === "function" ? value.bind(instance) : value;
4088
+ }
4089
+ });
4090
+ // ../common/src/exit-code.ts
4091
+ function setExitCode(code) {
4092
+ process.exitCode = code;
4093
+ }
4094
+
4095
+ // ../common/src/output-codecs.ts
4096
+ var yamlSlot = singleton("YamlCodec");
4097
+ var jmespathSlot = singleton("JmespathCodec");
4098
+ async function loadOutputCodecsAsync(needed) {
4099
+ const loads = [];
4100
+ if (needed.yaml && yamlSlot.get() === undefined) {
4101
+ loads.push(import("./js-yaml-87cdx6bm.js").then((mod) => {
4102
+ yamlSlot.set(mod);
4103
+ }));
4104
+ }
4105
+ if (needed.filter && jmespathSlot.get() === undefined) {
4106
+ loads.push(import("./jmespath-e4a59c8w.js").then((m)=>__toESM(m.default,1)).then((mod) => {
4107
+ jmespathSlot.set(mod);
4108
+ }));
4109
+ }
4110
+ await Promise.all(loads);
4111
+ }
4112
+ function getYamlCodec() {
4113
+ return yamlSlot.get();
4114
+ }
4115
+ function getJmespathCodec() {
4116
+ return jmespathSlot.get();
4117
+ }
4118
+
4119
+ // ../common/src/output-format-context.ts
4120
+ var formatSlot = singleton("OutputFormat");
4121
+ var formatExplicitSlot = singleton("OutputFormatExplicit");
4122
+ var helpRequestedSlot = singleton("HelpRequested");
4123
+ var filterSlot = singleton("OutputFilter");
4124
+ function getOutputFormat() {
4125
+ return formatSlot.get("json");
4126
+ }
4127
+ function getOutputFilter() {
4128
+ return filterSlot.get();
4129
+ }
4130
+
4131
+ // ../common/src/telemetry/command-terminal.ts
4132
+ var recordedFailureSlot = singleton("CommandTelemetryFailure");
4133
+ var AUTH_ERROR_CODES = new Set([
4134
+ "authentication_required",
4135
+ "permission_denied"
4136
+ ]);
4137
+ var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
4138
+ "local_permission_denied"
4139
+ ]);
4140
+ var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
4141
+ var NETWORK_HTTP_ERROR_CODES = new Set([
4142
+ "network_error",
4143
+ "rate_limited",
4144
+ "server_error",
4145
+ "not_found",
4146
+ "method_not_allowed"
4147
+ ]);
4148
+ var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
4149
+ var NETWORK_OS_ERROR_CODES = new Set([
4150
+ "ECONNREFUSED",
4151
+ "ECONNRESET",
4152
+ "ENOTFOUND",
4153
+ "EAI_AGAIN",
4154
+ "EPIPE",
4155
+ "EHOSTUNREACH",
4156
+ "ENETUNREACH",
4157
+ "EAI_FAIL"
4158
+ ]);
4159
+ var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
4160
+ var TLS_ERROR_CODES2 = new Set([
4161
+ "SELF_SIGNED_CERT_IN_CHAIN",
4162
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
4163
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
4164
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
4165
+ "UNABLE_TO_GET_ISSUER_CERT",
4166
+ "CERT_HAS_EXPIRED",
4167
+ "CERT_UNTRUSTED",
4168
+ "ERR_TLS_CERT_ALTNAME_INVALID"
4169
+ ]);
4170
+ var MISSING_DEPENDENCY_CODES = new Set([
4171
+ "MODULE_NOT_FOUND",
4172
+ "ERR_MODULE_NOT_FOUND"
4173
+ ]);
4174
+ var INTERNAL_ERROR_NAMES = new Set([
4175
+ "TypeError",
4176
+ "ReferenceError",
4177
+ "SyntaxError",
4178
+ "RangeError"
4179
+ ]);
4180
+ function isRecord(value) {
4181
+ return value !== null && typeof value === "object";
4182
+ }
4183
+ function stringField(value, field) {
4184
+ if (!isRecord(value)) {
4185
+ return;
4186
+ }
4187
+ const raw = value[field];
4188
+ return typeof raw === "string" ? raw : undefined;
4189
+ }
4190
+ function numberField(value, field) {
4191
+ if (!isRecord(value)) {
4192
+ return;
4193
+ }
4194
+ const raw = value[field];
4195
+ return typeof raw === "number" ? raw : undefined;
4196
+ }
4197
+ function findStringInCauseChain(error, field) {
4198
+ let current = error;
4199
+ for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
4200
+ const value = stringField(current, field);
4201
+ if (value) {
4202
+ return value;
4203
+ }
4204
+ current = current.cause;
4205
+ }
4206
+ return;
4207
+ }
4208
+ function findCodeInCauseChain(error) {
4209
+ return findStringInCauseChain(error, "code");
4210
+ }
4211
+ function isSpawnEnoent(error) {
4212
+ const code = findCodeInCauseChain(error);
4213
+ if (code !== "ENOENT") {
4214
+ return false;
4215
+ }
4216
+ const syscall = findStringInCauseChain(error, "syscall");
4217
+ return syscall?.startsWith("spawn") === true;
4218
+ }
4219
+ function isCancellationError(error, exitCode, pollSignal) {
4220
+ if (exitCode === 130) {
4221
+ return true;
4222
+ }
4223
+ if (!isRecord(error)) {
4224
+ return false;
4225
+ }
4226
+ if (numberField(error, "exitCode") === 130) {
4227
+ return true;
4228
+ }
4229
+ const name = stringField(error, "name");
4230
+ if (name === "ExitPromptError") {
4231
+ return true;
4232
+ }
4233
+ if (name === "AbortError" && pollSignal?.aborted) {
4234
+ return true;
4235
+ }
4236
+ const message = stringField(error, "message");
4237
+ return message?.includes("SIGINT") === true;
4238
+ }
4239
+ function terminalSignalFor(input, outcome) {
4240
+ if (input.recordedFailure?.terminalSignal) {
4241
+ return input.recordedFailure.terminalSignal;
4242
+ }
4243
+ const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
4244
+ if (explicit) {
4245
+ return explicit;
4246
+ }
4247
+ return outcome === "cancelled" ? "SIGINT" : undefined;
4089
4248
  }
4090
- function recordExitCode(exitCode) {
4091
- if (!timingsEnabled()) {
4092
- return;
4249
+ function classifyHttpStatus(status) {
4250
+ if (status === 401 || status === 403) {
4251
+ return "auth";
4093
4252
  }
4094
- getState().exitCode = exitCode;
4095
- }
4096
- function invocationStartedAt() {
4097
- return new Date(performance.timeOrigin + getState().baseline);
4098
- }
4099
- function invocationElapsedMs() {
4100
- return performance.now() - getState().baseline;
4253
+ if (status === 400 || status === 409 || status === 422) {
4254
+ return "validation";
4255
+ }
4256
+ if (status === 408) {
4257
+ return "timeout";
4258
+ }
4259
+ return "network_http";
4101
4260
  }
4102
- function markCommandStart() {
4103
- if (!timingsEnabled()) {
4104
- return;
4261
+ function classifyFromResult(result) {
4262
+ switch (result) {
4263
+ case "AuthenticationError":
4264
+ return "auth";
4265
+ case "ValidationError":
4266
+ return "validation";
4267
+ case "TimeoutError":
4268
+ return "timeout";
4269
+ default:
4270
+ return;
4105
4271
  }
4106
- getState().commandStart = performance.now();
4107
4272
  }
4108
- function recordCommandDuration(durationMs) {
4109
- if (!timingsEnabled()) {
4273
+ function classifyFromErrorCode(errorCode) {
4274
+ if (!errorCode) {
4110
4275
  return;
4111
4276
  }
4112
- getState().commandMs = durationMs;
4113
- }
4114
- // ../common/src/telemetry/proxy-http-agent.ts
4115
- var slot = singleton("ProxyAuthHttpsAgent");
4116
-
4117
- // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
4118
- var providerSlot = singleton("TelemetryProvider");
4119
-
4120
- // ../common/src/telemetry/telemetry-spool.ts
4121
- var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
4122
- var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
4123
-
4124
- // ../common/src/telemetry/telemetry-init.ts
4125
- var telemetryInstanceSlot = singleton("TelemetryService");
4126
- var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
4127
- function getGlobalTelemetryInstance() {
4128
- const existing = telemetryInstanceSlot.get();
4129
- if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
4130
- return existing;
4277
+ if (AUTH_ERROR_CODES.has(errorCode)) {
4278
+ return "auth";
4279
+ }
4280
+ if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
4281
+ return "local_permission";
4282
+ }
4283
+ if (VALIDATION_ERROR_CODES.has(errorCode)) {
4284
+ return "validation";
4285
+ }
4286
+ if (TIMEOUT_ERROR_CODES.has(errorCode)) {
4287
+ return "timeout";
4288
+ }
4289
+ if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
4290
+ return "network_http";
4131
4291
  }
4132
4292
  return;
4133
4293
  }
4134
- function setGlobalTelemetryInstance(instance) {
4135
- telemetryInstanceSlot.set(instance);
4294
+ function hasLocalPermissionCode(error) {
4295
+ for (const node of walkErrorGraph(error)) {
4296
+ const code = node.code;
4297
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
4298
+ return true;
4299
+ }
4300
+ }
4301
+ return false;
4136
4302
  }
4137
- var _localTelemetryInstance;
4138
- function getTelemetryInstance() {
4139
- const global = getGlobalTelemetryInstance();
4140
- if (global)
4141
- return global;
4142
- if (!_localTelemetryInstance) {
4143
- _localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
4144
- setGlobalTelemetryInstance(_localTelemetryInstance);
4303
+ function classifyFromError(error) {
4304
+ const code = findCodeInCauseChain(error);
4305
+ if (code) {
4306
+ if (code.startsWith("commander.")) {
4307
+ return "validation";
4308
+ }
4309
+ if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
4310
+ return "network_http";
4311
+ }
4312
+ if (TIMEOUT_OS_ERROR_CODES.has(code)) {
4313
+ return "timeout";
4314
+ }
4315
+ if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
4316
+ return "missing_dependency";
4317
+ }
4145
4318
  }
4146
- return _localTelemetryInstance;
4319
+ if (hasLocalPermissionCode(error)) {
4320
+ return "local_permission";
4321
+ }
4322
+ const message = stringField(error, "message");
4323
+ if (message?.includes("fetch failed") === true) {
4324
+ return "network_http";
4325
+ }
4326
+ const name = stringField(error, "name");
4327
+ if (name && INTERNAL_ERROR_NAMES.has(name)) {
4328
+ return "internal";
4329
+ }
4330
+ return;
4147
4331
  }
4148
- var telemetry = new Proxy({}, {
4149
- get(_, prop) {
4150
- const instance = getTelemetryInstance();
4151
- const value = instance[prop];
4152
- return typeof value === "function" ? value.bind(instance) : value;
4332
+ function classifyError2(input) {
4333
+ const recorded = input.recordedFailure;
4334
+ if (recorded?.errorClass) {
4335
+ return recorded.errorClass;
4153
4336
  }
4154
- });
4337
+ const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
4338
+ if (status !== undefined) {
4339
+ return classifyHttpStatus(status);
4340
+ }
4341
+ return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
4342
+ }
4343
+ function recordCommandFailureTelemetry(failure) {
4344
+ recordedFailureSlot.set(failure);
4345
+ }
4346
+ function clearRecordedCommandFailureTelemetry() {
4347
+ recordedFailureSlot.clear();
4348
+ }
4349
+ function takeRecordedCommandFailureTelemetry() {
4350
+ const failure = recordedFailureSlot.get();
4351
+ recordedFailureSlot.clear();
4352
+ return failure;
4353
+ }
4354
+ function buildCommandTerminalTelemetryProperties(input) {
4355
+ const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
4356
+ const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
4357
+ const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
4358
+ const terminalSignal = terminalSignalFor(input, outcome);
4359
+ return {
4360
+ [CommandDimensions.ExitCode]: input.exitCode,
4361
+ [CommandDimensions.TerminalOutcome]: outcome,
4362
+ ...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
4363
+ ...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
4364
+ };
4365
+ }
4366
+
4367
+ // ../common/src/telemetry/telemetry-events.ts
4368
+ var CommonTelemetryEvents = {
4369
+ Start: "Application.Start",
4370
+ Error: "Application.Error",
4371
+ ShipSucceeded: "Cli.ShipSucceeded"
4372
+ };
4155
4373
 
4156
4374
  // ../common/src/formatter.ts
4157
4375
  var ANSI_STYLES = {
@@ -4344,6 +4562,9 @@ function toPascalCaseData(value, verbatimKeys, subtrees) {
4344
4562
  function normalizeDataKeys(data, verbatimKeys, subtrees) {
4345
4563
  return toPascalCaseData(data, verbatimKeys, subtrees);
4346
4564
  }
4565
+ function pascalCaseDataKeys(data) {
4566
+ return normalizeDataKeys(data);
4567
+ }
4347
4568
  function toVerbatimKeySet(preserve) {
4348
4569
  if (!Array.isArray(preserve))
4349
4570
  return;
@@ -4815,7 +5036,165 @@ class FilterImplicitLimitError extends Error {
4815
5036
  this.instructions = "Pass --limit <n> to choose how many records the filter applies to. " + "To filter over all records, pass the command's maximum accepted --limit (see the option's description in --help).";
4816
5037
  }
4817
5038
  }
4818
- function applyFilter(data, filter) {
5039
+ function countRecords(data) {
5040
+ if (Array.isArray(data))
5041
+ return data.length;
5042
+ return data == null ? 0 : 1;
5043
+ }
5044
+ function availableFields(data) {
5045
+ const records = Array.isArray(data) ? data : [data];
5046
+ const keys = new Set;
5047
+ for (const record of records) {
5048
+ if (record && typeof record === "object" && !Array.isArray(record)) {
5049
+ for (const key of Object.keys(record))
5050
+ keys.add(key);
5051
+ }
5052
+ }
5053
+ return [...keys];
5054
+ }
5055
+ function decodeQuotedIdentifier(whole, inner) {
5056
+ const [error, decoded] = catchError(() => JSON.parse(whole));
5057
+ if (!error && typeof decoded === "string")
5058
+ return decoded;
5059
+ return inner.replace(/\\(.)/g, "$1");
5060
+ }
5061
+ function referencedFields(filter) {
5062
+ const top = new Set;
5063
+ const nested = new Set;
5064
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
5065
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
5066
+ const quoted = [];
5067
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
5068
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
5069
+ if (!isAlias) {
5070
+ quoted.push({
5071
+ name: decodeQuotedIdentifier(whole, name),
5072
+ index,
5073
+ tail: isPathTail(withoutValueLiterals, index)
5074
+ });
5075
+ }
5076
+ return `"${" ".repeat(whole.length - 2)}"`;
5077
+ });
5078
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
5079
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
5080
+ const place = (name, index, tail) => {
5081
+ if (tail || index >= rootEnd)
5082
+ nested.add(name);
5083
+ else
5084
+ top.add(name);
5085
+ };
5086
+ for (const entry of quoted)
5087
+ place(entry.name, entry.index, entry.tail);
5088
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
5089
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
5090
+ for (const match of identifiers) {
5091
+ const [, name, trailing] = match;
5092
+ if (trailing || reserved.has(name))
5093
+ continue;
5094
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
5095
+ }
5096
+ return {
5097
+ top: [...top],
5098
+ nested: [...nested].filter((name) => !top.has(name)),
5099
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
5100
+ };
5101
+ }
5102
+ function appearsBelowTopLevel(data, name) {
5103
+ let budget = 2000;
5104
+ const visit = (value, depth) => {
5105
+ if (budget-- <= 0 || depth > 4)
5106
+ return false;
5107
+ if (value === null || typeof value !== "object")
5108
+ return false;
5109
+ if (Array.isArray(value))
5110
+ return value.some((entry) => visit(entry, depth));
5111
+ const record = value;
5112
+ if (depth > 0 && Object.hasOwn(record, name))
5113
+ return true;
5114
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
5115
+ };
5116
+ return visit(data, 0);
5117
+ }
5118
+ function alwaysNullKeys(records) {
5119
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
5120
+ if (objects.length === 0 || objects.length !== records.length)
5121
+ return [];
5122
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
5123
+ if (keys.length === 0)
5124
+ return [];
5125
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
5126
+ return nullKeys.length === keys.length ? nullKeys : [];
5127
+ }
5128
+ function carriesOnlyNulls(value) {
5129
+ if (value === null)
5130
+ return true;
5131
+ if (Array.isArray(value)) {
5132
+ return value.length > 0 && value.every(carriesOnlyNulls);
5133
+ }
5134
+ if (typeof value === "object" && value !== undefined) {
5135
+ const values = Object.values(value);
5136
+ return values.length > 0 && values.every(carriesOnlyNulls);
5137
+ }
5138
+ return false;
5139
+ }
5140
+ function nameList(names, cap2 = 12) {
5141
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
5142
+ const rest = names.length - shown.length;
5143
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5144
+ }
5145
+ function buildFilterWarning(filter, data, outcome) {
5146
+ const present = availableFields(data);
5147
+ const refs = referencedFields(filter);
5148
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
5149
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
5150
+ const count = countRecords(data);
5151
+ const scope = `${count} record(s)`;
5152
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5153
+ const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
5154
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5155
+ let detail;
5156
+ let lede;
5157
+ if (outcome.kind === "null-elements") {
5158
+ lede = "returned only null values";
5159
+ const projected = `all ${outcome.count} of the elements it projected are null`;
5160
+ if (unknown.length > 0) {
5161
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5162
+ } else if (unchecked.length > 0) {
5163
+ detail = withSoundness(projected);
5164
+ } else {
5165
+ detail = `${projected}, and every field it names exists — a multi-select list ` + `(\`[A, B]\`) reads each entry against \`Data\` itself, so on a list ` + `result use \`[].[A, B]\` or \`[].{a: A, b: B}\` to read the records`;
5166
+ }
5167
+ } else if (outcome.kind === "null-rows") {
5168
+ lede = "returned only null values";
5169
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
5170
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
5171
+ } else if (outcome.kind === "null-values") {
5172
+ lede = "returned only null values";
5173
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
5174
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
5175
+ if (sameSet) {
5176
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
5177
+ } else if (unknown.length > 0) {
5178
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5179
+ } else {
5180
+ detail = withSoundness(`${projected} on all ${scope}`);
5181
+ }
5182
+ } else {
5183
+ lede = "returned nothing";
5184
+ if (unknown.length > 0) {
5185
+ detail = isNotAField(unknown);
5186
+ } else {
5187
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
5188
+ detail = withSoundness(`${selection} — it read ${scope}`);
5189
+ }
5190
+ }
5191
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
5192
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
5193
+ }
5194
+ function appendWarning(existing, note) {
5195
+ return existing ? `${existing} ${note}` : note;
5196
+ }
5197
+ function applyFilter(data, filter, onWarning) {
4819
5198
  const codec = requireJmespath();
4820
5199
  let result;
4821
5200
  try {
@@ -4823,9 +5202,34 @@ function applyFilter(data, filter) {
4823
5202
  } catch (err) {
4824
5203
  throw new FilterEvaluationError(filter, err);
4825
5204
  }
4826
- if (result == null)
5205
+ const inputCount = countRecords(data);
5206
+ const warn = (outcome) => {
5207
+ if (inputCount === 0)
5208
+ return;
5209
+ const note = buildFilterWarning(filter, data, outcome);
5210
+ getOutputSink().writeErr(`[WARN] ${note}
5211
+ `);
5212
+ onWarning?.(note);
5213
+ };
5214
+ const warnIfAllNull = (records) => {
5215
+ const keys = alwaysNullKeys(records);
5216
+ if (keys.length > 0)
5217
+ warn({ kind: "null-values", keys });
5218
+ };
5219
+ if (result == null) {
5220
+ warn({ kind: "empty" });
4827
5221
  return [];
5222
+ }
4828
5223
  if (Array.isArray(result)) {
5224
+ if (result.length === 0) {
5225
+ warn({ kind: "empty" });
5226
+ } else if (result.every((entry) => entry === null)) {
5227
+ warn({ kind: "null-elements", count: result.length });
5228
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
5229
+ warn({ kind: "null-rows", count: result.length });
5230
+ } else {
5231
+ warnIfAllNull(result);
5232
+ }
4829
5233
  if (result.length > 0 && typeof result[0] !== "object") {
4830
5234
  const fieldMatch = filter.match(/\.(\w+)$/);
4831
5235
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -4833,10 +5237,30 @@ function applyFilter(data, filter) {
4833
5237
  }
4834
5238
  return result;
4835
5239
  }
4836
- if (typeof result === "object")
5240
+ if (typeof result === "object") {
5241
+ warnIfAllNull([result]);
4837
5242
  return result;
5243
+ }
4838
5244
  return { Value: result };
4839
5245
  }
5246
+ function filterFailureData(envelope) {
5247
+ const filter = getOutputFilter();
5248
+ const data = envelope.Data;
5249
+ if (!filter || data == null)
5250
+ return;
5251
+ let note;
5252
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
5253
+ note = n;
5254
+ }));
5255
+ if (filterError) {
5256
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
5257
+ return;
5258
+ }
5259
+ envelope.Data = filtered;
5260
+ if (note) {
5261
+ envelope.Warning = appendWarning(envelope.Warning, note);
5262
+ }
5263
+ }
4840
5264
  function defaultErrorCodeForResult(result) {
4841
5265
  switch (result) {
4842
5266
  case RESULTS.AuthenticationError:
@@ -4880,7 +5304,7 @@ function defaultErrorCodeForHttpStatus(status) {
4880
5304
  return "server_error";
4881
5305
  return;
4882
5306
  }
4883
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
5307
+ var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
4884
5308
  function defaultErrorCodeForFailure(data) {
4885
5309
  if (data.Result === RESULTS.Failure) {
4886
5310
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
@@ -4919,8 +5343,14 @@ var OutputFormatter;
4919
5343
  }
4920
5344
  const filter = getOutputFilter();
4921
5345
  if (filter) {
4922
- const filtered = applyFilter(data.Data, filter);
5346
+ let note;
5347
+ const filtered = applyFilter(data.Data, filter, (n) => {
5348
+ note = n;
5349
+ });
4923
5350
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
5351
+ if (note) {
5352
+ data.Warning = appendWarning(data.Warning, note);
5353
+ }
4924
5354
  }
4925
5355
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
4926
5356
  }
@@ -4948,12 +5378,13 @@ var OutputFormatter;
4948
5378
  delete envelope.TelemetryErrorClass;
4949
5379
  delete envelope.TelemetryTerminalOutcome;
4950
5380
  delete envelope.TelemetryTerminalSignal;
5381
+ filterFailureData(envelope);
4951
5382
  if (!suppressTelemetry) {
4952
5383
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
4953
- result: data.Result,
4954
- errorCode: data.ErrorCode,
4955
- retry: data.Retry,
4956
- message: data.Message
5384
+ [ErrorDimensions.Result]: data.Result,
5385
+ [ErrorDimensions.ErrorCode]: data.ErrorCode,
5386
+ [ErrorDimensions.Retry]: data.Retry,
5387
+ [ErrorDimensions.ErrorMessage]: data.Message
4957
5388
  });
4958
5389
  }
4959
5390
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -4996,13 +5427,20 @@ var OutputFormatter;
4996
5427
  OutputFormatter.log = log;
4997
5428
  function formatToString(data) {
4998
5429
  const filter = getOutputFilter();
5430
+ const envelope = data;
4999
5431
  if ("Data" in data && data.Data != null) {
5000
5432
  data.Data = normalizeDataKeys(data.Data);
5001
5433
  if (filter) {
5002
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5434
+ let note;
5435
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5436
+ note = n;
5437
+ }));
5438
+ if (note) {
5439
+ envelope.Warning = appendWarning(envelope.Warning, note);
5440
+ }
5003
5441
  }
5004
5442
  }
5005
- const output = normalizeOutputKeys(data);
5443
+ const output = normalizeOutputKeys(envelope);
5006
5444
  const lines = [];
5007
5445
  const sink = getOutputSink();
5008
5446
  printOutput(output, getOutputFormat(), (msg) => {
@@ -5030,24 +5468,12 @@ var {
5030
5468
  Help
5031
5469
  } = import__.default;
5032
5470
 
5033
- // ../common/src/preview.ts
5034
- var previewSlot = singleton("PreviewBuild");
5035
- function isPreviewBuild() {
5036
- return previewSlot.get(false) ?? false;
5037
- }
5038
- Command.prototype.previewCommand = function(nameAndArgs, opts) {
5039
- if (isPreviewBuild()) {
5040
- return this.command(nameAndArgs, opts);
5041
- }
5042
- return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
5043
- };
5044
-
5045
5471
  // ../common/src/telemetry/command-attribution.ts
5046
5472
  var LEGACY_SKILL_NAMESPACE = "uipath:";
5047
5473
  var MAX_SKILL_NAME_LENGTH = 80;
5048
5474
  var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
5049
5475
  function productMode(productArea, mode) {
5050
- return { product_area: productArea, mode };
5476
+ return { ProductArea: productArea, Mode: mode };
5051
5477
  }
5052
5478
  function attributionRecord(groups) {
5053
5479
  const record = {};
@@ -5105,6 +5531,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
5105
5531
  ["rpa", "build", ["uip.rpa-legacy"]],
5106
5532
  ["conversational", "operate", ["uip.conversational"]],
5107
5533
  ["agents", "build", ["uip.codedagent", "uip.agent"]],
5534
+ ["coding-agents", "build", ["uip.coder"]],
5108
5535
  ["agenthub", "build", ["uip.agenthub"]],
5109
5536
  ["coded-apps", "build", ["uip.codedapp"]],
5110
5537
  ["functions", "build", ["uip.function", "uip.functions"]],
@@ -5190,32 +5617,64 @@ function normalizeSkillName(value) {
5190
5617
  function buildCommandTelemetryAttribution(commandPath, skillSource) {
5191
5618
  const skillName = normalizeSkillName(skillSource);
5192
5619
  return {
5193
- ...skillName ? { skill_name: skillName } : {},
5620
+ ...skillName ? { SkillName: skillName } : {},
5194
5621
  ...getCommandProductModeAttribution(commandPath)
5195
5622
  };
5196
5623
  }
5624
+ var AGENT_SESSION_ENV = {
5625
+ [BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
5626
+ [SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
5627
+ [SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
5628
+ [SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
5629
+ };
5630
+ var MAX_TELEMETRY_TOKEN_LENGTH = 120;
5631
+ function sanitizeTelemetryToken(value) {
5632
+ return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
5633
+ }
5634
+ function buildAgentSessionTelemetry(env) {
5635
+ const dimensions = {};
5636
+ for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
5637
+ const value = env[variable]?.trim();
5638
+ if (value) {
5639
+ dimensions[key] = sanitizeTelemetryToken(value);
5640
+ }
5641
+ }
5642
+ return dimensions;
5643
+ }
5197
5644
 
5198
5645
  // ../common/src/telemetry/command-name.ts
5199
- var TELEMETRY_COMMAND_ROOT = "uip";
5646
+ var TELEMETRY_NAME_ROOT = "Cli";
5647
+ var CLI_COMMAND_ROOT = "uip";
5648
+ var TELEMETRY_NAME_BARE_ACTION = "Invoke";
5200
5649
  function commandTelemetryName(parts) {
5650
+ const action = vetCommandTokens(parts).map(pascalizeToken).join("");
5651
+ return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
5652
+ }
5653
+ function commandInvocationPath(parts) {
5654
+ return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
5655
+ }
5656
+ function vetCommandTokens(parts) {
5201
5657
  const tokens = [];
5202
5658
  for (const part of parts) {
5203
- const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
5659
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
5204
5660
  if (pieces.every(isCommandToken)) {
5205
5661
  tokens.push(...pieces);
5206
5662
  continue;
5207
5663
  }
5208
5664
  tokens.push(UNKNOWN_TOKEN);
5209
5665
  }
5210
- return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
5666
+ return tokens;
5667
+ }
5668
+ function pascalizeToken(token) {
5669
+ return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
5211
5670
  }
5212
- var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
5671
+ var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
5213
5672
  var MAX_COMMAND_TOKEN_LENGTH = 32;
5214
5673
  var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
5215
5674
  function isCommandToken(token) {
5216
- return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
5675
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
5217
5676
  }
5218
- var UNKNOWN_TOKEN = "<unknown>";
5677
+ var UNKNOWN_TOKEN = "unknown";
5219
5678
 
5220
5679
  // ../common/src/telemetry/invocation-request.ts
5221
5680
  var requestContextSlot = singleton("TelemetryInvocationRequestContext");
@@ -5320,7 +5779,7 @@ function withheldArgumentValues(cmd) {
5320
5779
  });
5321
5780
  return values;
5322
5781
  }
5323
- function deriveCommandPath(cmd) {
5782
+ function deriveCommandParts(cmd) {
5324
5783
  const parts = [];
5325
5784
  let current = cmd;
5326
5785
  while (current) {
@@ -5333,14 +5792,13 @@ function deriveCommandPath(cmd) {
5333
5792
  if (parts.length > 1) {
5334
5793
  parts.shift();
5335
5794
  }
5336
- return commandTelemetryName(parts);
5795
+ return parts;
5337
5796
  }
5338
5797
  function isErrorContext(value) {
5339
5798
  return value !== null && typeof value === "object";
5340
5799
  }
5341
5800
  function commandHelpHint(commandPath) {
5342
- const command = commandPath.replace(/\./g, " ");
5343
- return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
5801
+ return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
5344
5802
  }
5345
5803
  function isPromptCancellation(error) {
5346
5804
  return error instanceof Error && error.name === "ExitPromptError";
@@ -5365,7 +5823,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5365
5823
  yaml: getOutputFormat() === "yaml",
5366
5824
  filter: getOutputFilter() !== undefined
5367
5825
  });
5368
- const telemetryName = deriveCommandPath(command);
5826
+ const commandParts = deriveCommandParts(command);
5827
+ const telemetryName = commandTelemetryName(commandParts);
5828
+ const commandPath = commandInvocationPath(commandParts);
5369
5829
  const props = typeof properties === "function" ? properties(...args) : properties;
5370
5830
  markCommandStart();
5371
5831
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
@@ -5400,7 +5860,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5400
5860
  Result: finalResult,
5401
5861
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
5402
5862
  Message: errorMessage,
5403
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
5863
+ Instructions: customInstructions ?? commandHelpHint(commandPath),
5404
5864
  ...customRetry ? { Retry: customRetry } : {},
5405
5865
  ...customContext ? { Context: customContext } : {}
5406
5866
  });
@@ -5417,8 +5877,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5417
5877
  recordedFailure,
5418
5878
  pollSignal: context.pollSignal
5419
5879
  });
5420
- if (terminalTelemetry.error_class === "internal" && error) {
5421
- telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
5880
+ if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
5881
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
5422
5882
  }
5423
5883
  const commandParams = extractCommandParams(command);
5424
5884
  if (props) {
@@ -5429,10 +5889,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5429
5889
  const baseProperties = redactProperties({
5430
5890
  ...commandParams,
5431
5891
  ...props,
5432
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
5433
- command: "true",
5892
+ ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
5893
+ ...buildAgentSessionTelemetry(process.env),
5894
+ [CommandDimensions.CommandName]: commandPath,
5895
+ [CommandDimensions.IsCommand]: "true",
5434
5896
  ...terminalTelemetry,
5435
- ...errorMessage ? { errorMessage } : {}
5897
+ ...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
5436
5898
  });
5437
5899
  emitInvocationRequest(telemetryName, success, baseProperties);
5438
5900
  } finally {
@@ -5960,6 +6422,31 @@ async function readStdin() {
5960
6422
  });
5961
6423
  }
5962
6424
 
6425
+ // ../common/src/telemetry/console-telemetry-provider.ts
6426
+ class ConsoleTelemetryProvider {
6427
+ async trackEvent({ name }) {
6428
+ console.debug(`[Telemetry] Event: ${name}`);
6429
+ }
6430
+ async trackException({ error }) {
6431
+ console.error(`[Telemetry] Exception: ${error.message}`);
6432
+ }
6433
+ async trackRequest({
6434
+ name,
6435
+ durationMs,
6436
+ success
6437
+ }) {
6438
+ console.debug(`[Telemetry] Request: ${name} (${durationMs}ms, ${success ? "ok" : "fail"})`);
6439
+ }
6440
+ async trackDependency({
6441
+ name,
6442
+ type,
6443
+ durationMs,
6444
+ success
6445
+ }) {
6446
+ console.debug(`[Telemetry] Dependency: ${name} [${type}] (${durationMs}ms, ${success ? "ok" : "fail"})`);
6447
+ }
6448
+ }
6449
+
5963
6450
  // ../common/src/attachment-binding.ts
5964
6451
  function appendOption(value, previous) {
5965
6452
  return [...previous ?? [], value];
@@ -5978,11 +6465,11 @@ function parseAttachmentSpec(spec) {
5978
6465
  }
5979
6466
  return { name, path };
5980
6467
  }
5981
- async function resolveAttachmentInputs(specs, upload) {
6468
+ async function readAttachmentSpecs(specs) {
5982
6469
  const fs = getFileSystem();
5983
- const prepared = await Promise.all(specs.map(async (spec) => {
6470
+ return Promise.all(specs.map(async (spec) => {
5984
6471
  const bytes = await fs.readFile(spec.path).catch(async (err) => {
5985
- throw new Error(`Cannot read --attachment '${spec.path}' for variable '${spec.name}': ${await extractErrorMessage(err)}`);
6472
+ throw new Error(`Cannot read --attachment '${spec.path}' for variable '${spec.name}': ${await extractErrorMessage(err)}`, { cause: err });
5986
6473
  });
5987
6474
  if (bytes === null) {
5988
6475
  throw new Error(`--attachment '${spec.path}' for variable '${spec.name}' is empty or could not be read.`);
@@ -5993,9 +6480,12 @@ async function resolveAttachmentInputs(specs, upload) {
5993
6480
  fileName: fs.path.basename(spec.path)
5994
6481
  };
5995
6482
  }));
6483
+ }
6484
+ async function resolveAttachmentInputs(specs, upload) {
6485
+ const prepared = await readAttachmentSpecs(specs);
5996
6486
  return Promise.all(prepared.map(async (p) => {
5997
6487
  const reference = await upload(p.bytes, p.fileName).catch(async (err) => {
5998
- throw new Error(`Failed to upload --attachment '${p.path}' for variable '${p.name}': ${await extractErrorMessage(err)}`);
6488
+ throw new Error(`Failed to upload --attachment '${p.path}' for variable '${p.name}': ${await extractErrorMessage(err)}`, { cause: err });
5999
6489
  });
6000
6490
  return { name: p.name, path: p.path, reference };
6001
6491
  }));
@@ -6012,6 +6502,17 @@ Command.prototype.examples = function(examples) {
6012
6502
  examplesByCommand.set(this, examples);
6013
6503
  return this;
6014
6504
  };
6505
+ // ../common/src/preview.ts
6506
+ var previewSlot = singleton("PreviewBuild");
6507
+ function isPreviewBuild() {
6508
+ return previewSlot.get(false) ?? false;
6509
+ }
6510
+ Command.prototype.previewCommand = function(nameAndArgs, opts) {
6511
+ if (isPreviewBuild()) {
6512
+ return this.command(nameAndArgs, opts);
6513
+ }
6514
+ return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
6515
+ };
6015
6516
  // ../common/src/completer.ts
6016
6517
  var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
6017
6518
  // ../common/src/console-guard.ts
@@ -6311,6 +6812,49 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
6311
6812
  // ../common/src/interactivity-context.ts
6312
6813
  var modeSlot = singleton("InteractivityMode");
6313
6814
  var interactiveFlagSlot = singleton("InteractiveFlag");
6815
+ // ../common/src/mime-types.ts
6816
+ var OCTET_STREAM = "application/octet-stream";
6817
+ var MIME_TYPES_BY_EXTENSION = Object.freeze({
6818
+ pdf: "application/pdf",
6819
+ png: "image/png",
6820
+ jpg: "image/jpeg",
6821
+ jpeg: "image/jpeg",
6822
+ gif: "image/gif",
6823
+ webp: "image/webp",
6824
+ bmp: "image/bmp",
6825
+ tif: "image/tiff",
6826
+ tiff: "image/tiff",
6827
+ svg: "image/svg+xml",
6828
+ txt: "text/plain",
6829
+ log: "text/plain",
6830
+ md: "text/markdown",
6831
+ csv: "text/csv",
6832
+ tsv: "text/tab-separated-values",
6833
+ json: "application/json",
6834
+ xml: "application/xml",
6835
+ html: "text/html",
6836
+ htm: "text/html",
6837
+ yaml: "application/yaml",
6838
+ yml: "application/yaml",
6839
+ doc: "application/msword",
6840
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
6841
+ xls: "application/vnd.ms-excel",
6842
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
6843
+ ppt: "application/vnd.ms-powerpoint",
6844
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
6845
+ zip: "application/zip",
6846
+ mp3: "audio/mpeg",
6847
+ wav: "audio/wav",
6848
+ mp4: "video/mp4"
6849
+ });
6850
+ function mimeTypeForFileName(fileName) {
6851
+ const dot = fileName.lastIndexOf(".");
6852
+ if (dot < 0 || dot === fileName.length - 1) {
6853
+ return OCTET_STREAM;
6854
+ }
6855
+ const extension = fileName.slice(dot + 1).toLowerCase();
6856
+ return Object.hasOwn(MIME_TYPES_BY_EXTENSION, extension) ? MIME_TYPES_BY_EXTENSION[extension] : OCTET_STREAM;
6857
+ }
6314
6858
  // ../common/src/option-aliases.ts
6315
6859
  function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
6316
6860
  getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
@@ -6360,6 +6904,7 @@ var ScreenLogger;
6360
6904
  })(ScreenLogger ||= {});
6361
6905
  // ../common/src/sdk-user-agent.ts
6362
6906
  var USER_AGENT_HEADER = "User-Agent";
6907
+ var AGENT_PROPERTY = BaseDimensions.Agent;
6363
6908
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
6364
6909
  function userAgentPatchKey(userAgent) {
6365
6910
  return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
@@ -6463,21 +7008,21 @@ function getShippedKeys() {
6463
7008
  }
6464
7009
  function dedupeKey(payload) {
6465
7010
  return [
6466
- payload.command_name,
6467
- payload.ship_kind,
6468
- payload.target,
6469
- payload.project_type,
6470
- payload.artifact_correlation_key ?? payload.package_version_key ?? payload.deployment_key ?? payload.solution_id ?? payload.package_name ?? ""
7011
+ payload.CommandName,
7012
+ payload.ShipKind,
7013
+ payload.Target,
7014
+ payload.ProjectType,
7015
+ payload.ArtifactCorrelationKey ?? payload.PackageVersionKey ?? payload.DeploymentKey ?? payload.SolutionId ?? payload.PackageName ?? ""
6471
7016
  ].join("|");
6472
7017
  }
6473
7018
  function withPseudonymizedIdentifiers(payload) {
6474
7019
  return {
6475
7020
  ...payload,
6476
- ...payload.package_name === undefined ? {} : {
6477
- package_name: `package#${pseudonymize(payload.package_name)}`
7021
+ ...payload.PackageName === undefined ? {} : {
7022
+ PackageName: `package#${pseudonymize(payload.PackageName)}`
6478
7023
  },
6479
- ...payload.artifact_correlation_key === undefined ? {} : {
6480
- artifact_correlation_key: `artifact#${pseudonymize(payload.artifact_correlation_key)}`
7024
+ ...payload.ArtifactCorrelationKey === undefined ? {} : {
7025
+ ArtifactCorrelationKey: `artifact#${pseudonymize(payload.ArtifactCorrelationKey)}`
6481
7026
  }
6482
7027
  };
6483
7028
  }
@@ -6493,6 +7038,6 @@ function trackShipSucceeded(payload) {
6493
7038
  }
6494
7039
  // ../common/src/tool-provider.ts
6495
7040
  var factorySlot = singleton("PackagerFactoryProvider");
6496
- export { catchError, extractErrorMessage, extractErrorMessageSync, appendOption, ATTACHMENT_INSTRUCTIONS, ATTACHMENT_UPLOAD_INSTRUCTIONS, parseAttachmentSpec, resolveAttachmentInputs, logger, getOutputFormat, getOutputFormatExplicit, RESULTS, EXIT_CODES, Pagination, OutputFormatter, summarizePlatformBody, InvalidArgumentError, Command, isPreviewBuild, processContext, UIPATH_HOME_DIR, DEFAULT_PAGE_SIZE, hashContent, instructionsFor, isGuid, createHiddenDeprecatedTenantOption, parseLimit, parseOffset, parseBoundedInt, registerPackageMetadataOptions, mapPackageMetadataOptions, msToDuration, PollOutcome, ErrorDecision, MIN_INTERVAL_MS, pollUntil, isTerminalStatus, isFailureStatus, ScreenLogger, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, unsupportedSolutionProjectType, readStdin, splitPackagedName, trackShipSucceeded };
7041
+ export { catchError, carriedInstructions, extractErrorMessage, extractErrorMessageSync, appendOption, ATTACHMENT_INSTRUCTIONS, ATTACHMENT_UPLOAD_INSTRUCTIONS, parseAttachmentSpec, resolveAttachmentInputs, getOutputSink, logger, CommandDimensions, ShipDimensions, PackagerDimensions, DebugTelemetryProvider, NodeContextStorage, TelemetryService, RESULTS, EXIT_CODES, Pagination, pascalCaseDataKeys, OutputFormatter, summarizePlatformBody, InvalidArgumentError, Command, Option, processContext, UIPATH_HOME_DIR, DEFAULT_PAGE_SIZE, hashContent, instructionsFor, isGuid, mimeTypeForFileName, createHiddenDeprecatedTenantOption, parseLimit, parseOffset, parseBoundedInt, registerPackageMetadataOptions, mapPackageMetadataOptions, msToDuration, PollOutcome, ErrorDecision, MIN_INTERVAL_MS, pollUntil, isTerminalStatus, isFailureStatus, ScreenLogger, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, unsupportedSolutionProjectType, readStdin, ConsoleTelemetryProvider, splitPackagedName, trackShipSucceeded };
6497
7042
 
6498
- //# debugId=D645F0A28E70B58464756E2164756E21
7043
+ //# debugId=2F1010F13634420164756E2164756E21