@uipath/apms-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-jjayvt9s.js";
6
+ } from "./tool-9q3ffrfg.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/apms-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 Access Policy Management Service.",
2106
2106
  private: false,
2107
2107
  repository: {
@@ -2181,8 +2181,156 @@ function getGlobalTelemetryProperties() {
2181
2181
  return telemetryPropsSlot.get();
2182
2182
  }
2183
2183
 
2184
+ // ../../common/src/telemetry/telemetry-dimensions.ts
2185
+ var BaseDimensions = {
2186
+ ApplicationName: "ApplicationName",
2187
+ ProductVersion: "ProductVersion",
2188
+ InstallationId: "InstallationId",
2189
+ CloudUserId: "CloudUserId",
2190
+ CloudTenantId: "CloudTenantId",
2191
+ CloudOrganizationId: "CloudOrganizationId",
2192
+ IsInternalUser: "IsInternalUser",
2193
+ Environment: "Environment",
2194
+ BaseUrl: "BaseUrl",
2195
+ Region: "Region",
2196
+ Agent: "Agent",
2197
+ AgentVersion: "AgentVersion",
2198
+ AgentModel: "AgentModel",
2199
+ ToolName: "ToolName",
2200
+ ToolVersion: "ToolVersion",
2201
+ ExecutionContext: "ExecutionContext",
2202
+ CiProvider: "CiProvider",
2203
+ SessionIdSource: "SessionIdSource",
2204
+ SessionId: "SessionId"
2205
+ };
2206
+ var CommandDimensions = {
2207
+ IsCommand: "IsCommand",
2208
+ IsReexec: "IsReexec",
2209
+ CommandName: "CommandName",
2210
+ ExitCode: "ExitCode",
2211
+ TerminalOutcome: "TerminalOutcome",
2212
+ ErrorClass: "ErrorClass",
2213
+ TerminalSignal: "TerminalSignal",
2214
+ ErrorMessage: "ErrorMessage",
2215
+ SkillName: "SkillName",
2216
+ ProductArea: "ProductArea",
2217
+ Mode: "Mode"
2218
+ };
2219
+ var ShipDimensions = {
2220
+ ShipKind: "ShipKind",
2221
+ Target: "Target",
2222
+ ProjectType: "ProjectType",
2223
+ ProjectTypes: "ProjectTypes",
2224
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
2225
+ PackageName: "PackageName",
2226
+ PackageVersion: "PackageVersion",
2227
+ PackageVersionKey: "PackageVersionKey",
2228
+ DeploymentKey: "DeploymentKey",
2229
+ SolutionId: "SolutionId",
2230
+ FolderKey: "FolderKey",
2231
+ FeedId: "FeedId"
2232
+ };
2233
+ var ErrorDimensions = {
2234
+ Result: "Result",
2235
+ ErrorCode: "ErrorCode",
2236
+ Retry: "Retry",
2237
+ ErrorMessage: "ErrorMessage"
2238
+ };
2239
+ var AuthDimensions = {
2240
+ AuthenticationMethod: "AuthenticationMethod",
2241
+ Success: "Success",
2242
+ Reason: "Reason"
2243
+ };
2244
+ var SkillsDimensions = {
2245
+ SchemaVersion: "SchemaVersion",
2246
+ AgentType: "AgentType",
2247
+ SkillsVersion: "SkillsVersion",
2248
+ UipSubcommand: "UipSubcommand",
2249
+ FileExtension: "FileExtension",
2250
+ SubagentModel: "SubagentModel",
2251
+ SubagentType: "SubagentType",
2252
+ PermissionMode: "PermissionMode",
2253
+ EffortLevel: "EffortLevel",
2254
+ SessionSource: "SessionSource",
2255
+ Outcome: "Outcome",
2256
+ DurationMs: "DurationMs",
2257
+ Source: "Source"
2258
+ };
2259
+ var PackagerDimensions = {
2260
+ ProjectId: "ProjectId",
2261
+ ProjectType: "ProjectType",
2262
+ SolutionId: "SolutionId"
2263
+ };
2264
+ var ScopeDimensions = {
2265
+ FolderId: "FolderId"
2266
+ };
2267
+ var ID_DIMENSIONS = new Set([
2268
+ BaseDimensions.CloudUserId,
2269
+ BaseDimensions.CloudTenantId,
2270
+ BaseDimensions.CloudOrganizationId,
2271
+ BaseDimensions.InstallationId,
2272
+ ShipDimensions.ArtifactCorrelationKey,
2273
+ ShipDimensions.PackageVersionKey,
2274
+ ShipDimensions.DeploymentKey,
2275
+ ShipDimensions.SolutionId,
2276
+ ShipDimensions.FolderKey,
2277
+ ShipDimensions.FeedId,
2278
+ PackagerDimensions.ProjectId
2279
+ ]);
2280
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
2281
+ var RESERVED_DIMENSION_NAMES = new Set([
2282
+ ...Object.values(BaseDimensions),
2283
+ ...Object.values(CommandDimensions),
2284
+ ...Object.values(ShipDimensions),
2285
+ ...Object.values(ErrorDimensions),
2286
+ ...Object.values(AuthDimensions),
2287
+ ...Object.values(SkillsDimensions),
2288
+ ...Object.values(PackagerDimensions),
2289
+ ...Object.values(ScopeDimensions)
2290
+ ]);
2291
+ var CURATED_DIMENSIONS = new Set([
2292
+ BaseDimensions.ApplicationName,
2293
+ BaseDimensions.ProductVersion,
2294
+ BaseDimensions.InstallationId,
2295
+ BaseDimensions.CloudUserId,
2296
+ BaseDimensions.CloudTenantId,
2297
+ BaseDimensions.CloudOrganizationId,
2298
+ BaseDimensions.IsInternalUser,
2299
+ BaseDimensions.Environment,
2300
+ BaseDimensions.BaseUrl,
2301
+ BaseDimensions.Region,
2302
+ BaseDimensions.Agent,
2303
+ BaseDimensions.AgentVersion,
2304
+ BaseDimensions.ToolVersion,
2305
+ BaseDimensions.ExecutionContext,
2306
+ BaseDimensions.CiProvider,
2307
+ BaseDimensions.SessionIdSource,
2308
+ BaseDimensions.SessionId,
2309
+ ...Object.values(CommandDimensions),
2310
+ ...Object.values(ShipDimensions)
2311
+ ]);
2312
+ function lowercaseIdDimensionValues(properties) {
2313
+ let changed = false;
2314
+ const result = {
2315
+ ...properties
2316
+ };
2317
+ for (const key of Object.keys(result)) {
2318
+ const value = result[key];
2319
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
2320
+ continue;
2321
+ }
2322
+ const lowered = value.toLowerCase();
2323
+ if (lowered !== value) {
2324
+ result[key] = lowered;
2325
+ changed = true;
2326
+ }
2327
+ }
2328
+ return changed ? result : properties;
2329
+ }
2330
+
2184
2331
  // ../../common/src/sdk-user-agent.ts
