@uipath/cli 1.1.0 → 1.195.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +991 -335
- package/package.json +59 -48
package/dist/index.js
CHANGED
|
@@ -681,6 +681,7 @@ var init_open = __esm(() => {
|
|
|
681
681
|
});
|
|
682
682
|
|
|
683
683
|
// ../filesystem/src/node.ts
|
|
684
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
684
685
|
import { existsSync } from "node:fs";
|
|
685
686
|
import * as fs6 from "node:fs/promises";
|
|
686
687
|
import * as os2 from "node:os";
|
|
@@ -762,6 +763,90 @@ class NodeFileSystem {
|
|
|
762
763
|
async mkdir(dirPath) {
|
|
763
764
|
await fs6.mkdir(dirPath, { recursive: true });
|
|
764
765
|
}
|
|
766
|
+
async acquireLock(lockPath) {
|
|
767
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
768
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
769
|
+
const ownerId = randomUUID2();
|
|
770
|
+
const start = Date.now();
|
|
771
|
+
while (true) {
|
|
772
|
+
try {
|
|
773
|
+
await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
774
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
775
|
+
} catch (error) {
|
|
776
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
777
|
+
throw error;
|
|
778
|
+
}
|
|
779
|
+
const stats = await fs6.stat(lockFile).catch(() => null);
|
|
780
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
781
|
+
const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
782
|
+
if (reclaimed)
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
786
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
787
|
+
}
|
|
788
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
async canonicalizeLockTarget(lockPath) {
|
|
793
|
+
const absolute = path2.resolve(lockPath);
|
|
794
|
+
const fullReal = await fs6.realpath(absolute).catch(() => null);
|
|
795
|
+
if (fullReal)
|
|
796
|
+
return fullReal;
|
|
797
|
+
const parent = path2.dirname(absolute);
|
|
798
|
+
const base = path2.basename(absolute);
|
|
799
|
+
const canonicalParent = await fs6.realpath(parent).catch(() => parent);
|
|
800
|
+
return path2.join(canonicalParent, base);
|
|
801
|
+
}
|
|
802
|
+
createLockRelease(lockFile, ownerId) {
|
|
803
|
+
const heartbeatStart = Date.now();
|
|
804
|
+
let heartbeatTimer;
|
|
805
|
+
let stopped = false;
|
|
806
|
+
const stopHeartbeat = () => {
|
|
807
|
+
stopped = true;
|
|
808
|
+
if (heartbeatTimer)
|
|
809
|
+
clearTimeout(heartbeatTimer);
|
|
810
|
+
};
|
|
811
|
+
const scheduleNextHeartbeat = () => {
|
|
812
|
+
if (stopped)
|
|
813
|
+
return;
|
|
814
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
815
|
+
stopped = true;
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
heartbeatTimer = setTimeout(() => {
|
|
819
|
+
runHeartbeat();
|
|
820
|
+
}, LOCK_HEARTBEAT_MS);
|
|
821
|
+
heartbeatTimer.unref?.();
|
|
822
|
+
};
|
|
823
|
+
const runHeartbeat = async () => {
|
|
824
|
+
if (stopped)
|
|
825
|
+
return;
|
|
826
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
827
|
+
if (stopped)
|
|
828
|
+
return;
|
|
829
|
+
if (current !== ownerId) {
|
|
830
|
+
stopped = true;
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
const now = Date.now() / 1000;
|
|
834
|
+
await fs6.utimes(lockFile, now, now).catch(() => {});
|
|
835
|
+
scheduleNextHeartbeat();
|
|
836
|
+
};
|
|
837
|
+
scheduleNextHeartbeat();
|
|
838
|
+
let released = false;
|
|
839
|
+
return async () => {
|
|
840
|
+
if (released)
|
|
841
|
+
return;
|
|
842
|
+
released = true;
|
|
843
|
+
stopHeartbeat();
|
|
844
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
845
|
+
if (current === ownerId) {
|
|
846
|
+
await fs6.rm(lockFile, { force: true });
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
}
|
|
765
850
|
async rm(filePath) {
|
|
766
851
|
await fs6.rm(filePath, { recursive: true, force: true });
|
|
767
852
|
}
|
|
@@ -807,9 +892,13 @@ class NodeFileSystem {
|
|
|
807
892
|
}
|
|
808
893
|
}
|
|
809
894
|
isEnoent(error) {
|
|
810
|
-
return
|
|
895
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
896
|
+
}
|
|
897
|
+
hasErrnoCode(error, code) {
|
|
898
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
811
899
|
}
|
|
812
900
|
}
|
|
901
|
+
var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200;
|
|
813
902
|
var init_node = __esm(() => {
|
|
814
903
|
init_open();
|
|
815
904
|
});
|
|
@@ -8963,7 +9052,7 @@ var require_applicationinsights = __commonJS((exports, module) => {
|
|
|
8963
9052
|
|
|
8964
9053
|
// ../../node_modules/applicationinsights/out/Library/JsonConfig.js
|
|
8965
9054
|
var require_JsonConfig = __commonJS((exports) => {
|
|
8966
|
-
var __dirname = "/
|
|
9055
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/applicationinsights/out/Library";
|
|
8967
9056
|
var __importDefault = exports && exports.__importDefault || function(mod2) {
|
|
8968
9057
|
return mod2 && mod2.__esModule ? mod2 : { default: mod2 };
|
|
8969
9058
|
};
|
|
@@ -20844,7 +20933,7 @@ var require_src7 = __commonJS((exports) => {
|
|
|
20844
20933
|
} });
|
|
20845
20934
|
});
|
|
20846
20935
|
|
|
20847
|
-
// ../../node_modules/@opentelemetry/
|
|
20936
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.js
|
|
20848
20937
|
var require_LogRecord = __commonJS((exports) => {
|
|
20849
20938
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20850
20939
|
exports.SeverityNumber = undefined;
|
|
@@ -20878,7 +20967,7 @@ var require_LogRecord = __commonJS((exports) => {
|
|
|
20878
20967
|
})(SeverityNumber = exports.SeverityNumber || (exports.SeverityNumber = {}));
|
|
20879
20968
|
});
|
|
20880
20969
|
|
|
20881
|
-
// ../../node_modules/@opentelemetry/
|
|
20970
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/NoopLogger.js
|
|
20882
20971
|
var require_NoopLogger = __commonJS((exports) => {
|
|
20883
20972
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20884
20973
|
exports.NOOP_LOGGER = exports.NoopLogger = undefined;
|
|
@@ -20890,7 +20979,7 @@ var require_NoopLogger = __commonJS((exports) => {
|
|
|
20890
20979
|
exports.NOOP_LOGGER = new NoopLogger;
|
|
20891
20980
|
});
|
|
20892
20981
|
|
|
20893
|
-
// ../../node_modules/@opentelemetry/
|
|
20982
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/internal/global-utils.js
|
|
20894
20983
|
var require_global_utils2 = __commonJS((exports) => {
|
|
20895
20984
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20896
20985
|
exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_LOGS_API_KEY = undefined;
|
|
@@ -20903,7 +20992,7 @@ var require_global_utils2 = __commonJS((exports) => {
|
|
|
20903
20992
|
exports.API_BACKWARDS_COMPATIBILITY_VERSION = 1;
|
|
20904
20993
|
});
|
|
20905
20994
|
|
|
20906
|
-
// ../../node_modules/@opentelemetry/
|
|
20995
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/NoopLoggerProvider.js
|
|
20907
20996
|
var require_NoopLoggerProvider = __commonJS((exports) => {
|
|
20908
20997
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20909
20998
|
exports.NOOP_LOGGER_PROVIDER = exports.NoopLoggerProvider = undefined;
|
|
@@ -20918,7 +21007,7 @@ var require_NoopLoggerProvider = __commonJS((exports) => {
|
|
|
20918
21007
|
exports.NOOP_LOGGER_PROVIDER = new NoopLoggerProvider;
|
|
20919
21008
|
});
|
|
20920
21009
|
|
|
20921
|
-
// ../../node_modules/@opentelemetry/
|
|
21010
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/ProxyLogger.js
|
|
20922
21011
|
var require_ProxyLogger = __commonJS((exports) => {
|
|
20923
21012
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20924
21013
|
exports.ProxyLogger = undefined;
|
|
@@ -20949,7 +21038,7 @@ var require_ProxyLogger = __commonJS((exports) => {
|
|
|
20949
21038
|
exports.ProxyLogger = ProxyLogger;
|
|
20950
21039
|
});
|
|
20951
21040
|
|
|
20952
|
-
// ../../node_modules/@opentelemetry/
|
|
21041
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/ProxyLoggerProvider.js
|
|
20953
21042
|
var require_ProxyLoggerProvider = __commonJS((exports) => {
|
|
20954
21043
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20955
21044
|
exports.ProxyLoggerProvider = undefined;
|
|
@@ -20976,7 +21065,7 @@ var require_ProxyLoggerProvider = __commonJS((exports) => {
|
|
|
20976
21065
|
exports.ProxyLoggerProvider = ProxyLoggerProvider;
|
|
20977
21066
|
});
|
|
20978
21067
|
|
|
20979
|
-
// ../../node_modules/@opentelemetry/
|
|
21068
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/api/logs.js
|
|
20980
21069
|
var require_logs = __commonJS((exports) => {
|
|
20981
21070
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20982
21071
|
exports.LogsAPI = undefined;
|
|
@@ -21017,7 +21106,7 @@ var require_logs = __commonJS((exports) => {
|
|
|
21017
21106
|
exports.LogsAPI = LogsAPI;
|
|
21018
21107
|
});
|
|
21019
21108
|
|
|
21020
|
-
// ../../node_modules/@opentelemetry/
|
|
21109
|
+
// ../../node_modules/@opentelemetry/api-logs/build/src/index.js
|
|
21021
21110
|
var require_src8 = __commonJS((exports) => {
|
|
21022
21111
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21023
21112
|
exports.logs = exports.NoopLogger = exports.NOOP_LOGGER = exports.SeverityNumber = undefined;
|
|
@@ -32030,7 +32119,7 @@ var require_stack_chain2 = __commonJS((exports, module) => {
|
|
|
32030
32119
|
|
|
32031
32120
|
// ../../node_modules/async-hook-jl/index.js
|
|
32032
32121
|
var require_async_hook_jl = __commonJS((exports, module) => {
|
|
32033
|
-
var __dirname = "/
|
|
32122
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/async-hook-jl";
|
|
32034
32123
|
var AsyncHook = require_async_hook();
|
|
32035
32124
|
if (global._asyncHook) {
|
|
32036
32125
|
if (global._asyncHook.version === require_package2().version) {
|
|
@@ -35656,7 +35745,7 @@ var require_PrefixHelper = __commonJS((exports) => {
|
|
|
35656
35745
|
|
|
35657
35746
|
// ../../node_modules/applicationinsights/out/Library/Context.js
|
|
35658
35747
|
var require_Context = __commonJS((exports, module) => {
|
|
35659
|
-
var __dirname = "/
|
|
35748
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/applicationinsights/out/Library";
|
|
35660
35749
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
35661
35750
|
if (k2 === undefined)
|
|
35662
35751
|
k2 = k;
|
|
@@ -39982,13 +40071,13 @@ var require_sha256 = __commonJS((exports, module) => {
|
|
|
39982
40071
|
computeSha256Hmac: () => computeSha256Hmac2
|
|
39983
40072
|
});
|
|
39984
40073
|
module.exports = __toCommonJS(sha256_exports);
|
|
39985
|
-
var
|
|
40074
|
+
var import_node_crypto2 = __require("node:crypto");
|
|
39986
40075
|
async function computeSha256Hmac2(key, stringToSign, encoding) {
|
|
39987
40076
|
const decodedKey = Buffer.from(key, "base64");
|
|
39988
|
-
return (0,
|
|
40077
|
+
return (0, import_node_crypto2.createHmac)("sha256", decodedKey).update(stringToSign).digest(encoding);
|
|
39989
40078
|
}
|
|
39990
40079
|
async function computeSha256Hash2(content, encoding) {
|
|
39991
|
-
return (0,
|
|
40080
|
+
return (0, import_node_crypto2.createHash)("sha256").update(content).digest(encoding);
|
|
39992
40081
|
}
|
|
39993
40082
|
});
|
|
39994
40083
|
|
|
@@ -40013,10 +40102,10 @@ var require_uuidUtils = __commonJS((exports, module) => {
|
|
|
40013
40102
|
var __toCommonJS = (mod2) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod2);
|
|
40014
40103
|
var uuidUtils_exports = {};
|
|
40015
40104
|
__export2(uuidUtils_exports, {
|
|
40016
|
-
randomUUID: () =>
|
|
40105
|
+
randomUUID: () => randomUUID3
|
|
40017
40106
|
});
|
|
40018
40107
|
module.exports = __toCommonJS(uuidUtils_exports);
|
|
40019
|
-
function
|
|
40108
|
+
function randomUUID3() {
|
|
40020
40109
|
return crypto.randomUUID();
|
|
40021
40110
|
}
|
|
40022
40111
|
});
|
|
@@ -40466,7 +40555,7 @@ var require_commonjs4 = __commonJS((exports) => {
|
|
|
40466
40555
|
exports.getRandomIntegerInclusive = getRandomIntegerInclusive2;
|
|
40467
40556
|
exports.isError = isError2;
|
|
40468
40557
|
exports.isObject = isObject4;
|
|
40469
|
-
exports.randomUUID =
|
|
40558
|
+
exports.randomUUID = randomUUID3;
|
|
40470
40559
|
exports.uint8ArrayToString = uint8ArrayToString2;
|
|
40471
40560
|
exports.stringToUint8Array = stringToUint8Array2;
|
|
40472
40561
|
var tslib_1 = require_tslib();
|
|
@@ -40515,7 +40604,7 @@ var require_commonjs4 = __commonJS((exports) => {
|
|
|
40515
40604
|
function isObject4(input) {
|
|
40516
40605
|
return tspRuntime.isObject(input);
|
|
40517
40606
|
}
|
|
40518
|
-
function
|
|
40607
|
+
function randomUUID3() {
|
|
40519
40608
|
return tspRuntime.randomUUID();
|
|
40520
40609
|
}
|
|
40521
40610
|
exports.isBrowser = tspRuntime.isBrowser;
|
|
@@ -41721,7 +41810,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
41721
41810
|
exports.Agent = Agent;
|
|
41722
41811
|
});
|
|
41723
41812
|
|
|
41724
|
-
// ../../node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
41813
|
+
// ../../node_modules/@azure/core-rest-pipeline/node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
41725
41814
|
var require_parse_proxy_response = __commonJS((exports) => {
|
|
41726
41815
|
var __importDefault = exports && exports.__importDefault || function(mod2) {
|
|
41727
41816
|
return mod2 && mod2.__esModule ? mod2 : { default: mod2 };
|
|
@@ -41817,7 +41906,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
41817
41906
|
exports.parseProxyResponse = parseProxyResponse;
|
|
41818
41907
|
});
|
|
41819
41908
|
|
|
41820
|
-
// ../../node_modules/https-proxy-agent/dist/index.js
|
|
41909
|
+
// ../../node_modules/@azure/core-rest-pipeline/node_modules/https-proxy-agent/dist/index.js
|
|
41821
41910
|
var require_dist2 = __commonJS((exports) => {
|
|
41822
41911
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
41823
41912
|
if (k2 === undefined)
|
|
@@ -46837,6 +46926,60 @@ function escapeNonAscii(jsonText) {
|
|
|
46837
46926
|
function needsAsciiSafeJson(sink) {
|
|
46838
46927
|
return process.platform === "win32" && !sink.capabilities.isInteractive;
|
|
46839
46928
|
}
|
|
46929
|
+
function isPlainRecord(value) {
|
|
46930
|
+
if (value === null || typeof value !== "object")
|
|
46931
|
+
return false;
|
|
46932
|
+
const prototype = Object.getPrototypeOf(value);
|
|
46933
|
+
return prototype === Object.prototype || prototype === null;
|
|
46934
|
+
}
|
|
46935
|
+
function toLowerCamelCaseKey(key) {
|
|
46936
|
+
if (!key)
|
|
46937
|
+
return key;
|
|
46938
|
+
if (/[_\-\s]/.test(key)) {
|
|
46939
|
+
const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
|
|
46940
|
+
if (!firstPart)
|
|
46941
|
+
return key;
|
|
46942
|
+
return [
|
|
46943
|
+
toLowerCamelCaseSimpleKey(firstPart),
|
|
46944
|
+
...restParts.map((part) => {
|
|
46945
|
+
const normalized = toLowerCamelCaseSimpleKey(part);
|
|
46946
|
+
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
46947
|
+
})
|
|
46948
|
+
].join("");
|
|
46949
|
+
}
|
|
46950
|
+
return toLowerCamelCaseSimpleKey(key);
|
|
46951
|
+
}
|
|
46952
|
+
function toLowerCamelCaseSimpleKey(key) {
|
|
46953
|
+
if (/^[A-Z0-9]+$/.test(key))
|
|
46954
|
+
return key.toLowerCase();
|
|
46955
|
+
return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
|
|
46956
|
+
}
|
|
46957
|
+
function toPascalCaseKey(key) {
|
|
46958
|
+
const lowerCamelKey = toLowerCamelCaseKey(key);
|
|
46959
|
+
return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
|
|
46960
|
+
}
|
|
46961
|
+
function toPascalCaseData(value) {
|
|
46962
|
+
if (Array.isArray(value))
|
|
46963
|
+
return value.map(toPascalCaseData);
|
|
46964
|
+
if (!isPlainRecord(value))
|
|
46965
|
+
return value;
|
|
46966
|
+
const result = {};
|
|
46967
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
46968
|
+
result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
|
|
46969
|
+
}
|
|
46970
|
+
return result;
|
|
46971
|
+
}
|
|
46972
|
+
function normalizeDataKeys(data) {
|
|
46973
|
+
return toPascalCaseData(data);
|
|
46974
|
+
}
|
|
46975
|
+
function normalizeOutputKeys(data) {
|
|
46976
|
+
const result = {};
|
|
46977
|
+
for (const [key, value] of Object.entries(data)) {
|
|
46978
|
+
const pascalKey = toPascalCaseKey(key);
|
|
46979
|
+
result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
|
|
46980
|
+
}
|
|
46981
|
+
return result;
|
|
46982
|
+
}
|
|
46840
46983
|
function printOutput(data, format2 = "json", logFn, asciiSafe = false) {
|
|
46841
46984
|
if (!data) {
|
|
46842
46985
|
logFn("Empty response object. No data to display.");
|
|
@@ -46899,7 +47042,7 @@ function wrapText(text, width) {
|
|
|
46899
47042
|
function printTable(data, logFn, externalLogValue) {
|
|
46900
47043
|
if (data.length === 0)
|
|
46901
47044
|
return;
|
|
46902
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
47045
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
46903
47046
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
46904
47047
|
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
46905
47048
|
logFn(header);
|
|
@@ -46914,7 +47057,7 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
46914
47057
|
}
|
|
46915
47058
|
}
|
|
46916
47059
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
46917
|
-
const keys = Object.keys(data).filter((key) =>
|
|
47060
|
+
const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
46918
47061
|
if (keys.length === 0)
|
|
46919
47062
|
return;
|
|
46920
47063
|
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
@@ -46930,7 +47073,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
46930
47073
|
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
46931
47074
|
if (data.length === 0)
|
|
46932
47075
|
return;
|
|
46933
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
47076
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
46934
47077
|
if (keys.length === 0)
|
|
46935
47078
|
return;
|
|
46936
47079
|
if (!process.stdout.isTTY) {
|
|
@@ -47015,7 +47158,12 @@ function validateOutputFilter(filter) {
|
|
|
47015
47158
|
}
|
|
47016
47159
|
}
|
|
47017
47160
|
function applyFilter(data, filter) {
|
|
47018
|
-
|
|
47161
|
+
let result;
|
|
47162
|
+
try {
|
|
47163
|
+
result = search(data, filter);
|
|
47164
|
+
} catch (err) {
|
|
47165
|
+
throw new FilterEvaluationError(filter, err);
|
|
47166
|
+
}
|
|
47019
47167
|
if (result == null)
|
|
47020
47168
|
return [];
|
|
47021
47169
|
if (Array.isArray(result)) {
|
|
@@ -47030,7 +47178,7 @@ function applyFilter(data, filter) {
|
|
|
47030
47178
|
return result;
|
|
47031
47179
|
return { Value: result };
|
|
47032
47180
|
}
|
|
47033
|
-
var RESULTS, EXIT_CODES, OutputFormatter;
|
|
47181
|
+
var RESULTS, EXIT_CODES, FilterEvaluationError, OutputFormatter;
|
|
47034
47182
|
var init_formatter = __esm(() => {
|
|
47035
47183
|
init_dist();
|
|
47036
47184
|
init_js_yaml();
|
|
@@ -47055,14 +47203,32 @@ var init_formatter = __esm(() => {
|
|
|
47055
47203
|
ValidationError: 3,
|
|
47056
47204
|
TimeoutError: 4
|
|
47057
47205
|
};
|
|
47206
|
+
FilterEvaluationError = class FilterEvaluationError extends Error {
|
|
47207
|
+
__brand = "FilterEvaluationError";
|
|
47208
|
+
filter;
|
|
47209
|
+
instructions;
|
|
47210
|
+
result = RESULTS.ValidationError;
|
|
47211
|
+
constructor(filter, cause) {
|
|
47212
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
47213
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
47214
|
+
this.name = "FilterEvaluationError";
|
|
47215
|
+
this.filter = filter;
|
|
47216
|
+
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
47217
|
+
}
|
|
47218
|
+
};
|
|
47058
47219
|
((OutputFormatter) => {
|
|
47059
|
-
function success(data) {
|
|
47220
|
+
function success(data, options) {
|
|
47060
47221
|
data.Log ??= getLogFilePath() || undefined;
|
|
47222
|
+
const normalize = !options?.preserveDataKeys;
|
|
47223
|
+
if (normalize) {
|
|
47224
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
47225
|
+
}
|
|
47061
47226
|
const filter = getOutputFilter();
|
|
47062
47227
|
if (filter) {
|
|
47063
|
-
|
|
47228
|
+
const filtered = applyFilter(data.Data, filter);
|
|
47229
|
+
data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
|
|
47064
47230
|
}
|
|
47065
|
-
logOutput(data, getOutputFormat());
|
|
47231
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
47066
47232
|
}
|
|
47067
47233
|
OutputFormatter.success = success;
|
|
47068
47234
|
function error(data) {
|
|
@@ -47072,7 +47238,7 @@ var init_formatter = __esm(() => {
|
|
|
47072
47238
|
result: data.Result,
|
|
47073
47239
|
message: data.Message
|
|
47074
47240
|
});
|
|
47075
|
-
logOutput(data, getOutputFormat());
|
|
47241
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
47076
47242
|
}
|
|
47077
47243
|
OutputFormatter.error = error;
|
|
47078
47244
|
function emitList(code, items, opts) {
|
|
@@ -47093,13 +47259,14 @@ var init_formatter = __esm(() => {
|
|
|
47093
47259
|
function log(data) {
|
|
47094
47260
|
const format2 = getOutputFormat();
|
|
47095
47261
|
const sink = getOutputSink();
|
|
47262
|
+
const normalized = toPascalCaseData(data);
|
|
47096
47263
|
if (format2 === "json") {
|
|
47097
|
-
const json2 = JSON.stringify(
|
|
47264
|
+
const json2 = JSON.stringify(normalized);
|
|
47098
47265
|
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
|
|
47099
47266
|
sink.writeErr(`${safe}
|
|
47100
47267
|
`);
|
|
47101
47268
|
} else {
|
|
47102
|
-
for (const [key, value] of Object.entries(
|
|
47269
|
+
for (const [key, value] of Object.entries(normalized)) {
|
|
47103
47270
|
sink.writeErr(`${key}: ${value}
|
|
47104
47271
|
`);
|
|
47105
47272
|
}
|
|
@@ -47108,12 +47275,16 @@ var init_formatter = __esm(() => {
|
|
|
47108
47275
|
OutputFormatter.log = log;
|
|
47109
47276
|
function formatToString(data) {
|
|
47110
47277
|
const filter = getOutputFilter();
|
|
47111
|
-
if (
|
|
47112
|
-
data.Data =
|
|
47278
|
+
if ("Data" in data && data.Data != null) {
|
|
47279
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
47280
|
+
if (filter) {
|
|
47281
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
|
|
47282
|
+
}
|
|
47113
47283
|
}
|
|
47284
|
+
const output = normalizeOutputKeys(data);
|
|
47114
47285
|
const lines = [];
|
|
47115
47286
|
const sink = getOutputSink();
|
|
47116
|
-
printOutput(
|
|
47287
|
+
printOutput(output, getOutputFormat(), (msg) => {
|
|
47117
47288
|
lines.push(msg);
|
|
47118
47289
|
}, needsAsciiSafeJson(sink));
|
|
47119
47290
|
return lines.join(`
|
|
@@ -48587,7 +48758,28 @@ var init_abort_controller = __esm(() => {
|
|
|
48587
48758
|
init_logger();
|
|
48588
48759
|
});
|
|
48589
48760
|
// ../common/src/polling/types.ts
|
|
48590
|
-
var
|
|
48761
|
+
var PollOutcome;
|
|
48762
|
+
var init_types = __esm(() => {
|
|
48763
|
+
PollOutcome = {
|
|
48764
|
+
Completed: "completed",
|
|
48765
|
+
Timeout: "timeout",
|
|
48766
|
+
Interrupted: "interrupted",
|
|
48767
|
+
Aborted: "aborted",
|
|
48768
|
+
Failed: "failed"
|
|
48769
|
+
};
|
|
48770
|
+
});
|
|
48771
|
+
|
|
48772
|
+
// ../common/src/polling/poll-failure-mapping.ts
|
|
48773
|
+
var REASON_BY_OUTCOME;
|
|
48774
|
+
var init_poll_failure_mapping = __esm(() => {
|
|
48775
|
+
init_types();
|
|
48776
|
+
REASON_BY_OUTCOME = {
|
|
48777
|
+
[PollOutcome.Timeout]: "poll_timeout",
|
|
48778
|
+
[PollOutcome.Failed]: "poll_failed",
|
|
48779
|
+
[PollOutcome.Interrupted]: "poll_failed",
|
|
48780
|
+
[PollOutcome.Aborted]: "poll_aborted"
|
|
48781
|
+
};
|
|
48782
|
+
});
|
|
48591
48783
|
|
|
48592
48784
|
// ../common/src/polling/poll-until.ts
|
|
48593
48785
|
var init_poll_until = __esm(() => {
|
|
@@ -48620,6 +48812,7 @@ var init_terminal_statuses = __esm(() => {
|
|
|
48620
48812
|
// ../common/src/polling/index.ts
|
|
48621
48813
|
var init_polling = __esm(() => {
|
|
48622
48814
|
init_abort_controller();
|
|
48815
|
+
init_poll_failure_mapping();
|
|
48623
48816
|
init_poll_until();
|
|
48624
48817
|
init_terminal_statuses();
|
|
48625
48818
|
init_types();
|
|
@@ -48638,6 +48831,20 @@ var init_screen_logger = __esm(() => {
|
|
|
48638
48831
|
})(ScreenLogger ||= {});
|
|
48639
48832
|
});
|
|
48640
48833
|
|
|
48834
|
+
// ../common/src/sdk-user-agent.ts
|
|
48835
|
+
function setSdkUserAgentHostToken(token) {
|
|
48836
|
+
if (token === undefined) {
|
|
48837
|
+
sdkUserAgentHostToken.clear();
|
|
48838
|
+
return;
|
|
48839
|
+
}
|
|
48840
|
+
sdkUserAgentHostToken.set(token);
|
|
48841
|
+
}
|
|
48842
|
+
var sdkUserAgentHostToken;
|
|
48843
|
+
var init_sdk_user_agent = __esm(() => {
|
|
48844
|
+
init_singleton();
|
|
48845
|
+
sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
48846
|
+
});
|
|
48847
|
+
|
|
48641
48848
|
// ../common/src/tool-provider.ts
|
|
48642
48849
|
function setPackagerFactoryProvider(provider) {
|
|
48643
48850
|
factorySlot.set(provider);
|
|
@@ -48840,13 +49047,17 @@ var init_trackedAction = __esm(() => {
|
|
|
48840
49047
|
const [error] = await catchError(fn(...args));
|
|
48841
49048
|
if (error) {
|
|
48842
49049
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
48843
|
-
logger.
|
|
49050
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
49051
|
+
const typed = error;
|
|
49052
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
49053
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
49054
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
48844
49055
|
OutputFormatter.error({
|
|
48845
|
-
Result:
|
|
49056
|
+
Result: finalResult,
|
|
48846
49057
|
Message: errorMessage,
|
|
48847
|
-
Instructions: "An unexpected error occurred. Run with --log-level debug for details."
|
|
49058
|
+
Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
|
|
48848
49059
|
});
|
|
48849
|
-
context.exit(
|
|
49060
|
+
context.exit(EXIT_CODES[finalResult]);
|
|
48850
49061
|
}
|
|
48851
49062
|
const durationMs = performance.now() - startTime;
|
|
48852
49063
|
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
@@ -48882,6 +49093,7 @@ var init_src2 = __esm(() => {
|
|
|
48882
49093
|
init_polling();
|
|
48883
49094
|
init_registry();
|
|
48884
49095
|
init_screen_logger();
|
|
49096
|
+
init_sdk_user_agent();
|
|
48885
49097
|
init_singleton();
|
|
48886
49098
|
init_node2();
|
|
48887
49099
|
init_telemetry_events();
|
|
@@ -48895,7 +49107,8 @@ var package_default;
|
|
|
48895
49107
|
var init_package = __esm(() => {
|
|
48896
49108
|
package_default = {
|
|
48897
49109
|
name: "@uipath/cli",
|
|
48898
|
-
|
|
49110
|
+
license: "MIT",
|
|
49111
|
+
version: "1.195.0",
|
|
48899
49112
|
description: "Cross platform CLI for UiPath",
|
|
48900
49113
|
repository: {
|
|
48901
49114
|
type: "git",
|
|
@@ -48936,6 +49149,7 @@ var init_package = __esm(() => {
|
|
|
48936
49149
|
devDependencies: {
|
|
48937
49150
|
"@inquirer/prompts": "^8.3.2",
|
|
48938
49151
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
49152
|
+
"@playwright/test": "^1.60.0",
|
|
48939
49153
|
"@types/bun": "^1.3.11",
|
|
48940
49154
|
"@types/node": "^25.5.2",
|
|
48941
49155
|
"@uipath/auth": "workspace:*",
|
|
@@ -48946,6 +49160,7 @@ var init_package = __esm(() => {
|
|
|
48946
49160
|
esbuild: "^0.27.3",
|
|
48947
49161
|
"js-yaml": "^4.1.0",
|
|
48948
49162
|
ora: "^9.3.0",
|
|
49163
|
+
"path-browserify": "^1.0.1",
|
|
48949
49164
|
typescript: "^6.0.2",
|
|
48950
49165
|
zod: "^4.3.6"
|
|
48951
49166
|
}
|
|
@@ -49011,6 +49226,9 @@ function stripGlobalOptions(args) {
|
|
|
49011
49226
|
const cleaned = [];
|
|
49012
49227
|
let format2;
|
|
49013
49228
|
let formatWasExplicit = false;
|
|
49229
|
+
let sawJsonAlias = false;
|
|
49230
|
+
let sawOutputOption = false;
|
|
49231
|
+
let outputConflict = false;
|
|
49014
49232
|
let filter;
|
|
49015
49233
|
let logLevel;
|
|
49016
49234
|
let logFile;
|
|
@@ -49024,22 +49242,55 @@ function stripGlobalOptions(args) {
|
|
|
49024
49242
|
filter = args[i2].substring("--output-filter=".length);
|
|
49025
49243
|
continue;
|
|
49026
49244
|
}
|
|
49027
|
-
if (args[i2] === "--
|
|
49028
|
-
|
|
49029
|
-
|
|
49030
|
-
|
|
49031
|
-
|
|
49032
|
-
|
|
49245
|
+
if (args[i2] === "--json") {
|
|
49246
|
+
sawJsonAlias = true;
|
|
49247
|
+
format2 = "json";
|
|
49248
|
+
formatWasExplicit = true;
|
|
49249
|
+
if (sawOutputOption) {
|
|
49250
|
+
outputConflict = true;
|
|
49251
|
+
}
|
|
49252
|
+
continue;
|
|
49253
|
+
}
|
|
49254
|
+
if (args[i2] === "--output") {
|
|
49255
|
+
sawOutputOption = true;
|
|
49256
|
+
if (sawJsonAlias) {
|
|
49257
|
+
outputConflict = true;
|
|
49258
|
+
}
|
|
49259
|
+
if (i2 + 1 < args.length) {
|
|
49260
|
+
const v = args[i2 + 1];
|
|
49261
|
+
if (VALID_FORMATS.includes(v)) {
|
|
49262
|
+
if (!sawJsonAlias) {
|
|
49263
|
+
format2 = v;
|
|
49264
|
+
}
|
|
49265
|
+
formatWasExplicit = true;
|
|
49266
|
+
i2++;
|
|
49267
|
+
continue;
|
|
49268
|
+
}
|
|
49269
|
+
if (sawJsonAlias) {
|
|
49270
|
+
i2++;
|
|
49271
|
+
continue;
|
|
49272
|
+
}
|
|
49273
|
+
}
|
|
49274
|
+
if (sawJsonAlias) {
|
|
49033
49275
|
continue;
|
|
49034
49276
|
}
|
|
49035
49277
|
}
|
|
49036
49278
|
if (args[i2]?.startsWith("--output=")) {
|
|
49279
|
+
sawOutputOption = true;
|
|
49280
|
+
if (sawJsonAlias) {
|
|
49281
|
+
outputConflict = true;
|
|
49282
|
+
}
|
|
49037
49283
|
const v = args[i2].substring("--output=".length);
|
|
49038
49284
|
if (VALID_FORMATS.includes(v)) {
|
|
49039
|
-
|
|
49285
|
+
if (!sawJsonAlias) {
|
|
49286
|
+
format2 = v;
|
|
49287
|
+
}
|
|
49040
49288
|
formatWasExplicit = true;
|
|
49041
49289
|
continue;
|
|
49042
49290
|
}
|
|
49291
|
+
if (sawJsonAlias) {
|
|
49292
|
+
continue;
|
|
49293
|
+
}
|
|
49043
49294
|
}
|
|
49044
49295
|
if (args[i2] === "--log-level" && i2 + 1 < args.length) {
|
|
49045
49296
|
const parsed = VALID_LOG_LEVELS[args[i2 + 1].toLowerCase()];
|
|
@@ -49073,6 +49324,7 @@ function stripGlobalOptions(args) {
|
|
|
49073
49324
|
args: cleaned,
|
|
49074
49325
|
format: resolvedFormat,
|
|
49075
49326
|
formatWasExplicit,
|
|
49327
|
+
outputConflict,
|
|
49076
49328
|
filter,
|
|
49077
49329
|
logLevel,
|
|
49078
49330
|
logFile
|
|
@@ -49480,7 +49732,7 @@ var init_helpFormatter = __esm(() => {
|
|
|
49480
49732
|
},
|
|
49481
49733
|
{
|
|
49482
49734
|
Flags: "--output-filter <expression>",
|
|
49483
|
-
Description: "JMESPath expression to
|
|
49735
|
+
Description: "JMESPath expression applied to the Data field of the response envelope"
|
|
49484
49736
|
},
|
|
49485
49737
|
{
|
|
49486
49738
|
Flags: "--log-level <debug|info|warn|error>",
|
|
@@ -49595,6 +49847,7 @@ function validateAndSetOutputFilter(filter, context) {
|
|
|
49595
49847
|
return true;
|
|
49596
49848
|
}
|
|
49597
49849
|
async function initProgram(context, hooks2 = {}) {
|
|
49850
|
+
setSdkUserAgentHostToken(`uip/${package_default.version}`);
|
|
49598
49851
|
const program2 = new Command;
|
|
49599
49852
|
program2.name("uip").description(`UiPath CLI ${package_default.version}`).version(package_default.version, "-v, --version").enablePositionalOptions();
|
|
49600
49853
|
const globalOptions = stripGlobalOptions(context.args);
|
|
@@ -49602,6 +49855,7 @@ async function initProgram(context, hooks2 = {}) {
|
|
|
49602
49855
|
args: cleanedArgs,
|
|
49603
49856
|
format: helpFormat,
|
|
49604
49857
|
formatWasExplicit,
|
|
49858
|
+
outputConflict,
|
|
49605
49859
|
filter,
|
|
49606
49860
|
logLevel,
|
|
49607
49861
|
logFile
|
|
@@ -49622,6 +49876,15 @@ async function initProgram(context, hooks2 = {}) {
|
|
|
49622
49876
|
if (overrides.onLoggerReady) {
|
|
49623
49877
|
overrides.onLoggerReady();
|
|
49624
49878
|
}
|
|
49879
|
+
if (outputConflict) {
|
|
49880
|
+
OutputFormatter.error({
|
|
49881
|
+
Result: RESULTS.ValidationError,
|
|
49882
|
+
Message: "error: option '--json' cannot be used with option '--output'",
|
|
49883
|
+
Instructions: "Use either --json or --output <format>, not both."
|
|
49884
|
+
});
|
|
49885
|
+
context.exit(EXIT_CODES.ValidationError);
|
|
49886
|
+
return null;
|
|
49887
|
+
}
|
|
49625
49888
|
if (!validateAndSetOutputFilter(filter, context)) {
|
|
49626
49889
|
return null;
|
|
49627
49890
|
}
|
|
@@ -53745,7 +54008,7 @@ var init_globalNpmRoot = __esm(() => {
|
|
|
53745
54008
|
});
|
|
53746
54009
|
|
|
53747
54010
|
// src/services/tools-whitelist.ts
|
|
53748
|
-
var TOOLS_WHITELIST, WHITELIST_BY_COMMAND, WHITELIST_BY_SHORT_NAME;
|
|
54011
|
+
var TOOLS_WHITELIST, COMMAND_ALIASES, ALIASES_BY_COMMAND, WHITELIST_BY_COMMAND, WHITELIST_BY_SHORT_NAME;
|
|
53749
54012
|
var init_tools_whitelist = __esm(() => {
|
|
53750
54013
|
TOOLS_WHITELIST = new Map([
|
|
53751
54014
|
["@uipath/solution-tool", "solution"],
|
|
@@ -53771,11 +54034,32 @@ var init_tools_whitelist = __esm(() => {
|
|
|
53771
54034
|
["@uipath/data-fabric-tool", "df"],
|
|
53772
54035
|
["@uipath/insights-tool", "insights"],
|
|
53773
54036
|
["@uipath/tasks-tool", "tasks"],
|
|
53774
|
-
["@uipath/
|
|
54037
|
+
["@uipath/aops-tool", "aops"],
|
|
53775
54038
|
["@uipath/llmgw-tool", "llm-configuration"],
|
|
53776
|
-
["@uipath/platform-tool", "platform"]
|
|
54039
|
+
["@uipath/platform-tool", "platform"],
|
|
54040
|
+
["@uipath/ixp-tool", "ixp"]
|
|
53777
54041
|
]);
|
|
53778
|
-
|
|
54042
|
+
COMMAND_ALIASES = new Map([
|
|
54043
|
+
["orchestrator", "or"]
|
|
54044
|
+
]);
|
|
54045
|
+
ALIASES_BY_COMMAND = (() => {
|
|
54046
|
+
const map2 = new Map;
|
|
54047
|
+
for (const [alias, canonical] of COMMAND_ALIASES) {
|
|
54048
|
+
const list = map2.get(canonical) ?? [];
|
|
54049
|
+
list.push(alias);
|
|
54050
|
+
map2.set(canonical, list);
|
|
54051
|
+
}
|
|
54052
|
+
return map2;
|
|
54053
|
+
})();
|
|
54054
|
+
WHITELIST_BY_COMMAND = (() => {
|
|
54055
|
+
const map2 = new Map([...TOOLS_WHITELIST.entries()].map(([pkg, cmd]) => [cmd, pkg]));
|
|
54056
|
+
for (const [alias, canonical] of COMMAND_ALIASES) {
|
|
54057
|
+
const pkg = [...TOOLS_WHITELIST.entries()].find(([, cmd]) => cmd === canonical)?.[0];
|
|
54058
|
+
if (pkg)
|
|
54059
|
+
map2.set(alias, pkg);
|
|
54060
|
+
}
|
|
54061
|
+
return map2;
|
|
54062
|
+
})();
|
|
53779
54063
|
WHITELIST_BY_SHORT_NAME = new Map([...TOOLS_WHITELIST.keys()].map((pkg) => [
|
|
53780
54064
|
pkg.replace(/^@uipath\//, ""),
|
|
53781
54065
|
pkg
|
|
@@ -54222,6 +54506,10 @@ ${errors4.map((e) => ` - ${e}`).join(`
|
|
|
54222
54506
|
if (authToken)
|
|
54223
54507
|
headers.Authorization = `Bearer ${authToken}`;
|
|
54224
54508
|
const info = await this.fetchPackageInfo(registryUrl, packageName, headers, options?.timeoutMs);
|
|
54509
|
+
if (options?.exact !== undefined && info.availableVersions?.includes(options.exact)) {
|
|
54510
|
+
logger.debug(`Resolved version: ${options.exact} (exact pin match)`);
|
|
54511
|
+
return options.exact;
|
|
54512
|
+
}
|
|
54225
54513
|
if (versionPrefix && info.availableVersions) {
|
|
54226
54514
|
const matching = info.availableVersions.filter((v) => v.startsWith(versionPrefix));
|
|
54227
54515
|
const picked = pickForChannel(matching, channel);
|
|
@@ -70008,7 +70296,7 @@ var init_zod = __esm(() => {
|
|
|
70008
70296
|
});
|
|
70009
70297
|
|
|
70010
70298
|
// src/config/loadConfig.ts
|
|
70011
|
-
var ConfigSchema, SECRET_FIELD_PATHS, formatZodError = (error51) => {
|
|
70299
|
+
var VERSION_PIN_RE, ConfigSchema, SECRET_FIELD_PATHS, formatZodError = (error51) => {
|
|
70012
70300
|
const issues = error51.issues.map((issue2) => {
|
|
70013
70301
|
const path6 = issue2.path.join(".") || "config";
|
|
70014
70302
|
let message = issue2.message;
|
|
@@ -70103,11 +70391,13 @@ Please ensure your config file contains valid JSON.`);
|
|
|
70103
70391
|
var init_loadConfig = __esm(() => {
|
|
70104
70392
|
init_src2();
|
|
70105
70393
|
init_zod();
|
|
70394
|
+
VERSION_PIN_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
|
|
70106
70395
|
ConfigSchema = exports_external.object({
|
|
70107
70396
|
core: exports_external.object({
|
|
70108
70397
|
output: exports_external.enum(["table", "json", "yaml", "plain", "text"]).transform((v) => v === "text" ? "plain" : v).optional(),
|
|
70109
70398
|
logLevel: exports_external.enum(["error", "warn", "info", "debug"]).optional(),
|
|
70110
|
-
updateChannel: exports_external.enum(["alpha", "beta", "stable"]).optional()
|
|
70399
|
+
updateChannel: exports_external.enum(["alpha", "beta", "stable"]).optional(),
|
|
70400
|
+
version: exports_external.string().regex(VERSION_PIN_RE, "must be major.minor or major.minor.patch (e.g. 1.2 or 1.2.3)").optional()
|
|
70111
70401
|
}).optional(),
|
|
70112
70402
|
auth: exports_external.object({
|
|
70113
70403
|
clientId: exports_external.string().min(1).optional(),
|
|
@@ -70132,8 +70422,42 @@ var init_loadConfig = __esm(() => {
|
|
|
70132
70422
|
LOCAL_CONFIG_REL = `${UIPATH_HOME_DIR}/${CONFIG_FILENAME}`;
|
|
70133
70423
|
});
|
|
70134
70424
|
|
|
70425
|
+
// src/services/versionPin.ts
|
|
70426
|
+
function isValidVersionPin(raw) {
|
|
70427
|
+
return VERSION_PIN_RE.test(raw.trim());
|
|
70428
|
+
}
|
|
70429
|
+
function parseVersionPin(raw) {
|
|
70430
|
+
if (raw === undefined)
|
|
70431
|
+
return null;
|
|
70432
|
+
const match = VERSION_PIN_RE.exec(raw.trim());
|
|
70433
|
+
if (!match)
|
|
70434
|
+
return null;
|
|
70435
|
+
const pin = {
|
|
70436
|
+
major: Number(match[1]),
|
|
70437
|
+
minor: Number(match[2])
|
|
70438
|
+
};
|
|
70439
|
+
if (match[3] !== undefined)
|
|
70440
|
+
pin.patch = Number(match[3]);
|
|
70441
|
+
return pin;
|
|
70442
|
+
}
|
|
70443
|
+
function resolvePinnedVersion() {
|
|
70444
|
+
return parseVersionPin(getCachedConfig().core?.version);
|
|
70445
|
+
}
|
|
70446
|
+
function isExactPin(pin) {
|
|
70447
|
+
return pin.patch !== undefined;
|
|
70448
|
+
}
|
|
70449
|
+
function pinnedPrefix(pin) {
|
|
70450
|
+
return `${pin.major}.${pin.minor}.`;
|
|
70451
|
+
}
|
|
70452
|
+
function formatVersionPin(pin) {
|
|
70453
|
+
return isExactPin(pin) ? `${pin.major}.${pin.minor}.${pin.patch}` : `${pin.major}.${pin.minor}`;
|
|
70454
|
+
}
|
|
70455
|
+
var init_versionPin = __esm(() => {
|
|
70456
|
+
init_loadConfig();
|
|
70457
|
+
});
|
|
70458
|
+
|
|
70135
70459
|
// src/commands/config.ts
|
|
70136
|
-
import { randomUUID as
|
|
70460
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
70137
70461
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
70138
70462
|
async function resolveForRead(explicit) {
|
|
70139
70463
|
const r = await resolveConfigFilePathAsync(explicit);
|
|
@@ -70179,7 +70503,7 @@ async function withConfigLock(targetPath, fn) {
|
|
|
70179
70503
|
const [statErr, stats] = await catchError(fs7.stat(lockPath));
|
|
70180
70504
|
const lockMissing = !statErr && stats === null;
|
|
70181
70505
|
const lockHeld = !statErr && stats !== null;
|
|
70182
|
-
const stale = lockHeld && Date.now() - stats.mtimeMs >
|
|
70506
|
+
const stale = lockHeld && Date.now() - stats.mtimeMs > LOCK_STALE_MS2;
|
|
70183
70507
|
if (lockMissing || stale) {
|
|
70184
70508
|
const [writeErr] = await catchError(fs7.writeFile(lockPath, myToken));
|
|
70185
70509
|
if (!writeErr) {
|
|
@@ -70205,7 +70529,7 @@ async function writeConfigFileAt(path6, config2) {
|
|
|
70205
70529
|
const fs7 = getFileSystem();
|
|
70206
70530
|
const dir = fs7.path.dirname(path6);
|
|
70207
70531
|
await fs7.mkdir(dir);
|
|
70208
|
-
const tempPath = `${path6}.${
|
|
70532
|
+
const tempPath = `${path6}.${randomUUID3()}.tmp`;
|
|
70209
70533
|
await fs7.writeFile(tempPath, JSON.stringify(config2, null, 4));
|
|
70210
70534
|
const [renameErr] = await catchError(fs7.rename(tempPath, path6));
|
|
70211
70535
|
if (renameErr) {
|
|
@@ -70317,7 +70641,7 @@ function registerConfigCommand(program2, context) {
|
|
|
70317
70641
|
}
|
|
70318
70642
|
});
|
|
70319
70643
|
});
|
|
70320
|
-
config2.command("set").description("Set a configuration value (writes to the discovered file, or to ~/.uipath/config.json by default)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).argument("<value>", "New value").option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_SET_EXAMPLES).trackedAction(context, async (key,
|
|
70644
|
+
config2.command("set").description("Set a configuration value (writes to the discovered file, or to ~/.uipath/config.json by default)").argument("<key>", `Config key (${VALID_KEY_NAMES.join(", ")})`).argument("<value>", "New value").option("-c, --config-file <path>", "Path to a specific config file (overrides discovery)").examples(CONFIG_SET_EXAMPLES).trackedAction(context, async (key, rawValue, options) => {
|
|
70321
70645
|
if (!(key in CONFIG_KEYS)) {
|
|
70322
70646
|
OutputFormatter.error({
|
|
70323
70647
|
Result: RESULTS.ValidationError,
|
|
@@ -70328,6 +70652,7 @@ function registerConfigCommand(program2, context) {
|
|
|
70328
70652
|
return;
|
|
70329
70653
|
}
|
|
70330
70654
|
const def = CONFIG_KEYS[key];
|
|
70655
|
+
const value = def.normalize ? def.normalize(rawValue) : rawValue;
|
|
70331
70656
|
if (def.validValues !== undefined && !def.validValues.includes(value)) {
|
|
70332
70657
|
OutputFormatter.error({
|
|
70333
70658
|
Result: RESULTS.ValidationError,
|
|
@@ -70337,6 +70662,15 @@ function registerConfigCommand(program2, context) {
|
|
|
70337
70662
|
context.exit(1);
|
|
70338
70663
|
return;
|
|
70339
70664
|
}
|
|
70665
|
+
if (def.validate && !def.validate(value)) {
|
|
70666
|
+
OutputFormatter.error({
|
|
70667
|
+
Result: RESULTS.ValidationError,
|
|
70668
|
+
Message: `Invalid value '${value}' for '${key}'`,
|
|
70669
|
+
Instructions: def.valueHint ?? "See documentation for valid values."
|
|
70670
|
+
});
|
|
70671
|
+
context.exit(1);
|
|
70672
|
+
return;
|
|
70673
|
+
}
|
|
70340
70674
|
const target = await resolveForWrite(options.configFile);
|
|
70341
70675
|
const [opErr] = await catchError(withConfigLock(target.path, async () => {
|
|
70342
70676
|
const rawConfig = await readConfigFileAt(target.path);
|
|
@@ -70363,11 +70697,12 @@ function registerConfigCommand(program2, context) {
|
|
|
70363
70697
|
});
|
|
70364
70698
|
});
|
|
70365
70699
|
}
|
|
70366
|
-
var CONFIG_KEYS, VALID_KEY_NAMES, CONFIG_GET_EXAMPLES, CONFIG_SET_EXAMPLES,
|
|
70700
|
+
var CONFIG_KEYS, VALID_KEY_NAMES, CONFIG_GET_EXAMPLES, CONFIG_SET_EXAMPLES, LOCK_STALE_MS2 = 1000, LOCK_RETRY_MS = 50, LOCK_TIMEOUT_MS = 1e4, LOCK_VERIFY_DELAY_MS = 25, lockToken = () => `${process.pid ?? 0}.${randomUUID3()}`, SECRET_WORD_TOKENS, REDACTED_VALUE = "<redacted>", SECRET_PATH_SET;
|
|
70367
70701
|
var init_config = __esm(() => {
|
|
70368
70702
|
init_src2();
|
|
70369
70703
|
init_src();
|
|
70370
70704
|
init_loadConfig();
|
|
70705
|
+
init_versionPin();
|
|
70371
70706
|
CONFIG_KEYS = {
|
|
70372
70707
|
output: {
|
|
70373
70708
|
path: ["core", "output"],
|
|
@@ -70383,6 +70718,13 @@ var init_config = __esm(() => {
|
|
|
70383
70718
|
path: ["core", "updateChannel"],
|
|
70384
70719
|
validValues: ["alpha", "beta", "stable"],
|
|
70385
70720
|
description: "Release channel used to resolve tool updates"
|
|
70721
|
+
},
|
|
70722
|
+
version: {
|
|
70723
|
+
path: ["core", "version"],
|
|
70724
|
+
normalize: (v) => v.trim(),
|
|
70725
|
+
validate: (v) => isValidVersionPin(v),
|
|
70726
|
+
valueHint: "Use major.minor or major.minor.patch (e.g. 1.2 or 1.2.3).",
|
|
70727
|
+
description: "Pinned platform version enforced by 'uip update' (CLI + tools)"
|
|
70386
70728
|
}
|
|
70387
70729
|
};
|
|
70388
70730
|
VALID_KEY_NAMES = Object.keys(CONFIG_KEYS);
|
|
@@ -70551,7 +70893,8 @@ var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00", AUTH_FILE_CONFIG
|
|
|
70551
70893
|
if (!clientSecret && fileAuth.clientSecret) {
|
|
70552
70894
|
clientSecret = fileAuth.clientSecret;
|
|
70553
70895
|
}
|
|
70554
|
-
const
|
|
70896
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
|
|
70897
|
+
const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
|
|
70555
70898
|
return {
|
|
70556
70899
|
clientId,
|
|
70557
70900
|
clientSecret,
|
|
@@ -70582,32 +70925,7 @@ var init_config2 = __esm(() => {
|
|
|
70582
70925
|
this.name = "InvalidBaseUrlError";
|
|
70583
70926
|
}
|
|
70584
70927
|
};
|
|
70585
|
-
DEFAULT_SCOPES = [
|
|
70586
|
-
"offline_access",
|
|
70587
|
-
"ProcessMining",
|
|
70588
|
-
"OrchestratorApiUserAccess",
|
|
70589
|
-
"StudioWebBackend",
|
|
70590
|
-
"IdentityServerApi",
|
|
70591
|
-
"ConnectionService",
|
|
70592
|
-
"DataService",
|
|
70593
|
-
"DataServiceApiUserAccess",
|
|
70594
|
-
"DocumentUnderstanding",
|
|
70595
|
-
"EnterpriseContextService",
|
|
70596
|
-
"Directory",
|
|
70597
|
-
"JamJamApi",
|
|
70598
|
-
"LLMGateway",
|
|
70599
|
-
"LLMOps",
|
|
70600
|
-
"OMS",
|
|
70601
|
-
"RCS.FolderAuthorization",
|
|
70602
|
-
"RCS.TagsManagement",
|
|
70603
|
-
"TestmanagerApiUserAccess",
|
|
70604
|
-
"AutomationSolutions",
|
|
70605
|
-
"StudioWebTypeCacheService",
|
|
70606
|
-
"Docs.GPT.Search",
|
|
70607
|
-
"Insights",
|
|
70608
|
-
"ReferenceToken",
|
|
70609
|
-
"Audit.Read"
|
|
70610
|
-
];
|
|
70928
|
+
DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
70611
70929
|
});
|
|
70612
70930
|
|
|
70613
70931
|
// ../../node_modules/oauth4webapi/build/index.js
|
|
@@ -71379,7 +71697,7 @@ var init_envAuth = __esm(() => {
|
|
|
71379
71697
|
|
|
71380
71698
|
// ../../node_modules/@uipath/coreipc/index.js
|
|
71381
71699
|
var require_coreipc = __commonJS((exports, module) => {
|
|
71382
|
-
var __dirname = "/
|
|
71700
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
|
|
71383
71701
|
/*! For license information please see index.js.LICENSE.txt */
|
|
71384
71702
|
(function(e, t) {
|
|
71385
71703
|
typeof exports == "object" && typeof module == "object" ? module.exports = t() : typeof define == "function" && define.amd ? define([], t) : typeof exports == "object" ? exports.ipc = t() : e.ipc = t();
|
|
@@ -89917,6 +90235,129 @@ function normalizeTokenRefreshFailure() {
|
|
|
89917
90235
|
function normalizeTokenRefreshUnavailableFailure() {
|
|
89918
90236
|
return "token refresh failed before authentication completed";
|
|
89919
90237
|
}
|
|
90238
|
+
function errorMessage2(error51) {
|
|
90239
|
+
return error51 instanceof Error ? error51.message : String(error51);
|
|
90240
|
+
}
|
|
90241
|
+
function computeExpirationThreshold(ensureTokenValidityMinutes) {
|
|
90242
|
+
return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
|
|
90243
|
+
}
|
|
90244
|
+
async function runRefreshLocked(inputs) {
|
|
90245
|
+
const {
|
|
90246
|
+
absolutePath,
|
|
90247
|
+
refreshToken: callerRefreshToken,
|
|
90248
|
+
customAuthority,
|
|
90249
|
+
ensureTokenValidityMinutes,
|
|
90250
|
+
loadEnvFile,
|
|
90251
|
+
saveEnvFile,
|
|
90252
|
+
refreshFn,
|
|
90253
|
+
resolveConfig
|
|
90254
|
+
} = inputs;
|
|
90255
|
+
const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
90256
|
+
let fresh;
|
|
90257
|
+
try {
|
|
90258
|
+
fresh = await loadEnvFile({ envPath: absolutePath });
|
|
90259
|
+
} catch (error51) {
|
|
90260
|
+
return {
|
|
90261
|
+
kind: "fail",
|
|
90262
|
+
status: {
|
|
90263
|
+
loginStatus: "Refresh Failed",
|
|
90264
|
+
hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
|
|
90265
|
+
tokenRefresh: {
|
|
90266
|
+
attempted: false,
|
|
90267
|
+
success: false,
|
|
90268
|
+
errorMessage: `auth file read failed: ${errorMessage2(error51)}`
|
|
90269
|
+
}
|
|
90270
|
+
}
|
|
90271
|
+
};
|
|
90272
|
+
}
|
|
90273
|
+
const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
|
|
90274
|
+
const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
|
|
90275
|
+
if (freshAccess && freshExp && freshExp > expirationThreshold) {
|
|
90276
|
+
return {
|
|
90277
|
+
kind: "ok",
|
|
90278
|
+
accessToken: freshAccess,
|
|
90279
|
+
refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
|
|
90280
|
+
expiration: freshExp,
|
|
90281
|
+
tokenRefresh: { attempted: false, success: true }
|
|
90282
|
+
};
|
|
90283
|
+
}
|
|
90284
|
+
const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
|
|
90285
|
+
let refreshedAccess;
|
|
90286
|
+
let refreshedRefresh;
|
|
90287
|
+
try {
|
|
90288
|
+
const config2 = await resolveConfig({ customAuthority });
|
|
90289
|
+
const refreshed = await refreshFn({
|
|
90290
|
+
refreshToken: tokenForIdP,
|
|
90291
|
+
tokenEndpoint: config2.tokenEndpoint,
|
|
90292
|
+
clientId: config2.clientId,
|
|
90293
|
+
expectedAuthority: customAuthority
|
|
90294
|
+
});
|
|
90295
|
+
refreshedAccess = refreshed.accessToken;
|
|
90296
|
+
refreshedRefresh = refreshed.refreshToken;
|
|
90297
|
+
} catch (error51) {
|
|
90298
|
+
const isOAuthFailure = isTokenRefreshOAuthFailure(error51);
|
|
90299
|
+
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
90300
|
+
const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
90301
|
+
return {
|
|
90302
|
+
kind: "fail",
|
|
90303
|
+
status: {
|
|
90304
|
+
loginStatus: "Refresh Failed",
|
|
90305
|
+
hint,
|
|
90306
|
+
tokenRefresh: {
|
|
90307
|
+
attempted: true,
|
|
90308
|
+
success: false,
|
|
90309
|
+
errorMessage: message
|
|
90310
|
+
}
|
|
90311
|
+
}
|
|
90312
|
+
};
|
|
90313
|
+
}
|
|
90314
|
+
const refreshedExp = getTokenExpiration(refreshedAccess);
|
|
90315
|
+
if (!refreshedExp || refreshedExp <= new Date) {
|
|
90316
|
+
return {
|
|
90317
|
+
kind: "fail",
|
|
90318
|
+
status: {
|
|
90319
|
+
loginStatus: "Refresh Failed",
|
|
90320
|
+
hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
|
|
90321
|
+
tokenRefresh: {
|
|
90322
|
+
attempted: true,
|
|
90323
|
+
success: false,
|
|
90324
|
+
errorMessage: "refreshed token has no valid expiration claim"
|
|
90325
|
+
}
|
|
90326
|
+
}
|
|
90327
|
+
};
|
|
90328
|
+
}
|
|
90329
|
+
try {
|
|
90330
|
+
await saveEnvFile({
|
|
90331
|
+
envPath: absolutePath,
|
|
90332
|
+
data: {
|
|
90333
|
+
UIPATH_ACCESS_TOKEN: refreshedAccess,
|
|
90334
|
+
UIPATH_REFRESH_TOKEN: refreshedRefresh
|
|
90335
|
+
},
|
|
90336
|
+
merge: true
|
|
90337
|
+
});
|
|
90338
|
+
return {
|
|
90339
|
+
kind: "ok",
|
|
90340
|
+
accessToken: refreshedAccess,
|
|
90341
|
+
refreshToken: refreshedRefresh,
|
|
90342
|
+
expiration: refreshedExp,
|
|
90343
|
+
tokenRefresh: { attempted: true, success: true }
|
|
90344
|
+
};
|
|
90345
|
+
} catch (error51) {
|
|
90346
|
+
const msg = errorMessage2(error51);
|
|
90347
|
+
return {
|
|
90348
|
+
kind: "ok",
|
|
90349
|
+
accessToken: refreshedAccess,
|
|
90350
|
+
refreshToken: refreshedRefresh,
|
|
90351
|
+
expiration: refreshedExp,
|
|
90352
|
+
persistenceWarning: `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`,
|
|
90353
|
+
tokenRefresh: {
|
|
90354
|
+
attempted: true,
|
|
90355
|
+
success: true,
|
|
90356
|
+
errorMessage: `persistence failed: ${msg}`
|
|
90357
|
+
}
|
|
90358
|
+
};
|
|
90359
|
+
}
|
|
90360
|
+
}
|
|
89920
90361
|
var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
89921
90362
|
const {
|
|
89922
90363
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
@@ -89991,73 +90432,103 @@ var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {})
|
|
|
89991
90432
|
let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
89992
90433
|
let expiration = getTokenExpiration(accessToken);
|
|
89993
90434
|
let persistenceWarning;
|
|
90435
|
+
let lockReleaseFailed = false;
|
|
89994
90436
|
let tokenRefresh;
|
|
89995
|
-
const
|
|
89996
|
-
|
|
89997
|
-
|
|
89998
|
-
|
|
90437
|
+
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
90438
|
+
const tryGlobalCredsHint = async () => {
|
|
90439
|
+
const fs7 = getFs2();
|
|
90440
|
+
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
90441
|
+
if (absolutePath === globalPath)
|
|
90442
|
+
return;
|
|
90443
|
+
if (!await fs7.exists(globalPath))
|
|
90444
|
+
return;
|
|
89999
90445
|
try {
|
|
90000
|
-
const
|
|
90001
|
-
|
|
90002
|
-
|
|
90003
|
-
const
|
|
90004
|
-
|
|
90005
|
-
|
|
90006
|
-
|
|
90007
|
-
|
|
90008
|
-
|
|
90009
|
-
|
|
90010
|
-
|
|
90446
|
+
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
90447
|
+
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
90448
|
+
return;
|
|
90449
|
+
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
90450
|
+
if (globalExp && globalExp <= new Date)
|
|
90451
|
+
return;
|
|
90452
|
+
return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
90453
|
+
} catch {
|
|
90454
|
+
return;
|
|
90455
|
+
}
|
|
90456
|
+
};
|
|
90457
|
+
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
90458
|
+
let release;
|
|
90459
|
+
try {
|
|
90460
|
+
release = await getFs2().acquireLock(absolutePath);
|
|
90011
90461
|
} catch (error51) {
|
|
90012
|
-
const
|
|
90013
|
-
const
|
|
90014
|
-
|
|
90462
|
+
const msg = errorMessage2(error51);
|
|
90463
|
+
const globalHint = await tryGlobalCredsHint();
|
|
90464
|
+
if (globalHint) {
|
|
90465
|
+
return {
|
|
90466
|
+
loginStatus: "Expired",
|
|
90467
|
+
accessToken,
|
|
90468
|
+
refreshToken,
|
|
90469
|
+
baseUrl: credentials.UIPATH_URL,
|
|
90470
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
90471
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
90472
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
90473
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
90474
|
+
expiration,
|
|
90475
|
+
source: "file" /* File */,
|
|
90476
|
+
hint: globalHint,
|
|
90477
|
+
tokenRefresh: {
|
|
90478
|
+
attempted: false,
|
|
90479
|
+
success: false,
|
|
90480
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
90481
|
+
}
|
|
90482
|
+
};
|
|
90483
|
+
}
|
|
90015
90484
|
return {
|
|
90016
90485
|
loginStatus: "Refresh Failed",
|
|
90017
|
-
hint,
|
|
90486
|
+
hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
|
|
90018
90487
|
tokenRefresh: {
|
|
90019
|
-
attempted:
|
|
90488
|
+
attempted: false,
|
|
90020
90489
|
success: false,
|
|
90021
|
-
errorMessage:
|
|
90490
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
90022
90491
|
}
|
|
90023
90492
|
};
|
|
90024
90493
|
}
|
|
90025
|
-
|
|
90026
|
-
|
|
90027
|
-
|
|
90028
|
-
|
|
90029
|
-
|
|
90030
|
-
|
|
90031
|
-
|
|
90032
|
-
|
|
90033
|
-
|
|
90494
|
+
let lockedFailure;
|
|
90495
|
+
try {
|
|
90496
|
+
const outcome = await runRefreshLocked({
|
|
90497
|
+
absolutePath,
|
|
90498
|
+
refreshToken,
|
|
90499
|
+
customAuthority: credentials.UIPATH_URL,
|
|
90500
|
+
ensureTokenValidityMinutes,
|
|
90501
|
+
loadEnvFile,
|
|
90502
|
+
saveEnvFile,
|
|
90503
|
+
refreshFn: refreshTokenFn,
|
|
90504
|
+
resolveConfig
|
|
90505
|
+
});
|
|
90506
|
+
if (outcome.kind === "fail") {
|
|
90507
|
+
lockedFailure = outcome.status;
|
|
90508
|
+
} else {
|
|
90509
|
+
accessToken = outcome.accessToken;
|
|
90510
|
+
refreshToken = outcome.refreshToken;
|
|
90511
|
+
expiration = outcome.expiration;
|
|
90512
|
+
tokenRefresh = outcome.tokenRefresh;
|
|
90513
|
+
if (outcome.persistenceWarning) {
|
|
90514
|
+
persistenceWarning = outcome.persistenceWarning;
|
|
90034
90515
|
}
|
|
90035
|
-
}
|
|
90516
|
+
}
|
|
90517
|
+
} finally {
|
|
90518
|
+
try {
|
|
90519
|
+
await release();
|
|
90520
|
+
} catch {
|
|
90521
|
+
lockReleaseFailed = true;
|
|
90522
|
+
}
|
|
90036
90523
|
}
|
|
90037
|
-
|
|
90038
|
-
|
|
90039
|
-
|
|
90040
|
-
|
|
90041
|
-
|
|
90042
|
-
|
|
90043
|
-
|
|
90044
|
-
|
|
90045
|
-
UIPATH_REFRESH_TOKEN: refreshToken
|
|
90046
|
-
},
|
|
90047
|
-
merge: true
|
|
90048
|
-
});
|
|
90049
|
-
tokenRefresh = {
|
|
90050
|
-
attempted: true,
|
|
90051
|
-
success: true
|
|
90052
|
-
};
|
|
90053
|
-
} catch (error51) {
|
|
90054
|
-
const msg = error51 instanceof Error ? error51.message : String(error51);
|
|
90055
|
-
persistenceWarning = `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`;
|
|
90056
|
-
tokenRefresh = {
|
|
90057
|
-
attempted: true,
|
|
90058
|
-
success: true,
|
|
90059
|
-
errorMessage: `persistence failed: ${msg}`
|
|
90060
|
-
};
|
|
90524
|
+
if (lockedFailure) {
|
|
90525
|
+
const globalHint = await tryGlobalCredsHint();
|
|
90526
|
+
const base = globalHint ? {
|
|
90527
|
+
...lockedFailure,
|
|
90528
|
+
loginStatus: "Expired",
|
|
90529
|
+
hint: globalHint
|
|
90530
|
+
} : lockedFailure;
|
|
90531
|
+
return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
|
|
90061
90532
|
}
|
|
90062
90533
|
}
|
|
90063
90534
|
const result = {
|
|
@@ -90072,23 +90543,13 @@ var LoginStatusSource, getLoginStatusWithDeps = async (options = {}, deps = {})
|
|
|
90072
90543
|
expiration,
|
|
90073
90544
|
source: "file" /* File */,
|
|
90074
90545
|
...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
|
|
90546
|
+
...lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
90075
90547
|
...tokenRefresh ? { tokenRefresh } : {}
|
|
90076
90548
|
};
|
|
90077
90549
|
if (result.loginStatus === "Expired") {
|
|
90078
|
-
const
|
|
90079
|
-
|
|
90080
|
-
|
|
90081
|
-
try {
|
|
90082
|
-
const globalCreds = await loadEnvFile({
|
|
90083
|
-
envPath: globalPath
|
|
90084
|
-
});
|
|
90085
|
-
if (globalCreds.UIPATH_ACCESS_TOKEN) {
|
|
90086
|
-
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
90087
|
-
if (!globalExp || globalExp > new Date) {
|
|
90088
|
-
result.hint = `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
90089
|
-
}
|
|
90090
|
-
}
|
|
90091
|
-
} catch {}
|
|
90550
|
+
const globalHint = await tryGlobalCredsHint();
|
|
90551
|
+
if (globalHint) {
|
|
90552
|
+
result.hint = globalHint;
|
|
90092
90553
|
}
|
|
90093
90554
|
}
|
|
90094
90555
|
return result;
|
|
@@ -90163,9 +90624,11 @@ var clientCredentialsLogin = async ({
|
|
|
90163
90624
|
const params = {
|
|
90164
90625
|
grant_type: "client_credentials",
|
|
90165
90626
|
client_id: config2.clientId,
|
|
90166
|
-
client_secret: config2.clientSecret ?? ""
|
|
90167
|
-
scope: config2.scopes.join(" ")
|
|
90627
|
+
client_secret: config2.clientSecret ?? ""
|
|
90168
90628
|
};
|
|
90629
|
+
if (config2.scopes.length > 0) {
|
|
90630
|
+
params.scope = config2.scopes.join(" ");
|
|
90631
|
+
}
|
|
90169
90632
|
const tokenResponse = await fetch(config2.tokenEndpoint, {
|
|
90170
90633
|
method: "POST",
|
|
90171
90634
|
headers: {
|
|
@@ -90375,11 +90838,25 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
90375
90838
|
searchDir = parentDir;
|
|
90376
90839
|
}
|
|
90377
90840
|
}
|
|
90378
|
-
|
|
90379
|
-
|
|
90380
|
-
|
|
90381
|
-
|
|
90382
|
-
|
|
90841
|
+
let saveRelease;
|
|
90842
|
+
try {
|
|
90843
|
+
if (typeof fs7.acquireLock === "function") {
|
|
90844
|
+
saveRelease = await fs7.acquireLock(savePath);
|
|
90845
|
+
}
|
|
90846
|
+
} catch {
|
|
90847
|
+
saveRelease = undefined;
|
|
90848
|
+
}
|
|
90849
|
+
try {
|
|
90850
|
+
await saveEnvFile({
|
|
90851
|
+
envPath: savePath,
|
|
90852
|
+
data: credentials,
|
|
90853
|
+
merge: true
|
|
90854
|
+
});
|
|
90855
|
+
} finally {
|
|
90856
|
+
if (saveRelease) {
|
|
90857
|
+
await saveRelease().catch(() => {});
|
|
90858
|
+
}
|
|
90859
|
+
}
|
|
90383
90860
|
const reportedPath = fs7.path.isAbsolute(savePath) ? savePath : fs7.path.join(fs7.env.homedir(), savePath);
|
|
90384
90861
|
emit({
|
|
90385
90862
|
type: "saved",
|
|
@@ -90409,7 +90886,21 @@ async function logoutWithDeps(options, deps = {}) {
|
|
|
90409
90886
|
const fs7 = getFs2();
|
|
90410
90887
|
const { absolutePath } = await resolveEnvFilePath(options.file);
|
|
90411
90888
|
if (absolutePath && await fs7.exists(absolutePath)) {
|
|
90412
|
-
|
|
90889
|
+
let release;
|
|
90890
|
+
try {
|
|
90891
|
+
if (typeof fs7.acquireLock === "function") {
|
|
90892
|
+
release = await fs7.acquireLock(absolutePath);
|
|
90893
|
+
}
|
|
90894
|
+
} catch {
|
|
90895
|
+
release = undefined;
|
|
90896
|
+
}
|
|
90897
|
+
try {
|
|
90898
|
+
await fs7.rm(absolutePath);
|
|
90899
|
+
} finally {
|
|
90900
|
+
if (release) {
|
|
90901
|
+
await release().catch(() => {});
|
|
90902
|
+
}
|
|
90903
|
+
}
|
|
90413
90904
|
return {
|
|
90414
90905
|
success: true,
|
|
90415
90906
|
message: `Logged out successfully. Removed ${absolutePath}`,
|
|
@@ -90430,81 +90921,6 @@ var init_logout = __esm(() => {
|
|
|
90430
90921
|
init_envFile();
|
|
90431
90922
|
});
|
|
90432
90923
|
|
|
90433
|
-
// ../auth/src/strategies/browser-strategy.ts
|
|
90434
|
-
var exports_browser_strategy = {};
|
|
90435
|
-
__export(exports_browser_strategy, {
|
|
90436
|
-
BrowserAuthStrategy: () => BrowserAuthStrategy
|
|
90437
|
-
});
|
|
90438
|
-
|
|
90439
|
-
class BrowserAuthStrategy {
|
|
90440
|
-
async execute(url2, _redirectUri, expectedState) {
|
|
90441
|
-
const global5 = getGlobalThis();
|
|
90442
|
-
if (!global5?.window) {
|
|
90443
|
-
throw new Error("Browser environment required for authentication");
|
|
90444
|
-
}
|
|
90445
|
-
const screenWidth = global5.window.screen?.width ?? 1024;
|
|
90446
|
-
const screenHeight = global5.window.screen?.height ?? 768;
|
|
90447
|
-
const width = 600;
|
|
90448
|
-
const height4 = 700;
|
|
90449
|
-
const left = screenWidth / 2 - width / 2;
|
|
90450
|
-
const top = screenHeight / 2 - height4 / 2;
|
|
90451
|
-
if (!global5.window.open) {
|
|
90452
|
-
throw new Error("window.open is not available");
|
|
90453
|
-
}
|
|
90454
|
-
const popupResult = global5.window.open(url2, "uip_auth", `width=${width},height=${height4},left=${left},top=${top},resizable=yes,scrollbars=yes,status=yes`);
|
|
90455
|
-
const popup = popupResult;
|
|
90456
|
-
if (!popup) {
|
|
90457
|
-
throw new Error(`Authentication popup was blocked by your browser.
|
|
90458
|
-
|
|
90459
|
-
` + `To continue:
|
|
90460
|
-
` + `1. Look for a popup blocker icon in your address bar
|
|
90461
|
-
` + `2. Allow popups for this site
|
|
90462
|
-
` + `3. Try logging in again
|
|
90463
|
-
|
|
90464
|
-
` + "If using an ad blocker, you may need to temporarily disable it.");
|
|
90465
|
-
}
|
|
90466
|
-
return new Promise((resolve2, reject) => {
|
|
90467
|
-
const messageHandler = (event) => {
|
|
90468
|
-
if (event.data?.type === "UIP_AUTH_CODE" && event.data.code) {
|
|
90469
|
-
if (event.data.state !== expectedState) {
|
|
90470
|
-
cleanup();
|
|
90471
|
-
reject(new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again."));
|
|
90472
|
-
popup.close();
|
|
90473
|
-
return;
|
|
90474
|
-
}
|
|
90475
|
-
cleanup();
|
|
90476
|
-
resolve2(event.data.code);
|
|
90477
|
-
popup.close();
|
|
90478
|
-
} else if (event.data?.type === "UIP_AUTH_ERROR") {
|
|
90479
|
-
cleanup();
|
|
90480
|
-
const errorMsg = event.data.error || "Authentication failed";
|
|
90481
|
-
reject(new Error(`Authentication failed: ${errorMsg}
|
|
90482
|
-
|
|
90483
|
-
` + "Please check your credentials and try again. " + "If the problem persists, verify your UiPath account is active."));
|
|
90484
|
-
popup.close();
|
|
90485
|
-
}
|
|
90486
|
-
};
|
|
90487
|
-
const cleanup = () => {
|
|
90488
|
-
global5.window?.removeEventListener?.("message", messageHandler);
|
|
90489
|
-
if (timer)
|
|
90490
|
-
clearInterval(timer);
|
|
90491
|
-
};
|
|
90492
|
-
if (global5.window?.addEventListener) {
|
|
90493
|
-
global5.window.addEventListener("message", messageHandler);
|
|
90494
|
-
}
|
|
90495
|
-
const timer = setInterval(() => {
|
|
90496
|
-
if (popup.closed) {
|
|
90497
|
-
cleanup();
|
|
90498
|
-
reject(new Error(`Authentication was cancelled.
|
|
90499
|
-
|
|
90500
|
-
` + "The authentication popup was closed before completing the login process. " + "Please try again and complete the authentication flow."));
|
|
90501
|
-
}
|
|
90502
|
-
}, 1000);
|
|
90503
|
-
});
|
|
90504
|
-
}
|
|
90505
|
-
}
|
|
90506
|
-
var init_browser_strategy = () => {};
|
|
90507
|
-
|
|
90508
90924
|
// ../auth/src/getBaseHtml.ts
|
|
90509
90925
|
var getBaseHtml = ({ title, message, type: type2 }) => {
|
|
90510
90926
|
const icon = type2 === "success" ? "✓" : "✕";
|
|
@@ -90651,7 +91067,7 @@ var getBaseHtml = ({ title, message, type: type2 }) => {
|
|
|
90651
91067
|
};
|
|
90652
91068
|
|
|
90653
91069
|
// ../auth/src/server.ts
|
|
90654
|
-
var startServer = async ({
|
|
91070
|
+
var AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT", startServer = async ({
|
|
90655
91071
|
redirectUri,
|
|
90656
91072
|
timeoutMs = DEFAULT_AUTH_TIMEOUT_MS2,
|
|
90657
91073
|
onListening
|
|
@@ -90722,7 +91138,18 @@ var startServer = async ({
|
|
|
90722
91138
|
reject(new Error("No authorization code received"));
|
|
90723
91139
|
return;
|
|
90724
91140
|
});
|
|
90725
|
-
|
|
91141
|
+
const timeoutHandle = setTimeout(() => {
|
|
91142
|
+
server.close();
|
|
91143
|
+
const err = new Error("Authentication timeout");
|
|
91144
|
+
err.code = AUTH_TIMEOUT_ERROR_CODE;
|
|
91145
|
+
reject(err);
|
|
91146
|
+
}, timeoutMs);
|
|
91147
|
+
const bindHost = redirectUri.hostname === "localhost" ? "127.0.0.1" : redirectUri.hostname;
|
|
91148
|
+
server.on("error", (err) => {
|
|
91149
|
+
clearTimeout(timeoutHandle);
|
|
91150
|
+
reject(err);
|
|
91151
|
+
});
|
|
91152
|
+
server.listen(Number(redirectUri.port), bindHost, () => {
|
|
90726
91153
|
if (onListening) {
|
|
90727
91154
|
Promise.resolve(onListening()).catch((err) => {
|
|
90728
91155
|
server.close();
|
|
@@ -90731,10 +91158,6 @@ var startServer = async ({
|
|
|
90731
91158
|
});
|
|
90732
91159
|
}
|
|
90733
91160
|
});
|
|
90734
|
-
const timeoutHandle = setTimeout(() => {
|
|
90735
|
-
server.close();
|
|
90736
|
-
reject(new Error("Authentication timeout"));
|
|
90737
|
-
}, timeoutMs);
|
|
90738
91161
|
server.on("close", () => {
|
|
90739
91162
|
clearTimeout(timeoutHandle);
|
|
90740
91163
|
});
|
|
@@ -90744,6 +91167,81 @@ var init_server = __esm(() => {
|
|
|
90744
91167
|
init_constants2();
|
|
90745
91168
|
});
|
|
90746
91169
|
|
|
91170
|
+
// ../auth/src/strategies/browser-strategy.ts
|
|
91171
|
+
var exports_browser_strategy = {};
|
|
91172
|
+
__export(exports_browser_strategy, {
|
|
91173
|
+
BrowserAuthStrategy: () => BrowserAuthStrategy
|
|
91174
|
+
});
|
|
91175
|
+
|
|
91176
|
+
class BrowserAuthStrategy {
|
|
91177
|
+
async execute(url2, _redirectUri, expectedState) {
|
|
91178
|
+
const global5 = getGlobalThis();
|
|
91179
|
+
if (!global5?.window) {
|
|
91180
|
+
throw new Error("Browser environment required for authentication");
|
|
91181
|
+
}
|
|
91182
|
+
const screenWidth = global5.window.screen?.width ?? 1024;
|
|
91183
|
+
const screenHeight = global5.window.screen?.height ?? 768;
|
|
91184
|
+
const width = 600;
|
|
91185
|
+
const height4 = 700;
|
|
91186
|
+
const left = screenWidth / 2 - width / 2;
|
|
91187
|
+
const top = screenHeight / 2 - height4 / 2;
|
|
91188
|
+
if (!global5.window.open) {
|
|
91189
|
+
throw new Error("window.open is not available");
|
|
91190
|
+
}
|
|
91191
|
+
const popupResult = global5.window.open(url2, "uip_auth", `width=${width},height=${height4},left=${left},top=${top},resizable=yes,scrollbars=yes,status=yes`);
|
|
91192
|
+
const popup = popupResult;
|
|
91193
|
+
if (!popup) {
|
|
91194
|
+
throw new Error(`Authentication popup was blocked by your browser.
|
|
91195
|
+
|
|
91196
|
+
` + `To continue:
|
|
91197
|
+
` + `1. Look for a popup blocker icon in your address bar
|
|
91198
|
+
` + `2. Allow popups for this site
|
|
91199
|
+
` + `3. Try logging in again
|
|
91200
|
+
|
|
91201
|
+
` + "If using an ad blocker, you may need to temporarily disable it.");
|
|
91202
|
+
}
|
|
91203
|
+
return new Promise((resolve2, reject) => {
|
|
91204
|
+
const messageHandler = (event) => {
|
|
91205
|
+
if (event.data?.type === "UIP_AUTH_CODE" && event.data.code) {
|
|
91206
|
+
if (event.data.state !== expectedState) {
|
|
91207
|
+
cleanup();
|
|
91208
|
+
reject(new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again."));
|
|
91209
|
+
popup.close();
|
|
91210
|
+
return;
|
|
91211
|
+
}
|
|
91212
|
+
cleanup();
|
|
91213
|
+
resolve2(event.data.code);
|
|
91214
|
+
popup.close();
|
|
91215
|
+
} else if (event.data?.type === "UIP_AUTH_ERROR") {
|
|
91216
|
+
cleanup();
|
|
91217
|
+
const errorMsg = event.data.error || "Authentication failed";
|
|
91218
|
+
reject(new Error(`Authentication failed: ${errorMsg}
|
|
91219
|
+
|
|
91220
|
+
` + "Please check your credentials and try again. " + "If the problem persists, verify your UiPath account is active."));
|
|
91221
|
+
popup.close();
|
|
91222
|
+
}
|
|
91223
|
+
};
|
|
91224
|
+
const cleanup = () => {
|
|
91225
|
+
global5.window?.removeEventListener?.("message", messageHandler);
|
|
91226
|
+
if (timer)
|
|
91227
|
+
clearInterval(timer);
|
|
91228
|
+
};
|
|
91229
|
+
if (global5.window?.addEventListener) {
|
|
91230
|
+
global5.window.addEventListener("message", messageHandler);
|
|
91231
|
+
}
|
|
91232
|
+
const timer = setInterval(() => {
|
|
91233
|
+
if (popup.closed) {
|
|
91234
|
+
cleanup();
|
|
91235
|
+
reject(new Error(`Authentication was cancelled.
|
|
91236
|
+
|
|
91237
|
+
` + "The authentication popup was closed before completing the login process. " + "Please try again and complete the authentication flow."));
|
|
91238
|
+
}
|
|
91239
|
+
}, 1000);
|
|
91240
|
+
});
|
|
91241
|
+
}
|
|
91242
|
+
}
|
|
91243
|
+
var init_browser_strategy = () => {};
|
|
91244
|
+
|
|
90747
91245
|
// ../auth/src/strategies/node-strategy.ts
|
|
90748
91246
|
var exports_node_strategy = {};
|
|
90749
91247
|
__export(exports_node_strategy, {
|
|
@@ -90830,7 +91328,8 @@ __export(exports_src2, {
|
|
|
90830
91328
|
ENV_AUTH_ENABLE_VAR: () => ENV_AUTH_ENABLE_VAR,
|
|
90831
91329
|
ENFORCE_ROBOT_AUTH_VAR: () => ENFORCE_ROBOT_AUTH_VAR,
|
|
90832
91330
|
DEFAULT_ENV_FILENAME: () => DEFAULT_ENV_FILENAME,
|
|
90833
|
-
DEFAULT_AUTH_FILENAME: () => DEFAULT_AUTH_FILENAME
|
|
91331
|
+
DEFAULT_AUTH_FILENAME: () => DEFAULT_AUTH_FILENAME,
|
|
91332
|
+
AUTH_TIMEOUT_ERROR_CODE: () => AUTH_TIMEOUT_ERROR_CODE
|
|
90834
91333
|
});
|
|
90835
91334
|
var authenticate = async ({
|
|
90836
91335
|
baseUrl,
|
|
@@ -90905,6 +91404,7 @@ var init_src3 = __esm(() => {
|
|
|
90905
91404
|
init_config2();
|
|
90906
91405
|
init_envAuth();
|
|
90907
91406
|
init_selectTenant();
|
|
91407
|
+
init_server();
|
|
90908
91408
|
init_envFile();
|
|
90909
91409
|
init_jwt();
|
|
90910
91410
|
init_authContext();
|
|
@@ -91082,6 +91582,25 @@ function resolveAuthFilePath(folder) {
|
|
|
91082
91582
|
}
|
|
91083
91583
|
return DEFAULT_ENV_FILENAME;
|
|
91084
91584
|
}
|
|
91585
|
+
function instructionsForLoginError(error51, message) {
|
|
91586
|
+
if (/[\r\n]/.test(message)) {
|
|
91587
|
+
return `See message above for details. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
91588
|
+
}
|
|
91589
|
+
const code = error51 instanceof Object && "code" in error51 ? error51.code : undefined;
|
|
91590
|
+
if (code === "EPERM" || code === "EACCES") {
|
|
91591
|
+
return `The callback listener on port 8104 was blocked by the OS or sandbox (${String(code)}). Grant local-network permission or run outside the sandbox, then try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
91592
|
+
}
|
|
91593
|
+
if (code === "EADDRINUSE") {
|
|
91594
|
+
return `Port 8104 is already in use by another process — close any other 'uip login' session, free the port, then try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
91595
|
+
}
|
|
91596
|
+
if (code === "EADDRNOTAVAIL") {
|
|
91597
|
+
return `The callback listener could not bind to the loopback address. Check that 127.0.0.1 resolves locally, then try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
91598
|
+
}
|
|
91599
|
+
if (code === AUTH_TIMEOUT_ERROR_CODE) {
|
|
91600
|
+
return `The browser did not return an authorization code within the timeout. Make sure your default browser opened, complete the sign-in, then retry. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
91601
|
+
}
|
|
91602
|
+
return `Inspect command arguments and message and try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
91603
|
+
}
|
|
91085
91604
|
function instructionsForStatusError(err) {
|
|
91086
91605
|
if (err instanceof EnvAuthConfigError) {
|
|
91087
91606
|
return "Check the UIPATH_CLI_* environment variables and re-run.";
|
|
@@ -91215,7 +91734,7 @@ function registerLoginCommand(program2, context) {
|
|
|
91215
91734
|
OutputFormatter.error({
|
|
91216
91735
|
Result: RESULTS.AuthenticationError,
|
|
91217
91736
|
Message: message,
|
|
91218
|
-
Instructions:
|
|
91737
|
+
Instructions: instructionsForLoginError(error51, message),
|
|
91219
91738
|
...httpStatus ? { Context: { httpStatus } } : {}
|
|
91220
91739
|
});
|
|
91221
91740
|
context.exit(2);
|
|
@@ -91289,10 +91808,12 @@ function registerLoginCommand(program2, context) {
|
|
|
91289
91808
|
statusData["Expiration Date"] = status.expiration;
|
|
91290
91809
|
if (status.hint) {
|
|
91291
91810
|
statusData.Hint = status.hint;
|
|
91811
|
+
} else if (status.loginStatus !== "Logged in") {
|
|
91812
|
+
statusData.Hint = defaultRefreshFailureInstructions(status);
|
|
91292
91813
|
}
|
|
91293
91814
|
OutputFormatter.success({
|
|
91294
91815
|
Result: RESULTS.Success,
|
|
91295
|
-
Code: "
|
|
91816
|
+
Code: "LoginStatus",
|
|
91296
91817
|
Data: statusData
|
|
91297
91818
|
});
|
|
91298
91819
|
});
|
|
@@ -91379,7 +91900,36 @@ function registerLoginCommand(program2, context) {
|
|
|
91379
91900
|
return;
|
|
91380
91901
|
}
|
|
91381
91902
|
const envFilePath = resolveAuthFilePath(options.file);
|
|
91382
|
-
const [
|
|
91903
|
+
const [locationError, location] = await catchError(resolveEnvFileLocationAsync(envFilePath));
|
|
91904
|
+
if (locationError) {
|
|
91905
|
+
OutputFormatter.error({
|
|
91906
|
+
Result: RESULTS.Failure,
|
|
91907
|
+
Message: `Failed to locate credentials file: ${locationError.message}`,
|
|
91908
|
+
Instructions: "Check filesystem permissions on the current directory and your home directory, then re-run."
|
|
91909
|
+
});
|
|
91910
|
+
context.exit(1);
|
|
91911
|
+
return;
|
|
91912
|
+
}
|
|
91913
|
+
if (!location.exists) {
|
|
91914
|
+
if (location.unusable) {
|
|
91915
|
+
OutputFormatter.error({
|
|
91916
|
+
Result: RESULTS.Failure,
|
|
91917
|
+
Message: `Credentials file at ${location.absolutePath} is not usable: ${location.unusable.message}`,
|
|
91918
|
+
Instructions: location.unusable.reason === "not-a-file" ? `Path resolves to a directory or special file. Move or rename ${location.absolutePath}, then run 'uip login' to recreate the credentials file.` : `Check filesystem permissions on ${location.absolutePath} and re-run.`
|
|
91919
|
+
});
|
|
91920
|
+
context.exit(1);
|
|
91921
|
+
return;
|
|
91922
|
+
}
|
|
91923
|
+
OutputFormatter.error({
|
|
91924
|
+
Result: RESULTS.AuthenticationError,
|
|
91925
|
+
Message: "Not authenticated",
|
|
91926
|
+
Instructions: "Run 'uip login' to authenticate first."
|
|
91927
|
+
});
|
|
91928
|
+
context.exit(2);
|
|
91929
|
+
return;
|
|
91930
|
+
}
|
|
91931
|
+
const resolvedEnvFilePath = location.absolutePath;
|
|
91932
|
+
const [statusError, status] = await catchError(auth.getLoginStatus({ envFilePath: resolvedEnvFilePath }));
|
|
91383
91933
|
if (statusError) {
|
|
91384
91934
|
OutputFormatter.error({
|
|
91385
91935
|
Result: RESULTS.ConfigError,
|
|
@@ -91395,6 +91945,7 @@ function registerLoginCommand(program2, context) {
|
|
|
91395
91945
|
Message: "Not authenticated",
|
|
91396
91946
|
Instructions: status.hint || "Run 'uip login' to authenticate first."
|
|
91397
91947
|
});
|
|
91948
|
+
context.exit(2);
|
|
91398
91949
|
return;
|
|
91399
91950
|
}
|
|
91400
91951
|
const [fetchError, data] = await catchError(auth.fetchTenants(status.baseUrl, status.accessToken, status.organizationId));
|
|
@@ -91416,7 +91967,7 @@ function registerLoginCommand(program2, context) {
|
|
|
91416
91967
|
});
|
|
91417
91968
|
return;
|
|
91418
91969
|
}
|
|
91419
|
-
const [saveError] = await catchError(auth.saveTenantSelection(
|
|
91970
|
+
const [saveError] = await catchError(auth.saveTenantSelection(resolvedEnvFilePath, matchedTenant.name, matchedTenant.id));
|
|
91420
91971
|
if (saveError) {
|
|
91421
91972
|
OutputFormatter.error({
|
|
91422
91973
|
Result: RESULTS.Failure,
|
|
@@ -91494,7 +92045,7 @@ function emitAuthEnv() {
|
|
|
91494
92045
|
Data: data
|
|
91495
92046
|
});
|
|
91496
92047
|
}
|
|
91497
|
-
var LOGIN_EXAMPLES, LOGIN_STATUS_EXAMPLES, LOGIN_REFRESH_EXAMPLES, LOGIN_TENANT_LIST_EXAMPLES, LOGIN_TENANT_SET_EXAMPLES, LOGIN_WHICH_EXAMPLES;
|
|
92048
|
+
var ENV_AUTH_FALLBACK_HINT = "Headless? Set UIPATH_CLI_ENABLE_ENV_AUTH=true with UIPATH_CLI_AUTH_TOKEN, UIPATH_CLI_ORGANIZATION_NAME, UIPATH_CLI_ORGANIZATION_ID, UIPATH_CLI_TENANT_NAME, and UIPATH_CLI_TENANT_ID to skip the browser flow.", LOGIN_EXAMPLES, LOGIN_STATUS_EXAMPLES, LOGIN_REFRESH_EXAMPLES, LOGIN_TENANT_LIST_EXAMPLES, LOGIN_TENANT_SET_EXAMPLES, LOGIN_WHICH_EXAMPLES;
|
|
91498
92049
|
var init_login = __esm(() => {
|
|
91499
92050
|
init_src3();
|
|
91500
92051
|
init_src2();
|
|
@@ -91532,7 +92083,7 @@ var init_login = __esm(() => {
|
|
|
91532
92083
|
Description: "Show current login status",
|
|
91533
92084
|
Command: "uip login status",
|
|
91534
92085
|
Output: {
|
|
91535
|
-
Code: "
|
|
92086
|
+
Code: "LoginStatus",
|
|
91536
92087
|
Data: {
|
|
91537
92088
|
Status: "Logged in",
|
|
91538
92089
|
Organization: "my-org",
|
|
@@ -91830,7 +92381,7 @@ function introspectCommands(program2) {
|
|
|
91830
92381
|
}
|
|
91831
92382
|
}
|
|
91832
92383
|
lines.push(`
|
|
91833
|
-
Global Options (can be used with any command):`, " --output <table|json|yaml|plain>: Output format (default: json)", " --output-filter <expression>: JMESPath expression to
|
|
92384
|
+
Global Options (can be used with any command):`, " --output <table|json|yaml|plain>: Output format (default: json)", " --output-filter <expression>: JMESPath expression applied to the Data field of the response envelope", " --log-level <debug|info|warn|error>: Log level threshold (default: info)", " --log-file <path>: Write logs to file instead of stderr", `
|
|
91834
92385
|
Pass the command without the 'uip' prefix. Example: "login status --output json"`, `Filter example: "tools list --output-filter 'Data[].name'"`);
|
|
91835
92386
|
return lines.join(`
|
|
91836
92387
|
`);
|
|
@@ -92290,15 +92841,15 @@ var makeIssue = (params) => {
|
|
|
92290
92841
|
message: issueData.message
|
|
92291
92842
|
};
|
|
92292
92843
|
}
|
|
92293
|
-
let
|
|
92844
|
+
let errorMessage3 = "";
|
|
92294
92845
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
92295
92846
|
for (const map3 of maps) {
|
|
92296
|
-
|
|
92847
|
+
errorMessage3 = map3(fullIssue, { data, defaultError: errorMessage3 }).message;
|
|
92297
92848
|
}
|
|
92298
92849
|
return {
|
|
92299
92850
|
...issueData,
|
|
92300
92851
|
path: fullPath,
|
|
92301
|
-
message:
|
|
92852
|
+
message: errorMessage3
|
|
92302
92853
|
};
|
|
92303
92854
|
}, INVALID, DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x) => x.status === "aborted", isDirty = (x) => x.status === "dirty", isValid = (x) => x.status === "valid", isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
92304
92855
|
var init_parseUtil = __esm(() => {
|
|
@@ -96790,19 +97341,19 @@ var init_Refs = __esm(() => {
|
|
|
96790
97341
|
});
|
|
96791
97342
|
|
|
96792
97343
|
// ../../node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
96793
|
-
function addErrorMessage(res, key,
|
|
97344
|
+
function addErrorMessage(res, key, errorMessage3, refs) {
|
|
96794
97345
|
if (!refs?.errorMessages)
|
|
96795
97346
|
return;
|
|
96796
|
-
if (
|
|
97347
|
+
if (errorMessage3) {
|
|
96797
97348
|
res.errorMessage = {
|
|
96798
97349
|
...res.errorMessage,
|
|
96799
|
-
[key]:
|
|
97350
|
+
[key]: errorMessage3
|
|
96800
97351
|
};
|
|
96801
97352
|
}
|
|
96802
97353
|
}
|
|
96803
|
-
function setResponseValueAndErrors(res, key, value,
|
|
97354
|
+
function setResponseValueAndErrors(res, key, value, errorMessage3, refs) {
|
|
96804
97355
|
res[key] = value;
|
|
96805
|
-
addErrorMessage(res, key,
|
|
97356
|
+
addErrorMessage(res, key, errorMessage3, refs);
|
|
96806
97357
|
}
|
|
96807
97358
|
|
|
96808
97359
|
// ../../node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
@@ -98224,8 +98775,8 @@ class Protocol {
|
|
|
98224
98775
|
if (queuedMessage.type === "response") {
|
|
98225
98776
|
resolver(message);
|
|
98226
98777
|
} else {
|
|
98227
|
-
const
|
|
98228
|
-
const error51 = new McpError(
|
|
98778
|
+
const errorMessage3 = message;
|
|
98779
|
+
const error51 = new McpError(errorMessage3.error.code, errorMessage3.error.message, errorMessage3.error.data);
|
|
98229
98780
|
resolver(error51);
|
|
98230
98781
|
}
|
|
98231
98782
|
} else {
|
|
@@ -105812,23 +106363,23 @@ var init_server3 = __esm(() => {
|
|
|
105812
106363
|
const wrappedHandler = async (request, extra) => {
|
|
105813
106364
|
const validatedRequest = safeParse3(CallToolRequestSchema, request);
|
|
105814
106365
|
if (!validatedRequest.success) {
|
|
105815
|
-
const
|
|
105816
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${
|
|
106366
|
+
const errorMessage3 = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
|
|
106367
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage3}`);
|
|
105817
106368
|
}
|
|
105818
106369
|
const { params } = validatedRequest.data;
|
|
105819
106370
|
const result = await Promise.resolve(handler(request, extra));
|
|
105820
106371
|
if (params.task) {
|
|
105821
106372
|
const taskValidationResult = safeParse3(CreateTaskResultSchema, result);
|
|
105822
106373
|
if (!taskValidationResult.success) {
|
|
105823
|
-
const
|
|
105824
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${
|
|
106374
|
+
const errorMessage3 = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
|
|
106375
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage3}`);
|
|
105825
106376
|
}
|
|
105826
106377
|
return taskValidationResult.data;
|
|
105827
106378
|
}
|
|
105828
106379
|
const validationResult = safeParse3(CallToolResultSchema, result);
|
|
105829
106380
|
if (!validationResult.success) {
|
|
105830
|
-
const
|
|
105831
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${
|
|
106381
|
+
const errorMessage3 = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
|
|
106382
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage3}`);
|
|
105832
106383
|
}
|
|
105833
106384
|
return validationResult.data;
|
|
105834
106385
|
};
|
|
@@ -106498,12 +107049,12 @@ class McpServer {
|
|
|
106498
107049
|
});
|
|
106499
107050
|
this._toolHandlersInitialized = true;
|
|
106500
107051
|
}
|
|
106501
|
-
createToolError(
|
|
107052
|
+
createToolError(errorMessage3) {
|
|
106502
107053
|
return {
|
|
106503
107054
|
content: [
|
|
106504
107055
|
{
|
|
106505
107056
|
type: "text",
|
|
106506
|
-
text:
|
|
107057
|
+
text: errorMessage3
|
|
106507
107058
|
}
|
|
106508
107059
|
],
|
|
106509
107060
|
isError: true
|
|
@@ -106518,8 +107069,8 @@ class McpServer {
|
|
|
106518
107069
|
const parseResult = await safeParseAsync3(schemaToParse, args);
|
|
106519
107070
|
if (!parseResult.success) {
|
|
106520
107071
|
const error51 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
106521
|
-
const
|
|
106522
|
-
throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${
|
|
107072
|
+
const errorMessage3 = getParseErrorMessage(error51);
|
|
107073
|
+
throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage3}`);
|
|
106523
107074
|
}
|
|
106524
107075
|
return parseResult.data;
|
|
106525
107076
|
}
|
|
@@ -106540,8 +107091,8 @@ class McpServer {
|
|
|
106540
107091
|
const parseResult = await safeParseAsync3(outputObj, result.structuredContent);
|
|
106541
107092
|
if (!parseResult.success) {
|
|
106542
107093
|
const error51 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
106543
|
-
const
|
|
106544
|
-
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${
|
|
107094
|
+
const errorMessage3 = getParseErrorMessage(error51);
|
|
107095
|
+
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage3}`);
|
|
106545
107096
|
}
|
|
106546
107097
|
}
|
|
106547
107098
|
async executeToolHandler(tool, args, extra) {
|
|
@@ -106743,8 +107294,8 @@ class McpServer {
|
|
|
106743
107294
|
const parseResult = await safeParseAsync3(argsObj, request.params.arguments);
|
|
106744
107295
|
if (!parseResult.success) {
|
|
106745
107296
|
const error51 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
106746
|
-
const
|
|
106747
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${
|
|
107297
|
+
const errorMessage3 = getParseErrorMessage(error51);
|
|
107298
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage3}`);
|
|
106748
107299
|
}
|
|
106749
107300
|
const args = parseResult.data;
|
|
106750
107301
|
const cb = prompt.callback;
|
|
@@ -107606,9 +108157,17 @@ var init_send_feedback = __esm(() => {
|
|
|
107606
108157
|
];
|
|
107607
108158
|
});
|
|
107608
108159
|
|
|
108160
|
+
// src/commands/skills/agents/autopilot.ts
|
|
108161
|
+
var def;
|
|
108162
|
+
var init_autopilot = __esm(() => {
|
|
108163
|
+
def = {
|
|
108164
|
+
localSubdir: [".autopilot", "skills"]
|
|
108165
|
+
};
|
|
108166
|
+
});
|
|
108167
|
+
|
|
107609
108168
|
// src/commands/skills/contentStore.ts
|
|
107610
108169
|
import { spawn } from "node:child_process";
|
|
107611
|
-
import { randomUUID as
|
|
108170
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
107612
108171
|
async function fetchSkillsTo(targetPath, rootDir) {
|
|
107613
108172
|
const fs7 = getFileSystem();
|
|
107614
108173
|
let needsClone = true;
|
|
@@ -107802,7 +108361,7 @@ async function downloadAndExtractZip(storePath) {
|
|
|
107802
108361
|
if (!response.ok) {
|
|
107803
108362
|
throw new Error(`Failed to download zip: ${response.status}`);
|
|
107804
108363
|
}
|
|
107805
|
-
const zipPath = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-${
|
|
108364
|
+
const zipPath = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-${randomUUID4()}.zip`);
|
|
107806
108365
|
const arrayBuffer = await response.arrayBuffer();
|
|
107807
108366
|
await fs7.writeFile(zipPath, Buffer.from(arrayBuffer));
|
|
107808
108367
|
try {
|
|
@@ -107935,13 +108494,13 @@ async function enableMarketplaceAutoUpdate() {
|
|
|
107935
108494
|
}
|
|
107936
108495
|
logger.info(` claude: enabled auto-update for marketplace ${MARKETPLACE_NAME}`);
|
|
107937
108496
|
}
|
|
107938
|
-
var MARKETPLACE_SOURCE = "UiPath/skills", MARKETPLACE_NAME = "uipath-marketplace", PLUGIN_NAME = "uipath", PLUGIN_REF,
|
|
108497
|
+
var MARKETPLACE_SOURCE = "UiPath/skills", MARKETPLACE_NAME = "uipath-marketplace", PLUGIN_NAME = "uipath", PLUGIN_REF, def2;
|
|
107939
108498
|
var init_claude = __esm(() => {
|
|
107940
108499
|
init_src2();
|
|
107941
108500
|
init_src();
|
|
107942
108501
|
init_contentStore();
|
|
107943
108502
|
PLUGIN_REF = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
|
|
107944
|
-
|
|
108503
|
+
def2 = {
|
|
107945
108504
|
localSubdir: [".claude", "skills"],
|
|
107946
108505
|
globalOnly: true,
|
|
107947
108506
|
destinationHint: () => "installed via `claude plugin install`",
|
|
@@ -107968,41 +108527,41 @@ var init_claude = __esm(() => {
|
|
|
107968
108527
|
});
|
|
107969
108528
|
|
|
107970
108529
|
// src/commands/skills/agents/codex.ts
|
|
107971
|
-
var
|
|
108530
|
+
var def3;
|
|
107972
108531
|
var init_codex = __esm(() => {
|
|
107973
|
-
|
|
108532
|
+
def3 = {
|
|
107974
108533
|
localSubdir: [".agents", "skills"]
|
|
107975
108534
|
};
|
|
107976
108535
|
});
|
|
107977
108536
|
|
|
107978
108537
|
// src/commands/skills/agents/copilot.ts
|
|
107979
|
-
var
|
|
108538
|
+
var def4;
|
|
107980
108539
|
var init_copilot = __esm(() => {
|
|
107981
|
-
|
|
108540
|
+
def4 = {
|
|
107982
108541
|
localSubdir: [".github", "skills"]
|
|
107983
108542
|
};
|
|
107984
108543
|
});
|
|
107985
108544
|
|
|
107986
108545
|
// src/commands/skills/agents/cursor.ts
|
|
107987
|
-
var
|
|
108546
|
+
var def5;
|
|
107988
108547
|
var init_cursor = __esm(() => {
|
|
107989
|
-
|
|
108548
|
+
def5 = {
|
|
107990
108549
|
localSubdir: [".cursor", "skills"]
|
|
107991
108550
|
};
|
|
107992
108551
|
});
|
|
107993
108552
|
|
|
107994
108553
|
// src/commands/skills/agents/gemini.ts
|
|
107995
|
-
var
|
|
108554
|
+
var def6;
|
|
107996
108555
|
var init_gemini = __esm(() => {
|
|
107997
|
-
|
|
108556
|
+
def6 = {
|
|
107998
108557
|
localSubdir: [".gemini", "skills"]
|
|
107999
108558
|
};
|
|
108000
108559
|
});
|
|
108001
108560
|
|
|
108002
108561
|
// src/commands/skills/agents/opencode.ts
|
|
108003
|
-
var
|
|
108562
|
+
var def7;
|
|
108004
108563
|
var init_opencode = __esm(() => {
|
|
108005
|
-
|
|
108564
|
+
def7 = {
|
|
108006
108565
|
localSubdir: [".opencode", "skills"],
|
|
108007
108566
|
globalSubdir: [".config", "opencode", "skills"]
|
|
108008
108567
|
};
|
|
@@ -108010,8 +108569,8 @@ var init_opencode = __esm(() => {
|
|
|
108010
108569
|
|
|
108011
108570
|
// src/commands/skills/agents/index.ts
|
|
108012
108571
|
function subdirFor(agent, isLocal) {
|
|
108013
|
-
const
|
|
108014
|
-
return isLocal ?
|
|
108572
|
+
const def8 = AGENT_DEFS[agent];
|
|
108573
|
+
return isLocal ? def8.localSubdir : def8.globalSubdir ?? def8.localSubdir;
|
|
108015
108574
|
}
|
|
108016
108575
|
function getSkillsDir(agent, rootDir, isLocal) {
|
|
108017
108576
|
const fs7 = getFileSystem();
|
|
@@ -108056,6 +108615,7 @@ var AGENT_DEFS;
|
|
|
108056
108615
|
var init_agents = __esm(() => {
|
|
108057
108616
|
init_src2();
|
|
108058
108617
|
init_src();
|
|
108618
|
+
init_autopilot();
|
|
108059
108619
|
init_claude();
|
|
108060
108620
|
init_codex();
|
|
108061
108621
|
init_copilot();
|
|
@@ -108063,12 +108623,13 @@ var init_agents = __esm(() => {
|
|
|
108063
108623
|
init_gemini();
|
|
108064
108624
|
init_opencode();
|
|
108065
108625
|
AGENT_DEFS = {
|
|
108066
|
-
claude:
|
|
108067
|
-
cursor:
|
|
108068
|
-
copilot:
|
|
108069
|
-
gemini:
|
|
108070
|
-
codex:
|
|
108071
|
-
opencode:
|
|
108626
|
+
claude: def2,
|
|
108627
|
+
cursor: def5,
|
|
108628
|
+
copilot: def4,
|
|
108629
|
+
gemini: def6,
|
|
108630
|
+
codex: def3,
|
|
108631
|
+
opencode: def7,
|
|
108632
|
+
autopilot: def
|
|
108072
108633
|
};
|
|
108073
108634
|
});
|
|
108074
108635
|
|
|
@@ -108538,7 +109099,8 @@ var init_prompt = __esm(() => {
|
|
|
108538
109099
|
"copilot",
|
|
108539
109100
|
"gemini",
|
|
108540
109101
|
"codex",
|
|
108541
|
-
"opencode"
|
|
109102
|
+
"opencode",
|
|
109103
|
+
"autopilot"
|
|
108542
109104
|
];
|
|
108543
109105
|
AGENT_DISPLAY_NAMES = {
|
|
108544
109106
|
claude: "Claude Code (Plugin)",
|
|
@@ -108546,7 +109108,8 @@ var init_prompt = __esm(() => {
|
|
|
108546
109108
|
copilot: "GitHub Copilot",
|
|
108547
109109
|
gemini: "Gemini CLI",
|
|
108548
109110
|
codex: "Codex",
|
|
108549
|
-
opencode: "OpenCode"
|
|
109111
|
+
opencode: "OpenCode",
|
|
109112
|
+
autopilot: "UiPath Autopilot"
|
|
108550
109113
|
};
|
|
108551
109114
|
});
|
|
108552
109115
|
|
|
@@ -108597,8 +109160,8 @@ async function resolveSkillsContext(options, operation) {
|
|
|
108597
109160
|
}
|
|
108598
109161
|
async function runOneAgent(agent, operation, resolved) {
|
|
108599
109162
|
const { rootDir, storePath, selectedSkills, isLocal } = resolved;
|
|
108600
|
-
const
|
|
108601
|
-
const customHook = operation === "update" ?
|
|
109163
|
+
const def8 = AGENT_DEFS[agent];
|
|
109164
|
+
const customHook = operation === "update" ? def8.update ?? def8.install : def8.install;
|
|
108602
109165
|
if (customHook) {
|
|
108603
109166
|
const [installError] = await catchError(customHook({ skills: selectedSkills, rootDir, storePath, isLocal }));
|
|
108604
109167
|
if (installError) {
|
|
@@ -108815,9 +109378,9 @@ function registerUninstallCommand(skillsCommand) {
|
|
|
108815
109378
|
logger.info(`Uninstalling ${skillNames.length} skill(s) for ${agents.join(", ")}`);
|
|
108816
109379
|
const uninstalled = [];
|
|
108817
109380
|
for (const targetAgent of agents) {
|
|
108818
|
-
const
|
|
108819
|
-
if (
|
|
108820
|
-
const [err] = await catchError(
|
|
109381
|
+
const def8 = AGENT_DEFS[targetAgent];
|
|
109382
|
+
if (def8.uninstall) {
|
|
109383
|
+
const [err] = await catchError(def8.uninstall({
|
|
108821
109384
|
skillNames,
|
|
108822
109385
|
rootDir,
|
|
108823
109386
|
storePath,
|
|
@@ -108908,7 +109471,7 @@ var init_uninstall = __esm(() => {
|
|
|
108908
109471
|
});
|
|
108909
109472
|
|
|
108910
109473
|
// src/services/updateService.skills.ts
|
|
108911
|
-
import { randomUUID as
|
|
109474
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
108912
109475
|
async function runSkillsUpdate(opts) {
|
|
108913
109476
|
const fs7 = getFileSystem();
|
|
108914
109477
|
if (opts.agent !== undefined) {
|
|
@@ -108999,7 +109562,7 @@ async function updateOneSection(opts, candidate) {
|
|
|
108999
109562
|
}
|
|
109000
109563
|
}
|
|
109001
109564
|
if (opts.dryRun) {
|
|
109002
|
-
const tmpRoot = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-dryrun-${
|
|
109565
|
+
const tmpRoot = fs7.path.join(fs7.env.tmpdir(), `uipath-skills-dryrun-${randomUUID5()}`);
|
|
109003
109566
|
try {
|
|
109004
109567
|
await fs7.mkdir(tmpRoot);
|
|
109005
109568
|
const tmpStore = fs7.path.join(tmpRoot, "store");
|
|
@@ -112994,6 +113557,7 @@ async function runToolsUpdate(opts, state) {
|
|
|
112994
113557
|
const entries = [];
|
|
112995
113558
|
const previousVersions = new Map(toUpdate.map((t) => [t.name, t.version]));
|
|
112996
113559
|
const total = toUpdate.length;
|
|
113560
|
+
const pin = opts.pin ?? null;
|
|
112997
113561
|
let index2 = 0;
|
|
112998
113562
|
for (const tool of toUpdate) {
|
|
112999
113563
|
index2++;
|
|
@@ -113007,10 +113571,12 @@ async function runToolsUpdate(opts, state) {
|
|
|
113007
113571
|
const [updateError] = await catchError((async () => {
|
|
113008
113572
|
let targetVersion = opts.version;
|
|
113009
113573
|
if (targetVersion === "latest") {
|
|
113010
|
-
const
|
|
113011
|
-
const
|
|
113574
|
+
const prefix = pin ? pinnedPrefix(pin) : state.getCliVersionPrefix();
|
|
113575
|
+
const exact = pin && isExactPin(pin) ? formatVersionPin(pin) : undefined;
|
|
113576
|
+
const latest = await toolService.searchLatestVersion(fullName, prefix, {
|
|
113012
113577
|
channel: opts.channel,
|
|
113013
|
-
allowLowerFallback:
|
|
113578
|
+
allowLowerFallback: pin === null,
|
|
113579
|
+
exact
|
|
113014
113580
|
});
|
|
113015
113581
|
if (latest) {
|
|
113016
113582
|
targetVersion = latest;
|
|
@@ -113019,7 +113585,7 @@ async function runToolsUpdate(opts, state) {
|
|
|
113019
113585
|
name: tool.name,
|
|
113020
113586
|
status: "failed",
|
|
113021
113587
|
from: tool.version,
|
|
113022
|
-
error: `No compatible ${opts.channel} version found for CLI v${
|
|
113588
|
+
error: pin ? `No version found matching pinned ${formatVersionPin(pin)} in the ${prefix}x line` : `No compatible ${opts.channel} version found for CLI v${prefix}x or lower`
|
|
113023
113589
|
});
|
|
113024
113590
|
return;
|
|
113025
113591
|
}
|
|
@@ -113034,6 +113600,9 @@ async function runToolsUpdate(opts, state) {
|
|
|
113034
113600
|
});
|
|
113035
113601
|
return;
|
|
113036
113602
|
}
|
|
113603
|
+
if (pin && opts.version === "latest" && compareSemver(targetVersion, currentVersion) < 0) {
|
|
113604
|
+
logger.info(`Downgrading ${tool.name} ${currentVersion} → ${targetVersion} to match the pinned version.`);
|
|
113605
|
+
}
|
|
113037
113606
|
if (opts.dryRun) {
|
|
113038
113607
|
entries.push({
|
|
113039
113608
|
name: tool.name,
|
|
@@ -113110,11 +113679,50 @@ async function runToolsUpdate(opts, state) {
|
|
|
113110
113679
|
}
|
|
113111
113680
|
return { entries };
|
|
113112
113681
|
}
|
|
113682
|
+
async function revertToolsUpdate(report, state) {
|
|
113683
|
+
const reverted = [];
|
|
113684
|
+
const failed = [];
|
|
113685
|
+
const targets = report.entries.filter((e) => e.status === "updated");
|
|
113686
|
+
if (targets.length === 0) {
|
|
113687
|
+
return { reverted, failed };
|
|
113688
|
+
}
|
|
113689
|
+
const [locationError, location] = await catchError(state.resolveInstallPath());
|
|
113690
|
+
if (locationError) {
|
|
113691
|
+
for (const entry of targets) {
|
|
113692
|
+
failed.push({ name: entry.name, error: locationError.message });
|
|
113693
|
+
}
|
|
113694
|
+
return { reverted, failed };
|
|
113695
|
+
}
|
|
113696
|
+
for (const entry of targets) {
|
|
113697
|
+
if (!entry.from) {
|
|
113698
|
+
failed.push({
|
|
113699
|
+
name: entry.name,
|
|
113700
|
+
error: "No previous version recorded to revert to."
|
|
113701
|
+
});
|
|
113702
|
+
continue;
|
|
113703
|
+
}
|
|
113704
|
+
const packageName = `@uipath/${entry.name}@${entry.from}`;
|
|
113705
|
+
const [installError] = await catchError(toolService.install(packageName, location.path, {
|
|
113706
|
+
global: location.global
|
|
113707
|
+
}));
|
|
113708
|
+
if (installError) {
|
|
113709
|
+
logger.debug(`Failed to revert ${entry.name} to ${entry.from}: ${installError.message}`);
|
|
113710
|
+
failed.push({ name: entry.name, error: installError.message });
|
|
113711
|
+
continue;
|
|
113712
|
+
}
|
|
113713
|
+
logger.info(`Reverted ${entry.name} to ${entry.from} after the CLI self-update failed.`);
|
|
113714
|
+
entry.status = "reverted";
|
|
113715
|
+
entry.to = entry.from;
|
|
113716
|
+
reverted.push(entry.name);
|
|
113717
|
+
}
|
|
113718
|
+
return { reverted, failed };
|
|
113719
|
+
}
|
|
113113
113720
|
var TOOLS_UPDATE_PHASES;
|
|
113114
113721
|
var init_updateService_tools = __esm(() => {
|
|
113115
113722
|
init_src2();
|
|
113116
113723
|
init_src();
|
|
113117
113724
|
init_toolService();
|
|
113725
|
+
init_versionPin();
|
|
113118
113726
|
TOOLS_UPDATE_PHASES = {
|
|
113119
113727
|
Checking: "checking",
|
|
113120
113728
|
Installing: "installing"
|
|
@@ -113123,7 +113731,7 @@ var init_updateService_tools = __esm(() => {
|
|
|
113123
113731
|
|
|
113124
113732
|
// src/commands/tools/update.ts
|
|
113125
113733
|
function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
113126
|
-
toolsCommand.command("update").description("Update installed tools").option("--name <scoped-tool-name>", "scoped package name").
|
|
113734
|
+
toolsCommand.command("update").description("Update installed tools").option("--name <scoped-tool-name>", "scoped package name").examples(TOOLS_UPDATE_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
113127
113735
|
const spinner = getOutputSink().capabilities.isInteractive ? ora({ text: "Updating tools…" }).start() : undefined;
|
|
113128
113736
|
let report;
|
|
113129
113737
|
try {
|
|
@@ -113131,7 +113739,8 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
|
113131
113739
|
dryRun: false,
|
|
113132
113740
|
channel: resolveChannel(),
|
|
113133
113741
|
name: options.name,
|
|
113134
|
-
version:
|
|
113742
|
+
version: "latest",
|
|
113743
|
+
pin: resolvePinnedVersion(),
|
|
113135
113744
|
onProgress: spinner ? ({ current, total, tool, phase }) => {
|
|
113136
113745
|
const verb = phase === TOOLS_UPDATE_PHASES.Checking ? "Checking" : "Installing";
|
|
113137
113746
|
spinner.text = `[${current}/${total}] ${verb} ${tool}`;
|
|
@@ -113155,7 +113764,7 @@ function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
|
113155
113764
|
OutputFormatter.error({
|
|
113156
113765
|
Result: RESULTS.Failure,
|
|
113157
113766
|
Message: `Failed to update ${failed.length} tool(s).`,
|
|
113158
|
-
Instructions: "Check tool compatibility with the current CLI version,
|
|
113767
|
+
Instructions: "Check tool compatibility with the current CLI version, adjust the pinned `core.version`, or run `uip config set updateChannel <alpha|beta|stable>` to switch release channels."
|
|
113159
113768
|
});
|
|
113160
113769
|
processContext.exit(EXIT_CODES.Failure);
|
|
113161
113770
|
return;
|
|
@@ -113173,6 +113782,7 @@ var init_update2 = __esm(() => {
|
|
|
113173
113782
|
init_ora();
|
|
113174
113783
|
init_channel();
|
|
113175
113784
|
init_updateService_tools();
|
|
113785
|
+
init_versionPin();
|
|
113176
113786
|
TOOLS_UPDATE_EXAMPLES = [
|
|
113177
113787
|
{
|
|
113178
113788
|
Description: "Update all installed tools to the latest version",
|
|
@@ -113295,7 +113905,13 @@ async function checkCliVersion(opts) {
|
|
|
113295
113905
|
if (opts.isLocal) {
|
|
113296
113906
|
return skipped(opts.cliPkgVersion, "local install");
|
|
113297
113907
|
}
|
|
113298
|
-
const
|
|
113908
|
+
const pin = opts.pin ?? null;
|
|
113909
|
+
const [err, latest] = await catchError(pin ? toolService.searchLatestVersion("@uipath/cli", pinnedPrefix(pin), {
|
|
113910
|
+
channel: opts.channel,
|
|
113911
|
+
allowLowerFallback: false,
|
|
113912
|
+
exact: isExactPin(pin) ? formatVersionPin(pin) : undefined,
|
|
113913
|
+
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
113914
|
+
}) : toolService.searchLatestVersion("@uipath/cli", undefined, {
|
|
113299
113915
|
channel: opts.channel,
|
|
113300
113916
|
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
113301
113917
|
}));
|
|
@@ -113304,9 +113920,18 @@ async function checkCliVersion(opts) {
|
|
|
113304
113920
|
return skipped(opts.cliPkgVersion, "network error");
|
|
113305
113921
|
}
|
|
113306
113922
|
if (!latest) {
|
|
113923
|
+
if (pin) {
|
|
113924
|
+
return {
|
|
113925
|
+
current: opts.cliPkgVersion,
|
|
113926
|
+
available: null,
|
|
113927
|
+
action: "failed",
|
|
113928
|
+
reason: `No @uipath/cli version found matching pinned ${formatVersionPin(pin)} in the ${pinnedPrefix(pin)}x line`
|
|
113929
|
+
};
|
|
113930
|
+
}
|
|
113307
113931
|
return skipped(opts.cliPkgVersion, `no ${opts.channel} version found`);
|
|
113308
113932
|
}
|
|
113309
|
-
|
|
113933
|
+
const differs = pin ? compareSemver(latest, opts.cliPkgVersion) !== 0 : compareSemver(latest, opts.cliPkgVersion) > 0;
|
|
113934
|
+
if (differs) {
|
|
113310
113935
|
return {
|
|
113311
113936
|
current: opts.cliPkgVersion,
|
|
113312
113937
|
available: latest,
|
|
@@ -113328,6 +113953,7 @@ var CLI_VERSION_PROBE_TIMEOUT_MS = 8000;
|
|
|
113328
113953
|
var init_updateService_cli = __esm(() => {
|
|
113329
113954
|
init_src2();
|
|
113330
113955
|
init_toolService();
|
|
113956
|
+
init_versionPin();
|
|
113331
113957
|
});
|
|
113332
113958
|
|
|
113333
113959
|
// src/services/updateService.ts
|
|
@@ -113338,7 +113964,8 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
113338
113964
|
dryRun,
|
|
113339
113965
|
channel,
|
|
113340
113966
|
name: options.tools.name,
|
|
113341
|
-
version:
|
|
113967
|
+
version: "latest",
|
|
113968
|
+
pin: options.versionPin ?? null
|
|
113342
113969
|
}, state) : null;
|
|
113343
113970
|
if (toolsReport?.fatal?.code === "NO_TOOLS_INSTALLED") {
|
|
113344
113971
|
toolsReport = { entries: [] };
|
|
@@ -113358,7 +113985,7 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
113358
113985
|
Subsystem: "tools",
|
|
113359
113986
|
Result: "Failure",
|
|
113360
113987
|
Message: `Failed to update ${entry.name}: ${entry.error ?? "unknown error"}`,
|
|
113361
|
-
Instructions: "Check tool compatibility with the current CLI version,
|
|
113988
|
+
Instructions: "Check tool compatibility with the current CLI version, adjust the pinned `core.version`, or run `uip config set updateChannel <alpha|beta|stable>` to switch release channels."
|
|
113362
113989
|
});
|
|
113363
113990
|
}
|
|
113364
113991
|
}
|
|
@@ -113385,7 +114012,8 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
113385
114012
|
channel,
|
|
113386
114013
|
cliPkgVersion: cliEnv.cliPkgVersion,
|
|
113387
114014
|
isLocal: cliEnv.isLocal,
|
|
113388
|
-
isDev: cliEnv.isDev
|
|
114015
|
+
isDev: cliEnv.isDev,
|
|
114016
|
+
pin: options.versionPin ?? null
|
|
113389
114017
|
}) : null;
|
|
113390
114018
|
const selfUpdate = options.cli?.self !== false;
|
|
113391
114019
|
if (cliReport?.action === "notice" && cliReport.available && !dryRun && selfUpdate) {
|
|
@@ -113393,6 +114021,10 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
113393
114021
|
if (installCtx.kind !== "unknown") {
|
|
113394
114022
|
const noticeReport = cliReport;
|
|
113395
114023
|
const available = noticeReport.available;
|
|
114024
|
+
const pin = options.versionPin ?? null;
|
|
114025
|
+
if (pin && compareSemver(available, noticeReport.current) < 0) {
|
|
114026
|
+
logger.info(`Downgrading @uipath/cli ${noticeReport.current} → ${available} to match the pinned version.`);
|
|
114027
|
+
}
|
|
113396
114028
|
const target = `@uipath/cli@${available}`;
|
|
113397
114029
|
const manualCommand = describeUpdateCommand(target, installCtx);
|
|
113398
114030
|
const [installErr] = await catchError(runCliSelfUpdate(target, installCtx, cliEnv.installPath));
|
|
@@ -113411,6 +114043,25 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
113411
114043
|
}
|
|
113412
114044
|
}
|
|
113413
114045
|
}
|
|
114046
|
+
if (cliReport?.action === "failed" && cliReport.available === null) {
|
|
114047
|
+
errors7.push({
|
|
114048
|
+
Subsystem: "cli",
|
|
114049
|
+
Result: "Failure",
|
|
114050
|
+
Message: cliReport.reason ?? "Failed to resolve the pinned @uipath/cli version.",
|
|
114051
|
+
Instructions: "Pin a published version line with `uip config set version <major.minor>` (or clear the pin), then re-run `uip update`."
|
|
114052
|
+
});
|
|
114053
|
+
}
|
|
114054
|
+
if (cliReport?.action === "failed" && !dryRun && toolsReport) {
|
|
114055
|
+
const { failed } = await revertToolsUpdate(toolsReport, state);
|
|
114056
|
+
for (const f of failed) {
|
|
114057
|
+
errors7.push({
|
|
114058
|
+
Subsystem: "tools",
|
|
114059
|
+
Result: "Failure",
|
|
114060
|
+
Message: `Failed to roll back ${f.name} after the CLI self-update failed: ${f.error}`,
|
|
114061
|
+
Instructions: "The CLI self-update failed and this tool could not be reverted, leaving a version mismatch. " + "Re-run `uip update`, or reinstall the matching version with `uip tools install @uipath/<name>@<version>`."
|
|
114062
|
+
});
|
|
114063
|
+
}
|
|
114064
|
+
}
|
|
113414
114065
|
const toolsFailed = !!toolsReport && (!!toolsReport.fatal || toolsReport.entries.some((e) => e.status === "failed"));
|
|
113415
114066
|
const skillsFailed = !!skillsReport && skillsReport.sections.some((s) => !!s.error);
|
|
113416
114067
|
const cliFailed = cliReport?.action === "failed";
|
|
@@ -113436,7 +114087,7 @@ var init_updateService = __esm(() => {
|
|
|
113436
114087
|
|
|
113437
114088
|
// src/commands/update.ts
|
|
113438
114089
|
function registerUpdateCommand3(program2, _context, state) {
|
|
113439
|
-
program2.command("update").description("Update installed UiPath tools and skills, and check for newer CLI").option("--dry-run", "Preview changes without applying them", false).option("--tools-only", "Skip skills section", false).option("--skills-only", "Skip tools section", false).option("--no-tools", "Do not update tools").option("--no-skills", "Do not update skills").option("--no-cli-check", "Do not probe for newer CLI version").option("--no-self", "Do not auto-update the CLI itself; only print a notice").option("--channel <channel>", "Override channel: stable | alpha | beta").option("--name <scoped-tool-name>", "Restrict tool update to one tool").option("--
|
|
114090
|
+
program2.command("update").description("Update installed UiPath tools and skills, and check for newer CLI").option("--dry-run", "Preview changes without applying them", false).option("--tools-only", "Skip skills section", false).option("--skills-only", "Skip tools section", false).option("--no-tools", "Do not update tools").option("--no-skills", "Do not update skills").option("--no-cli-check", "Do not probe for newer CLI version").option("--no-self", "Do not auto-update the CLI itself; only print a notice").option("--channel <channel>", "Override channel: stable | alpha | beta").option("--name <scoped-tool-name>", "Restrict tool update to one tool").option("--agent <agent>", "Restrict skill update to one agent").option("--local", "Restrict skills update to local scope only").option("--no-local", "Restrict skills update to global scope only").examples(UPDATE_EXAMPLES).trackedAction(processContext, async (raw) => {
|
|
113440
114091
|
if (raw.toolsOnly && raw.skillsOnly) {
|
|
113441
114092
|
OutputFormatter.error({
|
|
113442
114093
|
Result: RESULTS.ValidationError,
|
|
@@ -113464,16 +114115,7 @@ function registerUpdateCommand3(program2, _context, state) {
|
|
|
113464
114115
|
processContext.exit(EXIT_CODES.ValidationError);
|
|
113465
114116
|
return;
|
|
113466
114117
|
}
|
|
113467
|
-
const
|
|
113468
|
-
if (!toolsDisabled && raw.version !== undefined && raw.version !== "latest" && !raw.name) {
|
|
113469
|
-
OutputFormatter.error({
|
|
113470
|
-
Result: RESULTS.ValidationError,
|
|
113471
|
-
Message: "--version requires --name.",
|
|
113472
|
-
Instructions: "Pin a version per tool: --name <scoped-tool-name> --version <semver>."
|
|
113473
|
-
});
|
|
113474
|
-
processContext.exit(EXIT_CODES.ValidationError);
|
|
113475
|
-
return;
|
|
113476
|
-
}
|
|
114118
|
+
const versionPin = resolvePinnedVersion();
|
|
113477
114119
|
const channel = resolveChannelFlag(raw.channel);
|
|
113478
114120
|
if (channel === null) {
|
|
113479
114121
|
OutputFormatter.error({
|
|
@@ -113496,12 +114138,13 @@ function registerUpdateCommand3(program2, _context, state) {
|
|
|
113496
114138
|
dryRun: raw.dryRun ?? false,
|
|
113497
114139
|
channel,
|
|
113498
114140
|
sections,
|
|
113499
|
-
tools: { name: raw.name
|
|
114141
|
+
tools: { name: raw.name },
|
|
113500
114142
|
skills: {
|
|
113501
114143
|
agent: raw.agent,
|
|
113502
114144
|
local: raw.local
|
|
113503
114145
|
},
|
|
113504
|
-
cli: { self: raw.self !== false }
|
|
114146
|
+
cli: { self: raw.self !== false },
|
|
114147
|
+
versionPin
|
|
113505
114148
|
}, state, {
|
|
113506
114149
|
cliPkgVersion: package_default.version,
|
|
113507
114150
|
isLocal: !location.global,
|
|
@@ -113551,6 +114194,7 @@ var init_update3 = __esm(() => {
|
|
|
113551
114194
|
init_cliInstaller();
|
|
113552
114195
|
init_toolService();
|
|
113553
114196
|
init_updateService();
|
|
114197
|
+
init_versionPin();
|
|
113554
114198
|
VALID_CHANNELS2 = new Set([
|
|
113555
114199
|
"stable",
|
|
113556
114200
|
"alpha",
|
|
@@ -113884,7 +114528,10 @@ var init_autoInstall = __esm(() => {
|
|
|
113884
114528
|
// src/utils/registerToolCommands.ts
|
|
113885
114529
|
function registerToolCommands(program2, discovered, context) {
|
|
113886
114530
|
for (const entry of discovered) {
|
|
114531
|
+
const aliases = ALIASES_BY_COMMAND.get(entry.commandPrefix) ?? [];
|
|
113887
114532
|
const toolCommand = program2.command(entry.commandPrefix).description(entry.description).allowUnknownOption().allowExcessArguments(true).helpOption(false);
|
|
114533
|
+
if (aliases.length > 0)
|
|
114534
|
+
toolCommand.aliases(aliases);
|
|
113888
114535
|
toolCommand.action(async () => {
|
|
113889
114536
|
logger.debug(`Loading tool '${entry.toolName}'...`);
|
|
113890
114537
|
const tool = await importTool(entry);
|
|
@@ -113901,6 +114548,8 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
113901
114548
|
program2.commands.splice(idx, 1);
|
|
113902
114549
|
}
|
|
113903
114550
|
const realCommand = program2.command(tool.metadata.commandPrefix).description(tool.metadata.description);
|
|
114551
|
+
if (aliases.length > 0)
|
|
114552
|
+
realCommand.aliases(aliases);
|
|
113904
114553
|
const [regError] = await catchError(tool.registerCommands(realCommand));
|
|
113905
114554
|
if (regError) {
|
|
113906
114555
|
OutputFormatter.error({
|
|
@@ -113911,7 +114560,8 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
113911
114560
|
return;
|
|
113912
114561
|
}
|
|
113913
114562
|
const toolArgs = context.args.slice(2);
|
|
113914
|
-
const
|
|
114563
|
+
const candidates = [entry.commandPrefix, ...aliases];
|
|
114564
|
+
const prefixIdx = toolArgs.findIndex((a) => candidates.includes(a));
|
|
113915
114565
|
const positionals = prefixIdx >= 0 ? toolArgs.slice(prefixIdx + 1).filter((a) => !a.startsWith("-")) : [];
|
|
113916
114566
|
const unknownSub = findUnknownHelpCommand(realCommand, positionals, toolArgs);
|
|
113917
114567
|
if (unknownSub) {
|
|
@@ -113929,6 +114579,7 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
113929
114579
|
}
|
|
113930
114580
|
var init_registerToolCommands = __esm(() => {
|
|
113931
114581
|
init_src2();
|
|
114582
|
+
init_tools_whitelist();
|
|
113932
114583
|
init_toolLoader();
|
|
113933
114584
|
});
|
|
113934
114585
|
|
|
@@ -114135,6 +114786,11 @@ class TerminalSink {
|
|
|
114135
114786
|
|
|
114136
114787
|
// index.ts
|
|
114137
114788
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
114789
|
+
process.stdout.on("error", (err) => {
|
|
114790
|
+
if (err.code === "EPIPE")
|
|
114791
|
+
process.exit(0);
|
|
114792
|
+
});
|
|
114793
|
+
process.stderr.on("error", () => {});
|
|
114138
114794
|
configureLogger({ sink: new TerminalSink });
|
|
114139
114795
|
installConsoleGuard();
|
|
114140
114796
|
var pollController = createPollAbortController();
|