@uipath/identity-commands 1.203.0-preview.205 → 1.204.0-preview.206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +586 -97
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2864,9 +2864,60 @@ function settlePromiseLike(thenable) {
2864
2864
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2865
2865
  }
2866
2866
 
2867
+ // ../../common/src/error-graph.ts
2868
+ function* walkErrorGraph(error) {
2869
+ const queue = [error];
2870
+ const seen = new Set;
2871
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2872
+ const current = queue.shift();
2873
+ if (current === null || typeof current !== "object")
2874
+ continue;
2875
+ if (seen.has(current))
2876
+ continue;
2877
+ seen.add(current);
2878
+ const cur = current;
2879
+ yield cur;
2880
+ if (cur.cause !== undefined)
2881
+ queue.push(cur.cause);
2882
+ if (Array.isArray(cur.errors))
2883
+ queue.push(...cur.errors);
2884
+ }
2885
+ return;
2886
+ }
2887
+ function parseHttpStatusFromMessage(message) {
2888
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
2889
+ if (!match)
2890
+ return;
2891
+ const status = Number(match[1]);
2892
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
2893
+ }
2894
+ function findHttpStatusInGraph(error) {
2895
+ for (const node of walkErrorGraph(error)) {
2896
+ const response = node.response;
2897
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
2898
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
2899
+ return explicit;
2900
+ }
2901
+ if (typeof node.message === "string") {
2902
+ const parsed = parseHttpStatusFromMessage(node.message);
2903
+ if (parsed !== undefined && parsed >= 400) {
2904
+ return parsed;
2905
+ }
2906
+ }
2907
+ }
2908
+ return;
2909
+ }
2910
+
2911
+ // ../../common/src/local-permission-codes.ts
2912
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
2913
+ "EACCES",
2914
+ "EPERM",
2915
+ "EROFS"
2916
+ ]);
2917
+
2867
2918
  // ../../common/src/error-handler.ts
2868
- var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
2869
- var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
2919
+ 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.";
2920
+ 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.";
2870
2921
  var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
2871
2922
  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.";
2872
2923
  var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
@@ -2893,14 +2944,14 @@ var TLS_ERROR_CODES = new Set([
2893
2944
  ]);
2894
2945
  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.";
2895
2946
  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.";