2185
2332
  var USER_AGENT_HEADER = "User-Agent";
2333
+ var AGENT_PROPERTY = BaseDimensions.Agent;
2186
2334
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
2187
2335
  function userAgentPatchKey(userAgent) {
2188
2336
  return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
@@ -2510,7 +2658,7 @@ var package_default2 = {
2510
2658
  name: "@uipath/apms-sdk",
2511
2659
  author: "UiPath",
2512
2660
  license: "SEE LICENSE IN LICENSE.txt",
2513
- version: "1.203.0",
2661
+ version: "1.204.0",
2514
2662
  description: "SDK for the UiPath Access Policy Management Service API.",
2515
2663
  repository: {
2516
2664
  type: "git",
@@ -4077,6 +4225,11 @@ var pickName = (claims) => {
4077
4225
  const username = asString(claims?.preferred_username);
4078
4226
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
4079
4227
  };
4228
+ var pickScopes = (claims) => {
4229
+ const raw = claims?.scope;
4230
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
4231
+ return scopes.length > 0 ? scopes : undefined;
4232
+ };
4080
4233
  var resolveSessionIdentity = (accessToken, authFlow) => {
4081
4234
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
4082
4235
  const email = pickEmail(claims);
@@ -4102,6 +4255,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
4102
4255
  identity.clientId = clientId;
4103
4256
  return identity;
4104
4257
  };
4258
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
4105
4259
 
4106
4260
  // ../../auth/src/envAuth.ts
4107
4261
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -4174,6 +4328,7 @@ var readAuthFromEnv = () => {
4174
4328
  const expiration = getTokenExpiration(accessToken);
4175
4329
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
4176
4330
  const identity = resolveSessionIdentity(accessToken);
4331
+ const scopes = readTokenScopes(accessToken);
4177
4332
  return {
4178
4333
  loginStatus,
4179
4334
  accessToken,
@@ -4184,7 +4339,8 @@ var readAuthFromEnv = () => {
4184
4339
  tenantId,
4185
4340
  expiration,
4186
4341
  source: "env-vars" /* EnvironmentVariables */,
4187
- ...identity ? { identity } : {}
4342
+ ...identity ? { identity } : {},
4343
+ ...scopes ? { scopes } : {}
4188
4344
  };
4189
4345
  };
4190
4346
 
@@ -4822,10 +4978,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
4822
4978
  }
4823
4979
  function identityFields(accessToken, credentials) {
4824
4980
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
4825
- return identity ? { identity } : {};
4981
+ const scopes = readTokenScopes(accessToken);
4982
+ return {
4983
+ ...identity ? { identity } : {},
4984
+ ...scopes ? { scopes } : {}
4985
+ };
4826
4986
  }
4827
4987
  function buildRobotStatus(robotCreds) {
4828
4988
  const identity = resolveSessionIdentity(robotCreds.accessToken);
4989
+ const scopes = readTokenScopes(robotCreds.accessToken);
4829
4990
  return {
4830
4991
  loginStatus: "Logged in",
4831
4992
  accessToken: robotCreds.accessToken,
@@ -4837,7 +4998,8 @@ function buildRobotStatus(robotCreds) {
4837
4998
  issuer: robotCreds.issuer,
4838
4999
  expiration: getTokenExpiration(robotCreds.accessToken),
4839
5000
  source: "robot" /* Robot */,
4840
- ...identity ? { identity } : {}
5001
+ ...identity ? { identity } : {},
5002
+ ...scopes ? { scopes } : {}
4841
5003
  };
4842
5004
  }
4843
5005
  var isFileNotFoundError = (error) => {
@@ -5635,9 +5797,60 @@ function settlePromiseLike2(thenable) {
5635
5797
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
5636
5798
  }
5637
5799
 
5800
+ // ../../common/src/error-graph.ts
5801
+ function* walkErrorGraph(error) {
5802
+ const queue = [error];
5803
+ const seen = new Set;
5804
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
5805
+ const current = queue.shift();
5806
+ if (current === null || typeof current !== "object")
5807
+ continue;
5808
+ if (seen.has(current))
5809
+ continue;
5810
+ seen.add(current);
5811
+ const cur = current;
5812
+ yield cur;
5813
+ if (cur.cause !== undefined)
5814
+ queue.push(cur.cause);
5815
+ if (Array.isArray(cur.errors))
5816
+ queue.push(...cur.errors);
5817
+ }
5818
+ return;
5819
+ }
5820
+ function parseHttpStatusFromMessage(message) {
5821
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
5822
+ if (!match)
5823
+ return;
5824
+ const status = Number(match[1]);
5825
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
5826
+ }
5827
+ function findHttpStatusInGraph(error) {
5828
+ for (const node of walkErrorGraph(error)) {
5829
+ const response = node.response;
5830
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
5831
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
5832
+ return explicit;
5833
+ }
5834
+ if (typeof node.message === "string") {
5835
+ const parsed = parseHttpStatusFromMessage(node.message);
5836
+ if (parsed !== undefined && parsed >= 400) {
5837
+ return parsed;
5838
+ }
5839
+ }
5840
+ }
5841
+ return;
5842
+ }
5843
+
5844
+ // ../../common/src/local-permission-codes.ts
5845
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
5846
+ "EACCES",
5847
+ "EPERM",
5848
+ "EROFS"
5849
+ ]);
5850
+
5638
5851
  // ../../common/src/error-handler.ts
5639
- var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
5640
- var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
5852
+ 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.";
5853
+ 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.";
5641
5854
  var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
5642
5855
  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.";
5643
5856
  var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
@@ -5664,14 +5877,14 @@ var TLS_ERROR_CODES = new Set([
5664
5877
  ]);
5665
5878
  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.";
5666
5879
  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.";
5667
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
5668
- var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
5880
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
5669
5881
  function localPermissionInstructions(code, path2) {
5670
5882
  const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
5671
5883
  if (code === "EROFS") {
5672
5884
  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.";
5673
5885
  }
5674
- 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.";
5886
+ const onWindows = typeof process !== "undefined" && process.platform === "win32";
5887
+ 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.";
5675
5888
  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}`;
5676
5889
  }
5677
5890
  function describeConnectivityError(error) {
@@ -5725,48 +5938,6 @@ function localPermissionPath(path2, message) {
5725
5938
  return path2;
5726
5939
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
5727
5940
  }
5728
- function* walkErrorGraph(error) {
5729
- const queue = [error];
5730
- const seen = new Set;
5731
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
5732
- const current = queue.shift();
5733
- if (current === null || typeof current !== "object")
5734
- continue;
5735
- if (seen.has(current))
5736
- continue;
5737
- seen.add(current);
5738
- const cur = current;
5739
- yield cur;
5740
- if (cur.cause !== undefined)
5741
- queue.push(cur.cause);
5742
- if (Array.isArray(cur.errors))
5743
- queue.push(...cur.errors);
5744
- }
5745
- return;
5746
- }
5747
- function parseHttpStatusFromMessage(message) {
5748
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
5749
- if (!match)
5750
- return;
5751
- const status = Number(match[1]);
5752
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
5753
- }
5754
- function findHttpStatusInGraph(error) {
5755
- for (const node of walkErrorGraph(error)) {
5756
- const response = node.response;
5757
- const explicit = typeof node.status === "number" ? node.status : response?.status;
5758
- if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
5759
- return explicit;
5760
- }
5761
- if (typeof node.message === "string") {
5762
- const parsed = parseHttpStatusFromMessage(node.message);
5763
- if (parsed !== undefined && parsed >= 400) {
5764
- return parsed;
5765
- }
5766
- }
5767
- }
5768
- return;
5769
- }
5770
5941
  function isHtmlDocument(body) {
5771
5942
  return /^\s*(<!doctype html|<html\b)/i.test(body);
5772
5943
  }
@@ -6294,6 +6465,9 @@ var AUTH_ERROR_CODES = new Set([
6294
6465
  "authentication_required",
6295
6466
  "permission_denied"
6296
6467
  ]);
6468
+ var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
6469
+ "local_permission_denied"
6470
+ ]);
6297
6471
  var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
6298
6472
  var NETWORK_HTTP_ERROR_CODES = new Set([
6299
6473
  "network_error",
@@ -6434,6 +6608,9 @@ function classifyFromErrorCode(errorCode2) {
6434
6608
  if (AUTH_ERROR_CODES.has(errorCode2)) {
6435
6609
  return "auth";
6436
6610
  }
6611
+ if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode2)) {
6612
+ return "local_permission";
6613
+ }
6437
6614
  if (VALIDATION_ERROR_CODES.has(errorCode2)) {
6438
6615
  return "validation";
6439
6616
  }
@@ -6445,6 +6622,15 @@ function classifyFromErrorCode(errorCode2) {
6445
6622
  }
6446
6623
  return;
6447
6624
  }
6625
+ function hasLocalPermissionCode(error) {
6626
+ for (const node of walkErrorGraph(error)) {
6627
+ const code = node.code;
6628
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
6629
+ return true;
6630
+ }
6631
+ }
6632
+ return false;
6633
+ }
6448
6634
  function classifyFromError(error) {
6449
6635
  const code = findCodeInCauseChain(error);
6450
6636
  if (code) {
@@ -6461,6 +6647,9 @@ function classifyFromError(error) {
6461
6647
  return "missing_dependency";
6462
6648
  }
6463
6649
  }
6650
+ if (hasLocalPermissionCode(error)) {
6651
+ return "local_permission";
6652
+ }
6464
6653
  const message = stringField(error, "message");
6465
6654
  if (message?.includes("fetch failed") === true) {
6466
6655
  return "network_http";
@@ -6476,7 +6665,7 @@ function classifyError2(input) {
6476
6665
  if (recorded?.errorClass) {
6477
6666
  return recorded.errorClass;
6478
6667
  }
6479
- const status = recorded?.context?.httpStatus;
6668
+ const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
6480
6669
  if (status !== undefined) {
6481
6670
  return classifyHttpStatus(status);
6482
6671
  }
@@ -6499,17 +6688,18 @@ function buildCommandTerminalTelemetryProperties(input) {
6499
6688
  const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
6500
6689
  const terminalSignal = terminalSignalFor(input, outcome);
6501
6690
  return {
6502
- exit_code: input.exitCode,
6503
- terminal_outcome: outcome,
6504
- ...errorClass ? { error_class: errorClass } : {},
6505
- ...terminalSignal ? { terminal_signal: terminalSignal } : {}
6691
+ [CommandDimensions.ExitCode]: input.exitCode,
6692
+ [CommandDimensions.TerminalOutcome]: outcome,
6693
+ ...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
6694
+ ...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
6506
6695
  };
6507
6696
  }
6508
6697
 
6509
6698
  // ../../common/src/telemetry/telemetry-events.ts
6510
6699
  var CommonTelemetryEvents = {
6511
- Error: "uip.error",
6512
- ShipSucceeded: "uip.ship.succeeded"
6700
+ Start: "Application.Start",
6701
+ Error: "Application.Error",
6702
+ ShipSucceeded: "Cli.ShipSucceeded"
6513
6703
  };
6514
6704
 
6515
6705
  // ../../common/src/registry.ts
@@ -6717,8 +6907,8 @@ function detectExecutionContext(options = {}) {
6717
6907
  function getExecutionContextTelemetryProperties() {
6718
6908
  const detected = detectExecutionContext();
6719
6909
  return {
6720
- execution_context: detected.executionContext,
6721
- ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
6910
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
6911
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
6722
6912
  };
6723
6913
  }
6724
6914
  // ../../common/src/telemetry/node-context-storage.ts
@@ -6761,7 +6951,7 @@ function getInboundTraceContext() {
6761
6951
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
6762
6952
  var SESSION_ID_MAX_LENGTH = 64;
6763
6953
  var RANDOM_SESSION_ID_LENGTH = 32;
6764
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
6954
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
6765
6955
  var CONTROL_CHARACTERS = /\p{Cc}/gu;
6766
6956
  var INHERITED_SESSION_SOURCES = [
6767
6957
  { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
@@ -6813,6 +7003,9 @@ function resolveTelemetrySession() {
6813
7003
  telemetrySessionSlot.set(resolved);
6814
7004
  return resolved;
6815
7005
  }
7006
+ function getTelemetrySessionId() {
7007
+ return resolveTelemetrySession().id;
7008
+ }
6816
7009
  function getTelemetrySessionSource() {
6817
7010
  return resolveTelemetrySession().source;
6818
7011
  }
@@ -6887,7 +7080,10 @@ class TelemetryService {
6887
7080
  } catch (error) {
6888
7081
  const durationMs = clock.elapsedMs();
6889
7082
  const err = error instanceof Error ? error : new Error(String(error));
6890
- await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
7083
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
7084
+ ...properties,
7085
+ [CommandDimensions.ErrorMessage]: err.message
7086
+ }, context));
6891
7087
  throw error;
6892
7088
  }
6893
7089
  }
@@ -6958,7 +7154,10 @@ class TelemetryService {
6958
7154
  const durationMs = clock.elapsedMs();
6959
7155
  const err = error instanceof Error ? error : new Error(String(error));
6960
7156
  await this.telemetryProvider.trackDependency({
6961
- ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
7157
+ ...this.spanFor(name, durationMs, false, {
7158
+ ...properties,
7159
+ [CommandDimensions.ErrorMessage]: err.message
7160
+ }, childContext),
6962
7161
  type
6963
7162
  });
6964
7163
  throw error;
@@ -6993,9 +7192,10 @@ class TelemetryService {
6993
7192
  ...globalProperties,
6994
7193
  ...this.defaultProperties,
6995
7194
  ...redactProperties(properties ?? {}),
6996
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
7195
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
7196
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
6997
7197
  };
6998
- return enriched;
7198
+ return lowercaseIdDimensionValues(enriched);
6999
7199
  }
7000
7200
  generateId() {
7001
7201
  const bytes = new Uint8Array(8);
@@ -7756,7 +7956,165 @@ class FilterImplicitLimitError extends Error {
7756
7956
  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).";
7757
7957
  }
7758
7958
  }
7759
- function applyFilter(data, filter) {
7959
+ function countRecords(data) {
7960
+ if (Array.isArray(data))
7961
+ return data.length;
7962
+ return data == null ? 0 : 1;
7963
+ }
7964
+ function availableFields(data) {
7965
+ const records = Array.isArray(data) ? data : [data];
7966
+ const keys = new Set;
7967
+ for (const record of records) {
7968
+ if (record && typeof record === "object" && !Array.isArray(record)) {
7969
+ for (const key of Object.keys(record))
7970
+ keys.add(key);
7971
+ }
7972
+ }
7973
+ return [...keys];
7974
+ }
7975
+ function decodeQuotedIdentifier(whole, inner) {
7976
+ const [error, decoded] = catchError2(() => JSON.parse(whole));
7977
+ if (!error && typeof decoded === "string")
7978
+ return decoded;
7979
+ return inner.replace(/\\(.)/g, "$1");
7980
+ }
7981
+ function referencedFields(filter) {
7982
+ const top = new Set;
7983
+ const nested = new Set;
7984
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
7985
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
7986
+ const quoted = [];
7987
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
7988
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
7989
+ if (!isAlias) {
7990
+ quoted.push({
7991
+ name: decodeQuotedIdentifier(whole, name),
7992
+ index,
7993
+ tail: isPathTail(withoutValueLiterals, index)
7994
+ });
7995
+ }
7996
+ return `"${" ".repeat(whole.length - 2)}"`;
7997
+ });
7998
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
7999
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
8000
+ const place = (name, index, tail) => {
8001
+ if (tail || index >= rootEnd)
8002
+ nested.add(name);
8003
+ else
8004
+ top.add(name);
8005
+ };
8006
+ for (const entry of quoted)
8007
+ place(entry.name, entry.index, entry.tail);
8008
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
8009
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
8010
+ for (const match of identifiers) {
8011
+ const [, name, trailing] = match;
8012
+ if (trailing || reserved.has(name))
8013
+ continue;
8014
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
8015
+ }
8016
+ return {
8017
+ top: [...top],
8018
+ nested: [...nested].filter((name) => !top.has(name)),
8019
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
8020
+ };
8021
+ }
8022
+ function appearsBelowTopLevel(data, name) {
8023
+ let budget = 2000;
8024
+ const visit = (value, depth) => {
8025
+ if (budget-- <= 0 || depth > 4)
8026
+ return false;
8027
+ if (value === null || typeof value !== "object")
8028
+ return false;
8029
+ if (Array.isArray(value))
8030
+ return value.some((entry) => visit(entry, depth));
8031
+ const record = value;
8032
+ if (depth > 0 && Object.hasOwn(record, name))
8033
+ return true;
8034
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
8035
+ };
8036
+ return visit(data, 0);
8037
+ }
8038
+ function alwaysNullKeys(records) {
8039
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
8040
+ if (objects.length === 0 || objects.length !== records.length)
8041
+ return [];
8042
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
8043
+ if (keys.length === 0)
8044
+ return [];
8045
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
8046
+ return nullKeys.length === keys.length ? nullKeys : [];
8047
+ }
8048
+ function carriesOnlyNulls(value) {
8049
+ if (value === null)
8050
+ return true;
8051
+ if (Array.isArray(value)) {
8052
+ return value.length > 0 && value.every(carriesOnlyNulls);
8053
+ }
8054
+ if (typeof value === "object" && value !== undefined) {
8055
+ const values = Object.values(value);
8056
+ return values.length > 0 && values.every(carriesOnlyNulls);
8057
+ }
8058
+ return false;
8059
+ }
8060
+ function nameList(names, cap2 = 12) {
8061
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
8062
+ const rest = names.length - shown.length;
8063
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
8064
+ }
8065
+ function buildFilterWarning(filter, data, outcome) {
8066
+ const present = availableFields(data);
8067
+ const refs = referencedFields(filter);
8068
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
8069
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
8070
+ const count = countRecords(data);
8071
+ const scope = `${count} record(s)`;
8072
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
8073
+ 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" : "";
8074
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
8075
+ let detail;
8076
+ let lede;
8077
+ if (outcome.kind === "null-elements") {
8078
+ lede = "returned only null values";
8079
+ const projected = `all ${outcome.count} of the elements it projected are null`;
8080
+ if (unknown.length > 0) {
8081
+ detail = `${projected}, because ${isNotAField(unknown)}`;
8082
+ } else if (unchecked.length > 0) {
8083
+ detail = withSoundness(projected);
8084
+ } else {
8085
+ 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`;
8086
+ }
8087
+ } else if (outcome.kind === "null-rows") {
8088
+ lede = "returned only null values";
8089
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
8090
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
8091
+ } else if (outcome.kind === "null-values") {
8092
+ lede = "returned only null values";
8093
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
8094
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
8095
+ if (sameSet) {
8096
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
8097
+ } else if (unknown.length > 0) {
8098
+ detail = `${projected}, because ${isNotAField(unknown)}`;
8099
+ } else {
8100
+ detail = withSoundness(`${projected} on all ${scope}`);
8101
+ }
8102
+ } else {
8103
+ lede = "returned nothing";
8104
+ if (unknown.length > 0) {
8105
+ detail = isNotAField(unknown);
8106
+ } else {
8107
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
8108
+ detail = withSoundness(`${selection} — it read ${scope}`);
8109
+ }
8110
+ }
8111
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
8112
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
8113
+ }
8114
+ function appendWarning(existing, note) {
8115
+ return existing ? `${existing} ${note}` : note;
8116
+ }
8117
+ function applyFilter(data, filter, onWarning) {
7760
8118
  const codec = requireJmespath();
7761
8119
  let result;
7762
8120
  try {
@@ -7764,9 +8122,34 @@ function applyFilter(data, filter) {
7764
8122
  } catch (err) {
7765
8123
  throw new FilterEvaluationError(filter, err);
7766
8124
  }
7767
- if (result == null)
8125
+ const inputCount = countRecords(data);
8126
+ const warn = (outcome) => {
8127
+ if (inputCount === 0)
8128
+ return;
8129
+ const note = buildFilterWarning(filter, data, outcome);
8130
+ getOutputSink().writeErr(`[WARN] ${note}
8131
+ `);
8132
+ onWarning?.(note);
8133
+ };
8134
+ const warnIfAllNull = (records) => {
8135
+ const keys = alwaysNullKeys(records);
8136
+ if (keys.length > 0)
8137
+ warn({ kind: "null-values", keys });
8138
+ };
8139
+ if (result == null) {
8140
+ warn({ kind: "empty" });
7768
8141
  return [];
8142
+ }
7769
8143
  if (Array.isArray(result)) {
8144
+ if (result.length === 0) {
8145
+ warn({ kind: "empty" });
8146
+ } else if (result.every((entry) => entry === null)) {
8147
+ warn({ kind: "null-elements", count: result.length });
8148
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
8149
+ warn({ kind: "null-rows", count: result.length });
8150
+ } else {
8151
+ warnIfAllNull(result);
8152
+ }
7770
8153
  if (result.length > 0 && typeof result[0] !== "object") {
7771
8154
  const fieldMatch = filter.match(/\.(\w+)$/);
7772
8155
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -7774,10 +8157,30 @@ function applyFilter(data, filter) {
7774
8157
  }
7775
8158
  return result;
7776
8159
  }
7777
- if (typeof result === "object")
8160
+ if (typeof result === "object") {
8161
+ warnIfAllNull([result]);
7778
8162
  return result;
8163
+ }
7779
8164
  return { Value: result };
7780
8165
  }
8166
+ function filterFailureData(envelope) {
8167
+ const filter = getOutputFilter();
8168
+ const data = envelope.Data;
8169
+ if (!filter || data == null)
8170
+ return;
8171
+ let note;
8172
+ const [filterError, filtered] = catchError2(() => applyFilter(data, filter, (n) => {
8173
+ note = n;
8174
+ }));
8175
+ if (filterError) {
8176
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
8177
+ return;
8178
+ }
8179
+ envelope.Data = filtered;
8180
+ if (note) {
8181
+ envelope.Warning = appendWarning(envelope.Warning, note);
8182
+ }
8183
+ }
7781
8184
  function defaultErrorCodeForResult(result) {
7782
8185
  switch (result) {
7783
8186
  case RESULTS.AuthenticationError:
@@ -7821,7 +8224,7 @@ function defaultErrorCodeForHttpStatus(status) {
7821
8224
  return "server_error";
7822
8225
  return;
7823
8226
  }
7824
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
8227
+ var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
7825
8228
  function defaultErrorCodeForFailure(data) {
7826
8229
  if (data.Result === RESULTS.Failure) {
7827
8230
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
@@ -7860,8 +8263,14 @@ var OutputFormatter;
7860
8263
  }
7861
8264
  const filter = getOutputFilter();
7862
8265
  if (filter) {
7863
- const filtered = applyFilter(data.Data, filter);
8266
+ let note;
8267
+ const filtered = applyFilter(data.Data, filter, (n) => {
8268
+ note = n;
8269
+ });
7864
8270
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
8271
+ if (note) {
8272
+ data.Warning = appendWarning(data.Warning, note);
8273
+ }
7865
8274
  }
7866
8275
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
7867
8276
  }
@@ -7889,12 +8298,13 @@ var OutputFormatter;
7889
8298
  delete envelope.TelemetryErrorClass;
7890
8299
  delete envelope.TelemetryTerminalOutcome;
7891
8300
  delete envelope.TelemetryTerminalSignal;
8301
+ filterFailureData(envelope);
7892
8302
  if (!suppressTelemetry) {
7893
8303
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
7894
- result: data.Result,
7895
- errorCode: data.ErrorCode,
7896
- retry: data.Retry,
7897
- message: data.Message
8304
+ [ErrorDimensions.Result]: data.Result,
8305
+ [ErrorDimensions.ErrorCode]: data.ErrorCode,
8306
+ [ErrorDimensions.Retry]: data.Retry,
8307
+ [ErrorDimensions.ErrorMessage]: data.Message
7898
8308
  });
7899
8309
  }
7900
8310
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -7937,13 +8347,20 @@ var OutputFormatter;
7937
8347
  OutputFormatter.log = log;
7938
8348
  function formatToString(data) {
7939
8349
  const filter = getOutputFilter();
8350
+ const envelope = data;
7940
8351
  if ("Data" in data && data.Data != null) {
7941
8352
  data.Data = normalizeDataKeys(data.Data);
7942
8353
  if (filter) {
7943
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
8354
+ let note;
8355
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
8356
+ note = n;
8357
+ }));
8358
+ if (note) {
8359
+ envelope.Warning = appendWarning(envelope.Warning, note);
8360
+ }
7944
8361
  }
7945
8362
  }
