@uipath/eval-tool 1.203.0-preview.212 → 1.204.0-preview.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2650,9 +2650,60 @@ function settlePromiseLike(thenable) {
|
|
|
2650
2650
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2651
2651
|
}
|
|
2652
2652
|
|
|
2653
|
+
// ../common/src/error-graph.ts
|
|
2654
|
+
function* walkErrorGraph(error) {
|
|
2655
|
+
const queue = [error];
|
|
2656
|
+
const seen = new Set;
|
|
2657
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2658
|
+
const current = queue.shift();
|
|
2659
|
+
if (current === null || typeof current !== "object")
|
|
2660
|
+
continue;
|
|
2661
|
+
if (seen.has(current))
|
|
2662
|
+
continue;
|
|
2663
|
+
seen.add(current);
|
|
2664
|
+
const cur = current;
|
|
2665
|
+
yield cur;
|
|
2666
|
+
if (cur.cause !== undefined)
|
|
2667
|
+
queue.push(cur.cause);
|
|
2668
|
+
if (Array.isArray(cur.errors))
|
|
2669
|
+
queue.push(...cur.errors);
|
|
2670
|
+
}
|
|
2671
|
+
return;
|
|
2672
|
+
}
|
|
2673
|
+
function parseHttpStatusFromMessage(message) {
|
|
2674
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2675
|
+
if (!match)
|
|
2676
|
+
return;
|
|
2677
|
+
const status = Number(match[1]);
|
|
2678
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2679
|
+
}
|
|
2680
|
+
function findHttpStatusInGraph(error) {
|
|
2681
|
+
for (const node of walkErrorGraph(error)) {
|
|
2682
|
+
const response = node.response;
|
|
2683
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2684
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2685
|
+
return explicit;
|
|
2686
|
+
}
|
|
2687
|
+
if (typeof node.message === "string") {
|
|
2688
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2689
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
2690
|
+
return parsed;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
return;
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
// ../common/src/local-permission-codes.ts
|
|
2698
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2699
|
+
"EACCES",
|
|
2700
|
+
"EPERM",
|
|
2701
|
+
"EROFS"
|
|
2702
|
+
]);
|
|
2703
|
+
|
|
2653
2704
|
// ../common/src/error-handler.ts
|
|
2654
|
-
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to
|
|
2655
|
-
var DEFAULT_403 = "Forbidden (403).
|
|
2705
|
+
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.";
|
|
2706
|
+
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.";
|
|
2656
2707
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2657
2708
|
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.";
|
|
2658
2709
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
@@ -2679,16 +2730,22 @@ var TLS_ERROR_CODES = new Set([
|
|
|
2679
2730
|
]);
|
|
2680
2731
|
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.";
|
|
2681
2732
|
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.";
|
|
2682
|
-
var
|
|
2683
|
-
var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
|
|
2733
|
+
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
2684
2734
|
function localPermissionInstructions(code, path) {
|
|
2685
2735
|
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
2686
2736
|
if (code === "EROFS") {
|
|
2687
2737
|
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.";
|
|
2688
2738
|
}
|
|
2689
|
-
const
|
|
2739
|
+
const onWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
2740
|
+
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.";
|
|
2690
2741
|
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}`;
|
|
2691
2742
|
}
|
|
2743
|
+
function carriedInstructions(error) {
|
|
2744
|
+
if (!error || typeof error !== "object")
|
|
2745
|
+
return;
|
|
2746
|
+
const e = error;
|
|
2747
|
+
return typeof e.instructions === "string" ? e.instructions : undefined;
|
|
2748
|
+
}
|
|
2692
2749
|
function describeConnectivityError(error) {
|
|
2693
2750
|
for (const cur of walkErrorGraph(error)) {
|
|
2694
2751
|
const code = typeof cur.code === "string" ? cur.code : undefined;
|
|
@@ -2740,48 +2797,6 @@ function localPermissionPath(path, message) {
|
|
|
2740
2797
|
return path;
|
|
2741
2798
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
2742
2799
|
}
|
|
2743
|
-
function* walkErrorGraph(error) {
|
|
2744
|
-
const queue = [error];
|
|
2745
|
-
const seen = new Set;
|
|
2746
|
-
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2747
|
-
const current = queue.shift();
|
|
2748
|
-
if (current === null || typeof current !== "object")
|
|
2749
|
-
continue;
|
|
2750
|
-
if (seen.has(current))
|
|
2751
|
-
continue;
|
|
2752
|
-
seen.add(current);
|
|
2753
|
-
const cur = current;
|
|
2754
|
-
yield cur;
|
|
2755
|
-
if (cur.cause !== undefined)
|
|
2756
|
-
queue.push(cur.cause);
|
|
2757
|
-
if (Array.isArray(cur.errors))
|
|
2758
|
-
queue.push(...cur.errors);
|
|
2759
|
-
}
|
|
2760
|
-
return;
|
|
2761
|
-
}
|
|
2762
|
-
function parseHttpStatusFromMessage(message) {
|
|
2763
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2764
|
-
if (!match)
|
|
2765
|
-
return;
|
|
2766
|
-
const status = Number(match[1]);
|
|
2767
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2768
|
-
}
|
|
2769
|
-
function findHttpStatusInGraph(error) {
|
|
2770
|
-
for (const node of walkErrorGraph(error)) {
|
|
2771
|
-
const response = node.response;
|
|
2772
|
-
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2773
|
-
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2774
|
-
return explicit;
|
|
2775
|
-
}
|
|
2776
|
-
if (typeof node.message === "string") {
|
|
2777
|
-
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2778
|
-
if (parsed !== undefined && parsed >= 400) {
|
|
2779
|
-
return parsed;
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
return;
|
|
2784
|
-
}
|
|
2785
2800
|
function isHtmlDocument(body) {
|
|
2786
2801
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
2787
2802
|
}
|
|
@@ -3046,14 +3061,206 @@ async function extractErrorMessage(error, options) {
|
|
|
3046
3061
|
return message;
|
|
3047
3062
|
}
|
|
3048
3063
|
|
|
3064
|
+
// ../common/src/mime-types.ts
|
|
3065
|
+
var OCTET_STREAM = "application/octet-stream";
|
|
3066
|
+
var MIME_TYPES_BY_EXTENSION = Object.freeze({
|
|
3067
|
+
pdf: "application/pdf",
|
|
3068
|
+
png: "image/png",
|
|
3069
|
+
jpg: "image/jpeg",
|
|
3070
|
+
jpeg: "image/jpeg",
|
|
3071
|
+
gif: "image/gif",
|
|
3072
|
+
webp: "image/webp",
|
|
3073
|
+
bmp: "image/bmp",
|
|
3074
|
+
tif: "image/tiff",
|
|
3075
|
+
tiff: "image/tiff",
|
|
3076
|
+
svg: "image/svg+xml",
|
|
3077
|
+
txt: "text/plain",
|
|
3078
|
+
log: "text/plain",
|
|
3079
|
+
md: "text/markdown",
|
|
3080
|
+
csv: "text/csv",
|
|
3081
|
+
tsv: "text/tab-separated-values",
|
|
3082
|
+
json: "application/json",
|
|
3083
|
+
xml: "application/xml",
|
|
3084
|
+
html: "text/html",
|
|
3085
|
+
htm: "text/html",
|
|
3086
|
+
yaml: "application/yaml",
|
|
3087
|
+
yml: "application/yaml",
|
|
3088
|
+
doc: "application/msword",
|
|
3089
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
3090
|
+
xls: "application/vnd.ms-excel",
|
|
3091
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
3092
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
3093
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
3094
|
+
zip: "application/zip",
|
|
3095
|
+
mp3: "audio/mpeg",
|
|
3096
|
+
wav: "audio/wav",
|
|
3097
|
+
mp4: "video/mp4"
|
|
3098
|
+
});
|
|
3099
|
+
function mimeTypeForFileName(fileName) {
|
|
3100
|
+
const dot = fileName.lastIndexOf(".");
|
|
3101
|
+
if (dot < 0 || dot === fileName.length - 1) {
|
|
3102
|
+
return OCTET_STREAM;
|
|
3103
|
+
}
|
|
3104
|
+
const extension = fileName.slice(dot + 1).toLowerCase();
|
|
3105
|
+
return Object.hasOwn(MIME_TYPES_BY_EXTENSION, extension) ? MIME_TYPES_BY_EXTENSION[extension] : OCTET_STREAM;
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3049
3108
|
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
3050
3109
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
3051
3110
|
function getGlobalTelemetryProperties() {
|
|
3052
3111
|
return telemetryPropsSlot.get();
|
|
3053
3112
|
}
|
|
3054
3113
|
|
|
3114
|
+
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
3115
|
+
var BaseDimensions = {
|
|
3116
|
+
ApplicationName: "ApplicationName",
|
|
3117
|
+
ProductVersion: "ProductVersion",
|
|
3118
|
+
InstallationId: "InstallationId",
|
|
3119
|
+
CloudUserId: "CloudUserId",
|
|
3120
|
+
CloudTenantId: "CloudTenantId",
|
|
3121
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
3122
|
+
IsInternalUser: "IsInternalUser",
|
|
3123
|
+
Environment: "Environment",
|
|
3124
|
+
BaseUrl: "BaseUrl",
|
|
3125
|
+
Region: "Region",
|
|
3126
|
+
Agent: "Agent",
|
|
3127
|
+
AgentVersion: "AgentVersion",
|
|
3128
|
+
AgentModel: "AgentModel",
|
|
3129
|
+
ToolName: "ToolName",
|
|
3130
|
+
ToolVersion: "ToolVersion",
|
|
3131
|
+
ExecutionContext: "ExecutionContext",
|
|
3132
|
+
CiProvider: "CiProvider",
|
|
3133
|
+
SessionIdSource: "SessionIdSource",
|
|
3134
|
+
SessionId: "SessionId"
|
|
3135
|
+
};
|
|
3136
|
+
var CommandDimensions = {
|
|
3137
|
+
IsCommand: "IsCommand",
|
|
3138
|
+
IsReexec: "IsReexec",
|
|
3139
|
+
CommandName: "CommandName",
|
|
3140
|
+
ExitCode: "ExitCode",
|
|
3141
|
+
TerminalOutcome: "TerminalOutcome",
|
|
3142
|
+
ErrorClass: "ErrorClass",
|
|
3143
|
+
TerminalSignal: "TerminalSignal",
|
|
3144
|
+
ErrorMessage: "ErrorMessage",
|
|
3145
|
+
SkillName: "SkillName",
|
|
3146
|
+
ProductArea: "ProductArea",
|
|
3147
|
+
Mode: "Mode"
|
|
3148
|
+
};
|
|
3149
|
+
var ShipDimensions = {
|
|
3150
|
+
ShipKind: "ShipKind",
|
|
3151
|
+
Target: "Target",
|
|
3152
|
+
ProjectType: "ProjectType",
|
|
3153
|
+
ProjectTypes: "ProjectTypes",
|
|
3154
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3155
|
+
PackageName: "PackageName",
|
|
3156
|
+
PackageVersion: "PackageVersion",
|
|
3157
|
+
PackageVersionKey: "PackageVersionKey",
|
|
3158
|
+
DeploymentKey: "DeploymentKey",
|
|
3159
|
+
SolutionId: "SolutionId",
|
|
3160
|
+
FolderKey: "FolderKey",
|
|
3161
|
+
FeedId: "FeedId"
|
|
3162
|
+
};
|
|
3163
|
+
var ErrorDimensions = {
|
|
3164
|
+
Result: "Result",
|
|
3165
|
+
ErrorCode: "ErrorCode",
|
|
3166
|
+
Retry: "Retry",
|
|
3167
|
+
ErrorMessage: "ErrorMessage"
|
|
3168
|
+
};
|
|
3169
|
+
var AuthDimensions = {
|
|
3170
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
3171
|
+
Success: "Success",
|
|
3172
|
+
Reason: "Reason"
|
|
3173
|
+
};
|
|
3174
|
+
var SkillsDimensions = {
|
|
3175
|
+
SchemaVersion: "SchemaVersion",
|
|
3176
|
+
AgentType: "AgentType",
|
|
3177
|
+
SkillsVersion: "SkillsVersion",
|
|
3178
|
+
UipSubcommand: "UipSubcommand",
|
|
3179
|
+
FileExtension: "FileExtension",
|
|
3180
|
+
SubagentModel: "SubagentModel",
|
|
3181
|
+
SubagentType: "SubagentType",
|
|
3182
|
+
PermissionMode: "PermissionMode",
|
|
3183
|
+
EffortLevel: "EffortLevel",
|
|
3184
|
+
SessionSource: "SessionSource",
|
|
3185
|
+
Outcome: "Outcome",
|
|
3186
|
+
DurationMs: "DurationMs",
|
|
3187
|
+
Source: "Source"
|
|
3188
|
+
};
|
|
3189
|
+
var PackagerDimensions = {
|
|
3190
|
+
ProjectId: "ProjectId",
|
|
3191
|
+
ProjectType: "ProjectType",
|
|
3192
|
+
SolutionId: "SolutionId"
|
|
3193
|
+
};
|
|
3194
|
+
var ScopeDimensions = {
|
|
3195
|
+
FolderId: "FolderId"
|
|
3196
|
+
};
|
|
3197
|
+
var ID_DIMENSIONS = new Set([
|
|
3198
|
+
BaseDimensions.CloudUserId,
|
|
3199
|
+
BaseDimensions.CloudTenantId,
|
|
3200
|
+
BaseDimensions.CloudOrganizationId,
|
|
3201
|
+
BaseDimensions.InstallationId,
|
|
3202
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
3203
|
+
ShipDimensions.PackageVersionKey,
|
|
3204
|
+
ShipDimensions.DeploymentKey,
|
|
3205
|
+
ShipDimensions.SolutionId,
|
|
3206
|
+
ShipDimensions.FolderKey,
|
|
3207
|
+
ShipDimensions.FeedId,
|
|
3208
|
+
PackagerDimensions.ProjectId
|
|
3209
|
+
]);
|
|
3210
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3211
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3212
|
+
...Object.values(BaseDimensions),
|
|
3213
|
+
...Object.values(CommandDimensions),
|
|
3214
|
+
...Object.values(ShipDimensions),
|
|
3215
|
+
...Object.values(ErrorDimensions),
|
|
3216
|
+
...Object.values(AuthDimensions),
|
|
3217
|
+
...Object.values(SkillsDimensions),
|
|
3218
|
+
...Object.values(PackagerDimensions),
|
|
3219
|
+
...Object.values(ScopeDimensions)
|
|
3220
|
+
]);
|
|
3221
|
+
var CURATED_DIMENSIONS = new Set([
|
|
3222
|
+
BaseDimensions.ApplicationName,
|
|
3223
|
+
BaseDimensions.ProductVersion,
|
|
3224
|
+
BaseDimensions.InstallationId,
|
|
3225
|
+
BaseDimensions.CloudUserId,
|
|
3226
|
+
BaseDimensions.CloudTenantId,
|
|
3227
|
+
BaseDimensions.CloudOrganizationId,
|
|
3228
|
+
BaseDimensions.IsInternalUser,
|
|
3229
|
+
BaseDimensions.Environment,
|
|
3230
|
+
BaseDimensions.BaseUrl,
|
|
3231
|
+
BaseDimensions.Region,
|
|
3232
|
+
BaseDimensions.Agent,
|
|
3233
|
+
BaseDimensions.AgentVersion,
|
|
3234
|
+
BaseDimensions.ToolVersion,
|
|
3235
|
+
BaseDimensions.ExecutionContext,
|
|
3236
|
+
BaseDimensions.CiProvider,
|
|
3237
|
+
BaseDimensions.SessionIdSource,
|
|
3238
|
+
BaseDimensions.SessionId,
|
|
3239
|
+
...Object.values(CommandDimensions),
|
|
3240
|
+
...Object.values(ShipDimensions)
|
|
3241
|
+
]);
|
|
3242
|
+
function lowercaseIdDimensionValues(properties) {
|
|
3243
|
+
let changed = false;
|
|
3244
|
+
const result = {
|
|
3245
|
+
...properties
|
|
3246
|
+
};
|
|
3247
|
+
for (const key of Object.keys(result)) {
|
|
3248
|
+
const value = result[key];
|
|
3249
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3250
|
+
continue;
|
|
3251
|
+
}
|
|
3252
|
+
const lowered = value.toLowerCase();
|
|
3253
|
+
if (lowered !== value) {
|
|
3254
|
+
result[key] = lowered;
|
|
3255
|
+
changed = true;
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
return changed ? result : properties;
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3055
3261
|
// ../common/src/sdk-user-agent.ts
|
|
3056
3262
|
var USER_AGENT_HEADER = "User-Agent";
|
|
3263
|
+
var AGENT_PROPERTY = BaseDimensions.Agent;
|
|
3057
3264
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
3058
3265
|
function userAgentPatchKey(userAgent) {
|
|
3059
3266
|
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
@@ -3620,6 +3827,9 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
3620
3827
|
"authentication_required",
|
|
3621
3828
|
"permission_denied"
|
|
3622
3829
|
]);
|
|
3830
|
+
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
3831
|
+
"local_permission_denied"
|
|
3832
|
+
]);
|
|
3623
3833
|
var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
3624
3834
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
3625
3835
|
"network_error",
|
|
@@ -3760,6 +3970,9 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3760
3970
|
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
3761
3971
|
return "auth";
|
|
3762
3972
|
}
|
|
3973
|
+
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
|
|
3974
|
+
return "local_permission";
|
|
3975
|
+
}
|
|
3763
3976
|
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
3764
3977
|
return "validation";
|
|
3765
3978
|
}
|
|
@@ -3771,6 +3984,15 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3771
3984
|
}
|
|
3772
3985
|
return;
|
|
3773
3986
|
}
|
|
3987
|
+
function hasLocalPermissionCode(error) {
|
|
3988
|
+
for (const node of walkErrorGraph(error)) {
|
|
3989
|
+
const code = node.code;
|
|
3990
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
3991
|
+
return true;
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
return false;
|
|
3995
|
+
}
|
|
3774
3996
|
function classifyFromError(error) {
|
|
3775
3997
|
const code = findCodeInCauseChain(error);
|
|
3776
3998
|
if (code) {
|
|
@@ -3787,6 +4009,9 @@ function classifyFromError(error) {
|
|
|
3787
4009
|
return "missing_dependency";
|
|
3788
4010
|
}
|
|
3789
4011
|
}
|
|
4012
|
+
if (hasLocalPermissionCode(error)) {
|
|
4013
|
+
return "local_permission";
|
|
4014
|
+
}
|
|
3790
4015
|
const message = stringField(error, "message");
|
|
3791
4016
|
if (message?.includes("fetch failed") === true) {
|
|
3792
4017
|
return "network_http";
|
|
@@ -3802,7 +4027,7 @@ function classifyError2(input) {
|
|
|
3802
4027
|
if (recorded?.errorClass) {
|
|
3803
4028
|
return recorded.errorClass;
|
|
3804
4029
|
}
|
|
3805
|
-
const status = recorded?.context?.httpStatus;
|
|
4030
|
+
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3806
4031
|
if (status !== undefined) {
|
|
3807
4032
|
return classifyHttpStatus(status);
|
|
3808
4033
|
}
|
|
@@ -3825,17 +4050,18 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3825
4050
|
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
|
|
3826
4051
|
const terminalSignal = terminalSignalFor(input, outcome);
|
|
3827
4052
|
return {
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
...errorClass ? {
|
|
3831
|
-
...terminalSignal ? {
|
|
4053
|
+
[CommandDimensions.ExitCode]: input.exitCode,
|
|
4054
|
+
[CommandDimensions.TerminalOutcome]: outcome,
|
|
4055
|
+
...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
|
|
4056
|
+
...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
|
|
3832
4057
|
};
|
|
3833
4058
|
}
|
|
3834
4059
|
|
|
3835
4060
|
// ../common/src/telemetry/telemetry-events.ts
|
|
3836
4061
|
var CommonTelemetryEvents = {
|
|
3837
|
-
|
|
3838
|
-
|
|
4062
|
+
Start: "Application.Start",
|
|
4063
|
+
Error: "Application.Error",
|
|
4064
|
+
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3839
4065
|
};
|
|
3840
4066
|
|
|
3841
4067
|
// ../common/src/registry.ts
|
|
@@ -4043,8 +4269,8 @@ function detectExecutionContext(options = {}) {
|
|
|
4043
4269
|
function getExecutionContextTelemetryProperties() {
|
|
4044
4270
|
const detected = detectExecutionContext();
|
|
4045
4271
|
return {
|
|
4046
|
-
|
|
4047
|
-
...detected.ciProvider ? {
|
|
4272
|
+
[BaseDimensions.ExecutionContext]: detected.executionContext,
|
|
4273
|
+
...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
|
|
4048
4274
|
};
|
|
4049
4275
|
}
|
|
4050
4276
|
// ../common/src/telemetry/node-context-storage.ts
|
|
@@ -4087,7 +4313,7 @@ function getInboundTraceContext() {
|
|
|
4087
4313
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4088
4314
|
var SESSION_ID_MAX_LENGTH = 64;
|
|
4089
4315
|
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4090
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "
|
|
4316
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4091
4317
|
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4092
4318
|
var INHERITED_SESSION_SOURCES = [
|
|
4093
4319
|
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
@@ -4139,6 +4365,9 @@ function resolveTelemetrySession() {
|
|
|
4139
4365
|
telemetrySessionSlot.set(resolved);
|
|
4140
4366
|
return resolved;
|
|
4141
4367
|
}
|
|
4368
|
+
function getTelemetrySessionId() {
|
|
4369
|
+
return resolveTelemetrySession().id;
|
|
4370
|
+
}
|
|
4142
4371
|
function getTelemetrySessionSource() {
|
|
4143
4372
|
return resolveTelemetrySession().source;
|
|
4144
4373
|
}
|
|
@@ -4213,7 +4442,10 @@ class TelemetryService {
|
|
|
4213
4442
|
} catch (error) {
|
|
4214
4443
|
const durationMs = clock.elapsedMs();
|
|
4215
4444
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
4216
|
-
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4445
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4446
|
+
...properties,
|
|
4447
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4448
|
+
}, context));
|
|
4217
4449
|
throw error;
|
|
4218
4450
|
}
|
|
4219
4451
|
}
|
|
@@ -4284,7 +4516,10 @@ class TelemetryService {
|
|
|
4284
4516
|
const durationMs = clock.elapsedMs();
|
|
4285
4517
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
4286
4518
|
await this.telemetryProvider.trackDependency({
|
|
4287
|
-
...this.spanFor(name, durationMs, false, {
|
|
4519
|
+
...this.spanFor(name, durationMs, false, {
|
|
4520
|
+
...properties,
|
|
4521
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4522
|
+
}, childContext),
|
|
4288
4523
|
type
|
|
4289
4524
|
});
|
|
4290
4525
|
throw error;
|
|
@@ -4319,9 +4554,10 @@ class TelemetryService {
|
|
|
4319
4554
|
...globalProperties,
|
|
4320
4555
|
...this.defaultProperties,
|
|
4321
4556
|
...redactProperties(properties ?? {}),
|
|
4322
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
4557
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4558
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4323
4559
|
};
|
|
4324
|
-
return enriched;
|
|
4560
|
+
return lowercaseIdDimensionValues(enriched);
|
|
4325
4561
|
}
|
|
4326
4562
|
generateId() {
|
|
4327
4563
|
const bytes = new Uint8Array(8);
|
|
@@ -5115,7 +5351,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
5115
5351
|
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).";
|
|
5116
5352
|
}
|
|
5117
5353
|
}
|
|
5118
|
-
function
|
|
5354
|
+
function countRecords(data) {
|
|
5355
|
+
if (Array.isArray(data))
|
|
5356
|
+
return data.length;
|
|
5357
|
+
return data == null ? 0 : 1;
|
|
5358
|
+
}
|
|
5359
|
+
function availableFields(data) {
|
|
5360
|
+
const records = Array.isArray(data) ? data : [data];
|
|
5361
|
+
const keys = new Set;
|
|
5362
|
+
for (const record of records) {
|
|
5363
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
5364
|
+
for (const key of Object.keys(record))
|
|
5365
|
+
keys.add(key);
|
|
5366
|
+
}
|
|
5367
|
+
}
|
|
5368
|
+
return [...keys];
|
|
5369
|
+
}
|
|
5370
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
5371
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
5372
|
+
if (!error && typeof decoded === "string")
|
|
5373
|
+
return decoded;
|
|
5374
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
5375
|
+
}
|
|
5376
|
+
function referencedFields(filter) {
|
|
5377
|
+
const top = new Set;
|
|
5378
|
+
const nested = new Set;
|
|
5379
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
5380
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
5381
|
+
const quoted = [];
|
|
5382
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
5383
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
5384
|
+
if (!isAlias) {
|
|
5385
|
+
quoted.push({
|
|
5386
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
5387
|
+
index,
|
|
5388
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
5389
|
+
});
|
|
5390
|
+
}
|
|
5391
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
5392
|
+
});
|
|
5393
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
5394
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
5395
|
+
const place = (name, index, tail) => {
|
|
5396
|
+
if (tail || index >= rootEnd)
|
|
5397
|
+
nested.add(name);
|
|
5398
|
+
else
|
|
5399
|
+
top.add(name);
|
|
5400
|
+
};
|
|
5401
|
+
for (const entry of quoted)
|
|
5402
|
+
place(entry.name, entry.index, entry.tail);
|
|
5403
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
5404
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
5405
|
+
for (const match of identifiers) {
|
|
5406
|
+
const [, name, trailing] = match;
|
|
5407
|
+
if (trailing || reserved.has(name))
|
|
5408
|
+
continue;
|
|
5409
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
5410
|
+
}
|
|
5411
|
+
return {
|
|
5412
|
+
top: [...top],
|
|
5413
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
5414
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
5415
|
+
};
|
|
5416
|
+
}
|
|
5417
|
+
function appearsBelowTopLevel(data, name) {
|
|
5418
|
+
let budget = 2000;
|
|
5419
|
+
const visit = (value, depth) => {
|
|
5420
|
+
if (budget-- <= 0 || depth > 4)
|
|
5421
|
+
return false;
|
|
5422
|
+
if (value === null || typeof value !== "object")
|
|
5423
|
+
return false;
|
|
5424
|
+
if (Array.isArray(value))
|
|
5425
|
+
return value.some((entry) => visit(entry, depth));
|
|
5426
|
+
const record = value;
|
|
5427
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
5428
|
+
return true;
|
|
5429
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
5430
|
+
};
|
|
5431
|
+
return visit(data, 0);
|
|
5432
|
+
}
|
|
5433
|
+
function alwaysNullKeys(records) {
|
|
5434
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
5435
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
5436
|
+
return [];
|
|
5437
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
5438
|
+
if (keys.length === 0)
|
|
5439
|
+
return [];
|
|
5440
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
5441
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
5442
|
+
}
|
|
5443
|
+
function carriesOnlyNulls(value) {
|
|
5444
|
+
if (value === null)
|
|
5445
|
+
return true;
|
|
5446
|
+
if (Array.isArray(value)) {
|
|
5447
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
5448
|
+
}
|
|
5449
|
+
if (typeof value === "object" && value !== undefined) {
|
|
5450
|
+
const values = Object.values(value);
|
|
5451
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
5452
|
+
}
|
|
5453
|
+
return false;
|
|
5454
|
+
}
|
|
5455
|
+
function nameList(names, cap2 = 12) {
|
|
5456
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
5457
|
+
const rest = names.length - shown.length;
|
|
5458
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5459
|
+
}
|
|
5460
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
5461
|
+
const present = availableFields(data);
|
|
5462
|
+
const refs = referencedFields(filter);
|
|
5463
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
5464
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5465
|
+
const count = countRecords(data);
|
|
5466
|
+
const scope = `${count} record(s)`;
|
|
5467
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5468
|
+
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" : "";
|
|
5469
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5470
|
+
let detail;
|
|
5471
|
+
let lede;
|
|
5472
|
+
if (outcome.kind === "null-elements") {
|
|
5473
|
+
lede = "returned only null values";
|
|
5474
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
5475
|
+
if (unknown.length > 0) {
|
|
5476
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5477
|
+
} else if (unchecked.length > 0) {
|
|
5478
|
+
detail = withSoundness(projected);
|
|
5479
|
+
} else {
|
|
5480
|
+
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`;
|
|
5481
|
+
}
|
|
5482
|
+
} else if (outcome.kind === "null-rows") {
|
|
5483
|
+
lede = "returned only null values";
|
|
5484
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
5485
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
5486
|
+
} else if (outcome.kind === "null-values") {
|
|
5487
|
+
lede = "returned only null values";
|
|
5488
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
5489
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
5490
|
+
if (sameSet) {
|
|
5491
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
5492
|
+
} else if (unknown.length > 0) {
|
|
5493
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5494
|
+
} else {
|
|
5495
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
5496
|
+
}
|
|
5497
|
+
} else {
|
|
5498
|
+
lede = "returned nothing";
|
|
5499
|
+
if (unknown.length > 0) {
|
|
5500
|
+
detail = isNotAField(unknown);
|
|
5501
|
+
} else {
|
|
5502
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
5503
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
5504
|
+
}
|
|
5505
|
+
}
|
|
5506
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
5507
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
5508
|
+
}
|
|
5509
|
+
function appendWarning(existing, note) {
|
|
5510
|
+
return existing ? `${existing} ${note}` : note;
|
|
5511
|
+
}
|
|
5512
|
+
function applyFilter(data, filter, onWarning) {
|
|
5119
5513
|
const codec = requireJmespath();
|
|
5120
5514
|
let result;
|
|
5121
5515
|
try {
|
|
@@ -5123,9 +5517,34 @@ function applyFilter(data, filter) {
|
|
|
5123
5517
|
} catch (err) {
|
|
5124
5518
|
throw new FilterEvaluationError(filter, err);
|
|
5125
5519
|
}
|
|
5126
|
-
|
|
5520
|
+
const inputCount = countRecords(data);
|
|
5521
|
+
const warn = (outcome) => {
|
|
5522
|
+
if (inputCount === 0)
|
|
5523
|
+
return;
|
|
5524
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
5525
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
5526
|
+
`);
|
|
5527
|
+
onWarning?.(note);
|
|
5528
|
+
};
|
|
5529
|
+
const warnIfAllNull = (records) => {
|
|
5530
|
+
const keys = alwaysNullKeys(records);
|
|
5531
|
+
if (keys.length > 0)
|
|
5532
|
+
warn({ kind: "null-values", keys });
|
|
5533
|
+
};
|
|
5534
|
+
if (result == null) {
|
|
5535
|
+
warn({ kind: "empty" });
|
|
5127
5536
|
return [];
|
|
5537
|
+
}
|
|
5128
5538
|
if (Array.isArray(result)) {
|
|
5539
|
+
if (result.length === 0) {
|
|
5540
|
+
warn({ kind: "empty" });
|
|
5541
|
+
} else if (result.every((entry) => entry === null)) {
|
|
5542
|
+
warn({ kind: "null-elements", count: result.length });
|
|
5543
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
5544
|
+
warn({ kind: "null-rows", count: result.length });
|
|
5545
|
+
} else {
|
|
5546
|
+
warnIfAllNull(result);
|
|
5547
|
+
}
|
|
5129
5548
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
5130
5549
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
5131
5550
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -5133,10 +5552,30 @@ function applyFilter(data, filter) {
|
|
|
5133
5552
|
}
|
|
5134
5553
|
return result;
|
|
5135
5554
|
}
|
|
5136
|
-
if (typeof result === "object")
|
|
5555
|
+
if (typeof result === "object") {
|
|
5556
|
+
warnIfAllNull([result]);
|
|
5137
5557
|
return result;
|
|
5558
|
+
}
|
|
5138
5559
|
return { Value: result };
|
|
5139
5560
|
}
|
|
5561
|
+
function filterFailureData(envelope) {
|
|
5562
|
+
const filter = getOutputFilter();
|
|
5563
|
+
const data = envelope.Data;
|
|
5564
|
+
if (!filter || data == null)
|
|
5565
|
+
return;
|
|
5566
|
+
let note;
|
|
5567
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
5568
|
+
note = n;
|
|
5569
|
+
}));
|
|
5570
|
+
if (filterError) {
|
|
5571
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
5572
|
+
return;
|
|
5573
|
+
}
|
|
5574
|
+
envelope.Data = filtered;
|
|
5575
|
+
if (note) {
|
|
5576
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5577
|
+
}
|
|
5578
|
+
}
|
|
5140
5579
|
function defaultErrorCodeForResult(result) {
|
|
5141
5580
|
switch (result) {
|
|
5142
5581
|
case RESULTS.AuthenticationError:
|
|
@@ -5180,7 +5619,7 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
5180
5619
|
return "server_error";
|
|
5181
5620
|
return;
|
|
5182
5621
|
}
|
|
5183
|
-
var LOCAL_PERMISSION_TEXT_PATTERN =
|
|
5622
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5184
5623
|
function defaultErrorCodeForFailure(data) {
|
|
5185
5624
|
if (data.Result === RESULTS.Failure) {
|
|
5186
5625
|
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
@@ -5219,8 +5658,14 @@ var OutputFormatter;
|
|
|
5219
5658
|
}
|
|
5220
5659
|
const filter = getOutputFilter();
|
|
5221
5660
|
if (filter) {
|
|
5222
|
-
|
|
5661
|
+
let note;
|
|
5662
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
5663
|
+
note = n;
|
|
5664
|
+
});
|
|
5223
5665
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
5666
|
+
if (note) {
|
|
5667
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
5668
|
+
}
|
|
5224
5669
|
}
|
|
5225
5670
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
5226
5671
|
}
|
|
@@ -5248,12 +5693,13 @@ var OutputFormatter;
|
|
|
5248
5693
|
delete envelope.TelemetryErrorClass;
|
|
5249
5694
|
delete envelope.TelemetryTerminalOutcome;
|
|
5250
5695
|
delete envelope.TelemetryTerminalSignal;
|
|
5696
|
+
filterFailureData(envelope);
|
|
5251
5697
|
if (!suppressTelemetry) {
|
|
5252
5698
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5699
|
+
[ErrorDimensions.Result]: data.Result,
|
|
5700
|
+
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
5701
|
+
[ErrorDimensions.Retry]: data.Retry,
|
|
5702
|
+
[ErrorDimensions.ErrorMessage]: data.Message
|
|
5257
5703
|
});
|
|
5258
5704
|
}
|
|
5259
5705
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -5296,13 +5742,20 @@ var OutputFormatter;
|
|
|
5296
5742
|
OutputFormatter.log = log;
|
|
5297
5743
|
function formatToString(data) {
|
|
5298
5744
|
const filter = getOutputFilter();
|
|
5745
|
+
const envelope = data;
|
|
5299
5746
|
if ("Data" in data && data.Data != null) {
|
|
5300
5747
|
data.Data = normalizeDataKeys(data.Data);
|
|
5301
5748
|
if (filter) {
|
|
5302
|
-
|
|
5749
|
+
let note;
|
|
5750
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
5751
|
+
note = n;
|
|
5752
|
+
}));
|
|
5753
|
+
if (note) {
|
|
5754
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5755
|
+
}
|
|
5303
5756
|
}
|
|
5304
5757
|
}
|
|
5305
|
-
const output = normalizeOutputKeys(
|
|
5758
|
+
const output = normalizeOutputKeys(envelope);
|
|
5306
5759
|
const lines = [];
|
|
5307
5760
|
const sink = getOutputSink();
|
|
5308
5761
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -5336,7 +5789,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
|
5336
5789
|
var MAX_SKILL_NAME_LENGTH = 80;
|
|
5337
5790
|
var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
5338
5791
|
function productMode(productArea, mode) {
|
|
5339
|
-
return {
|
|
5792
|
+
return { ProductArea: productArea, Mode: mode };
|
|
5340
5793
|
}
|
|
5341
5794
|
function attributionRecord(groups) {
|
|
5342
5795
|
const record = {};
|
|
@@ -5394,6 +5847,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
5394
5847
|
["rpa", "build", ["uip.rpa-legacy"]],
|
|
5395
5848
|
["conversational", "operate", ["uip.conversational"]],
|
|
5396
5849
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
5850
|
+
["coding-agents", "build", ["uip.coder"]],
|
|
5397
5851
|
["agenthub", "build", ["uip.agenthub"]],
|
|
5398
5852
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
5399
5853
|
["functions", "build", ["uip.function", "uip.functions"]],
|
|
@@ -5479,32 +5933,64 @@ function normalizeSkillName(value) {
|
|
|
5479
5933
|
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
5480
5934
|
const skillName = normalizeSkillName(skillSource);
|
|
5481
5935
|
return {
|
|
5482
|
-
...skillName ? {
|
|
5936
|
+
...skillName ? { SkillName: skillName } : {},
|
|
5483
5937
|
...getCommandProductModeAttribution(commandPath)
|
|
5484
5938
|
};
|
|
5485
5939
|
}
|
|
5940
|
+
var AGENT_SESSION_ENV = {
|
|
5941
|
+
[BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
|
|
5942
|
+
[SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
|
|
5943
|
+
[SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
|
|
5944
|
+
[SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
|
|
5945
|
+
};
|
|
5946
|
+
var MAX_TELEMETRY_TOKEN_LENGTH = 120;
|
|
5947
|
+
function sanitizeTelemetryToken(value) {
|
|
5948
|
+
return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
|
|
5949
|
+
}
|
|
5950
|
+
function buildAgentSessionTelemetry(env) {
|
|
5951
|
+
const dimensions = {};
|
|
5952
|
+
for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
|
|
5953
|
+
const value = env[variable]?.trim();
|
|
5954
|
+
if (value) {
|
|
5955
|
+
dimensions[key] = sanitizeTelemetryToken(value);
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
return dimensions;
|
|
5959
|
+
}
|
|
5486
5960
|
|
|
5487
5961
|
// ../common/src/telemetry/command-name.ts
|
|
5488
|
-
var
|
|
5962
|
+
var TELEMETRY_NAME_ROOT = "Cli";
|
|
5963
|
+
var CLI_COMMAND_ROOT = "uip";
|
|
5964
|
+
var TELEMETRY_NAME_BARE_ACTION = "Invoke";
|
|
5489
5965
|
function commandTelemetryName(parts) {
|
|
5966
|
+
const action = vetCommandTokens(parts).map(pascalizeToken).join("");
|
|
5967
|
+
return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
|
|
5968
|
+
}
|
|
5969
|
+
function commandInvocationPath(parts) {
|
|
5970
|
+
return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
|
|
5971
|
+
}
|
|
5972
|
+
function vetCommandTokens(parts) {
|
|
5490
5973
|
const tokens = [];
|
|
5491
5974
|
for (const part of parts) {
|
|
5492
|
-
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !==
|
|
5975
|
+
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
|
|
5493
5976
|
if (pieces.every(isCommandToken)) {
|
|
5494
5977
|
tokens.push(...pieces);
|
|
5495
5978
|
continue;
|
|
5496
5979
|
}
|
|
5497
5980
|
tokens.push(UNKNOWN_TOKEN);
|
|
5498
5981
|
}
|
|
5499
|
-
return
|
|
5982
|
+
return tokens;
|
|
5983
|
+
}
|
|
5984
|
+
function pascalizeToken(token) {
|
|
5985
|
+
return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
5500
5986
|
}
|
|
5501
|
-
var COMMAND_TOKEN_PATTERN = /^[a-
|
|
5987
|
+
var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
5502
5988
|
var MAX_COMMAND_TOKEN_LENGTH = 32;
|
|
5503
5989
|
var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
5504
5990
|
function isCommandToken(token) {
|
|
5505
|
-
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token)
|
|
5991
|
+
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
|
|
5506
5992
|
}
|
|
5507
|
-
var UNKNOWN_TOKEN = "
|
|
5993
|
+
var UNKNOWN_TOKEN = "unknown";
|
|
5508
5994
|
|
|
5509
5995
|
// ../common/src/telemetry/invocation-request.ts
|
|
5510
5996
|
var requestContextSlot = singleton("TelemetryInvocationRequestContext");
|
|
@@ -5609,7 +6095,7 @@ function withheldArgumentValues(cmd) {
|
|
|
5609
6095
|
});
|
|
5610
6096
|
return values;
|
|
5611
6097
|
}
|
|
5612
|
-
function
|
|
6098
|
+
function deriveCommandParts(cmd) {
|
|
5613
6099
|
const parts = [];
|
|
5614
6100
|
let current = cmd;
|
|
5615
6101
|
while (current) {
|
|
@@ -5622,14 +6108,13 @@ function deriveCommandPath(cmd) {
|
|
|
5622
6108
|
if (parts.length > 1) {
|
|
5623
6109
|
parts.shift();
|
|
5624
6110
|
}
|
|
5625
|
-
return
|
|
6111
|
+
return parts;
|
|
5626
6112
|
}
|
|
5627
6113
|
function isErrorContext(value) {
|
|
5628
6114
|
return value !== null && typeof value === "object";
|
|
5629
6115
|
}
|
|
5630
6116
|
function commandHelpHint(commandPath) {
|
|
5631
|
-
|
|
5632
|
-
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
6117
|
+
return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5633
6118
|
}
|
|
5634
6119
|
function isPromptCancellation(error) {
|
|
5635
6120
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
@@ -5654,7 +6139,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5654
6139
|
yaml: getOutputFormat() === "yaml",
|
|
5655
6140
|
filter: getOutputFilter() !== undefined
|
|
5656
6141
|
});
|
|
5657
|
-
const
|
|
6142
|
+
const commandParts = deriveCommandParts(command);
|
|
6143
|
+
const telemetryName = commandTelemetryName(commandParts);
|
|
6144
|
+
const commandPath = commandInvocationPath(commandParts);
|
|
5658
6145
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
5659
6146
|
markCommandStart();
|
|
5660
6147
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
@@ -5689,7 +6176,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5689
6176
|
Result: finalResult,
|
|
5690
6177
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
5691
6178
|
Message: errorMessage,
|
|
5692
|
-
Instructions: customInstructions ?? commandHelpHint(
|
|
6179
|
+
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
5693
6180
|
...customRetry ? { Retry: customRetry } : {},
|
|
5694
6181
|
...customContext ? { Context: customContext } : {}
|
|
5695
6182
|
});
|
|
@@ -5706,8 +6193,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5706
6193
|
recordedFailure,
|
|
5707
6194
|
pollSignal: context.pollSignal
|
|
5708
6195
|
});
|
|
5709
|
-
if (terminalTelemetry.
|
|
5710
|
-
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), {
|
|
6196
|
+
if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
|
|
6197
|
+
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
|
|
5711
6198
|
}
|
|
5712
6199
|
const commandParams = extractCommandParams(command);
|
|
5713
6200
|
if (props) {
|
|
@@ -5718,10 +6205,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5718
6205
|
const baseProperties = redactProperties({
|
|
5719
6206
|
...commandParams,
|
|
5720
6207
|
...props,
|
|
5721
|
-
...buildCommandTelemetryAttribution(
|
|
5722
|
-
|
|
6208
|
+
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6209
|
+
...buildAgentSessionTelemetry(process.env),
|
|
6210
|
+
[CommandDimensions.CommandName]: commandPath,
|
|
6211
|
+
[CommandDimensions.IsCommand]: "true",
|
|
5723
6212
|
...terminalTelemetry,
|
|
5724
|
-
...errorMessage ? { errorMessage } : {}
|
|
6213
|
+
...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
|
|
5725
6214
|
});
|
|
5726
6215
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5727
6216
|
} finally {
|
|
@@ -5934,6 +6423,75 @@ var RESERVED_KEYWORDS_LOWER = new Set([
|
|
|
5934
6423
|
"writeonly",
|
|
5935
6424
|
"xor"
|
|
5936
6425
|
]);
|
|
6426
|
+
// ../common/src/error-instructions.ts
|
|
6427
|
+
function extractHttpStatus(err) {
|
|
6428
|
+
if (!err || typeof err !== "object")
|
|
6429
|
+
return;
|
|
6430
|
+
const e = err;
|
|
6431
|
+
const structured = e.response?.status ?? e.status ?? e.statusCode;
|
|
6432
|
+
if (structured !== undefined)
|
|
6433
|
+
return structured;
|
|
6434
|
+
return typeof e.message === "string" ? parseHttpStatusFromMessage(e.message) : undefined;
|
|
6435
|
+
}
|
|
6436
|
+
var GENERIC = "Check authentication and parameters";
|
|
6437
|
+
function instructionsFor(ctx, err) {
|
|
6438
|
+
switch (ctx) {
|
|
6439
|
+
case "auth":
|
|
6440
|
+
return "Run 'uip login' to authenticate. To inspect the current session, run 'uip whoami'.";
|
|
6441
|
+
case "identity":
|
|
6442
|
+
return "Select an active tenant with 'uip login tenant set <tenant>' and ensure your login includes an organization";
|
|
6443
|
+
case "input-parse":
|
|
6444
|
+
return "Ensure --inputs is valid JSON or pipe JSON via stdin";
|
|
6445
|
+
case "input-validate":
|
|
6446
|
+
return "Fix the flagged input fields to match the process's input schema";
|
|
6447
|
+
case "flag-format":
|
|
6448
|
+
return "Check the flag value format — see --help for the expected shape";
|
|
6449
|
+
case "permissions":
|
|
6450
|
+
return "Confirm your user has the required permissions in this folder/tenant, or re-authenticate with 'uip login' if your session has lapsed";
|
|
6451
|
+
case "backend": {
|
|
6452
|
+
const status = extractHttpStatus(err);
|
|
6453
|
+
if (status === 401) {
|
|
6454
|
+
return "Re-authenticate with 'uip login' — your session is invalid or expired";
|
|
6455
|
+
}
|
|
6456
|
+
if (status === 403) {
|
|
6457
|
+
return "Confirm your user has access to the resource, and the required permissions in this folder or tenant";
|
|
6458
|
+
}
|
|
6459
|
+
if (status === 404) {
|
|
6460
|
+
return "Verify the resource exists in the current folder/tenant";
|
|
6461
|
+
}
|
|
6462
|
+
if (status === 400 || status === 422) {
|
|
6463
|
+
return "Request was rejected — check flag values and inputs";
|
|
6464
|
+
}
|
|
6465
|
+
if (status === 405) {
|
|
6466
|
+
return "Check the command name and the base URL in use — the endpoint may not exist";
|
|
6467
|
+
}
|
|
6468
|
+
if (status === 408) {
|
|
6469
|
+
return "The request timed out — retry; if it persists, narrow the request (e.g. --limit on list commands)";
|
|
6470
|
+
}
|
|
6471
|
+
if (status === 409) {
|
|
6472
|
+
return "The resource already exists, or changed since it was read — list it to see the current state";
|
|
6473
|
+
}
|
|
6474
|
+
if (status === 413) {
|
|
6475
|
+
return "The upload is over the size limit — exclude unused dependencies or drop large files, then retry";
|
|
6476
|
+
}
|
|
6477
|
+
if (status === 429) {
|
|
6478
|
+
return "Rate limit reached — wait and retry; when the service suggests a delay, Retry and Context.retryAfter carry it";
|
|
6479
|
+
}
|
|
6480
|
+
if (status !== undefined && status >= 500 && status < 600) {
|
|
6481
|
+
return "The service returned a server error — retry; if it persists, check service status";
|
|
6482
|
+
}
|
|
6483
|
+
const permission = describePermissionError(err);
|
|
6484
|
+
if (permission) {
|
|
6485
|
+
return permission.instructions;
|
|
6486
|
+
}
|
|
6487
|
+
const connectivity = describeConnectivityError(err);
|
|
6488
|
+
if (connectivity) {
|
|
6489
|
+
return connectivity.instructions;
|
|
6490
|
+
}
|
|
6491
|
+
return GENERIC;
|
|
6492
|
+
}
|
|
6493
|
+
}
|
|
6494
|
+
}
|
|
5937
6495
|
// ../common/src/host-global-options.ts
|
|
5938
6496
|
var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
|
|
5939
6497
|
"--output",
|
|
@@ -6310,6 +6868,11 @@ var pickName = (claims) => {
|
|
|
6310
6868
|
const username = asString(claims?.preferred_username);
|
|
6311
6869
|
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
6312
6870
|
};
|
|
6871
|
+
var pickScopes = (claims) => {
|
|
6872
|
+
const raw = claims?.scope;
|
|
6873
|
+
const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
|
|
6874
|
+
return scopes.length > 0 ? scopes : undefined;
|
|
6875
|
+
};
|
|
6313
6876
|
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
6314
6877
|
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
6315
6878
|
const email = pickEmail(claims);
|
|
@@ -6335,6 +6898,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
6335
6898
|
identity.clientId = clientId;
|
|
6336
6899
|
return identity;
|
|
6337
6900
|
};
|
|
6901
|
+
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
6338
6902
|
|
|
6339
6903
|
// ../auth/src/envAuth.ts
|
|
6340
6904
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
@@ -6407,6 +6971,7 @@ var readAuthFromEnv = () => {
|
|
|
6407
6971
|
const expiration = getTokenExpiration(accessToken);
|
|
6408
6972
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
6409
6973
|
const identity = resolveSessionIdentity(accessToken);
|
|
6974
|
+
const scopes = readTokenScopes(accessToken);
|
|
6410
6975
|
return {
|
|
6411
6976
|
loginStatus,
|
|
6412
6977
|
accessToken,
|
|
@@ -6417,7 +6982,8 @@ var readAuthFromEnv = () => {
|
|
|
6417
6982
|
tenantId,
|
|
6418
6983
|
expiration,
|
|
6419
6984
|
source: "env-vars" /* EnvironmentVariables */,
|
|
6420
|
-
...identity ? { identity } : {}
|
|
6985
|
+
...identity ? { identity } : {},
|
|
6986
|
+
...scopes ? { scopes } : {}
|
|
6421
6987
|
};
|
|
6422
6988
|
};
|
|
6423
6989
|
|
|
@@ -7055,10 +7621,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
7055
7621
|
}
|
|
7056
7622
|
function identityFields(accessToken, credentials) {
|
|
7057
7623
|
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
7058
|
-
|
|
7624
|
+
const scopes = readTokenScopes(accessToken);
|
|
7625
|
+
return {
|
|
7626
|
+
...identity ? { identity } : {},
|
|
7627
|
+
...scopes ? { scopes } : {}
|
|
7628
|
+
};
|
|
7059
7629
|
}
|
|
7060
7630
|
function buildRobotStatus(robotCreds) {
|
|
7061
7631
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
7632
|
+
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
7062
7633
|
return {
|
|
7063
7634
|
loginStatus: "Logged in",
|
|
7064
7635
|
accessToken: robotCreds.accessToken,
|
|
@@ -7070,7 +7641,8 @@ function buildRobotStatus(robotCreds) {
|
|
|
7070
7641
|
issuer: robotCreds.issuer,
|
|
7071
7642
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
7072
7643
|
source: "robot" /* Robot */,
|
|
7073
|
-
...identity ? { identity } : {}
|
|
7644
|
+
...identity ? { identity } : {},
|
|
7645
|
+
...scopes ? { scopes } : {}
|
|
7074
7646
|
};
|
|
7075
7647
|
}
|
|
7076
7648
|
var isFileNotFoundError = (error) => {
|
|
@@ -7337,7 +7909,8 @@ var getAuthContext = async (options = {}) => {
|
|
|
7337
7909
|
organizationId: status.organizationId,
|
|
7338
7910
|
organizationName: status.organizationName,
|
|
7339
7911
|
tenantId: status.tenantId,
|
|
7340
|
-
tenantName
|
|
7912
|
+
tenantName,
|
|
7913
|
+
identity: status.identity
|
|
7341
7914
|
};
|
|
7342
7915
|
};
|
|
7343
7916
|
// ../auth/src/tenantSelection.ts
|
|
@@ -7350,6 +7923,6 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
7350
7923
|
TENANT_SELECTION_REQUIRED_CODE,
|
|
7351
7924
|
INVALID_TENANT_CODE
|
|
7352
7925
|
]);
|
|
7353
|
-
export { catchError, extractErrorMessage, RESULTS, Pagination, OutputFormatter, Command, processContext, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, getAuthContext };
|
|
7926
|
+
export { catchError, carriedInstructions, extractErrorDetails, extractErrorMessage, RESULTS, Pagination, OutputFormatter, Command, processContext, instructionsFor, mimeTypeForFileName, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, getAuthContext };
|
|
7354
7927
|
|
|
7355
|
-
//# debugId=
|
|
7928
|
+
//# debugId=DC3201D6735AF35364756E2164756E21
|