@uipath/common 1.203.0-preview.205 → 1.204.0-preview.206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8152,9 +8152,60 @@ function settlePromiseLike(thenable) {
8152
8152
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
8153
8153
  }
8154
8154
 
8155
+ // src/error-graph.ts
8156
+ function* walkErrorGraph(error) {
8157
+ const queue = [error];
8158
+ const seen = new Set;
8159
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
8160
+ const current = queue.shift();
8161
+ if (current === null || typeof current !== "object")
8162
+ continue;
8163
+ if (seen.has(current))
8164
+ continue;
8165
+ seen.add(current);
8166
+ const cur = current;
8167
+ yield cur;
8168
+ if (cur.cause !== undefined)
8169
+ queue.push(cur.cause);
8170
+ if (Array.isArray(cur.errors))
8171
+ queue.push(...cur.errors);
8172
+ }
8173
+ return;
8174
+ }
8175
+ function parseHttpStatusFromMessage(message) {
8176
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
8177
+ if (!match)
8178
+ return;
8179
+ const status = Number(match[1]);
8180
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
8181
+ }
8182
+ function findHttpStatusInGraph(error) {
8183
+ for (const node of walkErrorGraph(error)) {
8184
+ const response = node.response;
8185
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
8186
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
8187
+ return explicit;
8188
+ }
8189
+ if (typeof node.message === "string") {
8190
+ const parsed = parseHttpStatusFromMessage(node.message);
8191
+ if (parsed !== undefined && parsed >= 400) {
8192
+ return parsed;
8193
+ }
8194
+ }
8195
+ }
8196
+ return;
8197
+ }
8198
+
8199
+ // src/local-permission-codes.ts
8200
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
8201
+ "EACCES",
8202
+ "EPERM",
8203
+ "EROFS"
8204
+ ]);
8205
+
8155
8206
  // src/error-handler.ts
8156
- var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
8157
- var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
8207
+ 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.";
8208
+ 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.";
8158
8209
  var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
8159
8210
  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.";
8160
8211
  var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
@@ -8181,14 +8232,14 @@ var TLS_ERROR_CODES = new Set([
8181
8232
  ]);
8182
8233
  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.";
8183
8234
  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.";
