@uipath/resourcecatalog-tool 1.203.0-preview.203 → 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-g2ac01zx.js";
6
+ } from "./tool-snvn8cgb.js";
7
7
  import"./tool-1de529jm.js";
8
8
 
9
9
  // src/index.ts
@@ -2101,7 +2101,7 @@ var package_default = {
2101
2101
  name: "@uipath/resourcecatalog-tool",
2102
2102
  author: "UiPath",
2103
2103
  license: "SEE LICENSE IN LICENSE.txt",
2104
- version: "1.203.0-preview.203",
2104
+ version: "1.204.0-preview.206",
2105
2105
  description: "CLI plugin for the UiPath Resource Catalog Service.",
2106
2106
  private: false,
2107
2107
  repository: {
@@ -2128,6 +2128,7 @@ var package_default = {
2128
2128
  ],
2129
2129
  scripts: {
2130
2130
  build: "bun ../../../tools/build-tool.ts",
2131
+ typecheck: "tsc --noEmit",
2131
2132
  package: "bun run build && bun pm pack",
2132
2133
  lint: "biome check .",
2133
2134
  "lint:fix": "biome check --write .",
@@ -2910,9 +2911,60 @@ function settlePromiseLike(thenable) {
2910
2911
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2911
2912
  }
2912
2913
 
2914
+ // ../../common/src/error-graph.ts
2915
+ function* walkErrorGraph(error) {
2916
+ const queue = [error];
2917
+ const seen = new Set;
2918
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2919
+ const current = queue.shift();
2920
+ if (current === null || typeof current !== "object")
2921
+ continue;
2922
+ if (seen.has(current))
2923
+ continue;
2924
+ seen.add(current);
2925
+ const cur = current;
2926
+ yield cur;
2927
+ if (cur.cause !== undefined)
2928
+ queue.push(cur.cause);
2929
+ if (Array.isArray(cur.errors))
2930
+ queue.push(...cur.errors);
2931
+ }
2932
+ return;
2933
+ }
2934
+ function parseHttpStatusFromMessage(message) {
2935
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
2936
+ if (!match)
2937
+ return;
2938
+ const status = Number(match[1]);
2939
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
2940
+ }
2941
+ function findHttpStatusInGraph(error) {
2942
+ for (const node of walkErrorGraph(error)) {
2943
+ const response = node.response;
2944
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
2945
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
2946
+ return explicit;
2947
+ }
2948
+ if (typeof node.message === "string") {
2949
+ const parsed = parseHttpStatusFromMessage(node.message);
2950
+ if (parsed !== undefined && parsed >= 400) {
2951
+ return parsed;
2952
+ }
2953
+ }
2954
+ }
2955
+ return;
2956
+ }
2957
+
2958
+ // ../../common/src/local-permission-codes.ts
2959
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
2960
+ "EACCES",
2961
+ "EPERM",
2962
+ "EROFS"
2963
+ ]);
2964
+
2913
2965
  // ../../common/src/error-handler.ts
2914
- var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
2915
- var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
2966
+ 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.";
2967
+ var DEFAULT_403 = "Forbidden (403). The account lacks permission for this operation, or the token carries no scope for this API. Run `uip login status --detailed` to see the token's scopes.";
2916
2968
  var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
2917
2969
  var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
2918
2970
  var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
@@ -2939,14 +2991,14 @@ var TLS_ERROR_CODES = new Set([
2939
2991
  ]);
2940
2992
  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.";
2941
2993
  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.";
2942
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2943
- var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2994
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
2944
2995
  function localPermissionInstructions(code, path2) {
2945
2996
  const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
2946
2997
  if (code === "EROFS") {
2947
2998
  return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
2948
2999
  }
2949
- const remedy = process.platform === "win32" ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
3000
+ const onWindows = typeof process !== "undefined" && process.platform === "win32";
3001
+ const remedy = onWindows ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
2950
3002
  return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
2951
3003
  }
2952
3004
  function describeConnectivityError(error) {
@@ -3000,48 +3052,6 @@ function localPermissionPath(path2, message) {
3000
3052
  return path2;
3001
3053
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
3002
3054
  }
3003
- function* walkErrorGraph(error) {
3004
- const queue = [error];
3005
- const seen = new Set;
3006
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
3007
- const current = queue.shift();
3008
- if (current === null || typeof current !== "object")
3009
- continue;
3010
- if (seen.has(current))
3011
- continue;
3012
- seen.add(current);
3013
- const cur = current;
3014
- yield cur;
3015
- if (cur.cause !== undefined)
3016
- queue.push(cur.cause);
3017
- if (Array.isArray(cur.errors))
3018
- queue.push(...cur.errors);
3019
- }
3020
- return;
3021
- }
3022
- function parseHttpStatusFromMessage(message) {
3023
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
3024
- if (!match)
3025
- return;
3026
- const status = Number(match[1]);
3027
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
3028
- }
3029
- function findHttpStatusInGraph(error) {
3030
- for (const node of walkErrorGraph(error)) {
3031
- const response = node.response;
3032
- const explicit = typeof node.status === "number" ? node.status : response?.status;
3033
- if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
3034
- return explicit;
3035
- }
3036
- if (typeof node.message === "string") {
3037
- const parsed = parseHttpStatusFromMessage(node.message);
3038
- if (parsed !== undefined && parsed >= 400) {
3039
- return parsed;
3040
- }
3041
- }
3042
- }
3043
- return;
3044
- }
3045
3055
  function isHtmlDocument(body) {
3046
3056
  return /^\s*(<!doctype html|<html\b)/i.test(body);
3047
3057
  }
