@uipath/conversational-tool 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.
@@ -7,7 +7,7 @@ import {
7
7
  addSdkUserAgentHeader,
8
8
  getAuthContext,
9
9
  CLI_EXTERNAL_USER_ID
10
- } from "./tool-tz397c9p.js";
10
+ } from "./tool-g06mqzed.js";
11
11
 
12
12
  // src/api/cas-client.ts
13
13
  var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  Command
4
- } from "./tool-tz397c9p.js";
4
+ } from "./tool-g06mqzed.js";
5
5
  import"./tool-9v6hwcm1.js";
6
6
  import {
7
7
  metadata2,
8
8
  registerCommands2
9
- } from "./tool-2f7jq6vs.js";
9
+ } from "./tool-xe0k34m6.js";
10
10
 
11
11
  // src/index.ts
12
12
  var program = new Command;
@@ -2082,7 +2082,7 @@ var package_default = {
2082
2082
  name: "@uipath/conversational-tool",
2083
2083
  author: "UiPath",
2084
2084
  license: "SEE LICENSE IN LICENSE.txt",
2085
- version: "1.206.0-preview.306",
2085
+ version: "1.207.0-preview.307",
2086
2086
  description: "Handle conversations with deployed UiPath conversational processes.",
2087
2087
  publishConfig: {
2088
2088
  registry: "https://npm.pkg.github.com/"
@@ -2160,13 +2160,15 @@ var ProjectDimensions = {
2160
2160
  SolutionKey: "SolutionKey",
2161
2161
  SolutionProjectKey: "SolutionProjectKey",
2162
2162
  SolutionIdentityStatus: "SolutionIdentityStatus",
2163
- PreviousSolutionKey: "PreviousSolutionKey"
2163
+ PreviousSolutionKey: "PreviousSolutionKey",
2164
+ PreviousProjectKey: "PreviousProjectKey"
2164
2165
  };
2165
2166
  var GUID_KEY_DIMENSIONS = new Set([
2166
2167
  ProjectDimensions.ProjectKey,
2167
2168
  ProjectDimensions.SolutionKey,
2168
2169
  ProjectDimensions.SolutionProjectKey,
2169
- ProjectDimensions.PreviousSolutionKey
2170
+ ProjectDimensions.PreviousSolutionKey,
2171
+ ProjectDimensions.PreviousProjectKey
2170
2172
  ]);
2171
2173
  var ShipDimensions = {
2172
2174
  ShipKind: "ShipKind",
@@ -2320,9 +2322,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
2320
2322
  }
2321
2323
  }
2322
2324
 
2323
- // ../common/src/telemetry/pseudonymize.ts
2324
- var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2325
- var PSEUDONYM_HEX_LENGTH = 32;
2325
+ // ../common/src/sha256.ts
2326
2326
  var SHA256_K = new Uint32Array([
2327
2327
  1116352408,
2328
2328
  1899447441,
@@ -2402,7 +2402,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
2402
2402
  function rotr(value, bits) {
2403
2403
  return (value >>> bits | value << 32 - bits) >>> 0;
2404
2404
  }
2405
- function sha256Hex(input) {
2405
+ function sha256Words(input) {
2406
2406
  const bytes = new TextEncoder().encode(input);
2407
2407
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2408
2408
  const buffer = new Uint8Array(paddedLength);
@@ -2458,12 +2458,19 @@ function sha256Hex(input) {
2458
2458
  state[6] = state[6] + g >>> 0;
2459
2459
  state[7] = state[7] + h >>> 0;
2460
2460
  }
2461
+ return state;
2462
+ }
2463
+ function sha256Hex(input) {
2461
2464
  let hex = "";
2462
- for (const word of state) {
2465
+ for (const word of sha256Words(input)) {
2463
2466
  hex += word.toString(16).padStart(8, "0");
2464
2467
  }
2465
2468
  return hex;
2466
2469
  }
2470
+
2471
+ // ../common/src/telemetry/pseudonymize.ts
2472
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2473
+ var PSEUDONYM_HEX_LENGTH = 32;
2467
2474
  function resolveSha256Hex() {
2468
2475
  try {
2469
2476
  const nodeCrypto = __require("node:crypto");
@@ -2859,13 +2866,25 @@ function settlePromiseLike(thenable) {
2859
2866
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2860
2867
  }
2861
2868
 
2869
+ // ../common/src/result-types.ts
2870
+ var RESULTS = {
2871
+ Success: "Success",
2872
+ Failure: "Failure",
2873
+ ConfigError: "ConfigError",
2874
+ AuthenticationError: "AuthenticationError",
2875
+ ValidationError: "ValidationError",
2876
+ TimeoutError: "TimeoutError"
2877
+ };
2878
+
2862
2879
  // ../common/src/error-codes.ts
2863
2880
  var CLI_ERROR_CODES = [
2864
2881
  "invalid_argument",
2882
+ "confirmation_required",
2865
2883
  "authentication_required",
2866
2884
  "permission_denied",
2867
2885
  "local_permission_denied",
2868
2886
  "not_found",
2887
+ "not_enabled",
2869
2888
  "rate_limited",
2870
2889
  "network_error",
2871
2890
  "timeout",
@@ -2904,6 +2923,12 @@ function carriedRetry(error) {
2904
2923
  const retry = error.retry;
2905
2924
  return isRetryHint(retry) ? retry : undefined;
2906
2925
  }
2926
+ function carriedResult(error) {
2927
+ if (!error || typeof error !== "object")
2928
+ return;
2929
+ const result = error.result;
2930
+ return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
2931
+ }
2907
2932
  function defaultRetryForErrorCode(errorCode) {
2908
2933
  switch (errorCode) {
2909
2934
  case "network_error":
@@ -3293,6 +3318,8 @@ async function extractErrorDetails(error, options) {
3293
3318
  }
3294
3319
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
3295
3320
  context.errorCode = parsedBody.errorCode;
3321
+ } else if (typeof parsedBody?.errorCode === "number") {
3322
+ context.errorCode = String(parsedBody.errorCode);
3296
3323
  } else if (parsedBody?.code && typeof parsedBody.code === "string") {
3297
3324
  context.errorCode = parsedBody.code;
3298
3325
  }
@@ -3550,12 +3577,26 @@ class NodeFileSystem {
3550
3577
  throw error;
3551
3578
  }
3552
3579
  }
3553
- async writeFile(filePath, data) {
3580
+ async writeFile(filePath, data, options) {
3554
3581
  const dir = path.dirname(filePath);
3555
3582
  if (dir) {
3556
3583
  await fs.mkdir(dir, { recursive: true });
3557
3584
  }
3558
- await fs.writeFile(filePath, data);
3585
+ if (options?.mode === undefined || process.platform === "win32") {
3586
+ if (options?.exclusive) {
3587
+ await fs.writeFile(filePath, data, { flag: "wx" });
3588
+ } else {
3589
+ await fs.writeFile(filePath, data);
3590
+ }
3591
+ return;
3592
+ }
3593
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
3594
+ try {
3595
+ await handle.chmod(options.mode);
3596
+ await handle.writeFile(data);
3597
+ } finally {
3598
+ await handle.close();
3599
+ }
3559
3600
  }
3560
3601
  async appendFile(filePath, data) {
3561
3602
  const dir = path.dirname(filePath);
@@ -3590,7 +3631,8 @@ class NodeFileSystem {
3590
3631
  isDirectory: () => stats.isDirectory(),
3591
3632
  size: stats.size,
3592
3633
  mtimeMs: stats.mtimeMs,
3593
- ctimeMs: stats.ctimeMs
3634
+ ctimeMs: stats.ctimeMs,
3635
+ mode: stats.mode
3594
3636
  };
3595
3637
  } catch (error) {
3596
3638
  if (this.isEnoent(error))
@@ -3601,8 +3643,13 @@ class NodeFileSystem {
3601
3643
  async exists(filePath) {
3602
3644
  return existsSync(filePath);
3603
3645
  }
3604
- async mkdir(dirPath) {
3605
- await fs.mkdir(dirPath, { recursive: true });
3646
+ async mkdir(dirPath, options) {
3647
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
3648
+ }
3649
+ async chmod(targetPath, mode) {
3650
+ if (process.platform === "win32")
3651
+ return;
3652
+ await fs.chmod(targetPath, mode);
3606
3653
  }
3607
3654
  async acquireLock(lockPath) {
3608
3655
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -3752,7 +3799,7 @@ class NodeFileSystem {
3752
3799
  async getTempDir() {
3753
3800
  return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
3754
3801
  }
3755
- async copyDirectory(sourcePath, destPath) {
3802
+ async copyDirectory(sourcePath, destPath, options) {
3756
3803
  const sourceStats = await this.stat(sourcePath);
3757
3804
  if (!sourceStats) {
3758
3805
  throw new Error(`Source directory does not exist: ${sourcePath}`);
@@ -3769,7 +3816,9 @@ class NodeFileSystem {
3769
3816
  if (!entryStats)
3770
3817
  continue;
3771
3818
  if (entryStats.isDirectory()) {
3772
- await this.copyDirectory(srcEntry, destEntry);
3819
+ if (options?.skipDirectoryNames?.includes(entry))
3820
+ continue;
3821
+ await this.copyDirectory(srcEntry, destEntry, options);
3773
3822
  } else if (entryStats.isFile()) {
3774
3823
  const content = await this.readFile(srcEntry);
3775
3824
  if (content !== null) {
@@ -4136,16 +4185,6 @@ function getOutputFilter() {
4136
4185
  return filterSlot.get();
4137
4186
  }
4138
4187
 
4139
- // ../common/src/result-types.ts
4140
- var RESULTS = {
4141
- Success: "Success",
4142
- Failure: "Failure",
4143
- ConfigError: "ConfigError",
4144
- AuthenticationError: "AuthenticationError",
4145
- ValidationError: "ValidationError",
4146
- TimeoutError: "TimeoutError"
4147
- };
4148
-
4149
4188
  // ../common/src/telemetry/command-terminal.ts
4150
4189
  var recordedFailureSlot = singleton("CommandTelemetryFailure");
4151
4190
  var AUTH_ERROR_CODES = new Set([
@@ -4155,7 +4194,10 @@ var AUTH_ERROR_CODES = new Set([
4155
4194
  var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
4156
4195
  "local_permission_denied"
4157
4196
  ]);
4158
- var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
4197
+ var VALIDATION_ERROR_CODES = new Set([
4198
+ "invalid_argument",
4199
+ "confirmation_required"
4200
+ ]);
4159
4201
  var NETWORK_HTTP_ERROR_CODES = new Set([
4160
4202
  "network_error",
4161
4203
  "rate_limited",
@@ -4381,6 +4423,109 @@ var CommonTelemetryEvents = {
4381
4423
  ShipSucceeded: "Cli.ShipSucceeded"
4382
4424
  };
4383
4425
 
4426
+ // ../common/src/telemetry/global-telemetry-properties.ts
4427
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4428
+ function getGlobalTelemetryProperties() {
4429
+ return telemetryPropsSlot.get();
4430
+ }
4431
+
4432
+ // ../common/src/telemetry/trace-context.ts
4433
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
4434
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
4435
+ function getProcessEnv() {
4436
+ return globalThis.process?.env;
4437
+ }
4438
+ function parseInboundTraceparent(value) {
4439
+ if (!value) {
4440
+ return;
4441
+ }
4442
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
4443
+ if (!match) {
4444
+ return;
4445
+ }
4446
+ const [, traceId, parentSpanId] = match;
4447
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
4448
+ return;
4449
+ }
4450
+ return { traceId, parentSpanId };
4451
+ }
4452
+ function getInboundTraceContext() {
4453
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
4454
+ }
4455
+
4456
+ // ../common/src/telemetry/session-id.ts
4457
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
4458
+ var SESSION_ID_MAX_LENGTH = 64;
4459
+ var RANDOM_SESSION_ID_LENGTH = 32;
4460
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
4461
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
4462
+ var INHERITED_SESSION_SOURCES = [
4463
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
4464
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
4465
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
4466
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
4467
+ { envVar: "WT_SESSION", source: "terminal" }
4468
+ ];
4469
+ var telemetrySessionSlot = singleton("TelemetrySession");
4470
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
4471
+ function getProcessEnv2() {
4472
+ return globalThis.process?.env;
4473
+ }
4474
+ function normalizeSessionId(value) {
4475
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
4476
+ return;
4477
+ }
4478
+ const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
4479
+ return cleaned || undefined;
4480
+ }
4481
+ function getConfiguredTelemetrySessionId() {
4482
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
4483
+ }
4484
+ function getInheritedSession(env) {
4485
+ for (const candidate of INHERITED_SESSION_SOURCES) {
4486
+ const handle = normalizeSessionId(env[candidate.envVar]);
4487
+ if (handle) {
4488
+ return { id: handle, source: candidate.source };
4489
+ }
4490
+ }
4491
+ return;
4492
+ }
4493
+ function generateRandomSession() {
4494
+ const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
4495
+ crypto.getRandomValues(bytes);
4496
+ let hex = "";
4497
+ for (const byte of bytes) {
4498
+ hex += byte.toString(16).padStart(2, "0");
4499
+ }
4500
+ return { id: hex, source: "random" };
4501
+ }
4502
+ function resolveTelemetrySession() {
4503
+ const existing = telemetrySessionSlot.get();
4504
+ if (existing) {
4505
+ return existing;
4506
+ }
4507
+ const declaredHandle = getConfiguredTelemetrySessionId();
4508
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
4509
+ telemetrySessionSlot.set(resolved);
4510
+ return resolved;
4511
+ }
4512
+ function getTelemetrySessionId() {
4513
+ return resolveTelemetrySession().id;
4514
+ }
4515
+ function getTelemetrySessionSource() {
4516
+ return resolveTelemetrySession().source;
4517
+ }
4518
+ function getTelemetryOperationId() {
4519
+ const existing = telemetryOperationIdSlot.get();
4520
+ if (existing) {
4521
+ return existing;
4522
+ }
4523
+ const inboundTraceId = getInboundTraceContext()?.traceId;
4524
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4525
+ telemetryOperationIdSlot.set(generated);
4526
+ return generated;
4527
+ }
4528
+
4384
4529
  // ../common/src/registry.ts
4385
4530
  import { execFileSync } from "node:child_process";
4386
4531
  function readRegistryValue(keyPath, valueName) {
@@ -4602,108 +4747,6 @@ class NodeContextStorage {
4602
4747
  return this.storage.getStore();
4603
4748
  }
4604
4749
  }
4605
- // ../common/src/telemetry/trace-context.ts
4606
- var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
4607
- var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
4608
- function getProcessEnv() {
4609
- return globalThis.process?.env;
4610
- }
4611
- function parseInboundTraceparent(value) {
4612
- if (!value) {
4613
- return;
4614
- }
4615
- const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
4616
- if (!match) {
4617
- return;
4618
- }
4619
- const [, traceId, parentSpanId] = match;
4620
- if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
4621
- return;
4622
- }
4623
- return { traceId, parentSpanId };
4624
- }
4625
- function getInboundTraceContext() {
4626
- return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
4627
- }
4628
-
4629
- // ../common/src/telemetry/session-id.ts
4630
- var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
4631
- var SESSION_ID_MAX_LENGTH = 64;
4632
- var RANDOM_SESSION_ID_LENGTH = 32;
4633
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
4634
- var CONTROL_CHARACTERS = /\p{Cc}/gu;
4635
- var INHERITED_SESSION_SOURCES = [
4636
- { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
4637
- { envVar: "CODEX_THREAD_ID", source: "codex" },
4638
- { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
4639
- { envVar: "TERM_SESSION_ID", source: "terminal" },
4640
- { envVar: "WT_SESSION", source: "terminal" }
4641
- ];
4642
- var telemetrySessionSlot = singleton("TelemetrySession");
4643
- var telemetryOperationIdSlot = singleton("TelemetryOperationId");
4644
- function getProcessEnv2() {
4645
- return globalThis.process?.env;
4646
- }
4647
- function normalizeSessionId(value) {
4648
- if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
4649
- return;
4650
- }
4651
- const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
4652
- return cleaned || undefined;
4653
- }
4654
- function getConfiguredTelemetrySessionId() {
4655
- return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
4656
- }
4657
- function getInheritedSession(env) {
4658
- for (const candidate of INHERITED_SESSION_SOURCES) {
4659
- const handle = normalizeSessionId(env[candidate.envVar]);
4660
- if (handle) {
4661
- return { id: handle, source: candidate.source };
4662
- }
4663
- }
4664
- return;
4665
- }
4666
- function generateRandomSession() {
4667
- const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
4668
- crypto.getRandomValues(bytes);
4669
- let hex = "";
4670
- for (const byte of bytes) {
4671
- hex += byte.toString(16).padStart(2, "0");
4672
- }
4673
- return { id: hex, source: "random" };
4674
- }
4675
- function resolveTelemetrySession() {
4676
- const existing = telemetrySessionSlot.get();
4677
- if (existing) {
4678
- return existing;
4679
- }
4680
- const declaredHandle = getConfiguredTelemetrySessionId();
4681
- const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
4682
- telemetrySessionSlot.set(resolved);
4683
- return resolved;
4684
- }
4685
- function getTelemetrySessionId() {
4686
- return resolveTelemetrySession().id;
4687
- }
4688
- function getTelemetrySessionSource() {
4689
- return resolveTelemetrySession().source;
4690
- }
4691
- function getTelemetryOperationId() {
4692
- const existing = telemetryOperationIdSlot.get();
4693
- if (existing) {
4694
- return existing;
4695
- }
4696
- const inboundTraceId = getInboundTraceContext()?.traceId;
4697
- const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4698
- telemetryOperationIdSlot.set(generated);
4699
- return generated;
4700
- }
4701
- // ../common/src/telemetry/global-telemetry-properties.ts
4702
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4703
- function getGlobalTelemetryProperties() {
4704
- return telemetryPropsSlot.get();
4705
- }
4706
-
4707
4750
  // ../common/src/telemetry/span-clock.ts
4708
4751
  function startSpanClock() {
4709
4752
  const started = performance.now();
@@ -4917,6 +4960,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
4917
4960
  // ../common/src/telemetry/telemetry-init.ts
4918
4961
  var telemetryInstanceSlot = singleton("TelemetryService");
4919
4962
  var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
4963
+ var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
4920
4964
  function getGlobalTelemetryInstance() {
4921
4965
  const existing = telemetryInstanceSlot.get();
4922
4966
  if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
@@ -5100,7 +5144,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5100
5144
  const pagedRows = extractPagedRows(data.Data);
5101
5145
  const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
5102
5146
  items.forEach((item) => {
5103
- const values = Object.values(item).map((v) => v ?? "").join("\t");
5147
+ const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
5104
5148
  logFn(values);
5105
5149
  });
5106
5150
  } else {
@@ -5115,7 +5159,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
5115
5159
  default: {
5116
5160
  const hasData = "Data" in data && data.Data != null;
5117
5161
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
5118
- const rows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5162
+ const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
5163
+ const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
5119
5164
  if (hasData && !(rows !== null && rows.length === 0)) {
5120
5165
  const logValue = data.Log;
5121
5166
  if (rows !== null) {
@@ -5172,6 +5217,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
5172
5217
  function isPlainObjectArray(value) {
5173
5218
  return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
5174
5219
  }
5220
+ function isPrimitiveArray(value) {
5221
+ return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
5222
+ }
5175
5223
  function isNonEmptyPlainObject(value) {
5176
5224
  return isPlainRecord(value) && Object.keys(value).length > 0;
5177
5225
  }
@@ -5518,12 +5566,12 @@ class FilterEvaluationError extends Error {
5518
5566
  instructions;
5519
5567
  retry = "RetryWillNotFix";
5520
5568
  result = RESULTS.ValidationError;
5521
- constructor(filter, cause) {
5569
+ constructor(filter, cause, hint) {
5522
5570
  const underlying = cause instanceof Error ? cause.message : String(cause);
5523
- super(`Filter '${filter}' failed to evaluate: ${underlying}`);
5571
+ super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
5524
5572
  this.name = "FilterEvaluationError";
5525
5573
  this.filter = filter;
5526
- 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(@)'.";
5574
+ 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(@)'.";
5527
5575
  }
5528
5576
  }
5529
5577
 
@@ -5645,6 +5693,93 @@ function nameList(names, cap = 12) {
5645
5693
  const rest = names.length - shown.length;
5646
5694
  return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5647
5695
  }
5696
+ function notFieldsOn(names, scope) {
5697
+ return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5698
+ }
5699
+ function failingFieldRead(ast, isList, fn, argIndex) {
5700
+ const [left, right, condition] = ast.children ?? [];
5701
+ let scopes = [];
5702
+ if (!isList) {
5703
+ scopes = [ast];
5704
+ } else if (ast.type === "FilterProjection" && left?.type === "Identity") {
5705
+ scopes = [condition, right];
5706
+ } else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
5707
+ scopes = [right];
5708
+ }
5709
+ const reads = new Set;
5710
+ let tracked = 0;
5711
+ const visit = (node) => {
5712
+ if (!node)
5713
+ return;
5714
+ switch (node.type) {
5715
+ case "Function": {
5716
+ const arg = node.children?.[argIndex - 1];
5717
+ if (node.name === fn && arg?.type === "Field" && arg.name) {
5718
+ reads.add(arg.name);
5719
+ tracked++;
5720
+ }
5721
+ node.children?.forEach(visit);
5722
+ return;
5723
+ }
5724
+ case "AndExpression":
5725
+ case "OrExpression":
5726
+ case "NotExpression":
5727
+ case "Comparator":
5728
+ case "MultiSelectList":
5729
+ case "MultiSelectHash":
5730
+ node.children?.forEach(visit);
5731
+ return;
5732
+ case "KeyValuePair":
5733
+ visit(node.value);
5734
+ return;
5735
+ }
5736
+ };
5737
+ scopes.forEach(visit);
5738
+ const calls = (node) => {
5739
+ if (node === null || typeof node !== "object")
5740
+ return 0;
5741
+ const own = node.type === "Function" && node.name === fn ? 1 : 0;
5742
+ const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
5743
+ return own + next.reduce((sum, child) => sum + calls(child), 0);
5744
+ };
5745
+ return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
5746
+ }
5747
+ function fieldExpression(name) {
5748
+ return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
5749
+ }
5750
+ function evaluationHint(codec, filter, data, cause) {
5751
+ const underlying = cause instanceof Error ? cause.message : String(cause);
5752
+ const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
5753
+ if (!failure)
5754
+ return;
5755
+ const [, fn, position, expected] = failure;
5756
+ const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
5757
+ if (name === undefined)
5758
+ return;
5759
+ const present = availableFields(data);
5760
+ if (present.length === 0)
5761
+ return;
5762
+ const scope = `${countRecords(data)} record(s)`;
5763
+ if (!present.includes(name)) {
5764
+ return {
5765
+ detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
5766
+ instructions: "Use a field the records have; names are case-sensitive."
5767
+ };
5768
+ }
5769
+ const records = Array.isArray(data) ? data : [data];
5770
+ const unset = records.filter((r) => r?.[name] == null).length;
5771
+ const field = fieldExpression(name);
5772
+ let fallback;
5773
+ if (expected.split(",").includes("string")) {
5774
+ fallback = "''";
5775
+ } else if (expected.split(",").includes("array")) {
5776
+ fallback = "`[]`";
5777
+ }
5778
+ return {
5779
+ detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
5780
+ 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.`
5781
+ };
5782
+ }
5648
5783
  function buildFilterWarning(filter, data, outcome) {
5649
5784
  const present = availableFields(data);
5650
5785
  const refs = referencedFields(filter);
@@ -5652,7 +5787,7 @@ function buildFilterWarning(filter, data, outcome) {
5652
5787
  const unchecked = refs.nested.filter((name) => !present.includes(name));
5653
5788
  const count = countRecords(data);
5654
5789
  const scope = `${count} record(s)`;
5655
- const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5790
+ const isNotAField = (names) => notFieldsOn(names, scope);
5656
5791
  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" : "";
5657
5792
  const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5658
5793
  let detail;
@@ -5703,7 +5838,8 @@ function applyFilter(data, filter, onWarning) {
5703
5838
  try {
5704
5839
  result = codec.search(data, filter);
5705
5840
  } catch (err) {
5706
- throw new FilterEvaluationError(filter, err);
5841
+ const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
5842
+ throw new FilterEvaluationError(filter, err, hint);
5707
5843
  }
5708
5844
  const inputCount = countRecords(data);
5709
5845
  const warn = (outcome) => {
@@ -6646,7 +6782,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6646
6782
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
6647
6783
  const typed = error;
6648
6784
  const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
6649
- const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
6785
+ const customResult = carriedResult(error);
6650
6786
  const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
6651
6787
  const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
6652
6788
  const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
@@ -6720,14 +6856,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6720
6856
  // ../common/src/completer.ts
6721
6857
  var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
6722
6858
  // ../common/src/confirmation.ts
6723
- function requireConfirmation(flags, operation) {
6859
+ function requireConfirmation(flags, operation, options) {
6724
6860
  if (flags.yes === true || flags.force === true) {
6725
6861
  return true;
6726
6862
  }
6863
+ const message = options?.reversible ? `Confirmation required: this will ${operation}.` : `Confirmation required: this will ${operation} and cannot be undone.`;
6727
6864
  OutputFormatter.error({
6728
6865
  Result: RESULTS.Failure,
6729
- Message: `Confirmation required: this will ${operation} and cannot be undone.`,
6730
- Instructions: "Re-run with --yes to confirm."
6866
+ Message: message,
6867
+ Instructions: options?.instructions ?? "Re-run with --yes to confirm.",
6868
+ ErrorCode: "confirmation_required",
6869
+ Retry: "RetryWillNotFix"
6731
6870
  });
6732
6871
  processContext.exit(1);
6733
6872
  return false;
@@ -7050,6 +7189,8 @@ var FAILURE_STATUSES = new Set([
7050
7189
  "canceled",
7051
7190
  "stopped"
7052
7191
  ]);
7192
+ // ../common/src/relayed-output.ts
7193
+ var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
7053
7194
  // ../common/src/screen-logger.ts
7054
7195
  var ScreenLogger;
7055
7196
  ((ScreenLogger) => {
@@ -7094,6 +7235,8 @@ function settlePromiseLike2(thenable) {
7094
7235
  // ../auth/src/constants.ts
7095
7236
  var UIPATH_HOME_DIR = ".uipath";
7096
7237
  var AUTH_FILENAME = ".auth";
7238
+ var AUTH_FILE_MODE = 384;
7239
+ var AUTH_DIR_MODE = 448;
7097
7240
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
7098
7241
  var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
7099
7242
 
@@ -7917,6 +8060,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
7917
8060
  }
7918
8061
  return parseEnvContent(content);
7919
8062
  };
8063
+ var findAuthHomeDir = (fs, dir) => {
8064
+ let current = dir;
8065
+ for (;; ) {
8066
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
8067
+ return current;
8068
+ const parent = fs.path.dirname(current);
8069
+ if (parent === current)
8070
+ return;
8071
+ current = parent;
8072
+ }
8073
+ };
8074
+ var TEMP_FILE_ATTEMPTS = 5;
8075
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
8076
+ var writeTempFile = async (fs, targetPath, content) => {
8077
+ for (let attempt = 1;; attempt++) {
8078
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
8079
+ try {
8080
+ await fs.writeFile(tempPath, content, {
8081
+ mode: AUTH_FILE_MODE,
8082
+ exclusive: true
8083
+ });
8084
+ return tempPath;
8085
+ } catch (error) {
8086
+ if (!isFileExists(error)) {
8087
+ await fs.rm(tempPath).catch(() => {});
8088
+ throw error;
8089
+ }
8090
+ if (attempt === TEMP_FILE_ATTEMPTS)
8091
+ throw error;
8092
+ }
8093
+ }
8094
+ };
7920
8095
  var saveEnvFileAsync = async ({
7921
8096
  envPath,
7922
8097
  data,
@@ -7944,10 +8119,18 @@ var saveEnvFileAsync = async ({
7944
8119
  `)}
7945
8120
  `;
7946
8121
  const dir = fs.path.dirname(absolutePath);
7947
- await fs.mkdir(dir);
7948
- const tempPath = `${absolutePath}.tmp`;
7949
- await fs.writeFile(tempPath, content);
7950
- await fs.rename(tempPath, absolutePath);
8122
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
8123
+ const authHomeDir = findAuthHomeDir(fs, dir);
8124
+ if (authHomeDir !== undefined) {
8125
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
8126
+ }
8127
+ const tempPath = await writeTempFile(fs, absolutePath, content);
8128
+ try {
8129
+ await fs.rename(tempPath, absolutePath);
8130
+ } catch (error) {
8131
+ await fs.rm(tempPath).catch(() => {});
8132
+ throw error;
8133
+ }
7951
8134
  };
7952
8135
 
7953
8136
  // ../auth/src/loginStatus.ts
@@ -8545,6 +8728,6 @@ var TENANT_SELECTION_CODES = new Set([
8545
8728
  // src/api/external-user-id.ts
8546
8729
  var CLI_EXTERNAL_USER_ID = "app-user-cli-cas";
8547
8730
 
8548
- export { package_default, getFileSystem, catchError, carriedErrorCode, extractErrorDetails, extractErrorMessageSync, hasIdentityInstructionContext, instructionsFor, RESULTS, InvalidArgumentError, Command, EXIT_CODES, OutputFormatter, processContext, requireConfirmation, canPrompt, parseBoundedInt, getSdkUserAgentToken, addSdkUserAgentHeader, getAuthContext, CLI_EXTERNAL_USER_ID };
8731
+ export { package_default, getFileSystem, catchError, RESULTS, carriedErrorCode, extractErrorDetails, extractErrorMessageSync, hasIdentityInstructionContext, instructionsFor, InvalidArgumentError, Command, EXIT_CODES, OutputFormatter, processContext, requireConfirmation, canPrompt, parseBoundedInt, getSdkUserAgentToken, addSdkUserAgentHeader, getAuthContext, CLI_EXTERNAL_USER_ID };
8549
8732
 
8550
- //# debugId=2F1C9FF5AD65585564756E2164756E21
8733
+ //# debugId=38B6442AF6890C9C64756E2164756E21
@@ -2,10 +2,10 @@ import {
2
2
  package_default,
3
3
  getFileSystem,
4
4
  catchError,
5
+ RESULTS,
5
6
  extractErrorDetails,
6
7
  extractErrorMessageSync,
7
8
  instructionsFor,
8
- RESULTS,
9
9
  InvalidArgumentError,
10
10
  EXIT_CODES,
11
11
  OutputFormatter,
@@ -15,7 +15,7 @@ import {
15
15
  parseBoundedInt,
16
16
  getAuthContext,
17
17
  CLI_EXTERNAL_USER_ID
18
- } from "./tool-tz397c9p.js";
18
+ } from "./tool-g06mqzed.js";
19
19
  import {
20
20
  getOrCreateClient,
21
21
  createTrack,
@@ -13634,7 +13634,7 @@ var resolveEntryPoint = (entryPoints, requested) => {
13634
13634
  var resolveBinding = async (target) => {
13635
13635
  const processKey = target.processKey.toLowerCase();
13636
13636
  const folderKey = target.folderKey.toLowerCase();
13637
- const { listVoiceEntryPoints } = await import("./cas-client-8g12m06y.js");
13637
+ const { listVoiceEntryPoints } = await import("./cas-client-5vm2fjf1.js");
13638
13638
  const [epError, entryPoints] = await catchError(listVoiceEntryPoints(processKey, folderKey));
13639
13639
  if (epError) {
13640
13640
  await failFromError(epError);
@@ -13650,7 +13650,7 @@ var resolveBinding = async (target) => {
13650
13650
  var registerTrunksCommand = (program) => {
13651
13651
  const trunks = program.command("trunks").description("Inspect the SIP trunks (phone numbers) configured for conversational voice.");
13652
13652
  trunks.command("list").description("List the tenant's SIP trunks. Voice flows dial out from an outbound-enabled trunk's phone number (`inputs.from` on Create outgoing call); inbound-enabled trunks route incoming calls to a published process. Trunks are connected in Instance Management under Phone numbers.").option("--direction <direction>", "Only trunks enabled for this call direction: inbound or outbound (default: all trunks)", parseDirection).examples(TRUNKS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
13653
- const { listSipTrunks } = await import("./cas-client-8g12m06y.js");
13653
+ const { listSipTrunks } = await import("./cas-client-5vm2fjf1.js");
13654
13654
  const [listError, trunks] = await catchError(listSipTrunks(options.direction));
13655
13655
  if (listError) {
13656
13656
  await failFromError(listError);
@@ -13666,7 +13666,7 @@ var registerTrunksCommand = (program) => {
13666
13666
  const plan = planAssign(options);
13667
13667
  if (plan === null)
13668
13668
  return;
13669
- const { resolveSipTrunk, updateSipTrunkBinding } = await import("./cas-client-8g12m06y.js");
13669
+ const { resolveSipTrunk, updateSipTrunkBinding } = await import("./cas-client-5vm2fjf1.js");
13670
13670
  const [trunkError, trunk] = await catchError(resolveSipTrunk(trunkArg));
13671
13671
  if (trunkError) {
13672
13672
  await failFromError(trunkError);
@@ -13838,4 +13838,4 @@ var registerCommands2 = async (program) => {
13838
13838
 
13839
13839
  export { metadata2, registerCommands2 };
13840
13840
 
13841
- //# debugId=DBD1E0019B7D671164756E2164756E21
13841
+ //# debugId=CFB2760DD316B64364756E2164756E21
package/dist/tool.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-2f7jq6vs.js";
4
+ } from "./tool-xe0k34m6.js";
5
5
  import"./tool-9v6hwcm1.js";
6
- import"./tool-tz397c9p.js";
6
+ import"./tool-g06mqzed.js";
7
7
  export {
8
8
  metadata2 as metadata,
9
9
  registerCommands2 as registerCommands
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/conversational-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.206.0-preview.306",
5
+ "version": "1.207.0-preview.307",
6
6
  "description": "Handle conversations with deployed UiPath conversational processes.",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/"
@@ -18,5 +18,5 @@
18
18
  "files": [
19
19
  "dist"
20
20
  ],
21
- "gitHead": "0b8843ae9b6d2f69a0203f96ab91e5d55e416383"
21
+ "gitHead": "a625ed8ac421089170db3cb8b95c497f3c7b0d62"
22
22
  }