8184
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
8185
- var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
8235
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
8186
8236
  function localPermissionInstructions(code, path3) {
8187
8237
  const target = path3 !== undefined ? `'${path3}'` : "a local file or resource";
8188
8238
  if (code === "EROFS") {
8189
8239
  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.";
8190
8240
  }
8191
- 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.";
8241
+ const onWindows = typeof process !== "undefined" && process.platform === "win32";
8242
+ 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.";
8192
8243
  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}`;
8193
8244
  }
8194
8245
  function carriedInstructions(error) {
@@ -8279,48 +8330,6 @@ function localPermissionPath(path3, message) {
8279
8330
  return path3;
8280
8331
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
8281
8332
  }
8282
- function* walkErrorGraph(error) {
8283
- const queue = [error];
8284
- const seen = new Set;
8285
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
8286
- const current = queue.shift();
8287
- if (current === null || typeof current !== "object")
8288
- continue;
8289
- if (seen.has(current))
8290
- continue;
8291
- seen.add(current);
8292
- const cur = current;
8293
- yield cur;
8294
- if (cur.cause !== undefined)
8295
- queue.push(cur.cause);
8296
- if (Array.isArray(cur.errors))
8297
- queue.push(...cur.errors);
8298
- }
8299
- return;
8300
- }
8301
- function parseHttpStatusFromMessage(message) {
8302
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
8303
- if (!match)
8304
- return;
8305
- const status = Number(match[1]);
8306
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
8307
- }
8308
- function findHttpStatusInGraph(error) {
8309
- for (const node of walkErrorGraph(error)) {
8310
- const response = node.response;
8311
- const explicit = typeof node.status === "number" ? node.status : response?.status;
8312
- if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
8313
- return explicit;
8314
- }
8315
- if (typeof node.message === "string") {
8316
- const parsed = parseHttpStatusFromMessage(node.message);
8317
- if (parsed !== undefined && parsed >= 400) {
8318
- return parsed;
8319
- }
8320
- }
8321
- }
8322
- return;
8323
- }
8324
8333
  function isHtmlDocument(body) {
8325
8334
  return /^\s*(<!doctype html|<html\b)/i.test(body);
8326
8335
  }
@@ -8617,11 +8626,11 @@ function parseAttachmentSpec(spec) {
8617
8626
  }
8618
8627
  return { name, path: path3 };
8619
8628
  }
8620
- async function resolveAttachmentInputs(specs, upload) {
8629
+ async function readAttachmentSpecs(specs) {
8621
8630
  const fs7 = getFileSystem();
8622
- const prepared = await Promise.all(specs.map(async (spec) => {
8631
+ return Promise.all(specs.map(async (spec) => {
8623
8632
  const bytes = await fs7.readFile(spec.path).catch(async (err) => {
8624
- throw new Error(`Cannot read --attachment '${spec.path}' for variable '${spec.name}': ${await extractErrorMessage(err)}`);
8633
+ throw new Error(`Cannot read --attachment '${spec.path}' for variable '${spec.name}': ${await extractErrorMessage(err)}`, { cause: err });
8625
8634
  });
8626
8635
  if (bytes === null) {
8627
8636
  throw new Error(`--attachment '${spec.path}' for variable '${spec.name}' is empty or could not be read.`);
@@ -8632,9 +8641,12 @@ async function resolveAttachmentInputs(specs, upload) {
8632
8641
  fileName: fs7.path.basename(spec.path)
8633
8642
  };
8634
8643
  }));
8644
+ }
8645
+ async function resolveAttachmentInputs(specs, upload) {
8646
+ const prepared = await readAttachmentSpecs(specs);
8635
8647
  return Promise.all(prepared.map(async (p) => {
8636
8648
  const reference = await upload(p.bytes, p.fileName).catch(async (err) => {
8637
- throw new Error(`Failed to upload --attachment '${p.path}' for variable '${p.name}': ${await extractErrorMessage(err)}`);
8649
+ throw new Error(`Failed to upload --attachment '${p.path}' for variable '${p.name}': ${await extractErrorMessage(err)}`, { cause: err });
8638
8650
  });
8639
8651
  return { name: p.name, path: p.path, reference };
8640
8652
  }));
@@ -8985,12 +8997,180 @@ function isOutputFormat(value) {
8985
8997
  return OUTPUT_FORMATS.includes(value);
8986
8998
  }
8987
8999
 
9000
+ // src/telemetry/telemetry-dimensions.ts
9001
+ var CLI_APPLICATION_NAME = "UiPath.Cli";
9002
+ var BaseDimensions = {
9003
+ ApplicationName: "ApplicationName",
9004
+ ProductVersion: "ProductVersion",
9005
+ InstallationId: "InstallationId",
9006
+ CloudUserId: "CloudUserId",
9007
+ CloudTenantId: "CloudTenantId",
9008
+ CloudOrganizationId: "CloudOrganizationId",
9009
+ IsInternalUser: "IsInternalUser",
9010
+ Environment: "Environment",
9011
+ BaseUrl: "BaseUrl",
9012
+ Region: "Region",
9013
+ Agent: "Agent",
9014
+ AgentVersion: "AgentVersion",
9015
+ AgentModel: "AgentModel",
9016
+ ToolName: "ToolName",
9017
+ ToolVersion: "ToolVersion",
9018
+ ExecutionContext: "ExecutionContext",
9019
+ CiProvider: "CiProvider",
9020
+ SessionIdSource: "SessionIdSource",
9021
+ SessionId: "SessionId"
9022
+ };
9023
+ var CommandDimensions = {
9024
+ IsCommand: "IsCommand",
9025
+ IsReexec: "IsReexec",
9026
+ CommandName: "CommandName",
9027
+ ExitCode: "ExitCode",
9028
+ TerminalOutcome: "TerminalOutcome",
9029
+ ErrorClass: "ErrorClass",
9030
+ TerminalSignal: "TerminalSignal",
9031
+ ErrorMessage: "ErrorMessage",
9032
+ SkillName: "SkillName",
9033
+ ProductArea: "ProductArea",
9034
+ Mode: "Mode"
9035
+ };
9036
+ var ShipDimensions = {
9037
+ ShipKind: "ShipKind",
9038
+ Target: "Target",
9039
+ ProjectType: "ProjectType",
9040
+ ProjectTypes: "ProjectTypes",
9041
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
9042
+ PackageName: "PackageName",
9043
+ PackageVersion: "PackageVersion",
9044
+ PackageVersionKey: "PackageVersionKey",
9045
+ DeploymentKey: "DeploymentKey",
9046
+ SolutionId: "SolutionId",
9047
+ FolderKey: "FolderKey",
9048
+ FeedId: "FeedId"
9049
+ };
9050
+ var ErrorDimensions = {
9051
+ Result: "Result",
9052
+ ErrorCode: "ErrorCode",
9053
+ Retry: "Retry",
9054
+ ErrorMessage: "ErrorMessage"
9055
+ };
9056
+ var AuthDimensions = {
9057
+ AuthenticationMethod: "AuthenticationMethod",
9058
+ Success: "Success",
9059
+ Reason: "Reason"
9060
+ };
9061
+ var SkillsDimensions = {
9062
+ SchemaVersion: "SchemaVersion",
9063
+ AgentType: "AgentType",
9064
+ SkillsVersion: "SkillsVersion",
9065
+ UipSubcommand: "UipSubcommand",
9066
+ FileExtension: "FileExtension",
9067
+ SubagentModel: "SubagentModel",
9068
+ SubagentType: "SubagentType",
9069
+ PermissionMode: "PermissionMode",
9070
+ EffortLevel: "EffortLevel",
9071
+ SessionSource: "SessionSource",
9072
+ Outcome: "Outcome",
9073
+ DurationMs: "DurationMs",
9074
+ Source: "Source"
9075
+ };
9076
+ var PackagerDimensions = {
9077
+ ProjectId: "ProjectId",
9078
+ ProjectType: "ProjectType",
9079
+ SolutionId: "SolutionId"
9080
+ };
9081
+ var ScopeDimensions = {
9082
+ FolderId: "FolderId"
9083
+ };
9084
+ var ID_DIMENSIONS = new Set([
9085
+ BaseDimensions.CloudUserId,
9086
+ BaseDimensions.CloudTenantId,
9087
+ BaseDimensions.CloudOrganizationId,
9088
+ BaseDimensions.InstallationId,
9089
+ ShipDimensions.ArtifactCorrelationKey,
9090
+ ShipDimensions.PackageVersionKey,
9091
+ ShipDimensions.DeploymentKey,
9092
+ ShipDimensions.SolutionId,
9093
+ ShipDimensions.FolderKey,
9094
+ ShipDimensions.FeedId,
9095
+ PackagerDimensions.ProjectId
9096
+ ]);
9097
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
9098
+ var DIMENSION_NAME_EXEMPT_PREFIXES = [
9099
+ "uip.cmd.arg.",
9100
+ "server.",
9101
+ "http."
9102
+ ];
9103
+ function isExemptDimensionName(name) {
9104
+ return DIMENSION_NAME_EXEMPT_PREFIXES.some((prefix) => name.startsWith(prefix));
9105
+ }
9106
+ var DIMENSION_NAME_PATTERN = /^[A-Z][A-Za-z0-9]*$/;
9107
+ var EVENT_NAME_PATTERN = /^[A-Z][A-Za-z0-9]*\.[A-Z][A-Za-z0-9]*$/;
9108
+ var RESERVED_DIMENSION_NAMES = new Set([
9109
+ ...Object.values(BaseDimensions),
9110
+ ...Object.values(CommandDimensions),
9111
+ ...Object.values(ShipDimensions),
9112
+ ...Object.values(ErrorDimensions),
9113
+ ...Object.values(AuthDimensions),
9114
+ ...Object.values(SkillsDimensions),
9115
+ ...Object.values(PackagerDimensions),
9116
+ ...Object.values(ScopeDimensions)
9117
+ ]);
9118
+ var CURATED_DIMENSIONS = new Set([
9119
+ BaseDimensions.ApplicationName,
9120
+ BaseDimensions.ProductVersion,
9121
+ BaseDimensions.InstallationId,
9122
+ BaseDimensions.CloudUserId,
9123
+ BaseDimensions.CloudTenantId,
9124
+ BaseDimensions.CloudOrganizationId,
9125
+ BaseDimensions.IsInternalUser,
9126
+ BaseDimensions.Environment,
9127
+ BaseDimensions.BaseUrl,
9128
+ BaseDimensions.Region,
9129
+ BaseDimensions.Agent,
9130
+ BaseDimensions.AgentVersion,
9131
+ BaseDimensions.ToolVersion,
9132
+ BaseDimensions.ExecutionContext,
9133
+ BaseDimensions.CiProvider,
9134
+ BaseDimensions.SessionIdSource,
9135
+ BaseDimensions.SessionId,
9136
+ ...Object.values(CommandDimensions),
9137
+ ...Object.values(ShipDimensions)
9138
+ ]);
9139
+ function assertNoCuratedDimensionTargets(map2, mapName) {
9140
+ for (const [inputKey, dimension] of Object.entries(map2)) {
9141
+ if (CURATED_DIMENSIONS.has(dimension)) {
9142
+ throw new Error(`${mapName}: input field "${inputKey}" maps to curated dimension "${dimension}"`);
9143
+ }
9144
+ }
9145
+ }
9146
+ function lowercaseIdDimensionValues(properties) {
9147
+ let changed = false;
9148
+ const result = {
9149
+ ...properties
9150
+ };
9151
+ for (const key of Object.keys(result)) {
9152
+ const value = result[key];
9153
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
9154
+ continue;
9155
+ }
9156
+ const lowered = value.toLowerCase();
9157
+ if (lowered !== value) {
9158
+ result[key] = lowered;
9159
+ changed = true;
9160
+ }
9161
+ }
9162
+ return changed ? result : properties;
9163
+ }
9164
+
8988
9165
  // src/telemetry/command-terminal.ts
8989
9166
  var recordedFailureSlot = singleton("CommandTelemetryFailure");
8990
9167
  var AUTH_ERROR_CODES = new Set([
8991
9168
  "authentication_required",
8992
9169
  "permission_denied"
8993
9170
  ]);
9171
+ var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
9172
+ "local_permission_denied"
9173
+ ]);
8994
9174
  var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
8995
9175
  var NETWORK_HTTP_ERROR_CODES = new Set([
8996
9176
  "network_error",
@@ -9131,6 +9311,9 @@ function classifyFromErrorCode(errorCode) {
9131
9311
  if (AUTH_ERROR_CODES.has(errorCode)) {
9132
9312
  return "auth";
9133
9313
  }
9314
+ if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
9315
+ return "local_permission";
9316
+ }
9134
9317
  if (VALIDATION_ERROR_CODES.has(errorCode)) {
9135
9318
  return "validation";
9136
9319
  }
@@ -9142,6 +9325,15 @@ function classifyFromErrorCode(errorCode) {
9142
9325
  }
9143
9326
  return;
9144
9327
  }
9328
+ function hasLocalPermissionCode(error) {
9329
+ for (const node of walkErrorGraph(error)) {
9330
+ const code = node.code;
9331
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
9332
+ return true;
9333
+ }
9334
+ }
9335
+ return false;
9336
+ }
9145
9337
  function classifyFromError(error) {
9146
9338
  const code = findCodeInCauseChain(error);
9147
9339
  if (code) {
@@ -9158,6 +9350,9 @@ function classifyFromError(error) {
9158
9350
  return "missing_dependency";
9159
9351
  }
9160
9352
  }
9353
+ if (hasLocalPermissionCode(error)) {
9354
+ return "local_permission";
9355
+ }
9161
9356
  const message = stringField(error, "message");
9162
9357
  if (message?.includes("fetch failed") === true) {
9163
9358
  return "network_http";
@@ -9173,7 +9368,7 @@ function classifyError2(input) {
9173
9368
  if (recorded?.errorClass) {
9174
9369
  return recorded.errorClass;
9175
9370
  }
9176
- const status = recorded?.context?.httpStatus;
9371
+ const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
9177
9372
  if (status !== undefined) {
9178
9373
  return classifyHttpStatus(status);
9179
9374
  }
@@ -9199,17 +9394,18 @@ function buildCommandTerminalTelemetryProperties(input) {
9199
9394
  const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
9200
9395
  const terminalSignal = terminalSignalFor(input, outcome);
9201
9396
  return {
9202
- exit_code: input.exitCode,
9203
- terminal_outcome: outcome,
9204
- ...errorClass ? { error_class: errorClass } : {},
9205
- ...terminalSignal ? { terminal_signal: terminalSignal } : {}
9397
+ [CommandDimensions.ExitCode]: input.exitCode,
9398
+ [CommandDimensions.TerminalOutcome]: outcome,
9399
+ ...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
9400
+ ...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
9206
9401
  };
9207
9402
  }
9208
9403
 
9209
9404
  // src/telemetry/telemetry-events.ts
9210
9405
  var CommonTelemetryEvents = {
9211
- Error: "uip.error",
9212
- ShipSucceeded: "uip.ship.succeeded"
9406
+ Start: "Application.Start",
9407
+ Error: "Application.Error",
9408
+ ShipSucceeded: "Cli.ShipSucceeded"
9213
9409
  };
9214
9410
 
9215
9411
  // src/telemetry/telemetry-init.ts
@@ -9406,14 +9602,14 @@ function deriveRegion(baseUrl) {
9406
9602
  }
9407
9603
  function buildEnvironmentProperties(baseUrl) {
9408
9604
  const props = {
9409
- environment: normalizeEnvironment(baseUrl)
9605
+ [BaseDimensions.Environment]: normalizeEnvironment(baseUrl)
9410
9606
  };
9411
9607
  const normalized = normalizeBaseUrl(baseUrl);
9412
9608
  if (normalized)
9413
- props.base_url = normalized;
9609
+ props[BaseDimensions.BaseUrl] = normalized;
9414
9610
  const region = deriveRegion(baseUrl);
9415
9611
  if (region)
9416
- props.region = region;
9612
+ props[BaseDimensions.Region] = region;
9417
9613
  return props;
9418
9614
  }
9419
9615
  // src/telemetry/execution-context.ts
@@ -9525,8 +9721,8 @@ function detectExecutionContext(options = {}) {
9525
9721
  function getExecutionContextTelemetryProperties() {
9526
9722
  const detected = detectExecutionContext();
9527
9723
  return {
9528
- execution_context: detected.executionContext,
9529
- ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
9724
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
9725
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
9530
9726
  };
9531
9727
  }
9532
9728
  // src/telemetry/node-context-storage.ts
@@ -9569,7 +9765,7 @@ function getInboundTraceContext() {
9569
9765
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
9570
9766
  var SESSION_ID_MAX_LENGTH = 64;
9571
9767
  var RANDOM_SESSION_ID_LENGTH = 32;
9572
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
9768
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
9573
9769
  var CONTROL_CHARACTERS = /\p{Cc}/gu;
9574
9770
  var INHERITED_SESSION_SOURCES = [
9575
9771
  { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
@@ -9708,7 +9904,10 @@ class TelemetryService {
9708
9904
  } catch (error) {
9709
9905
  const durationMs = clock.elapsedMs();
9710
9906
  const err = error instanceof Error ? error : new Error(String(error));
9711
- await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
9907
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
9908
+ ...properties,
9909
+ [CommandDimensions.ErrorMessage]: err.message
9910
+ }, context));
9712
9911
  throw error;
9713
9912
  }
9714
9913
  }
@@ -9779,7 +9978,10 @@ class TelemetryService {
9779
9978
  const durationMs = clock.elapsedMs();
9780
9979
  const err = error instanceof Error ? error : new Error(String(error));
9781
9980
  await this.telemetryProvider.trackDependency({
9782
- ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
9981
+ ...this.spanFor(name, durationMs, false, {
9982
+ ...properties,
9983
+ [CommandDimensions.ErrorMessage]: err.message
9984
+ }, childContext),
9783
9985
  type: type2
9784
9986
  });
9785
9987
  throw error;
@@ -9814,9 +10016,10 @@ class TelemetryService {
9814
10016
  ...globalProperties,
9815
10017
  ...this.defaultProperties,
9816
10018
  ...redactProperties(properties ?? {}),
9817
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
10019
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
10020
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
9818
10021
  };
9819
- return enriched;
10022
+ return lowercaseIdDimensionValues(enriched);
9820
10023
  }
9821
10024
  generateId() {
9822
10025
  const bytes = new Uint8Array(8);
@@ -10072,7 +10275,7 @@ function makeTrackedFetch(realFetch) {
10072
10275
  telemetry.trackDependencyResult(name, "HTTP", durationMs, false, {
10073
10276
  "server.address": url.host,
10074
10277
  "http.request.method": method,
10075
- errorMessage: error instanceof Error ? error.message : String(error)
10278
+ [CommandDimensions.ErrorMessage]: error instanceof Error ? error.message : String(error)
10076
10279
  }, context);
10077
10280
  throw error;
10078
10281
  }
@@ -10922,6 +11125,7 @@ class SuccessOutput {
10922
11125
  Data;
10923
11126
  Pagination;
10924
11127
  Instructions;
11128
+ Warning;
10925
11129
  Log;
10926
11130
  constructor(code, data) {
10927
11131
  this.Code = code;
@@ -11069,6 +11273,9 @@ function toPascalCaseData(value, verbatimKeys, subtrees) {
11069
11273
  function normalizeDataKeys(data, verbatimKeys, subtrees) {
11070
11274
  return toPascalCaseData(data, verbatimKeys, subtrees);
11071
11275
  }
11276
+ function pascalCaseDataKeys(data) {
11277
+ return normalizeDataKeys(data);
11278
+ }
11072
11279
  function toVerbatimKeySet(preserve) {
11073
11280
  if (!Array.isArray(preserve))
11074
11281
  return;
@@ -11563,7 +11770,165 @@ class ConfigurationError extends Error {
11563
11770
  function isConfigurationError(error) {
11564
11771
  return typeof error === "object" && error !== null && "__brand" in error && error.__brand === "ConfigurationError";
11565
11772
  }
11566
- function applyFilter(data, filter) {
11773
+ function countRecords(data) {
11774
+ if (Array.isArray(data))
11775
+ return data.length;
11776
+ return data == null ? 0 : 1;
11777
+ }
11778
+ function availableFields(data) {
11779
+ const records = Array.isArray(data) ? data : [data];
11780
+ const keys = new Set;
11781
+ for (const record of records) {
11782
+ if (record && typeof record === "object" && !Array.isArray(record)) {
11783
+ for (const key of Object.keys(record))
11784
+ keys.add(key);
11785
+ }
11786
+ }
11787
+ return [...keys];
11788
+ }
11789
+ function decodeQuotedIdentifier(whole, inner) {
11790
+ const [error, decoded] = catchError(() => JSON.parse(whole));
11791
+ if (!error && typeof decoded === "string")
11792
+ return decoded;
11793
+ return inner.replace(/\\(.)/g, "$1");
11794
+ }
11795
+ function referencedFields(filter) {
11796
+ const top = new Set;
11797
+ const nested = new Set;
11798
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
11799
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
11800
+ const quoted = [];
11801
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
11802
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
11803
+ if (!isAlias) {
11804
+ quoted.push({
11805
+ name: decodeQuotedIdentifier(whole, name),
11806
+ index,
11807
+ tail: isPathTail(withoutValueLiterals, index)
11808
+ });
11809
+ }
11810
+ return `"${" ".repeat(whole.length - 2)}"`;
11811
+ });
11812
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
11813
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
11814
+ const place = (name, index, tail) => {
11815
+ if (tail || index >= rootEnd)
11816
+ nested.add(name);
11817
+ else
11818
+ top.add(name);
11819
+ };
11820
+ for (const entry of quoted)
11821
+ place(entry.name, entry.index, entry.tail);
11822
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
11823
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
11824
+ for (const match of identifiers) {
11825
+ const [, name, trailing] = match;
11826
+ if (trailing || reserved.has(name))
11827
+ continue;
11828
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
11829
+ }
11830
+ return {
11831
+ top: [...top],
11832
+ nested: [...nested].filter((name) => !top.has(name)),
11833
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
11834
+ };
11835
+ }
11836
+ function appearsBelowTopLevel(data, name) {
11837
+ let budget = 2000;
11838
+ const visit = (value, depth) => {
11839
+ if (budget-- <= 0 || depth > 4)
11840
+ return false;
11841
+ if (value === null || typeof value !== "object")
11842
+ return false;
11843
+ if (Array.isArray(value))
11844
+ return value.some((entry) => visit(entry, depth));
11845
+ const record = value;
11846
+ if (depth > 0 && Object.hasOwn(record, name))
11847
+ return true;
11848
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
11849
+ };
11850
+ return visit(data, 0);
11851
+ }
11852
+ function alwaysNullKeys(records) {
11853
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
11854
+ if (objects.length === 0 || objects.length !== records.length)
11855
+ return [];
11856
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
11857
+ if (keys.length === 0)
11858
+ return [];
11859
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
11860
+ return nullKeys.length === keys.length ? nullKeys : [];
11861
+ }
11862
+ function carriesOnlyNulls(value) {
11863
+ if (value === null)
11864
+ return true;
11865
+ if (Array.isArray(value)) {
11866
+ return value.length > 0 && value.every(carriesOnlyNulls);
11867
+ }
11868
+ if (typeof value === "object" && value !== undefined) {
11869
+ const values = Object.values(value);
11870
+ return values.length > 0 && values.every(carriesOnlyNulls);
11871
+ }
11872
+ return false;
11873
+ }
11874
+ function nameList(names, cap2 = 12) {
11875
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
11876
+ const rest = names.length - shown.length;
11877
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
11878
+ }
11879
+ function buildFilterWarning(filter, data, outcome) {
11880
+ const present = availableFields(data);
11881
+ const refs = referencedFields(filter);
11882
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
11883
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
11884
+ const count = countRecords(data);
11885
+ const scope = `${count} record(s)`;
11886
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
11887
+ 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" : "";
11888
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
11889
+ let detail;
11890
+ let lede;
11891
+ if (outcome.kind === "null-elements") {
11892
+ lede = "returned only null values";
11893
+ const projected = `all ${outcome.count} of the elements it projected are null`;
11894
+ if (unknown.length > 0) {
11895
+ detail = `${projected}, because ${isNotAField(unknown)}`;
11896
+ } else if (unchecked.length > 0) {
11897
+ detail = withSoundness(projected);
11898
+ } else {
11899
+ 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`;
11900
+ }
11901
+ } else if (outcome.kind === "null-rows") {
11902
+ lede = "returned only null values";
11903
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
11904
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
11905
+ } else if (outcome.kind === "null-values") {
11906
+ lede = "returned only null values";
11907
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
11908
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
11909
+ if (sameSet) {
11910
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
11911
+ } else if (unknown.length > 0) {
11912
+ detail = `${projected}, because ${isNotAField(unknown)}`;
11913
+ } else {
11914
+ detail = withSoundness(`${projected} on all ${scope}`);
11915
+ }
11916
+ } else {
11917
+ lede = "returned nothing";
11918
+ if (unknown.length > 0) {
11919
+ detail = isNotAField(unknown);
11920
+ } else {
11921
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
11922
+ detail = withSoundness(`${selection} — it read ${scope}`);
11923
+ }
11924
+ }
11925
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
11926
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
11927
+ }
11928
+ function appendWarning(existing, note) {
11929
+ return existing ? `${existing} ${note}` : note;
11930
+ }
11931
+ function applyFilter(data, filter, onWarning) {
11567
11932
  const codec = requireJmespath();
11568
11933
  let result;
11569
11934
  try {
@@ -11571,9 +11936,34 @@ function applyFilter(data, filter) {
11571
11936
  } catch (err) {
11572
11937
  throw new FilterEvaluationError(filter, err);
11573
11938
  }
11574
- if (result == null)
11939
+ const inputCount = countRecords(data);
11940
+ const warn = (outcome) => {
11941
+ if (inputCount === 0)
11942
+ return;
11943
+ const note = buildFilterWarning(filter, data, outcome);
11944
+ getOutputSink().writeErr(`[WARN] ${note}
11945
+ `);
11946
+ onWarning?.(note);
11947
+ };
11948
+ const warnIfAllNull = (records) => {
11949
+ const keys = alwaysNullKeys(records);
11950
+ if (keys.length > 0)
11951
+ warn({ kind: "null-values", keys });
11952
+ };
11953
+ if (result == null) {
11954
+ warn({ kind: "empty" });
11575
11955
  return [];
11956
+ }
11576
11957
  if (Array.isArray(result)) {
11958
+ if (result.length === 0) {
11959
+ warn({ kind: "empty" });
11960
+ } else if (result.every((entry) => entry === null)) {
11961
+ warn({ kind: "null-elements", count: result.length });
11962
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
11963
+ warn({ kind: "null-rows", count: result.length });
11964
+ } else {
11965
+ warnIfAllNull(result);
11966
+ }
11577
11967
  if (result.length > 0 && typeof result[0] !== "object") {
11578
11968
  const fieldMatch = filter.match(/\.(\w+)$/);
11579
11969
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -11581,10 +11971,30 @@ function applyFilter(data, filter) {
11581
11971
  }
11582
11972
  return result;
11583
11973
  }
11584
- if (typeof result === "object")
11974
+ if (typeof result === "object") {
11975
+ warnIfAllNull([result]);
11585
11976
  return result;
11977
+ }
11586
11978
  return { Value: result };
11587
11979
  }
11980
+ function filterFailureData(envelope) {
11981
+ const filter = getOutputFilter();
11982
+ const data = envelope.Data;
11983
+ if (!filter || data == null)
11984
+ return;
11985
+ let note;
11986
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
11987
+ note = n;
11988
+ }));
11989
+ if (filterError) {
11990
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
11991
+ return;
11992
+ }
11993
+ envelope.Data = filtered;
11994
+ if (note) {
11995
+ envelope.Warning = appendWarning(envelope.Warning, note);
11996
+ }
11997
+ }
11588
11998
  function defaultErrorCodeForResult(result) {
11589
11999
  switch (result) {
11590
12000
  case RESULTS.AuthenticationError:
@@ -11628,7 +12038,7 @@ function defaultErrorCodeForHttpStatus(status) {
11628
12038
  return "server_error";
11629
12039
  return;
11630
12040
  }
11631
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
12041
+ var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
11632
12042
  function defaultErrorCodeForFailure(data) {
11633
12043
  if (data.Result === RESULTS.Failure) {
11634
12044
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
@@ -11667,8 +12077,14 @@ var OutputFormatter;
11667
12077
  }
11668
12078
  const filter = getOutputFilter();
11669
12079
  if (filter) {
11670
- const filtered = applyFilter(data.Data, filter);
12080
+ let note;
12081
+ const filtered = applyFilter(data.Data, filter, (n) => {
12082
+ note = n;
12083
+ });
11671
12084
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
12085
+ if (note) {
12086
+ data.Warning = appendWarning(data.Warning, note);
12087
+ }
11672
12088
  }
11673
12089
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
11674
12090
  }
@@ -11696,12 +12112,13 @@ var OutputFormatter;
11696
12112
  delete envelope.TelemetryErrorClass;
11697
12113
  delete envelope.TelemetryTerminalOutcome;
11698
12114
  delete envelope.TelemetryTerminalSignal;
12115
+ filterFailureData(envelope);
11699
12116
  if (!suppressTelemetry) {
11700
12117
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
11701
- result: data.Result,
11702
- errorCode: data.ErrorCode,
11703
- retry: data.Retry,
11704
- message: data.Message
12118
+ [ErrorDimensions.Result]: data.Result,
12119
+ [ErrorDimensions.ErrorCode]: data.ErrorCode,
12120
+ [ErrorDimensions.Retry]: data.Retry,
12121
+ [ErrorDimensions.ErrorMessage]: data.Message
11705
12122
  });
11706
12123
  }
