@uipath/docsai-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.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-gdbvck3g.js";
6
+ } from "./tool-fp9emw8t.js";
7
7
  import"./tool-1yh8g550.js";
8
8
 
9
9
  // src/index.ts
@@ -8989,7 +8989,7 @@ var package_default = {
8989
8989
  name: "@uipath/docsai-tool",
8990
8990
  author: "UiPath",
8991
8991
  license: "SEE LICENSE IN LICENSE.txt",
8992
- version: "1.203.0-preview.205",
8992
+ version: "1.204.0-preview.206",
8993
8993
  description: "Search UiPath documentation with AI-powered answers.",
8994
8994
  private: false,
8995
8995
  repository: {
@@ -9799,8 +9799,59 @@ function settlePromiseLike(thenable) {
9799
9799
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
9800
9800
  }
9801
9801
 
9802
+ // ../common/src/error-graph.ts
9803
+ function* walkErrorGraph(error) {
9804
+ const queue = [error];
9805
+ const seen = new Set;
9806
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
9807
+ const current = queue.shift();
9808
+ if (current === null || typeof current !== "object")
9809
+ continue;
9810
+ if (seen.has(current))
9811
+ continue;
9812
+ seen.add(current);
9813
+ const cur = current;
9814
+ yield cur;
9815
+ if (cur.cause !== undefined)
9816
+ queue.push(cur.cause);
9817
+ if (Array.isArray(cur.errors))
9818
+ queue.push(...cur.errors);
9819
+ }
9820
+ return;
9821
+ }
9822
+ function parseHttpStatusFromMessage(message) {
9823
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
9824
+ if (!match)
9825
+ return;
9826
+ const status = Number(match[1]);
9827
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
9828
+ }
9829
+ function findHttpStatusInGraph(error) {
9830
+ for (const node of walkErrorGraph(error)) {
9831
+ const response = node.response;
9832
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
9833
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
9834
+ return explicit;
9835
+ }
9836
+ if (typeof node.message === "string") {
9837
+ const parsed = parseHttpStatusFromMessage(node.message);
9838
+ if (parsed !== undefined && parsed >= 400) {
9839
+ return parsed;
9840
+ }
9841
+ }
9842
+ }
9843
+ return;
9844
+ }
9845
+
9846
+ // ../common/src/local-permission-codes.ts
9847
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
9848
+ "EACCES",
9849
+ "EPERM",
9850
+ "EROFS"
9851
+ ]);
9852
+
9802
9853
  // ../common/src/error-handler.ts
