@uipath/oms-commands 1.203.0-preview.203 → 1.204.0-preview.206
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +583 -96
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2865,9 +2865,60 @@ function settlePromiseLike(thenable) {
|
|
|
2865
2865
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2866
2866
|
}
|
|
2867
2867
|
|
|
2868
|
+
// ../../common/src/error-graph.ts
|
|
2869
|
+
function* walkErrorGraph(error) {
|
|
2870
|
+
const queue = [error];
|
|
2871
|
+
const seen = new Set;
|
|
2872
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2873
|
+
const current = queue.shift();
|
|
2874
|
+
if (current === null || typeof current !== "object")
|
|
2875
|
+
continue;
|
|
2876
|
+
if (seen.has(current))
|
|
2877
|
+
continue;
|
|
2878
|
+
seen.add(current);
|
|
2879
|
+
const cur = current;
|
|
2880
|
+
yield cur;
|
|
2881
|
+
if (cur.cause !== undefined)
|
|
2882
|
+
queue.push(cur.cause);
|
|
2883
|
+
if (Array.isArray(cur.errors))
|
|
2884
|
+
queue.push(...cur.errors);
|
|
2885
|
+
}
|
|
2886
|
+
return;
|
|
2887
|
+
}
|
|
2888
|
+
function parseHttpStatusFromMessage(message) {
|
|
2889
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2890
|
+
if (!match)
|
|
2891
|
+
return;
|
|
2892
|
+
const status = Number(match[1]);
|
|
2893
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2894
|
+
}
|
|
2895
|
+
function findHttpStatusInGraph(error) {
|
|
2896
|
+
for (const node of walkErrorGraph(error)) {
|
|
2897
|
+
const response = node.response;
|
|
2898
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2899
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2900
|
+
return explicit;
|
|
2901
|
+
}
|
|
2902
|
+
if (typeof node.message === "string") {
|
|
2903
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2904
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
2905
|
+
return parsed;
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
return;
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
// ../../common/src/local-permission-codes.ts
|
|
2913
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2914
|
+
"EACCES",
|
|
2915
|
+
"EPERM",
|
|
2916
|
+
"EROFS"
|
|
2917
|
+
]);
|
|
2918
|
+
|
|
2868
2919
|
// ../../common/src/error-handler.ts
|
|
2869
|
-
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to
|
|
2870
|
-
var DEFAULT_403 = "Forbidden (403).
|
|
2920
|
+
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.";
|
|
2921
|
+
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.";
|
|
2871
2922
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2872
2923
|
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.";
|
|
2873
2924
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
@@ -2894,14 +2945,14 @@ var TLS_ERROR_CODES = new Set([
|
|
|
2894
2945
|
]);
|
|
2895
2946
|
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.";
|
|
2896
2947
|
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.";
|
|
2897
|
-
var
|
|
2898
|
-
var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
|
|
2948
|
+
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
2899
2949
|
function localPermissionInstructions(code, path2) {
|
|
2900
2950
|
const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
|
|
2901
2951
|
if (code === "EROFS") {
|
|
2902
2952
|
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.";
|
|
2903
2953
|
}
|
|
2904
|
-
const
|
|
2954
|
+
const onWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
2955
|
+
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.";
|
|
2905
2956
|
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}`;
|
|
2906
2957
|
}
|
|
2907
2958
|
function describeConnectivityError(error) {
|
|
@@ -2955,48 +3006,6 @@ function localPermissionPath(path2, message) {
|
|
|
2955
3006
|
return path2;
|
|
2956
3007
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
2957
3008
|
}
|
|
2958
|
-
function* walkErrorGraph(error) {
|
|
2959
|
-
const queue = [error];
|
|
2960
|
-
const seen = new Set;
|
|
2961
|
-
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2962
|
-
const current = queue.shift();
|
|
2963
|
-
if (current === null || typeof current !== "object")
|
|
2964
|
-
continue;
|
|
2965
|
-
if (seen.has(current))
|
|
2966
|
-
continue;
|
|
2967
|
-
seen.add(current);
|
|
2968
|
-
const cur = current;
|
|
2969
|
-
yield cur;
|
|
2970
|
-
if (cur.cause !== undefined)
|
|
2971
|
-
queue.push(cur.cause);
|
|
2972
|
-
if (Array.isArray(cur.errors))
|
|
2973
|
-
queue.push(...cur.errors);
|
|
2974
|
-
}
|
|
2975
|
-
return;
|
|
2976
|
-
}
|
|
2977
|
-
function parseHttpStatusFromMessage(message) {
|
|
2978
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2979
|
-
if (!match)
|
|
2980
|
-
return;
|
|
2981
|
-
const status = Number(match[1]);
|
|
2982
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2983
|
-
}
|
|
2984
|
-
function findHttpStatusInGraph(error) {
|
|
2985
|
-
for (const node of walkErrorGraph(error)) {
|
|
2986
|
-
const response = node.response;
|
|
2987
|
-
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2988
|
-
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2989
|
-
return explicit;
|
|
2990
|
-
}
|
|
2991
|
-
if (typeof node.message === "string") {
|
|
2992
|
-
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2993
|
-
if (parsed !== undefined && parsed >= 400) {
|
|
2994
|
-
return parsed;
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
return;
|
|
2999
|
-
}
|
|
3000
3009
|
function isHtmlDocument(body) {
|
|
3001
3010
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3002
3011
|
}
|
|
@@ -3518,12 +3527,162 @@ function getOutputFilter() {
|
|
|
3518
3527
|
return filterSlot.get();
|
|
3519
3528
|
}
|
|
3520
3529
|
|
|
3530
|
+
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
3531
|
+
var BaseDimensions = {
|
|
3532
|
+
ApplicationName: "ApplicationName",
|
|
3533
|
+
ProductVersion: "ProductVersion",
|
|
3534
|
+
InstallationId: "InstallationId",
|
|
3535
|
+
CloudUserId: "CloudUserId",
|
|
3536
|
+
CloudTenantId: "CloudTenantId",
|
|
3537
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
3538
|
+
IsInternalUser: "IsInternalUser",
|
|
3539
|
+
Environment: "Environment",
|
|
3540
|
+
BaseUrl: "BaseUrl",
|
|
3541
|
+
Region: "Region",
|
|
3542
|
+
Agent: "Agent",
|
|
3543
|
+
AgentVersion: "AgentVersion",
|
|
3544
|
+
AgentModel: "AgentModel",
|
|
3545
|
+
ToolName: "ToolName",
|
|
3546
|
+
ToolVersion: "ToolVersion",
|
|
3547
|
+
ExecutionContext: "ExecutionContext",
|
|
3548
|
+
CiProvider: "CiProvider",
|
|
3549
|
+
SessionIdSource: "SessionIdSource",
|
|
3550
|
+
SessionId: "SessionId"
|
|
3551
|
+
};
|
|
3552
|
+
var CommandDimensions = {
|
|
3553
|
+
IsCommand: "IsCommand",
|
|
3554
|
+
IsReexec: "IsReexec",
|
|
3555
|
+
CommandName: "CommandName",
|
|
3556
|
+
ExitCode: "ExitCode",
|
|
3557
|
+
TerminalOutcome: "TerminalOutcome",
|
|
3558
|
+
ErrorClass: "ErrorClass",
|
|
3559
|
+
TerminalSignal: "TerminalSignal",
|
|
3560
|
+
ErrorMessage: "ErrorMessage",
|
|
3561
|
+
SkillName: "SkillName",
|
|
3562
|
+
ProductArea: "ProductArea",
|
|
3563
|
+
Mode: "Mode"
|
|
3564
|
+
};
|
|
3565
|
+
var ShipDimensions = {
|
|
3566
|
+
ShipKind: "ShipKind",
|
|
3567
|
+
Target: "Target",
|
|
3568
|
+
ProjectType: "ProjectType",
|
|
3569
|
+
ProjectTypes: "ProjectTypes",
|
|
3570
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3571
|
+
PackageName: "PackageName",
|
|
3572
|
+
PackageVersion: "PackageVersion",
|
|
3573
|
+
PackageVersionKey: "PackageVersionKey",
|
|
3574
|
+
DeploymentKey: "DeploymentKey",
|
|
3575
|
+
SolutionId: "SolutionId",
|
|
3576
|
+
FolderKey: "FolderKey",
|
|
3577
|
+
FeedId: "FeedId"
|
|
3578
|
+
};
|
|
3579
|
+
var ErrorDimensions = {
|
|
3580
|
+
Result: "Result",
|
|
3581
|
+
ErrorCode: "ErrorCode",
|
|
3582
|
+
Retry: "Retry",
|
|
3583
|
+
ErrorMessage: "ErrorMessage"
|
|
3584
|
+
};
|
|
3585
|
+
var AuthDimensions = {
|
|
3586
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
3587
|
+
Success: "Success",
|
|
3588
|
+
Reason: "Reason"
|
|
3589
|
+
};
|
|
3590
|
+
var SkillsDimensions = {
|
|
3591
|
+
SchemaVersion: "SchemaVersion",
|
|
3592
|
+
AgentType: "AgentType",
|
|
3593
|
+
SkillsVersion: "SkillsVersion",
|
|
3594
|
+
UipSubcommand: "UipSubcommand",
|
|
3595
|
+
FileExtension: "FileExtension",
|
|
3596
|
+
SubagentModel: "SubagentModel",
|
|
3597
|
+
SubagentType: "SubagentType",
|
|
3598
|
+
PermissionMode: "PermissionMode",
|
|
3599
|
+
EffortLevel: "EffortLevel",
|
|
3600
|
+
SessionSource: "SessionSource",
|
|
3601
|
+
Outcome: "Outcome",
|
|
3602
|
+
DurationMs: "DurationMs",
|
|
3603
|
+
Source: "Source"
|
|
3604
|
+
};
|
|
3605
|
+
var PackagerDimensions = {
|
|
3606
|
+
ProjectId: "ProjectId",
|
|
3607
|
+
ProjectType: "ProjectType",
|
|
3608
|
+
SolutionId: "SolutionId"
|
|
3609
|
+
};
|
|
3610
|
+
var ScopeDimensions = {
|
|
3611
|
+
FolderId: "FolderId"
|
|
3612
|
+
};
|
|
3613
|
+
var ID_DIMENSIONS = new Set([
|
|
3614
|
+
BaseDimensions.CloudUserId,
|
|
3615
|
+
BaseDimensions.CloudTenantId,
|
|
3616
|
+
BaseDimensions.CloudOrganizationId,
|
|
3617
|
+
BaseDimensions.InstallationId,
|
|
3618
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
3619
|
+
ShipDimensions.PackageVersionKey,
|
|
3620
|
+
ShipDimensions.DeploymentKey,
|
|
3621
|
+
ShipDimensions.SolutionId,
|
|
3622
|
+
ShipDimensions.FolderKey,
|
|
3623
|
+
ShipDimensions.FeedId,
|
|
3624
|
+
PackagerDimensions.ProjectId
|
|
3625
|
+
]);
|
|
3626
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3627
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3628
|
+
...Object.values(BaseDimensions),
|
|
3629
|
+
...Object.values(CommandDimensions),
|
|
3630
|
+
...Object.values(ShipDimensions),
|
|
3631
|
+
...Object.values(ErrorDimensions),
|
|
3632
|
+
...Object.values(AuthDimensions),
|
|
3633
|
+
...Object.values(SkillsDimensions),
|
|
3634
|
+
...Object.values(PackagerDimensions),
|
|
3635
|
+
...Object.values(ScopeDimensions)
|
|
3636
|
+
]);
|
|
3637
|
+
var CURATED_DIMENSIONS = new Set([
|
|
3638
|
+
BaseDimensions.ApplicationName,
|
|
3639
|
+
BaseDimensions.ProductVersion,
|
|
3640
|
+
BaseDimensions.InstallationId,
|
|
3641
|
+
BaseDimensions.CloudUserId,
|
|
3642
|
+
BaseDimensions.CloudTenantId,
|
|
3643
|
+
BaseDimensions.CloudOrganizationId,
|
|
3644
|
+
BaseDimensions.IsInternalUser,
|
|
3645
|
+
BaseDimensions.Environment,
|
|
3646
|
+
BaseDimensions.BaseUrl,
|
|
3647
|
+
BaseDimensions.Region,
|
|
3648
|
+
BaseDimensions.Agent,
|
|
3649
|
+
BaseDimensions.AgentVersion,
|
|
3650
|
+
BaseDimensions.ToolVersion,
|
|
3651
|
+
BaseDimensions.ExecutionContext,
|
|
3652
|
+
BaseDimensions.CiProvider,
|
|
3653
|
+
BaseDimensions.SessionIdSource,
|
|
3654
|
+
BaseDimensions.SessionId,
|
|
3655
|
+
...Object.values(CommandDimensions),
|
|
3656
|
+
...Object.values(ShipDimensions)
|
|
3657
|
+
]);
|
|
3658
|
+
function lowercaseIdDimensionValues(properties) {
|
|
3659
|
+
let changed = false;
|
|
3660
|
+
const result = {
|
|
3661
|
+
...properties
|
|
3662
|
+
};
|
|
3663
|
+
for (const key of Object.keys(result)) {
|
|
3664
|
+
const value = result[key];
|
|
3665
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3666
|
+
continue;
|
|
3667
|
+
}
|
|
3668
|
+
const lowered = value.toLowerCase();
|
|
3669
|
+
if (lowered !== value) {
|
|
3670
|
+
result[key] = lowered;
|
|
3671
|
+
changed = true;
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
return changed ? result : properties;
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3521
3677
|
// ../../common/src/telemetry/command-terminal.ts
|
|
3522
3678
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3523
3679
|
var AUTH_ERROR_CODES = new Set([
|
|
3524
3680
|
"authentication_required",
|
|
3525
3681
|
"permission_denied"
|
|
3526
3682
|
]);
|
|
3683
|
+
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
3684
|
+
"local_permission_denied"
|
|
3685
|
+
]);
|
|
3527
3686
|
var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
3528
3687
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
3529
3688
|
"network_error",
|
|
@@ -3664,6 +3823,9 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3664
3823
|
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
3665
3824
|
return "auth";
|
|
3666
3825
|
}
|
|
3826
|
+
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
|
|
3827
|
+
return "local_permission";
|
|
3828
|
+
}
|
|
3667
3829
|
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
3668
3830
|
return "validation";
|
|
3669
3831
|
}
|
|
@@ -3675,6 +3837,15 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3675
3837
|
}
|
|
3676
3838
|
return;
|
|
3677
3839
|
}
|
|
3840
|
+
function hasLocalPermissionCode(error) {
|
|
3841
|
+
for (const node of walkErrorGraph(error)) {
|
|
3842
|
+
const code = node.code;
|
|
3843
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
3844
|
+
return true;
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
return false;
|
|
3848
|
+
}
|
|
3678
3849
|
function classifyFromError(error) {
|
|
3679
3850
|
const code = findCodeInCauseChain(error);
|
|
3680
3851
|
if (code) {
|
|
@@ -3691,6 +3862,9 @@ function classifyFromError(error) {
|
|
|
3691
3862
|
return "missing_dependency";
|
|
3692
3863
|
}
|
|
3693
3864
|
}
|
|
3865
|
+
if (hasLocalPermissionCode(error)) {
|
|
3866
|
+
return "local_permission";
|
|
3867
|
+
}
|
|
3694
3868
|
const message = stringField(error, "message");
|
|
3695
3869
|
if (message?.includes("fetch failed") === true) {
|
|
3696
3870
|
return "network_http";
|
|
@@ -3706,7 +3880,7 @@ function classifyError2(input) {
|
|
|
3706
3880
|
if (recorded?.errorClass) {
|
|
3707
3881
|
return recorded.errorClass;
|
|
3708
3882
|
}
|
|
3709
|
-
const status = recorded?.context?.httpStatus;
|
|
3883
|
+
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3710
3884
|
if (status !== undefined) {
|
|
3711
3885
|
return classifyHttpStatus(status);
|
|
3712
3886
|
}
|
|
@@ -3729,17 +3903,18 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3729
3903
|
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
|
|
3730
3904
|
const terminalSignal = terminalSignalFor(input, outcome);
|
|
3731
3905
|
return {
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
...errorClass ? {
|
|
3735
|
-
...terminalSignal ? {
|
|
3906
|
+
[CommandDimensions.ExitCode]: input.exitCode,
|
|
3907
|
+
[CommandDimensions.TerminalOutcome]: outcome,
|
|
3908
|
+
...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
|
|
3909
|
+
...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
|
|
3736
3910
|
};
|
|
3737
3911
|
}
|
|
3738
3912
|
|
|
3739
3913
|
// ../../common/src/telemetry/telemetry-events.ts
|
|
3740
3914
|
var CommonTelemetryEvents = {
|
|
3741
|
-
|
|
3742
|
-
|
|
3915
|
+
Start: "Application.Start",
|
|
3916
|
+
Error: "Application.Error",
|
|
3917
|
+
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3743
3918
|
};
|
|
3744
3919
|
|
|
3745
3920
|
// ../../common/src/registry.ts
|
|
@@ -3947,8 +4122,8 @@ function detectExecutionContext(options = {}) {
|
|
|
3947
4122
|
function getExecutionContextTelemetryProperties() {
|
|
3948
4123
|
const detected = detectExecutionContext();
|
|
3949
4124
|
return {
|
|
3950
|
-
|
|
3951
|
-
...detected.ciProvider ? {
|
|
4125
|
+
[BaseDimensions.ExecutionContext]: detected.executionContext,
|
|
4126
|
+
...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
|
|
3952
4127
|
};
|
|
3953
4128
|
}
|
|
3954
4129
|
// ../../common/src/telemetry/node-context-storage.ts
|
|
@@ -3991,7 +4166,7 @@ function getInboundTraceContext() {
|
|
|
3991
4166
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
3992
4167
|
var SESSION_ID_MAX_LENGTH = 64;
|
|
3993
4168
|
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
3994
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "
|
|
4169
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
3995
4170
|
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
3996
4171
|
var INHERITED_SESSION_SOURCES = [
|
|
3997
4172
|
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
@@ -4043,6 +4218,9 @@ function resolveTelemetrySession() {
|
|
|
4043
4218
|
telemetrySessionSlot.set(resolved);
|
|
4044
4219
|
return resolved;
|
|
4045
4220
|
}
|
|
4221
|
+
function getTelemetrySessionId() {
|
|
4222
|
+
return resolveTelemetrySession().id;
|
|
4223
|
+
}
|
|
4046
4224
|
function getTelemetrySessionSource() {
|
|
4047
4225
|
return resolveTelemetrySession().source;
|
|
4048
4226
|
}
|
|
@@ -4123,7 +4301,10 @@ class TelemetryService {
|
|
|
4123
4301
|
} catch (error) {
|
|
4124
4302
|
const durationMs = clock.elapsedMs();
|
|
4125
4303
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
4126
|
-
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4304
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4305
|
+
...properties,
|
|
4306
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4307
|
+
}, context));
|
|
4127
4308
|
throw error;
|
|
4128
4309
|
}
|
|
4129
4310
|
}
|
|
@@ -4194,7 +4375,10 @@ class TelemetryService {
|
|
|
4194
4375
|
const durationMs = clock.elapsedMs();
|
|
4195
4376
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
4196
4377
|
await this.telemetryProvider.trackDependency({
|
|
4197
|
-
...this.spanFor(name, durationMs, false, {
|
|
4378
|
+
...this.spanFor(name, durationMs, false, {
|
|
4379
|
+
...properties,
|
|
4380
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4381
|
+
}, childContext),
|
|
4198
4382
|
type
|
|
4199
4383
|
});
|
|
4200
4384
|
throw error;
|
|
@@ -4229,9 +4413,10 @@ class TelemetryService {
|
|
|
4229
4413
|
...globalProperties,
|
|
4230
4414
|
...this.defaultProperties,
|
|
4231
4415
|
...redactProperties(properties ?? {}),
|
|
4232
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
4416
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4417
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4233
4418
|
};
|
|
4234
|
-
return enriched;
|
|
4419
|
+
return lowercaseIdDimensionValues(enriched);
|
|
4235
4420
|
}
|
|
4236
4421
|
generateId() {
|
|
4237
4422
|
const bytes = new Uint8Array(8);
|
|
@@ -4992,7 +5177,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4992
5177
|
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).";
|
|
4993
5178
|
}
|
|
4994
5179
|
}
|
|
4995
|
-
function
|
|
5180
|
+
function countRecords(data) {
|
|
5181
|
+
if (Array.isArray(data))
|
|
5182
|
+
return data.length;
|
|
5183
|
+
return data == null ? 0 : 1;
|
|
5184
|
+
}
|
|
5185
|
+
function availableFields(data) {
|
|
5186
|
+
const records = Array.isArray(data) ? data : [data];
|
|
5187
|
+
const keys = new Set;
|
|
5188
|
+
for (const record of records) {
|
|
5189
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
5190
|
+
for (const key of Object.keys(record))
|
|
5191
|
+
keys.add(key);
|
|
5192
|
+
}
|
|
5193
|
+
}
|
|
5194
|
+
return [...keys];
|
|
5195
|
+
}
|
|
5196
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
5197
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
5198
|
+
if (!error && typeof decoded === "string")
|
|
5199
|
+
return decoded;
|
|
5200
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
5201
|
+
}
|
|
5202
|
+
function referencedFields(filter) {
|
|
5203
|
+
const top = new Set;
|
|
5204
|
+
const nested = new Set;
|
|
5205
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
5206
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
5207
|
+
const quoted = [];
|
|
5208
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
5209
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
5210
|
+
if (!isAlias) {
|
|
5211
|
+
quoted.push({
|
|
5212
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
5213
|
+
index,
|
|
5214
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
5215
|
+
});
|
|
5216
|
+
}
|
|
5217
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
5218
|
+
});
|
|
5219
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
5220
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
5221
|
+
const place = (name, index, tail) => {
|
|
5222
|
+
if (tail || index >= rootEnd)
|
|
5223
|
+
nested.add(name);
|
|
5224
|
+
else
|
|
5225
|
+
top.add(name);
|
|
5226
|
+
};
|
|
5227
|
+
for (const entry of quoted)
|
|
5228
|
+
place(entry.name, entry.index, entry.tail);
|
|
5229
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
5230
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
5231
|
+
for (const match of identifiers) {
|
|
5232
|
+
const [, name, trailing] = match;
|
|
5233
|
+
if (trailing || reserved.has(name))
|
|
5234
|
+
continue;
|
|
5235
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
5236
|
+
}
|
|
5237
|
+
return {
|
|
5238
|
+
top: [...top],
|
|
5239
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
5240
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
5241
|
+
};
|
|
5242
|
+
}
|
|
5243
|
+
function appearsBelowTopLevel(data, name) {
|
|
5244
|
+
let budget = 2000;
|
|
5245
|
+
const visit = (value, depth) => {
|
|
5246
|
+
if (budget-- <= 0 || depth > 4)
|
|
5247
|
+
return false;
|
|
5248
|
+
if (value === null || typeof value !== "object")
|
|
5249
|
+
return false;
|
|
5250
|
+
if (Array.isArray(value))
|
|
5251
|
+
return value.some((entry) => visit(entry, depth));
|
|
5252
|
+
const record = value;
|
|
5253
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
5254
|
+
return true;
|
|
5255
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
5256
|
+
};
|
|
5257
|
+
return visit(data, 0);
|
|
5258
|
+
}
|
|
5259
|
+
function alwaysNullKeys(records) {
|
|
5260
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
5261
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
5262
|
+
return [];
|
|
5263
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
5264
|
+
if (keys.length === 0)
|
|
5265
|
+
return [];
|
|
5266
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
5267
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
5268
|
+
}
|
|
5269
|
+
function carriesOnlyNulls(value) {
|
|
5270
|
+
if (value === null)
|
|
5271
|
+
return true;
|
|
5272
|
+
if (Array.isArray(value)) {
|
|
5273
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
5274
|
+
}
|
|
5275
|
+
if (typeof value === "object" && value !== undefined) {
|
|
5276
|
+
const values = Object.values(value);
|
|
5277
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
5278
|
+
}
|
|
5279
|
+
return false;
|
|
5280
|
+
}
|
|
5281
|
+
function nameList(names, cap2 = 12) {
|
|
5282
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
5283
|
+
const rest = names.length - shown.length;
|
|
5284
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5285
|
+
}
|
|
5286
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
5287
|
+
const present = availableFields(data);
|
|
5288
|
+
const refs = referencedFields(filter);
|
|
5289
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
5290
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5291
|
+
const count = countRecords(data);
|
|
5292
|
+
const scope = `${count} record(s)`;
|
|
5293
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5294
|
+
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" : "";
|
|
5295
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5296
|
+
let detail;
|
|
5297
|
+
let lede;
|
|
5298
|
+
if (outcome.kind === "null-elements") {
|
|
5299
|
+
lede = "returned only null values";
|
|
5300
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
5301
|
+
if (unknown.length > 0) {
|
|
5302
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5303
|
+
} else if (unchecked.length > 0) {
|
|
5304
|
+
detail = withSoundness(projected);
|
|
5305
|
+
} else {
|
|
5306
|
+
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`;
|
|
5307
|
+
}
|
|
5308
|
+
} else if (outcome.kind === "null-rows") {
|
|
5309
|
+
lede = "returned only null values";
|
|
5310
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
5311
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
5312
|
+
} else if (outcome.kind === "null-values") {
|
|
5313
|
+
lede = "returned only null values";
|
|
5314
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
5315
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
5316
|
+
if (sameSet) {
|
|
5317
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
5318
|
+
} else if (unknown.length > 0) {
|
|
5319
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5320
|
+
} else {
|
|
5321
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
5322
|
+
}
|
|
5323
|
+
} else {
|
|
5324
|
+
lede = "returned nothing";
|
|
5325
|
+
if (unknown.length > 0) {
|
|
5326
|
+
detail = isNotAField(unknown);
|
|
5327
|
+
} else {
|
|
5328
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
5329
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
5330
|
+
}
|
|
5331
|
+
}
|
|
5332
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
5333
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
5334
|
+
}
|
|
5335
|
+
function appendWarning(existing, note) {
|
|
5336
|
+
return existing ? `${existing} ${note}` : note;
|
|
5337
|
+
}
|
|
5338
|
+
function applyFilter(data, filter, onWarning) {
|
|
4996
5339
|
const codec = requireJmespath();
|
|
4997
5340
|
let result;
|
|
4998
5341
|
try {
|
|
@@ -5000,9 +5343,34 @@ function applyFilter(data, filter) {
|
|
|
5000
5343
|
} catch (err) {
|
|
5001
5344
|
throw new FilterEvaluationError(filter, err);
|
|
5002
5345
|
}
|
|
5003
|
-
|
|
5346
|
+
const inputCount = countRecords(data);
|
|
5347
|
+
const warn = (outcome) => {
|
|
5348
|
+
if (inputCount === 0)
|
|
5349
|
+
return;
|
|
5350
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
5351
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
5352
|
+
`);
|
|
5353
|
+
onWarning?.(note);
|
|
5354
|
+
};
|
|
5355
|
+
const warnIfAllNull = (records) => {
|
|
5356
|
+
const keys = alwaysNullKeys(records);
|
|
5357
|
+
if (keys.length > 0)
|
|
5358
|
+
warn({ kind: "null-values", keys });
|
|
5359
|
+
};
|
|
5360
|
+
if (result == null) {
|
|
5361
|
+
warn({ kind: "empty" });
|
|
5004
5362
|
return [];
|
|
5363
|
+
}
|
|
5005
5364
|
if (Array.isArray(result)) {
|
|
5365
|
+
if (result.length === 0) {
|
|
5366
|
+
warn({ kind: "empty" });
|
|
5367
|
+
} else if (result.every((entry) => entry === null)) {
|
|
5368
|
+
warn({ kind: "null-elements", count: result.length });
|
|
5369
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
5370
|
+
warn({ kind: "null-rows", count: result.length });
|
|
5371
|
+
} else {
|
|
5372
|
+
warnIfAllNull(result);
|
|
5373
|
+
}
|
|
5006
5374
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
5007
5375
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
5008
5376
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -5010,10 +5378,30 @@ function applyFilter(data, filter) {
|
|
|
5010
5378
|
}
|
|
5011
5379
|
return result;
|
|
5012
5380
|
}
|
|
5013
|
-
if (typeof result === "object")
|
|
5381
|
+
if (typeof result === "object") {
|
|
5382
|
+
warnIfAllNull([result]);
|
|
5014
5383
|
return result;
|
|
5384
|
+
}
|
|
5015
5385
|
return { Value: result };
|
|
5016
5386
|
}
|
|
5387
|
+
function filterFailureData(envelope) {
|
|
5388
|
+
const filter = getOutputFilter();
|
|
5389
|
+
const data = envelope.Data;
|
|
5390
|
+
if (!filter || data == null)
|
|
5391
|
+
return;
|
|
5392
|
+
let note;
|
|
5393
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
5394
|
+
note = n;
|
|
5395
|
+
}));
|
|
5396
|
+
if (filterError) {
|
|
5397
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
5398
|
+
return;
|
|
5399
|
+
}
|
|
5400
|
+
envelope.Data = filtered;
|
|
5401
|
+
if (note) {
|
|
5402
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5403
|
+
}
|
|
5404
|
+
}
|
|
5017
5405
|
function defaultErrorCodeForResult(result) {
|
|
5018
5406
|
switch (result) {
|
|
5019
5407
|
case RESULTS.AuthenticationError:
|
|
@@ -5057,7 +5445,7 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
5057
5445
|
return "server_error";
|
|
5058
5446
|
return;
|
|
5059
5447
|
}
|
|
5060
|
-
var LOCAL_PERMISSION_TEXT_PATTERN =
|
|
5448
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5061
5449
|
function defaultErrorCodeForFailure(data) {
|
|
5062
5450
|
if (data.Result === RESULTS.Failure) {
|
|
5063
5451
|
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
@@ -5096,8 +5484,14 @@ var OutputFormatter;
|
|
|
5096
5484
|
}
|
|
5097
5485
|
const filter = getOutputFilter();
|
|
5098
5486
|
if (filter) {
|
|
5099
|
-
|
|
5487
|
+
let note;
|
|
5488
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
5489
|
+
note = n;
|
|
5490
|
+
});
|
|
5100
5491
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
5492
|
+
if (note) {
|
|
5493
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
5494
|
+
}
|
|
5101
5495
|
}
|
|
5102
5496
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
5103
5497
|
}
|
|
@@ -5125,12 +5519,13 @@ var OutputFormatter;
|
|
|
5125
5519
|
delete envelope.TelemetryErrorClass;
|
|
5126
5520
|
delete envelope.TelemetryTerminalOutcome;
|
|
5127
5521
|
delete envelope.TelemetryTerminalSignal;
|
|
5522
|
+
filterFailureData(envelope);
|
|
5128
5523
|
if (!suppressTelemetry) {
|
|
5129
5524
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5525
|
+
[ErrorDimensions.Result]: data.Result,
|
|
5526
|
+
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
5527
|
+
[ErrorDimensions.Retry]: data.Retry,
|
|
5528
|
+
[ErrorDimensions.ErrorMessage]: data.Message
|
|
5134
5529
|
});
|
|
5135
5530
|
}
|
|
5136
5531
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -5173,13 +5568,20 @@ var OutputFormatter;
|
|
|
5173
5568
|
OutputFormatter.log = log;
|
|
5174
5569
|
function formatToString(data) {
|
|
5175
5570
|
const filter = getOutputFilter();
|
|
5571
|
+
const envelope = data;
|
|
5176
5572
|
if ("Data" in data && data.Data != null) {
|
|
5177
5573
|
data.Data = normalizeDataKeys(data.Data);
|
|
5178
5574
|
if (filter) {
|
|
5179
|
-
|
|
5575
|
+
let note;
|
|
5576
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
5577
|
+
note = n;
|
|
5578
|
+
}));
|
|
5579
|
+
if (note) {
|
|
5580
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5581
|
+
}
|
|
5180
5582
|
}
|
|
5181
5583
|
}
|
|
5182
|
-
const output = normalizeOutputKeys(
|
|
5584
|
+
const output = normalizeOutputKeys(envelope);
|
|
5183
5585
|
const lines = [];
|
|
5184
5586
|
const sink = getOutputSink();
|
|
5185
5587
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -5229,7 +5631,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
|
5229
5631
|
var MAX_SKILL_NAME_LENGTH = 80;
|
|
5230
5632
|
var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
5231
5633
|
function productMode(productArea, mode) {
|
|
5232
|
-
return {
|
|
5634
|
+
return { ProductArea: productArea, Mode: mode };
|
|
5233
5635
|
}
|
|
5234
5636
|
function attributionRecord(groups) {
|
|
5235
5637
|
const record = {};
|
|
@@ -5287,6 +5689,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
5287
5689
|
["rpa", "build", ["uip.rpa-legacy"]],
|
|
5288
5690
|
["conversational", "operate", ["uip.conversational"]],
|
|
5289
5691
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
5692
|
+
["coding-agents", "build", ["uip.coder"]],
|
|
5290
5693
|
["agenthub", "build", ["uip.agenthub"]],
|
|
5291
5694
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
5292
5695
|
["functions", "build", ["uip.function", "uip.functions"]],
|
|
@@ -5372,32 +5775,64 @@ function normalizeSkillName(value) {
|
|
|
5372
5775
|
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
5373
5776
|
const skillName = normalizeSkillName(skillSource);
|
|
5374
5777
|
return {
|
|
5375
|
-
...skillName ? {
|
|
5778
|
+
...skillName ? { SkillName: skillName } : {},
|
|
5376
5779
|
...getCommandProductModeAttribution(commandPath)
|
|
5377
5780
|
};
|
|
5378
5781
|
}
|
|
5782
|
+
var AGENT_SESSION_ENV = {
|
|
5783
|
+
[BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
|
|
5784
|
+
[SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
|
|
5785
|
+
[SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
|
|
5786
|
+
[SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
|
|
5787
|
+
};
|
|
5788
|
+
var MAX_TELEMETRY_TOKEN_LENGTH = 120;
|
|
5789
|
+
function sanitizeTelemetryToken(value) {
|
|
5790
|
+
return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
|
|
5791
|
+
}
|
|
5792
|
+
function buildAgentSessionTelemetry(env) {
|
|
5793
|
+
const dimensions = {};
|
|
5794
|
+
for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
|
|
5795
|
+
const value = env[variable]?.trim();
|
|
5796
|
+
if (value) {
|
|
5797
|
+
dimensions[key] = sanitizeTelemetryToken(value);
|
|
5798
|
+
}
|
|
5799
|
+
}
|
|
5800
|
+
return dimensions;
|
|
5801
|
+
}
|
|
5379
5802
|
|
|
5380
5803
|
// ../../common/src/telemetry/command-name.ts
|
|
5381
|
-
var
|
|
5804
|
+
var TELEMETRY_NAME_ROOT = "Cli";
|
|
5805
|
+
var CLI_COMMAND_ROOT = "uip";
|
|
5806
|
+
var TELEMETRY_NAME_BARE_ACTION = "Invoke";
|
|
5382
5807
|
function commandTelemetryName(parts) {
|
|
5808
|
+
const action = vetCommandTokens(parts).map(pascalizeToken).join("");
|
|
5809
|
+
return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
|
|
5810
|
+
}
|
|
5811
|
+
function commandInvocationPath(parts) {
|
|
5812
|
+
return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
|
|
5813
|
+
}
|
|
5814
|
+
function vetCommandTokens(parts) {
|
|
5383
5815
|
const tokens = [];
|
|
5384
5816
|
for (const part of parts) {
|
|
5385
|
-
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !==
|
|
5817
|
+
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
|
|
5386
5818
|
if (pieces.every(isCommandToken)) {
|
|
5387
5819
|
tokens.push(...pieces);
|
|
5388
5820
|
continue;
|
|
5389
5821
|
}
|
|
5390
5822
|
tokens.push(UNKNOWN_TOKEN);
|
|
5391
5823
|
}
|
|
5392
|
-
return
|
|
5824
|
+
return tokens;
|
|
5393
5825
|
}
|
|
5394
|
-
|
|
5826
|
+
function pascalizeToken(token) {
|
|
5827
|
+
return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
5828
|
+
}
|
|
5829
|
+
var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
5395
5830
|
var MAX_COMMAND_TOKEN_LENGTH = 32;
|
|
5396
5831
|
var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
5397
5832
|
function isCommandToken(token) {
|
|
5398
|
-
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token)
|
|
5833
|
+
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
|
|
5399
5834
|
}
|
|
5400
|
-
var UNKNOWN_TOKEN = "
|
|
5835
|
+
var UNKNOWN_TOKEN = "unknown";
|
|
5401
5836
|
|
|
5402
5837
|
// ../../common/src/telemetry/invocation-request.ts
|
|
5403
5838
|
var requestContextSlot = singleton("TelemetryInvocationRequestContext");
|
|
@@ -5502,7 +5937,7 @@ function withheldArgumentValues(cmd) {
|
|
|
5502
5937
|
});
|
|
5503
5938
|
return values;
|
|
5504
5939
|
}
|
|
5505
|
-
function
|
|
5940
|
+
function deriveCommandParts(cmd) {
|
|
5506
5941
|
const parts = [];
|
|
5507
5942
|
let current = cmd;
|
|
5508
5943
|
while (current) {
|
|
@@ -5515,14 +5950,13 @@ function deriveCommandPath(cmd) {
|
|
|
5515
5950
|
if (parts.length > 1) {
|
|
5516
5951
|
parts.shift();
|
|
5517
5952
|
}
|
|
5518
|
-
return
|
|
5953
|
+
return parts;
|
|
5519
5954
|
}
|
|
5520
5955
|
function isErrorContext(value) {
|
|
5521
5956
|
return value !== null && typeof value === "object";
|
|
5522
5957
|
}
|
|
5523
5958
|
function commandHelpHint(commandPath) {
|
|
5524
|
-
|
|
5525
|
-
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5959
|
+
return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5526
5960
|
}
|
|
5527
5961
|
function isPromptCancellation(error) {
|
|
5528
5962
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
@@ -5547,7 +5981,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5547
5981
|
yaml: getOutputFormat() === "yaml",
|
|
5548
5982
|
filter: getOutputFilter() !== undefined
|
|
5549
5983
|
});
|
|
5550
|
-
const
|
|
5984
|
+
const commandParts = deriveCommandParts(command);
|
|
5985
|
+
const telemetryName = commandTelemetryName(commandParts);
|
|
5986
|
+
const commandPath = commandInvocationPath(commandParts);
|
|
5551
5987
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
5552
5988
|
markCommandStart();
|
|
5553
5989
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
@@ -5582,7 +6018,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5582
6018
|
Result: finalResult,
|
|
5583
6019
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
5584
6020
|
Message: errorMessage,
|
|
5585
|
-
Instructions: customInstructions ?? commandHelpHint(
|
|
6021
|
+
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
5586
6022
|
...customRetry ? { Retry: customRetry } : {},
|
|
5587
6023
|
...customContext ? { Context: customContext } : {}
|
|
5588
6024
|
});
|
|
@@ -5599,8 +6035,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5599
6035
|
recordedFailure,
|
|
5600
6036
|
pollSignal: context.pollSignal
|
|
5601
6037
|
});
|
|
5602
|
-
if (terminalTelemetry.
|
|
5603
|
-
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), {
|
|
6038
|
+
if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
|
|
6039
|
+
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
|
|
5604
6040
|
}
|
|
5605
6041
|
const commandParams = extractCommandParams(command);
|
|
5606
6042
|
if (props) {
|
|
@@ -5611,10 +6047,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5611
6047
|
const baseProperties = redactProperties({
|
|
5612
6048
|
...commandParams,
|
|
5613
6049
|
...props,
|
|
5614
|
-
...buildCommandTelemetryAttribution(
|
|
5615
|
-
|
|
6050
|
+
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6051
|
+
...buildAgentSessionTelemetry(process.env),
|
|
6052
|
+
[CommandDimensions.CommandName]: commandPath,
|
|
6053
|
+
[CommandDimensions.IsCommand]: "true",
|
|
5616
6054
|
...terminalTelemetry,
|
|
5617
|
-
...errorMessage ? { errorMessage } : {}
|
|
6055
|
+
...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
|
|
5618
6056
|
});
|
|
5619
6057
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5620
6058
|
} finally {
|
|
@@ -5845,6 +6283,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
|
|
|
5845
6283
|
// ../../common/src/interactivity-context.ts
|
|
5846
6284
|
var modeSlot = singleton("InteractivityMode");
|
|
5847
6285
|
var interactiveFlagSlot = singleton("InteractiveFlag");
|
|
6286
|
+
// ../../common/src/mime-types.ts
|
|
6287
|
+
var MIME_TYPES_BY_EXTENSION = Object.freeze({
|
|
6288
|
+
pdf: "application/pdf",
|
|
6289
|
+
png: "image/png",
|
|
6290
|
+
jpg: "image/jpeg",
|
|
6291
|
+
jpeg: "image/jpeg",
|
|
6292
|
+
gif: "image/gif",
|
|
6293
|
+
webp: "image/webp",
|
|
6294
|
+
bmp: "image/bmp",
|
|
6295
|
+
tif: "image/tiff",
|
|
6296
|
+
tiff: "image/tiff",
|
|
6297
|
+
svg: "image/svg+xml",
|
|
6298
|
+
txt: "text/plain",
|
|
6299
|
+
log: "text/plain",
|
|
6300
|
+
md: "text/markdown",
|
|
6301
|
+
csv: "text/csv",
|
|
6302
|
+
tsv: "text/tab-separated-values",
|
|
6303
|
+
json: "application/json",
|
|
6304
|
+
xml: "application/xml",
|
|
6305
|
+
html: "text/html",
|
|
6306
|
+
htm: "text/html",
|
|
6307
|
+
yaml: "application/yaml",
|
|
6308
|
+
yml: "application/yaml",
|
|
6309
|
+
doc: "application/msword",
|
|
6310
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
6311
|
+
xls: "application/vnd.ms-excel",
|
|
6312
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
6313
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
6314
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
6315
|
+
zip: "application/zip",
|
|
6316
|
+
mp3: "audio/mpeg",
|
|
6317
|
+
wav: "audio/wav",
|
|
6318
|
+
mp4: "video/mp4"
|
|
6319
|
+
});
|
|
5848
6320
|
// ../../common/src/polling/types.ts
|
|
5849
6321
|
var PollOutcome = {
|
|
5850
6322
|
Completed: "completed",
|
|
@@ -5890,6 +6362,7 @@ var ScreenLogger;
|
|
|
5890
6362
|
})(ScreenLogger ||= {});
|
|
5891
6363
|
// ../../common/src/sdk-user-agent.ts
|
|
5892
6364
|
var USER_AGENT_HEADER = "User-Agent";
|
|
6365
|
+
var AGENT_PROPERTY = BaseDimensions.Agent;
|
|
5893
6366
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
5894
6367
|
function userAgentPatchKey(userAgent) {
|
|
5895
6368
|
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
@@ -6782,7 +7255,7 @@ var package_default = {
|
|
|
6782
7255
|
name: "@uipath/oms-sdk",
|
|
6783
7256
|
author: "UiPath",
|
|
6784
7257
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6785
|
-
version: "1.
|
|
7258
|
+
version: "1.204.0",
|
|
6786
7259
|
description: "SDK for the UiPath Organization Management Service API.",
|
|
6787
7260
|
repository: {
|
|
6788
7261
|
type: "git",
|
|
@@ -11518,6 +11991,11 @@ var pickName = (claims) => {
|
|
|
11518
11991
|
const username = asString(claims?.preferred_username);
|
|
11519
11992
|
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
11520
11993
|
};
|
|
11994
|
+
var pickScopes = (claims) => {
|
|
11995
|
+
const raw = claims?.scope;
|
|
11996
|
+
const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
|
|
11997
|
+
return scopes.length > 0 ? scopes : undefined;
|
|
11998
|
+
};
|
|
11521
11999
|
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
11522
12000
|
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
11523
12001
|
const email = pickEmail(claims);
|
|
@@ -11543,6 +12021,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
11543
12021
|
identity.clientId = clientId;
|
|
11544
12022
|
return identity;
|
|
11545
12023
|
};
|
|
12024
|
+
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
11546
12025
|
|
|
11547
12026
|
// ../../auth/src/envAuth.ts
|
|
11548
12027
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
@@ -11615,6 +12094,7 @@ var readAuthFromEnv = () => {
|
|
|
11615
12094
|
const expiration = getTokenExpiration(accessToken);
|
|
11616
12095
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
11617
12096
|
const identity = resolveSessionIdentity(accessToken);
|
|
12097
|
+
const scopes = readTokenScopes(accessToken);
|
|
11618
12098
|
return {
|
|
11619
12099
|
loginStatus,
|
|
11620
12100
|
accessToken,
|
|
@@ -11625,7 +12105,8 @@ var readAuthFromEnv = () => {
|
|
|
11625
12105
|
tenantId,
|
|
11626
12106
|
expiration,
|
|
11627
12107
|
source: "env-vars" /* EnvironmentVariables */,
|
|
11628
|
-
...identity ? { identity } : {}
|
|
12108
|
+
...identity ? { identity } : {},
|
|
12109
|
+
...scopes ? { scopes } : {}
|
|
11629
12110
|
};
|
|
11630
12111
|
};
|
|
11631
12112
|
|
|
@@ -12263,10 +12744,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
12263
12744
|
}
|
|
12264
12745
|
function identityFields(accessToken, credentials) {
|
|
12265
12746
|
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
12266
|
-
|
|
12747
|
+
const scopes = readTokenScopes(accessToken);
|
|
12748
|
+
return {
|
|
12749
|
+
...identity ? { identity } : {},
|
|
12750
|
+
...scopes ? { scopes } : {}
|
|
12751
|
+
};
|
|
12267
12752
|
}
|
|
12268
12753
|
function buildRobotStatus(robotCreds) {
|
|
12269
12754
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
12755
|
+
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
12270
12756
|
return {
|
|
12271
12757
|
loginStatus: "Logged in",
|
|
12272
12758
|
accessToken: robotCreds.accessToken,
|
|
@@ -12278,7 +12764,8 @@ function buildRobotStatus(robotCreds) {
|
|
|
12278
12764
|
issuer: robotCreds.issuer,
|
|
12279
12765
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
12280
12766
|
source: "robot" /* Robot */,
|
|
12281
|
-
...identity ? { identity } : {}
|
|
12767
|
+
...identity ? { identity } : {},
|
|
12768
|
+
...scopes ? { scopes } : {}
|
|
12282
12769
|
};
|
|
12283
12770
|
}
|
|
12284
12771
|
var isFileNotFoundError = (error) => {
|
|
@@ -13766,4 +14253,4 @@ export {
|
|
|
13766
14253
|
registerCommands
|
|
13767
14254
|
};
|
|
13768
14255
|
|
|
13769
|
-
//# debugId=
|
|
14256
|
+
//# debugId=BB1A0B1893AA3D7F64756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/oms-commands",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.204.0-preview.206",
|
|
6
6
|
"description": "Admin CLI commands for the UiPath Organization Management Service. Library composed by admin-tool, not a standalone CLI tool.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ea7fd32a02acccf14e8e83522e69101430627b83"
|
|
30
30
|
}
|