@uipath/agent-sdk 1.203.0-preview.212 → 1.204.0-preview.211

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 +151 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -971,8 +971,137 @@ function singleton(ctorOrName) {
971
971
  // ../common/src/telemetry/global-telemetry-properties.ts
972
972
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
973
973
 
974
+ // ../common/src/telemetry/telemetry-dimensions.ts
975
+ var BaseDimensions = {
976
+ ApplicationName: "ApplicationName",
977
+ ProductVersion: "ProductVersion",
978
+ InstallationId: "InstallationId",
979
+ CloudUserId: "CloudUserId",
980
+ CloudTenantId: "CloudTenantId",
981
+ CloudOrganizationId: "CloudOrganizationId",
982
+ IsInternalUser: "IsInternalUser",
983
+ Environment: "Environment",
984
+ BaseUrl: "BaseUrl",
985
+ Region: "Region",
986
+ Agent: "Agent",
987
+ AgentVersion: "AgentVersion",
988
+ AgentModel: "AgentModel",
989
+ ToolName: "ToolName",
990
+ ToolVersion: "ToolVersion",
991
+ ExecutionContext: "ExecutionContext",
992
+ CiProvider: "CiProvider",
993
+ SessionIdSource: "SessionIdSource",
994
+ SessionId: "SessionId"
995
+ };
996
+ var CommandDimensions = {
997
+ IsCommand: "IsCommand",
998
+ IsReexec: "IsReexec",
999
+ CommandName: "CommandName",
1000
+ ExitCode: "ExitCode",
1001
+ TerminalOutcome: "TerminalOutcome",
1002
+ ErrorClass: "ErrorClass",
1003
+ TerminalSignal: "TerminalSignal",
1004
+ ErrorMessage: "ErrorMessage",
1005
+ SkillName: "SkillName",
1006
+ ProductArea: "ProductArea",
1007
+ Mode: "Mode"
1008
+ };
1009
+ var ShipDimensions = {
1010
+ ShipKind: "ShipKind",
1011
+ Target: "Target",
1012
+ ProjectType: "ProjectType",
1013
+ ProjectTypes: "ProjectTypes",
1014
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
1015
+ PackageName: "PackageName",
1016
+ PackageVersion: "PackageVersion",
1017
+ PackageVersionKey: "PackageVersionKey",
1018
+ DeploymentKey: "DeploymentKey",
1019
+ SolutionId: "SolutionId",
1020
+ FolderKey: "FolderKey",
1021
+ FeedId: "FeedId"
1022
+ };
1023
+ var ErrorDimensions = {
1024
+ Result: "Result",
1025
+ ErrorCode: "ErrorCode",
1026
+ Retry: "Retry",
1027
+ ErrorMessage: "ErrorMessage"
1028
+ };
1029
+ var AuthDimensions = {
1030
+ AuthenticationMethod: "AuthenticationMethod",
1031
+ Success: "Success",
1032
+ Reason: "Reason"
1033
+ };
1034
+ var SkillsDimensions = {
1035
+ SchemaVersion: "SchemaVersion",
1036
+ AgentType: "AgentType",
1037
+ SkillsVersion: "SkillsVersion",
1038
+ UipSubcommand: "UipSubcommand",
1039
+ FileExtension: "FileExtension",
1040
+ SubagentModel: "SubagentModel",
1041
+ SubagentType: "SubagentType",
1042
+ PermissionMode: "PermissionMode",
1043
+ EffortLevel: "EffortLevel",
1044
+ SessionSource: "SessionSource",
1045
+ Outcome: "Outcome",
1046
+ DurationMs: "DurationMs",
1047
+ Source: "Source"
1048
+ };
1049
+ var PackagerDimensions = {
1050
+ ProjectId: "ProjectId",
1051
+ ProjectType: "ProjectType",
1052
+ SolutionId: "SolutionId"
1053
+ };
1054
+ var ScopeDimensions = {
1055
+ FolderId: "FolderId"
1056
+ };
1057
+ var ID_DIMENSIONS = new Set([
1058
+ BaseDimensions.CloudUserId,
1059
+ BaseDimensions.CloudTenantId,
1060
+ BaseDimensions.CloudOrganizationId,
1061
+ BaseDimensions.InstallationId,
1062
+ ShipDimensions.ArtifactCorrelationKey,
1063
+ ShipDimensions.PackageVersionKey,
1064
+ ShipDimensions.DeploymentKey,
1065
+ ShipDimensions.SolutionId,
1066
+ ShipDimensions.FolderKey,
1067
+ ShipDimensions.FeedId,
1068
+ PackagerDimensions.ProjectId
1069
+ ]);
1070
+ var RESERVED_DIMENSION_NAMES = new Set([
1071
+ ...Object.values(BaseDimensions),
1072
+ ...Object.values(CommandDimensions),
1073
+ ...Object.values(ShipDimensions),
1074
+ ...Object.values(ErrorDimensions),
1075
+ ...Object.values(AuthDimensions),
1076
+ ...Object.values(SkillsDimensions),
1077
+ ...Object.values(PackagerDimensions),
1078
+ ...Object.values(ScopeDimensions)
1079
+ ]);
1080
+ var CURATED_DIMENSIONS = new Set([
1081
+ BaseDimensions.ApplicationName,
1082
+ BaseDimensions.ProductVersion,
1083
+ BaseDimensions.InstallationId,
1084
+ BaseDimensions.CloudUserId,
1085
+ BaseDimensions.CloudTenantId,
1086
+ BaseDimensions.CloudOrganizationId,
1087
+ BaseDimensions.IsInternalUser,
1088
+ BaseDimensions.Environment,
1089
+ BaseDimensions.BaseUrl,
1090
+ BaseDimensions.Region,
1091
+ BaseDimensions.Agent,
1092
+ BaseDimensions.AgentVersion,
1093
+ BaseDimensions.ToolVersion,
1094
+ BaseDimensions.ExecutionContext,
1095
+ BaseDimensions.CiProvider,
1096
+ BaseDimensions.SessionIdSource,
1097
+ BaseDimensions.SessionId,
1098
+ ...Object.values(CommandDimensions),
1099
+ ...Object.values(ShipDimensions)
1100
+ ]);
1101
+
974
1102
  // ../common/src/sdk-user-agent.ts
975
1103
  var USER_AGENT_HEADER = "User-Agent";
1104
+ var AGENT_PROPERTY = BaseDimensions.Agent;
976
1105
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
977
1106
  function userAgentPatchKey(userAgent) {
978
1107
  return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
@@ -1358,7 +1487,7 @@ var package_default = {
1358
1487
  name: "@uipath/agent-sdk",
1359
1488
  author: "UiPath",
1360
1489
  license: "SEE LICENSE IN LICENSE.txt",
1361
- version: "1.203.0-preview.212",
1490
+ version: "1.204.0-preview.211",
1362
1491
  description: "SDK for the UiPath Agent Runtime API — evaluation execution and debug sessions.",
1363
1492
  repository: {
1364
1493
  type: "git",
@@ -1388,6 +1517,7 @@ var package_default = {
1388
1517
  ],
1389
1518
  scripts: {
1390
1519
  build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
1520
+ typecheck: "tsc --noEmit",
1391
1521
  generate: "bun run src/scripts/generate-sdk.ts",
1392
1522
  test: "vitest run",
1393
1523
  "test:coverage": "vitest run --coverage",
@@ -4624,6 +4754,11 @@ var pickName = (claims) => {
4624
4754
  const username = asString(claims?.preferred_username);
4625
4755
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
4626
4756
  };
4757
+ var pickScopes = (claims) => {
4758
+ const raw = claims?.scope;
4759
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
4760
+ return scopes.length > 0 ? scopes : undefined;
4761
+ };
4627
4762
  var resolveSessionIdentity = (accessToken, authFlow) => {
4628
4763
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
4629
4764
  const email = pickEmail(claims);
@@ -4649,6 +4784,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
4649
4784
  identity.clientId = clientId;
4650
4785
  return identity;
4651
4786
  };
4787
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
4652
4788
 
4653
4789
  // ../auth/src/envAuth.ts
4654
4790
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -4721,6 +4857,7 @@ var readAuthFromEnv = () => {
4721
4857
  const expiration = getTokenExpiration(accessToken);
4722
4858
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
4723
4859
  const identity = resolveSessionIdentity(accessToken);
4860
+ const scopes = readTokenScopes(accessToken);
4724
4861
  return {
4725
4862
  loginStatus,
4726
4863
  accessToken,
@@ -4731,7 +4868,8 @@ var readAuthFromEnv = () => {
4731
4868
  tenantId,
4732
4869
  expiration,
4733
4870
  source: "env-vars" /* EnvironmentVariables */,
4734
- ...identity ? { identity } : {}
4871
+ ...identity ? { identity } : {},
4872
+ ...scopes ? { scopes } : {}
4735
4873
  };
4736
4874
  };
4737
4875
 
@@ -5373,10 +5511,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
5373
5511
  }
5374
5512
  function identityFields(accessToken, credentials) {
5375
5513
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
5376
- return identity ? { identity } : {};
5514
+ const scopes = readTokenScopes(accessToken);
5515
+ return {
5516
+ ...identity ? { identity } : {},
5517
+ ...scopes ? { scopes } : {}
5518
+ };
5377
5519
  }
5378
5520
  function buildRobotStatus(robotCreds) {
5379
5521
  const identity = resolveSessionIdentity(robotCreds.accessToken);
5522
+ const scopes = readTokenScopes(robotCreds.accessToken);
5380
5523
  return {
5381
5524
  loginStatus: "Logged in",
5382
5525
  accessToken: robotCreds.accessToken,
@@ -5388,7 +5531,8 @@ function buildRobotStatus(robotCreds) {
5388
5531
  issuer: robotCreds.issuer,
5389
5532
  expiration: getTokenExpiration(robotCreds.accessToken),
5390
5533
  source: "robot" /* Robot */,
5391
- ...identity ? { identity } : {}
5534
+ ...identity ? { identity } : {},
5535
+ ...scopes ? { scopes } : {}
5392
5536
  };
5393
5537
  }
5394
5538
  var isFileNotFoundError = (error) => {
@@ -5655,7 +5799,8 @@ var getAuthContext = async (options = {}) => {
5655
5799
  organizationId: status.organizationId,
5656
5800
  organizationName: status.organizationName,
5657
5801
  tenantId: status.tenantId,
5658
- tenantName
5802
+ tenantName,
5803
+ identity: status.identity
5659
5804
  };
5660
5805
  };
5661
5806
  // ../auth/src/authProfileDetails.ts
@@ -6209,4 +6354,4 @@ export {
6209
6354
  querystring
6210
6355
  };
6211
6356
 
6212
- //# debugId=C63C0BBDCC29404364756E2164756E21
6357
+ //# debugId=B78837C0FE26C35464756E2164756E21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/agent-sdk",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.212",
5
+ "version": "1.204.0-preview.211",
6
6
  "description": "SDK for the UiPath Agent Runtime API — evaluation execution and debug sessions.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -30,5 +30,5 @@
30
30
  "files": [
31
31
  "dist"
32
32
  ],
33
- "gitHead": "15094ce85cf76c59a54affbed3304febc271f41a"
33
+ "gitHead": "275e01f1f6098d4c3bc9673f5225f33372822534"
34
34
  }