9803
- var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
9854
+ 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.";
9804
9855
  var NETWORK_ERROR_CODES = new Set([
9805
9856
  "ECONNREFUSED",
9806
9857
  "ECONNRESET",
@@ -9824,7 +9875,7 @@ var TLS_ERROR_CODES = new Set([
9824
9875
  ]);
9825
9876
  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.";
9826
9877
  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.";
9827
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
9878
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
9828
9879
  function extractErrorMessageSync(error) {
9829
9880
  if (error instanceof Error) {
9830
9881
  return error.message;
@@ -10097,12 +10148,162 @@ function getOutputFilter() {
10097
10148
  return filterSlot.get();
10098
10149
  }
10099
10150
 
10151
+ // ../common/src/telemetry/telemetry-dimensions.ts
10152
+ var BaseDimensions = {
10153
+ ApplicationName: "ApplicationName",
10154
+ ProductVersion: "ProductVersion",
10155
+ InstallationId: "InstallationId",
10156
+ CloudUserId: "CloudUserId",
10157
+ CloudTenantId: "CloudTenantId",
10158
+ CloudOrganizationId: "CloudOrganizationId",
10159
+ IsInternalUser: "IsInternalUser",
10160
+ Environment: "Environment",
10161
+ BaseUrl: "BaseUrl",
10162
+ Region: "Region",
10163
+ Agent: "Agent",
10164
+ AgentVersion: "AgentVersion",
10165
+ AgentModel: "AgentModel",
10166
+ ToolName: "ToolName",
10167
+ ToolVersion: "ToolVersion",
10168
+ ExecutionContext: "ExecutionContext",
10169
+ CiProvider: "CiProvider",
10170
+ SessionIdSource: "SessionIdSource",
10171
+ SessionId: "SessionId"
10172
+ };
10173
+ var CommandDimensions = {
10174
+ IsCommand: "IsCommand",
10175
+ IsReexec: "IsReexec",
10176
+ CommandName: "CommandName",
10177
+ ExitCode: "ExitCode",
10178
+ TerminalOutcome: "TerminalOutcome",
10179
+ ErrorClass: "ErrorClass",
10180
+ TerminalSignal: "TerminalSignal",
10181
+ ErrorMessage: "ErrorMessage",
10182
+ SkillName: "SkillName",
10183
+ ProductArea: "ProductArea",
10184
+ Mode: "Mode"
10185
+ };
10186
+ var ShipDimensions = {
10187
+ ShipKind: "ShipKind",
10188
+ Target: "Target",
10189
+ ProjectType: "ProjectType",
10190
+ ProjectTypes: "ProjectTypes",
10191
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
10192
+ PackageName: "PackageName",
10193
+ PackageVersion: "PackageVersion",
10194
+ PackageVersionKey: "PackageVersionKey",
10195
+ DeploymentKey: "DeploymentKey",
10196
+ SolutionId: "SolutionId",
10197
+ FolderKey: "FolderKey",
10198
+ FeedId: "FeedId"
10199
+ };
10200
+ var ErrorDimensions = {
10201
+ Result: "Result",
10202
+ ErrorCode: "ErrorCode",
10203
+ Retry: "Retry",
10204
+ ErrorMessage: "ErrorMessage"
10205
+ };
10206
+ var AuthDimensions = {
10207
+ AuthenticationMethod: "AuthenticationMethod",
10208
+ Success: "Success",
10209
+ Reason: "Reason"
10210
+ };
10211
+ var SkillsDimensions = {
10212
+ SchemaVersion: "SchemaVersion",
10213
+ AgentType: "AgentType",
10214
+ SkillsVersion: "SkillsVersion",
10215
+ UipSubcommand: "UipSubcommand",
10216
+ FileExtension: "FileExtension",
10217
+ SubagentModel: "SubagentModel",
10218
+ SubagentType: "SubagentType",
10219
+ PermissionMode: "PermissionMode",
10220
+ EffortLevel: "EffortLevel",
10221
+ SessionSource: "SessionSource",
10222
+ Outcome: "Outcome",
10223
+ DurationMs: "DurationMs",
10224
+ Source: "Source"
10225
+ };
10226
+ var PackagerDimensions = {
10227
+ ProjectId: "ProjectId",
10228
+ ProjectType: "ProjectType",
10229
+ SolutionId: "SolutionId"
10230
+ };
10231
+ var ScopeDimensions = {
10232
+ FolderId: "FolderId"
10233
+ };
10234
+ var ID_DIMENSIONS = new Set([
10235
+ BaseDimensions.CloudUserId,
10236
+ BaseDimensions.CloudTenantId,
10237
+ BaseDimensions.CloudOrganizationId,
10238
+ BaseDimensions.InstallationId,
10239
+ ShipDimensions.ArtifactCorrelationKey,
10240
+ ShipDimensions.PackageVersionKey,
10241
+ ShipDimensions.DeploymentKey,
10242
+ ShipDimensions.SolutionId,
10243
+ ShipDimensions.FolderKey,
10244
+ ShipDimensions.FeedId,
10245
+ PackagerDimensions.ProjectId
10246
+ ]);
10247
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
10248
+ var RESERVED_DIMENSION_NAMES = new Set([
10249
+ ...Object.values(BaseDimensions),
10250
+ ...Object.values(CommandDimensions),
10251
+ ...Object.values(ShipDimensions),
10252
+ ...Object.values(ErrorDimensions),
10253
+ ...Object.values(AuthDimensions),
10254
+ ...Object.values(SkillsDimensions),
10255
+ ...Object.values(PackagerDimensions),
10256
+ ...Object.values(ScopeDimensions)
10257
+ ]);
10258
+ var CURATED_DIMENSIONS = new Set([
10259
+ BaseDimensions.ApplicationName,
10260
+ BaseDimensions.ProductVersion,
10261
+ BaseDimensions.InstallationId,
10262
+ BaseDimensions.CloudUserId,
10263
+ BaseDimensions.CloudTenantId,
10264
+ BaseDimensions.CloudOrganizationId,
10265
+ BaseDimensions.IsInternalUser,
10266
+ BaseDimensions.Environment,
10267
+ BaseDimensions.BaseUrl,
10268
+ BaseDimensions.Region,
10269
+ BaseDimensions.Agent,
10270
+ BaseDimensions.AgentVersion,
10271
+ BaseDimensions.ToolVersion,
10272
+ BaseDimensions.ExecutionContext,
10273
+ BaseDimensions.CiProvider,
10274
+ BaseDimensions.SessionIdSource,
10275
+ BaseDimensions.SessionId,
10276
+ ...Object.values(CommandDimensions),
10277
+ ...Object.values(ShipDimensions)
10278
+ ]);
10279
+ function lowercaseIdDimensionValues(properties) {
10280
+ let changed = false;
10281
+ const result = {
10282
+ ...properties
10283
+ };
10284
+ for (const key of Object.keys(result)) {
10285
+ const value = result[key];
10286
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
10287
+ continue;
10288
+ }
10289
+ const lowered = value.toLowerCase();
10290
+ if (lowered !== value) {
10291
+ result[key] = lowered;
10292
+ changed = true;
10293
+ }
10294
+ }
10295
+ return changed ? result : properties;
10296
+ }
10297
+
10100
10298
  // ../common/src/telemetry/command-terminal.ts
10101
10299
  var recordedFailureSlot = singleton("CommandTelemetryFailure");
10102
10300
  var AUTH_ERROR_CODES = new Set([
10103
10301
  "authentication_required",
10104
10302
  "permission_denied"
10105
10303
  ]);
10304
+ var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
10305
+ "local_permission_denied"
10306
+ ]);
10106
10307
  var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
10107
10308
  var NETWORK_HTTP_ERROR_CODES = new Set([
10108
10309
  "network_error",
@@ -10243,6 +10444,9 @@ function classifyFromErrorCode(errorCode) {
10243
10444
  if (AUTH_ERROR_CODES.has(errorCode)) {
10244
10445
  return "auth";
10245
10446
  }
10447
+ if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
10448
+ return "local_permission";
10449
+ }
10246
10450
  if (VALIDATION_ERROR_CODES.has(errorCode)) {
10247
10451
  return "validation";
10248
10452
  }
@@ -10254,6 +10458,15 @@ function classifyFromErrorCode(errorCode) {
10254
10458
  }
10255
10459
  return;
10256
10460
  }
10461
+ function hasLocalPermissionCode(error) {
10462
+ for (const node of walkErrorGraph(error)) {
10463
+ const code = node.code;
10464
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
10465
+ return true;
10466
+ }
10467
+ }
10468
+ return false;
10469
+ }
10257
10470
  function classifyFromError(error) {
10258
10471
  const code = findCodeInCauseChain(error);
10259
10472
  if (code) {
@@ -10270,6 +10483,9 @@ function classifyFromError(error) {
10270
10483
  return "missing_dependency";
10271
10484
  }
10272
10485
  }
10486
+ if (hasLocalPermissionCode(error)) {
10487
+ return "local_permission";
10488
+ }
10273
10489
  const message = stringField(error, "message");
10274
10490
  if (message?.includes("fetch failed") === true) {
10275
10491
  return "network_http";
@@ -10285,7 +10501,7 @@ function classifyError(input) {
10285
10501
  if (recorded?.errorClass) {
10286
10502
  return recorded.errorClass;
10287
10503
  }
10288
- const status = recorded?.context?.httpStatus;
10504
+ const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
10289
10505
  if (status !== undefined) {
10290
10506
  return classifyHttpStatus(status);
10291
10507
  }
@@ -10308,17 +10524,18 @@ function buildCommandTerminalTelemetryProperties(input) {
10308
10524
  const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
10309
10525
  const terminalSignal = terminalSignalFor(input, outcome);
10310
10526
  return {
10311
- exit_code: input.exitCode,
10312
- terminal_outcome: outcome,
10313
- ...errorClass ? { error_class: errorClass } : {},
10314
- ...terminalSignal ? { terminal_signal: terminalSignal } : {}
10527
+ [CommandDimensions.ExitCode]: input.exitCode,
10528
+ [CommandDimensions.TerminalOutcome]: outcome,
10529
+ ...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
10530
+ ...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
10315
10531
  };
10316
10532
  }
10317
10533
 
10318
10534
  // ../common/src/telemetry/telemetry-events.ts
10319
10535
  var CommonTelemetryEvents = {
10320
- Error: "uip.error",
10321
- ShipSucceeded: "uip.ship.succeeded"
10536
+ Start: "Application.Start",
10537
+ Error: "Application.Error",
10538
+ ShipSucceeded: "Cli.ShipSucceeded"
10322
10539
  };
10323
10540
 
10324
10541
  // ../common/src/registry.ts
@@ -10526,8 +10743,8 @@ function detectExecutionContext(options = {}) {
10526
10743
  function getExecutionContextTelemetryProperties() {
10527
10744
  const detected = detectExecutionContext();
10528
10745
  return {
10529
- execution_context: detected.executionContext,
10530
- ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
10746
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
10747
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
10531
10748
  };
10532
10749
  }
10533
10750
  // ../common/src/telemetry/node-context-storage.ts
@@ -10570,7 +10787,7 @@ function getInboundTraceContext() {
10570
10787
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
10571
10788
  var SESSION_ID_MAX_LENGTH = 64;
10572
10789
  var RANDOM_SESSION_ID_LENGTH = 32;
10573
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
10790
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
10574
10791
  var CONTROL_CHARACTERS = /\p{Cc}/gu;
10575
10792
  var INHERITED_SESSION_SOURCES = [
10576
10793
  { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
@@ -10622,6 +10839,9 @@ function resolveTelemetrySession() {
10622
10839
  telemetrySessionSlot.set(resolved);
10623
10840
  return resolved;
10624
10841
  }
10842
+ function getTelemetrySessionId() {
10843
+ return resolveTelemetrySession().id;
10844
+ }
10625
10845
  function getTelemetrySessionSource() {
10626
10846
  return resolveTelemetrySession().source;
10627
10847
  }
@@ -10702,7 +10922,10 @@ class TelemetryService {
10702
10922
  } catch (error) {
10703
10923
  const durationMs = clock.elapsedMs();
10704
10924
  const err = error instanceof Error ? error : new Error(String(error));
10705
- await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
10925
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
10926
+ ...properties,
10927
+ [CommandDimensions.ErrorMessage]: err.message
10928
+ }, context));
10706
10929
  throw error;
10707
10930
  }
10708
10931
  }
@@ -10773,7 +10996,10 @@ class TelemetryService {
10773
10996
  const durationMs = clock.elapsedMs();
10774
10997
  const err = error instanceof Error ? error : new Error(String(error));
10775
10998
  await this.telemetryProvider.trackDependency({
10776
- ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
10999
+ ...this.spanFor(name, durationMs, false, {
11000
+ ...properties,
11001
+ [CommandDimensions.ErrorMessage]: err.message
11002
+ }, childContext),
10777
11003
  type
10778
11004
  });
10779
11005
  throw error;
@@ -10808,9 +11034,10 @@ class TelemetryService {
10808
11034
  ...globalProperties,
10809
11035
  ...this.defaultProperties,
10810
11036
  ...redactProperties(properties ?? {}),
10811
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
11037
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
11038
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
10812
11039
  };
10813
- return enriched;
11040
+ return lowercaseIdDimensionValues(enriched);
10814
11041
  }
10815
11042
  generateId() {
10816
11043
  const bytes = new Uint8Array(8);
@@ -11571,7 +11798,165 @@ class FilterImplicitLimitError extends Error {
11571
11798
  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).";
11572
11799
  }
11573
11800
  }
11574
- function applyFilter(data, filter) {
11801
+ function countRecords(data) {
11802
+ if (Array.isArray(data))
11803
+ return data.length;
11804
+ return data == null ? 0 : 1;
11805
+ }
11806
+ function availableFields(data) {
11807
+ const records = Array.isArray(data) ? data : [data];
11808
+ const keys = new Set;
11809
+ for (const record of records) {
11810
+ if (record && typeof record === "object" && !Array.isArray(record)) {
11811
+ for (const key of Object.keys(record))
11812
+ keys.add(key);
11813
+ }
11814
+ }
11815
+ return [...keys];
11816
+ }
11817
+ function decodeQuotedIdentifier(whole, inner) {
11818
+ const [error, decoded] = catchError(() => JSON.parse(whole));
11819
+ if (!error && typeof decoded === "string")
11820
+ return decoded;
11821
+ return inner.replace(/\\(.)/g, "$1");
11822
+ }
11823
+ function referencedFields(filter) {
11824
+ const top = new Set;
11825
+ const nested = new Set;
11826
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
11827
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
11828
+ const quoted = [];
11829
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
11830
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
11831
+ if (!isAlias) {
11832
+ quoted.push({
11833
+ name: decodeQuotedIdentifier(whole, name),
11834
+ index,
11835
+ tail: isPathTail(withoutValueLiterals, index)
11836
+ });
11837
+ }
11838
+ return `"${" ".repeat(whole.length - 2)}"`;
11839
+ });
11840
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
11841
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
11842
+ const place = (name, index, tail) => {
11843
+ if (tail || index >= rootEnd)
11844
+ nested.add(name);
11845
+ else
11846
+ top.add(name);
11847
+ };
11848
+ for (const entry of quoted)
11849
+ place(entry.name, entry.index, entry.tail);
11850
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
11851
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
11852
+ for (const match of identifiers) {
11853
+ const [, name, trailing] = match;
11854
+ if (trailing || reserved.has(name))
11855
+ continue;
11856
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
11857
+ }
11858
+ return {
11859
+ top: [...top],
11860
+ nested: [...nested].filter((name) => !top.has(name)),
11861
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
11862
+ };
11863
+ }
11864
+ function appearsBelowTopLevel(data, name) {
11865
+ let budget = 2000;
11866
+ const visit = (value, depth) => {
11867
+ if (budget-- <= 0 || depth > 4)
11868
+ return false;
11869
+ if (value === null || typeof value !== "object")
11870
+ return false;
11871
+ if (Array.isArray(value))
11872
+ return value.some((entry) => visit(entry, depth));
11873
+ const record = value;
11874
+ if (depth > 0 && Object.hasOwn(record, name))
11875
+ return true;
11876
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
11877
+ };
11878
+ return visit(data, 0);
11879
+ }
11880
+ function alwaysNullKeys(records) {
11881
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
11882
+ if (objects.length === 0 || objects.length !== records.length)
11883
+ return [];
11884
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
11885
+ if (keys.length === 0)
11886
+ return [];
11887
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
11888
+ return nullKeys.length === keys.length ? nullKeys : [];
11889
+ }
11890
+ function carriesOnlyNulls(value) {
11891
+ if (value === null)
11892
+ return true;
11893
+ if (Array.isArray(value)) {
11894
+ return value.length > 0 && value.every(carriesOnlyNulls);
11895
+ }
11896
+ if (typeof value === "object" && value !== undefined) {
11897
+ const values = Object.values(value);
11898
+ return values.length > 0 && values.every(carriesOnlyNulls);
11899
+ }
11900
+ return false;
11901
+ }
11902
+ function nameList(names, cap2 = 12) {
11903
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
11904
+ const rest = names.length - shown.length;
11905
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
11906
+ }
11907
+ function buildFilterWarning(filter, data, outcome) {
11908
+ const present = availableFields(data);
11909
+ const refs = referencedFields(filter);
11910
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
11911
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
11912
+ const count = countRecords(data);
11913
+ const scope = `${count} record(s)`;
11914
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
11915
+ 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" : "";
11916
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
11917
+ let detail;
11918
+ let lede;
11919
+ if (outcome.kind === "null-elements") {
11920
+ lede = "returned only null values";
11921
+ const projected = `all ${outcome.count} of the elements it projected are null`;
11922
+ if (unknown.length > 0) {
11923
+ detail = `${projected}, because ${isNotAField(unknown)}`;
11924
+ } else if (unchecked.length > 0) {
11925
+ detail = withSoundness(projected);
11926
+ } else {
11927
+ 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`;
11928
+ }
11929
+ } else if (outcome.kind === "null-rows") {
11930
+ lede = "returned only null values";
11931
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
11932
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
11933
+ } else if (outcome.kind === "null-values") {
11934
+ lede = "returned only null values";
11935
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
11936
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
11937
+ if (sameSet) {
11938
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
11939
+ } else if (unknown.length > 0) {
11940
+ detail = `${projected}, because ${isNotAField(unknown)}`;
11941
+ } else {
11942
+ detail = withSoundness(`${projected} on all ${scope}`);
11943
+ }
11944
+ } else {
11945
+ lede = "returned nothing";
11946
+ if (unknown.length > 0) {
11947
+ detail = isNotAField(unknown);
11948
+ } else {
11949
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
11950
+ detail = withSoundness(`${selection} — it read ${scope}`);
11951
+ }
11952
+ }
11953
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
11954
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
11955
+ }
11956
+ function appendWarning(existing, note) {
11957
+ return existing ? `${existing} ${note}` : note;
11958
+ }
11959
+ function applyFilter(data, filter, onWarning) {
11575
11960
  const codec = requireJmespath();
11576
11961
  let result;
11577
11962
  try {
@@ -11579,9 +11964,34 @@ function applyFilter(data, filter) {
11579
11964
  } catch (err) {
11580
11965
  throw new FilterEvaluationError(filter, err);
11581
11966
  }
11582
- if (result == null)
11967
+ const inputCount = countRecords(data);
11968
+ const warn = (outcome) => {
11969
+ if (inputCount === 0)
11970
+ return;
11971
+ const note = buildFilterWarning(filter, data, outcome);
11972
+ getOutputSink().writeErr(`[WARN] ${note}
11973
+ `);
11974
+ onWarning?.(note);
11975
+ };
11976
+ const warnIfAllNull = (records) => {
11977
+ const keys = alwaysNullKeys(records);
11978
+ if (keys.length > 0)
11979
+ warn({ kind: "null-values", keys });
11980
+ };
11981
+ if (result == null) {
11982
+ warn({ kind: "empty" });
11583
11983
  return [];
11984
+ }
11584
11985
  if (Array.isArray(result)) {
11986
+ if (result.length === 0) {
11987
+ warn({ kind: "empty" });
11988
+ } else if (result.every((entry) => entry === null)) {
11989
+ warn({ kind: "null-elements", count: result.length });
11990
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
11991
+ warn({ kind: "null-rows", count: result.length });
11992
+ } else {
11993
+ warnIfAllNull(result);
11994
+ }
11585
11995
  if (result.length > 0 && typeof result[0] !== "object") {
11586
11996
  const fieldMatch = filter.match(/\.(\w+)$/);
11587
11997
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -11589,10 +11999,30 @@ function applyFilter(data, filter) {
11589
11999
  }
11590
12000
  return result;
11591
12001
  }
11592
- if (typeof result === "object")
12002
+ if (typeof result === "object") {
12003
+ warnIfAllNull([result]);
11593
12004
  return result;
12005
+ }
11594
12006
  return { Value: result };
11595
12007
  }
12008
+ function filterFailureData(envelope) {
12009
+ const filter = getOutputFilter();
12010
+ const data = envelope.Data;
12011
+ if (!filter || data == null)
12012
+ return;
12013
+ let note;
12014
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
12015
+ note = n;
12016
+ }));
12017
+ if (filterError) {
12018
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
12019
+ return;
12020
+ }
12021
+ envelope.Data = filtered;
12022
+ if (note) {
12023
+ envelope.Warning = appendWarning(envelope.Warning, note);
12024
+ }
12025
+ }
11596
12026
  function defaultErrorCodeForResult(result) {
11597
12027
  switch (result) {
11598
12028
  case RESULTS.AuthenticationError:
@@ -11607,7 +12037,7 @@ function defaultErrorCodeForResult(result) {
11607
12037
  return "unknown_error";
11608
12038
  }
11609
12039
  }
11610
- function parseHttpStatusFromMessage(message) {
12040
+ function parseHttpStatusFromMessage2(message) {
11611
12041
  const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
11612
12042
  if (!match)
11613
12043
  return;
@@ -11636,10 +12066,10 @@ function defaultErrorCodeForHttpStatus(status) {
11636
12066
  return "server_error";
11637
12067
  return;
11638
12068
  }
11639
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
12069
+ var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
11640
12070
  function defaultErrorCodeForFailure(data) {
11641
12071
  if (data.Result === RESULTS.Failure) {
11642
- const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
12072
+ const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
11643
12073
  const errorCode = defaultErrorCodeForHttpStatus(status);
11644
12074
  if (errorCode)
11645
12075
  return errorCode;
@@ -11675,8 +12105,14 @@ var OutputFormatter;
11675
12105
  }
11676
12106
  const filter = getOutputFilter();
11677
12107
  if (filter) {
11678
- const filtered = applyFilter(data.Data, filter);
12108
+ let note;
12109
+ const filtered = applyFilter(data.Data, filter, (n) => {
12110
+ note = n;
12111
+ });
11679
12112
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
12113
+ if (note) {
12114
+ data.Warning = appendWarning(data.Warning, note);
12115
+ }
11680
12116
  }
11681
12117
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
11682
12118
  }
@@ -11704,12 +12140,13 @@ var OutputFormatter;
11704
12140
  delete envelope.TelemetryErrorClass;
11705
12141
  delete envelope.TelemetryTerminalOutcome;
11706
12142
  delete envelope.TelemetryTerminalSignal;
12143
+ filterFailureData(envelope);
11707
12144
  if (!suppressTelemetry) {
11708
12145
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
11709
- result: data.Result,
11710
- errorCode: data.ErrorCode,
11711
- retry: data.Retry,
11712
- message: data.Message
12146
+ [ErrorDimensions.Result]: data.Result,
12147
+ [ErrorDimensions.ErrorCode]: data.ErrorCode,
12148
+ [ErrorDimensions.Retry]: data.Retry,
12149
+ [ErrorDimensions.ErrorMessage]: data.Message
11713
12150
  });
11714
12151
  }
11715
12152
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -11752,13 +12189,20 @@ var OutputFormatter;
11752
12189
  OutputFormatter.log = log;
11753
12190
  function formatToString(data) {
11754
12191
  const filter = getOutputFilter();
12192
+ const envelope = data;
11755
12193
  if ("Data" in data && data.Data != null) {
11756
12194
  data.Data = normalizeDataKeys(data.Data);
11757
12195
  if (filter) {
11758
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
12196
+ let note;
12197
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
12198
+ note = n;
12199
+ }));
12200
+ if (note) {
12201
+ envelope.Warning = appendWarning(envelope.Warning, note);
12202
+ }
11759
12203
  }
11760
12204
  }
11761
- const output = normalizeOutputKeys(data);
12205
+ const output = normalizeOutputKeys(envelope);
11762
12206
  const lines = [];
11763
12207
  const sink = getOutputSink();
11764
12208
  printOutput(output, getOutputFormat(), (msg) => {
@@ -11808,7 +12252,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
11808
12252
  var MAX_SKILL_NAME_LENGTH = 80;
11809
12253
  var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
11810
12254
  function productMode(productArea, mode) {
11811
- return { product_area: productArea, mode };
12255
+ return { ProductArea: productArea, Mode: mode };
11812
12256
  }
11813
12257
  function attributionRecord(groups) {
11814
12258
  const record = {};
@@ -11866,6 +12310,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
11866
12310
  ["rpa", "build", ["uip.rpa-legacy"]],
11867
12311
  ["conversational", "operate", ["uip.conversational"]],
11868
12312
  ["agents", "build", ["uip.codedagent", "uip.agent"]],
12313
+ ["coding-agents", "build", ["uip.coder"]],
11869
12314
  ["agenthub", "build", ["uip.agenthub"]],
11870
12315
  ["coded-apps", "build", ["uip.codedapp"]],
11871
12316
  ["functions", "build", ["uip.function", "uip.functions"]],
@@ -11951,32 +12396,64 @@ function normalizeSkillName(value) {
11951
12396
  function buildCommandTelemetryAttribution(commandPath, skillSource) {
11952
12397
  const skillName = normalizeSkillName(skillSource);
11953
12398
  return {
11954
- ...skillName ? { skill_name: skillName } : {},
12399
+ ...skillName ? { SkillName: skillName } : {},
11955
12400
  ...getCommandProductModeAttribution(commandPath)
11956
12401
  };
11957
12402
  }
12403
+ var AGENT_SESSION_ENV = {
12404
+ [BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
12405
+ [SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
12406
+ [SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
12407
+ [SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
12408
+ };
12409
+ var MAX_TELEMETRY_TOKEN_LENGTH = 120;
12410
+ function sanitizeTelemetryToken(value) {
12411
+ return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
12412
+ }
12413
+ function buildAgentSessionTelemetry(env) {
12414
+ const dimensions = {};
12415
+ for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
12416
+ const value = env[variable]?.trim();
12417
+ if (value) {
12418
+ dimensions[key] = sanitizeTelemetryToken(value);
12419
+ }
12420
+ }
12421
+ return dimensions;
12422
+ }
11958
12423
 
11959
12424
  // ../common/src/telemetry/command-name.ts
11960
- var TELEMETRY_COMMAND_ROOT = "uip";
12425
+ var TELEMETRY_NAME_ROOT = "Cli";
12426
+ var CLI_COMMAND_ROOT = "uip";
12427
+ var TELEMETRY_NAME_BARE_ACTION = "Invoke";
11961
12428
  function commandTelemetryName(parts) {
12429
+ const action = vetCommandTokens(parts).map(pascalizeToken).join("");
12430
+ return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
12431
+ }
12432
+ function commandInvocationPath(parts) {
12433
+ return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
12434
+ }
12435
+ function vetCommandTokens(parts) {
11962
12436
  const tokens = [];
11963
12437
  for (const part of parts) {
11964
- const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
12438
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
11965
12439
  if (pieces.every(isCommandToken)) {
11966
12440
  tokens.push(...pieces);
11967
12441
  continue;
11968
12442
  }
11969
12443
  tokens.push(UNKNOWN_TOKEN);
11970
12444
  }
11971
- return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
12445
+ return tokens;
11972
12446
  }
11973
- var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
12447
+ function pascalizeToken(token) {
12448
+ return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
12449
+ }
12450
+ var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
11974
12451
  var MAX_COMMAND_TOKEN_LENGTH = 32;
11975
12452
  var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
11976
12453
  function isCommandToken(token) {
11977
- return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
12454
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
11978
12455
  }
11979
- var UNKNOWN_TOKEN = "<unknown>";
12456
+ var UNKNOWN_TOKEN = "unknown";
11980
12457
 
11981
12458
  // ../common/src/telemetry/invocation-request.ts
11982
12459
  var requestContextSlot = singleton("TelemetryInvocationRequestContext");
@@ -12081,7 +12558,7 @@ function withheldArgumentValues(cmd) {
12081
12558
  });
12082
12559
  return values;
12083
12560
  }
12084
- function deriveCommandPath(cmd) {
12561
+ function deriveCommandParts(cmd) {
12085
12562
  const parts = [];
12086
12563
  let current = cmd;
12087
12564
  while (current) {
@@ -12094,14 +12571,13 @@ function deriveCommandPath(cmd) {
12094
12571
  if (parts.length > 1) {
12095
12572
  parts.shift();
12096
12573
  }
12097
- return commandTelemetryName(parts);
12574
+ return parts;
12098
12575
  }
12099
12576
  function isErrorContext(value) {
12100
12577
  return value !== null && typeof value === "object";
12101
12578
  }
12102
12579
  function commandHelpHint(commandPath) {
12103
- const command = commandPath.replace(/\./g, " ");
12104
- return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
12580
+ return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
12105
12581
  }
12106
12582
  function isPromptCancellation(error) {
12107
12583
  return error instanceof Error && error.name === "ExitPromptError";
@@ -12126,7 +12602,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12126
12602
  yaml: getOutputFormat() === "yaml",
12127
12603
  filter: getOutputFilter() !== undefined
12128
12604
  });
12129
- const telemetryName = deriveCommandPath(command);
12605
+ const commandParts = deriveCommandParts(command);
12606
+ const telemetryName = commandTelemetryName(commandParts);
12607
+ const commandPath = commandInvocationPath(commandParts);
12130
12608
  const props = typeof properties === "function" ? properties(...args) : properties;
12131
12609
  markCommandStart();
12132
12610
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
@@ -12161,7 +12639,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12161
12639
  Result: finalResult,
12162
12640
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
12163
12641
  Message: errorMessage,
12164
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
12642
+ Instructions: customInstructions ?? commandHelpHint(commandPath),
12165
12643
  ...customRetry ? { Retry: customRetry } : {},
12166
12644
  ...customContext ? { Context: customContext } : {}
12167
12645
  });
@@ -12178,8 +12656,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12178
12656
  recordedFailure,
12179
12657
  pollSignal: context.pollSignal
12180
12658
  });
12181
- if (terminalTelemetry.error_class === "internal" && error) {
12182
- telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
12659
+ if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
12660
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
12183
12661
  }
12184
12662
  const commandParams = extractCommandParams(command);
12185
12663
  if (props) {
@@ -12190,10 +12668,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12190
12668
  const baseProperties = redactProperties({
12191
12669
  ...commandParams,
12192
12670
  ...props,
12193
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
12194
- command: "true",
12671
+ ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
12672
+ ...buildAgentSessionTelemetry(process.env),
12673
+ [CommandDimensions.CommandName]: commandPath,
12674
+ [CommandDimensions.IsCommand]: "true",
12195
12675
  ...terminalTelemetry,
12196
- ...errorMessage ? { errorMessage } : {}
12676
+ ...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
12197
12677
  });
12198
12678
  emitInvocationRequest(telemetryName, success, baseProperties);
12199
12679
  } finally {
@@ -12424,6 +12904,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
12424
12904
  // ../common/src/interactivity-context.ts
12425
12905
  var modeSlot = singleton("InteractivityMode");
12426
12906
  var interactiveFlagSlot = singleton("InteractiveFlag");
12907
+ // ../common/src/mime-types.ts
12908
+ var MIME_TYPES_BY_EXTENSION = Object.freeze({
12909
+ pdf: "application/pdf",
12910
+ png: "image/png",
12911
+ jpg: "image/jpeg",
12912
+ jpeg: "image/jpeg",
12913
+ gif: "image/gif",
12914
+ webp: "image/webp",
12915
+ bmp: "image/bmp",
12916
+ tif: "image/tiff",
12917
+ tiff: "image/tiff",
12918
+ svg: "image/svg+xml",
12919
+ txt: "text/plain",
12920
+ log: "text/plain",
12921
+ md: "text/markdown",
12922
+ csv: "text/csv",
12923
+ tsv: "text/tab-separated-values",
12924
+ json: "application/json",
12925
+ xml: "application/xml",
12926
+ html: "text/html",
12927
+ htm: "text/html",
12928
+ yaml: "application/yaml",
12929
+ yml: "application/yaml",
12930
+ doc: "application/msword",
12931
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
12932
+ xls: "application/vnd.ms-excel",
12933
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
12934
+ ppt: "application/vnd.ms-powerpoint",
12935
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
12936
+ zip: "application/zip",
12937
+ mp3: "audio/mpeg",
12938
+ wav: "audio/wav",
12939
+ mp4: "video/mp4"
12940
+ });
12427
12941
  // ../common/src/option-aliases.ts
12428
12942
  function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
12429
12943
  getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
@@ -12485,6 +12999,7 @@ var ScreenLogger;
12485
12999
  ScreenLogger.progress = progress;
12486
13000
  })(ScreenLogger ||= {});
12487
13001
  // ../common/src/sdk-user-agent.ts
13002
+ var AGENT_PROPERTY = BaseDimensions.Agent;
12488
13003
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
12489
13004
  // ../common/src/telemetry/ship-succeeded.ts
12490
13005
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
@@ -12801,6 +13316,11 @@ var pickName = (claims) => {
12801
13316
  const username = asString(claims?.preferred_username);
12802
13317
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
12803
13318
  };
13319
+ var pickScopes = (claims) => {
13320
+ const raw = claims?.scope;
13321
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
13322
+ return scopes.length > 0 ? scopes : undefined;
13323
+ };
12804
13324
  var resolveSessionIdentity = (accessToken, authFlow) => {
12805
13325
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
12806
13326
  const email = pickEmail(claims);
@@ -12826,6 +13346,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
12826
13346
  identity.clientId = clientId;
12827
13347
  return identity;
12828
13348
  };
13349
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
12829
13350
 
12830
13351
  // ../auth/src/envAuth.ts
12831
13352
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -12898,6 +13419,7 @@ var readAuthFromEnv = () => {
12898
13419
  const expiration = getTokenExpiration(accessToken);
12899
13420
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
12900
13421
  const identity = resolveSessionIdentity(accessToken);
13422
+ const scopes = readTokenScopes(accessToken);
12901
13423
  return {
12902
13424
  loginStatus,
12903
13425
  accessToken,
@@ -12908,7 +13430,8 @@ var readAuthFromEnv = () => {
12908
13430
  tenantId,
12909
13431
  expiration,
12910
13432
  source: "env-vars" /* EnvironmentVariables */,
12911
- ...identity ? { identity } : {}
13433
+ ...identity ? { identity } : {},
13434
+ ...scopes ? { scopes } : {}
12912
13435
  };
12913
13436
  };
12914
13437
 
@@ -13546,10 +14069,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
13546
14069
  }
13547
14070
  function identityFields(accessToken, credentials) {
13548
14071
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
13549
- return identity ? { identity } : {};
14072
+ const scopes = readTokenScopes(accessToken);
14073
+ return {
14074
+ ...identity ? { identity } : {},
14075
+ ...scopes ? { scopes } : {}
14076
+ };
13550
14077
  }
13551
14078
  function buildRobotStatus(robotCreds) {
13552
14079
  const identity = resolveSessionIdentity(robotCreds.accessToken);
14080
+ const scopes = readTokenScopes(robotCreds.accessToken);
13553
14081
  return {
13554
14082
  loginStatus: "Logged in",
13555
14083
  accessToken: robotCreds.accessToken,
@@ -13561,7 +14089,8 @@ function buildRobotStatus(robotCreds) {
13561
14089
  issuer: robotCreds.issuer,
13562
14090
  expiration: getTokenExpiration(robotCreds.accessToken),
13563
14091
  source: "robot" /* Robot */,
13564
- ...identity ? { identity } : {}
14092
+ ...identity ? { identity } : {},
14093
+ ...scopes ? { scopes } : {}
13565
14094
  };
13566
14095
  }
13567
14096
  var isFileNotFoundError = (error) => {
@@ -23100,4 +23629,4 @@ var registerCommands = async (program2) => {
23100
23629
 
23101
23630
  export { Command, metadata, registerCommands };
23102
23631
 
23103
- //# debugId=255DD803BA06BC6664756E2164756E21
23632
+ //# debugId=A00E5B8226078FFF64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-gdbvck3g.js";
4
+ } from "./tool-fp9emw8t.js";
5
5
  import"./tool-1yh8g550.js";
6
6
  export {
7
7
  metadata,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/docsai-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.205",
5
+ "version": "1.204.0-preview.206",
6
6
  "description": "Search UiPath documentation with AI-powered answers.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "d8d19829030cc590c630bebfc60a9d9fc7fa8c31"
30
+ "gitHead": "ea7fd32a02acccf14e8e83522e69101430627b83"
31
31
  }