@@ -3563,12 +3573,162 @@ function getOutputFilter() {
3563
3573
  return filterSlot.get();
3564
3574
  }
3565
3575
 
3576
+ // ../../common/src/telemetry/telemetry-dimensions.ts
3577
+ var BaseDimensions = {
3578
+ ApplicationName: "ApplicationName",
3579
+ ProductVersion: "ProductVersion",
3580
+ InstallationId: "InstallationId",
3581
+ CloudUserId: "CloudUserId",
3582
+ CloudTenantId: "CloudTenantId",
3583
+ CloudOrganizationId: "CloudOrganizationId",
3584
+ IsInternalUser: "IsInternalUser",
3585
+ Environment: "Environment",
3586
+ BaseUrl: "BaseUrl",
3587
+ Region: "Region",
3588
+ Agent: "Agent",
3589
+ AgentVersion: "AgentVersion",
3590
+ AgentModel: "AgentModel",
3591
+ ToolName: "ToolName",
3592
+ ToolVersion: "ToolVersion",
3593
+ ExecutionContext: "ExecutionContext",
3594
+ CiProvider: "CiProvider",
3595
+ SessionIdSource: "SessionIdSource",
3596
+ SessionId: "SessionId"
3597
+ };
3598
+ var CommandDimensions = {
3599
+ IsCommand: "IsCommand",
3600
+ IsReexec: "IsReexec",
3601
+ CommandName: "CommandName",
3602
+ ExitCode: "ExitCode",
3603
+ TerminalOutcome: "TerminalOutcome",
3604
+ ErrorClass: "ErrorClass",
3605
+ TerminalSignal: "TerminalSignal",
3606
+ ErrorMessage: "ErrorMessage",
3607
+ SkillName: "SkillName",
3608
+ ProductArea: "ProductArea",
3609
+ Mode: "Mode"
3610
+ };
3611
+ var ShipDimensions = {
3612
+ ShipKind: "ShipKind",
3613
+ Target: "Target",
3614
+ ProjectType: "ProjectType",
3615
+ ProjectTypes: "ProjectTypes",
3616
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
3617
+ PackageName: "PackageName",
3618
+ PackageVersion: "PackageVersion",
3619
+ PackageVersionKey: "PackageVersionKey",
3620
+ DeploymentKey: "DeploymentKey",
3621
+ SolutionId: "SolutionId",
3622
+ FolderKey: "FolderKey",
3623
+ FeedId: "FeedId"
3624
+ };
3625
+ var ErrorDimensions = {
3626
+ Result: "Result",
3627
+ ErrorCode: "ErrorCode",
3628
+ Retry: "Retry",
3629
+ ErrorMessage: "ErrorMessage"
3630
+ };
3631
+ var AuthDimensions = {
3632
+ AuthenticationMethod: "AuthenticationMethod",
3633
+ Success: "Success",
3634
+ Reason: "Reason"
3635
+ };
3636
+ var SkillsDimensions = {
3637
+ SchemaVersion: "SchemaVersion",
3638
+ AgentType: "AgentType",
3639
+ SkillsVersion: "SkillsVersion",
3640
+ UipSubcommand: "UipSubcommand",
3641
+ FileExtension: "FileExtension",
3642
+ SubagentModel: "SubagentModel",
3643
+ SubagentType: "SubagentType",
3644
+ PermissionMode: "PermissionMode",
3645
+ EffortLevel: "EffortLevel",
3646
+ SessionSource: "SessionSource",
3647
+ Outcome: "Outcome",
3648
+ DurationMs: "DurationMs",
3649
+ Source: "Source"
3650
+ };
3651
+ var PackagerDimensions = {
3652
+ ProjectId: "ProjectId",
3653
+ ProjectType: "ProjectType",
3654
+ SolutionId: "SolutionId"
3655
+ };
3656
+ var ScopeDimensions = {
3657
+ FolderId: "FolderId"
3658
+ };
3659
+ var ID_DIMENSIONS = new Set([
3660
+ BaseDimensions.CloudUserId,
3661
+ BaseDimensions.CloudTenantId,
3662
+ BaseDimensions.CloudOrganizationId,
3663
+ BaseDimensions.InstallationId,
3664
+ ShipDimensions.ArtifactCorrelationKey,
3665
+ ShipDimensions.PackageVersionKey,
3666
+ ShipDimensions.DeploymentKey,
3667
+ ShipDimensions.SolutionId,
3668
+ ShipDimensions.FolderKey,
3669
+ ShipDimensions.FeedId,
3670
+ PackagerDimensions.ProjectId
3671
+ ]);
3672
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
3673
+ var RESERVED_DIMENSION_NAMES = new Set([
3674
+ ...Object.values(BaseDimensions),
3675
+ ...Object.values(CommandDimensions),
3676
+ ...Object.values(ShipDimensions),
3677
+ ...Object.values(ErrorDimensions),
3678
+ ...Object.values(AuthDimensions),
3679
+ ...Object.values(SkillsDimensions),
3680
+ ...Object.values(PackagerDimensions),
3681
+ ...Object.values(ScopeDimensions)
3682
+ ]);
3683
+ var CURATED_DIMENSIONS = new Set([
3684
+ BaseDimensions.ApplicationName,
3685
+ BaseDimensions.ProductVersion,
3686
+ BaseDimensions.InstallationId,
3687
+ BaseDimensions.CloudUserId,
3688
+ BaseDimensions.CloudTenantId,
3689
+ BaseDimensions.CloudOrganizationId,
3690
+ BaseDimensions.IsInternalUser,
3691
+ BaseDimensions.Environment,
3692
+ BaseDimensions.BaseUrl,
3693
+ BaseDimensions.Region,
3694
+ BaseDimensions.Agent,
3695
+ BaseDimensions.AgentVersion,
3696
+ BaseDimensions.ToolVersion,
3697
+ BaseDimensions.ExecutionContext,
3698
+ BaseDimensions.CiProvider,
3699
+ BaseDimensions.SessionIdSource,
3700
+ BaseDimensions.SessionId,
3701
+ ...Object.values(CommandDimensions),
3702
+ ...Object.values(ShipDimensions)
3703
+ ]);
3704
+ function lowercaseIdDimensionValues(properties) {
3705
+ let changed = false;
3706
+ const result = {
3707
+ ...properties
3708
+ };
3709
+ for (const key of Object.keys(result)) {
3710
+ const value = result[key];
3711
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
3712
+ continue;
3713
+ }
3714
+ const lowered = value.toLowerCase();
3715
+ if (lowered !== value) {
3716
+ result[key] = lowered;
3717
+ changed = true;
3718
+ }
3719
+ }
3720
+ return changed ? result : properties;
3721
+ }
3722
+
3566
3723
  // ../../common/src/telemetry/command-terminal.ts