2896
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2897
- var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2947
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
2898
2948
  function localPermissionInstructions(code, path2) {
2899
2949
  const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
2900
2950
  if (code === "EROFS") {
2901
2951
  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.";
2902
2952
  }
2903
- 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.";
2953
+ const onWindows = typeof process !== "undefined" && process.platform === "win32";
2954
+ 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.";
2904
2955
  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}`;
2905
2956
  }
2906
2957
  function describeConnectivityError(error) {
@@ -2954,48 +3005,6 @@ function localPermissionPath(path2, message) {
2954
3005
  return path2;
2955
3006
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2956
3007
  }
2957
- function* walkErrorGraph(error) {
2958
- const queue = [error];
2959
- const seen = new Set;
2960
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2961
- const current = queue.shift();
2962
- if (current === null || typeof current !== "object")
2963
- continue;
2964
- if (seen.has(current))
2965
- continue;
2966
- seen.add(current);
2967
- const cur = current;
2968
- yield cur;
2969
- if (cur.cause !== undefined)
2970
- queue.push(cur.cause);
2971
- if (Array.isArray(cur.errors))
2972
- queue.push(...cur.errors);
2973
- }
2974
- return;
2975
- }
2976
- function parseHttpStatusFromMessage(message) {
2977
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
2978
- if (!match)
2979
- return;
2980
- const status = Number(match[1]);
2981
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
2982
- }
2983
- function findHttpStatusInGraph(error) {
2984
- for (const node of walkErrorGraph(error)) {
2985
- const response = node.response;
2986
- const explicit = typeof node.status === "number" ? node.status : response?.status;
2987
- if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
2988
- return explicit;
2989
- }
2990
- if (typeof node.message === "string") {
2991
- const parsed = parseHttpStatusFromMessage(node.message);
2992
- if (parsed !== undefined && parsed >= 400) {
2993
- return parsed;
2994
- }
2995
- }
2996
- }
2997
- return;
2998
- }
2999
3008
  function isHtmlDocument(body) {
3000
3009
  return /^\s*(<!doctype html|<html\b)/i.test(body);
3001
3010
  }
@@ -3517,12 +3526,162 @@ function getOutputFilter() {
3517
3526
  return filterSlot.get();
3518
3527
  }
3519
3528
 
3529
+ // ../../common/src/telemetry/telemetry-dimensions.ts
3530
+ var BaseDimensions = {
3531
+ ApplicationName: "ApplicationName",
3532
+ ProductVersion: "ProductVersion",
3533
+ InstallationId: "InstallationId",
3534
+ CloudUserId: "CloudUserId",
3535
+ CloudTenantId: "CloudTenantId",
3536
+ CloudOrganizationId: "CloudOrganizationId",
3537
+ IsInternalUser: "IsInternalUser",
3538
+ Environment: "Environment",
3539
+ BaseUrl: "BaseUrl",
3540
+ Region: "Region",
3541
+ Agent: "Agent",
3542
+ AgentVersion: "AgentVersion",
3543
+ AgentModel: "AgentModel",
3544
+ ToolName: "ToolName",
3545
+ ToolVersion: "ToolVersion",
3546
+ ExecutionContext: "ExecutionContext",
3547
+ CiProvider: "CiProvider",
3548
+ SessionIdSource: "SessionIdSource",
3549
+ SessionId: "SessionId"
3550
+ };
3551
+ var CommandDimensions = {
3552
+ IsCommand: "IsCommand",
3553
+ IsReexec: "IsReexec",
3554
+ CommandName: "CommandName",
3555
+ ExitCode: "ExitCode",
3556
+ TerminalOutcome: "TerminalOutcome",
3557
+ ErrorClass: "ErrorClass",
3558
+ TerminalSignal: "TerminalSignal",
3559
+ ErrorMessage: "ErrorMessage",
3560
+ SkillName: "SkillName",
3561
+ ProductArea: "ProductArea",
3562
+ Mode: "Mode"
3563
+ };
3564
+ var ShipDimensions = {
3565
+ ShipKind: "ShipKind",
3566
+ Target: "Target",
3567
+ ProjectType: "ProjectType",
3568
+ ProjectTypes: "ProjectTypes",
3569
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
3570
+ PackageName: "PackageName",
3571
+ PackageVersion: "PackageVersion",
3572
+ PackageVersionKey: "PackageVersionKey",
3573
+ DeploymentKey: "DeploymentKey",
3574
+ SolutionId: "SolutionId",
3575
+ FolderKey: "FolderKey",
3576
+ FeedId: "FeedId"
3577
+ };
3578
+ var ErrorDimensions = {
3579
+ Result: "Result",
3580
+ ErrorCode: "ErrorCode",
3581
+ Retry: "Retry",
3582
+ ErrorMessage: "ErrorMessage"
3583
+ };
3584
+ var AuthDimensions = {
3585
+ AuthenticationMethod: "AuthenticationMethod",
3586
+ Success: "Success",
3587
+ Reason: "Reason"
3588
+ };
3589
+ var SkillsDimensions = {
3590
+ SchemaVersion: "SchemaVersion",
3591
+ AgentType: "AgentType",
3592
+ SkillsVersion: "SkillsVersion",
3593
+ UipSubcommand: "UipSubcommand",
3594
+ FileExtension: "FileExtension",
3595
+ SubagentModel: "SubagentModel",
3596
+ SubagentType: "SubagentType",
3597
+ PermissionMode: "PermissionMode",
3598
+ EffortLevel: "EffortLevel",
3599
+ SessionSource: "SessionSource",
3600
+ Outcome: "Outcome",
3601
+ DurationMs: "DurationMs",
3602
+ Source: "Source"
3603
+ };
3604
+ var PackagerDimensions = {
3605
+ ProjectId: "ProjectId",
3606
+ ProjectType: "ProjectType",
3607
+ SolutionId: "SolutionId"
3608
+ };
3609
+ var ScopeDimensions = {
3610
+ FolderId: "FolderId"
3611
+ };
3612
+ var ID_DIMENSIONS = new Set([
3613
+ BaseDimensions.CloudUserId,
3614
+ BaseDimensions.CloudTenantId,
3615
+ BaseDimensions.CloudOrganizationId,
3616
+ BaseDimensions.InstallationId,
3617
+ ShipDimensions.ArtifactCorrelationKey,
3618
+ ShipDimensions.PackageVersionKey,
3619
+ ShipDimensions.DeploymentKey,
3620
+ ShipDimensions.SolutionId,
3621
+ ShipDimensions.FolderKey,
3622
+ ShipDimensions.FeedId,
3623
+ PackagerDimensions.ProjectId
3624
+ ]);
3625
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
3626
+ var RESERVED_DIMENSION_NAMES = new Set([
3627
+ ...Object.values(BaseDimensions),
3628
+ ...Object.values(CommandDimensions),
3629
+ ...Object.values(ShipDimensions),
3630
+ ...Object.values(ErrorDimensions),
3631
+ ...Object.values(AuthDimensions),
3632
+ ...Object.values(SkillsDimensions),
3633
+ ...Object.values(PackagerDimensions),
3634
+ ...Object.values(ScopeDimensions)
3635
+ ]);
3636
+ var CURATED_DIMENSIONS = new Set([
3637
+ BaseDimensions.ApplicationName,
3638
+ BaseDimensions.ProductVersion,
3639
+ BaseDimensions.InstallationId,
3640
+ BaseDimensions.CloudUserId,
3641
+ BaseDimensions.CloudTenantId,
3642
+ BaseDimensions.CloudOrganizationId,
3643
+ BaseDimensions.IsInternalUser,
3644
+ BaseDimensions.Environment,
3645
+ BaseDimensions.BaseUrl,
3646
+ BaseDimensions.Region,
3647
+ BaseDimensions.Agent,
3648
+ BaseDimensions.AgentVersion,
3649
+ BaseDimensions.ToolVersion,
3650
+ BaseDimensions.ExecutionContext,
3651
+ BaseDimensions.CiProvider,
3652
+ BaseDimensions.SessionIdSource,
3653
+ BaseDimensions.SessionId,
3654
+ ...Object.values(CommandDimensions),
3655
+ ...Object.values(ShipDimensions)
3656
+ ]);
3657
+ function lowercaseIdDimensionValues(properties) {
3658
+ let changed = false;
3659
+ const result = {
3660
+ ...properties
3661
+ };
3662
+ for (const key of Object.keys(result)) {
3663
+ const value = result[key];
3664
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
3665
+ continue;
3666
+ }
3667
+ const lowered = value.toLowerCase();
3668
+ if (lowered !== value) {
3669
+ result[key] = lowered;
3670
+ changed = true;
3671
+ }
3672
+ }
3673
+ return changed ? result : properties;
3674
+ }
3675
+
3520
3676
  // ../../common/src/telemetry/command-terminal.ts
3521
3677
  var recordedFailureSlot = singleton("CommandTelemetryFailure");
3522
3678
  var AUTH_ERROR_CODES = new Set([
3523
3679
  "authentication_required",
3524
3680
  "permission_denied"
3525
3681
  ]);
3682
+ var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
3683
+ "local_permission_denied"
3684
+ ]);
3526
3685
  var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
3527
3686
  var NETWORK_HTTP_ERROR_CODES = new Set([
3528
3687
  "network_error",
@@ -3663,6 +3822,9 @@ function classifyFromErrorCode(errorCode) {
3663
3822
  if (AUTH_ERROR_CODES.has(errorCode)) {
3664
3823
  return "auth";
3665
3824
  }
3825
+ if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
3826
+ return "local_permission";
3827
+ }
3666
3828
  if (VALIDATION_ERROR_CODES.has(errorCode)) {
3667
3829
  return "validation";
3668
3830
  }
@@ -3674,6 +3836,15 @@ function classifyFromErrorCode(errorCode) {
3674
3836
  }
3675
3837
  return;
3676
3838
  }
3839
+ function hasLocalPermissionCode(error) {
3840
+ for (const node of walkErrorGraph(error)) {
3841
+ const code = node.code;
3842
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
3843
+ return true;
3844
+ }
3845
+ }
3846
+ return false;
3847
+ }
3677
3848
  function classifyFromError(error) {
3678
3849
  const code = findCodeInCauseChain(error);
3679
3850
  if (code) {
@@ -3690,6 +3861,9 @@ function classifyFromError(error) {
3690
3861
  return "missing_dependency";
3691
3862
  }
3692
3863
  }
3864
+ if (hasLocalPermissionCode(error)) {
3865
+ return "local_permission";
3866
+ }
3693
3867
  const message = stringField(error, "message");
3694
3868
  if (message?.includes("fetch failed") === true) {
3695
3869
  return "network_http";
@@ -3705,7 +3879,7 @@ function classifyError2(input) {
3705
3879
  if (recorded?.errorClass) {
3706
3880
  return recorded.errorClass;
3707
3881
  }
3708
- const status = recorded?.context?.httpStatus;
3882
+ const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
3709
3883
  if (status !== undefined) {
3710
3884
  return classifyHttpStatus(status);
3711
3885
  }
@@ -3728,17 +3902,18 @@ function buildCommandTerminalTelemetryProperties(input) {
3728
3902
  const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
3729
3903
  const terminalSignal = terminalSignalFor(input, outcome);
3730
3904
  return {
3731
- exit_code: input.exitCode,
3732
- terminal_outcome: outcome,
3733
- ...errorClass ? { error_class: errorClass } : {},
3734
- ...terminalSignal ? { terminal_signal: terminalSignal } : {}
3905
+ [CommandDimensions.ExitCode]: input.exitCode,
3906
+ [CommandDimensions.TerminalOutcome]: outcome,
3907
+ ...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
3908
+ ...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
3735
3909
  };
3736
3910
  }
3737
3911
 
3738
3912
  // ../../common/src/telemetry/telemetry-events.ts
3739
3913
  var CommonTelemetryEvents = {
3740
- Error: "uip.error",
3741
- ShipSucceeded: "uip.ship.succeeded"
3914
+ Start: "Application.Start",
3915
+ Error: "Application.Error",
3916
+ ShipSucceeded: "Cli.ShipSucceeded"
3742
3917
  };
3743
3918
 
3744
3919
  // ../../common/src/registry.ts
@@ -3946,8 +4121,8 @@ function detectExecutionContext(options = {}) {
3946
4121
  function getExecutionContextTelemetryProperties() {
3947
4122
  const detected = detectExecutionContext();
3948
4123
  return {
3949
- execution_context: detected.executionContext,
3950
- ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
4124
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
4125
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
3951
4126
  };
3952
4127
  }
3953
4128
  // ../../common/src/telemetry/node-context-storage.ts
@@ -3990,7 +4165,7 @@ function getInboundTraceContext() {
3990
4165
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
3991
4166
  var SESSION_ID_MAX_LENGTH = 64;
3992
4167
  var RANDOM_SESSION_ID_LENGTH = 32;
3993
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
4168
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
3994
4169
  var CONTROL_CHARACTERS = /\p{Cc}/gu;
3995
4170
  var INHERITED_SESSION_SOURCES = [
3996
4171
  { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
@@ -4042,6 +4217,9 @@ function resolveTelemetrySession() {
4042
4217
  telemetrySessionSlot.set(resolved);
4043
4218
  return resolved;
4044
4219
  }
4220
+ function getTelemetrySessionId() {
4221
+ return resolveTelemetrySession().id;
4222
+ }
4045
4223
  function getTelemetrySessionSource() {
4046
4224
  return resolveTelemetrySession().source;
4047
4225
  }
@@ -4122,7 +4300,10 @@ class TelemetryService {
4122
4300
  } catch (error) {
4123
4301
  const durationMs = clock.elapsedMs();
4124
4302
  const err = error instanceof Error ? error : new Error(String(error));
4125
- await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
4303
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
4304
+ ...properties,
4305
+ [CommandDimensions.ErrorMessage]: err.message
4306
+ }, context));
4126
4307
  throw error;
4127
4308
  }
4128
4309
  }
@@ -4193,7 +4374,10 @@ class TelemetryService {
4193
4374
  const durationMs = clock.elapsedMs();
4194
4375
  const err = error instanceof Error ? error : new Error(String(error));
4195
4376
  await this.telemetryProvider.trackDependency({
4196
- ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
4377
+ ...this.spanFor(name, durationMs, false, {
4378
+ ...properties,
4379
+ [CommandDimensions.ErrorMessage]: err.message
4380
+ }, childContext),
4197
4381
  type
4198
4382
  });
4199
4383
  throw error;
@@ -4228,9 +4412,10 @@ class TelemetryService {
4228
4412
  ...globalProperties,
4229
4413
  ...this.defaultProperties,
4230
4414
  ...redactProperties(properties ?? {}),
4231
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
4415
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
4416
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
4232
4417
  };
4233
- return enriched;
4418
+ return lowercaseIdDimensionValues(enriched);
4234
4419
  }
4235
4420
  generateId() {
4236
4421
  const bytes = new Uint8Array(8);
@@ -4991,7 +5176,165 @@ class FilterImplicitLimitError extends Error {
4991
5176
  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).";
4992
5177
  }
4993
5178
  }
4994
- function applyFilter(data, filter) {
5179
+ function countRecords(data) {
5180
+ if (Array.isArray(data))
5181
+ return data.length;
5182
+ return data == null ? 0 : 1;
5183
+ }
5184
+ function availableFields(data) {
5185
+ const records = Array.isArray(data) ? data : [data];
5186
+ const keys = new Set;
5187
+ for (const record of records) {
5188
+ if (record && typeof record === "object" && !Array.isArray(record)) {
5189
+ for (const key of Object.keys(record))
5190
+ keys.add(key);
5191
+ }
5192
+ }
5193
+ return [...keys];
5194
+ }
5195
+ function decodeQuotedIdentifier(whole, inner) {
5196
+ const [error, decoded] = catchError(() => JSON.parse(whole));
5197
+ if (!error && typeof decoded === "string")
5198
+ return decoded;
5199
+ return inner.replace(/\\(.)/g, "$1");
5200
+ }
5201
+ function referencedFields(filter) {
5202
+ const top = new Set;
5203
+ const nested = new Set;
5204
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
5205
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
5206
+ const quoted = [];
5207
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
5208
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
5209
+ if (!isAlias) {
5210
+ quoted.push({
5211
+ name: decodeQuotedIdentifier(whole, name),
5212
+ index,
5213
+ tail: isPathTail(withoutValueLiterals, index)
5214
+ });
5215
+ }
5216
+ return `"${" ".repeat(whole.length - 2)}"`;
5217
+ });
5218
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
5219
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
5220
+ const place = (name, index, tail) => {
5221
+ if (tail || index >= rootEnd)
5222
+ nested.add(name);
5223
+ else
5224
+ top.add(name);
5225
+ };
5226
+ for (const entry of quoted)
5227
+ place(entry.name, entry.index, entry.tail);
5228
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
5229
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
5230
+ for (const match of identifiers) {
5231
+ const [, name, trailing] = match;
5232
+ if (trailing || reserved.has(name))
5233
+ continue;
5234
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
5235
+ }
5236
+ return {
5237
+ top: [...top],
5238
+ nested: [...nested].filter((name) => !top.has(name)),
5239
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
5240
+ };
5241
+ }
5242
+ function appearsBelowTopLevel(data, name) {
5243
+ let budget = 2000;
5244
+ const visit = (value, depth) => {
5245
+ if (budget-- <= 0 || depth > 4)
5246
+ return false;
5247
+ if (value === null || typeof value !== "object")
5248
+ return false;
5249
+ if (Array.isArray(value))
5250
+ return value.some((entry) => visit(entry, depth));
5251
+ const record = value;
5252
+ if (depth > 0 && Object.hasOwn(record, name))
5253
+ return true;
5254
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
5255
+ };
5256
+ return visit(data, 0);
5257
+ }
5258
+ function alwaysNullKeys(records) {
5259
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
5260
+ if (objects.length === 0 || objects.length !== records.length)
5261
+ return [];
5262
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
5263
+ if (keys.length === 0)
5264
+ return [];
5265
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
5266
+ return nullKeys.length === keys.length ? nullKeys : [];
5267
+ }
5268
+ function carriesOnlyNulls(value) {
5269
+ if (value === null)
5270
+ return true;
5271
+ if (Array.isArray(value)) {
5272
+ return value.length > 0 && value.every(carriesOnlyNulls);
5273
+ }
5274
+ if (typeof value === "object" && value !== undefined) {
5275
+ const values = Object.values(value);
5276
+ return values.length > 0 && values.every(carriesOnlyNulls);
5277
+ }
5278
+ return false;
5279
+ }
5280
+ function nameList(names, cap2 = 12) {
5281
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
5282
+ const rest = names.length - shown.length;
5283
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5284
+ }
5285
+ function buildFilterWarning(filter, data, outcome) {
5286
+ const present = availableFields(data);
5287
+ const refs = referencedFields(filter);
5288
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
5289
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
5290
+ const count = countRecords(data);
5291
+ const scope = `${count} record(s)`;
5292
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5293
+ 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" : "";
5294
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5295
+ let detail;
5296
+ let lede;
5297
+ if (outcome.kind === "null-elements") {
5298
+ lede = "returned only null values";
5299
+ const projected = `all ${outcome.count} of the elements it projected are null`;
5300
+ if (unknown.length > 0) {
5301
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5302
+ } else if (unchecked.length > 0) {
5303
+ detail = withSoundness(projected);
5304
+ } else {
5305
+ 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`;
5306
+ }
5307
+ } else if (outcome.kind === "null-rows") {
5308
+ lede = "returned only null values";
5309
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
5310
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
5311
+ } else if (outcome.kind === "null-values") {
5312
+ lede = "returned only null values";
5313
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
5314
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
5315
+ if (sameSet) {
5316
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
5317
+ } else if (unknown.length > 0) {
5318
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5319
+ } else {
5320
+ detail = withSoundness(`${projected} on all ${scope}`);
5321
+ }
5322
+ } else {
5323
+ lede = "returned nothing";
5324
+ if (unknown.length > 0) {
5325
+ detail = isNotAField(unknown);
5326
+ } else {
5327
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
5328
+ detail = withSoundness(`${selection} — it read ${scope}`);
5329
+ }
5330
+ }
5331
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
5332
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
5333
+ }
5334
+ function appendWarning(existing, note) {
5335
+ return existing ? `${existing} ${note}` : note;
5336
+ }
5337
+ function applyFilter(data, filter, onWarning) {
4995
5338
  const codec = requireJmespath();
4996
5339
  let result;
4997
5340
  try {
@@ -4999,9 +5342,34 @@ function applyFilter(data, filter) {
4999
5342
  } catch (err) {
5000
5343
  throw new FilterEvaluationError(filter, err);
5001
5344
  }
5002
- if (result == null)
5345
+ const inputCount = countRecords(data);
5346
+ const warn = (outcome) => {
5347
+ if (inputCount === 0)
5348
+ return;
5349
+ const note = buildFilterWarning(filter, data, outcome);
5350
+ getOutputSink().writeErr(`[WARN] ${note}
5351
+ `);
5352
+ onWarning?.(note);
5353
+ };
5354
+ const warnIfAllNull = (records) => {
5355
+ const keys = alwaysNullKeys(records);
5356
+ if (keys.length > 0)
5357
+ warn({ kind: "null-values", keys });
5358
+ };
5359
+ if (result == null) {
5360
+ warn({ kind: "empty" });
5003
5361
  return [];
5362
+ }
5004
5363
  if (Array.isArray(result)) {
5364
+ if (result.length === 0) {
5365
+ warn({ kind: "empty" });
5366
+ } else if (result.every((entry) => entry === null)) {
5367
+ warn({ kind: "null-elements", count: result.length });
5368
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
5369
+ warn({ kind: "null-rows", count: result.length });
5370
+ } else {
5371
+ warnIfAllNull(result);
5372
+ }
5005
5373
  if (result.length > 0 && typeof result[0] !== "object") {
5006
5374
  const fieldMatch = filter.match(/\.(\w+)$/);
5007
5375
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -5009,10 +5377,30 @@ function applyFilter(data, filter) {
5009
5377
  }
5010
5378
  return result;
5011
5379
  }
5012
- if (typeof result === "object")
5380
+ if (typeof result === "object") {
5381
+ warnIfAllNull([result]);
5013
5382
  return result;
5383
+ }
5014
5384
  return { Value: result };
5015
5385
  }
5386
+ function filterFailureData(envelope) {
5387
+ const filter = getOutputFilter();
5388
+ const data = envelope.Data;
5389
+ if (!filter || data == null)
5390
+ return;
5391
+ let note;
5392
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
5393
+ note = n;
5394
+ }));
5395
+ if (filterError) {
5396
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
5397
+ return;
5398
+ }
5399
+ envelope.Data = filtered;
5400
+ if (note) {
5401
+ envelope.Warning = appendWarning(envelope.Warning, note);
5402
+ }
5403
+ }
5016
5404
  function defaultErrorCodeForResult(result) {
5017
5405
  switch (result) {
5018
5406
  case RESULTS.AuthenticationError:
@@ -5056,7 +5444,7 @@ function defaultErrorCodeForHttpStatus(status) {
5056
5444
  return "server_error";
5057
5445
  return;
5058
5446
  }
5059
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
5447
+ var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
5060
5448
  function defaultErrorCodeForFailure(data) {
5061
5449
  if (data.Result === RESULTS.Failure) {
5062
5450
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
@@ -5095,8 +5483,14 @@ var OutputFormatter;
5095
5483
  }
5096
5484
  const filter = getOutputFilter();
5097
5485
  if (filter) {
5098
- const filtered = applyFilter(data.Data, filter);
5486
+ let note;
5487
+ const filtered = applyFilter(data.Data, filter, (n) => {
5488
+ note = n;
5489
+ });
5099
5490
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
5491
+ if (note) {
5492
+ data.Warning = appendWarning(data.Warning, note);
5493
+ }
5100
5494
  }
5101
5495
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
5102
5496
  }
@@ -5124,12 +5518,13 @@ var OutputFormatter;
5124
5518
  delete envelope.TelemetryErrorClass;
5125
5519
  delete envelope.TelemetryTerminalOutcome;
5126
5520
  delete envelope.TelemetryTerminalSignal;
5521
+ filterFailureData(envelope);
5127
5522
  if (!suppressTelemetry) {
5128
5523
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
5129
- result: data.Result,
5130
- errorCode: data.ErrorCode,
5131
- retry: data.Retry,
5132
- message: data.Message
5524
+ [ErrorDimensions.Result]: data.Result,
5525
+ [ErrorDimensions.ErrorCode]: data.ErrorCode,
5526
+ [ErrorDimensions.Retry]: data.Retry,
5527
+ [ErrorDimensions.ErrorMessage]: data.Message
5133
5528
  });
5134
5529
  }