11707
12124
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -11744,13 +12161,20 @@ var OutputFormatter;
11744
12161
  OutputFormatter.log = log;
11745
12162
  function formatToString(data) {
11746
12163
  const filter = getOutputFilter();
12164
+ const envelope = data;
11747
12165
  if ("Data" in data && data.Data != null) {
11748
12166
  data.Data = normalizeDataKeys(data.Data);
11749
12167
  if (filter) {
11750
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
12168
+ let note;
12169
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
12170
+ note = n;
12171
+ }));
12172
+ if (note) {
12173
+ envelope.Warning = appendWarning(envelope.Warning, note);
12174
+ }
11751
12175
  }
11752
12176
  }
11753
- const output = normalizeOutputKeys(data);
12177
+ const output = normalizeOutputKeys(envelope);
11754
12178
  const lines = [];
11755
12179
  const sink = getOutputSink();
11756
12180
  printOutput(output, getOutputFormat(), (msg) => {
@@ -11829,7 +12253,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
11829
12253
  var MAX_SKILL_NAME_LENGTH = 80;
11830
12254
  var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
11831
12255
  function productMode(productArea, mode) {
11832
- return { product_area: productArea, mode };
12256
+ return { ProductArea: productArea, Mode: mode };
11833
12257
  }
11834
12258
  function attributionRecord(groups) {
11835
12259
  const record = {};
@@ -11887,6 +12311,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
11887
12311
  ["rpa", "build", ["uip.rpa-legacy"]],
11888
12312
  ["conversational", "operate", ["uip.conversational"]],
11889
12313
  ["agents", "build", ["uip.codedagent", "uip.agent"]],
12314
+ ["coding-agents", "build", ["uip.coder"]],
11890
12315
  ["agenthub", "build", ["uip.agenthub"]],
11891
12316
  ["coded-apps", "build", ["uip.codedapp"]],
11892
12317
  ["functions", "build", ["uip.function", "uip.functions"]],
@@ -11977,7 +12402,7 @@ function normalizeLegacySkillName(value) {
11977
12402
  function buildCommandTelemetryAttribution(commandPath, skillSource) {
11978
12403
  const skillName = normalizeSkillName(skillSource);
11979
12404
  return {
11980
- ...skillName ? { skill_name: skillName } : {},
12405
+ ...skillName ? { SkillName: skillName } : {},
11981
12406
  ...getCommandProductModeAttribution(commandPath)
11982
12407
  };
11983
12408
  }
@@ -11988,31 +12413,64 @@ function buildSkillEventTelemetryAttribution(skillSource, uipSubcommand) {
11988
12413
  return {
11989
12414
  ...skillAttribution,
11990
12415
  ...commandAttribution2,
11991
- ...skillName ? { skill_name: skillName } : {}
12416
+ ...skillName ? { SkillName: skillName } : {}
11992
12417
  };
11993
12418
  }
12419
+ var AGENT_SESSION_ENV = {
12420
+ [BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
12421
+ [SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
12422
+ [SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
12423
+ [SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
12424
+ };
12425
+ var MAX_TELEMETRY_TOKEN_LENGTH = 120;
12426
+ function sanitizeTelemetryToken(value) {
12427
+ return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
12428
+ }
12429
+ function buildAgentSessionTelemetry(env) {
12430
+ const dimensions = {};
12431
+ for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
12432
+ const value = env[variable]?.trim();
12433
+ if (value) {
12434
+ dimensions[key] = sanitizeTelemetryToken(value);
12435
+ }
12436
+ }
12437
+ return dimensions;
12438
+ }
11994
12439
 
11995
12440
  // src/telemetry/command-name.ts
11996
- var TELEMETRY_COMMAND_ROOT = "uip";
12441
+ var TELEMETRY_NAME_ROOT = "Cli";
12442
+ var CLI_COMMAND_ROOT = "uip";
12443
+ var TELEMETRY_COMMAND_ROOT = CLI_COMMAND_ROOT;
12444
+ var TELEMETRY_NAME_BARE_ACTION = "Invoke";
11997
12445
  function commandTelemetryName(parts) {
12446
+ const action = vetCommandTokens(parts).map(pascalizeToken).join("");
12447
+ return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
12448
+ }
12449
+ function commandInvocationPath(parts) {
12450
+ return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
12451
+ }
12452
+ function vetCommandTokens(parts) {
11998
12453
  const tokens = [];
11999
12454
  for (const part of parts) {
12000
- const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
12455
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
12001
12456
  if (pieces.every(isCommandToken)) {
12002
12457
  tokens.push(...pieces);
12003
12458
  continue;
12004
12459
  }
12005
12460
  tokens.push(UNKNOWN_TOKEN);
12006
12461
  }
12007
- return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
12462
+ return tokens;
12463
+ }
12464
+ function pascalizeToken(token) {
12465
+ return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
12008
12466
  }
12009
- var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
12467
+ var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
12010
12468
  var MAX_COMMAND_TOKEN_LENGTH = 32;
12011
12469
  var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12012
12470
  function isCommandToken(token) {
12013
- return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
12471
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
12014
12472
  }
12015
- var UNKNOWN_TOKEN = "<unknown>";
12473
+ var UNKNOWN_TOKEN = "unknown";
12016
12474
 
12017
12475
  // src/telemetry/invocation-request.ts
12018
12476
  var requestContextSlot = singleton("TelemetryInvocationRequestContext");
@@ -12123,7 +12581,7 @@ function withheldArgumentValues(cmd) {
12123
12581
  });
12124
12582
  return values;
12125
12583
  }
12126
- function deriveCommandPath(cmd) {
12584
+ function deriveCommandParts(cmd) {
12127
12585
  const parts = [];
12128
12586
  let current = cmd;
12129
12587
  while (current) {
@@ -12136,14 +12594,16 @@ function deriveCommandPath(cmd) {
12136
12594
  if (parts.length > 1) {
12137
12595
  parts.shift();
12138
12596
  }
12139
- return commandTelemetryName(parts);
12597
+ return parts;
12598
+ }
12599
+ function deriveCommandPath(cmd) {
12600
+ return commandTelemetryName(deriveCommandParts(cmd));
12140
12601
  }
12141
12602
  function isErrorContext(value) {
12142
12603
  return value !== null && typeof value === "object";
12143
12604
  }
12144
12605
  function commandHelpHint(commandPath) {
12145
- const command = commandPath.replace(/\./g, " ");
12146
- return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
12606
+ return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
12147
12607
  }
12148
12608
  function isPromptCancellation(error) {
12149
12609
  return error instanceof Error && error.name === "ExitPromptError";
@@ -12168,7 +12628,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12168
12628
  yaml: getOutputFormat() === "yaml",
12169
12629
  filter: getOutputFilter() !== undefined
12170
12630
  });
12171
- const telemetryName = deriveCommandPath(command);
12631
+ const commandParts = deriveCommandParts(command);
12632
+ const telemetryName = commandTelemetryName(commandParts);
12633
+ const commandPath = commandInvocationPath(commandParts);
12172
12634
  const props = typeof properties === "function" ? properties(...args) : properties;
12173
12635
  markCommandStart();
12174
12636
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
@@ -12203,7 +12665,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12203
12665
  Result: finalResult,
12204
12666
  ...customErrorCode ? { ErrorCode: customErrorCode } : {},
12205
12667
  Message: errorMessage,
12206
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
12668
+ Instructions: customInstructions ?? commandHelpHint(commandPath),
12207
12669
  ...customRetry ? { Retry: customRetry } : {},
12208
12670
  ...customContext ? { Context: customContext } : {}
12209
12671
  });
@@ -12220,8 +12682,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12220
12682
  recordedFailure,
12221
12683
  pollSignal: context.pollSignal
12222
12684
  });
12223
- if (terminalTelemetry.error_class === "internal" && error) {
12224
- telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
12685
+ if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
12686
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
12225
12687
  }
12226
12688
  const commandParams = extractCommandParams(command);
12227
12689
  if (props) {
@@ -12232,10 +12694,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
12232
12694
  const baseProperties = redactProperties({
12233
12695
  ...commandParams,
12234
12696
  ...props,
12235
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
12236
- command: "true",
12697
+ ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
12698
+ ...buildAgentSessionTelemetry(process.env),
12699
+ [CommandDimensions.CommandName]: commandPath,
12700
+ [CommandDimensions.IsCommand]: "true",
12237
12701
  ...terminalTelemetry,
12238
- ...errorMessage ? { errorMessage } : {}
12702
+ ...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
12239
12703
  });
12240
12704
  emitInvocationRequest(telemetryName, success, baseProperties);
12241
12705
  } finally {
@@ -12849,6 +13313,49 @@ function canPrompt() {
12849
13313
  const capabilities = getOutputSink().capabilities;
12850
13314
  return capabilities.isInteractive && capabilities.canReadInput;
12851
13315
  }
13316
+ // src/mime-types.ts
13317
+ var OCTET_STREAM = "application/octet-stream";
13318
+ var MIME_TYPES_BY_EXTENSION = Object.freeze({
13319
+ pdf: "application/pdf",
13320
+ png: "image/png",
13321
+ jpg: "image/jpeg",
13322
+ jpeg: "image/jpeg",
13323
+ gif: "image/gif",
13324
+ webp: "image/webp",
13325
+ bmp: "image/bmp",
13326
+ tif: "image/tiff",
13327
+ tiff: "image/tiff",
13328
+ svg: "image/svg+xml",
13329
+ txt: "text/plain",
13330
+ log: "text/plain",
13331
+ md: "text/markdown",
13332
+ csv: "text/csv",
13333
+ tsv: "text/tab-separated-values",
13334
+ json: "application/json",
13335
+ xml: "application/xml",
13336
+ html: "text/html",
13337
+ htm: "text/html",
13338
+ yaml: "application/yaml",
13339
+ yml: "application/yaml",
13340
+ doc: "application/msword",
13341
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
13342
+ xls: "application/vnd.ms-excel",
13343
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
13344
+ ppt: "application/vnd.ms-powerpoint",
13345
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
13346
+ zip: "application/zip",
13347
+ mp3: "audio/mpeg",
13348
+ wav: "audio/wav",
13349
+ mp4: "video/mp4"
13350
+ });
13351
+ function mimeTypeForFileName(fileName) {
13352
+ const dot = fileName.lastIndexOf(".");
13353
+ if (dot < 0 || dot === fileName.length - 1) {
13354
+ return OCTET_STREAM;
13355
+ }
13356
+ const extension = fileName.slice(dot + 1).toLowerCase();
13357
+ return Object.hasOwn(MIME_TYPES_BY_EXTENSION, extension) ? MIME_TYPES_BY_EXTENSION[extension] : OCTET_STREAM;
13358
+ }
12852
13359
  // src/option-aliases.ts
12853
13360
  function resolveDeprecatedOptionAlias({
12854
13361
  preferredValue,
@@ -13522,7 +14029,7 @@ var ScreenLogger;
13522
14029
  // src/sdk-user-agent.ts
13523
14030
  var USER_AGENT_HEADER = "User-Agent";
13524
14031
  var CODING_AGENT_HEADER = "x-coding-agent-info";
13525
- var AGENT_PROPERTY = "agent";
14032
+ var AGENT_PROPERTY = BaseDimensions.Agent;
13526
14033
  var CODING_AGENT_PROPERTY = "CodingAgent";
13527
14034
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
13528
14035
  function userAgentPatchKey(userAgent) {
@@ -13736,21 +14243,21 @@ function getShippedKeys() {
13736
14243
  }
13737
14244
  function dedupeKey(payload) {
13738
14245
  return [
13739
- payload.command_name,
13740
- payload.ship_kind,
13741
- payload.target,
13742
- payload.project_type,
13743
- payload.artifact_correlation_key ?? payload.package_version_key ?? payload.deployment_key ?? payload.solution_id ?? payload.package_name ?? ""
14246
+ payload.CommandName,
14247
+ payload.ShipKind,
14248
+ payload.Target,
14249
+ payload.ProjectType,
14250
+ payload.ArtifactCorrelationKey ?? payload.PackageVersionKey ?? payload.DeploymentKey ?? payload.SolutionId ?? payload.PackageName ?? ""
13744
14251
  ].join("|");
13745
14252
  }
13746
14253
  function withPseudonymizedIdentifiers(payload) {
13747
14254
  return {
13748
14255
  ...payload,
13749
- ...payload.package_name === undefined ? {} : {
13750
- package_name: `package#${pseudonymize(payload.package_name)}`
14256
+ ...payload.PackageName === undefined ? {} : {
14257
+ PackageName: `package#${pseudonymize(payload.PackageName)}`
13751
14258
  },
13752
- ...payload.artifact_correlation_key === undefined ? {} : {
13753
- artifact_correlation_key: `artifact#${pseudonymize(payload.artifact_correlation_key)}`
14259
+ ...payload.ArtifactCorrelationKey === undefined ? {} : {
14260
+ ArtifactCorrelationKey: `artifact#${pseudonymize(payload.ArtifactCorrelationKey)}`
13754
14261
  }
13755
14262
  };
13756
14263
  }
@@ -13793,10 +14300,16 @@ export {
13793
14300
  ATTACHMENT_INSTRUCTIONS,
13794
14301
  ATTACHMENT_UPLOAD_INSTRUCTIONS,
13795
14302
  AUTH_FILENAME,
14303
+ AuthDimensions,
13796
14304
  BACKOFF_DEFAULTS,
14305
+ BaseDimensions,
13797
14306
  BrowserContextStorage,
14307
+ CLI_APPLICATION_NAME,
14308
+ CLI_COMMAND_ROOT,
13798
14309
  CLI_ERROR_CODES,
13799
14310
  CONFIG_FILENAME,
14311
+ CURATED_DIMENSIONS,
14312
+ CommandDimensions,
13800
14313
  CommonTelemetryEvents,
13801
14314
  ConfigurationError,
13802
14315
  ConsoleTelemetryProvider,
@@ -13806,35 +14319,49 @@ export {
13806
14319
  DEFAULT_LOG_LEVEL,
13807
14320
  DEFAULT_PAGE_SIZE,
13808
14321
  DEFAULT_REDIRECT_URI,
14322
+ DIMENSION_NAME_EXEMPT_PREFIXES,
14323
+ DIMENSION_NAME_PATTERN,
13809
14324
  DebugTelemetryProvider,
14325
+ EVENT_NAME_PATTERN,
13810
14326
  EXECUTION_CONTEXT_VALUES,
13811
14327
  EXIT_CODES,
13812
14328
  ErrorDecision,
14329
+ ErrorDimensions,
13813
14330
  FailureOutput,
13814
14331
  FilterEvaluationError,
13815
14332
  FilterImplicitLimitError,
13816
14333
  HOST_GLOBAL_FLAGS,
13817
14334
  HOST_GLOBAL_OPTIONS_WITH_VALUE,
14335
+ ID_DIMENSIONS,
13818
14336
  LogLevel,
13819
14337
  MAX_SPOOL_AGE_MS,
13820
14338
  MAX_SPOOL_FILES,
14339
+ MIME_TYPES_BY_EXTENSION,
13821
14340
  MIN_INTERVAL_MS,
13822
14341
  NodeContextStorage,
14342
+ OCTET_STREAM,
13823
14343
  OUTPUT_FORMATS,
13824
14344
  OutputFormatter,
13825
14345
  POLL_DEFAULTS,
14346
+ PackagerDimensions,
13826
14347
  Pagination,
13827
14348
  PollOutcome,
13828
14349
  REGISTER_EXPORT,
14350
+ RESERVED_DIMENSION_NAMES,
13829
14351
  RESULTS,
13830
14352
  RETRY_HINTS,
14353
+ ScopeDimensions,
13831
14354
  ScreenLogger,
14355
+ ShipDimensions,
14356
+ SkillsDimensions,
13832
14357
  SuccessOutput,
13833
14358
  TELEMETRY_ARG_VALUE_DEFAULTED,
13834
14359
  TELEMETRY_ARG_VALUE_WITHHELD,
13835
14360
  TELEMETRY_COMMAND_ARG_PREFIX,
13836
14361
  TELEMETRY_COMMAND_ROOT,
13837
14362
  TELEMETRY_DRAIN_ARGV,
14363
+ TELEMETRY_NAME_BARE_ACTION,
14364
+ TELEMETRY_NAME_ROOT,
13838
14365
  TELEMETRY_SESSION_ID_ENV,
13839
14366
  TELEMETRY_SESSION_SOURCE_PROPERTY,
13840
14367
  TELEMETRY_TRACEPARENT_ENV,
@@ -13847,8 +14374,10 @@ export {
13847
14374
  addSdkCodingAgentHeader,
13848
14375
  addSdkUserAgentHeader,
13849
14376
  appendOption,
14377
+ assertNoCuratedDimensionTargets,
13850
14378
  buildActionCenterInboxUrl,
13851
14379
  buildActionCenterTaskUrl,
14380
+ buildAgentSessionTelemetry,
13852
14381
  buildCommandTelemetryAttribution,
13853
14382
  buildCommandTerminalTelemetryProperties,
13854
14383
  buildEnvironmentProperties,
@@ -13864,12 +14393,14 @@ export {
13864
14393
  clearRecordedCommandFailureTelemetry,
13865
14394
  clearSuppliedArgumentValues,
13866
14395
  collectCommands,
14396
+ commandInvocationPath,
13867
14397
  commandTelemetryName,
13868
14398
  configureLogger,
13869
14399
  createAppInsightsProvider,
13870
14400
  createHiddenDeprecatedTenantOption,
13871
14401
  createPollAbortController,
13872
14402
  createTelemetryProvider,
14403
+ deriveCommandParts,
13873
14404
  deriveCommandPath,
13874
14405
  describeConnectivityError,
13875
14406
  describePermissionError,
@@ -13927,6 +14458,7 @@ export {
13927
14458
  invocationStartedAt,
13928
14459
  isCliErrorCode,
13929
14460
  isConfigurationError,
14461
+ isExemptDimensionName,
13930
14462
  isFailureStatus,
13931
14463
  isGuid,
13932
14464
  isHtmlDocument,
@@ -13938,11 +14470,13 @@ export {
13938
14470
  isTerminalStatus,
13939
14471
  loadOutputCodecsAsync,
13940
14472
  logger,
14473
+ lowercaseIdDimensionValues,
13941
14474
  makeTrackedFetch,
13942
14475
  mapPackageMetadataOptions,
13943
14476
  mapPollFailure,
13944
14477
  markCommandStart,
13945
14478
  markLongLivedHost,
14479
+ mimeTypeForFileName,
13946
14480
  msToDuration,
13947
14481
  normalizeBaseUrl,
13948
14482
  normalizeEnvironment,
@@ -13955,10 +14489,12 @@ export {
13955
14489
  parseNonNegativeInteger,
13956
14490
  parseOffset,
13957
14491
  parsePositiveInteger,
14492
+ pascalCaseDataKeys,
13958
14493
  pollUntil,
13959
14494
  previewOnly,
13960
14495
  processContext,
13961
14496
  pseudonymize,
14497
+ readAttachmentSpecs,
13962
14498
  readRegistryValue,
13963
14499
  readStdin,
13964
14500
  readStdinWithTimeout,
@@ -13989,6 +14525,7 @@ export {
13989
14525
  runWithInvocationRequest,
13990
14526
  runWithSink,
13991
14527
  runWithTimings,
14528
+ sanitizeTelemetryToken,
13992
14529
  setExecutionContextAuthSignal,
13993
14530
  setExitCode,
13994
14531
  setGlobalLogFilePath,
@@ -14032,4 +14569,4 @@ export {
14032
14569
  writeTelemetrySpoolFile
14033
14570
  };
14034
14571
 
14035
- //# debugId=1C8485A93560E50864756E2164756E21
14572
+ //# debugId=8CEC7672768EA47864756E2164756E21