@uipath/llm-gateway-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.
- package/dist/tool.js +719 -1120
- package/package.json +2 -2
package/dist/tool.js
CHANGED
|
@@ -2101,7 +2101,7 @@ var package_default = {
|
|
|
2101
2101
|
name: "@uipath/llm-gateway-tool",
|
|
2102
2102
|
author: "UiPath",
|
|
2103
2103
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.
|
|
2104
|
+
version: "1.204.0-preview.211",
|
|
2105
2105
|
description: "CLI plugin for UiPath LLM Gateway model discovery.",
|
|
2106
2106
|
private: false,
|
|
2107
2107
|
repository: {
|
|
@@ -2125,6 +2125,7 @@ var package_default = {
|
|
|
2125
2125
|
],
|
|
2126
2126
|
scripts: {
|
|
2127
2127
|
build: "bun ../../../tools/build-tool.ts",
|
|
2128
|
+
typecheck: "tsc --noEmit",
|
|
2128
2129
|
lint: "biome check .",
|
|
2129
2130
|
"lint:fix": "biome check --write .",
|
|
2130
2131
|
test: "vitest run",
|
|
@@ -2906,9 +2907,60 @@ function settlePromiseLike(thenable) {
|
|
|
2906
2907
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2907
2908
|
}
|
|
2908
2909
|
|
|
2910
|
+
// ../../common/src/error-graph.ts
|
|
2911
|
+
function* walkErrorGraph(error) {
|
|
2912
|
+
const queue = [error];
|
|
2913
|
+
const seen = new Set;
|
|
2914
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2915
|
+
const current = queue.shift();
|
|
2916
|
+
if (current === null || typeof current !== "object")
|
|
2917
|
+
continue;
|
|
2918
|
+
if (seen.has(current))
|
|
2919
|
+
continue;
|
|
2920
|
+
seen.add(current);
|
|
2921
|
+
const cur = current;
|
|
2922
|
+
yield cur;
|
|
2923
|
+
if (cur.cause !== undefined)
|
|
2924
|
+
queue.push(cur.cause);
|
|
2925
|
+
if (Array.isArray(cur.errors))
|
|
2926
|
+
queue.push(...cur.errors);
|
|
2927
|
+
}
|
|
2928
|
+
return;
|
|
2929
|
+
}
|
|
2930
|
+
function parseHttpStatusFromMessage(message) {
|
|
2931
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2932
|
+
if (!match)
|
|
2933
|
+
return;
|
|
2934
|
+
const status = Number(match[1]);
|
|
2935
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2936
|
+
}
|
|
2937
|
+
function findHttpStatusInGraph(error) {
|
|
2938
|
+
for (const node of walkErrorGraph(error)) {
|
|
2939
|
+
const response = node.response;
|
|
2940
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2941
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2942
|
+
return explicit;
|
|
2943
|
+
}
|
|
2944
|
+
if (typeof node.message === "string") {
|
|
2945
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2946
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
2947
|
+
return parsed;
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
// ../../common/src/local-permission-codes.ts
|
|
2955
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2956
|
+
"EACCES",
|
|
2957
|
+
"EPERM",
|
|
2958
|
+
"EROFS"
|
|
2959
|
+
]);
|
|
2960
|
+
|
|
2909
2961
|
// ../../common/src/error-handler.ts
|
|
2910
|
-
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to
|
|
2911
|
-
var DEFAULT_403 = "Forbidden (403).
|
|
2962
|
+
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.";
|
|
2963
|
+
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.";
|
|
2912
2964
|
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2913
2965
|
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.";
|
|
2914
2966
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
@@ -2935,14 +2987,14 @@ var TLS_ERROR_CODES = new Set([
|
|
|
2935
2987
|
]);
|
|
2936
2988
|
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.";
|
|
2937
2989
|
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.";
|
|
2938
|
-
var
|
|
2939
|
-
var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
|
|
2990
|
+
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
2940
2991
|
function localPermissionInstructions(code, path2) {
|
|
2941
2992
|
const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
|
|
2942
2993
|
if (code === "EROFS") {
|
|
2943
2994
|
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.";
|
|
2944
2995
|
}
|
|
2945
|
-
const
|
|
2996
|
+
const onWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
2997
|
+
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.";
|
|
2946
2998
|
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}`;
|
|
2947
2999
|
}
|
|
2948
3000
|
function describeConnectivityError(error) {
|
|
@@ -2996,48 +3048,6 @@ function localPermissionPath(path2, message) {
|
|
|
2996
3048
|
return path2;
|
|
2997
3049
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
2998
3050
|
}
|
|
2999
|
-
function* walkErrorGraph(error) {
|
|
3000
|
-
const queue = [error];
|
|
3001
|
-
const seen = new Set;
|
|
3002
|
-
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
3003
|
-
const current = queue.shift();
|
|
3004
|
-
if (current === null || typeof current !== "object")
|
|
3005
|
-
continue;
|
|
3006
|
-
if (seen.has(current))
|
|
3007
|
-
continue;
|
|
3008
|
-
seen.add(current);
|
|
3009
|
-
const cur = current;
|
|
3010
|
-
yield cur;
|
|
3011
|
-
if (cur.cause !== undefined)
|
|
3012
|
-
queue.push(cur.cause);
|
|
3013
|
-
if (Array.isArray(cur.errors))
|
|
3014
|
-
queue.push(...cur.errors);
|
|
3015
|
-
}
|
|
3016
|
-
return;
|
|
3017
|
-
}
|
|
3018
|
-
function parseHttpStatusFromMessage(message) {
|
|
3019
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
3020
|
-
if (!match)
|
|
3021
|
-
return;
|
|
3022
|
-
const status = Number(match[1]);
|
|
3023
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
3024
|
-
}
|
|
3025
|
-
function findHttpStatusInGraph(error) {
|
|
3026
|
-
for (const node of walkErrorGraph(error)) {
|
|
3027
|
-
const response = node.response;
|
|
3028
|
-
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
3029
|
-
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
3030
|
-
return explicit;
|
|
3031
|
-
}
|
|
3032
|
-
if (typeof node.message === "string") {
|
|
3033
|
-
const parsed = parseHttpStatusFromMessage(node.message);
|
|
3034
|
-
if (parsed !== undefined && parsed >= 400) {
|
|
3035
|
-
return parsed;
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3038
|
-
}
|
|
3039
|
-
return;
|
|
3040
|
-
}
|
|
3041
3051
|
function isHtmlDocument(body) {
|
|
3042
3052
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3043
3053
|
}
|
|
@@ -3559,12 +3569,162 @@ function getOutputFilter() {
|
|
|
3559
3569
|
return filterSlot.get();
|
|
3560
3570
|
}
|
|
3561
3571
|
|
|
3572
|
+
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
3573
|
+
var BaseDimensions = {
|
|
3574
|
+
ApplicationName: "ApplicationName",
|
|
3575
|
+
ProductVersion: "ProductVersion",
|
|
3576
|
+
InstallationId: "InstallationId",
|
|
3577
|
+
CloudUserId: "CloudUserId",
|
|
3578
|
+
CloudTenantId: "CloudTenantId",
|
|
3579
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
3580
|
+
IsInternalUser: "IsInternalUser",
|
|
3581
|
+
Environment: "Environment",
|
|
3582
|
+
BaseUrl: "BaseUrl",
|
|
3583
|
+
Region: "Region",
|
|
3584
|
+
Agent: "Agent",
|
|
3585
|
+
AgentVersion: "AgentVersion",
|
|
3586
|
+
AgentModel: "AgentModel",
|
|
3587
|
+
ToolName: "ToolName",
|
|
3588
|
+
ToolVersion: "ToolVersion",
|
|
3589
|
+
ExecutionContext: "ExecutionContext",
|
|
3590
|
+
CiProvider: "CiProvider",
|
|
3591
|
+
SessionIdSource: "SessionIdSource",
|
|
3592
|
+
SessionId: "SessionId"
|
|
3593
|
+
};
|
|
3594
|
+
var CommandDimensions = {
|
|
3595
|
+
IsCommand: "IsCommand",
|
|
3596
|
+
IsReexec: "IsReexec",
|
|
3597
|
+
CommandName: "CommandName",
|
|
3598
|
+
ExitCode: "ExitCode",
|
|
3599
|
+
TerminalOutcome: "TerminalOutcome",
|
|
3600
|
+
ErrorClass: "ErrorClass",
|
|
3601
|
+
TerminalSignal: "TerminalSignal",
|
|
3602
|
+
ErrorMessage: "ErrorMessage",
|
|
3603
|
+
SkillName: "SkillName",
|
|
3604
|
+
ProductArea: "ProductArea",
|
|
3605
|
+
Mode: "Mode"
|
|
3606
|
+
};
|
|
3607
|
+
var ShipDimensions = {
|
|
3608
|
+
ShipKind: "ShipKind",
|
|
3609
|
+
Target: "Target",
|
|
3610
|
+
ProjectType: "ProjectType",
|
|
3611
|
+
ProjectTypes: "ProjectTypes",
|
|
3612
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3613
|
+
PackageName: "PackageName",
|
|
3614
|
+
PackageVersion: "PackageVersion",
|
|
3615
|
+
PackageVersionKey: "PackageVersionKey",
|
|
3616
|
+
DeploymentKey: "DeploymentKey",
|
|
3617
|
+
SolutionId: "SolutionId",
|
|
3618
|
+
FolderKey: "FolderKey",
|
|
3619
|
+
FeedId: "FeedId"
|
|
3620
|
+
};
|
|
3621
|
+
var ErrorDimensions = {
|
|
3622
|
+
Result: "Result",
|
|
3623
|
+
ErrorCode: "ErrorCode",
|
|
3624
|
+
Retry: "Retry",
|
|
3625
|
+
ErrorMessage: "ErrorMessage"
|
|
3626
|
+
};
|
|
3627
|
+
var AuthDimensions = {
|
|
3628
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
3629
|
+
Success: "Success",
|
|
3630
|
+
Reason: "Reason"
|
|
3631
|
+
};
|
|
3632
|
+
var SkillsDimensions = {
|
|
3633
|
+
SchemaVersion: "SchemaVersion",
|
|
3634
|
+
AgentType: "AgentType",
|
|
3635
|
+
SkillsVersion: "SkillsVersion",
|
|
3636
|
+
UipSubcommand: "UipSubcommand",
|
|
3637
|
+
FileExtension: "FileExtension",
|
|
3638
|
+
SubagentModel: "SubagentModel",
|
|
3639
|
+
SubagentType: "SubagentType",
|
|
3640
|
+
PermissionMode: "PermissionMode",
|
|
3641
|
+
EffortLevel: "EffortLevel",
|
|
3642
|
+
SessionSource: "SessionSource",
|
|
3643
|
+
Outcome: "Outcome",
|
|
3644
|
+
DurationMs: "DurationMs",
|
|
3645
|
+
Source: "Source"
|
|
3646
|
+
};
|
|
3647
|
+
var PackagerDimensions = {
|
|
3648
|
+
ProjectId: "ProjectId",
|
|
3649
|
+
ProjectType: "ProjectType",
|
|
3650
|
+
SolutionId: "SolutionId"
|
|
3651
|
+
};
|
|
3652
|
+
var ScopeDimensions = {
|
|
3653
|
+
FolderId: "FolderId"
|
|
3654
|
+
};
|
|
3655
|
+
var ID_DIMENSIONS = new Set([
|
|
3656
|
+
BaseDimensions.CloudUserId,
|
|
3657
|
+
BaseDimensions.CloudTenantId,
|
|
3658
|
+
BaseDimensions.CloudOrganizationId,
|
|
3659
|
+
BaseDimensions.InstallationId,
|
|
3660
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
3661
|
+
ShipDimensions.PackageVersionKey,
|
|
3662
|
+
ShipDimensions.DeploymentKey,
|
|
3663
|
+
ShipDimensions.SolutionId,
|
|
3664
|
+
ShipDimensions.FolderKey,
|
|
3665
|
+
ShipDimensions.FeedId,
|
|
3666
|
+
PackagerDimensions.ProjectId
|
|
3667
|
+
]);
|
|
3668
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3669
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3670
|
+
...Object.values(BaseDimensions),
|
|
3671
|
+
...Object.values(CommandDimensions),
|
|
3672
|
+
...Object.values(ShipDimensions),
|
|
3673
|
+
...Object.values(ErrorDimensions),
|
|
3674
|
+
...Object.values(AuthDimensions),
|
|
3675
|
+
...Object.values(SkillsDimensions),
|
|
3676
|
+
...Object.values(PackagerDimensions),
|
|
3677
|
+
...Object.values(ScopeDimensions)
|
|
3678
|
+
]);
|
|
3679
|
+
var CURATED_DIMENSIONS = new Set([
|
|
3680
|
+
BaseDimensions.ApplicationName,
|
|
3681
|
+
BaseDimensions.ProductVersion,
|
|
3682
|
+
BaseDimensions.InstallationId,
|
|
3683
|
+
BaseDimensions.CloudUserId,
|
|
3684
|
+
BaseDimensions.CloudTenantId,
|
|
3685
|
+
BaseDimensions.CloudOrganizationId,
|
|
3686
|
+
BaseDimensions.IsInternalUser,
|
|
3687
|
+
BaseDimensions.Environment,
|
|
3688
|
+
BaseDimensions.BaseUrl,
|
|
3689
|
+
BaseDimensions.Region,
|
|
3690
|
+
BaseDimensions.Agent,
|
|
3691
|
+
BaseDimensions.AgentVersion,
|
|
3692
|
+
BaseDimensions.ToolVersion,
|
|
3693
|
+
BaseDimensions.ExecutionContext,
|
|
3694
|
+
BaseDimensions.CiProvider,
|
|
3695
|
+
BaseDimensions.SessionIdSource,
|
|
3696
|
+
BaseDimensions.SessionId,
|
|
3697
|
+
...Object.values(CommandDimensions),
|
|
3698
|
+
...Object.values(ShipDimensions)
|
|
3699
|
+
]);
|
|
3700
|
+
function lowercaseIdDimensionValues(properties) {
|
|
3701
|
+
let changed = false;
|
|
3702
|
+
const result = {
|
|
3703
|
+
...properties
|
|
3704
|
+
};
|
|
3705
|
+
for (const key of Object.keys(result)) {
|
|
3706
|
+
const value = result[key];
|
|
3707
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3708
|
+
continue;
|
|
3709
|
+
}
|
|
3710
|
+
const lowered = value.toLowerCase();
|
|
3711
|
+
if (lowered !== value) {
|
|
3712
|
+
result[key] = lowered;
|
|
3713
|
+
changed = true;
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
return changed ? result : properties;
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3562
3719
|
// ../../common/src/telemetry/command-terminal.ts
|
|
3563
3720
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3564
3721
|
var AUTH_ERROR_CODES = new Set([
|
|
3565
3722
|
"authentication_required",
|
|
3566
3723
|
"permission_denied"
|
|
3567
3724
|
]);
|
|
3725
|
+
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
3726
|
+
"local_permission_denied"
|
|
3727
|
+
]);
|
|
3568
3728
|
var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
3569
3729
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
3570
3730
|
"network_error",
|
|
@@ -3705,6 +3865,9 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3705
3865
|
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
3706
3866
|
return "auth";
|
|
3707
3867
|
}
|
|
3868
|
+
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
|
|
3869
|
+
return "local_permission";
|
|
3870
|
+
}
|
|
3708
3871
|
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
3709
3872
|
return "validation";
|
|
3710
3873
|
}
|
|
@@ -3716,6 +3879,15 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3716
3879
|
}
|
|
3717
3880
|
return;
|
|
3718
3881
|
}
|
|
3882
|
+
function hasLocalPermissionCode(error) {
|
|
3883
|
+
for (const node of walkErrorGraph(error)) {
|
|
3884
|
+
const code = node.code;
|
|
3885
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
3886
|
+
return true;
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
return false;
|
|
3890
|
+
}
|
|
3719
3891
|
function classifyFromError(error) {
|
|
3720
3892
|
const code = findCodeInCauseChain(error);
|
|
3721
3893
|
if (code) {
|
|
@@ -3732,6 +3904,9 @@ function classifyFromError(error) {
|
|
|
3732
3904
|
return "missing_dependency";
|
|
3733
3905
|
}
|
|
3734
3906
|
}
|
|
3907
|
+
if (hasLocalPermissionCode(error)) {
|
|
3908
|
+
return "local_permission";
|
|
3909
|
+
}
|
|
3735
3910
|
const message = stringField(error, "message");
|
|
3736
3911
|
if (message?.includes("fetch failed") === true) {
|
|
3737
3912
|
return "network_http";
|
|
@@ -3747,7 +3922,7 @@ function classifyError2(input) {
|
|
|
3747
3922
|
if (recorded?.errorClass) {
|
|
3748
3923
|
return recorded.errorClass;
|
|
3749
3924
|
}
|
|
3750
|
-
const status = recorded?.context?.httpStatus;
|
|
3925
|
+
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3751
3926
|
if (status !== undefined) {
|
|
3752
3927
|
return classifyHttpStatus(status);
|
|
3753
3928
|
}
|
|
@@ -3770,17 +3945,18 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3770
3945
|
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
|
|
3771
3946
|
const terminalSignal = terminalSignalFor(input, outcome);
|
|
3772
3947
|
return {
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
...errorClass ? {
|
|
3776
|
-
...terminalSignal ? {
|
|
3948
|
+
[CommandDimensions.ExitCode]: input.exitCode,
|
|
3949
|
+
[CommandDimensions.TerminalOutcome]: outcome,
|
|
3950
|
+
...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
|
|
3951
|
+
...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
|
|
3777
3952
|
};
|
|
3778
3953
|
}
|
|
3779
3954
|
|
|
3780
3955
|
// ../../common/src/telemetry/telemetry-events.ts
|
|
3781
3956
|
var CommonTelemetryEvents = {
|
|
3782
|
-
|
|
3783
|
-
|
|
3957
|
+
Start: "Application.Start",
|
|
3958
|
+
Error: "Application.Error",
|
|
3959
|
+
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3784
3960
|
};
|
|
3785
3961
|
|
|
3786
3962
|
// ../../common/src/registry.ts
|
|
@@ -3988,8 +4164,8 @@ function detectExecutionContext(options = {}) {
|
|
|
3988
4164
|
function getExecutionContextTelemetryProperties() {
|
|
3989
4165
|
const detected = detectExecutionContext();
|
|
3990
4166
|
return {
|
|
3991
|
-
|
|
3992
|
-
...detected.ciProvider ? {
|
|
4167
|
+
[BaseDimensions.ExecutionContext]: detected.executionContext,
|
|
4168
|
+
...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
|
|
3993
4169
|
};
|
|
3994
4170
|
}
|
|
3995
4171
|
// ../../common/src/telemetry/node-context-storage.ts
|
|
@@ -4032,7 +4208,7 @@ function getInboundTraceContext() {
|
|
|
4032
4208
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4033
4209
|
var SESSION_ID_MAX_LENGTH = 64;
|
|
4034
4210
|
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4035
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "
|
|
4211
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4036
4212
|
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4037
4213
|
var INHERITED_SESSION_SOURCES = [
|
|
4038
4214
|
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
@@ -4084,6 +4260,9 @@ function resolveTelemetrySession() {
|
|
|
4084
4260
|
telemetrySessionSlot.set(resolved);
|
|
4085
4261
|
return resolved;
|
|
4086
4262
|
}
|
|
4263
|
+
function getTelemetrySessionId() {
|
|
4264
|
+
return resolveTelemetrySession().id;
|
|
4265
|
+
}
|
|
4087
4266
|
function getTelemetrySessionSource() {
|
|
4088
4267
|
return resolveTelemetrySession().source;
|
|
4089
4268
|
}
|
|
@@ -4164,7 +4343,10 @@ class TelemetryService {
|
|
|
4164
4343
|
} catch (error) {
|
|
4165
4344
|
const durationMs = clock.elapsedMs();
|
|
4166
4345
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
4167
|
-
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4346
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
4347
|
+
...properties,
|
|
4348
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4349
|
+
}, context));
|
|
4168
4350
|
throw error;
|
|
4169
4351
|
}
|
|
4170
4352
|
}
|
|
@@ -4235,7 +4417,10 @@ class TelemetryService {
|
|
|
4235
4417
|
const durationMs = clock.elapsedMs();
|
|
4236
4418
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
4237
4419
|
await this.telemetryProvider.trackDependency({
|
|
4238
|
-
...this.spanFor(name, durationMs, false, {
|
|
4420
|
+
...this.spanFor(name, durationMs, false, {
|
|
4421
|
+
...properties,
|
|
4422
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4423
|
+
}, childContext),
|
|
4239
4424
|
type
|
|
4240
4425
|
});
|
|
4241
4426
|
throw error;
|
|
@@ -4270,9 +4455,10 @@ class TelemetryService {
|
|
|
4270
4455
|
...globalProperties,
|
|
4271
4456
|
...this.defaultProperties,
|
|
4272
4457
|
...redactProperties(properties ?? {}),
|
|
4273
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
4458
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4459
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4274
4460
|
};
|
|
4275
|
-
return enriched;
|
|
4461
|
+
return lowercaseIdDimensionValues(enriched);
|
|
4276
4462
|
}
|
|
4277
4463
|
generateId() {
|
|
4278
4464
|
const bytes = new Uint8Array(8);
|
|
@@ -5033,7 +5219,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
5033
5219
|
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).";
|
|
5034
5220
|
}
|
|
5035
5221
|
}
|
|
5036
|
-
function
|
|
5222
|
+
function countRecords(data) {
|
|
5223
|
+
if (Array.isArray(data))
|
|
5224
|
+
return data.length;
|
|
5225
|
+
return data == null ? 0 : 1;
|
|
5226
|
+
}
|
|
5227
|
+
function availableFields(data) {
|
|
5228
|
+
const records = Array.isArray(data) ? data : [data];
|
|
5229
|
+
const keys = new Set;
|
|
5230
|
+
for (const record of records) {
|
|
5231
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
5232
|
+
for (const key of Object.keys(record))
|
|
5233
|
+
keys.add(key);
|
|
5234
|
+
}
|
|
5235
|
+
}
|
|
5236
|
+
return [...keys];
|
|
5237
|
+
}
|
|
5238
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
5239
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
5240
|
+
if (!error && typeof decoded === "string")
|
|
5241
|
+
return decoded;
|
|
5242
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
5243
|
+
}
|
|
5244
|
+
function referencedFields(filter) {
|
|
5245
|
+
const top = new Set;
|
|
5246
|
+
const nested = new Set;
|
|
5247
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
5248
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
5249
|
+
const quoted = [];
|
|
5250
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
5251
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
5252
|
+
if (!isAlias) {
|
|
5253
|
+
quoted.push({
|
|
5254
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
5255
|
+
index,
|
|
5256
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
5257
|
+
});
|
|
5258
|
+
}
|
|
5259
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
5260
|
+
});
|
|
5261
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
5262
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
5263
|
+
const place = (name, index, tail) => {
|
|
5264
|
+
if (tail || index >= rootEnd)
|
|
5265
|
+
nested.add(name);
|
|
5266
|
+
else
|
|
5267
|
+
top.add(name);
|
|
5268
|
+
};
|
|
5269
|
+
for (const entry of quoted)
|
|
5270
|
+
place(entry.name, entry.index, entry.tail);
|
|
5271
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
5272
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
5273
|
+
for (const match of identifiers) {
|
|
5274
|
+
const [, name, trailing] = match;
|
|
5275
|
+
if (trailing || reserved.has(name))
|
|
5276
|
+
continue;
|
|
5277
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
5278
|
+
}
|
|
5279
|
+
return {
|
|
5280
|
+
top: [...top],
|
|
5281
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
5282
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
5283
|
+
};
|
|
5284
|
+
}
|
|
5285
|
+
function appearsBelowTopLevel(data, name) {
|
|
5286
|
+
let budget = 2000;
|
|
5287
|
+
const visit = (value, depth) => {
|
|
5288
|
+
if (budget-- <= 0 || depth > 4)
|
|
5289
|
+
return false;
|
|
5290
|
+
if (value === null || typeof value !== "object")
|
|
5291
|
+
return false;
|
|
5292
|
+
if (Array.isArray(value))
|
|
5293
|
+
return value.some((entry) => visit(entry, depth));
|
|
5294
|
+
const record = value;
|
|
5295
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
5296
|
+
return true;
|
|
5297
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
5298
|
+
};
|
|
5299
|
+
return visit(data, 0);
|
|
5300
|
+
}
|
|
5301
|
+
function alwaysNullKeys(records) {
|
|
5302
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
5303
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
5304
|
+
return [];
|
|
5305
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
5306
|
+
if (keys.length === 0)
|
|
5307
|
+
return [];
|
|
5308
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
5309
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
5310
|
+
}
|
|
5311
|
+
function carriesOnlyNulls(value) {
|
|
5312
|
+
if (value === null)
|
|
5313
|
+
return true;
|
|
5314
|
+
if (Array.isArray(value)) {
|
|
5315
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
5316
|
+
}
|
|
5317
|
+
if (typeof value === "object" && value !== undefined) {
|
|
5318
|
+
const values = Object.values(value);
|
|
5319
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
5320
|
+
}
|
|
5321
|
+
return false;
|
|
5322
|
+
}
|
|
5323
|
+
function nameList(names, cap2 = 12) {
|
|
5324
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
5325
|
+
const rest = names.length - shown.length;
|
|
5326
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5327
|
+
}
|
|
5328
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
5329
|
+
const present = availableFields(data);
|
|
5330
|
+
const refs = referencedFields(filter);
|
|
5331
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
5332
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5333
|
+
const count = countRecords(data);
|
|
5334
|
+
const scope = `${count} record(s)`;
|
|
5335
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5336
|
+
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" : "";
|
|
5337
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5338
|
+
let detail;
|
|
5339
|
+
let lede;
|
|
5340
|
+
if (outcome.kind === "null-elements") {
|
|
5341
|
+
lede = "returned only null values";
|
|
5342
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
5343
|
+
if (unknown.length > 0) {
|
|
5344
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5345
|
+
} else if (unchecked.length > 0) {
|
|
5346
|
+
detail = withSoundness(projected);
|
|
5347
|
+
} else {
|
|
5348
|
+
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`;
|
|
5349
|
+
}
|
|
5350
|
+
} else if (outcome.kind === "null-rows") {
|
|
5351
|
+
lede = "returned only null values";
|
|
5352
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
5353
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
5354
|
+
} else if (outcome.kind === "null-values") {
|
|
5355
|
+
lede = "returned only null values";
|
|
5356
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
5357
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
5358
|
+
if (sameSet) {
|
|
5359
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
5360
|
+
} else if (unknown.length > 0) {
|
|
5361
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
5362
|
+
} else {
|
|
5363
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
5364
|
+
}
|
|
5365
|
+
} else {
|
|
5366
|
+
lede = "returned nothing";
|
|
5367
|
+
if (unknown.length > 0) {
|
|
5368
|
+
detail = isNotAField(unknown);
|
|
5369
|
+
} else {
|
|
5370
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
5371
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
5375
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
5376
|
+
}
|
|
5377
|
+
function appendWarning(existing, note) {
|
|
5378
|
+
return existing ? `${existing} ${note}` : note;
|
|
5379
|
+
}
|
|
5380
|
+
function applyFilter(data, filter, onWarning) {
|
|
5037
5381
|
const codec = requireJmespath();
|
|
5038
5382
|
let result;
|
|
5039
5383
|
try {
|
|
@@ -5041,9 +5385,34 @@ function applyFilter(data, filter) {
|
|
|
5041
5385
|
} catch (err) {
|
|
5042
5386
|
throw new FilterEvaluationError(filter, err);
|
|
5043
5387
|
}
|
|
5044
|
-
|
|
5388
|
+
const inputCount = countRecords(data);
|
|
5389
|
+
const warn = (outcome) => {
|
|
5390
|
+
if (inputCount === 0)
|
|
5391
|
+
return;
|
|
5392
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
5393
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
5394
|
+
`);
|
|
5395
|
+
onWarning?.(note);
|
|
5396
|
+
};
|
|
5397
|
+
const warnIfAllNull = (records) => {
|
|
5398
|
+
const keys = alwaysNullKeys(records);
|
|
5399
|
+
if (keys.length > 0)
|
|
5400
|
+
warn({ kind: "null-values", keys });
|
|
5401
|
+
};
|
|
5402
|
+
if (result == null) {
|
|
5403
|
+
warn({ kind: "empty" });
|
|
5045
5404
|
return [];
|
|
5405
|
+
}
|
|
5046
5406
|
if (Array.isArray(result)) {
|
|
5407
|
+
if (result.length === 0) {
|
|
5408
|
+
warn({ kind: "empty" });
|
|
5409
|
+
} else if (result.every((entry) => entry === null)) {
|
|
5410
|
+
warn({ kind: "null-elements", count: result.length });
|
|
5411
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
5412
|
+
warn({ kind: "null-rows", count: result.length });
|
|
5413
|
+
} else {
|
|
5414
|
+
warnIfAllNull(result);
|
|
5415
|
+
}
|
|
5047
5416
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
5048
5417
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
5049
5418
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -5051,10 +5420,30 @@ function applyFilter(data, filter) {
|
|
|
5051
5420
|
}
|
|
5052
5421
|
return result;
|
|
5053
5422
|
}
|
|
5054
|
-
if (typeof result === "object")
|
|
5423
|
+
if (typeof result === "object") {
|
|
5424
|
+
warnIfAllNull([result]);
|
|
5055
5425
|
return result;
|
|
5426
|
+
}
|
|
5056
5427
|
return { Value: result };
|
|
5057
5428
|
}
|
|
5429
|
+
function filterFailureData(envelope) {
|
|
5430
|
+
const filter = getOutputFilter();
|
|
5431
|
+
const data = envelope.Data;
|
|
5432
|
+
if (!filter || data == null)
|
|
5433
|
+
return;
|
|
5434
|
+
let note;
|
|
5435
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
5436
|
+
note = n;
|
|
5437
|
+
}));
|
|
5438
|
+
if (filterError) {
|
|
5439
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
5440
|
+
return;
|
|
5441
|
+
}
|
|
5442
|
+
envelope.Data = filtered;
|
|
5443
|
+
if (note) {
|
|
5444
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5058
5447
|
function defaultErrorCodeForResult(result) {
|
|
5059
5448
|
switch (result) {
|
|
5060
5449
|
case RESULTS.AuthenticationError:
|
|
@@ -5098,7 +5487,7 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
5098
5487
|
return "server_error";
|
|
5099
5488
|
return;
|
|
5100
5489
|
}
|
|
5101
|
-
var LOCAL_PERMISSION_TEXT_PATTERN =
|
|
5490
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5102
5491
|
function defaultErrorCodeForFailure(data) {
|
|
5103
5492
|
if (data.Result === RESULTS.Failure) {
|
|
5104
5493
|
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
@@ -5137,8 +5526,14 @@ var OutputFormatter;
|
|
|
5137
5526
|
}
|
|
5138
5527
|
const filter = getOutputFilter();
|
|
5139
5528
|
if (filter) {
|
|
5140
|
-
|
|
5529
|
+
let note;
|
|
5530
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
5531
|
+
note = n;
|
|
5532
|
+
});
|
|
5141
5533
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
5534
|
+
if (note) {
|
|
5535
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
5536
|
+
}
|
|
5142
5537
|
}
|
|
5143
5538
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
5144
5539
|
}
|
|
@@ -5166,12 +5561,13 @@ var OutputFormatter;
|
|
|
5166
5561
|
delete envelope.TelemetryErrorClass;
|
|
5167
5562
|
delete envelope.TelemetryTerminalOutcome;
|
|
5168
5563
|
delete envelope.TelemetryTerminalSignal;
|
|
5564
|
+
filterFailureData(envelope);
|
|
5169
5565
|
if (!suppressTelemetry) {
|
|
5170
5566
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5567
|
+
[ErrorDimensions.Result]: data.Result,
|
|
5568
|
+
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
5569
|
+
[ErrorDimensions.Retry]: data.Retry,
|
|
5570
|
+
[ErrorDimensions.ErrorMessage]: data.Message
|
|
5175
5571
|
});
|
|
5176
5572
|
}
|
|
5177
5573
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -5214,13 +5610,20 @@ var OutputFormatter;
|
|
|
5214
5610
|
OutputFormatter.log = log;
|
|
5215
5611
|
function formatToString(data) {
|
|
5216
5612
|
const filter = getOutputFilter();
|
|
5613
|
+
const envelope = data;
|
|
5217
5614
|
if ("Data" in data && data.Data != null) {
|
|
5218
5615
|
data.Data = normalizeDataKeys(data.Data);
|
|
5219
5616
|
if (filter) {
|
|
5220
|
-
|
|
5617
|
+
let note;
|
|
5618
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
5619
|
+
note = n;
|
|
5620
|
+
}));
|
|
5621
|
+
if (note) {
|
|
5622
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5623
|
+
}
|
|
5221
5624
|
}
|
|
5222
5625
|
}
|
|
5223
|
-
const output = normalizeOutputKeys(
|
|
5626
|
+
const output = normalizeOutputKeys(envelope);
|
|
5224
5627
|
const lines = [];
|
|
5225
5628
|
const sink = getOutputSink();
|
|
5226
5629
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -5270,7 +5673,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
|
5270
5673
|
var MAX_SKILL_NAME_LENGTH = 80;
|
|
5271
5674
|
var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
5272
5675
|
function productMode(productArea, mode) {
|
|
5273
|
-
return {
|
|
5676
|
+
return { ProductArea: productArea, Mode: mode };
|
|
5274
5677
|
}
|
|
5275
5678
|
function attributionRecord(groups) {
|
|
5276
5679
|
const record = {};
|
|
@@ -5328,6 +5731,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
5328
5731
|
["rpa", "build", ["uip.rpa-legacy"]],
|
|
5329
5732
|
["conversational", "operate", ["uip.conversational"]],
|
|
5330
5733
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
5734
|
+
["coding-agents", "build", ["uip.coder"]],
|
|
5331
5735
|
["agenthub", "build", ["uip.agenthub"]],
|
|
5332
5736
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
5333
5737
|
["functions", "build", ["uip.function", "uip.functions"]],
|
|
@@ -5413,32 +5817,64 @@ function normalizeSkillName(value) {
|
|
|
5413
5817
|
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
5414
5818
|
const skillName = normalizeSkillName(skillSource);
|
|
5415
5819
|
return {
|
|
5416
|
-
...skillName ? {
|
|
5820
|
+
...skillName ? { SkillName: skillName } : {},
|
|
5417
5821
|
...getCommandProductModeAttribution(commandPath)
|
|
5418
5822
|
};
|
|
5419
5823
|
}
|
|
5824
|
+
var AGENT_SESSION_ENV = {
|
|
5825
|
+
[BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
|
|
5826
|
+
[SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
|
|
5827
|
+
[SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
|
|
5828
|
+
[SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
|
|
5829
|
+
};
|
|
5830
|
+
var MAX_TELEMETRY_TOKEN_LENGTH = 120;
|
|
5831
|
+
function sanitizeTelemetryToken(value) {
|
|
5832
|
+
return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
|
|
5833
|
+
}
|
|
5834
|
+
function buildAgentSessionTelemetry(env) {
|
|
5835
|
+
const dimensions = {};
|
|
5836
|
+
for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
|
|
5837
|
+
const value = env[variable]?.trim();
|
|
5838
|
+
if (value) {
|
|
5839
|
+
dimensions[key] = sanitizeTelemetryToken(value);
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
return dimensions;
|
|
5843
|
+
}
|
|
5420
5844
|
|
|
5421
5845
|
// ../../common/src/telemetry/command-name.ts
|
|
5422
|
-
var
|
|
5846
|
+
var TELEMETRY_NAME_ROOT = "Cli";
|
|
5847
|
+
var CLI_COMMAND_ROOT = "uip";
|
|
5848
|
+
var TELEMETRY_NAME_BARE_ACTION = "Invoke";
|
|
5423
5849
|
function commandTelemetryName(parts) {
|
|
5850
|
+
const action = vetCommandTokens(parts).map(pascalizeToken).join("");
|
|
5851
|
+
return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
|
|
5852
|
+
}
|
|
5853
|
+
function commandInvocationPath(parts) {
|
|
5854
|
+
return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
|
|
5855
|
+
}
|
|
5856
|
+
function vetCommandTokens(parts) {
|
|
5424
5857
|
const tokens = [];
|
|
5425
5858
|
for (const part of parts) {
|
|
5426
|
-
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !==
|
|
5859
|
+
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
|
|
5427
5860
|
if (pieces.every(isCommandToken)) {
|
|
5428
5861
|
tokens.push(...pieces);
|
|
5429
5862
|
continue;
|
|
5430
5863
|
}
|
|
5431
5864
|
tokens.push(UNKNOWN_TOKEN);
|
|
5432
5865
|
}
|
|
5433
|
-
return
|
|
5866
|
+
return tokens;
|
|
5867
|
+
}
|
|
5868
|
+
function pascalizeToken(token) {
|
|
5869
|
+
return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
5434
5870
|
}
|
|
5435
|
-
var COMMAND_TOKEN_PATTERN = /^[a-
|
|
5871
|
+
var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
5436
5872
|
var MAX_COMMAND_TOKEN_LENGTH = 32;
|
|
5437
5873
|
var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
5438
5874
|
function isCommandToken(token) {
|
|
5439
|
-
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token)
|
|
5875
|
+
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
|
|
5440
5876
|
}
|
|
5441
|
-
var UNKNOWN_TOKEN = "
|
|
5877
|
+
var UNKNOWN_TOKEN = "unknown";
|
|
5442
5878
|
|
|
5443
5879
|
// ../../common/src/telemetry/invocation-request.ts
|
|
5444
5880
|
var requestContextSlot = singleton("TelemetryInvocationRequestContext");
|
|
@@ -5543,7 +5979,7 @@ function withheldArgumentValues(cmd) {
|
|
|
5543
5979
|
});
|
|
5544
5980
|
return values;
|
|
5545
5981
|
}
|
|
5546
|
-
function
|
|
5982
|
+
function deriveCommandParts(cmd) {
|
|
5547
5983
|
const parts = [];
|
|
5548
5984
|
let current = cmd;
|
|
5549
5985
|
while (current) {
|
|
@@ -5556,14 +5992,13 @@ function deriveCommandPath(cmd) {
|
|
|
5556
5992
|
if (parts.length > 1) {
|
|
5557
5993
|
parts.shift();
|
|
5558
5994
|
}
|
|
5559
|
-
return
|
|
5995
|
+
return parts;
|
|
5560
5996
|
}
|
|
5561
5997
|
function isErrorContext(value) {
|
|
5562
5998
|
return value !== null && typeof value === "object";
|
|
5563
5999
|
}
|
|
5564
6000
|
function commandHelpHint(commandPath) {
|
|
5565
|
-
|
|
5566
|
-
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
6001
|
+
return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5567
6002
|
}
|
|
5568
6003
|
function isPromptCancellation(error) {
|
|
5569
6004
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
@@ -5588,7 +6023,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5588
6023
|
yaml: getOutputFormat() === "yaml",
|
|
5589
6024
|
filter: getOutputFilter() !== undefined
|
|
5590
6025
|
});
|
|
5591
|
-
const
|
|
6026
|
+
const commandParts = deriveCommandParts(command);
|
|
6027
|
+
const telemetryName = commandTelemetryName(commandParts);
|
|
6028
|
+
const commandPath = commandInvocationPath(commandParts);
|
|
5592
6029
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
5593
6030
|
markCommandStart();
|
|
5594
6031
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
@@ -5623,7 +6060,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5623
6060
|
Result: finalResult,
|
|
5624
6061
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
5625
6062
|
Message: errorMessage,
|
|
5626
|
-
Instructions: customInstructions ?? commandHelpHint(
|
|
6063
|
+
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
5627
6064
|
...customRetry ? { Retry: customRetry } : {},
|
|
5628
6065
|
...customContext ? { Context: customContext } : {}
|
|
5629
6066
|
});
|
|
@@ -5640,8 +6077,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5640
6077
|
recordedFailure,
|
|
5641
6078
|
pollSignal: context.pollSignal
|
|
5642
6079
|
});
|
|
5643
|
-
if (terminalTelemetry.
|
|
5644
|
-
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), {
|
|
6080
|
+
if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
|
|
6081
|
+
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
|
|
5645
6082
|
}
|
|
5646
6083
|
const commandParams = extractCommandParams(command);
|
|
5647
6084
|
if (props) {
|
|
@@ -5652,10 +6089,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5652
6089
|
const baseProperties = redactProperties({
|
|
5653
6090
|
...commandParams,
|
|
5654
6091
|
...props,
|
|
5655
|
-
...buildCommandTelemetryAttribution(
|
|
5656
|
-
|
|
6092
|
+
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6093
|
+
...buildAgentSessionTelemetry(process.env),
|
|
6094
|
+
[CommandDimensions.CommandName]: commandPath,
|
|
6095
|
+
[CommandDimensions.IsCommand]: "true",
|
|
5657
6096
|
...terminalTelemetry,
|
|
5658
|
-
...errorMessage ? { errorMessage } : {}
|
|
6097
|
+
...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
|
|
5659
6098
|
});
|
|
5660
6099
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5661
6100
|
} finally {
|
|
@@ -5886,6 +6325,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
|
|
|
5886
6325
|
// ../../common/src/interactivity-context.ts
|
|
5887
6326
|
var modeSlot = singleton("InteractivityMode");
|
|
5888
6327
|
var interactiveFlagSlot = singleton("InteractiveFlag");
|
|
6328
|
+
// ../../common/src/mime-types.ts
|
|
6329
|
+
var MIME_TYPES_BY_EXTENSION = Object.freeze({
|
|
6330
|
+
pdf: "application/pdf",
|
|
6331
|
+
png: "image/png",
|
|
6332
|
+
jpg: "image/jpeg",
|
|
6333
|
+
jpeg: "image/jpeg",
|
|
6334
|
+
gif: "image/gif",
|
|
6335
|
+
webp: "image/webp",
|
|
6336
|
+
bmp: "image/bmp",
|
|
6337
|
+
tif: "image/tiff",
|
|
6338
|
+
tiff: "image/tiff",
|
|
6339
|
+
svg: "image/svg+xml",
|
|
6340
|
+
txt: "text/plain",
|
|
6341
|
+
log: "text/plain",
|
|
6342
|
+
md: "text/markdown",
|
|
6343
|
+
csv: "text/csv",
|
|
6344
|
+
tsv: "text/tab-separated-values",
|
|
6345
|
+
json: "application/json",
|
|
6346
|
+
xml: "application/xml",
|
|
6347
|
+
html: "text/html",
|
|
6348
|
+
htm: "text/html",
|
|
6349
|
+
yaml: "application/yaml",
|
|
6350
|
+
yml: "application/yaml",
|
|
6351
|
+
doc: "application/msword",
|
|
6352
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
6353
|
+
xls: "application/vnd.ms-excel",
|
|
6354
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
6355
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
6356
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
6357
|
+
zip: "application/zip",
|
|
6358
|
+
mp3: "audio/mpeg",
|
|
6359
|
+
wav: "audio/wav",
|
|
6360
|
+
mp4: "video/mp4"
|
|
6361
|
+
});
|
|
5889
6362
|
// ../../common/src/polling/types.ts
|
|
5890
6363
|
var PollOutcome = {
|
|
5891
6364
|
Completed: "completed",
|
|
@@ -5930,63 +6403,13 @@ var ScreenLogger;
|
|
|
5930
6403
|
ScreenLogger.progress = progress;
|
|
5931
6404
|
})(ScreenLogger ||= {});
|
|
5932
6405
|
// ../../common/src/sdk-user-agent.ts
|
|
6406
|
+
var AGENT_PROPERTY = BaseDimensions.Agent;
|
|
5933
6407
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
5934
6408
|
// ../../common/src/telemetry/ship-succeeded.ts
|
|
5935
6409
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
5936
6410
|
// ../../common/src/tool-provider.ts
|
|
5937
6411
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
5938
|
-
//
|
|
5939
|
-
import { createRequire } from "node:module";
|
|
5940
|
-
import fs2 from "node:fs";
|
|
5941
|
-
import fs22 from "node:fs";
|
|
5942
|
-
import process2 from "node:process";
|
|
5943
|
-
import os2 from "node:os";
|
|
5944
|
-
import fs3 from "node:fs";
|
|
5945
|
-
import process3 from "node:process";
|
|
5946
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
5947
|
-
import { promisify } from "node:util";
|
|
5948
|
-
import childProcess from "node:child_process";
|
|
5949
|
-
import { promisify as promisify2 } from "node:util";
|
|
5950
|
-
import childProcess2 from "node:child_process";
|
|
5951
|
-
import fs4, { constants as fsConstants } from "node:fs/promises";
|
|
5952
|
-
import { promisify as promisify3 } from "node:util";
|
|
5953
|
-
import process4 from "node:process";
|
|
5954
|
-
import { execFile as execFile3 } from "node:child_process";
|
|
5955
|
-
import process5 from "node:process";
|
|
5956
|
-
import { promisify as promisify4 } from "node:util";
|
|
5957
|
-
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
5958
|
-
import { promisify as promisify5 } from "node:util";
|
|
5959
|
-
import { execFile as execFile5 } from "node:child_process";
|
|
5960
|
-
import { promisify as promisify6 } from "node:util";
|
|
5961
|
-
import process6 from "node:process";
|
|
5962
|
-
import { execFile as execFile6 } from "node:child_process";
|
|
5963
|
-
import process7 from "node:process";
|
|
5964
|
-
import process8 from "node:process";
|
|
5965
|
-
import path2 from "node:path";
|
|
5966
|
-
import { fileURLToPath } from "node:url";
|
|
5967
|
-
import childProcess3 from "node:child_process";
|
|
5968
|
-
import fs5, { constants as fsConstants2 } from "node:fs/promises";
|
|
5969
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
5970
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
5971
|
-
import * as fs6 from "node:fs/promises";
|
|
5972
|
-
import * as os22 from "node:os";
|
|
5973
|
-
import * as path22 from "node:path";
|
|
5974
|
-
var __defProp = Object.defineProperty;
|
|
5975
|
-
var __returnValue = (v) => v;
|
|
5976
|
-
function __exportSetter(name, newValue) {
|
|
5977
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5978
|
-
}
|
|
5979
|
-
var __export = (target, all) => {
|
|
5980
|
-
for (var name in all)
|
|
5981
|
-
__defProp(target, name, {
|
|
5982
|
-
get: all[name],
|
|
5983
|
-
enumerable: true,
|
|
5984
|
-
configurable: true,
|
|
5985
|
-
set: __exportSetter.bind(all, name)
|
|
5986
|
-
});
|
|
5987
|
-
};
|
|
5988
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
5989
|
-
var __require2 = /* @__PURE__ */ createRequire(import.meta.url);
|
|
6412
|
+
// ../../auth/src/catch-error.ts
|
|
5990
6413
|
function isPromiseLike2(value) {
|
|
5991
6414
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
5992
6415
|
}
|
|
@@ -6013,915 +6436,62 @@ function settlePromiseLike2(thenable) {
|
|
|
6013
6436
|
undefined
|
|
6014
6437
|
]);
|
|
6015
6438
|
}
|
|
6439
|
+
|
|
6440
|
+
// ../../auth/src/constants.ts
|
|
6016
6441
|
var UIPATH_HOME_DIR = ".uipath";
|
|
6017
6442
|
var AUTH_FILENAME = ".auth";
|
|
6018
6443
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
6019
|
-
var DEFAULT_AUTH_TIMEOUT_MS2;
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
}
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
if (isDockerCached === undefined) {
|
|
6043
|
-
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
6444
|
+
var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
6445
|
+
|
|
6446
|
+
// ../../auth/src/config.ts
|
|
6447
|
+
var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
|
|
6448
|
+
var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
|
|
6449
|
+
var globalSlot = globalThis;
|
|
6450
|
+
var getAuthFileConfig = () => globalSlot[AUTH_FILE_CONFIG_KEY] ?? {};
|
|
6451
|
+
|
|
6452
|
+
class InvalidBaseUrlError extends Error {
|
|
6453
|
+
url;
|
|
6454
|
+
reason;
|
|
6455
|
+
constructor(url, reason) {
|
|
6456
|
+
super(`Invalid base URL: "${url}"
|
|
6457
|
+
` + `Reason: ${reason}
|
|
6458
|
+
|
|
6459
|
+
` + `Expected format: an https:// URL (or bare host — https:// is assumed), e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
|
|
6460
|
+
` + `You can specify the URL via:
|
|
6461
|
+
` + ` • --authority flag
|
|
6462
|
+
` + ` • UIPATH_URL environment variable
|
|
6463
|
+
` + ` • auth.authority in config file`);
|
|
6464
|
+
this.url = url;
|
|
6465
|
+
this.reason = reason;
|
|
6466
|
+
this.name = "InvalidBaseUrlError";
|
|
6044
6467
|
}
|
|
6045
|
-
return isDockerCached;
|
|
6046
6468
|
}
|
|
6047
|
-
var
|
|
6048
|
-
var
|
|
6049
|
-
|
|
6050
|
-
if (
|
|
6051
|
-
|
|
6469
|
+
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
6470
|
+
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
6471
|
+
let baseUrl = rawUrl;
|
|
6472
|
+
if (baseUrl.endsWith("/identity_/")) {
|
|
6473
|
+
baseUrl = baseUrl.slice(0, -11);
|
|
6474
|
+
} else if (baseUrl.endsWith("/identity_")) {
|
|
6475
|
+
baseUrl = baseUrl.slice(0, -10);
|
|
6052
6476
|
}
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
var cachedResult;
|
|
6056
|
-
var hasContainerEnv = () => {
|
|
6057
|
-
try {
|
|
6058
|
-
fs22.statSync("/run/.containerenv");
|
|
6059
|
-
return true;
|
|
6060
|
-
} catch {
|
|
6061
|
-
return false;
|
|
6477
|
+
while (baseUrl.endsWith("/")) {
|
|
6478
|
+
baseUrl = baseUrl.slice(0, -1);
|
|
6062
6479
|
}
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
}
|
|
6067
|
-
var isWsl = () => {
|
|
6068
|
-
if (process2.platform !== "linux") {
|
|
6069
|
-
return false;
|
|
6480
|
+
const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
|
|
6481
|
+
const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
|
|
6482
|
+
if (!hasScheme && hostCandidate.includes(".")) {
|
|
6483
|
+
baseUrl = `https://${baseUrl}`;
|
|
6070
6484
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
}
|
|
6075
|
-
|
|
6485
|
+
const resolvedBaseUrl = baseUrl;
|
|
6486
|
+
const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
|
|
6487
|
+
if (urlError) {
|
|
6488
|
+
const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
|
|
6489
|
+
throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
|
|
6076
6490
|
}
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
return !isInsideContainer();
|
|
6080
|
-
}
|
|
6081
|
-
} catch {}
|
|
6082
|
-
if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
|
|
6083
|
-
return !isInsideContainer();
|
|
6491
|
+
if (url.protocol !== "https:") {
|
|
6492
|
+
throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
|
|
6084
6493
|
}
|
|
6085
|
-
return
|
|
6086
|
-
};
|
|
6087
|
-
var is_wsl_default;
|
|
6088
|
-
var init_is_wsl = __esm(() => {
|
|
6089
|
-
init_is_inside_container();
|
|
6090
|
-
is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
6091
|
-
});
|
|
6092
|
-
var execFile;
|
|
6093
|
-
var powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
6094
|
-
var executePowerShell = async (command, options = {}) => {
|
|
6095
|
-
const {
|
|
6096
|
-
powerShellPath: psPath,
|
|
6097
|
-
...execFileOptions
|
|
6098
|
-
} = options;
|
|
6099
|
-
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
6100
|
-
return execFile(psPath ?? powerShellPath(), [
|
|
6101
|
-
...executePowerShell.argumentsPrefix,
|
|
6102
|
-
encodedCommand
|
|
6103
|
-
], {
|
|
6104
|
-
encoding: "utf8",
|
|
6105
|
-
...execFileOptions
|
|
6106
|
-
});
|
|
6107
|
-
};
|
|
6108
|
-
var init_powershell_utils = __esm(() => {
|
|
6109
|
-
execFile = promisify(childProcess.execFile);
|
|
6110
|
-
executePowerShell.argumentsPrefix = [
|
|
6111
|
-
"-NoProfile",
|
|
6112
|
-
"-NonInteractive",
|
|
6113
|
-
"-ExecutionPolicy",
|
|
6114
|
-
"Bypass",
|
|
6115
|
-
"-EncodedCommand"
|
|
6116
|
-
];
|
|
6117
|
-
executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
|
|
6118
|
-
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
6119
|
-
});
|
|
6120
|
-
function parseMountPointFromConfig(content) {
|
|
6121
|
-
for (const line of content.split(`
|
|
6122
|
-
`)) {
|
|
6123
|
-
if (/^\s*#/.test(line)) {
|
|
6124
|
-
continue;
|
|
6125
|
-
}
|
|
6126
|
-
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
6127
|
-
if (!match) {
|
|
6128
|
-
continue;
|
|
6129
|
-
}
|
|
6130
|
-
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
6131
|
-
}
|
|
6132
|
-
}
|
|
6133
|
-
var execFile2;
|
|
6134
|
-
var wslDrivesMountPoint;
|
|
6135
|
-
var powerShellPathFromWsl = async () => {
|
|
6136
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
6137
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
6138
|
-
};
|
|
6139
|
-
var powerShellPath2;
|
|
6140
|
-
var canAccessPowerShellPromise;
|
|
6141
|
-
var canAccessPowerShell = async () => {
|
|
6142
|
-
canAccessPowerShellPromise ??= (async () => {
|
|
6143
|
-
try {
|
|
6144
|
-
const psPath = await powerShellPath2();
|
|
6145
|
-
await fs4.access(psPath, fsConstants.X_OK);
|
|
6146
|
-
return true;
|
|
6147
|
-
} catch {
|
|
6148
|
-
return false;
|
|
6149
|
-
}
|
|
6150
|
-
})();
|
|
6151
|
-
return canAccessPowerShellPromise;
|
|
6152
|
-
};
|
|
6153
|
-
var wslDefaultBrowser = async () => {
|
|
6154
|
-
const psPath = await powerShellPath2();
|
|
6155
|
-
const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
6156
|
-
const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
|
|
6157
|
-
return stdout.trim();
|
|
6158
|
-
};
|
|
6159
|
-
var convertWslPathToWindows = async (path3) => {
|
|
6160
|
-
if (/^[a-z]+:\/\//i.test(path3)) {
|
|
6161
|
-
return path3;
|
|
6162
|
-
}
|
|
6163
|
-
try {
|
|
6164
|
-
const { stdout } = await execFile2("wslpath", ["-aw", path3], { encoding: "utf8" });
|
|
6165
|
-
return stdout.trim();
|
|
6166
|
-
} catch {
|
|
6167
|
-
return path3;
|
|
6168
|
-
}
|
|
6169
|
-
};
|
|
6170
|
-
var init_wsl_utils = __esm(() => {
|
|
6171
|
-
init_is_wsl();
|
|
6172
|
-
init_powershell_utils();
|
|
6173
|
-
init_is_wsl();
|
|
6174
|
-
execFile2 = promisify2(childProcess2.execFile);
|
|
6175
|
-
wslDrivesMountPoint = (() => {
|
|
6176
|
-
const defaultMountPoint = "/mnt/";
|
|
6177
|
-
let mountPoint;
|
|
6178
|
-
return async function() {
|
|
6179
|
-
if (mountPoint) {
|
|
6180
|
-
return mountPoint;
|
|
6181
|
-
}
|
|
6182
|
-
const configFilePath = "/etc/wsl.conf";
|
|
6183
|
-
let isConfigFileExists = false;
|
|
6184
|
-
try {
|
|
6185
|
-
await fs4.access(configFilePath, fsConstants.F_OK);
|
|
6186
|
-
isConfigFileExists = true;
|
|
6187
|
-
} catch {}
|
|
6188
|
-
if (!isConfigFileExists) {
|
|
6189
|
-
return defaultMountPoint;
|
|
6190
|
-
}
|
|
6191
|
-
const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
|
|
6192
|
-
const parsedMountPoint = parseMountPointFromConfig(configContent);
|
|
6193
|
-
if (parsedMountPoint === undefined) {
|
|
6194
|
-
return defaultMountPoint;
|
|
6195
|
-
}
|
|
6196
|
-
mountPoint = parsedMountPoint;
|
|
6197
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
6198
|
-
return mountPoint;
|
|
6199
|
-
};
|
|
6200
|
-
})();
|
|
6201
|
-
powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
|
|
6202
|
-
});
|
|
6203
|
-
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
6204
|
-
const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
6205
|
-
Object.defineProperty(object, propertyName, {
|
|
6206
|
-
configurable: true,
|
|
6207
|
-
enumerable: true,
|
|
6208
|
-
get() {
|
|
6209
|
-
const result = valueGetter();
|
|
6210
|
-
define(result);
|
|
6211
|
-
return result;
|
|
6212
|
-
},
|
|
6213
|
-
set(value) {
|
|
6214
|
-
define(value);
|
|
6215
|
-
}
|
|
6216
|
-
});
|
|
6217
|
-
return object;
|
|
6218
|
-
}
|
|
6219
|
-
async function defaultBrowserId() {
|
|
6220
|
-
if (process4.platform !== "darwin") {
|
|
6221
|
-
throw new Error("macOS only");
|
|
6222
|
-
}
|
|
6223
|
-
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
6224
|
-
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
6225
|
-
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
6226
|
-
if (browserId === "com.apple.safari") {
|
|
6227
|
-
return "com.apple.Safari";
|
|
6228
|
-
}
|
|
6229
|
-
return browserId;
|
|
6230
|
-
}
|
|
6231
|
-
var execFileAsync;
|
|
6232
|
-
var init_default_browser_id = __esm(() => {
|
|
6233
|
-
execFileAsync = promisify3(execFile3);
|
|
6234
|
-
});
|
|
6235
|
-
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
6236
|
-
if (process5.platform !== "darwin") {
|
|
6237
|
-
throw new Error("macOS only");
|
|
6238
|
-
}
|
|
6239
|
-
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
6240
|
-
const execOptions = {};
|
|
6241
|
-
if (signal) {
|
|
6242
|
-
execOptions.signal = signal;
|
|
6243
|
-
}
|
|
6244
|
-
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
6245
|
-
return stdout.trim();
|
|
6246
|
-
}
|
|
6247
|
-
var execFileAsync2;
|
|
6248
|
-
var init_run_applescript = __esm(() => {
|
|
6249
|
-
execFileAsync2 = promisify4(execFile4);
|
|
6250
|
-
});
|
|
6251
|
-
async function bundleName(bundleId) {
|
|
6252
|
-
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
6253
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
6254
|
-
}
|
|
6255
|
-
var init_bundle_name = __esm(() => {
|
|
6256
|
-
init_run_applescript();
|
|
6257
|
-
});
|
|
6258
|
-
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
6259
|
-
const { stdout } = await _execFileAsync("reg", [
|
|
6260
|
-
"QUERY",
|
|
6261
|
-
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
6262
|
-
"/v",
|
|
6263
|
-
"ProgId"
|
|
6264
|
-
]);
|
|
6265
|
-
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
6266
|
-
if (!match) {
|
|
6267
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
6268
|
-
}
|
|
6269
|
-
const { id } = match.groups;
|
|
6270
|
-
const dotIndex = id.lastIndexOf(".");
|
|
6271
|
-
const hyphenIndex = id.lastIndexOf("-");
|
|
6272
|
-
const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
|
|
6273
|
-
const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
|
|
6274
|
-
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
6275
|
-
}
|
|
6276
|
-
var execFileAsync3;
|
|
6277
|
-
var windowsBrowserProgIds;
|
|
6278
|
-
var _windowsBrowserProgIdMap;
|
|
6279
|
-
var UnknownBrowserError;
|
|
6280
|
-
var init_windows = __esm(() => {
|
|
6281
|
-
execFileAsync3 = promisify5(execFile5);
|
|
6282
|
-
windowsBrowserProgIds = {
|
|
6283
|
-
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
6284
|
-
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
6285
|
-
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
6286
|
-
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
6287
|
-
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
6288
|
-
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
6289
|
-
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
6290
|
-
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
6291
|
-
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
6292
|
-
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
6293
|
-
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
6294
|
-
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
6295
|
-
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
6296
|
-
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
6297
|
-
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
6298
|
-
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
6299
|
-
};
|
|
6300
|
-
_windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
6301
|
-
UnknownBrowserError = class UnknownBrowserError2 extends Error {
|
|
6302
|
-
};
|
|
6303
|
-
});
|
|
6304
|
-
async function defaultBrowser2() {
|
|
6305
|
-
if (process6.platform === "darwin") {
|
|
6306
|
-
const id = await defaultBrowserId();
|
|
6307
|
-
const name = await bundleName(id);
|
|
6308
|
-
return { name, id };
|
|
6309
|
-
}
|
|
6310
|
-
if (process6.platform === "linux") {
|
|
6311
|
-
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
6312
|
-
const id = stdout.trim();
|
|
6313
|
-
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
6314
|
-
return { name, id };
|
|
6315
|
-
}
|
|
6316
|
-
if (process6.platform === "win32") {
|
|
6317
|
-
return defaultBrowser();
|
|
6318
|
-
}
|
|
6319
|
-
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
6320
|
-
}
|
|
6321
|
-
var execFileAsync4;
|
|
6322
|
-
var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
6323
|
-
var init_default_browser = __esm(() => {
|
|
6324
|
-
init_default_browser_id();
|
|
6325
|
-
init_bundle_name();
|
|
6326
|
-
init_windows();
|
|
6327
|
-
init_windows();
|
|
6328
|
-
execFileAsync4 = promisify6(execFile6);
|
|
6329
|
-
});
|
|
6330
|
-
var isInSsh;
|
|
6331
|
-
var is_in_ssh_default;
|
|
6332
|
-
var init_is_in_ssh = __esm(() => {
|
|
6333
|
-
isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
|
|
6334
|
-
is_in_ssh_default = isInSsh;
|
|
6335
|
-
});
|
|
6336
|
-
var exports_open = {};
|
|
6337
|
-
__export(exports_open, {
|
|
6338
|
-
apps: () => apps,
|
|
6339
|
-
default: () => open_default,
|
|
6340
|
-
openApp: () => openApp
|
|
6341
|
-
});
|
|
6342
|
-
function detectArchBinary(binary) {
|
|
6343
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
6344
|
-
return binary;
|
|
6345
|
-
}
|
|
6346
|
-
const { [arch]: archBinary } = binary;
|
|
6347
|
-
if (!archBinary) {
|
|
6348
|
-
throw new Error(`${arch} is not supported`);
|
|
6349
|
-
}
|
|
6350
|
-
return archBinary;
|
|
6351
|
-
}
|
|
6352
|
-
function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
|
|
6353
|
-
if (wsl && is_wsl_default) {
|
|
6354
|
-
return detectArchBinary(wsl);
|
|
6355
|
-
}
|
|
6356
|
-
if (!platformBinary) {
|
|
6357
|
-
throw new Error(`${platform} is not supported`);
|
|
6358
|
-
}
|
|
6359
|
-
return detectArchBinary(platformBinary);
|
|
6360
|
-
}
|
|
6361
|
-
var fallbackAttemptSymbol;
|
|
6362
|
-
var __dirname2;
|
|
6363
|
-
var localXdgOpenPath;
|
|
6364
|
-
var platform;
|
|
6365
|
-
var arch;
|
|
6366
|
-
var tryEachApp = async (apps, opener) => {
|
|
6367
|
-
if (apps.length === 0) {
|
|
6368
|
-
return;
|
|
6369
|
-
}
|
|
6370
|
-
const errors = [];
|
|
6371
|
-
for (const app of apps) {
|
|
6372
|
-
try {
|
|
6373
|
-
return await opener(app);
|
|
6374
|
-
} catch (error) {
|
|
6375
|
-
errors.push(error);
|
|
6376
|
-
}
|
|
6377
|
-
}
|
|
6378
|
-
throw new AggregateError(errors, "Failed to open in all supported apps");
|
|
6379
|
-
};
|
|
6380
|
-
var baseOpen = async (options) => {
|
|
6381
|
-
options = {
|
|
6382
|
-
wait: false,
|
|
6383
|
-
background: false,
|
|
6384
|
-
newInstance: false,
|
|
6385
|
-
allowNonzeroExitCode: false,
|
|
6386
|
-
...options
|
|
6387
|
-
};
|
|
6388
|
-
const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
|
|
6389
|
-
delete options[fallbackAttemptSymbol];
|
|
6390
|
-
if (Array.isArray(options.app)) {
|
|
6391
|
-
return tryEachApp(options.app, (singleApp) => baseOpen({
|
|
6392
|
-
...options,
|
|
6393
|
-
app: singleApp,
|
|
6394
|
-
[fallbackAttemptSymbol]: true
|
|
6395
|
-
}));
|
|
6396
|
-
}
|
|
6397
|
-
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
6398
|
-
appArguments = [...appArguments];
|
|
6399
|
-
if (Array.isArray(app)) {
|
|
6400
|
-
return tryEachApp(app, (appName) => baseOpen({
|
|
6401
|
-
...options,
|
|
6402
|
-
app: {
|
|
6403
|
-
name: appName,
|
|
6404
|
-
arguments: appArguments
|
|
6405
|
-
},
|
|
6406
|
-
[fallbackAttemptSymbol]: true
|
|
6407
|
-
}));
|
|
6408
|
-
}
|
|
6409
|
-
if (app === "browser" || app === "browserPrivate") {
|
|
6410
|
-
const ids = {
|
|
6411
|
-
"com.google.chrome": "chrome",
|
|
6412
|
-
"google-chrome.desktop": "chrome",
|
|
6413
|
-
"com.brave.browser": "brave",
|
|
6414
|
-
"org.mozilla.firefox": "firefox",
|
|
6415
|
-
"firefox.desktop": "firefox",
|
|
6416
|
-
"com.microsoft.msedge": "edge",
|
|
6417
|
-
"com.microsoft.edge": "edge",
|
|
6418
|
-
"com.microsoft.edgemac": "edge",
|
|
6419
|
-
"microsoft-edge.desktop": "edge",
|
|
6420
|
-
"com.apple.safari": "safari"
|
|
6421
|
-
};
|
|
6422
|
-
const flags = {
|
|
6423
|
-
chrome: "--incognito",
|
|
6424
|
-
brave: "--incognito",
|
|
6425
|
-
firefox: "--private-window",
|
|
6426
|
-
edge: "--inPrivate"
|
|
6427
|
-
};
|
|
6428
|
-
let browser;
|
|
6429
|
-
if (is_wsl_default) {
|
|
6430
|
-
const progId = await wslDefaultBrowser();
|
|
6431
|
-
const browserInfo = _windowsBrowserProgIdMap.get(progId);
|
|
6432
|
-
browser = browserInfo ?? {};
|
|
6433
|
-
} else {
|
|
6434
|
-
browser = await defaultBrowser2();
|
|
6435
|
-
}
|
|
6436
|
-
if (browser.id in ids) {
|
|
6437
|
-
const browserName = ids[browser.id.toLowerCase()];
|
|
6438
|
-
if (app === "browserPrivate") {
|
|
6439
|
-
if (browserName === "safari") {
|
|
6440
|
-
throw new Error("Safari doesn't support opening in private mode via command line");
|
|
6441
|
-
}
|
|
6442
|
-
appArguments.push(flags[browserName]);
|
|
6443
|
-
}
|
|
6444
|
-
return baseOpen({
|
|
6445
|
-
...options,
|
|
6446
|
-
app: {
|
|
6447
|
-
name: apps[browserName],
|
|
6448
|
-
arguments: appArguments
|
|
6449
|
-
}
|
|
6450
|
-
});
|
|
6451
|
-
}
|
|
6452
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
6453
|
-
}
|
|
6454
|
-
let command;
|
|
6455
|
-
const cliArguments = [];
|
|
6456
|
-
const childProcessOptions = {};
|
|
6457
|
-
let shouldUseWindowsInWsl = false;
|
|
6458
|
-
if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
|
|
6459
|
-
shouldUseWindowsInWsl = await canAccessPowerShell();
|
|
6460
|
-
}
|
|
6461
|
-
if (platform === "darwin") {
|
|
6462
|
-
command = "open";
|
|
6463
|
-
if (options.wait) {
|
|
6464
|
-
cliArguments.push("--wait-apps");
|
|
6465
|
-
}
|
|
6466
|
-
if (options.background) {
|
|
6467
|
-
cliArguments.push("--background");
|
|
6468
|
-
}
|
|
6469
|
-
if (options.newInstance) {
|
|
6470
|
-
cliArguments.push("--new");
|
|
6471
|
-
}
|
|
6472
|
-
if (app) {
|
|
6473
|
-
cliArguments.push("-a", app);
|
|
6474
|
-
}
|
|
6475
|
-
} else if (platform === "win32" || shouldUseWindowsInWsl) {
|
|
6476
|
-
command = await powerShellPath2();
|
|
6477
|
-
cliArguments.push(...executePowerShell.argumentsPrefix);
|
|
6478
|
-
if (!is_wsl_default) {
|
|
6479
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
6480
|
-
}
|
|
6481
|
-
if (is_wsl_default && options.target) {
|
|
6482
|
-
options.target = await convertWslPathToWindows(options.target);
|
|
6483
|
-
}
|
|
6484
|
-
const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
|
|
6485
|
-
if (options.wait) {
|
|
6486
|
-
encodedArguments.push("-Wait");
|
|
6487
|
-
}
|
|
6488
|
-
if (app) {
|
|
6489
|
-
encodedArguments.push(executePowerShell.escapeArgument(app));
|
|
6490
|
-
if (options.target) {
|
|
6491
|
-
appArguments.push(options.target);
|
|
6492
|
-
}
|
|
6493
|
-
} else if (options.target) {
|
|
6494
|
-
encodedArguments.push(executePowerShell.escapeArgument(options.target));
|
|
6495
|
-
}
|
|
6496
|
-
if (appArguments.length > 0) {
|
|
6497
|
-
appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
|
|
6498
|
-
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
6499
|
-
}
|
|
6500
|
-
options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
|
|
6501
|
-
if (!options.wait) {
|
|
6502
|
-
childProcessOptions.stdio = "ignore";
|
|
6503
|
-
}
|
|
6504
|
-
} else {
|
|
6505
|
-
if (app) {
|
|
6506
|
-
command = app;
|
|
6507
|
-
} else {
|
|
6508
|
-
const isBundled = !__dirname2 || __dirname2 === "/";
|
|
6509
|
-
let exeLocalXdgOpen = false;
|
|
6510
|
-
try {
|
|
6511
|
-
await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
|
|
6512
|
-
exeLocalXdgOpen = true;
|
|
6513
|
-
} catch {}
|
|
6514
|
-
const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
6515
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
6516
|
-
}
|
|
6517
|
-
if (appArguments.length > 0) {
|
|
6518
|
-
cliArguments.push(...appArguments);
|
|
6519
|
-
}
|
|
6520
|
-
if (!options.wait) {
|
|
6521
|
-
childProcessOptions.stdio = "ignore";
|
|
6522
|
-
childProcessOptions.detached = true;
|
|
6523
|
-
}
|
|
6524
|
-
}
|
|
6525
|
-
if (platform === "darwin" && appArguments.length > 0) {
|
|
6526
|
-
cliArguments.push("--args", ...appArguments);
|
|
6527
|
-
}
|
|
6528
|
-
if (options.target) {
|
|
6529
|
-
cliArguments.push(options.target);
|
|
6530
|
-
}
|
|
6531
|
-
const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
|
|
6532
|
-
if (options.wait) {
|
|
6533
|
-
return new Promise((resolve3, reject) => {
|
|
6534
|
-
subprocess.once("error", reject);
|
|
6535
|
-
subprocess.once("close", (exitCode) => {
|
|
6536
|
-
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
6537
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
6538
|
-
return;
|
|
6539
|
-
}
|
|
6540
|
-
resolve3(subprocess);
|
|
6541
|
-
});
|
|
6542
|
-
});
|
|
6543
|
-
}
|
|
6544
|
-
if (isFallbackAttempt) {
|
|
6545
|
-
return new Promise((resolve3, reject) => {
|
|
6546
|
-
subprocess.once("error", reject);
|
|
6547
|
-
subprocess.once("spawn", () => {
|
|
6548
|
-
subprocess.once("close", (exitCode) => {
|
|
6549
|
-
subprocess.off("error", reject);
|
|
6550
|
-
if (exitCode !== 0) {
|
|
6551
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
6552
|
-
return;
|
|
6553
|
-
}
|
|
6554
|
-
subprocess.unref();
|
|
6555
|
-
resolve3(subprocess);
|
|
6556
|
-
});
|
|
6557
|
-
});
|
|
6558
|
-
});
|
|
6559
|
-
}
|
|
6560
|
-
subprocess.unref();
|
|
6561
|
-
return new Promise((resolve3, reject) => {
|
|
6562
|
-
subprocess.once("error", reject);
|
|
6563
|
-
subprocess.once("spawn", () => {
|
|
6564
|
-
subprocess.off("error", reject);
|
|
6565
|
-
resolve3(subprocess);
|
|
6566
|
-
});
|
|
6567
|
-
});
|
|
6568
|
-
};
|
|
6569
|
-
var open = (target, options) => {
|
|
6570
|
-
if (typeof target !== "string") {
|
|
6571
|
-
throw new TypeError("Expected a `target`");
|
|
6572
|
-
}
|
|
6573
|
-
return baseOpen({
|
|
6574
|
-
...options,
|
|
6575
|
-
target
|
|
6576
|
-
});
|
|
6577
|
-
};
|
|
6578
|
-
var openApp = (name, options) => {
|
|
6579
|
-
if (typeof name !== "string" && !Array.isArray(name)) {
|
|
6580
|
-
throw new TypeError("Expected a valid `name`");
|
|
6581
|
-
}
|
|
6582
|
-
const { arguments: appArguments = [] } = options ?? {};
|
|
6583
|
-
if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
|
|
6584
|
-
throw new TypeError("Expected `appArguments` as Array type");
|
|
6585
|
-
}
|
|
6586
|
-
return baseOpen({
|
|
6587
|
-
...options,
|
|
6588
|
-
app: {
|
|
6589
|
-
name,
|
|
6590
|
-
arguments: appArguments
|
|
6591
|
-
}
|
|
6592
|
-
});
|
|
6593
|
-
};
|
|
6594
|
-
var apps;
|
|
6595
|
-
var open_default;
|
|
6596
|
-
var init_open = __esm(() => {
|
|
6597
|
-
init_wsl_utils();
|
|
6598
|
-
init_powershell_utils();
|
|
6599
|
-
init_default_browser();
|
|
6600
|
-
init_is_inside_container();
|
|
6601
|
-
init_is_in_ssh();
|
|
6602
|
-
fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
6603
|
-
__dirname2 = import.meta.url ? path2.dirname(fileURLToPath(import.meta.url)) : "";
|
|
6604
|
-
localXdgOpenPath = path2.join(__dirname2, "xdg-open");
|
|
6605
|
-
({ platform, arch } = process8);
|
|
6606
|
-
apps = {
|
|
6607
|
-
browser: "browser",
|
|
6608
|
-
browserPrivate: "browserPrivate"
|
|
6609
|
-
};
|
|
6610
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
6611
|
-
darwin: "google chrome",
|
|
6612
|
-
win32: "chrome",
|
|
6613
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
|
|
6614
|
-
}, {
|
|
6615
|
-
wsl: {
|
|
6616
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
6617
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
6618
|
-
}
|
|
6619
|
-
}));
|
|
6620
|
-
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
6621
|
-
darwin: "brave browser",
|
|
6622
|
-
win32: "brave",
|
|
6623
|
-
linux: ["brave-browser", "brave"]
|
|
6624
|
-
}, {
|
|
6625
|
-
wsl: {
|
|
6626
|
-
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
6627
|
-
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
6628
|
-
}
|
|
6629
|
-
}));
|
|
6630
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
6631
|
-
darwin: "firefox",
|
|
6632
|
-
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
6633
|
-
linux: "firefox"
|
|
6634
|
-
}, {
|
|
6635
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
6636
|
-
}));
|
|
6637
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
6638
|
-
darwin: "microsoft edge",
|
|
6639
|
-
win32: "msedge",
|
|
6640
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
6641
|
-
}, {
|
|
6642
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
6643
|
-
}));
|
|
6644
|
-
defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
6645
|
-
darwin: "Safari"
|
|
6646
|
-
}));
|
|
6647
|
-
open_default = open;
|
|
6648
|
-
});
|
|
6649
|
-
|
|
6650
|
-
class NodeFileSystem2 {
|
|
6651
|
-
path = {
|
|
6652
|
-
join: path22.join,
|
|
6653
|
-
resolve: path22.resolve,
|
|
6654
|
-
relative: path22.relative,
|
|
6655
|
-
dirname: path22.dirname,
|
|
6656
|
-
isAbsolute: path22.isAbsolute,
|
|
6657
|
-
basename: path22.basename
|
|
6658
|
-
};
|
|
6659
|
-
env = {
|
|
6660
|
-
cwd: process.cwd,
|
|
6661
|
-
homedir: os22.homedir,
|
|
6662
|
-
tmpdir: os22.tmpdir,
|
|
6663
|
-
getenv: (key) => process.env[key]
|
|
6664
|
-
};
|
|
6665
|
-
utils = {
|
|
6666
|
-
open: async (url) => {
|
|
6667
|
-
const { default: open2 } = await Promise.resolve().then(() => (init_open(), exports_open));
|
|
6668
|
-
await open2(url);
|
|
6669
|
-
}
|
|
6670
|
-
};
|
|
6671
|
-
async readFile(path3, options) {
|
|
6672
|
-
try {
|
|
6673
|
-
if (options) {
|
|
6674
|
-
return await fs6.readFile(path3, "utf-8");
|
|
6675
|
-
}
|
|
6676
|
-
return await fs6.readFile(path3);
|
|
6677
|
-
} catch (error) {
|
|
6678
|
-
if (this.isEnoent(error))
|
|
6679
|
-
return null;
|
|
6680
|
-
throw error;
|
|
6681
|
-
}
|
|
6682
|
-
}
|
|
6683
|
-
async writeFile(filePath, data) {
|
|
6684
|
-
const dir = path22.dirname(filePath);
|
|
6685
|
-
if (dir) {
|
|
6686
|
-
await fs6.mkdir(dir, { recursive: true });
|
|
6687
|
-
}
|
|
6688
|
-
await fs6.writeFile(filePath, data);
|
|
6689
|
-
}
|
|
6690
|
-
async appendFile(filePath, data) {
|
|
6691
|
-
const dir = path22.dirname(filePath);
|
|
6692
|
-
if (dir) {
|
|
6693
|
-
await fs6.mkdir(dir, { recursive: true });
|
|
6694
|
-
}
|
|
6695
|
-
await fs6.appendFile(filePath, data);
|
|
6696
|
-
}
|
|
6697
|
-
async readdir(dirPath) {
|
|
6698
|
-
try {
|
|
6699
|
-
return await fs6.readdir(dirPath);
|
|
6700
|
-
} catch (error) {
|
|
6701
|
-
if (this.isEnoent(error))
|
|
6702
|
-
return [];
|
|
6703
|
-
throw error;
|
|
6704
|
-
}
|
|
6705
|
-
}
|
|
6706
|
-
async stat(filePath) {
|
|
6707
|
-
try {
|
|
6708
|
-
const stats = await fs6.stat(filePath);
|
|
6709
|
-
return {
|
|
6710
|
-
isFile: () => stats.isFile(),
|
|
6711
|
-
isDirectory: () => stats.isDirectory(),
|
|
6712
|
-
size: stats.size,
|
|
6713
|
-
mtimeMs: stats.mtimeMs
|
|
6714
|
-
};
|
|
6715
|
-
} catch (error) {
|
|
6716
|
-
if (this.isEnoent(error))
|
|
6717
|
-
return null;
|
|
6718
|
-
throw error;
|
|
6719
|
-
}
|
|
6720
|
-
}
|
|
6721
|
-
async exists(filePath) {
|
|
6722
|
-
return existsSync2(filePath);
|
|
6723
|
-
}
|
|
6724
|
-
async mkdir(dirPath) {
|
|
6725
|
-
await fs6.mkdir(dirPath, { recursive: true });
|
|
6726
|
-
}
|
|
6727
|
-
async acquireLock(lockPath) {
|
|
6728
|
-
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
6729
|
-
const lockFile = `${canonicalPath}.lock`;
|
|
6730
|
-
const ownerId = randomUUID2();
|
|
6731
|
-
const start = Date.now();
|
|
6732
|
-
while (true) {
|
|
6733
|
-
try {
|
|
6734
|
-
await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
6735
|
-
return this.createLockRelease(lockFile, ownerId);
|
|
6736
|
-
} catch (error) {
|
|
6737
|
-
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
6738
|
-
throw error;
|
|
6739
|
-
}
|
|
6740
|
-
const stats = await fs6.stat(lockFile).catch(() => null);
|
|
6741
|
-
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS2) {
|
|
6742
|
-
const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
6743
|
-
if (reclaimed)
|
|
6744
|
-
continue;
|
|
6745
|
-
}
|
|
6746
|
-
if (Date.now() - start > LOCK_MAX_WAIT_MS2) {
|
|
6747
|
-
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
6748
|
-
}
|
|
6749
|
-
await new Promise((resolve22) => setTimeout(resolve22, LOCK_RETRY_MIN_MS2 + Math.random() * LOCK_RETRY_JITTER_MS2));
|
|
6750
|
-
}
|
|
6751
|
-
}
|
|
6752
|
-
}
|
|
6753
|
-
async canonicalizeLockTarget(lockPath) {
|
|
6754
|
-
const absolute = path22.resolve(lockPath);
|
|
6755
|
-
const fullReal = await fs6.realpath(absolute).catch(() => null);
|
|
6756
|
-
if (fullReal)
|
|
6757
|
-
return fullReal;
|
|
6758
|
-
const parent = path22.dirname(absolute);
|
|
6759
|
-
const base = path22.basename(absolute);
|
|
6760
|
-
const canonicalParent = await fs6.realpath(parent).catch(() => parent);
|
|
6761
|
-
return path22.join(canonicalParent, base);
|
|
6762
|
-
}
|
|
6763
|
-
createLockRelease(lockFile, ownerId) {
|
|
6764
|
-
const heartbeatStart = Date.now();
|
|
6765
|
-
let heartbeatTimer;
|
|
6766
|
-
let stopped = false;
|
|
6767
|
-
const stopHeartbeat = () => {
|
|
6768
|
-
stopped = true;
|
|
6769
|
-
if (heartbeatTimer)
|
|
6770
|
-
clearTimeout(heartbeatTimer);
|
|
6771
|
-
};
|
|
6772
|
-
const scheduleNextHeartbeat = () => {
|
|
6773
|
-
if (stopped)
|
|
6774
|
-
return;
|
|
6775
|
-
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS2) {
|
|
6776
|
-
stopped = true;
|
|
6777
|
-
return;
|
|
6778
|
-
}
|
|
6779
|
-
heartbeatTimer = setTimeout(() => {
|
|
6780
|
-
runHeartbeat();
|
|
6781
|
-
}, LOCK_HEARTBEAT_MS2);
|
|
6782
|
-
heartbeatTimer.unref?.();
|
|
6783
|
-
};
|
|
6784
|
-
const runHeartbeat = async () => {
|
|
6785
|
-
if (stopped)
|
|
6786
|
-
return;
|
|
6787
|
-
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
6788
|
-
if (stopped)
|
|
6789
|
-
return;
|
|
6790
|
-
if (current !== ownerId) {
|
|
6791
|
-
stopped = true;
|
|
6792
|
-
return;
|
|
6793
|
-
}
|
|
6794
|
-
const now = Date.now() / 1000;
|
|
6795
|
-
await fs6.utimes(lockFile, now, now).catch(() => {});
|
|
6796
|
-
scheduleNextHeartbeat();
|
|
6797
|
-
};
|
|
6798
|
-
scheduleNextHeartbeat();
|
|
6799
|
-
let released = false;
|
|
6800
|
-
return async () => {
|
|
6801
|
-
if (released)
|
|
6802
|
-
return;
|
|
6803
|
-
released = true;
|
|
6804
|
-
stopHeartbeat();
|
|
6805
|
-
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
6806
|
-
if (current === ownerId) {
|
|
6807
|
-
await fs6.rm(lockFile, { force: true });
|
|
6808
|
-
}
|
|
6809
|
-
};
|
|
6810
|
-
}
|
|
6811
|
-
async rm(filePath) {
|
|
6812
|
-
await fs6.rm(filePath, { recursive: true, force: true });
|
|
6813
|
-
}
|
|
6814
|
-
async rename(oldPath, newPath) {
|
|
6815
|
-
await fs6.rename(oldPath, newPath);
|
|
6816
|
-
}
|
|
6817
|
-
async realpath(filePath) {
|
|
6818
|
-
try {
|
|
6819
|
-
return await fs6.realpath(filePath);
|
|
6820
|
-
} catch (error) {
|
|
6821
|
-
if (this.isEnoent(error))
|
|
6822
|
-
return filePath;
|
|
6823
|
-
throw error;
|
|
6824
|
-
}
|
|
6825
|
-
}
|
|
6826
|
-
async getTempDir() {
|
|
6827
|
-
return await fs6.mkdtemp(path22.join(os22.tmpdir(), "uipath-fs-"));
|
|
6828
|
-
}
|
|
6829
|
-
async copyDirectory(sourcePath, destPath) {
|
|
6830
|
-
const sourceStats = await this.stat(sourcePath);
|
|
6831
|
-
if (!sourceStats) {
|
|
6832
|
-
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
6833
|
-
}
|
|
6834
|
-
if (!sourceStats.isDirectory()) {
|
|
6835
|
-
throw new Error(`Source path is not a directory: ${sourcePath}`);
|
|
6836
|
-
}
|
|
6837
|
-
await this.mkdir(destPath);
|
|
6838
|
-
const entries = await this.readdir(sourcePath);
|
|
6839
|
-
for (const entry of entries) {
|
|
6840
|
-
const srcEntry = path22.join(sourcePath, entry);
|
|
6841
|
-
const destEntry = path22.join(destPath, entry);
|
|
6842
|
-
const entryStats = await this.stat(srcEntry);
|
|
6843
|
-
if (!entryStats)
|
|
6844
|
-
continue;
|
|
6845
|
-
if (entryStats.isDirectory()) {
|
|
6846
|
-
await this.copyDirectory(srcEntry, destEntry);
|
|
6847
|
-
} else if (entryStats.isFile()) {
|
|
6848
|
-
const content = await this.readFile(srcEntry);
|
|
6849
|
-
if (content !== null) {
|
|
6850
|
-
await this.writeFile(destEntry, content);
|
|
6851
|
-
}
|
|
6852
|
-
}
|
|
6853
|
-
}
|
|
6854
|
-
}
|
|
6855
|
-
isEnoent(error) {
|
|
6856
|
-
return this.hasErrnoCode(error, "ENOENT");
|
|
6857
|
-
}
|
|
6858
|
-
hasErrnoCode(error, code) {
|
|
6859
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
6860
|
-
}
|
|
6861
|
-
}
|
|
6862
|
-
var LOCK_HEARTBEAT_MS2 = 5000;
|
|
6863
|
-
var LOCK_STALE_MS2 = 15000;
|
|
6864
|
-
var LOCK_MAX_WAIT_MS2 = 20000;
|
|
6865
|
-
var LOCK_MAX_HOLD_MS2 = 60000;
|
|
6866
|
-
var LOCK_RETRY_MIN_MS2 = 100;
|
|
6867
|
-
var LOCK_RETRY_JITTER_MS2 = 200;
|
|
6868
|
-
var init_node = () => {};
|
|
6869
|
-
var fsInstance2;
|
|
6870
|
-
var getFileSystem2 = () => fsInstance2;
|
|
6871
|
-
var init_src = __esm(() => {
|
|
6872
|
-
init_node();
|
|
6873
|
-
init_node();
|
|
6874
|
-
fsInstance2 = new NodeFileSystem2;
|
|
6875
|
-
});
|
|
6876
|
-
init_constants();
|
|
6877
|
-
var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
|
|
6878
|
-
var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
|
|
6879
|
-
var globalSlot = globalThis;
|
|
6880
|
-
var getAuthFileConfig = () => globalSlot[AUTH_FILE_CONFIG_KEY] ?? {};
|
|
6881
|
-
|
|
6882
|
-
class InvalidBaseUrlError extends Error {
|
|
6883
|
-
url;
|
|
6884
|
-
reason;
|
|
6885
|
-
constructor(url, reason) {
|
|
6886
|
-
super(`Invalid base URL: "${url}"
|
|
6887
|
-
` + `Reason: ${reason}
|
|
6888
|
-
|
|
6889
|
-
` + `Expected format: an https:// URL (or bare host — https:// is assumed), e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
|
|
6890
|
-
` + `You can specify the URL via:
|
|
6891
|
-
` + ` • --authority flag
|
|
6892
|
-
` + ` • UIPATH_URL environment variable
|
|
6893
|
-
` + ` • auth.authority in config file`);
|
|
6894
|
-
this.url = url;
|
|
6895
|
-
this.reason = reason;
|
|
6896
|
-
this.name = "InvalidBaseUrlError";
|
|
6897
|
-
}
|
|
6898
|
-
}
|
|
6899
|
-
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
6900
|
-
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
6901
|
-
let baseUrl = rawUrl;
|
|
6902
|
-
if (baseUrl.endsWith("/identity_/")) {
|
|
6903
|
-
baseUrl = baseUrl.slice(0, -11);
|
|
6904
|
-
} else if (baseUrl.endsWith("/identity_")) {
|
|
6905
|
-
baseUrl = baseUrl.slice(0, -10);
|
|
6906
|
-
}
|
|
6907
|
-
while (baseUrl.endsWith("/")) {
|
|
6908
|
-
baseUrl = baseUrl.slice(0, -1);
|
|
6909
|
-
}
|
|
6910
|
-
const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
|
|
6911
|
-
const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
|
|
6912
|
-
if (!hasScheme && hostCandidate.includes(".")) {
|
|
6913
|
-
baseUrl = `https://${baseUrl}`;
|
|
6914
|
-
}
|
|
6915
|
-
const resolvedBaseUrl = baseUrl;
|
|
6916
|
-
const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
|
|
6917
|
-
if (urlError) {
|
|
6918
|
-
const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
|
|
6919
|
-
throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
|
|
6920
|
-
}
|
|
6921
|
-
if (url.protocol !== "https:") {
|
|
6922
|
-
throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
|
|
6923
|
-
}
|
|
6924
|
-
return url.pathname.length > 1 ? url.origin : baseUrl;
|
|
6494
|
+
return url.pathname.length > 1 ? url.origin : baseUrl;
|
|
6925
6495
|
};
|
|
6926
6496
|
var resolveScopes = (isExternalAppAuth, customScopes, fileScopes) => {
|
|
6927
6497
|
const requestedScopes = customScopes?.length ? customScopes : fileScopes ?? [];
|
|
@@ -6970,10 +6540,13 @@ var resolveConfigAsync = async ({
|
|
|
6970
6540
|
tokenEndpoint: `${baseUrl}/identity_/connect/token`
|
|
6971
6541
|
};
|
|
6972
6542
|
};
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6543
|
+
|
|
6544
|
+
// ../../auth/src/utils/platform.ts
|
|
6545
|
+
function isBrowser() {
|
|
6546
|
+
return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
|
|
6547
|
+
}
|
|
6548
|
+
|
|
6549
|
+
// ../../auth/src/authProfile.ts
|
|
6977
6550
|
var DEFAULT_AUTH_PROFILE = "default";
|
|
6978
6551
|
var PROFILE_DIR = "profiles";
|
|
6979
6552
|
var PROFILE_NAME_RE = /^[A-Za-z0-9._-]+$/;
|
|
@@ -6984,7 +6557,7 @@ function isAuthProfileStorage(value) {
|
|
|
6984
6557
|
return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
|
|
6985
6558
|
}
|
|
6986
6559
|
function createProfileStorage() {
|
|
6987
|
-
const [error, mod] = catchError2(() =>
|
|
6560
|
+
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
6988
6561
|
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
6989
6562
|
return {
|
|
6990
6563
|
getStore: () => {
|
|
@@ -7033,14 +6606,15 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
7033
6606
|
if (normalized === undefined) {
|
|
7034
6607
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
7035
6608
|
}
|
|
7036
|
-
const
|
|
7037
|
-
return
|
|
6609
|
+
const fs2 = getFileSystem();
|
|
6610
|
+
return fs2.path.join(fs2.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
7038
6611
|
}
|
|
7039
6612
|
function getActiveAuthProfileFilePath() {
|
|
7040
6613
|
const profile = getActiveAuthProfile();
|
|
7041
6614
|
return profile ? resolveAuthProfileFilePath(profile) : undefined;
|
|
7042
6615
|
}
|
|
7043
6616
|
|
|
6617
|
+
// ../../auth/src/utils/jwt.ts
|
|
7044
6618
|
class InvalidIssuerError extends Error {
|
|
7045
6619
|
expected;
|
|
7046
6620
|
actual;
|
|
@@ -7110,6 +6684,8 @@ var getTokenExpiration = (accessToken) => {
|
|
|
7110
6684
|
return;
|
|
7111
6685
|
}
|
|
7112
6686
|
};
|
|
6687
|
+
|
|
6688
|
+
// ../../auth/src/sessionIdentity.ts
|
|
7113
6689
|
var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
|
|
7114
6690
|
var decodeClaims = (accessToken) => {
|
|
7115
6691
|
const [error, claims] = catchError2(() => parseJWT(accessToken));
|
|
@@ -7144,6 +6720,11 @@ var pickName = (claims) => {
|
|
|
7144
6720
|
const username = asString(claims?.preferred_username);
|
|
7145
6721
|
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
7146
6722
|
};
|
|
6723
|
+
var pickScopes = (claims) => {
|
|
6724
|
+
const raw = claims?.scope;
|
|
6725
|
+
const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
|
|
6726
|
+
return scopes.length > 0 ? scopes : undefined;
|
|
6727
|
+
};
|
|
7147
6728
|
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
7148
6729
|
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
7149
6730
|
const email = pickEmail(claims);
|
|
@@ -7169,6 +6750,9 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
7169
6750
|
identity.clientId = clientId;
|
|
7170
6751
|
return identity;
|
|
7171
6752
|
};
|
|
6753
|
+
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
6754
|
+
|
|
6755
|
+
// ../../auth/src/envAuth.ts
|
|
7172
6756
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
7173
6757
|
var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
|
|
7174
6758
|
var ENV_AUTH_VARS = {
|
|
@@ -7227,7 +6811,7 @@ var readAuthFromEnv = () => {
|
|
|
7227
6811
|
organizationId,
|
|
7228
6812
|
tenantName,
|
|
7229
6813
|
tenantId,
|
|
7230
|
-
source: "env-vars"
|
|
6814
|
+
source: "env-vars" /* EnvironmentVariables */,
|
|
7231
6815
|
hint: "Token is opaque (not a JWT) - expiration and identity cannot be " + "determined locally. Commands will fail with 401 once it is revoked or " + `expired. If this was meant to be a JWT instead of a PAT, note: ${parseErrorMessage}`
|
|
7232
6816
|
};
|
|
7233
6817
|
}
|
|
@@ -7239,6 +6823,7 @@ var readAuthFromEnv = () => {
|
|
|
7239
6823
|
const expiration = getTokenExpiration(accessToken);
|
|
7240
6824
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
7241
6825
|
const identity = resolveSessionIdentity(accessToken);
|
|
6826
|
+
const scopes = readTokenScopes(accessToken);
|
|
7242
6827
|
return {
|
|
7243
6828
|
loginStatus,
|
|
7244
6829
|
accessToken,
|
|
@@ -7248,11 +6833,13 @@ var readAuthFromEnv = () => {
|
|
|
7248
6833
|
tenantName,
|
|
7249
6834
|
tenantId,
|
|
7250
6835
|
expiration,
|
|
7251
|
-
source: "env-vars"
|
|
7252
|
-
...identity ? { identity } : {}
|
|
6836
|
+
source: "env-vars" /* EnvironmentVariables */,
|
|
6837
|
+
...identity ? { identity } : {},
|
|
6838
|
+
...scopes ? { scopes } : {}
|
|
7253
6839
|
};
|
|
7254
6840
|
};
|
|
7255
|
-
|
|
6841
|
+
|
|
6842
|
+
// ../../auth/src/refreshCircuitBreaker.ts
|
|
7256
6843
|
var BREAKER_SUFFIX = ".refresh-state";
|
|
7257
6844
|
var BACKOFF_BASE_MS = 60000;
|
|
7258
6845
|
var BACKOFF_CAP_MS = 60 * 60 * 1000;
|
|
@@ -7270,9 +6857,9 @@ function breakerPathFor(authPath) {
|
|
|
7270
6857
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
7271
6858
|
}
|
|
7272
6859
|
async function loadRefreshBreaker(authPath) {
|
|
7273
|
-
const
|
|
6860
|
+
const fs2 = getFileSystem();
|
|
7274
6861
|
try {
|
|
7275
|
-
const content = await
|
|
6862
|
+
const content = await fs2.readFile(breakerPathFor(authPath), "utf-8");
|
|
7276
6863
|
if (!content)
|
|
7277
6864
|
return {};
|
|
7278
6865
|
const parsed = JSON.parse(content);
|
|
@@ -7283,20 +6870,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
7283
6870
|
}
|
|
7284
6871
|
async function saveRefreshBreaker(authPath, state) {
|
|
7285
6872
|
try {
|
|
7286
|
-
const
|
|
7287
|
-
const
|
|
7288
|
-
await
|
|
7289
|
-
const tempPath = `${
|
|
7290
|
-
await
|
|
7291
|
-
await
|
|
6873
|
+
const fs2 = getFileSystem();
|
|
6874
|
+
const path2 = breakerPathFor(authPath);
|
|
6875
|
+
await fs2.mkdir(fs2.path.dirname(path2));
|
|
6876
|
+
const tempPath = `${path2}.tmp`;
|
|
6877
|
+
await fs2.writeFile(tempPath, JSON.stringify(state));
|
|
6878
|
+
await fs2.rename(tempPath, path2);
|
|
7292
6879
|
} catch {}
|
|
7293
6880
|
}
|
|
7294
6881
|
async function clearRefreshBreaker(authPath) {
|
|
7295
|
-
const
|
|
7296
|
-
const
|
|
6882
|
+
const fs2 = getFileSystem();
|
|
6883
|
+
const path2 = breakerPathFor(authPath);
|
|
7297
6884
|
try {
|
|
7298
|
-
if (await
|
|
7299
|
-
await
|
|
6885
|
+
if (await fs2.exists(path2)) {
|
|
6886
|
+
await fs2.rm(path2);
|
|
7300
6887
|
}
|
|
7301
6888
|
} catch {}
|
|
7302
6889
|
}
|
|
@@ -7309,20 +6896,21 @@ function shouldSurface(state, nowMs) {
|
|
|
7309
6896
|
return true;
|
|
7310
6897
|
return nowMs - state.lastSurfacedAtMs >= SURFACE_WINDOW_MS;
|
|
7311
6898
|
}
|
|
7312
|
-
|
|
6899
|
+
|
|
6900
|
+
// ../../auth/src/robotClientFallback.ts
|
|
7313
6901
|
var DEFAULT_TIMEOUT_MS = 1000;
|
|
7314
6902
|
var CLOSE_TIMEOUT_MS = 500;
|
|
7315
6903
|
var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
7316
6904
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
7317
6905
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
7318
6906
|
var getRobotIpcPipeNames = async () => {
|
|
7319
|
-
const
|
|
7320
|
-
const username =
|
|
6907
|
+
const fs2 = getFileSystem();
|
|
6908
|
+
const username = fs2.env.getenv("USER") ?? fs2.env.getenv("USERNAME");
|
|
7321
6909
|
if (!username) {
|
|
7322
6910
|
throw new Error("Unable to determine current username");
|
|
7323
6911
|
}
|
|
7324
|
-
const tempPath =
|
|
7325
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
6912
|
+
const tempPath = fs2.env.getenv("TMPDIR") ?? "/tmp/";
|
|
6913
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs2.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
7326
6914
|
};
|
|
7327
6915
|
var defaultIsRobotIpcAvailable = async () => {
|
|
7328
6916
|
if (process.platform === "win32") {
|
|
@@ -7332,20 +6920,20 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
7332
6920
|
if (pipeNamesError || !pipeNames) {
|
|
7333
6921
|
return false;
|
|
7334
6922
|
}
|
|
7335
|
-
const
|
|
6923
|
+
const fs2 = getFileSystem();
|
|
7336
6924
|
for (const pipeName of pipeNames) {
|
|
7337
|
-
const [existsError, exists] = await catchError2(
|
|
6925
|
+
const [existsError, exists] = await catchError2(fs2.exists(pipeName));
|
|
7338
6926
|
if (!existsError && exists === true) {
|
|
7339
6927
|
return true;
|
|
7340
6928
|
}
|
|
7341
6929
|
}
|
|
7342
6930
|
return false;
|
|
7343
6931
|
};
|
|
7344
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
6932
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
|
|
7345
6933
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
7346
6934
|
promise.then((value) => {
|
|
7347
6935
|
clearTimeout(timer);
|
|
7348
|
-
|
|
6936
|
+
resolve2(value);
|
|
7349
6937
|
}, (error) => {
|
|
7350
6938
|
clearTimeout(timer);
|
|
7351
6939
|
reject(error);
|
|
@@ -7451,6 +7039,8 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
7451
7039
|
await catchError2(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
|
|
7452
7040
|
}
|
|
7453
7041
|
};
|
|
7042
|
+
|
|
7043
|
+
// ../../auth/src/tokenRefresh.ts
|
|
7454
7044
|
var TOKEN_REFRESH_REAUTHENTICATE_MESSAGE = "Token refresh failed. Run 'uip login' to re-authenticate.";
|
|
7455
7045
|
|
|
7456
7046
|
class TokenRefreshOAuthError extends Error {
|
|
@@ -7495,9 +7085,11 @@ var refreshAccessToken = async ({
|
|
|
7495
7085
|
}
|
|
7496
7086
|
return { accessToken: newAccessToken, refreshToken: newRefreshToken };
|
|
7497
7087
|
};
|
|
7088
|
+
|
|
7089
|
+
// ../../auth/src/types.ts
|
|
7498
7090
|
var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
|
|
7499
|
-
|
|
7500
|
-
|
|
7091
|
+
|
|
7092
|
+
// ../../auth/src/utils/envFile.ts
|
|
7501
7093
|
var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
|
|
7502
7094
|
var KNOWN_ERROR_CODES = new Set([
|
|
7503
7095
|
"EISDIR",
|
|
@@ -7514,9 +7106,9 @@ var errorCode = (err) => {
|
|
|
7514
7106
|
}
|
|
7515
7107
|
return "EUNKNOWN";
|
|
7516
7108
|
};
|
|
7517
|
-
var probeAsync = async (
|
|
7109
|
+
var probeAsync = async (fs2, candidate) => {
|
|
7518
7110
|
try {
|
|
7519
|
-
const stats = await
|
|
7111
|
+
const stats = await fs2.stat(candidate);
|
|
7520
7112
|
if (stats === null) {
|
|
7521
7113
|
return { exists: false };
|
|
7522
7114
|
}
|
|
@@ -7543,9 +7135,9 @@ var probeAsync = async (fs7, candidate) => {
|
|
|
7543
7135
|
}
|
|
7544
7136
|
};
|
|
7545
7137
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
7546
|
-
const
|
|
7547
|
-
if (
|
|
7548
|
-
const probe2 = await probeAsync(
|
|
7138
|
+
const fs2 = getFileSystem();
|
|
7139
|
+
if (fs2.path.isAbsolute(envFilePath)) {
|
|
7140
|
+
const probe2 = await probeAsync(fs2, envFilePath);
|
|
7549
7141
|
return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
7550
7142
|
exists: false,
|
|
7551
7143
|
absolutePath: envFilePath,
|
|
@@ -7553,11 +7145,11 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
|
|
|
7553
7145
|
...probe2.unusable ? { unusable: probe2.unusable } : {}
|
|
7554
7146
|
};
|
|
7555
7147
|
}
|
|
7556
|
-
const cwd = opts?.cwd ??
|
|
7148
|
+
const cwd = opts?.cwd ?? fs2.env.cwd();
|
|
7557
7149
|
let searchDir = cwd;
|
|
7558
7150
|
while (true) {
|
|
7559
|
-
const candidate =
|
|
7560
|
-
const probe2 = await probeAsync(
|
|
7151
|
+
const candidate = fs2.path.join(searchDir, envFilePath);
|
|
7152
|
+
const probe2 = await probeAsync(fs2, candidate);
|
|
7561
7153
|
if (probe2.exists) {
|
|
7562
7154
|
return {
|
|
7563
7155
|
exists: true,
|
|
@@ -7565,14 +7157,14 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
|
|
|
7565
7157
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
7566
7158
|
};
|
|
7567
7159
|
}
|
|
7568
|
-
const parentDir =
|
|
7160
|
+
const parentDir = fs2.path.dirname(searchDir);
|
|
7569
7161
|
if (parentDir === searchDir) {
|
|
7570
7162
|
break;
|
|
7571
7163
|
}
|
|
7572
7164
|
searchDir = parentDir;
|
|
7573
7165
|
}
|
|
7574
|
-
const homePath =
|
|
7575
|
-
const probe = await probeAsync(
|
|
7166
|
+
const homePath = fs2.path.join(fs2.env.homedir(), envFilePath);
|
|
7167
|
+
const probe = await probeAsync(fs2, homePath);
|
|
7576
7168
|
if (probe.exists) {
|
|
7577
7169
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
7578
7170
|
}
|
|
@@ -7615,12 +7207,12 @@ var parseEnvContent = (content) => {
|
|
|
7615
7207
|
return env;
|
|
7616
7208
|
};
|
|
7617
7209
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
7618
|
-
const
|
|
7619
|
-
const absolutePath =
|
|
7620
|
-
if (!await
|
|
7210
|
+
const fs2 = getFileSystem();
|
|
7211
|
+
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
|
|
7212
|
+
if (!await fs2.exists(absolutePath)) {
|
|
7621
7213
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7622
7214
|
}
|
|
7623
|
-
const content = await
|
|
7215
|
+
const content = await fs2.readFile(absolutePath, "utf-8");
|
|
7624
7216
|
if (content === null) {
|
|
7625
7217
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7626
7218
|
}
|
|
@@ -7631,10 +7223,10 @@ var saveEnvFileAsync = async ({
|
|
|
7631
7223
|
data,
|
|
7632
7224
|
merge = true
|
|
7633
7225
|
}) => {
|
|
7634
|
-
const
|
|
7635
|
-
const absolutePath =
|
|
7226
|
+
const fs2 = getFileSystem();
|
|
7227
|
+
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.homedir(), envPath);
|
|
7636
7228
|
let existingData = {};
|
|
7637
|
-
if (merge && await
|
|
7229
|
+
if (merge && await fs2.exists(absolutePath)) {
|
|
7638
7230
|
try {
|
|
7639
7231
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
7640
7232
|
} catch {}
|
|
@@ -7652,12 +7244,14 @@ var saveEnvFileAsync = async ({
|
|
|
7652
7244
|
const content = `${lines.join(`
|
|
7653
7245
|
`)}
|
|
7654
7246
|
`;
|
|
7655
|
-
const dir =
|
|
7656
|
-
await
|
|
7247
|
+
const dir = fs2.path.dirname(absolutePath);
|
|
7248
|
+
await fs2.mkdir(dir);
|
|
7657
7249
|
const tempPath = `${absolutePath}.tmp`;
|
|
7658
|
-
await
|
|
7659
|
-
await
|
|
7250
|
+
await fs2.writeFile(tempPath, content);
|
|
7251
|
+
await fs2.rename(tempPath, absolutePath);
|
|
7660
7252
|
};
|
|
7253
|
+
|
|
7254
|
+
// ../../auth/src/loginStatus.ts
|
|
7661
7255
|
var getLoginStatusAsync = async (options = {}) => {
|
|
7662
7256
|
return getLoginStatusWithDeps(options);
|
|
7663
7257
|
};
|
|
@@ -7666,7 +7260,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
7666
7260
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
7667
7261
|
loadEnvFile = loadEnvFileAsync,
|
|
7668
7262
|
saveEnvFile = saveEnvFileAsync,
|
|
7669
|
-
getFs =
|
|
7263
|
+
getFs = getFileSystem,
|
|
7670
7264
|
refreshToken: refreshTokenFn = refreshAccessToken,
|
|
7671
7265
|
resolveConfig = resolveConfigAsync,
|
|
7672
7266
|
robotFallback = tryRobotClientFallback,
|
|
@@ -7737,13 +7331,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
7737
7331
|
};
|
|
7738
7332
|
async function resolveRobotEnforcedStatus(robotFallback) {
|
|
7739
7333
|
if (isEnvAuthEnabled()) {
|
|
7740
|
-
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true are mutually exclusive. Unset one of them and re-run.`);
|
|
7334
|
+
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
|
|
7741
7335
|
}
|
|
7742
7336
|
const robotCreds = await robotFallback({ force: true });
|
|
7743
7337
|
if (!robotCreds) {
|
|
7744
7338
|
return {
|
|
7745
7339
|
loginStatus: "Not logged in",
|
|
7746
|
-
hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot session is unavailable. Start and sign in to the Assistant, or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or env-var authentication.`
|
|
7340
|
+
hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
|
|
7747
7341
|
};
|
|
7748
7342
|
}
|
|
7749
7343
|
return buildRobotStatus(robotCreds);
|
|
@@ -7768,11 +7362,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
7768
7362
|
return { credentials };
|
|
7769
7363
|
}
|
|
7770
7364
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
7771
|
-
const
|
|
7772
|
-
const globalPath =
|
|
7365
|
+
const fs2 = getFs();
|
|
7366
|
+
const globalPath = fs2.path.join(fs2.env.homedir(), envFilePath);
|
|
7773
7367
|
if (absolutePath === globalPath)
|
|
7774
7368
|
return;
|
|
7775
|
-
if (!await
|
|
7369
|
+
if (!await fs2.exists(globalPath))
|
|
7776
7370
|
return;
|
|
7777
7371
|
try {
|
|
7778
7372
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -7863,7 +7457,7 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
7863
7457
|
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
7864
7458
|
tenantId: credentials.UIPATH_TENANT_ID,
|
|
7865
7459
|
expiration: tokens.expiration,
|
|
7866
|
-
source: "saved-login"
|
|
7460
|
+
source: "saved-login" /* SavedLogin */,
|
|
7867
7461
|
...identityFields(tokens.accessToken, credentials),
|
|
7868
7462
|
...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
|
|
7869
7463
|
...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
@@ -7879,10 +7473,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
7879
7473
|
}
|
|
7880
7474
|
function identityFields(accessToken, credentials) {
|
|
7881
7475
|
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
7882
|
-
|
|
7476
|
+
const scopes = readTokenScopes(accessToken);
|
|
7477
|
+
return {
|
|
7478
|
+
...identity ? { identity } : {},
|
|
7479
|
+
...scopes ? { scopes } : {}
|
|
7480
|
+
};
|
|
7883
7481
|
}
|
|
7884
7482
|
function buildRobotStatus(robotCreds) {
|
|
7885
7483
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
7484
|
+
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
7886
7485
|
return {
|
|
7887
7486
|
loginStatus: "Logged in",
|
|
7888
7487
|
accessToken: robotCreds.accessToken,
|
|
@@ -7893,8 +7492,9 @@ function buildRobotStatus(robotCreds) {
|
|
|
7893
7492
|
tenantId: robotCreds.tenantId,
|
|
7894
7493
|
issuer: robotCreds.issuer,
|
|
7895
7494
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
7896
|
-
source: "robot"
|
|
7897
|
-
...identity ? { identity } : {}
|
|
7495
|
+
source: "robot" /* Robot */,
|
|
7496
|
+
...identity ? { identity } : {},
|
|
7497
|
+
...scopes ? { scopes } : {}
|
|
7898
7498
|
};
|
|
7899
7499
|
}
|
|
7900
7500
|
var isFileNotFoundError = (error) => {
|
|
@@ -7945,7 +7545,7 @@ async function circuitBreakerShortCircuit(ctx) {
|
|
|
7945
7545
|
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
7946
7546
|
tenantId: credentials.UIPATH_TENANT_ID,
|
|
7947
7547
|
expiration,
|
|
7948
|
-
source: "saved-login"
|
|
7548
|
+
source: "saved-login" /* SavedLogin */,
|
|
7949
7549
|
...identityFields(accessToken, credentials)
|
|
7950
7550
|
} : {},
|
|
7951
7551
|
hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
|
|
@@ -7968,7 +7568,7 @@ async function lockAcquireFailureStatus(ctx, error) {
|
|
|
7968
7568
|
tenantName: ctx.credentials.UIPATH_TENANT_NAME,
|
|
7969
7569
|
tenantId: ctx.credentials.UIPATH_TENANT_ID,
|
|
7970
7570
|
expiration: ctx.expiration,
|
|
7971
|
-
source: "saved-login"
|
|
7571
|
+
source: "saved-login" /* SavedLogin */,
|
|
7972
7572
|
...identityFields(ctx.accessToken, ctx.credentials),
|
|
7973
7573
|
hint: globalHint,
|
|
7974
7574
|
tokenRefresh: {
|
|
@@ -8132,18 +7732,17 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
8132
7732
|
function errorMessage(error) {
|
|
8133
7733
|
return error instanceof Error ? error.message : String(error);
|
|
8134
7734
|
}
|
|
8135
|
-
|
|
8136
|
-
init_constants();
|
|
8137
|
-
init_src();
|
|
8138
|
-
init_constants();
|
|
7735
|
+
// ../../auth/src/tenantSelection.ts
|
|
8139
7736
|
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
7737
|
+
|
|
7738
|
+
// ../../auth/src/selectTenant.ts
|
|
8140
7739
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
8141
7740
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
8142
7741
|
var TENANT_SELECTION_CODES = new Set([
|
|
8143
7742
|
TENANT_SELECTION_REQUIRED_CODE,
|
|
8144
7743
|
INVALID_TENANT_CODE
|
|
8145
7744
|
]);
|
|
8146
|
-
|
|
7745
|
+
// ../llmgw-sdk/src/client-factory.ts
|
|
8147
7746
|
var SERVICE_PATH = {
|
|
8148
7747
|
"llm-gateway": "llmgateway_"
|
|
8149
7748
|
};
|
|
@@ -8170,9 +7769,9 @@ function stripTrailingSlash(s) {
|
|
|
8170
7769
|
}
|
|
8171
7770
|
return end === s.length ? s : s.slice(0, end);
|
|
8172
7771
|
}
|
|
8173
|
-
function buildUrl(baseUrl,
|
|
7772
|
+
function buildUrl(baseUrl, path2, query) {
|
|
8174
7773
|
const trimmed = stripTrailingSlash(baseUrl);
|
|
8175
|
-
const suffix =
|
|
7774
|
+
const suffix = path2.startsWith("/") ? path2 : `/${path2}`;
|
|
8176
7775
|
if (!query)
|
|
8177
7776
|
return `${trimmed}${suffix}`;
|
|
8178
7777
|
const search = new URLSearchParams;
|
|
@@ -8269,6 +7868,7 @@ async function createAiHttpContext(service, options) {
|
|
|
8269
7868
|
fetchVoid
|
|
8270
7869
|
};
|
|
8271
7870
|
}
|
|
7871
|
+
// ../llmgw-sdk/src/discovery.ts
|
|
8272
7872
|
async function getDiscoveryModels(options) {
|
|
8273
7873
|
const context = await createAiHttpContext("llm-gateway", options);
|
|
8274
7874
|
const extraHeaders = {
|
|
@@ -8295,7 +7895,6 @@ async function getDiscoveryModels(options) {
|
|
|
8295
7895
|
extraHeaders
|
|
8296
7896
|
});
|
|
8297
7897
|
}
|
|
8298
|
-
|
|
8299
7898
|
// src/commands/models.ts
|
|
8300
7899
|
var LOGIN_INSTRUCTIONS = "Run 'uip login' to authenticate before using this command.";
|
|
8301
7900
|
var EXAMPLES = [
|
|
@@ -8398,4 +7997,4 @@ export {
|
|
|
8398
7997
|
registerCommands
|
|
8399
7998
|
};
|
|
8400
7999
|
|
|
8401
|
-
//# debugId=
|
|
8000
|
+
//# debugId=2BF3AE9F890F589C64756E2164756E21
|