5135
5530
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -5172,13 +5567,20 @@ var OutputFormatter;
5172
5567
  OutputFormatter.log = log;
5173
5568
  function formatToString(data) {
5174
5569
  const filter = getOutputFilter();
5570
+ const envelope = data;
5175
5571
  if ("Data" in data && data.Data != null) {
5176
5572
  data.Data = normalizeDataKeys(data.Data);
5177
5573
  if (filter) {
5178
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5574
+ let note;
5575
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5576
+ note = n;
5577
+ }));
5578
+ if (note) {
5579
+ envelope.Warning = appendWarning(envelope.Warning, note);
5580
+ }
5179
5581
  }
5180
5582
  }
5181
- const output = normalizeOutputKeys(data);
5583
+ const output = normalizeOutputKeys(envelope);
5182
5584
  const lines = [];
5183
5585
  const sink = getOutputSink();
5184
5586
  printOutput(output, getOutputFormat(), (msg) => {
@@ -5228,7 +5630,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
5228
5630
  var MAX_SKILL_NAME_LENGTH = 80;
5229
5631
  var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
5230
5632
  function productMode(productArea, mode) {
5231
- return { product_area: productArea, mode };
5633
+ return { ProductArea: productArea, Mode: mode };
5232
5634
  }
5233
5635
  function attributionRecord(groups) {
5234
5636
  const record = {};
@@ -5286,6 +5688,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
5286
5688
  ["rpa", "build", ["uip.rpa-legacy"]],
5287
5689
  ["conversational", "operate", ["uip.conversational"]],
5288
5690
  ["agents", "build", ["uip.codedagent", "uip.agent"]],
5691
+ ["coding-agents", "build", ["uip.coder"]],
5289
5692
  ["agenthub", "build", ["uip.agenthub"]],
5290
5693
  ["coded-apps", "build", ["uip.codedapp"]],
5291
5694
  ["functions", "build", ["uip.function", "uip.functions"]],
@@ -5371,32 +5774,64 @@ function normalizeSkillName(value) {
5371
5774
  function buildCommandTelemetryAttribution(commandPath, skillSource) {
5372
5775
  const skillName = normalizeSkillName(skillSource);
5373
5776
  return {
5374
- ...skillName ? { skill_name: skillName } : {},
5777
+ ...skillName ? { SkillName: skillName } : {},
5375
5778
  ...getCommandProductModeAttribution(commandPath)
5376
5779
  };
5377
5780
  }
5781
+ var AGENT_SESSION_ENV = {
5782
+ [BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
5783
+ [SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
5784
+ [SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
5785
+ [SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
5786
+ };
5787
+ var MAX_TELEMETRY_TOKEN_LENGTH = 120;
5788
+ function sanitizeTelemetryToken(value) {
5789
+ return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
5790
+ }
5791
+ function buildAgentSessionTelemetry(env) {
5792
+ const dimensions = {};
5793
+ for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
5794
+ const value = env[variable]?.trim();
5795
+ if (value) {
5796
+ dimensions[key] = sanitizeTelemetryToken(value);
5797
+ }
5798
+ }
5799
+ return dimensions;
5800
+ }
5378
5801
 
5379
5802
  // ../../common/src/telemetry/command-name.ts
5380
- var TELEMETRY_COMMAND_ROOT = "uip";
5803
+ var TELEMETRY_NAME_ROOT = "Cli";
5804
+ var CLI_COMMAND_ROOT = "uip";
5805
+ var TELEMETRY_NAME_BARE_ACTION = "Invoke";
5381
5806
  function commandTelemetryName(parts) {
5807
+ const action = vetCommandTokens(parts).map(pascalizeToken).join("");
5808
+ return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
5809
+ }
5810
+ function commandInvocationPath(parts) {
5811
+ return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
5812
+ }
5813
+ function vetCommandTokens(parts) {
5382
5814
  const tokens = [];
5383
5815
  for (const part of parts) {
5384
- const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
5816
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
5385
5817
  if (pieces.every(isCommandToken)) {
5386
5818
  tokens.push(...pieces);
5387
5819
  continue;
5388
5820
  }
5389
5821
  tokens.push(UNKNOWN_TOKEN);
5390
5822
  }
5391
- return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
5823
+ return tokens;
5824
+ }
5825
+ function pascalizeToken(token) {
5826
+ return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
5392
5827
  }
5393
- var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
5828
+ var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
5394
5829
  var MAX_COMMAND_TOKEN_LENGTH = 32;
5395
5830
  var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
5396
5831
  function isCommandToken(token) {
5397
- return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
5832
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
5398
5833
  }
5399
- var UNKNOWN_TOKEN = "<unknown>";
5834
+ var UNKNOWN_TOKEN = "unknown";
5400
5835
 
5401
5836
  // ../../common/src/telemetry/invocation-request.ts
5402
5837
  var requestContextSlot = singleton("TelemetryInvocationRequestContext");
@@ -5501,7 +5936,7 @@ function withheldArgumentValues(cmd) {
5501
5936
  });
5502
5937
  return values;
5503
5938
  }
5504
- function deriveCommandPath(cmd) {
5939
+ function deriveCommandParts(cmd) {
5505
5940
  const parts = [];
5506
5941
  let current = cmd;
5507
5942
  while (current) {
@@ -5514,14 +5949,13 @@ function deriveCommandPath(cmd) {
5514
5949
  if (parts.length > 1) {
5515
5950
  parts.shift();
5516
5951
  }
5517
- return commandTelemetryName(parts);
5952
+ return parts;
5518
5953
  }
5519
5954
  function isErrorContext(value) {
5520
5955
  return value !== null && typeof value === "object";
5521
5956
  }
5522
5957
  function commandHelpHint(commandPath) {
5523
- const command = commandPath.replace(/\./g, " ");
5524
- return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
5958
+ return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
5525
5959
  }
5526
5960
  function isPromptCancellation(error) {
5527
5961
  return error instanceof Error && error.name === "ExitPromptError";
@@ -5546,7 +5980,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5546
5980
  yaml: getOutputFormat() === "yaml",
5547
5981
  filter: getOutputFilter() !== undefined
5548
5982
  });
5549
- const telemetryName = deriveCommandPath(command);
5983
+ const commandParts = deriveCommandParts(command);
5984
+ const telemetryName = commandTelemetryName(commandParts);
5985
+ const commandPath = commandInvocationPath(commandParts);
5550
5986
  const props = typeof properties === "function" ? properties(...args) : properties;
5551
5987
  markCommandStart();
5552
5988
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
@@ -5581,7 +6017,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5581
6017
  Result: finalResult,
5582
6018
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
5583
6019
  Message: errorMessage,
5584
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
6020
+ Instructions: customInstructions ?? commandHelpHint(commandPath),
5585
6021
  ...customRetry ? { Retry: customRetry } : {},
5586
6022
  ...customContext ? { Context: customContext } : {}
5587
6023
  });
@@ -5598,8 +6034,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5598
6034
  recordedFailure,
5599
6035
  pollSignal: context.pollSignal
5600
6036
  });
5601
- if (terminalTelemetry.error_class === "internal" && error) {
5602
- telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
6037
+ if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
6038
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
5603
6039
  }
5604
6040
  const commandParams = extractCommandParams(command);
5605
6041
  if (props) {
@@ -5610,10 +6046,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5610
6046
  const baseProperties = redactProperties({
5611
6047
  ...commandParams,
5612
6048
  ...props,
5613
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
5614
- command: "true",
6049
+ ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
6050
+ ...buildAgentSessionTelemetry(process.env),
6051
+ [CommandDimensions.CommandName]: commandPath,
6052
+ [CommandDimensions.IsCommand]: "true",
5615
6053
  ...terminalTelemetry,
5616
- ...errorMessage ? { errorMessage } : {}
6054
+ ...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
5617
6055
  });
5618
6056
  emitInvocationRequest(telemetryName, success, baseProperties);
5619
6057
  } finally {
@@ -5845,6 +6283,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
5845
6283
  // ../../common/src/interactivity-context.ts
5846
6284
  var modeSlot = singleton("InteractivityMode");
5847
6285
  var interactiveFlagSlot = singleton("InteractiveFlag");
6286
+ // ../../common/src/mime-types.ts
6287
+ var MIME_TYPES_BY_EXTENSION = Object.freeze({
6288
+ pdf: "application/pdf",
6289
+ png: "image/png",
6290
+ jpg: "image/jpeg",
6291
+ jpeg: "image/jpeg",
6292
+ gif: "image/gif",
6293
+ webp: "image/webp",
6294
+ bmp: "image/bmp",
6295
+ tif: "image/tiff",
6296
+ tiff: "image/tiff",
6297
+ svg: "image/svg+xml",
6298
+ txt: "text/plain",
6299
+ log: "text/plain",
6300
+ md: "text/markdown",
6301
+ csv: "text/csv",
6302
+ tsv: "text/tab-separated-values",
6303
+ json: "application/json",
6304
+ xml: "application/xml",
6305
+ html: "text/html",
6306
+ htm: "text/html",
6307
+ yaml: "application/yaml",
6308
+ yml: "application/yaml",
6309
+ doc: "application/msword",
6310
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
6311
+ xls: "application/vnd.ms-excel",
6312
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
6313
+ ppt: "application/vnd.ms-powerpoint",
6314
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
6315
+ zip: "application/zip",
6316
+ mp3: "audio/mpeg",
6317
+ wav: "audio/wav",
6318
+ mp4: "video/mp4"
6319
+ });
5848
6320
  // ../../common/src/option-validators.ts
5849
6321
  function splitScopeList(raw) {
5850
6322
  if (!raw)
@@ -5896,6 +6368,7 @@ var ScreenLogger;
5896
6368
  })(ScreenLogger ||= {});
5897
6369
  // ../../common/src/sdk-user-agent.ts
5898
6370
  var USER_AGENT_HEADER = "User-Agent";
6371
+ var AGENT_PROPERTY = BaseDimensions.Agent;
5899
6372
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
5900
6373
  function userAgentPatchKey(userAgent) {
5901
6374
  return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
@@ -6235,7 +6708,7 @@ var package_default = {
6235
6708
  name: "@uipath/identity-sdk",
6236
6709
  author: "UiPath",
6237
6710
  license: "SEE LICENSE IN LICENSE.txt",
6238
- version: "1.203.0",
6711
+ version: "1.204.0",
6239
6712
  repository: {
6240
6713
  type: "git",
6241
6714
  url: "https://github.com/UiPath/cli.git",
@@ -6264,6 +6737,7 @@ var package_default = {
6264
6737
  private: true,
6265
6738
  scripts: {
6266
6739
  build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
6740
+ typecheck: "tsc --noEmit",
6267
6741
  generate: "bun run src/scripts/generate-sdk.ts",
6268
6742
  lint: "biome check .",
6269
6743
  test: "vitest run",
@@ -9101,6 +9575,11 @@ var pickName = (claims) => {
9101
9575
  const username = asString(claims?.preferred_username);
9102
9576
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
9103
9577
  };
9578
+ var pickScopes = (claims) => {
9579
+ const raw = claims?.scope;
9580
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
9581
+ return scopes.length > 0 ? scopes : undefined;
9582
+ };
9104
9583
  var resolveSessionIdentity = (accessToken, authFlow) => {
9105
9584
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
9106
9585
  const email = pickEmail(claims);
@@ -9126,6 +9605,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
9126
9605
  identity.clientId = clientId;
9127
9606
  return identity;
9128
9607
  };
9608
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
9129
9609
 
9130
9610
  // ../../auth/src/envAuth.ts
9131
9611
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -9198,6 +9678,7 @@ var readAuthFromEnv = () => {
9198
9678
  const expiration = getTokenExpiration(accessToken);
9199
9679
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
9200
9680
  const identity = resolveSessionIdentity(accessToken);
9681
+ const scopes = readTokenScopes(accessToken);
9201
9682
  return {
9202
9683
  loginStatus,
9203
9684
  accessToken,
@@ -9208,7 +9689,8 @@ var readAuthFromEnv = () => {
9208
9689
  tenantId,
9209
9690
  expiration,
9210
9691
  source: "env-vars" /* EnvironmentVariables */,
9211
- ...identity ? { identity } : {}
9692
+ ...identity ? { identity } : {},
9693
+ ...scopes ? { scopes } : {}
9212
9694
  };
9213
9695
  };
9214
9696
 
@@ -9846,10 +10328,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
9846
10328
  }
9847
10329
  function identityFields(accessToken, credentials) {
9848
10330
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
9849
- return identity ? { identity } : {};
10331
+ const scopes = readTokenScopes(accessToken);
10332
+ return {
10333
+ ...identity ? { identity } : {},
10334
+ ...scopes ? { scopes } : {}
10335
+ };
9850
10336
  }
9851
10337
  function buildRobotStatus(robotCreds) {
9852
10338
  const identity = resolveSessionIdentity(robotCreds.accessToken);
10339
+ const scopes = readTokenScopes(robotCreds.accessToken);
9853
10340
  return {
9854
10341
  loginStatus: "Logged in",
9855
10342
  accessToken: robotCreds.accessToken,
@@ -9861,7 +10348,8 @@ function buildRobotStatus(robotCreds) {
9861
10348
  issuer: robotCreds.issuer,
9862
10349
  expiration: getTokenExpiration(robotCreds.accessToken),
9863
10350
  source: "robot" /* Robot */,
9864
- ...identity ? { identity } : {}
10351
+ ...identity ? { identity } : {},
10352
+ ...scopes ? { scopes } : {}
9865
10353
  };
9866
10354
  }
9867
10355
  var isFileNotFoundError = (error) => {
@@ -10128,7 +10616,8 @@ var getAuthContext = async (options = {}) => {
10128
10616
  organizationId: status.organizationId,
10129
10617
  organizationName: status.organizationName,
10130
10618
  tenantId: status.tenantId,
10131
- tenantName
10619
+ tenantName,
10620
+ identity: status.identity
10132
10621
  };
10133
10622
  };
10134
10623
  // ../../auth/src/tenantSelection.ts
@@ -12517,4 +13006,4 @@ export {
12517
13006
  registerCommands
12518
13007
  };
12519
13008
 
12520
- //# debugId=3920CFCAD024B24E64756E2164756E21
13009
+ //# debugId=D34519147811041B64756E2164756E21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/identity-commands",
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": "Admin CLI commands for Identity Server users, groups, robot accounts, and external apps. Library composed by admin-tool, not a standalone CLI tool.",
7
7
  "private": false,
8
8
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
- "gitHead": "d8d19829030cc590c630bebfc60a9d9fc7fa8c31"
29
+ "gitHead": "ea7fd32a02acccf14e8e83522e69101430627b83"
30
30
  }