3567
3724
  var recordedFailureSlot = singleton("CommandTelemetryFailure");
3568
3725
  var AUTH_ERROR_CODES = new Set([
3569
3726
  "authentication_required",
3570
3727
  "permission_denied"
3571
3728
  ]);
3729
+ var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
3730
+ "local_permission_denied"
3731
+ ]);
3572
3732
  var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
3573
3733
  var NETWORK_HTTP_ERROR_CODES = new Set([
3574
3734
  "network_error",
@@ -3709,6 +3869,9 @@ function classifyFromErrorCode(errorCode) {
3709
3869
  if (AUTH_ERROR_CODES.has(errorCode)) {
3710
3870
  return "auth";
3711
3871
  }
3872
+ if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
3873
+ return "local_permission";
3874
+ }
3712
3875
  if (VALIDATION_ERROR_CODES.has(errorCode)) {
3713
3876
  return "validation";
3714
3877
  }
@@ -3720,6 +3883,15 @@ function classifyFromErrorCode(errorCode) {
3720
3883
  }
3721
3884
  return;
3722
3885
  }
3886
+ function hasLocalPermissionCode(error) {
3887
+ for (const node of walkErrorGraph(error)) {
3888
+ const code = node.code;
3889
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
3890
+ return true;
3891
+ }
3892
+ }
3893
+ return false;
3894
+ }
3723
3895
  function classifyFromError(error) {
3724
3896
  const code = findCodeInCauseChain(error);
3725
3897
  if (code) {
@@ -3736,6 +3908,9 @@ function classifyFromError(error) {
3736
3908
  return "missing_dependency";
3737
3909
  }
3738
3910
  }
3911
+ if (hasLocalPermissionCode(error)) {
3912
+ return "local_permission";
3913
+ }
3739
3914
  const message = stringField(error, "message");
3740
3915
  if (message?.includes("fetch failed") === true) {
3741
3916
  return "network_http";
@@ -3751,7 +3926,7 @@ function classifyError2(input) {
3751
3926
  if (recorded?.errorClass) {
3752
3927
  return recorded.errorClass;
3753
3928
  }
3754
- const status = recorded?.context?.httpStatus;
3929
+ const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
3755
3930
  if (status !== undefined) {
3756
3931
  return classifyHttpStatus(status);
3757
3932
  }
@@ -3774,17 +3949,18 @@ function buildCommandTerminalTelemetryProperties(input) {
3774
3949
  const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
3775
3950
  const terminalSignal = terminalSignalFor(input, outcome);
3776
3951
  return {
3777
- exit_code: input.exitCode,
3778
- terminal_outcome: outcome,
3779
- ...errorClass ? { error_class: errorClass } : {},
3780
- ...terminalSignal ? { terminal_signal: terminalSignal } : {}
3952
+ [CommandDimensions.ExitCode]: input.exitCode,
3953
+ [CommandDimensions.TerminalOutcome]: outcome,
3954
+ ...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
3955
+ ...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
3781
3956
  };
3782
3957
  }
3783
3958
 
3784
3959
  // ../../common/src/telemetry/telemetry-events.ts
3785
3960
  var CommonTelemetryEvents = {
3786
- Error: "uip.error",
3787
- ShipSucceeded: "uip.ship.succeeded"
3961
+ Start: "Application.Start",
3962
+ Error: "Application.Error",
3963
+ ShipSucceeded: "Cli.ShipSucceeded"
3788
3964
  };
3789
3965
 
3790
3966
  // ../../common/src/registry.ts
@@ -3992,8 +4168,8 @@ function detectExecutionContext(options = {}) {
3992
4168
  function getExecutionContextTelemetryProperties() {
3993
4169
  const detected = detectExecutionContext();
3994
4170
  return {
3995
- execution_context: detected.executionContext,
3996
- ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
4171
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
4172
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
3997
4173
  };
3998
4174
  }
3999
4175
  // ../../common/src/telemetry/node-context-storage.ts
@@ -4036,7 +4212,7 @@ function getInboundTraceContext() {
4036
4212
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
4037
4213
  var SESSION_ID_MAX_LENGTH = 64;
4038
4214
  var RANDOM_SESSION_ID_LENGTH = 32;
4039
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
4215
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
4040
4216
  var CONTROL_CHARACTERS = /\p{Cc}/gu;
4041
4217
  var INHERITED_SESSION_SOURCES = [
4042
4218
  { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
@@ -4088,6 +4264,9 @@ function resolveTelemetrySession() {
4088
4264
  telemetrySessionSlot.set(resolved);
4089
4265
  return resolved;
4090
4266
  }
4267
+ function getTelemetrySessionId() {
4268
+ return resolveTelemetrySession().id;
4269
+ }
4091
4270
  function getTelemetrySessionSource() {
4092
4271
  return resolveTelemetrySession().source;
4093
4272
  }
@@ -4168,7 +4347,10 @@ class TelemetryService {
4168
4347
  } catch (error) {
4169
4348
  const durationMs = clock.elapsedMs();
4170
4349
  const err = error instanceof Error ? error : new Error(String(error));
4171
- await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
4350
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
4351
+ ...properties,
4352
+ [CommandDimensions.ErrorMessage]: err.message
4353
+ }, context));
4172
4354
  throw error;
4173
4355
  }
4174
4356
  }
@@ -4239,7 +4421,10 @@ class TelemetryService {
4239
4421
  const durationMs = clock.elapsedMs();
4240
4422
  const err = error instanceof Error ? error : new Error(String(error));
4241
4423
  await this.telemetryProvider.trackDependency({
4242
- ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
4424
+ ...this.spanFor(name, durationMs, false, {
4425
+ ...properties,
4426
+ [CommandDimensions.ErrorMessage]: err.message
4427
+ }, childContext),
4243
4428
  type
4244
4429
  });
4245
4430
  throw error;
@@ -4274,9 +4459,10 @@ class TelemetryService {
4274
4459
  ...globalProperties,
4275
4460
  ...this.defaultProperties,
4276
4461
  ...redactProperties(properties ?? {}),
4277
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
4462
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
4463
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
4278
4464
  };
4279
- return enriched;
4465
+ return lowercaseIdDimensionValues(enriched);
4280
4466
  }
4281
4467
  generateId() {
4282
4468
  const bytes = new Uint8Array(8);
@@ -5037,7 +5223,165 @@ class FilterImplicitLimitError extends Error {
5037
5223
  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).";
5038
5224
  }
5039
5225
  }
5040
- function applyFilter(data, filter) {
5226
+ function countRecords(data) {
5227
+ if (Array.isArray(data))
5228
+ return data.length;
5229
+ return data == null ? 0 : 1;
5230
+ }
5231
+ function availableFields(data) {
5232
+ const records = Array.isArray(data) ? data : [data];
5233
+ const keys = new Set;
5234
+ for (const record of records) {
5235
+ if (record && typeof record === "object" && !Array.isArray(record)) {
5236
+ for (const key of Object.keys(record))
5237
+ keys.add(key);
5238
+ }
5239
+ }
5240
+ return [...keys];
5241
+ }
5242
+ function decodeQuotedIdentifier(whole, inner) {
5243
+ const [error, decoded] = catchError(() => JSON.parse(whole));
5244
+ if (!error && typeof decoded === "string")
5245
+ return decoded;
5246
+ return inner.replace(/\\(.)/g, "$1");
5247
+ }
5248
+ function referencedFields(filter) {
5249
+ const top = new Set;
5250
+ const nested = new Set;
5251
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
5252
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
5253
+ const quoted = [];
5254
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
5255
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
5256
+ if (!isAlias) {
5257
+ quoted.push({
5258
+ name: decodeQuotedIdentifier(whole, name),
5259
+ index,
5260
+ tail: isPathTail(withoutValueLiterals, index)
5261
+ });
5262
+ }
5263
+ return `"${" ".repeat(whole.length - 2)}"`;
5264
+ });
5265
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
5266
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
5267
+ const place = (name, index, tail) => {
5268
+ if (tail || index >= rootEnd)
5269
+ nested.add(name);
5270
+ else
5271
+ top.add(name);
5272
+ };
5273
+ for (const entry of quoted)
5274
+ place(entry.name, entry.index, entry.tail);
5275
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
5276
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
5277
+ for (const match of identifiers) {
5278
+ const [, name, trailing] = match;
5279
+ if (trailing || reserved.has(name))
5280
+ continue;
5281
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
5282
+ }
5283
+ return {
5284
+ top: [...top],
5285
+ nested: [...nested].filter((name) => !top.has(name)),
5286
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
5287
+ };
5288
+ }
5289
+ function appearsBelowTopLevel(data, name) {
5290
+ let budget = 2000;
5291
+ const visit = (value, depth) => {
5292
+ if (budget-- <= 0 || depth > 4)
5293
+ return false;
5294
+ if (value === null || typeof value !== "object")
5295
+ return false;
5296
+ if (Array.isArray(value))
5297
+ return value.some((entry) => visit(entry, depth));
5298
+ const record = value;
5299
+ if (depth > 0 && Object.hasOwn(record, name))
5300
+ return true;
5301
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
5302
+ };
5303
+ return visit(data, 0);
5304
+ }
5305
+ function alwaysNullKeys(records) {
5306
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
5307
+ if (objects.length === 0 || objects.length !== records.length)
5308
+ return [];
5309
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
5310
+ if (keys.length === 0)
5311
+ return [];
5312
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
5313
+ return nullKeys.length === keys.length ? nullKeys : [];
5314
+ }
5315
+ function carriesOnlyNulls(value) {
5316
+ if (value === null)
5317
+ return true;
5318
+ if (Array.isArray(value)) {
5319
+ return value.length > 0 && value.every(carriesOnlyNulls);
5320
+ }
5321
+ if (typeof value === "object" && value !== undefined) {
5322
+ const values = Object.values(value);
5323
+ return values.length > 0 && values.every(carriesOnlyNulls);
5324
+ }
5325
+ return false;
5326
+ }
5327
+ function nameList(names, cap2 = 12) {
5328
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
5329
+ const rest = names.length - shown.length;
5330
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5331
+ }
5332
+ function buildFilterWarning(filter, data, outcome) {
5333
+ const present = availableFields(data);
5334
+ const refs = referencedFields(filter);
5335
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
5336
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
5337
+ const count = countRecords(data);
5338
+ const scope = `${count} record(s)`;
5339
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5340
+ 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" : "";
5341
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5342
+ let detail;
5343
+ let lede;
5344
+ if (outcome.kind === "null-elements") {
5345
+ lede = "returned only null values";
5346
+ const projected = `all ${outcome.count} of the elements it projected are null`;
5347
+ if (unknown.length > 0) {
5348
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5349
+ } else if (unchecked.length > 0) {
5350
+ detail = withSoundness(projected);
5351
+ } else {
5352
+ 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`;
5353
+ }
5354
+ } else if (outcome.kind === "null-rows") {
5355
+ lede = "returned only null values";
5356
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
5357
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
5358
+ } else if (outcome.kind === "null-values") {
5359
+ lede = "returned only null values";
5360
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
5361
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
5362
+ if (sameSet) {
5363
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
5364
+ } else if (unknown.length > 0) {
5365
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5366
+ } else {
5367
+ detail = withSoundness(`${projected} on all ${scope}`);
5368
+ }
5369
+ } else {
5370
+ lede = "returned nothing";
5371
+ if (unknown.length > 0) {
5372
+ detail = isNotAField(unknown);
5373
+ } else {
5374
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
5375
+ detail = withSoundness(`${selection} — it read ${scope}`);
5376
+ }
5377
+ }
5378
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
5379
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
5380
+ }
5381
+ function appendWarning(existing, note) {
5382
+ return existing ? `${existing} ${note}` : note;
5383
+ }
5384
+ function applyFilter(data, filter, onWarning) {
5041
5385
  const codec = requireJmespath();
5042
5386
  let result;
5043
5387
  try {
@@ -5045,9 +5389,34 @@ function applyFilter(data, filter) {
5045
5389
  } catch (err) {
5046
5390
  throw new FilterEvaluationError(filter, err);
5047
5391
  }
5048
- if (result == null)
5392
+ const inputCount = countRecords(data);
5393
+ const warn = (outcome) => {
5394
+ if (inputCount === 0)
5395
+ return;
5396
+ const note = buildFilterWarning(filter, data, outcome);
5397
+ getOutputSink().writeErr(`[WARN] ${note}
5398
+ `);
5399
+ onWarning?.(note);
5400
+ };
5401
+ const warnIfAllNull = (records) => {
5402
+ const keys = alwaysNullKeys(records);
5403
+ if (keys.length > 0)
5404
+ warn({ kind: "null-values", keys });
5405
+ };
5406
+ if (result == null) {
5407
+ warn({ kind: "empty" });
5049
5408
  return [];
5409
+ }
5050
5410
  if (Array.isArray(result)) {
5411
+ if (result.length === 0) {
5412
+ warn({ kind: "empty" });
5413
+ } else if (result.every((entry) => entry === null)) {
5414
+ warn({ kind: "null-elements", count: result.length });
5415
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
5416
+ warn({ kind: "null-rows", count: result.length });
5417
+ } else {
5418
+ warnIfAllNull(result);
5419
+ }
5051
5420
  if (result.length > 0 && typeof result[0] !== "object") {
5052
5421
  const fieldMatch = filter.match(/\.(\w+)$/);
5053
5422
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -5055,10 +5424,30 @@ function applyFilter(data, filter) {
5055
5424
  }
5056
5425
  return result;
5057
5426
  }
5058
- if (typeof result === "object")
5427
+ if (typeof result === "object") {
5428
+ warnIfAllNull([result]);
5059
5429
  return result;
5430
+ }
5060
5431
  return { Value: result };
5061
5432
  }
5433
+ function filterFailureData(envelope) {
5434
+ const filter = getOutputFilter();
5435
+ const data = envelope.Data;
5436
+ if (!filter || data == null)
5437
+ return;
5438
+ let note;
5439
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
5440
+ note = n;
5441
+ }));
5442
+ if (filterError) {
5443
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
5444
+ return;
5445
+ }
5446
+ envelope.Data = filtered;
5447
+ if (note) {
5448
+ envelope.Warning = appendWarning(envelope.Warning, note);
5449
+ }
5450
+ }
5062
5451
  function defaultErrorCodeForResult(result) {
5063
5452
  switch (result) {
5064
5453
  case RESULTS.AuthenticationError:
@@ -5102,7 +5491,7 @@ function defaultErrorCodeForHttpStatus(status) {
5102
5491
  return "server_error";
5103
5492
  return;
5104
5493
  }
5105
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
5494
+ var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
5106
5495
  function defaultErrorCodeForFailure(data) {
5107
5496
  if (data.Result === RESULTS.Failure) {
5108
5497
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
@@ -5141,8 +5530,14 @@ var OutputFormatter;
5141
5530
  }
5142
5531
  const filter = getOutputFilter();
5143
5532
  if (filter) {
5144
- const filtered = applyFilter(data.Data, filter);
5533
+ let note;
5534
+ const filtered = applyFilter(data.Data, filter, (n) => {
5535
+ note = n;
5536
+ });
5145
5537
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
5538
+ if (note) {
5539
+ data.Warning = appendWarning(data.Warning, note);
5540
+ }
5146
5541
  }
5147
5542
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
5148
5543
  }
@@ -5170,12 +5565,13 @@ var OutputFormatter;
5170
5565
  delete envelope.TelemetryErrorClass;
5171
5566
  delete envelope.TelemetryTerminalOutcome;
5172
5567
  delete envelope.TelemetryTerminalSignal;
5568
+ filterFailureData(envelope);
5173
5569
  if (!suppressTelemetry) {
5174
5570
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
5175
- result: data.Result,
5176
- errorCode: data.ErrorCode,
5177
- retry: data.Retry,
5178
- message: data.Message
5571
+ [ErrorDimensions.Result]: data.Result,
5572
+ [ErrorDimensions.ErrorCode]: data.ErrorCode,
5573
+ [ErrorDimensions.Retry]: data.Retry,
5574
+ [ErrorDimensions.ErrorMessage]: data.Message
5179
5575
  });
5180
5576
  }
5181
5577
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -5218,13 +5614,20 @@ var OutputFormatter;
5218
5614
  OutputFormatter.log = log;
5219
5615
  function formatToString(data) {
5220
5616
  const filter = getOutputFilter();
5617
+ const envelope = data;
5221
5618
  if ("Data" in data && data.Data != null) {
5222
5619
  data.Data = normalizeDataKeys(data.Data);
5223
5620
  if (filter) {
5224
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5621
+ let note;
5622
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5623
+ note = n;
5624
+ }));
5625
+ if (note) {
5626
+ envelope.Warning = appendWarning(envelope.Warning, note);
5627
+ }
5225
5628
  }
5226
5629
  }
5227
- const output = normalizeOutputKeys(data);
5630
+ const output = normalizeOutputKeys(envelope);
5228
5631
  const lines = [];
5229
5632
  const sink = getOutputSink();
5230
5633
  printOutput(output, getOutputFormat(), (msg) => {
@@ -5274,7 +5677,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
5274
5677
  var MAX_SKILL_NAME_LENGTH = 80;
5275
5678
  var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
5276
5679
  function productMode(productArea, mode) {
5277
- return { product_area: productArea, mode };
5680
+ return { ProductArea: productArea, Mode: mode };
5278
5681
  }
5279
5682
  function attributionRecord(groups) {
5280
5683
  const record = {};
@@ -5332,6 +5735,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
5332
5735
  ["rpa", "build", ["uip.rpa-legacy"]],
5333
5736
  ["conversational", "operate", ["uip.conversational"]],
5334
5737
  ["agents", "build", ["uip.codedagent", "uip.agent"]],
5738
+ ["coding-agents", "build", ["uip.coder"]],
5335
5739
  ["agenthub", "build", ["uip.agenthub"]],
5336
5740
  ["coded-apps", "build", ["uip.codedapp"]],
5337
5741
  ["functions", "build", ["uip.function", "uip.functions"]],
@@ -5417,32 +5821,64 @@ function normalizeSkillName(value) {
5417
5821
  function buildCommandTelemetryAttribution(commandPath, skillSource) {
5418
5822
  const skillName = normalizeSkillName(skillSource);
5419
5823
  return {
5420
- ...skillName ? { skill_name: skillName } : {},
5824
+ ...skillName ? { SkillName: skillName } : {},
5421
5825
  ...getCommandProductModeAttribution(commandPath)
5422
5826
  };
5423
5827
  }
5828
+ var AGENT_SESSION_ENV = {
5829
+ [BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
5830
+ [SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
5831
+ [SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
5832
+ [SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
5833
+ };
5834
+ var MAX_TELEMETRY_TOKEN_LENGTH = 120;
5835
+ function sanitizeTelemetryToken(value) {
5836
+ return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
5837
+ }
5838
+ function buildAgentSessionTelemetry(env) {
5839
+ const dimensions = {};
5840
+ for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
5841
+ const value = env[variable]?.trim();
5842
+ if (value) {
5843
+ dimensions[key] = sanitizeTelemetryToken(value);
5844
+ }
5845
+ }
5846
+ return dimensions;
5847
+ }
5424
5848
 
5425
5849
  // ../../common/src/telemetry/command-name.ts
5426
- var TELEMETRY_COMMAND_ROOT = "uip";
5850
+ var TELEMETRY_NAME_ROOT = "Cli";
5851
+ var CLI_COMMAND_ROOT = "uip";
5852
+ var TELEMETRY_NAME_BARE_ACTION = "Invoke";
5427
5853
  function commandTelemetryName(parts) {
5854
+ const action = vetCommandTokens(parts).map(pascalizeToken).join("");
5855
+ return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
5856
+ }
5857
+ function commandInvocationPath(parts) {
5858
+ return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
5859
+ }
5860
+ function vetCommandTokens(parts) {
5428
5861
  const tokens = [];
5429
5862
  for (const part of parts) {
5430
- const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
5863
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
5431
5864
  if (pieces.every(isCommandToken)) {
5432
5865
  tokens.push(...pieces);
5433
5866
  continue;
5434
5867
  }
5435
5868
  tokens.push(UNKNOWN_TOKEN);
5436
5869
  }
5437
- return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
5870
+ return tokens;
5438
5871
  }
5439
- var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
5872
+ function pascalizeToken(token) {
5873
+ return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
5874
+ }
5875
+ var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
5440
5876
  var MAX_COMMAND_TOKEN_LENGTH = 32;
5441
5877
  var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
5442
5878
  function isCommandToken(token) {
5443
- return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
5879
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
5444
5880
  }
5445
- var UNKNOWN_TOKEN = "<unknown>";
5881
+ var UNKNOWN_TOKEN = "unknown";
5446
5882
 
5447
5883
  // ../../common/src/telemetry/invocation-request.ts
5448
5884
  var requestContextSlot = singleton("TelemetryInvocationRequestContext");
@@ -5547,7 +5983,7 @@ function withheldArgumentValues(cmd) {
5547
5983
  });
5548
5984
  return values;
5549
5985
  }
5550
- function deriveCommandPath(cmd) {
5986
+ function deriveCommandParts(cmd) {
5551
5987
  const parts = [];
5552
5988
  let current = cmd;
5553
5989
  while (current) {
@@ -5560,14 +5996,13 @@ function deriveCommandPath(cmd) {
5560
5996
  if (parts.length > 1) {
5561
5997
  parts.shift();
5562
5998
  }
5563
- return commandTelemetryName(parts);
5999
+ return parts;
5564
6000
  }
5565
6001
  function isErrorContext(value) {
5566
6002
  return value !== null && typeof value === "object";
5567
6003
  }
5568
6004
  function commandHelpHint(commandPath) {
5569
- const command = commandPath.replace(/\./g, " ");
5570
- return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
6005
+ return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
5571
6006
  }
5572
6007
  function isPromptCancellation(error) {
5573
6008
  return error instanceof Error && error.name === "ExitPromptError";
@@ -5592,7 +6027,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5592
6027
  yaml: getOutputFormat() === "yaml",
5593
6028
  filter: getOutputFilter() !== undefined
5594
6029
  });
5595
- const telemetryName = deriveCommandPath(command);
6030
+ const commandParts = deriveCommandParts(command);
6031
+ const telemetryName = commandTelemetryName(commandParts);
6032
+ const commandPath = commandInvocationPath(commandParts);
5596
6033
  const props = typeof properties === "function" ? properties(...args) : properties;
5597
6034
  markCommandStart();
5598
6035
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
@@ -5627,7 +6064,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5627
6064
  Result: finalResult,
5628
6065
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
5629
6066
  Message: errorMessage,
5630
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
6067
+ Instructions: customInstructions ?? commandHelpHint(commandPath),
5631
6068
  ...customRetry ? { Retry: customRetry } : {},
5632
6069
  ...customContext ? { Context: customContext } : {}
5633
6070
  });
@@ -5644,8 +6081,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5644
6081
  recordedFailure,
5645
6082
  pollSignal: context.pollSignal
5646
6083
  });
5647
- if (terminalTelemetry.error_class === "internal" && error) {
5648
- telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
6084
+ if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
6085
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
5649
6086
  }
5650
6087
  const commandParams = extractCommandParams(command);
5651
6088
  if (props) {
@@ -5656,10 +6093,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5656
6093
  const baseProperties = redactProperties({
5657
6094
  ...commandParams,
5658
6095
  ...props,
5659
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
5660
- command: "true",
6096
+ ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
6097
+ ...buildAgentSessionTelemetry(process.env),
6098
+ [CommandDimensions.CommandName]: commandPath,
6099
+ [CommandDimensions.IsCommand]: "true",
5661
6100
  ...terminalTelemetry,
5662
- ...errorMessage ? { errorMessage } : {}
6101
+ ...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
5663
6102
  });
5664
6103
  emitInvocationRequest(telemetryName, success, baseProperties);
5665
6104
  } finally {
@@ -5891,6 +6330,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
5891
6330
  // ../../common/src/interactivity-context.ts
5892
6331
  var modeSlot = singleton("InteractivityMode");
5893
6332
  var interactiveFlagSlot = singleton("InteractiveFlag");
6333
+ // ../../common/src/mime-types.ts
6334
+ var MIME_TYPES_BY_EXTENSION = Object.freeze({
6335
+ pdf: "application/pdf",
6336
+ png: "image/png",
6337
+ jpg: "image/jpeg",
6338
+ jpeg: "image/jpeg",
6339
+ gif: "image/gif",
6340
+ webp: "image/webp",
6341
+ bmp: "image/bmp",
6342
+ tif: "image/tiff",
6343
+ tiff: "image/tiff",
6344
+ svg: "image/svg+xml",
6345
+ txt: "text/plain",
6346
+ log: "text/plain",
6347
+ md: "text/markdown",
6348
+ csv: "text/csv",
6349
+ tsv: "text/tab-separated-values",
6350
+ json: "application/json",
6351
+ xml: "application/xml",
6352
+ html: "text/html",
6353
+ htm: "text/html",
6354
+ yaml: "application/yaml",
6355
+ yml: "application/yaml",
6356
+ doc: "application/msword",
6357
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
6358
+ xls: "application/vnd.ms-excel",
6359
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
6360
+ ppt: "application/vnd.ms-powerpoint",
6361
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
6362
+ zip: "application/zip",
6363
+ mp3: "audio/mpeg",
6364
+ wav: "audio/wav",
6365
+ mp4: "video/mp4"
6366
+ });
5894
6367
  // ../../common/src/option-aliases.ts
5895
6368
  function resolveDeprecatedOptionAlias({
5896
6369
  preferredValue,
@@ -5976,6 +6449,7 @@ var ScreenLogger;
5976
6449
  })(ScreenLogger ||= {});
5977
6450
  // ../../common/src/sdk-user-agent.ts
5978
6451
  var USER_AGENT_HEADER = "User-Agent";
6452
+ var AGENT_PROPERTY = BaseDimensions.Agent;
5979
6453
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
5980
6454
  function userAgentPatchKey(userAgent) {
5981
6455
  return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
@@ -6306,7 +6780,7 @@ var package_default2 = {
6306
6780
  name: "@uipath/resourcecatalog-sdk",
6307
6781
  author: "UiPath",
6308
6782
  license: "SEE LICENSE IN LICENSE.txt",
6309
- version: "1.203.0",
6783
+ version: "1.204.0",
6310
6784
  description: "SDK for the UiPath Resource Catalog Service API.",
6311
6785
  repository: {
6312
6786
  type: "git",
@@ -6336,6 +6810,7 @@ var package_default2 = {
6336
6810
  private: true,
6337
6811
  scripts: {
6338
6812
  build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
6813
+ typecheck: "tsc --noEmit",
6339
6814
  generate: "bun run src/scripts/generate-sdk.ts",
6340
6815
  lint: "biome check ."
6341
6816
  },
@@ -8004,6 +8479,11 @@ var pickName = (claims) => {
8004
8479
  const username = asString(claims?.preferred_username);
8005
8480
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
8006
8481
  };
8482
+ var pickScopes = (claims) => {
8483
+ const raw = claims?.scope;
8484
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
8485
+ return scopes.length > 0 ? scopes : undefined;
8486
+ };
8007
8487
  var resolveSessionIdentity = (accessToken, authFlow) => {
8008
8488
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
8009
8489
  const email = pickEmail(claims);
@@ -8029,6 +8509,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
8029
8509
  identity.clientId = clientId;
8030
8510
  return identity;
8031
8511
  };
8512
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
8032
8513
 
8033
8514
  // ../../auth/src/envAuth.ts
8034
8515
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -8101,6 +8582,7 @@ var readAuthFromEnv = () => {
8101
8582
  const expiration = getTokenExpiration(accessToken);
8102
8583
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
8103
8584
  const identity = resolveSessionIdentity(accessToken);
8585
+ const scopes = readTokenScopes(accessToken);
8104
8586
  return {
8105
8587
  loginStatus,
8106
8588
  accessToken,
@@ -8111,7 +8593,8 @@ var readAuthFromEnv = () => {
8111
8593
  tenantId,
8112
8594
  expiration,
8113
8595
  source: "env-vars" /* EnvironmentVariables */,
8114
- ...identity ? { identity } : {}
8596
+ ...identity ? { identity } : {},
8597
+ ...scopes ? { scopes } : {}
8115
8598
  };
8116
8599
  };
8117
8600
 
@@ -8749,10 +9232,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
8749
9232
  }
8750
9233
  function identityFields(accessToken, credentials) {
8751
9234
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
8752
- return identity ? { identity } : {};
9235
+ const scopes = readTokenScopes(accessToken);
9236
+ return {
9237
+ ...identity ? { identity } : {},
9238
+ ...scopes ? { scopes } : {}
9239
+ };
8753
9240
  }
8754
9241
  function buildRobotStatus(robotCreds) {
8755
9242
  const identity = resolveSessionIdentity(robotCreds.accessToken);
9243
+ const scopes = readTokenScopes(robotCreds.accessToken);
8756
9244
  return {
8757
9245
  loginStatus: "Logged in",
8758
9246
  accessToken: robotCreds.accessToken,
@@ -8764,7 +9252,8 @@ function buildRobotStatus(robotCreds) {
8764
9252
  issuer: robotCreds.issuer,
8765
9253
  expiration: getTokenExpiration(robotCreds.accessToken),
8766
9254
  source: "robot" /* Robot */,
8767
- ...identity ? { identity } : {}
9255
+ ...identity ? { identity } : {},
9256
+ ...scopes ? { scopes } : {}
8768
9257
  };
8769
9258
  }
8770
9259
  var isFileNotFoundError = (error) => {
@@ -9277,4 +9766,4 @@ var registerCommands = async (program2) => {
9277
9766
 
9278
9767
  export { Command, metadata, registerCommands };
9279
9768
 
9280
- //# debugId=06C921B9DA7242AB64756E2164756E21
9769
+ //# debugId=F5B025781D437BAB64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-g2ac01zx.js";
4
+ } from "./tool-snvn8cgb.js";
5
5
  import"./tool-1de529jm.js";
6
6
  export {
7
7
  metadata,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/resourcecatalog-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.203",
5
+ "version": "1.204.0-preview.206",
6
6
  "description": "CLI plugin for the UiPath Resource Catalog Service.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "a10661bf5ec19ddd6c628ed7bb1db55f721a6027"
30
+ "gitHead": "ea7fd32a02acccf14e8e83522e69101430627b83"
31
31
  }