@uipath/cli 1.206.0-preview.306 → 1.207.0-preview.307

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 (69) hide show
  1. package/README.md +48 -0
  2. package/dist/{browser-strategy-p5fhwxqj.js → browser-strategy-5rfwnk5q.js} +1 -1
  3. package/dist/cli-1jpx8z2w.js +28 -0
  4. package/dist/cliInstaller-3dxg6fbd.js +23 -0
  5. package/dist/{contentStore-34hat2cd.js → contentStore-5p86z7qq.js} +7 -6
  6. package/dist/{environmentInfo-tr3pt6x1.js → environmentInfo-wp5jthdh.js} +6 -6
  7. package/dist/{feedbackPrompts-bx209g5v.js → feedbackPrompts-fc66gq0p.js} +3 -3
  8. package/dist/forcedUpdate-fm57455c.js +21 -0
  9. package/dist/{handlers-jjwt24f2.js → handlers-rg3d62gb.js} +13 -9
  10. package/dist/index-2f6vv7yr.js +81 -0
  11. package/dist/index-319vtrwd.js +264 -0
  12. package/dist/index-33wtbzyw.js +248 -0
  13. package/dist/index-5dbc9t09.js +41 -0
  14. package/dist/index-5ygg5mrs.js +1272 -0
  15. package/dist/{index-99emfvtm.js → index-65pyx6c9.js} +4 -2
  16. package/dist/{index-rr5hdtcy.js → index-81197qe5.js} +15 -17
  17. package/dist/{index-2mm750yx.js → index-8n0z4r6f.js} +69 -13
  18. package/dist/{index-8zhmg5tz.js → index-8pk6n4t9.js} +2 -2
  19. package/dist/{index-nsrrst23.js → index-ack311y7.js} +12 -2
  20. package/dist/index-afhekp0a.js +331 -0
  21. package/dist/{index-szbq3m4j.js → index-bf2mdvne.js} +8 -12
  22. package/dist/{index-2n2vr5w5.js → index-dt6mjnkf.js} +39 -57
  23. package/dist/{index-85fgzk87.js → index-dtgfa304.js} +1 -1
  24. package/dist/{index-y7d0cth0.js → index-e82sznr2.js} +7 -7
  25. package/dist/index-ej6eeger.js +23 -0
  26. package/dist/{index-bxc30q35.js → index-gk5pc8xr.js} +2 -2
  27. package/dist/{index-7q9kcs3w.js → index-h2ctqv68.js} +14 -5
  28. package/dist/{index-m780gg7f.js → index-hfvbp7ay.js} +30 -14
  29. package/dist/index-jk7em40j.js +37 -0
  30. package/dist/{index-691s5342.js → index-jn06044v.js} +2130 -834
  31. package/dist/{index-vhn8f5d2.js → index-kdr4xvby.js} +5 -5
  32. package/dist/{index-ckp8r4dh.js → index-mb62swmp.js} +2 -2
  33. package/dist/index-nzfpbep9.js +14 -0
  34. package/dist/{index-z070caqq.js → index-p64w2wrt.js} +30 -8
  35. package/dist/{index-8x2rp038.js → index-petywj9n.js} +81 -58
  36. package/dist/{index-nn8qzaxe.js → index-phkawd97.js} +2 -2
  37. package/dist/{index-ede5v6yy.js → index-q3f93ttm.js} +26 -17
  38. package/dist/{index-3s642t05.js → index-spnvnhbf.js} +7 -10
  39. package/dist/index-v7yphxb8.js +118 -0
  40. package/dist/index-vrfbee4d.js +340 -0
  41. package/dist/{index-69mcde3n.js → index-xw81b1gn.js} +196 -81
  42. package/dist/{index-wg3cne7n.js → index-xxms6rt8.js} +24 -5
  43. package/dist/{index-21kns9qg.js → index-y7v9rkq9.js} +1 -1
  44. package/dist/{index-fdztq951.js → index-zhp702kh.js} +393 -82
  45. package/dist/index.js +23 -18
  46. package/dist/{install-kgcwdbqs.js → install-h76qyy1e.js} +6 -7
  47. package/dist/{node-strategy-p1n8wr5s.js → node-strategy-9t0ttffv.js} +2 -2
  48. package/dist/{project-context-caht70an.js → project-context-rc4ghykm.js} +13 -5
  49. package/dist/{prompt-9ze9zy34.js → prompt-5vbvcsds.js} +5 -5
  50. package/dist/{server-qg4rm5e3.js → server-8c4jwqjh.js} +5 -5
  51. package/dist/{skillCatalog-fvrcgryd.js → skillCatalog-bqya1aer.js} +8 -7
  52. package/dist/skillsService-8yjvmz8c.js +35 -0
  53. package/dist/{telemetry-drain-rt346cfz.js → telemetry-drain-8qr5tzmf.js} +2 -2
  54. package/dist/tree-fk9gwh4v.js +16 -0
  55. package/dist/updateService-9qew50s3.js +377 -0
  56. package/dist/updateService.cli-xtqp78g7.js +15 -0
  57. package/dist/updateService.skills-e2pbe2w6.js +27 -0
  58. package/dist/updateService.tools-m58m2fbt.js +19 -0
  59. package/package.json +2 -2
  60. package/dist/cli-7rv7qys0.js +0 -23
  61. package/dist/index-3qp7d08f.js +0 -240
  62. package/dist/index-3zf0ywpb.js +0 -95
  63. package/dist/index-753mncpq.js +0 -271
  64. package/dist/index-w3my9pw8.js +0 -45
  65. package/dist/skillsService-0387c5f0.js +0 -29
  66. package/dist/tree-4dhk82fh.js +0 -17
  67. package/dist/updateService-a3ypvwz8.js +0 -522
  68. package/dist/updateService.skills-nkdzyrwv.js +0 -22
  69. package/dist/updateService.tools-3zfct9yk.js +0 -16
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getFileSystem2
3
- } from "./index-z070caqq.js";
3
+ } from "./index-p64w2wrt.js";
4
4
  import {
5
5
  __toESM,
6
6
  __commonJS,
@@ -2124,13 +2124,15 @@ var ProjectDimensions = {
2124
2124
  SolutionKey: "SolutionKey",
2125
2125
  SolutionProjectKey: "SolutionProjectKey",
2126
2126
  SolutionIdentityStatus: "SolutionIdentityStatus",
2127
- PreviousSolutionKey: "PreviousSolutionKey"
2127
+ PreviousSolutionKey: "PreviousSolutionKey",
2128
+ PreviousProjectKey: "PreviousProjectKey"
2128
2129
  };
2129
2130
  var GUID_KEY_DIMENSIONS = new Set([
2130
2131
  ProjectDimensions.ProjectKey,
2131
2132
  ProjectDimensions.SolutionKey,
2132
2133
  ProjectDimensions.SolutionProjectKey,
2133
- ProjectDimensions.PreviousSolutionKey
2134
+ ProjectDimensions.PreviousSolutionKey,
2135
+ ProjectDimensions.PreviousProjectKey
2134
2136
  ]);
2135
2137
  var ShipDimensions = {
2136
2138
  ShipKind: "ShipKind",
@@ -2300,9 +2302,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
2300
2302
  }
2301
2303
  }