7946
- const output = normalizeOutputKeys(data);
8363
+ const output = normalizeOutputKeys(envelope);
7947
8364
  const lines = [];
7948
8365
  const sink = getOutputSink();
7949
8366
  printOutput(output, getOutputFormat(), (msg) => {
@@ -7993,7 +8410,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
7993
8410
  var MAX_SKILL_NAME_LENGTH = 80;
7994
8411
  var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
7995
8412
  function productMode(productArea, mode) {
7996
- return { product_area: productArea, mode };
8413
+ return { ProductArea: productArea, Mode: mode };
7997
8414
  }
7998
8415
  function attributionRecord(groups) {
7999
8416
  const record = {};
@@ -8051,6 +8468,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
8051
8468
  ["rpa", "build", ["uip.rpa-legacy"]],
8052
8469
  ["conversational", "operate", ["uip.conversational"]],
8053
8470
  ["agents", "build", ["uip.codedagent", "uip.agent"]],
8471
+ ["coding-agents", "build", ["uip.coder"]],
8054
8472
  ["agenthub", "build", ["uip.agenthub"]],
8055
8473
  ["coded-apps", "build", ["uip.codedapp"]],
8056
8474
  ["functions", "build", ["uip.function", "uip.functions"]],
@@ -8136,32 +8554,64 @@ function normalizeSkillName(value) {
8136
8554
  function buildCommandTelemetryAttribution(commandPath, skillSource) {
8137
8555
  const skillName = normalizeSkillName(skillSource);
8138
8556
  return {
8139
- ...skillName ? { skill_name: skillName } : {},
8557
+ ...skillName ? { SkillName: skillName } : {},
8140
8558
  ...getCommandProductModeAttribution(commandPath)
8141
8559
  };
8142
8560
  }
8561
+ var AGENT_SESSION_ENV = {
8562
+ [BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
8563
+ [SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
8564
+ [SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
8565
+ [SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
8566
+ };
8567
+ var MAX_TELEMETRY_TOKEN_LENGTH = 120;
8568
+ function sanitizeTelemetryToken(value) {
8569
+ return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
8570
+ }
8571
+ function buildAgentSessionTelemetry(env) {
8572
+ const dimensions = {};
8573
+ for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
8574
+ const value = env[variable]?.trim();
8575
+ if (value) {
8576
+ dimensions[key] = sanitizeTelemetryToken(value);
8577
+ }
8578
+ }
8579
+ return dimensions;
8580
+ }
8143
8581
 
8144
8582
  // ../../common/src/telemetry/command-name.ts
8145
- var TELEMETRY_COMMAND_ROOT = "uip";
8583
+ var TELEMETRY_NAME_ROOT = "Cli";
8584
+ var CLI_COMMAND_ROOT = "uip";
8585
+ var TELEMETRY_NAME_BARE_ACTION = "Invoke";
8146
8586
  function commandTelemetryName(parts) {
8587
+ const action = vetCommandTokens(parts).map(pascalizeToken).join("");
8588
+ return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
8589
+ }
8590
+ function commandInvocationPath(parts) {
8591
+ return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
8592
+ }
8593
+ function vetCommandTokens(parts) {
8147
8594
  const tokens = [];
8148
8595
  for (const part of parts) {
8149
- const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
8596
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
8150
8597
  if (pieces.every(isCommandToken)) {
8151
8598
  tokens.push(...pieces);
8152
8599
  continue;
8153
8600
  }
8154
8601
  tokens.push(UNKNOWN_TOKEN);
8155
8602
  }
8156
- return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
8603
+ return tokens;
8157
8604
  }
8158
- var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
8605
+ function pascalizeToken(token) {
8606
+ return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
8607
+ }
8608
+ var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
8159
8609
  var MAX_COMMAND_TOKEN_LENGTH = 32;
8160
8610
  var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
8161
8611
  function isCommandToken(token) {
8162
- return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
8612
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
8163
8613
  }
8164
- var UNKNOWN_TOKEN = "<unknown>";
8614
+ var UNKNOWN_TOKEN = "unknown";
8165
8615
 
8166
8616
  // ../../common/src/telemetry/invocation-request.ts
8167
8617
  var requestContextSlot = singleton("TelemetryInvocationRequestContext");
@@ -8266,7 +8716,7 @@ function withheldArgumentValues(cmd) {
8266
8716
  });
8267
8717
  return values;
8268
8718
  }
8269
- function deriveCommandPath(cmd) {
8719
+ function deriveCommandParts(cmd) {
8270
8720
  const parts = [];
8271
8721
  let current = cmd;
8272
8722
  while (current) {
@@ -8279,14 +8729,13 @@ function deriveCommandPath(cmd) {
8279
8729
  if (parts.length > 1) {
8280
8730
  parts.shift();
8281
8731
  }
8282
- return commandTelemetryName(parts);
8732
+ return parts;
8283
8733
  }
8284
8734
  function isErrorContext(value) {
8285
8735
  return value !== null && typeof value === "object";
8286
8736
  }
8287
8737
  function commandHelpHint(commandPath) {
8288
- const command = commandPath.replace(/\./g, " ");
8289
- return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
8738
+ return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
8290
8739
  }
8291
8740
  function isPromptCancellation(error) {
8292
8741
  return error instanceof Error && error.name === "ExitPromptError";
@@ -8311,7 +8760,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
8311
8760
  yaml: getOutputFormat() === "yaml",
8312
8761
  filter: getOutputFilter() !== undefined
8313
8762
  });
8314
- const telemetryName = deriveCommandPath(command);
8763
+ const commandParts = deriveCommandParts(command);
8764
+ const telemetryName = commandTelemetryName(commandParts);
8765
+ const commandPath = commandInvocationPath(commandParts);
8315
8766
  const props = typeof properties === "function" ? properties(...args) : properties;
8316
8767
  markCommandStart();
8317
8768
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
@@ -8346,7 +8797,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
8346
8797
  Result: finalResult,
8347
8798
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
8348
8799
  Message: errorMessage2,
8349
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
8800
+ Instructions: customInstructions ?? commandHelpHint(commandPath),
8350
8801
  ...customRetry ? { Retry: customRetry } : {},
8351
8802
  ...customContext ? { Context: customContext } : {}
8352
8803
  });
@@ -8363,8 +8814,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
8363
8814
  recordedFailure,
8364
8815
  pollSignal: context.pollSignal
8365
8816
  });
8366
- if (terminalTelemetry.error_class === "internal" && error) {
8367
- telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
8817
+ if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
8818
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
8368
8819
  }
8369
8820
  const commandParams = extractCommandParams(command);
8370
8821
  if (props) {
@@ -8375,10 +8826,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
8375
8826
  const baseProperties = redactProperties({
8376
8827
  ...commandParams,
8377
8828
  ...props,
8378
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
8379
- command: "true",
8829
+ ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
8830
+ ...buildAgentSessionTelemetry(process.env),
8831
+ [CommandDimensions.CommandName]: commandPath,
8832
+ [CommandDimensions.IsCommand]: "true",
8380
8833
  ...terminalTelemetry,
8381
- ...errorMessage2 ? { errorMessage: errorMessage2 } : {}
8834
+ ...errorMessage2 ? { [CommandDimensions.ErrorMessage]: errorMessage2 } : {}
8382
8835
  });
8383
8836
  emitInvocationRequest(telemetryName, success, baseProperties);
8384
8837
  } finally {
@@ -8609,6 +9062,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
8609
9062
  // ../../common/src/interactivity-context.ts
8610
9063
  var modeSlot = singleton("InteractivityMode");
8611
9064
  var interactiveFlagSlot = singleton("InteractiveFlag");
9065
+ // ../../common/src/mime-types.ts
9066
+ var MIME_TYPES_BY_EXTENSION = Object.freeze({
9067
+ pdf: "application/pdf",
9068
+ png: "image/png",
9069
+ jpg: "image/jpeg",
9070
+ jpeg: "image/jpeg",
9071
+ gif: "image/gif",
9072
+ webp: "image/webp",
9073
+ bmp: "image/bmp",
9074
+ tif: "image/tiff",
9075
+ tiff: "image/tiff",
9076
+ svg: "image/svg+xml",
9077
+ txt: "text/plain",
9078
+ log: "text/plain",
9079
+ md: "text/markdown",
9080
+ csv: "text/csv",
9081
+ tsv: "text/tab-separated-values",
9082
+ json: "application/json",
9083
+ xml: "application/xml",
9084
+ html: "text/html",
9085
+ htm: "text/html",
9086
+ yaml: "application/yaml",
9087
+ yml: "application/yaml",
9088
+ doc: "application/msword",
9089
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
9090
+ xls: "application/vnd.ms-excel",
9091
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
9092
+ ppt: "application/vnd.ms-powerpoint",
9093
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
9094
+ zip: "application/zip",
9095
+ mp3: "audio/mpeg",
9096
+ wav: "audio/wav",
9097
+ mp4: "video/mp4"
9098
+ });
8612
9099
  // ../../common/src/polling/types.ts
8613
9100
  var PollOutcome = {
8614
9101
  Completed: "completed",
@@ -9797,4 +10284,4 @@ var registerCommands = async (program2) => {
9797
10284
 
9798
10285
  export { Command, metadata, registerCommands };
9799
10286
 
9800
- //# debugId=13ABBE012339C2AC64756E2164756E21
10287
+ //# debugId=07741CFEF793B66964756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-jjayvt9s.js";
4
+ } from "./tool-9q3ffrfg.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/apms-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 Access Policy Management 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
  }