2302
2304
 
2303
- // ../common/src/telemetry/pseudonymize.ts
2304
- var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2305
- var PSEUDONYM_HEX_LENGTH = 32;
2305
+ // ../common/src/sha256.ts
2306
2306
  var SHA256_K = new Uint32Array([
2307
2307
  1116352408,
2308
2308
  1899447441,
@@ -2382,7 +2382,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
2382
2382
  function rotr(value, bits) {
2383
2383
  return (value >>> bits | value << 32 - bits) >>> 0;
2384
2384
  }
2385
- function sha256Hex(input) {
2385
+ function sha256Words(input) {
2386
2386
  const bytes = new TextEncoder().encode(input);
2387
2387
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2388
2388
  const buffer = new Uint8Array(paddedLength);
@@ -2438,12 +2438,19 @@ function sha256Hex(input) {
2438
2438
  state[6] = state[6] + g >>> 0;
2439
2439
  state[7] = state[7] + h >>> 0;
2440
2440
  }
2441
+ return state;
2442
+ }
2443
+ function sha256Hex(input) {
2441
2444
  let hex = "";
2442
- for (const word of state) {
2445
+ for (const word of sha256Words(input)) {
2443
2446
  hex += word.toString(16).padStart(8, "0");
2444
2447
  }
2445
2448
  return hex;
2446
2449
  }
2450
+
2451
+ // ../common/src/telemetry/pseudonymize.ts
2452
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2453
+ var PSEUDONYM_HEX_LENGTH = 32;
2447
2454
  function resolveSha256Hex() {
2448
2455
  try {
2449
2456
  const nodeCrypto = __require("node:crypto");
@@ -2839,13 +2846,25 @@ function settlePromiseLike(thenable) {
2839
2846
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2840
2847
  }
2841
2848
 
2849
+ // ../common/src/result-types.ts
2850
+ var RESULTS = {
2851
+ Success: "Success",
2852
+ Failure: "Failure",
2853
+ ConfigError: "ConfigError",
2854
+ AuthenticationError: "AuthenticationError",
2855
+ ValidationError: "ValidationError",
2856
+ TimeoutError: "TimeoutError"
2857
+ };
2858
+
2842
2859
  // ../common/src/error-codes.ts
2843
2860
  var CLI_ERROR_CODES = [
2844
2861
  "invalid_argument",
2862
+ "confirmation_required",
2845
2863
  "authentication_required",
2846
2864
  "permission_denied",
2847
2865
  "local_permission_denied",
2848
2866
  "not_found",
2867
+ "not_enabled",
2849
2868
  "rate_limited",
2850
2869
  "network_error",
2851
2870
  "timeout",
@@ -2884,6 +2903,12 @@ function carriedRetry(error) {
2884
2903
  const retry = error.retry;
2885
2904
  return isRetryHint(retry) ? retry : undefined;
2886
2905
  }
2906
+ function carriedResult(error) {
2907
+ if (!error || typeof error !== "object")
2908
+ return;
2909
+ const result = error.result;
2910
+ return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
2911
+ }
2887
2912
  function defaultRetryForErrorCode(errorCode) {
2888
2913
  switch (errorCode) {
2889
2914
  case "network_error":
@@ -3169,6 +3194,9 @@ function withCarriedClass(inferred, error) {
3169
3194
  }
3170
3195
  return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
3171
3196
  }
3197
+ function classifyThrownError(error) {
3198
+ return withCarriedClass(classifyError(findHttpStatusInGraph(error), error), error);
3199
+ }
3172
3200
  function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
3173
3201
  if (extractedMessage) {
3174
3202
  return `HTTP ${status}: ${extractedMessage}`;
@@ -3310,6 +3338,8 @@ async function extractErrorDetails(error, options) {
3310
3338
  }
3311
3339
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
3312
3340
  context.errorCode = parsedBody.errorCode;
3341
+ } else if (typeof parsedBody?.errorCode === "number") {
3342
+ context.errorCode = String(parsedBody.errorCode);
3313
3343
  } else if (parsedBody?.code && typeof parsedBody.code === "string") {
3314
3344
  context.errorCode = parsedBody.code;
3315
3345
  }
@@ -3381,16 +3411,6 @@ function extractErrorMessageSync(error) {
3381
3411
  return describeThrownValue(error);
3382
3412
  }
3383
3413
 
3384
- // ../common/src/result-types.ts
3385
- var RESULTS = {
3386
- Success: "Success",
3387
- Failure: "Failure",
3388
- ConfigError: "ConfigError",
3389
- AuthenticationError: "AuthenticationError",
3390
- ValidationError: "ValidationError",
3391
- TimeoutError: "TimeoutError"
3392
- };
3393
-
3394
3414
  // ../../node_modules/commander/index.js
3395
3415
  var exports_commander = {};
3396
3416
  __exportCjs(exports_commander, {
@@ -4464,6 +4484,136 @@ class TelemetryService {
4464
4484
  // ../common/src/telemetry/telemetry-init.ts
4465
4485
  import { spawn } from "node:child_process";
4466
4486
 
4487
+ // ../common/src/telemetry/appinsights-span-fields.ts
4488
+ function toOperationUrn(name) {
4489
+ if (URL.canParse(name))
4490
+ return name;
4491
+ const sanitized = encodeURIComponent(name).replace(/%2F/g, "/");
4492
+ return `urn:uip:${sanitized}`;
4493
+ }
4494
+ function spanStart(duration) {
4495
+ return new Date(Date.now() - duration);
4496
+ }
4497
+
4498
+ // ../common/src/telemetry/browser-appinsights-telemetry-provider.ts
4499
+ class BrowserAppInsightsTelemetryProvider {
4500
+ target;
4501
+ pending = [];
4502
+ applicationVersion;
4503
+ constructor(target) {
4504
+ this.target = target;
4505
+ }
4506
+ setApplicationVersion(version) {
4507
+ this.applicationVersion = version;
4508
+ }
4509
+ getSessionId() {
4510
+ return getTelemetrySessionId();
4511
+ }
4512
+ async trackEvent(event) {
4513
+ this.enqueue("Event", "EventData", event, new Date, {
4514
+ name: event.name
4515
+ });
4516
+ }
4517
+ async trackException(exception) {
4518
+ const { error } = exception;
4519
+ this.enqueue("Exception", "ExceptionData", exception, new Date, {
4520
+ exceptions: [
4521
+ {
4522
+ typeName: error.name,
4523
+ message: error.message,
4524
+ hasFullStack: error.stack !== undefined,
4525
+ stack: error.stack
4526
+ }
4527
+ ]
4528
+ });
4529
+ }
4530
+ async trackRequest(span) {
4531
+ const { name, durationMs, success, startedAt, id } = span;
4532
+ this.enqueue("Request", "RequestData", span, startedAt ?? spanStart(durationMs), {
4533
+ id: id ?? crypto.randomUUID().replaceAll("-", "").slice(0, 16),
4534
+ name,
4535
+ url: toOperationUrn(name),
4536
+ duration: formatDuration(durationMs),
4537
+ success,
4538
+ responseCode: success ? "200" : "500"
4539
+ });
4540
+ }
4541
+ async trackDependency(span) {
4542
+ const { name, type, durationMs, success, startedAt, id, resultCode } = span;
4543
+ this.enqueue("RemoteDependency", "RemoteDependencyData", span, startedAt ?? spanStart(durationMs), {
4544
+ ...id ? { id } : {},
4545
+ name,
4546
+ type,
4547
+ duration: formatDuration(durationMs),
4548
+ success,
4549
+ resultCode: resultCode ?? (success ? "200" : "500")
4550
+ });
4551
+ }
4552
+ async flush() {
4553
+ if (this.pending.length === 0)
4554
+ return;
4555
+ const batch = this.pending;
4556
+ this.pending = [];
4557
+ const [error] = await catchError(fetch(`${this.target.ingestionOrigin}/v2/track`, {
4558
+ method: "POST",
4559
+ headers: { "Content-Type": "application/json" },
4560
+ body: JSON.stringify(batch),
4561
+ keepalive: true
4562
+ }));
4563
+ if (error) {
4564
+ logger.debug(`[AppInsights] browser send failed: ${error.message}`);
4565
+ }
4566
+ }
4567
+ async shutdown() {
4568
+ await this.flush();
4569
+ }
4570
+ enqueue(itemType, baseType, item, time, fields) {
4571
+ const iKey = this.target.instrumentationKey;
4572
+ this.pending.push({
4573
+ name: `Microsoft.ApplicationInsights.${iKey.replaceAll("-", "")}.${itemType}`,
4574
+ time: time.toISOString(),
4575
+ iKey,
4576
+ tags: this.tags(item),
4577
+ data: {
4578
+ baseType,
4579
+ baseData: {
4580
+ ver: 2,
4581
+ ...fields,
4582
+ properties: stringProperties({
4583
+ ...getGlobalTelemetryProperties(),
4584
+ ...item.properties
4585
+ })
4586
+ }
4587
+ }
4588
+ });
4589
+ }
4590
+ tags(item) {
4591
+ return {
4592
+ "ai.session.id": getTelemetrySessionId(),
4593
+ "ai.operation.id": item.operationId ?? getTelemetryOperationId(),
4594
+ ...item.parentId ? { "ai.operation.parentId": item.parentId } : {},
4595
+ ...this.applicationVersion ? { "ai.application.ver": this.applicationVersion } : {},
4596
+ "ai.internal.sdkVersion": "uip-browser"
4597
+ };
4598
+ }
4599
+ }
4600
+ function stringProperties(properties) {
4601
+ const result = {};
4602
+ for (const [key, value] of Object.entries(properties)) {
4603
+ if (value === undefined)
4604
+ continue;
4605
+ result[key] = typeof value === "string" ? value : JSON.stringify(value);
4606
+ }
4607
+ return result;
4608
+ }
4609
+ function formatDuration(durationMs) {
4610
+ const ms = Math.max(0, Math.round(durationMs));
4611
+ const pad = (value, width = 2) => String(value).padStart(width, "0");
4612
+ const days = Math.floor(ms / 86400000);
4613
+ const time = `${pad(Math.floor(ms / 3600000) % 24)}:${pad(Math.floor(ms / 60000) % 60)}:${pad(Math.floor(ms / 1000) % 60)}.${pad(ms % 1000, 3)}`;
4614
+ return days > 0 ? `${days}.${time}` : time;
4615
+ }
4616
+
4467
4617
  // ../common/src/registry.ts
4468
4618
  import { execFileSync } from "node:child_process";
4469
4619
  function readRegistryValue(keyPath, valueName) {
@@ -4555,15 +4705,6 @@ function getProxyAuthHttpsAgent() {
4555
4705
 
4556
4706
  // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
4557
4707
  var providerSlot = singleton("TelemetryProvider");
4558
- function toOperationUrn(name) {
4559
- if (URL.canParse(name))
4560
- return name;
4561
- const sanitized = encodeURIComponent(name).replace(/%2F/g, "/");
4562
- return `urn:uip:${sanitized}`;
4563
- }
4564
- function spanStart(duration) {
4565
- return new Date(Date.now() - duration);
4566
- }
4567
4708
  function isRecord(value) {
4568
4709
  return value !== null && typeof value === "object";
4569
4710
  }
@@ -4914,6 +5055,15 @@ function isTelemetryDisabled() {
4914
5055
  function isProjectTelemetryDisabled() {
4915
5056
  return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
4916
5057
  }
5058
+ function connectionStringValue(connectionString, key) {
5059
+ for (const part of connectionString.split(";")) {
5060
+ const separator = part.indexOf("=");
5061
+ if (separator !== -1 && part.slice(0, separator).trim().toLowerCase() === key.toLowerCase()) {
5062
+ return part.slice(separator + 1).trim();
5063
+ }
5064
+ }
5065
+ return;
5066
+ }
4917
5067
 
4918
5068
  // ../common/src/telemetry/telemetry-spool.ts
4919
5069
  var TELEMETRY_DRAIN_ARGV = "__uip-drain-telemetry";
@@ -5032,18 +5182,19 @@ function getConnectionString() {
5032
5182
  }
5033
5183
  var DEFAULT_INGESTION_ORIGIN = "https://dc.services.visualstudio.com";
5034
5184
  function getTelemetryIngestionOrigin() {
5035
- for (const part of getConnectionString().split(";")) {
5036
- const separator = part.indexOf("=");
5037
- if (separator === -1) {
5038
- continue;
5039
- }
5040
- if (part.slice(0, separator).trim().toLowerCase() !== "ingestionendpoint") {
5041
- continue;
5042
- }
5043
- const [error, url] = catchError(() => new URL(part.slice(separator + 1).trim()));
5044
- return error ? DEFAULT_INGESTION_ORIGIN : url.origin;
5045
- }
5046
- return DEFAULT_INGESTION_ORIGIN;
5185
+ const endpoint = connectionStringValue(getConnectionString(), "IngestionEndpoint");
5186
+ if (endpoint === undefined) {
5187
+ return DEFAULT_INGESTION_ORIGIN;
5188
+ }
5189
+ const [error, url] = catchError(() => new URL(endpoint));
5190
+ return error ? DEFAULT_INGESTION_ORIGIN : url.origin;
5191
+ }
5192
+ var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
5193
+ function getBrowserAppInsightsProvider() {
5194
+ return browserProviderSlot.getOrInit(() => new BrowserAppInsightsTelemetryProvider({
5195
+ instrumentationKey: connectionStringValue(getConnectionString(), "InstrumentationKey") ?? "",
5196
+ ingestionOrigin: getTelemetryIngestionOrigin()
5197
+ }));
5047
5198
  }
5048
5199
  async function createAppInsightsProvider() {
5049
5200
  return getOrCreateProvider(getConnectionString());
@@ -5057,6 +5208,11 @@ async function createTelemetryProvider(options) {
5057
5208
  telemetryProviderInstance = fallback;
5058
5209
  return { provider: fallback, name: "Disabled" };
5059
5210
  }
5211
+ if (options?.browserAppInsights) {
5212
+ const provider = getBrowserAppInsightsProvider();
5213
+ telemetryProviderInstance = provider;
5214
+ return { provider, name: "BrowserAppInsightsTelemetryProvider" };
5215
+ }
5060
5216
  if (options?.appInsights === false) {
5061
5217
  const fallback = new LoggerTelemetryProvider;
5062
5218
  telemetryProviderInstance = fallback;
@@ -5104,14 +5260,15 @@ var telemetry = new Proxy({}, {
5104
5260
  });
5105
5261
  async function telemetryInit(options) {
5106
5262
  const { provider, name: providerName } = await createTelemetryProvider({
5107
- appInsights: options?.appInsights
5263
+ appInsights: options?.appInsights,
5264
+ browserAppInsights: options?.browserAppInsights
5108
5265
  });
5109
5266
  const existing = getGlobalTelemetryInstance();
5110
5267
  const instance = existing ?? new TelemetryService(provider, new NodeContextStorage);
5111
5268
  instance.setProvider(provider);
5112
5269
  setGlobalTelemetryInstance(instance);
5113
5270
  _localTelemetryInstance = instance;
5114
- const isAppInsights = providerName === "NodeAppInsightsTelemetryProvider";
5271
+ const isAppInsights = providerName === "BrowserAppInsightsTelemetryProvider" || providerName === "NodeAppInsightsTelemetryProvider";
5115
5272
  if (options?.version && isAppInsights) {
5116
5273
  provider.setApplicationVersion(options.version);
5117
5274
  }
@@ -5142,6 +5299,14 @@ async function runWithTimeout(operation, timeoutMs) {
5142
5299
  clearTimeout(timer);
5143
5300
  }
5144
5301
  }
5302
+ async function runProviderFlush(provider) {
5303
+ const [flushError, flushResult] = await catchError(runWithTimeout(provider.flush(), FLUSH_SHUTDOWN_TIMEOUT_MS));
5304
+ if (flushError) {
5305
+ logger.warn(`[Telemetry] flush failed (non-fatal): ${flushError.message}`);
5306
+ } else if (flushResult === "timeout") {
5307
+ logger.warn(`[Telemetry] flush timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
5308
+ }
5309
+ }
5145
5310
  async function runProviderShutdown(provider) {
5146
5311
  const [shutdownError, shutdownResult] = await catchError(runWithTimeout(provider.shutdown(), FLUSH_SHUTDOWN_TIMEOUT_MS));
5147
5312
  if (shutdownError) {
@@ -5234,18 +5399,17 @@ async function telemetryFlushAndShutdown() {
5234
5399
  if (!isFlushableTelemetryProvider(telemetryProviderInstance)) {
5235
5400
  return;
5236
5401
  }
5402
+ if (telemetryProviderInstance === browserProviderSlot.get()) {
5403
+ await runProviderFlush(telemetryProviderInstance);
5404
+ return;
5405
+ }
5237
5406
  if (!telemetryFlushShutdownPromise) {
5238
5407
  const provider = telemetryProviderInstance;
5239
5408
  telemetryFlushShutdownPromise = (async () => {
5240
5409
  if (await trySidecarHandoff(provider)) {
5241
5410
  return;
5242
5411
  }
5243
- const [flushError, flushResult] = await catchError(runWithTimeout(provider.flush(), FLUSH_SHUTDOWN_TIMEOUT_MS));
5244
- if (flushError) {
5245
- logger.warn(`[Telemetry] flush failed (non-fatal): ${flushError.message}`);
5246
- } else if (flushResult === "timeout") {
5247
- logger.warn(`[Telemetry] flush timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
5248
- }
5412
+ await runProviderFlush(provider);
5249
5413
  await runProviderShutdown(provider);
5250
5414
  })();
5251
5415
  }
@@ -5375,7 +5539,10 @@ var AUTH_ERROR_CODES = new Set([
5375
5539
  var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
5376
5540
  "local_permission_denied"
5377
5541
  ]);
5378
- var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
5542
+ var VALIDATION_ERROR_CODES = new Set([
5543
+ "invalid_argument",
5544
+ "confirmation_required"
5545
+ ]);
5379
5546
  var NETWORK_HTTP_ERROR_CODES = new Set([
5380
5547
  "network_error",
5381
5548
  "rate_limited",
@@ -5756,6 +5923,9 @@ function toPascalCaseData(value, verbatimKeys, subtrees) {
5756
5923
  function normalizeDataKeys(data, verbatimKeys, subtrees) {
5757
5924
  return toPascalCaseData(data, verbatimKeys, subtrees);
5758
5925
  }
5926
+ function pascalCaseDataKeys(data) {
5927
+ return normalizeDataKeys(data);
5928
+ }
5759
5929
  function toVerbatimKeySet(preserve) {
5760
5930
  if (!Array.isArray(preserve))
5761
5931
  return;
@@ -5788,7 +5958,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5788
5958
  const pagedRows = extractPagedRows(data.Data);
5789
5959
  const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
5790
5960
  items.forEach((item) => {
5791
- const values = Object.values(item).map((v) => v ?? "").join("\t");
5961
+ const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
5792
5962
  logFn(values);
5793
5963
  });
5794
5964
  } else {
@@ -5803,7 +5973,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5803
5973
  default: {
5804
5974
  const hasData = "Data" in data && data.Data != null;
5805
5975
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
5806
- const rows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5976
+ const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5977
+ const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
5807
5978
  if (hasData && !(rows !== null && rows.length === 0)) {
5808
5979
  const logValue = data.Log;
5809
5980
  if (rows !== null) {
@@ -5860,6 +6031,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
5860
6031
  function isPlainObjectArray(value) {
5861
6032
  return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
5862
6033
  }
6034
+ function isPrimitiveArray(value) {
6035
+ return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
6036
+ }
5863
6037
  function isNonEmptyPlainObject(value) {
5864
6038
  return isPlainRecord(value) && Object.keys(value).length > 0;
5865
6039
  }
@@ -6215,12 +6389,12 @@ class FilterEvaluationError extends Error {
6215
6389
  instructions;
6216
6390
  retry = "RetryWillNotFix";
6217
6391
  result = RESULTS.ValidationError;
6218
- constructor(filter, cause) {
6392
+ constructor(filter, cause, hint) {
6219
6393
  const underlying = cause instanceof Error ? cause.message : String(cause);
6220
- super(`Filter '${filter}' failed to evaluate: ${underlying}`);
6394
+ super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
6221
6395
  this.name = "FilterEvaluationError";
6222
6396
  this.filter = filter;
6223
- this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
6397
+ this.instructions = (hint ? `${hint.instructions} ` : "") + `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
6224
6398
  }
6225
6399
  }
6226
6400
 
@@ -6342,6 +6516,93 @@ function nameList(names, cap = 12) {
6342
6516
  const rest = names.length - shown.length;
6343
6517
  return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
6344
6518
  }
6519
+ function notFieldsOn(names, scope) {
6520
+ return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
6521
+ }
6522
+ function failingFieldRead(ast, isList, fn, argIndex) {
6523
+ const [left, right, condition] = ast.children ?? [];
6524
+ let scopes = [];
6525
+ if (!isList) {
6526
+ scopes = [ast];
6527
+ } else if (ast.type === "FilterProjection" && left?.type === "Identity") {
6528
+ scopes = [condition, right];
6529
+ } else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
6530
+ scopes = [right];
6531
+ }
6532
+ const reads = new Set;
6533
+ let tracked = 0;
6534
+ const visit = (node) => {
6535
+ if (!node)
6536
+ return;
6537
+ switch (node.type) {
6538
+ case "Function": {
6539
+ const arg = node.children?.[argIndex - 1];
6540
+ if (node.name === fn && arg?.type === "Field" && arg.name) {
6541
+ reads.add(arg.name);
6542
+ tracked++;
6543
+ }
6544
+ node.children?.forEach(visit);
6545
+ return;
6546
+ }
6547
+ case "AndExpression":
6548
+ case "OrExpression":
6549
+ case "NotExpression":
6550
+ case "Comparator":
6551
+ case "MultiSelectList":
6552
+ case "MultiSelectHash":
6553
+ node.children?.forEach(visit);
6554
+ return;
6555
+ case "KeyValuePair":
6556
+ visit(node.value);
6557
+ return;
6558
+ }
6559
+ };
6560
+ scopes.forEach(visit);
6561
+ const calls = (node) => {
6562
+ if (node === null || typeof node !== "object")
6563
+ return 0;
6564
+ const own = node.type === "Function" && node.name === fn ? 1 : 0;
6565
+ const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
6566
+ return own + next.reduce((sum, child) => sum + calls(child), 0);
6567
+ };
6568
+ return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
6569
+ }
6570
+ function fieldExpression(name) {
6571
+ return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
6572
+ }
6573
+ function evaluationHint(codec, filter, data, cause) {
6574
+ const underlying = cause instanceof Error ? cause.message : String(cause);
6575
+ const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
6576
+ if (!failure)
6577
+ return;
6578
+ const [, fn, position, expected] = failure;
6579
+ const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
6580
+ if (name === undefined)
6581
+ return;
6582
+ const present = availableFields(data);
6583
+ if (present.length === 0)
6584
+ return;
6585
+ const scope = `${countRecords(data)} record(s)`;
6586
+ if (!present.includes(name)) {
6587
+ return {
6588
+ detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
6589
+ instructions: "Use a field the records have; names are case-sensitive."
6590
+ };
6591
+ }
6592
+ const records = Array.isArray(data) ? data : [data];
6593
+ const unset = records.filter((r) => r?.[name] == null).length;
6594
+ const field = fieldExpression(name);
6595
+ let fallback;
6596
+ if (expected.split(",").includes("string")) {
6597
+ fallback = "''";
6598
+ } else if (expected.split(",").includes("array")) {
6599
+ fallback = "`[]`";
6600
+ }
6601
+ return {
6602
+ detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
6603
+ instructions: fallback ? `Give it a default where ${fn}() reads it, e.g. \`${field} || ${fallback}\`.` : `Filter out the records where \`${name}\` is null before ${fn}() reads it.`
6604
+ };
6605
+ }
6345
6606
  function buildFilterWarning(filter, data, outcome) {
6346
6607
  const present = availableFields(data);
6347
6608
  const refs = referencedFields(filter);
@@ -6349,7 +6610,7 @@ function buildFilterWarning(filter, data, outcome) {
6349
6610
  const unchecked = refs.nested.filter((name) => !present.includes(name));
6350
6611
  const count = countRecords(data);
6351
6612
  const scope = `${count} record(s)`;
6352
- const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
6613
+ const isNotAField = (names) => notFieldsOn(names, scope);
6353
6614
  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" : "";
6354
6615
  const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
6355
6616
  let detail;
@@ -6400,7 +6661,8 @@ function applyFilter(data, filter, onWarning) {
6400
6661
  try {
6401
6662
  result = codec.search(data, filter);
6402
6663
  } catch (err) {
6403
- throw new FilterEvaluationError(filter, err);
6664
+ const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
6665
+ throw new FilterEvaluationError(filter, err, hint);
6404
6666
  }
6405
6667
  const inputCount = countRecords(data);
6406
6668
  const warn = (outcome) => {
@@ -7312,7 +7574,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
7312
7574
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
7313
7575
  const typed = error;
7314
7576
  const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
7315
- const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
7577
+ const customResult = carriedResult(error);
7316
7578
  const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
7317
7579
  const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
7318
7580
  const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
@@ -7607,6 +7869,18 @@ var FAILURE_STATUSES = new Set([
7607
7869
  "canceled",
7608
7870
  "stopped"
7609
7871
  ]);
7872
+ // ../common/src/classified-failure.ts
7873
+ async function classifiedFailure(message, error, options) {
7874
+ const details = await extractErrorDetails(error, options);
7875
+ return {
7876
+ Result: details.result,
7877
+ ErrorCode: details.errorCode,
7878
+ Message: message,
7879
+ Instructions: details.message,
7880
+ Retry: details.retry,
7881
+ ...details.context ? { Context: details.context } : {}
7882
+ };
7883
+ }
7610
7884
  // ../common/src/command-examples.ts
7611
7885
  var examplesByCommand = new WeakMap;
7612
7886
  function getCommandExamples(cmd) {
@@ -7685,14 +7959,17 @@ function collectCommands(command, parentName, result) {
7685
7959
  }
7686
7960
  }
7687
7961
  // ../common/src/confirmation.ts
7688
- function requireConfirmation(flags, operation) {
7962
+ function requireConfirmation(flags, operation, options) {
7689
7963
  if (flags.yes === true || flags.force === true) {
7690
7964
  return true;
7691
7965
  }
7966
+ const message = options?.reversible ? `Confirmation required: this will ${operation}.` : `Confirmation required: this will ${operation} and cannot be undone.`;
7692
7967
  OutputFormatter.error({
7693
7968
  Result: RESULTS.Failure,
7694
- Message: `Confirmation required: this will ${operation} and cannot be undone.`,
7695
- Instructions: "Re-run with --yes to confirm."
7969
+ Message: message,
7970
+ Instructions: options?.instructions ?? "Re-run with --yes to confirm.",
7971
+ ErrorCode: "confirmation_required",
7972
+ Retry: "RetryWillNotFix"
7696
7973
  });
7697
7974
  processContext.exit(1);
7698
7975
  return false;
@@ -7946,6 +8223,11 @@ var MIME_TYPES_BY_EXTENSION = Object.freeze({
7946
8223
  });
7947
8224
  // ../common/src/packager-tool-import.ts
7948
8225
  var REGISTER_EXPORT = "registerPackagerFactories";
8226
+ // ../common/src/relayed-output.ts
8227
+ var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
8228
+ function isOutputRelayed(cmd) {
8229
+ return cmd[RELAYED_OUTPUT_SYMBOL] === true;
8230
+ }
7949
8231
  // ../common/src/screen-logger.ts
7950
8232
  var ScreenLogger;
7951
8233
  ((ScreenLogger) => {
@@ -7965,36 +8247,65 @@ function setSdkUserAgentHostToken(token) {
7965
8247
  }
7966
8248
  sdkUserAgentHostToken.set(token);
7967
8249
  }
8250
+ // ../common/src/shell-quote.ts
8251
+ function quoteForShell(value) {
8252
+ return `'${value.replace(/'/g, "'\\''")}'`;
8253
+ }
7968
8254
  // ../common/src/stdin.ts
7969
- async function readStdin() {
8255
+ function readPipedStdin(idleTimeoutMs) {
7970
8256
  if (process.stdin.isTTY) {
7971
- return null;
8257
+ return Promise.resolve(null);
7972
8258
  }
7973
8259
  return new Promise((resolve, reject) => {
8260
+ const stdin = process.stdin;
7974
8261
  let data = "";
7975
- process.stdin.setEncoding("utf8");
7976
- process.stdin.on("data", (chunk) => {
8262
+ let timer;
8263
+ const detach = () => {
8264
+ clearTimeout(timer);
8265
+ stdin.off("data", onData);
8266
+ stdin.off("end", onEnd);
8267
+ stdin.off("error", onError);
8268
+ };
8269
+ const release = () => {
8270
+ detach();
8271
+ stdin.pause();
8272
+ stdin.unref?.();
8273
+ };
8274
+ const armTimer = () => {
8275
+ clearTimeout(timer);
8276
+ if (idleTimeoutMs === undefined) {
8277
+ return;
8278
+ }
8279
+ timer = setTimeout(() => {
8280
+ release();
8281
+ if (!data.trim()) {
8282
+ resolve(null);
8283
+ return;
8284
+ }
8285
+ reject(new Error(`Timed out: stdin was idle for ${idleTimeoutMs} ms before end of input.`));
8286
+ }, idleTimeoutMs);
8287
+ };
8288
+ const onData = (chunk) => {
7977
8289
  data += chunk;
7978
- });
7979
- process.stdin.on("end", () => resolve(data.trim() || null));
7980
- process.stdin.on("error", reject);
8290
+ armTimer();
8291
+ };
8292
+ const onEnd = () => {
8293
+ detach();
8294
+ resolve(data.trim() || null);
8295
+ };
8296
+ const onError = (err) => {
8297
+ detach();
8298
+ reject(err);
8299
+ };
8300
+ armTimer();
8301
+ stdin.setEncoding("utf8");
8302
+ stdin.on("data", onData);
8303
+ stdin.on("end", onEnd);
8304
+ stdin.on("error", onError);
7981
8305
  });
7982
8306
  }
7983
8307
  async function readStdinWithTimeout(timeoutMs) {
7984
- let timer;
7985
- const timeout = new Promise((resolve) => {
7986
- timer = setTimeout(() => {
7987
- process.stdin.unref?.();
7988
- resolve(null);
7989
- }, timeoutMs);
7990
- });
7991
- try {
7992
- return await Promise.race([readStdin(), timeout]);
7993
- } finally {
7994
- if (timer) {
7995
- clearTimeout(timer);
7996
- }
7997
- }
8308
+ return readPipedStdin(timeoutMs);
7998
8309
  }
7999
8310
  // ../common/src/telemetry/ship-succeeded.ts
8000
8311
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
@@ -8003,6 +8314,6 @@ var factorySlot = singleton("PackagerFactoryProvider");
8003
8314
  function setPackagerFactoryProvider(provider) {
8004
8315
  factorySlot.set(provider);
8005
8316
  }
8006
- export { CLI_APPLICATION_NAME, BaseDimensions, CommandDimensions, ProjectDimensions, AuthDimensions, SkillsDimensions, assertNoCuratedDimensionTargets, solutionIdentityProperties, projectKey, redactProperties, catchError, carriedErrorCode, carriedRetry, carriedInstructions, formatErrorChain, describeConnectivityError, extractErrorMessageSync, RESULTS, Command, Option, setPreviewBuild, runWithSink, getOutputSink, setGlobalSink, LogLevel, logger, configureLogger, runWithTimings, setTimingCommand, suppressTimingReport, setExitCode, recordHostExit, getExitCode, resetExitCode, loadOutputCodecsAsync, setOutputFormat, getOutputFormat, setOutputFormatExplicit, getOutputFormatExplicit, setHelpRequested, getHelpRequested, setOutputFilter, OUTPUT_FORMATS, isOutputFormat, takeRecordedCommandFailureTelemetry, buildCommandTerminalTelemetryProperties, CommonTelemetryEvents, detectAgent, detectAgentVersion, buildEnvironmentProperties, setExecutionContextAuthSignal, setGlobalTelemetryProperties, makeTrackedFetch, setProxyAuthHttpsAgent, isTelemetryDisabled, TELEMETRY_DRAIN_ARGV, setTelemetrySidecarEntry, claimPendingSpoolFiles, releaseClaimedSpoolFile, discardClaimedSpoolFile, sweepTelemetrySpool, getTelemetryIngestionOrigin, telemetry, telemetryInit, telemetryFlushAndShutdown, telemetryShutdownWithoutFlush, EXIT_CODES, Pagination, validateOutputFilter, OutputFormatter, configureProjectContextTelemetry, buildSkillEventTelemetryAttribution, sanitizeTelemetryToken, commandTelemetryName, commandInvocationPath, runWithInvocationRequest, emitInvocationRequest, processContext, setProcessContextPollSignal, TELEMETRY_ARG_VALUE_WITHHELD, extractCommandHelp, collectCommands, getCompleter, requireConfirmation, installConsoleGuard, UIPATH_HOME_DIR, CONFIG_FILENAME, DEFAULT_FETCH_TIMEOUT_MS, resolveEnvReference, setInteractivityMode, setInteractiveFlag, wasInteractiveFlagPassed, canPrompt, parseBoundedInt, splitScopeList, REGISTER_EXPORT, createPollAbortController, setSdkUserAgentHostToken, readStdinWithTimeout, setPackagerFactoryProvider };
8317
+ export { CLI_APPLICATION_NAME, BaseDimensions, CommandDimensions, ProjectDimensions, AuthDimensions, SkillsDimensions, assertNoCuratedDimensionTargets, solutionIdentityProperties, projectKey, redactProperties, catchError, RESULTS, carriedErrorCode, carriedRetry, carriedInstructions, formatErrorChain, describeConnectivityError, classifyThrownError, extractErrorDetails, extractErrorMessageSync, classifiedFailure, Command, Option, setPreviewBuild, runWithSink, getOutputSink, setGlobalSink, LogLevel, logger, configureLogger, runWithTimings, setTimingCommand, suppressTimingReport, setExitCode, recordHostExit, getExitCode, resetExitCode, loadOutputCodecsAsync, setOutputFormat, getOutputFormat, setOutputFormatExplicit, getOutputFormatExplicit, setHelpRequested, getHelpRequested, setOutputFilter, OUTPUT_FORMATS, isOutputFormat, takeRecordedCommandFailureTelemetry, buildCommandTerminalTelemetryProperties, CommonTelemetryEvents, setGlobalTelemetryProperties, detectAgent, detectAgentVersion, buildEnvironmentProperties, setExecutionContextAuthSignal, makeTrackedFetch, setProxyAuthHttpsAgent, isTelemetryDisabled, TELEMETRY_DRAIN_ARGV, setTelemetrySidecarEntry, claimPendingSpoolFiles, releaseClaimedSpoolFile, discardClaimedSpoolFile, sweepTelemetrySpool, getTelemetryIngestionOrigin, telemetry, telemetryInit, telemetryFlushAndShutdown, telemetryShutdownWithoutFlush, EXIT_CODES, Pagination, pascalCaseDataKeys, validateOutputFilter, OutputFormatter, configureProjectContextTelemetry, buildSkillEventTelemetryAttribution, sanitizeTelemetryToken, CLI_COMMAND_ROOT, commandTelemetryName, commandInvocationPath, runWithInvocationRequest, emitInvocationRequest, processContext, setProcessContextPollSignal, TELEMETRY_ARG_VALUE_WITHHELD, extractCommandHelp, collectCommands, getCompleter, requireConfirmation, installConsoleGuard, UIPATH_HOME_DIR, CONFIG_FILENAME, DEFAULT_FETCH_TIMEOUT_MS, resolveEnvReference, setInteractivityMode, setInteractiveFlag, wasInteractiveFlagPassed, canPrompt, parseBoundedInt, splitScopeList, REGISTER_EXPORT, createPollAbortController, isOutputRelayed, setSdkUserAgentHostToken, quoteForShell, readStdinWithTimeout, setPackagerFactoryProvider };
8007
8318
 
8008
- //# debugId=5DD85C46186AA70964756E2164756E21
8319
+ //# debugId=71436646789FDEDC64756E2164756E21