@uipath/model-hub-tool 1.205.0-preview.281 → 1.206.0-preview.282
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-xnzgkhtg.js → index-x4997kvr.js} +2 -22
- package/dist/index.js +6 -7
- package/dist/{jmespath-drx4ffp3.js → jmespath-09m00b2f.js} +1 -1
- package/dist/{js-yaml-71wj4em9.js → js-yaml-cr6n3g9w.js} +1 -3
- package/dist/{tool-1de529jm.js → tool-epsr41wx.js} +12 -3
- package/dist/{tool-mdynk53c.js → tool-hzamp9cm.js} +1167 -648
- package/dist/tool.js +6 -7
- package/package.json +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
__toESM,
|
|
2
3
|
__commonJS,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./tool-
|
|
4
|
+
__exportCjs,
|
|
5
|
+
__require
|
|
6
|
+
} from "./tool-epsr41wx.js";
|
|
6
7
|
|
|
7
8
|
// ../../../node_modules/commander/lib/error.js
|
|
8
9
|
var require_error = __commonJS(function(exports) {
|
|
@@ -124,7 +125,7 @@ var require_help = __commonJS(function(exports) {
|
|
|
124
125
|
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
125
126
|
}
|
|
126
127
|
visibleCommands(cmd) {
|
|
127
|
-
const visibleCommands = cmd.commands.filter((
|
|
128
|
+
const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
|
|
128
129
|
const helpCommand = cmd._getHelpCommand();
|
|
129
130
|
if (helpCommand && !helpCommand._hidden) {
|
|
130
131
|
visibleCommands.push(helpCommand);
|
|
@@ -604,8 +605,8 @@ var require_option = __commonJS(function(exports) {
|
|
|
604
605
|
}
|
|
605
606
|
}
|
|
606
607
|
function camelcase(str) {
|
|
607
|
-
return str.split("-").reduce((
|
|
608
|
-
return
|
|
608
|
+
return str.split("-").reduce((str, word) => {
|
|
609
|
+
return str + word[0].toUpperCase() + word.slice(1);
|
|
609
610
|
});
|
|
610
611
|
}
|
|
611
612
|
function splitOptionFlags(flags) {
|
|
@@ -726,8 +727,8 @@ var require_suggestSimilar = __commonJS(function(exports) {
|
|
|
726
727
|
var require_command = __commonJS(function(exports) {
|
|
727
728
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
728
729
|
var childProcess = __require("node:child_process");
|
|
729
|
-
var
|
|
730
|
-
var
|
|
730
|
+
var path = __require("node:path");
|
|
731
|
+
var fs = __require("node:fs");
|
|
731
732
|
var process2 = __require("node:process");
|
|
732
733
|
var { Argument, humanReadableArgName } = require_argument();
|
|
733
734
|
var { CommanderError } = require_error();
|
|
@@ -1176,44 +1177,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1176
1177
|
});
|
|
1177
1178
|
return source;
|
|
1178
1179
|
}
|
|
1179
|
-
_prepareUserArgs(
|
|
1180
|
-
if (
|
|
1180
|
+
_prepareUserArgs(argv2, parseOptions) {
|
|
1181
|
+
if (argv2 !== undefined && !Array.isArray(argv2)) {
|
|
1181
1182
|
throw new Error("first parameter to parse must be array or undefined");
|
|
1182
1183
|
}
|
|
1183
1184
|
parseOptions = parseOptions || {};
|
|
1184
|
-
if (
|
|
1185
|
+
if (argv2 === undefined && parseOptions.from === undefined) {
|
|
1185
1186
|
if (process2.versions?.electron) {
|
|
1186
1187
|
parseOptions.from = "electron";
|
|
1187
1188
|
}
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1189
|
+
const execArgv2 = process2.execArgv ?? [];
|
|
1190
|
+
if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
|
|
1190
1191
|
parseOptions.from = "eval";
|
|
1191
1192
|
}
|
|
1192
1193
|
}
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1194
|
+
if (argv2 === undefined) {
|
|
1195
|
+
argv2 = process2.argv;
|
|
1195
1196
|
}
|
|
1196
|
-
this.rawArgs =
|
|
1197
|
+
this.rawArgs = argv2.slice();
|
|
1197
1198
|
let userArgs;
|
|
1198
1199
|
switch (parseOptions.from) {
|
|
1199
1200
|
case undefined:
|
|
1200
1201
|
case "node":
|
|
1201
|
-
this._scriptPath =
|
|
1202
|
-
userArgs =
|
|
1202
|
+
this._scriptPath = argv2[1];
|
|
1203
|
+
userArgs = argv2.slice(2);
|
|
1203
1204
|
break;
|
|
1204
1205
|
case "electron":
|
|
1205
1206
|
if (process2.defaultApp) {
|
|
1206
|
-
this._scriptPath =
|
|
1207
|
-
userArgs =
|
|
1207
|
+
this._scriptPath = argv2[1];
|
|
1208
|
+
userArgs = argv2.slice(2);
|
|
1208
1209
|
} else {
|
|
1209
|
-
userArgs =
|
|
1210
|
+
userArgs = argv2.slice(1);
|
|
1210
1211
|
}
|
|
1211
1212
|
break;
|
|
1212
1213
|
case "user":
|
|
1213
|
-
userArgs =
|
|
1214
|
+
userArgs = argv2.slice(0);
|
|
1214
1215
|
break;
|
|
1215
1216
|
case "eval":
|
|
1216
|
-
userArgs =
|
|
1217
|
+
userArgs = argv2.slice(1);
|
|
1217
1218
|
break;
|
|
1218
1219
|
default:
|
|
1219
1220
|
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
|
|
@@ -1262,7 +1263,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1262
1263
|
this.processedArgs = [];
|
|
1263
1264
|
}
|
|
1264
1265
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1265
|
-
if (
|
|
1266
|
+
if (fs.existsSync(executableFile))
|
|
1266
1267
|
return;
|
|
1267
1268
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
1268
1269
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -1276,12 +1277,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1276
1277
|
let launchWithNode = false;
|
|
1277
1278
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1278
1279
|
function findFile(baseDir, baseName) {
|
|
1279
|
-
const localBin =
|
|
1280
|
-
if (
|
|
1280
|
+
const localBin = path.resolve(baseDir, baseName);
|
|
1281
|
+
if (fs.existsSync(localBin))
|
|
1281
1282
|
return localBin;
|
|
1282
|
-
if (sourceExt.includes(
|
|
1283
|
+
if (sourceExt.includes(path.extname(baseName)))
|
|
1283
1284
|
return;
|
|
1284
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1285
|
+
const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
|
|
1285
1286
|
if (foundExt)
|
|
1286
1287
|
return `${localBin}${foundExt}`;
|
|
1287
1288
|
return;
|
|
@@ -1293,23 +1294,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1293
1294
|
if (this._scriptPath) {
|
|
1294
1295
|
let resolvedScriptPath;
|
|
1295
1296
|
try {
|
|
1296
|
-
resolvedScriptPath =
|
|
1297
|
+
resolvedScriptPath = fs.realpathSync(this._scriptPath);
|
|
1297
1298
|
} catch {
|
|
1298
1299
|
resolvedScriptPath = this._scriptPath;
|
|
1299
1300
|
}
|
|
1300
|
-
executableDir =
|
|
1301
|
+
executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
|
|
1301
1302
|
}
|
|
1302
1303
|
if (executableDir) {
|
|
1303
1304
|
let localFile = findFile(executableDir, executableFile);
|
|
1304
1305
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1305
|
-
const legacyName =
|
|
1306
|
+
const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
|
|
1306
1307
|
if (legacyName !== this._name) {
|
|
1307
1308
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1308
1309
|
}
|
|
1309
1310
|
}
|
|
1310
1311
|
executableFile = localFile || executableFile;
|
|
1311
1312
|
}
|
|
1312
|
-
launchWithNode = sourceExt.includes(
|
|
1313
|
+
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
1313
1314
|
let proc;
|
|
1314
1315
|
if (process2.platform !== "win32") {
|
|
1315
1316
|
if (launchWithNode) {
|
|
@@ -1736,18 +1737,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1736
1737
|
this.error(message, { code: "commander.missingMandatoryOptionValue" });
|
|
1737
1738
|
}
|
|
1738
1739
|
_conflictingOption(option, conflictingOption) {
|
|
1739
|
-
const findBestOptionFromValue = (
|
|
1740
|
-
const optionKey =
|
|
1740
|
+
const findBestOptionFromValue = (option) => {
|
|
1741
|
+
const optionKey = option.attributeName();
|
|
1741
1742
|
const optionValue = this.getOptionValue(optionKey);
|
|
1742
1743
|
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
|
|
1743
1744
|
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
|
|
1744
1745
|
if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
|
|
1745
1746
|
return negativeOption;
|
|
1746
1747
|
}
|
|
1747
|
-
return positiveOption ||
|
|
1748
|
+
return positiveOption || option;
|
|
1748
1749
|
};
|
|
1749
|
-
const getErrorMessage = (
|
|
1750
|
-
const bestOption = findBestOptionFromValue(
|
|
1750
|
+
const getErrorMessage = (option) => {
|
|
1751
|
+
const bestOption = findBestOptionFromValue(option);
|
|
1751
1752
|
const optionKey = bestOption.attributeName();
|
|
1752
1753
|
const source = this.getOptionValueSource(optionKey);
|
|
1753
1754
|
if (source === "env") {
|
|
@@ -1898,13 +1899,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1898
1899
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
1899
1900
|
}
|
|
1900
1901
|
nameFromFilename(filename) {
|
|
1901
|
-
this._name =
|
|
1902
|
+
this._name = path.basename(filename, path.extname(filename));
|
|
1902
1903
|
return this;
|
|
1903
1904
|
}
|
|
1904
|
-
executableDir(
|
|
1905
|
-
if (
|
|
1905
|
+
executableDir(path) {
|
|
1906
|
+
if (path === undefined)
|
|
1906
1907
|
return this._executableDir;
|
|
1907
|
-
this._executableDir =
|
|
1908
|
+
this._executableDir = path;
|
|
1908
1909
|
return this;
|
|
1909
1910
|
}
|
|
1910
1911
|
helpInformation(contextOptions) {
|
|
@@ -2001,11 +2002,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2001
2002
|
}
|
|
2002
2003
|
help(contextOptions) {
|
|
2003
2004
|
this.outputHelp(contextOptions);
|
|
2004
|
-
let
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2005
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
2006
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2007
|
+
exitCode2 = 1;
|
|
2007
2008
|
}
|
|
2008
|
-
this._exit(
|
|
2009
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
2009
2010
|
}
|
|
2010
2011
|
addHelpText(position, text) {
|
|
2011
2012
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
@@ -2076,32 +2077,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2076
2077
|
exports.Command = Command;
|
|
2077
2078
|
exports.useColor = useColor;
|
|
2078
2079
|
});
|
|
2079
|
-
|
|
2080
|
-
// ../../../node_modules/commander/index.js
|
|
2081
|
-
var require_commander = __commonJS(function(exports) {
|
|
2082
|
-
var { Argument } = require_argument();
|
|
2083
|
-
var { Command } = require_command();
|
|
2084
|
-
var { CommanderError, InvalidArgumentError } = require_error();
|
|
2085
|
-
var { Help } = require_help();
|
|
2086
|
-
var { Option } = require_option();
|
|
2087
|
-
exports.program = new Command;
|
|
2088
|
-
exports.createCommand = (name) => new Command(name);
|
|
2089
|
-
exports.createOption = (flags, description) => new Option(flags, description);
|
|
2090
|
-
exports.createArgument = (name, description) => new Argument(name, description);
|
|
2091
|
-
exports.Command = Command;
|
|
2092
|
-
exports.Option = Option;
|
|
2093
|
-
exports.Argument = Argument;
|
|
2094
|
-
exports.Help = Help;
|
|
2095
|
-
exports.CommanderError = CommanderError;
|
|
2096
|
-
exports.InvalidArgumentError = InvalidArgumentError;
|
|
2097
|
-
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
2098
|
-
});
|
|
2099
2080
|
// package.json
|
|
2100
2081
|
var package_default = {
|
|
2101
2082
|
name: "@uipath/model-hub-tool",
|
|
2102
2083
|
author: "UiPath",
|
|
2103
2084
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.
|
|
2085
|
+
version: "1.206.0-preview.282",
|
|
2105
2086
|
description: "CLI plugin for the UiPath Model Hub (LLM Gateway organization-scoped views).",
|
|
2106
2087
|
private: false,
|
|
2107
2088
|
repository: {
|
|
@@ -2145,7 +2126,7 @@ var package_default = {
|
|
|
2145
2126
|
};
|
|
2146
2127
|
|
|
2147
2128
|
// ../../filesystem/src/node.ts
|
|
2148
|
-
import { randomUUID } from "node:crypto";
|
|
2129
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2149
2130
|
import { existsSync } from "node:fs";
|
|
2150
2131
|
import * as fs from "node:fs/promises";
|
|
2151
2132
|
import * as os from "node:os";
|
|
@@ -2156,6 +2137,9 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
2156
2137
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
2157
2138
|
var LOCK_RETRY_MIN_MS = 100;
|
|
2158
2139
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
2140
|
+
var HASH_CHUNK_BYTES = 256 * 1024;
|
|
2141
|
+
var hashBuffers = [];
|
|
2142
|
+
var HASH_BUFFERS_KEPT = 64;
|
|
2159
2143
|
|
|
2160
2144
|
class NodeFileSystem {
|
|
2161
2145
|
path = {
|
|
@@ -2174,7 +2158,7 @@ class NodeFileSystem {
|
|
|
2174
2158
|
};
|
|
2175
2159
|
utils = {
|
|
2176
2160
|
open: async (url) => {
|
|
2177
|
-
const { default: open } = await import("./index-
|
|
2161
|
+
const { default: open } = await import("./index-x4997kvr.js");
|
|
2178
2162
|
await open(url);
|
|
2179
2163
|
}
|
|
2180
2164
|
};
|
|
@@ -2213,6 +2197,15 @@ class NodeFileSystem {
|
|
|
2213
2197
|
throw error;
|
|
2214
2198
|
}
|
|
2215
2199
|
}
|
|
2200
|
+
async readdirEntries(dirPath) {
|
|
2201
|
+
try {
|
|
2202
|
+
return await fs.readdir(dirPath, { withFileTypes: true });
|
|
2203
|
+
} catch (error) {
|
|
2204
|
+
if (this.isEnoent(error))
|
|
2205
|
+
return [];
|
|
2206
|
+
throw error;
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2216
2209
|
async stat(filePath) {
|
|
2217
2210
|
try {
|
|
2218
2211
|
const stats = await fs.stat(filePath);
|
|
@@ -2220,7 +2213,8 @@ class NodeFileSystem {
|
|
|
2220
2213
|
isFile: () => stats.isFile(),
|
|
2221
2214
|
isDirectory: () => stats.isDirectory(),
|
|
2222
2215
|
size: stats.size,
|
|
2223
|
-
mtimeMs: stats.mtimeMs
|
|
2216
|
+
mtimeMs: stats.mtimeMs,
|
|
2217
|
+
ctimeMs: stats.ctimeMs
|
|
2224
2218
|
};
|
|
2225
2219
|
} catch (error) {
|
|
2226
2220
|
if (this.isEnoent(error))
|
|
@@ -2334,6 +2328,42 @@ class NodeFileSystem {
|
|
|
2334
2328
|
throw error;
|
|
2335
2329
|
}
|
|
2336
2330
|
}
|
|
2331
|
+
async hashFile(filePath) {
|
|
2332
|
+
let handle;
|
|
2333
|
+
try {
|
|
2334
|
+
handle = await fs.open(filePath, "r");
|
|
2335
|
+
} catch (error) {
|
|
2336
|
+
if (this.isEnoent(error))
|
|
2337
|
+
return null;
|
|
2338
|
+
throw error;
|
|
2339
|
+
}
|
|
2340
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
2341
|
+
try {
|
|
2342
|
+
const opened = await handle.stat();
|
|
2343
|
+
const stats = {
|
|
2344
|
+
isFile: () => opened.isFile(),
|
|
2345
|
+
isDirectory: () => opened.isDirectory(),
|
|
2346
|
+
size: opened.size,
|
|
2347
|
+
mtimeMs: opened.mtimeMs,
|
|
2348
|
+
ctimeMs: opened.ctimeMs
|
|
2349
|
+
};
|
|
2350
|
+
const hash = createHash("sha256");
|
|
2351
|
+
let size = 0;
|
|
2352
|
+
for (;; ) {
|
|
2353
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
2354
|
+
if (bytesRead === 0)
|
|
2355
|
+
break;
|
|
2356
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
2357
|
+
size += bytesRead;
|
|
2358
|
+
}
|
|
2359
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
2360
|
+
} finally {
|
|
2361
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
2362
|
+
hashBuffers.push(buffer);
|
|
2363
|
+
}
|
|
2364
|
+
await handle.close();
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2337
2367
|
async realpath(filePath) {
|
|
2338
2368
|
try {
|
|
2339
2369
|
return await fs.realpath(filePath);
|
|
@@ -2384,6 +2414,208 @@ class NodeFileSystem {
|
|
|
2384
2414
|
var fsInstance = new NodeFileSystem;
|
|
2385
2415
|
var getFileSystem = () => fsInstance;
|
|
2386
2416
|
|
|
2417
|
+
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
2418
|
+
var BaseDimensions = {
|
|
2419
|
+
ApplicationName: "ApplicationName",
|
|
2420
|
+
ProductVersion: "ProductVersion",
|
|
2421
|
+
InstallationId: "InstallationId",
|
|
2422
|
+
CloudUserId: "CloudUserId",
|
|
2423
|
+
CloudTenantId: "CloudTenantId",
|
|
2424
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
2425
|
+
IsInternalUser: "IsInternalUser",
|
|
2426
|
+
Environment: "Environment",
|
|
2427
|
+
BaseUrl: "BaseUrl",
|
|
2428
|
+
Region: "Region",
|
|
2429
|
+
Agent: "Agent",
|
|
2430
|
+
AgentVersion: "AgentVersion",
|
|
2431
|
+
AgentModel: "AgentModel",
|
|
2432
|
+
ToolName: "ToolName",
|
|
2433
|
+
ToolVersion: "ToolVersion",
|
|
2434
|
+
ExecutionContext: "ExecutionContext",
|
|
2435
|
+
CiProvider: "CiProvider",
|
|
2436
|
+
SessionIdSource: "SessionIdSource",
|
|
2437
|
+
SessionId: "SessionId"
|
|
2438
|
+
};
|
|
2439
|
+
var CommandDimensions = {
|
|
2440
|
+
IsCommand: "IsCommand",
|
|
2441
|
+
IsReexec: "IsReexec",
|
|
2442
|
+
CommandName: "CommandName",
|
|
2443
|
+
ExitCode: "ExitCode",
|
|
2444
|
+
TerminalOutcome: "TerminalOutcome",
|
|
2445
|
+
ErrorClass: "ErrorClass",
|
|
2446
|
+
TerminalSignal: "TerminalSignal",
|
|
2447
|
+
ErrorMessage: "ErrorMessage",
|
|
2448
|
+
SkillName: "SkillName",
|
|
2449
|
+
ProductArea: "ProductArea",
|
|
2450
|
+
Mode: "Mode"
|
|
2451
|
+
};
|
|
2452
|
+
var ProjectDimensions = {
|
|
2453
|
+
ProjectKey: "ProjectKey",
|
|
2454
|
+
ProjectType: "ProjectType",
|
|
2455
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2456
|
+
SolutionKey: "SolutionKey",
|
|
2457
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2458
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2459
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2460
|
+
};
|
|
2461
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2462
|
+
ProjectDimensions.ProjectKey,
|
|
2463
|
+
ProjectDimensions.SolutionKey,
|
|
2464
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2465
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2466
|
+
]);
|
|
2467
|
+
var ShipDimensions = {
|
|
2468
|
+
ShipKind: "ShipKind",
|
|
2469
|
+
Target: "Target",
|
|
2470
|
+
ProjectType: "ProjectType",
|
|
2471
|
+
ProjectTypes: "ProjectTypes",
|
|
2472
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
2473
|
+
PackageName: "PackageName",
|
|
2474
|
+
PackageVersion: "PackageVersion",
|
|
2475
|
+
PackageVersionKey: "PackageVersionKey",
|
|
2476
|
+
DeploymentKey: "DeploymentKey",
|
|
2477
|
+
SolutionId: "SolutionId",
|
|
2478
|
+
FolderKey: "FolderKey",
|
|
2479
|
+
FeedId: "FeedId"
|
|
2480
|
+
};
|
|
2481
|
+
var ErrorDimensions = {
|
|
2482
|
+
Result: "Result",
|
|
2483
|
+
ErrorCode: "ErrorCode",
|
|
2484
|
+
Retry: "Retry",
|
|
2485
|
+
ErrorMessage: "ErrorMessage",
|
|
2486
|
+
HttpStatus: "HttpStatus",
|
|
2487
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
2488
|
+
};
|
|
2489
|
+
var AuthDimensions = {
|
|
2490
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
2491
|
+
Success: "Success",
|
|
2492
|
+
Reason: "Reason"
|
|
2493
|
+
};
|
|
2494
|
+
var SkillsDimensions = {
|
|
2495
|
+
SchemaVersion: "SchemaVersion",
|
|
2496
|
+
AgentType: "AgentType",
|
|
2497
|
+
SkillsVersion: "SkillsVersion",
|
|
2498
|
+
UipSubcommand: "UipSubcommand",
|
|
2499
|
+
FileExtension: "FileExtension",
|
|
2500
|
+
SubagentModel: "SubagentModel",
|
|
2501
|
+
SubagentType: "SubagentType",
|
|
2502
|
+
PermissionMode: "PermissionMode",
|
|
2503
|
+
EffortLevel: "EffortLevel",
|
|
2504
|
+
SessionSource: "SessionSource",
|
|
2505
|
+
Outcome: "Outcome",
|
|
2506
|
+
DurationMs: "DurationMs",
|
|
2507
|
+
Source: "Source"
|
|
2508
|
+
};
|
|
2509
|
+
var PackagerDimensions = {
|
|
2510
|
+
ProjectId: "ProjectId",
|
|
2511
|
+
ProjectType: "ProjectType",
|
|
2512
|
+
SolutionId: "SolutionId"
|
|
2513
|
+
};
|
|
2514
|
+
var ScopeDimensions = {
|
|
2515
|
+
FolderId: "FolderId"
|
|
2516
|
+
};
|
|
2517
|
+
var ID_DIMENSIONS = new Set([
|
|
2518
|
+
BaseDimensions.CloudUserId,
|
|
2519
|
+
BaseDimensions.CloudTenantId,
|
|
2520
|
+
BaseDimensions.CloudOrganizationId,
|
|
2521
|
+
BaseDimensions.InstallationId,
|
|
2522
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
2523
|
+
ShipDimensions.PackageVersionKey,
|
|
2524
|
+
ShipDimensions.DeploymentKey,
|
|
2525
|
+
ShipDimensions.SolutionId,
|
|
2526
|
+
ShipDimensions.FolderKey,
|
|
2527
|
+
ShipDimensions.FeedId,
|
|
2528
|
+
PackagerDimensions.ProjectId
|
|
2529
|
+
]);
|
|
2530
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
2531
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
2532
|
+
...Object.values(BaseDimensions),
|
|
2533
|
+
...Object.values(CommandDimensions),
|
|
2534
|
+
...Object.values(ShipDimensions),
|
|
2535
|
+
...Object.values(ProjectDimensions),
|
|
2536
|
+
...Object.values(ErrorDimensions),
|
|
2537
|
+
...Object.values(AuthDimensions),
|
|
2538
|
+
...Object.values(SkillsDimensions),
|
|
2539
|
+
...Object.values(PackagerDimensions),
|
|
2540
|
+
...Object.values(ScopeDimensions)
|
|
2541
|
+
]);
|
|
2542
|
+
var CURATED_DIMENSIONS = new Set([
|
|
2543
|
+
BaseDimensions.ApplicationName,
|
|
2544
|
+
BaseDimensions.ProductVersion,
|
|
2545
|
+
BaseDimensions.InstallationId,
|
|
2546
|
+
BaseDimensions.CloudUserId,
|
|
2547
|
+
BaseDimensions.CloudTenantId,
|
|
2548
|
+
BaseDimensions.CloudOrganizationId,
|
|
2549
|
+
BaseDimensions.IsInternalUser,
|
|
2550
|
+
BaseDimensions.Environment,
|
|
2551
|
+
BaseDimensions.BaseUrl,
|
|
2552
|
+
BaseDimensions.Region,
|
|
2553
|
+
BaseDimensions.Agent,
|
|
2554
|
+
BaseDimensions.AgentVersion,
|
|
2555
|
+
BaseDimensions.ToolVersion,
|
|
2556
|
+
BaseDimensions.ExecutionContext,
|
|
2557
|
+
BaseDimensions.CiProvider,
|
|
2558
|
+
BaseDimensions.SessionIdSource,
|
|
2559
|
+
BaseDimensions.SessionId,
|
|
2560
|
+
...Object.values(CommandDimensions),
|
|
2561
|
+
...Object.values(ShipDimensions),
|
|
2562
|
+
...Object.values(ProjectDimensions)
|
|
2563
|
+
]);
|
|
2564
|
+
function lowercaseIdDimensionValues(properties) {
|
|
2565
|
+
let changed = false;
|
|
2566
|
+
const result = {
|
|
2567
|
+
...properties
|
|
2568
|
+
};
|
|
2569
|
+
for (const key of Object.keys(result)) {
|
|
2570
|
+
const value = result[key];
|
|
2571
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
2572
|
+
continue;
|
|
2573
|
+
}
|
|
2574
|
+
const lowered = value.toLowerCase();
|
|
2575
|
+
if (lowered !== value) {
|
|
2576
|
+
result[key] = lowered;
|
|
2577
|
+
changed = true;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
return changed ? result : properties;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
// ../../common/src/telemetry/project-identity.ts
|
|
2584
|
+
function projectKey(id) {
|
|
2585
|
+
if (typeof id !== "string")
|
|
2586
|
+
return;
|
|
2587
|
+
const key = id.trim().toLowerCase().replaceAll("-", "");
|
|
2588
|
+
return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
|
|
2589
|
+
}
|
|
2590
|
+
function projectIdentityProperties(identity) {
|
|
2591
|
+
const key = identity.id ? projectKey(identity.id) : undefined;
|
|
2592
|
+
return {
|
|
2593
|
+
[ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
|
|
2594
|
+
[ProjectDimensions.ProjectType]: identity.projectType,
|
|
2595
|
+
...identity.status === "resolved" && key ? {
|
|
2596
|
+
[ProjectDimensions.ProjectKey]: key
|
|
2597
|
+
} : {}
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
|
|
2601
|
+
async function withinProjectIdentityBudget(work, onTimeout) {
|
|
2602
|
+
work.catch(() => {
|
|
2603
|
+
return;
|
|
2604
|
+
});
|
|
2605
|
+
let timer;
|
|
2606
|
+
const expired = new Promise((resolve) => {
|
|
2607
|
+
timer = setTimeout(() => {
|
|
2608
|
+
onTimeout?.();
|
|
2609
|
+
resolve(undefined);
|
|
2610
|
+
}, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
|
|
2611
|
+
});
|
|
2612
|
+
try {
|
|
2613
|
+
return await Promise.race([work, expired]);
|
|
2614
|
+
} finally {
|
|
2615
|
+
clearTimeout(timer);
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2387
2619
|
// ../../common/src/telemetry/pseudonymize.ts
|
|
2388
2620
|
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2389
2621
|
var PSEUDONYM_HEX_LENGTH = 32;
|
|
@@ -2752,8 +2984,8 @@ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
|
|
|
2752
2984
|
return `${redactUrl(core)}${trailing}`;
|
|
2753
2985
|
});
|
|
2754
2986
|
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
2755
|
-
out = out.replace(UNC_PATH_PATTERN, (_match, before,
|
|
2756
|
-
const [core, trailing] = peelTrailingPunctuation(
|
|
2987
|
+
out = out.replace(UNC_PATH_PATTERN, (_match, before, path) => {
|
|
2988
|
+
const [core, trailing] = peelTrailingPunctuation(path);
|
|
2757
2989
|
return `${before}unc#${pseudonymize(core)}${trailing}`;
|
|
2758
2990
|
});
|
|
2759
2991
|
out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
|
|
@@ -2847,6 +3079,8 @@ function redactProperty(name, value) {
|
|
|
2847
3079
|
if (isSensitiveName(name)) {
|
|
2848
3080
|
return REDACTED;
|
|
2849
3081
|
}
|
|
3082
|
+
if (GUID_KEY_DIMENSIONS.has(name))
|
|
3083
|
+
return projectKey(value);
|
|
2850
3084
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
2851
3085
|
return value;
|
|
2852
3086
|
}
|
|
@@ -2921,6 +3155,63 @@ function settlePromiseLike(thenable) {
|
|
|
2921
3155
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2922
3156
|
}
|
|
2923
3157
|
|
|
3158
|
+
// ../../common/src/error-codes.ts
|
|
3159
|
+
var CLI_ERROR_CODES = [
|
|
3160
|
+
"invalid_argument",
|
|
3161
|
+
"authentication_required",
|
|
3162
|
+
"permission_denied",
|
|
3163
|
+
"local_permission_denied",
|
|
3164
|
+
"not_found",
|
|
3165
|
+
"rate_limited",
|
|
3166
|
+
"network_error",
|
|
3167
|
+
"timeout",
|
|
3168
|
+
"server_error",
|
|
3169
|
+
"method_not_allowed",
|
|
3170
|
+
"not_supported",
|
|
3171
|
+
"configuration_error",
|
|
3172
|
+
"execution_failed",
|
|
3173
|
+
"unknown_error"
|
|
3174
|
+
];
|
|
3175
|
+
var RETRY_HINTS = [
|
|
3176
|
+
"RetryWillNotFix",
|
|
3177
|
+
"RetryLater",
|
|
3178
|
+
"RetryAfter1Second",
|
|
3179
|
+
"RetryAfter10Seconds",
|
|
3180
|
+
"RetryAfter30Seconds",
|
|
3181
|
+
"RetryAfter60Seconds"
|
|
3182
|
+
];
|
|
3183
|
+
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
3184
|
+
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
3185
|
+
function isCliErrorCode(value) {
|
|
3186
|
+
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
3187
|
+
}
|
|
3188
|
+
function isRetryHint(value) {
|
|
3189
|
+
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
3190
|
+
}
|
|
3191
|
+
function carriedErrorCode(error) {
|
|
3192
|
+
if (!error || typeof error !== "object")
|
|
3193
|
+
return;
|
|
3194
|
+
const code = error.errorCode;
|
|
3195
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
3196
|
+
}
|
|
3197
|
+
function carriedRetry(error) {
|
|
3198
|
+
if (!error || typeof error !== "object")
|
|
3199
|
+
return;
|
|
3200
|
+
const retry = error.retry;
|
|
3201
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
3202
|
+
}
|
|
3203
|
+
function defaultRetryForErrorCode(errorCode) {
|
|
3204
|
+
switch (errorCode) {
|
|
3205
|
+
case "network_error":
|
|
3206
|
+
case "rate_limited":
|
|
3207
|
+
case "server_error":
|
|
3208
|
+
case "timeout":
|
|
3209
|
+
return "RetryLater";
|
|
3210
|
+
default:
|
|
3211
|
+
return "RetryWillNotFix";
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
|
|
2924
3215
|
// ../../common/src/error-graph.ts
|
|
2925
3216
|
function* walkErrorGraph(error) {
|
|
2926
3217
|
const queue = [error];
|
|
@@ -2965,18 +3256,54 @@ function findHttpStatusInGraph(error) {
|
|
|
2965
3256
|
return;
|
|
2966
3257
|
}
|
|
2967
3258
|
|
|
2968
|
-
// ../../common/src/
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
3259
|
+
// ../../common/src/http-status.ts
|
|
3260
|
+
function classifyHttpStatus(status) {
|
|
3261
|
+
if (status === undefined)
|
|
3262
|
+
return;
|
|
3263
|
+
if (status === 400 || status === 409 || status === 413 || status === 422) {
|
|
3264
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3265
|
+
}
|
|
3266
|
+
if (status === 401) {
|
|
3267
|
+
return {
|
|
3268
|
+
errorCode: "authentication_required",
|
|
3269
|
+
retry: "RetryWillNotFix"
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
if (status === 403) {
|
|
3273
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3274
|
+
}
|
|
3275
|
+
if (status === 404) {
|
|
3276
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3277
|
+
}
|
|
3278
|
+
if (status === 405) {
|
|
3279
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3280
|
+
}
|
|
3281
|
+
if (status === 408) {
|
|
3282
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3283
|
+
}
|
|
3284
|
+
if (status === 429) {
|
|
3285
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3286
|
+
}
|
|
3287
|
+
if (status >= 500 && status < 600) {
|
|
3288
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3289
|
+
}
|
|
3290
|
+
return;
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
// ../../common/src/local-permission-codes.ts
|
|
3294
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
3295
|
+
"EACCES",
|
|
3296
|
+
"EPERM",
|
|
3297
|
+
"EROFS"
|
|
3298
|
+
]);
|
|
3299
|
+
|
|
3300
|
+
// ../../common/src/error-handler.ts
|
|
3301
|
+
var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its token carries no scope for this API. Run `uip login status --detailed` to see the session and its scopes.";
|
|
3302
|
+
var DEFAULT_403 = "Forbidden (403). The account lacks permission for this operation, or the token carries no scope for this API. Run `uip login status --detailed` to see the token's scopes.";
|
|
3303
|
+
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2979
3304
|
var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
|
|
3305
|
+
var CLOUDFLARE_BLOCK_403 = "Forbidden (403) by Cloudflare, in front of the service: the answer is a Cloudflare HTML page, not the service's JSON, so the service did not see the request and did not check the account's roles or the token's scopes. Cloudflare blocks a request when its content matches a firewall rule (text that looks like SQL or script code, for example) or when it comes from a network the firewall does not allow.";
|
|
3306
|
+
var CLOUDFLARE_BLOCK_403_INSTRUCTIONS = "If the request carries text that looks like code, change that text and try again. Otherwise send the time of the request and the Cloudflare Ray ID, when the message gives one, to the owner of the service or UiPath support.";
|
|
2980
3307
|
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2981
3308
|
var NETWORK_ERROR_CODES = new Set([
|
|
2982
3309
|
"ECONNREFUSED",
|
|
@@ -3002,8 +3329,8 @@ var TLS_ERROR_CODES = new Set([
|
|
|
3002
3329
|
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
3003
3330
|
var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
3004
3331
|
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
3005
|
-
function localPermissionInstructions(code,
|
|
3006
|
-
const target =
|
|
3332
|
+
function localPermissionInstructions(code, path) {
|
|
3333
|
+
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
3007
3334
|
if (code === "EROFS") {
|
|
3008
3335
|
return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
|
|
3009
3336
|
}
|
|
@@ -3040,12 +3367,12 @@ function describePermissionError(error) {
|
|
|
3040
3367
|
const code = matchLocalPermissionCode(cur.code, message);
|
|
3041
3368
|
if (!code)
|
|
3042
3369
|
continue;
|
|
3043
|
-
const
|
|
3370
|
+
const path = localPermissionPath(cur.path, message);
|
|
3044
3371
|
return {
|
|
3045
3372
|
code,
|
|
3046
3373
|
message: message ?? code,
|
|
3047
|
-
...
|
|
3048
|
-
instructions: localPermissionInstructions(code,
|
|
3374
|
+
...path !== undefined ? { path } : {},
|
|
3375
|
+
instructions: localPermissionInstructions(code, path)
|
|
3049
3376
|
};
|
|
3050
3377
|
}
|
|
3051
3378
|
return;
|
|
@@ -3057,11 +3384,25 @@ function matchLocalPermissionCode(code, message) {
|
|
|
3057
3384
|
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
3058
3385
|
return match ? match[1] : undefined;
|
|
3059
3386
|
}
|
|
3060
|
-
function localPermissionPath(
|
|
3061
|
-
if (typeof
|
|
3062
|
-
return
|
|
3387
|
+
function localPermissionPath(path, message) {
|
|
3388
|
+
if (typeof path === "string")
|
|
3389
|
+
return path;
|
|
3063
3390
|
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
3064
3391
|
}
|
|
3392
|
+
function readHeader(response, name) {
|
|
3393
|
+
const headers = response?.headers;
|
|
3394
|
+
if (!headers || typeof headers !== "object")
|
|
3395
|
+
return;
|
|
3396
|
+
if (typeof headers.get === "function") {
|
|
3397
|
+
const value = headers.get(name);
|
|
3398
|
+
if (value)
|
|
3399
|
+
return value;
|
|
3400
|
+
}
|
|
3401
|
+
const plain = headers;
|
|
3402
|
+
const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
|
|
3403
|
+
const value = key === undefined ? undefined : plain[key];
|
|
3404
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
3405
|
+
}
|
|
3065
3406
|
function isHtmlDocument(body) {
|
|
3066
3407
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3067
3408
|
}
|
|
@@ -3078,36 +3419,9 @@ function retryHintForRetryAfter(seconds) {
|
|
|
3078
3419
|
return "RetryAfter60Seconds";
|
|
3079
3420
|
}
|
|
3080
3421
|
function classifyError(status, error) {
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
if (status === 401) {
|
|
3085
|
-
return {
|
|
3086
|
-
errorCode: "authentication_required",
|
|
3087
|
-
retry: "RetryWillNotFix"
|
|
3088
|
-
};
|
|
3089
|
-
}
|
|
3090
|
-
if (status === 403) {
|
|
3091
|
-
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
3092
|
-
}
|
|
3093
|
-
if (status === 404) {
|
|
3094
|
-
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
3095
|
-
}
|
|
3096
|
-
if (status === 405) {
|
|
3097
|
-
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
3098
|
-
}
|
|
3099
|
-
if (status === 413) {
|
|
3100
|
-
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
3101
|
-
}
|
|
3102
|
-
if (status === 408) {
|
|
3103
|
-
return { errorCode: "timeout", retry: "RetryLater" };
|
|
3104
|
-
}
|
|
3105
|
-
if (status === 429) {
|
|
3106
|
-
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
3107
|
-
}
|
|
3108
|
-
if (status !== undefined && status >= 500 && status < 600) {
|
|
3109
|
-
return { errorCode: "server_error", retry: "RetryLater" };
|
|
3110
|
-
}
|
|
3422
|
+
const byStatus = classifyHttpStatus(status);
|
|
3423
|
+
if (byStatus)
|
|
3424
|
+
return byStatus;
|
|
3111
3425
|
if (status === undefined && describePermissionError(error)) {
|
|
3112
3426
|
return {
|
|
3113
3427
|
errorCode: "local_permission_denied",
|
|
@@ -3123,6 +3437,17 @@ function classifyError(status, error) {
|
|
|
3123
3437
|
}
|
|
3124
3438
|
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
3125
3439
|
}
|
|
3440
|
+
function withCarriedClass(inferred, error) {
|
|
3441
|
+
const errorCode = carriedErrorCode(error);
|
|
3442
|
+
const retry = carriedRetry(error);
|
|
3443
|
+
if (errorCode === undefined || errorCode === inferred.errorCode) {
|
|
3444
|
+
return {
|
|
3445
|
+
errorCode: inferred.errorCode,
|
|
3446
|
+
retry: retry ?? inferred.retry
|
|
3447
|
+
};
|
|
3448
|
+
}
|
|
3449
|
+
return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
|
|
3450
|
+
}
|
|
3126
3451
|
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
3127
3452
|
if (extractedMessage) {
|
|
3128
3453
|
return `HTTP ${status}: ${extractedMessage}`;
|
|
@@ -3178,9 +3503,14 @@ async function extractErrorDetails(error, options) {
|
|
|
3178
3503
|
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
3179
3504
|
const classification = classifyError(classificationStatus, error);
|
|
3180
3505
|
let retry = classification.retry;
|
|
3506
|
+
const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
|
|
3507
|
+
const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
|
|
3508
|
+
const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
|
|
3181
3509
|
if (status === 401) {
|
|
3182
3510
|
message = DEFAULT_401;
|
|
3183
3511
|
result = "AuthenticationError";
|
|
3512
|
+
} else if (cloudflareBlock) {
|
|
3513
|
+
message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
|
|
3184
3514
|
} else if (status === 403) {
|
|
3185
3515
|
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
3186
3516
|
result = "AuthenticationError";
|
|
@@ -3228,7 +3558,9 @@ async function extractErrorDetails(error, options) {
|
|
|
3228
3558
|
}
|
|
3229
3559
|
}
|
|
3230
3560
|
let details = rawMessage;
|
|
3231
|
-
if (
|
|
3561
|
+
if (htmlForbidden) {
|
|
3562
|
+
details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
|
|
3563
|
+
} else if (rawBody) {
|
|
3232
3564
|
if (parsedBody) {
|
|
3233
3565
|
const extra = {};
|
|
3234
3566
|
if (parsedBody.errorCode)
|
|
@@ -3262,6 +3594,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3262
3594
|
}
|
|
3263
3595
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
3264
3596
|
context.requestId = parsedBody.requestId;
|
|
3597
|
+
} else if (cloudflareBlock && rayId) {
|
|
3598
|
+
context.requestId = rayId;
|
|
3265
3599
|
}
|
|
3266
3600
|
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
3267
3601
|
context.traceId = parsedBody.traceId;
|
|
@@ -3270,16 +3604,7 @@ async function extractErrorDetails(error, options) {
|
|
|
3270
3604
|
context.path = permission.path;
|
|
3271
3605
|
}
|
|
3272
3606
|
if (status === 429) {
|
|
3273
|
-
const
|
|
3274
|
-
const headersObj = resp?.headers;
|
|
3275
|
-
let retryAfterValue;
|
|
3276
|
-
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
3277
|
-
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
3278
|
-
}
|
|
3279
|
-
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
3280
|
-
const headers = headersObj;
|
|
3281
|
-
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
3282
|
-
}
|
|
3607
|
+
const retryAfterValue = readHeader(response, "retry-after");
|
|
3283
3608
|
if (retryAfterValue) {
|
|
3284
3609
|
const seconds = Number(retryAfterValue);
|
|
3285
3610
|
if (!Number.isNaN(seconds)) {
|
|
@@ -3313,9 +3638,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3313
3638
|
}
|
|
3314
3639
|
return {
|
|
3315
3640
|
result,
|
|
3316
|
-
errorCode: classification.errorCode,
|
|
3641
|
+
...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
|
|
3317
3642
|
message,
|
|
3318
|
-
retry,
|
|
3319
3643
|
details,
|
|
3320
3644
|
...hasContext ? { context } : {},
|
|
3321
3645
|
...parsedErrors ? { parsedErrors } : {}
|
|
@@ -3325,10 +3649,91 @@ async function extractErrorMessage(error, options) {
|
|
|
3325
3649
|
const { message } = await extractErrorDetails(error, options);
|
|
3326
3650
|
return message;
|
|
3327
3651
|
}
|
|
3328
|
-
// ../../common/src/
|
|
3329
|
-
|
|
3330
|
-
|
|
3652
|
+
// ../../common/src/result-types.ts
|
|
3653
|
+
var RESULTS = {
|
|
3654
|
+
Success: "Success",
|
|
3655
|
+
Failure: "Failure",
|
|
3656
|
+
ConfigError: "ConfigError",
|
|
3657
|
+
AuthenticationError: "AuthenticationError",
|
|
3658
|
+
ValidationError: "ValidationError",
|
|
3659
|
+
TimeoutError: "TimeoutError"
|
|
3660
|
+
};
|
|
3661
|
+
// ../../../node_modules/commander/index.js
|
|
3662
|
+
var exports_commander = {};
|
|
3663
|
+
__exportCjs(exports_commander, {
|
|
3664
|
+
program: () => $program,
|
|
3665
|
+
createCommand: () => $createCommand,
|
|
3666
|
+
createOption: () => $createOption,
|
|
3667
|
+
createArgument: () => $createArgument,
|
|
3668
|
+
Command: () => $Command,
|
|
3669
|
+
Option: () => $Option,
|
|
3670
|
+
Argument: () => $Argument,
|
|
3671
|
+
Help: () => $Help,
|
|
3672
|
+
CommanderError: () => $CommanderError,
|
|
3673
|
+
InvalidArgumentError: () => $InvalidArgumentError,
|
|
3674
|
+
InvalidOptionArgumentError: () => $InvalidOptionArgumentError
|
|
3675
|
+
}, {
|
|
3676
|
+
program: (value) => $program = value,
|
|
3677
|
+
createCommand: (value) => $createCommand = value,
|
|
3678
|
+
createOption: (value) => $createOption = value,
|
|
3679
|
+
createArgument: (value) => $createArgument = value,
|
|
3680
|
+
Command: (value) => $Command = value,
|
|
3681
|
+
Option: (value) => $Option = value,
|
|
3682
|
+
Argument: (value) => $Argument = value,
|
|
3683
|
+
Help: (value) => $Help = value,
|
|
3684
|
+
CommanderError: (value) => $CommanderError = value,
|
|
3685
|
+
InvalidArgumentError: (value) => $InvalidArgumentError = value,
|
|
3686
|
+
InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
|
|
3687
|
+
});
|
|
3688
|
+
var { Argument } = require_argument();
|
|
3689
|
+
var { Command: Command2 } = require_command();
|
|
3690
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
3691
|
+
var { Help } = require_help();
|
|
3692
|
+
var { Option } = require_option();
|
|
3693
|
+
var $program = new Command2;
|
|
3694
|
+
var $createCommand = (name) => new Command2(name);
|
|
3695
|
+
var $createOption = (flags, description) => new Option(flags, description);
|
|
3696
|
+
var $createArgument = (name, description) => new Argument(name, description);
|
|
3697
|
+
var $Command = Command2;
|
|
3698
|
+
var $Option = Option;
|
|
3699
|
+
var $Argument = Argument;
|
|
3700
|
+
var $Help = Help;
|
|
3701
|
+
var $CommanderError = CommanderError;
|
|
3702
|
+
var $InvalidArgumentError = InvalidArgumentError;
|
|
3703
|
+
var $InvalidOptionArgumentError = InvalidArgumentError;
|
|
3704
|
+
|
|
3705
|
+
// ../../../node_modules/commander/esm.mjs
|
|
3706
|
+
var {
|
|
3707
|
+
program,
|
|
3708
|
+
createCommand,
|
|
3709
|
+
createArgument,
|
|
3710
|
+
createOption,
|
|
3711
|
+
CommanderError: CommanderError2,
|
|
3712
|
+
InvalidArgumentError: InvalidArgumentError2,
|
|
3713
|
+
InvalidOptionArgumentError,
|
|
3714
|
+
Command,
|
|
3715
|
+
Argument: Argument2,
|
|
3716
|
+
Option: Option2,
|
|
3717
|
+
Help: Help2
|
|
3718
|
+
} = exports_commander;
|
|
3719
|
+
|
|
3720
|
+
// ../../common/src/command-examples.ts
|
|
3721
|
+
var examplesByCommand = new WeakMap;
|
|
3722
|
+
Command.prototype.examples = function(examples) {
|
|
3723
|
+
examplesByCommand.set(this, examples);
|
|
3724
|
+
return this;
|
|
3725
|
+
};
|
|
3726
|
+
// ../../common/src/preview.ts
|
|
3727
|
+
var previewSlot = singleton("PreviewBuild");
|
|
3728
|
+
function isPreviewBuild() {
|
|
3729
|
+
return previewSlot.get(false) ?? false;
|
|
3331
3730
|
}
|
|
3731
|
+
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
3732
|
+
if (isPreviewBuild()) {
|
|
3733
|
+
return this.command(nameAndArgs, opts);
|
|
3734
|
+
}
|
|
3735
|
+
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
3736
|
+
};
|
|
3332
3737
|
|
|
3333
3738
|
// ../../common/src/output-context.ts
|
|
3334
3739
|
function createStorage() {
|
|
@@ -3363,8 +3768,8 @@ function getOutputSink() {
|
|
|
3363
3768
|
|
|
3364
3769
|
// ../../common/src/logger.ts
|
|
3365
3770
|
var logFilePathSlot = singleton("logFilePath");
|
|
3366
|
-
function setGlobalLogFilePath(
|
|
3367
|
-
logFilePathSlot.set(
|
|
3771
|
+
function setGlobalLogFilePath(path) {
|
|
3772
|
+
logFilePathSlot.set(path);
|
|
3368
3773
|
}
|
|
3369
3774
|
function getGlobalLogFilePath() {
|
|
3370
3775
|
return logFilePathSlot.get("");
|
|
@@ -3432,14 +3837,14 @@ class SimpleLogger {
|
|
|
3432
3837
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
3433
3838
|
}
|
|
3434
3839
|
writeToFile(formatted) {
|
|
3435
|
-
const
|
|
3436
|
-
if (!
|
|
3840
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
3841
|
+
if (!path)
|
|
3437
3842
|
return;
|
|
3438
3843
|
const timestamp = new Date().toISOString();
|
|
3439
3844
|
this.pendingWrites = Promise.all([
|
|
3440
3845
|
this.pendingWrites,
|
|
3441
3846
|
this.pendingInit
|
|
3442
|
-
]).then(() => getFileSystem().appendFile(
|
|
3847
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
3443
3848
|
}
|
|
3444
3849
|
write(formatted) {
|
|
3445
3850
|
if (this.isFileLoggingActive()) {
|
|
@@ -3489,17 +3894,17 @@ class SimpleLogger {
|
|
|
3489
3894
|
setGlobalLogFilePath("");
|
|
3490
3895
|
}
|
|
3491
3896
|
}
|
|
3492
|
-
setLogFile(
|
|
3493
|
-
this.logFilePath =
|
|
3494
|
-
setGlobalLogFilePath(
|
|
3495
|
-
if (!
|
|
3897
|
+
setLogFile(path) {
|
|
3898
|
+
this.logFilePath = path;
|
|
3899
|
+
setGlobalLogFilePath(path);
|
|
3900
|
+
if (!path)
|
|
3496
3901
|
return;
|
|
3497
3902
|
this.fileLoggingEnabled = true;
|
|
3498
|
-
const
|
|
3903
|
+
const fs = getFileSystem();
|
|
3499
3904
|
this.pendingInit = (async () => {
|
|
3500
3905
|
const [error] = await catchError((async () => {
|
|
3501
|
-
await
|
|
3502
|
-
await
|
|
3906
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
3907
|
+
await fs.writeFile(path, "");
|
|
3503
3908
|
})());
|
|
3504
3909
|
if (error)
|
|
3505
3910
|
this.fileLoggingEnabled = false;
|
|
@@ -3547,18 +3952,111 @@ function getLogFilePath() {
|
|
|
3547
3952
|
return logger.getLogFilePath();
|
|
3548
3953
|
}
|
|
3549
3954
|
|
|
3955
|
+
// ../../common/src/timings.ts
|
|
3956
|
+
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
3957
|
+
function createStorage2() {
|
|
3958
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
3959
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
3960
|
+
return {
|
|
3961
|
+
getStore: () => {
|
|
3962
|
+
return;
|
|
3963
|
+
},
|
|
3964
|
+
run: (_store, fn) => fn()
|
|
3965
|
+
};
|
|
3966
|
+
}
|
|
3967
|
+
return new mod.AsyncLocalStorage;
|
|
3968
|
+
}
|
|
3969
|
+
var storageSlot = singleton("TimingStorage");
|
|
3970
|
+
var stateSlot = singleton("Timings");
|
|
3971
|
+
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
3972
|
+
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
3973
|
+
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
3974
|
+
function newState(baseline) {
|
|
3975
|
+
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
3976
|
+
}
|
|
3977
|
+
function getState() {
|
|
3978
|
+
const scoped = storage.getStore();
|
|
3979
|
+
if (scoped) {
|
|
3980
|
+
return scoped;
|
|
3981
|
+
}
|
|
3982
|
+
const pinned = livePinnedState();
|
|
3983
|
+
if (pinned !== undefined) {
|
|
3984
|
+
return pinned;
|
|
3985
|
+
}
|
|
3986
|
+
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
3987
|
+
}
|
|
3988
|
+
function livePinnedState() {
|
|
3989
|
+
const pinned = stateSlot.get();
|
|
3990
|
+
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
3991
|
+
}
|
|
3992
|
+
function processStartIsInvocationStart() {
|
|
3993
|
+
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
3994
|
+
}
|
|
3995
|
+
function timingsEnabled() {
|
|
3996
|
+
if (typeof process === "undefined") {
|
|
3997
|
+
return false;
|
|
3998
|
+
}
|
|
3999
|
+
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4000
|
+
if (value === undefined) {
|
|
4001
|
+
return false;
|
|
4002
|
+
}
|
|
4003
|
+
const normalized = value.trim().toLowerCase();
|
|
4004
|
+
return normalized === "1" || normalized === "true";
|
|
4005
|
+
}
|
|
4006
|
+
function recordExitCode(exitCode) {
|
|
4007
|
+
if (!timingsEnabled()) {
|
|
4008
|
+
return;
|
|
4009
|
+
}
|
|
4010
|
+
getState().exitCode = exitCode;
|
|
4011
|
+
}
|
|
4012
|
+
function invocationStartedAt() {
|
|
4013
|
+
return new Date(performance.timeOrigin + getState().baseline);
|
|
4014
|
+
}
|
|
4015
|
+
function invocationElapsedMs() {
|
|
4016
|
+
return performance.now() - getState().baseline;
|
|
4017
|
+
}
|
|
4018
|
+
function markCommandStart() {
|
|
4019
|
+
if (!timingsEnabled()) {
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
getState().commandStart = performance.now();
|
|
4023
|
+
}
|
|
4024
|
+
function recordCommandDuration(durationMs) {
|
|
4025
|
+
if (!timingsEnabled()) {
|
|
4026
|
+
return;
|
|
4027
|
+
}
|
|
4028
|
+
getState().commandMs = durationMs;
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
// ../../common/src/exit-code.ts
|
|
4032
|
+
function setExitCode(code) {
|
|
4033
|
+
process.exitCode = code;
|
|
4034
|
+
recordExitCode(code);
|
|
4035
|
+
}
|
|
4036
|
+
var GENERIC_FAILURE_EXIT_CODE = 1;
|
|
4037
|
+
function recordCommandExit(code) {
|
|
4038
|
+
if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
setExitCode(code);
|
|
4042
|
+
}
|
|
4043
|
+
function getExitCode() {
|
|
4044
|
+
const code = process.exitCode;
|
|
4045
|
+
return typeof code === "number" ? code : 0;
|
|
4046
|
+
}
|
|
4047
|
+
|
|
3550
4048
|
// ../../common/src/output-codecs.ts
|
|
3551
4049
|
var yamlSlot = singleton("YamlCodec");
|
|
3552
4050
|
var jmespathSlot = singleton("JmespathCodec");
|
|
3553
4051
|
async function loadOutputCodecsAsync(needed) {
|
|
3554
4052
|
const loads = [];
|
|
3555
4053
|
if (needed.yaml && yamlSlot.get() === undefined) {
|
|
3556
|
-
loads.push(import("./js-yaml-
|
|
4054
|
+
loads.push(import("./js-yaml-cr6n3g9w.js").then((mod) => {
|
|
3557
4055
|
yamlSlot.set(mod);
|
|
3558
4056
|
}));
|
|
3559
4057
|
}
|
|
3560
4058
|
if (needed.filter && jmespathSlot.get() === undefined) {
|
|
3561
|
-
loads.push(import("./jmespath-
|
|
4059
|
+
loads.push(import("./jmespath-09m00b2f.js").then((m)=>__toESM(m.default,1)).then((mod) => {
|
|
3562
4060
|
jmespathSlot.set(mod);
|
|
3563
4061
|
}));
|
|
3564
4062
|
}
|
|
@@ -3583,155 +4081,6 @@ function getOutputFilter() {
|
|
|
3583
4081
|
return filterSlot.get();
|
|
3584
4082
|
}
|
|
3585
4083
|
|
|
3586
|
-
// ../../common/src/telemetry/telemetry-dimensions.ts
|
|
3587
|
-
var BaseDimensions = {
|
|
3588
|
-
ApplicationName: "ApplicationName",
|
|
3589
|
-
ProductVersion: "ProductVersion",
|
|
3590
|
-
InstallationId: "InstallationId",
|
|
3591
|
-
CloudUserId: "CloudUserId",
|
|
3592
|
-
CloudTenantId: "CloudTenantId",
|
|
3593
|
-
CloudOrganizationId: "CloudOrganizationId",
|
|
3594
|
-
IsInternalUser: "IsInternalUser",
|
|
3595
|
-
Environment: "Environment",
|
|
3596
|
-
BaseUrl: "BaseUrl",
|
|
3597
|
-
Region: "Region",
|
|
3598
|
-
Agent: "Agent",
|
|
3599
|
-
AgentVersion: "AgentVersion",
|
|
3600
|
-
AgentModel: "AgentModel",
|
|
3601
|
-
ToolName: "ToolName",
|
|
3602
|
-
ToolVersion: "ToolVersion",
|
|
3603
|
-
ExecutionContext: "ExecutionContext",
|
|
3604
|
-
CiProvider: "CiProvider",
|
|
3605
|
-
SessionIdSource: "SessionIdSource",
|
|
3606
|
-
SessionId: "SessionId"
|
|
3607
|
-
};
|
|
3608
|
-
var CommandDimensions = {
|
|
3609
|
-
IsCommand: "IsCommand",
|
|
3610
|
-
IsReexec: "IsReexec",
|
|
3611
|
-
CommandName: "CommandName",
|
|
3612
|
-
ExitCode: "ExitCode",
|
|
3613
|
-
TerminalOutcome: "TerminalOutcome",
|
|
3614
|
-
ErrorClass: "ErrorClass",
|
|
3615
|
-
TerminalSignal: "TerminalSignal",
|
|
3616
|
-
ErrorMessage: "ErrorMessage",
|
|
3617
|
-
SkillName: "SkillName",
|
|
3618
|
-
ProductArea: "ProductArea",
|
|
3619
|
-
Mode: "Mode"
|
|
3620
|
-
};
|
|
3621
|
-
var ShipDimensions = {
|
|
3622
|
-
ShipKind: "ShipKind",
|
|
3623
|
-
Target: "Target",
|
|
3624
|
-
ProjectType: "ProjectType",
|
|
3625
|
-
ProjectTypes: "ProjectTypes",
|
|
3626
|
-
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3627
|
-
PackageName: "PackageName",
|
|
3628
|
-
PackageVersion: "PackageVersion",
|
|
3629
|
-
PackageVersionKey: "PackageVersionKey",
|
|
3630
|
-
DeploymentKey: "DeploymentKey",
|
|
3631
|
-
SolutionId: "SolutionId",
|
|
3632
|
-
FolderKey: "FolderKey",
|
|
3633
|
-
FeedId: "FeedId"
|
|
3634
|
-
};
|
|
3635
|
-
var ErrorDimensions = {
|
|
3636
|
-
Result: "Result",
|
|
3637
|
-
ErrorCode: "ErrorCode",
|
|
3638
|
-
Retry: "Retry",
|
|
3639
|
-
ErrorMessage: "ErrorMessage",
|
|
3640
|
-
HttpStatus: "HttpStatus",
|
|
3641
|
-
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3642
|
-
};
|
|
3643
|
-
var AuthDimensions = {
|
|
3644
|
-
AuthenticationMethod: "AuthenticationMethod",
|
|
3645
|
-
Success: "Success",
|
|
3646
|
-
Reason: "Reason"
|
|
3647
|
-
};
|
|
3648
|
-
var SkillsDimensions = {
|
|
3649
|
-
SchemaVersion: "SchemaVersion",
|
|
3650
|
-
AgentType: "AgentType",
|
|
3651
|
-
SkillsVersion: "SkillsVersion",
|
|
3652
|
-
UipSubcommand: "UipSubcommand",
|
|
3653
|
-
FileExtension: "FileExtension",
|
|
3654
|
-
SubagentModel: "SubagentModel",
|
|
3655
|
-
SubagentType: "SubagentType",
|
|
3656
|
-
PermissionMode: "PermissionMode",
|
|
3657
|
-
EffortLevel: "EffortLevel",
|
|
3658
|
-
SessionSource: "SessionSource",
|
|
3659
|
-
Outcome: "Outcome",
|
|
3660
|
-
DurationMs: "DurationMs",
|
|
3661
|
-
Source: "Source"
|
|
3662
|
-
};
|
|
3663
|
-
var PackagerDimensions = {
|
|
3664
|
-
ProjectId: "ProjectId",
|
|
3665
|
-
ProjectType: "ProjectType",
|
|
3666
|
-
SolutionId: "SolutionId"
|
|
3667
|
-
};
|
|
3668
|
-
var ScopeDimensions = {
|
|
3669
|
-
FolderId: "FolderId"
|
|
3670
|
-
};
|
|
3671
|
-
var ID_DIMENSIONS = new Set([
|
|
3672
|
-
BaseDimensions.CloudUserId,
|
|
3673
|
-
BaseDimensions.CloudTenantId,
|
|
3674
|
-
BaseDimensions.CloudOrganizationId,
|
|
3675
|
-
BaseDimensions.InstallationId,
|
|
3676
|
-
ShipDimensions.ArtifactCorrelationKey,
|
|
3677
|
-
ShipDimensions.PackageVersionKey,
|
|
3678
|
-
ShipDimensions.DeploymentKey,
|
|
3679
|
-
ShipDimensions.SolutionId,
|
|
3680
|
-
ShipDimensions.FolderKey,
|
|
3681
|
-
ShipDimensions.FeedId,
|
|
3682
|
-
PackagerDimensions.ProjectId
|
|
3683
|
-
]);
|
|
3684
|
-
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3685
|
-
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3686
|
-
...Object.values(BaseDimensions),
|
|
3687
|
-
...Object.values(CommandDimensions),
|
|
3688
|
-
...Object.values(ShipDimensions),
|
|
3689
|
-
...Object.values(ErrorDimensions),
|
|
3690
|
-
...Object.values(AuthDimensions),
|
|
3691
|
-
...Object.values(SkillsDimensions),
|
|
3692
|
-
...Object.values(PackagerDimensions),
|
|
3693
|
-
...Object.values(ScopeDimensions)
|
|
3694
|
-
]);
|
|
3695
|
-
var CURATED_DIMENSIONS = new Set([
|
|
3696
|
-
BaseDimensions.ApplicationName,
|
|
3697
|
-
BaseDimensions.ProductVersion,
|
|
3698
|
-
BaseDimensions.InstallationId,
|
|
3699
|
-
BaseDimensions.CloudUserId,
|
|
3700
|
-
BaseDimensions.CloudTenantId,
|
|
3701
|
-
BaseDimensions.CloudOrganizationId,
|
|
3702
|
-
BaseDimensions.IsInternalUser,
|
|
3703
|
-
BaseDimensions.Environment,
|
|
3704
|
-
BaseDimensions.BaseUrl,
|
|
3705
|
-
BaseDimensions.Region,
|
|
3706
|
-
BaseDimensions.Agent,
|
|
3707
|
-
BaseDimensions.AgentVersion,
|
|
3708
|
-
BaseDimensions.ToolVersion,
|
|
3709
|
-
BaseDimensions.ExecutionContext,
|
|
3710
|
-
BaseDimensions.CiProvider,
|
|
3711
|
-
BaseDimensions.SessionIdSource,
|
|
3712
|
-
BaseDimensions.SessionId,
|
|
3713
|
-
...Object.values(CommandDimensions),
|
|
3714
|
-
...Object.values(ShipDimensions)
|
|
3715
|
-
]);
|
|
3716
|
-
function lowercaseIdDimensionValues(properties) {
|
|
3717
|
-
let changed = false;
|
|
3718
|
-
const result = {
|
|
3719
|
-
...properties
|
|
3720
|
-
};
|
|
3721
|
-
for (const key of Object.keys(result)) {
|
|
3722
|
-
const value = result[key];
|
|
3723
|
-
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3724
|
-
continue;
|
|
3725
|
-
}
|
|
3726
|
-
const lowered = value.toLowerCase();
|
|
3727
|
-
if (lowered !== value) {
|
|
3728
|
-
result[key] = lowered;
|
|
3729
|
-
changed = true;
|
|
3730
|
-
}
|
|
3731
|
-
}
|
|
3732
|
-
return changed ? result : properties;
|
|
3733
|
-
}
|
|
3734
|
-
|
|
3735
4084
|
// ../../common/src/telemetry/command-terminal.ts
|
|
3736
4085
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3737
4086
|
var AUTH_ERROR_CODES = new Set([
|
|
@@ -3850,17 +4199,8 @@ function terminalSignalFor(input, outcome) {
|
|
|
3850
4199
|
}
|
|
3851
4200
|
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
3852
4201
|
}
|
|
3853
|
-
function
|
|
3854
|
-
|
|
3855
|
-
return "auth";
|
|
3856
|
-
}
|
|
3857
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
3858
|
-
return "validation";
|
|
3859
|
-
}
|
|
3860
|
-
if (status === 408) {
|
|
3861
|
-
return "timeout";
|
|
3862
|
-
}
|
|
3863
|
-
return "network_http";
|
|
4202
|
+
function classifyFailingHttpStatus(status) {
|
|
4203
|
+
return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
|
|
3864
4204
|
}
|
|
3865
4205
|
function classifyFromResult(result) {
|
|
3866
4206
|
switch (result) {
|
|
@@ -3940,7 +4280,7 @@ function classifyError2(input) {
|
|
|
3940
4280
|
}
|
|
3941
4281
|
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3942
4282
|
if (status !== undefined) {
|
|
3943
|
-
return
|
|
4283
|
+
return classifyFailingHttpStatus(status);
|
|
3944
4284
|
}
|
|
3945
4285
|
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
3946
4286
|
}
|
|
@@ -3972,6 +4312,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3972
4312
|
var CommonTelemetryEvents = {
|
|
3973
4313
|
Start: "Application.Start",
|
|
3974
4314
|
Error: "Application.Error",
|
|
4315
|
+
ProjectActivity: "Cli.ProjectActivity",
|
|
3975
4316
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3976
4317
|
};
|
|
3977
4318
|
|
|
@@ -4452,117 +4793,42 @@ class TelemetryService {
|
|
|
4452
4793
|
...context !== undefined ? { parentId: context.id } : {}
|
|
4453
4794
|
};
|
|
4454
4795
|
}
|
|
4455
|
-
spanFor(name, durationMs, success, properties, context) {
|
|
4456
|
-
return {
|
|
4457
|
-
name: redactSpanName(name),
|
|
4458
|
-
durationMs,
|
|
4459
|
-
success,
|
|
4460
|
-
properties: this.enrichProperties(properties),
|
|
4461
|
-
operationId: context.operationId,
|
|
4462
|
-
...context.parentId !== undefined ? { parentId: context.parentId } : {},
|
|
4463
|
-
id: context.id,
|
|
4464
|
-
...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
|
|
4465
|
-
};
|
|
4466
|
-
}
|
|
4467
|
-
enrichProperties(properties) {
|
|
4468
|
-
const globalProperties = getGlobalTelemetryProperties();
|
|
4469
|
-
const enriched = {
|
|
4470
|
-
...getExecutionContextTelemetryProperties(),
|
|
4471
|
-
...globalProperties,
|
|
4472
|
-
...this.defaultProperties,
|
|
4473
|
-
...redactProperties(properties ?? {}),
|
|
4474
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4475
|
-
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4476
|
-
};
|
|
4477
|
-
return lowercaseIdDimensionValues(enriched);
|
|
4478
|
-
}
|
|
4479
|
-
generateId() {
|
|
4480
|
-
const bytes = new Uint8Array(8);
|
|
4481
|
-
let hex = "";
|
|
4482
|
-
do {
|
|
4483
|
-
crypto.getRandomValues(bytes);
|
|
4484
|
-
hex = "";
|
|
4485
|
-
for (const byte of bytes) {
|
|
4486
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
4487
|
-
}
|
|
4488
|
-
} while (/^0+$/.test(hex));
|
|
4489
|
-
return hex;
|
|
4490
|
-
}
|
|
4491
|
-
}
|
|
4492
|
-
// ../../common/src/timings.ts
|
|
4493
|
-
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
4494
|
-
function createStorage2() {
|
|
4495
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
4496
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
4497
|
-
return {
|
|
4498
|
-
getStore: () => {
|
|
4499
|
-
return;
|
|
4500
|
-
},
|
|
4501
|
-
run: (_store, fn) => fn()
|
|
4502
|
-
};
|
|
4503
|
-
}
|
|
4504
|
-
return new mod.AsyncLocalStorage;
|
|
4505
|
-
}
|
|
4506
|
-
var storageSlot = singleton("TimingStorage");
|
|
4507
|
-
var stateSlot = singleton("Timings");
|
|
4508
|
-
var rootStartedSlot = singleton("TimingsRootStarted");
|
|
4509
|
-
var longLivedHostSlot = singleton("TimingsLongLivedHost");
|
|
4510
|
-
var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
|
|
4511
|
-
function newState(baseline) {
|
|
4512
|
-
return { baseline, httpMs: 0, httpCalls: 0 };
|
|
4513
|
-
}
|
|
4514
|
-
function getState() {
|
|
4515
|
-
const scoped = storage.getStore();
|
|
4516
|
-
if (scoped) {
|
|
4517
|
-
return scoped;
|
|
4518
|
-
}
|
|
4519
|
-
const pinned = livePinnedState();
|
|
4520
|
-
if (pinned !== undefined) {
|
|
4521
|
-
return pinned;
|
|
4522
|
-
}
|
|
4523
|
-
return newState(processStartIsInvocationStart() ? 0 : performance.now());
|
|
4524
|
-
}
|
|
4525
|
-
function livePinnedState() {
|
|
4526
|
-
const pinned = stateSlot.get();
|
|
4527
|
-
return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
|
|
4528
|
-
}
|
|
4529
|
-
function processStartIsInvocationStart() {
|
|
4530
|
-
return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
|
|
4531
|
-
}
|
|
4532
|
-
function timingsEnabled() {
|
|
4533
|
-
if (typeof process === "undefined") {
|
|
4534
|
-
return false;
|
|
4535
|
-
}
|
|
4536
|
-
const value = process.env?.[TIMINGS_ENV_VAR];
|
|
4537
|
-
if (value === undefined) {
|
|
4538
|
-
return false;
|
|
4539
|
-
}
|
|
4540
|
-
const normalized = value.trim().toLowerCase();
|
|
4541
|
-
return normalized === "1" || normalized === "true";
|
|
4542
|
-
}
|
|
4543
|
-
function recordExitCode(exitCode) {
|
|
4544
|
-
if (!timingsEnabled()) {
|
|
4545
|
-
return;
|
|
4796
|
+
spanFor(name, durationMs, success, properties, context) {
|
|
4797
|
+
return {
|
|
4798
|
+
name: redactSpanName(name),
|
|
4799
|
+
durationMs,
|
|
4800
|
+
success,
|
|
4801
|
+
properties: this.enrichProperties(properties),
|
|
4802
|
+
operationId: context.operationId,
|
|
4803
|
+
...context.parentId !== undefined ? { parentId: context.parentId } : {},
|
|
4804
|
+
id: context.id,
|
|
4805
|
+
...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
|
|
4806
|
+
};
|
|
4546
4807
|
}
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
return;
|
|
4808
|
+
enrichProperties(properties) {
|
|
4809
|
+
const globalProperties = getGlobalTelemetryProperties();
|
|
4810
|
+
const enriched = {
|
|
4811
|
+
...getExecutionContextTelemetryProperties(),
|
|
4812
|
+
...globalProperties,
|
|
4813
|
+
...this.defaultProperties,
|
|
4814
|
+
...redactProperties(properties ?? {}),
|
|
4815
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4816
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
4817
|
+
};
|
|
4818
|
+
return lowercaseIdDimensionValues(enriched);
|
|
4558
4819
|
}
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4820
|
+
generateId() {
|
|
4821
|
+
const bytes = new Uint8Array(8);
|
|
4822
|
+
let hex = "";
|
|
4823
|
+
do {
|
|
4824
|
+
crypto.getRandomValues(bytes);
|
|
4825
|
+
hex = "";
|
|
4826
|
+
for (const byte of bytes) {
|
|
4827
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4828
|
+
}
|
|
4829
|
+
} while (/^0+$/.test(hex));
|
|
4830
|
+
return hex;
|
|
4564
4831
|
}
|
|
4565
|
-
getState().commandMs = durationMs;
|
|
4566
4832
|
}
|
|
4567
4833
|
// ../../common/src/telemetry/proxy-http-agent.ts
|
|
4568
4834
|
var slot = singleton("ProxyAuthHttpsAgent");
|
|
@@ -4570,6 +4836,15 @@ var slot = singleton("ProxyAuthHttpsAgent");
|
|
|
4570
4836
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
4571
4837
|
var providerSlot = singleton("TelemetryProvider");
|
|
4572
4838
|
|
|
4839
|
+
// ../../common/src/telemetry/telemetry-config.ts
|
|
4840
|
+
function isTelemetryDisabled() {
|
|
4841
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
4842
|
+
return value === "1" || value === "true";
|
|
4843
|
+
}
|
|
4844
|
+
function isProjectTelemetryDisabled() {
|
|
4845
|
+
return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
|
|
4846
|
+
}
|
|
4847
|
+
|
|
4573
4848
|
// ../../common/src/telemetry/telemetry-spool.ts
|
|
4574
4849
|
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
4575
4850
|
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
@@ -4605,7 +4880,6 @@ var telemetry = new Proxy({}, {
|
|
|
4605
4880
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
4606
4881
|
}
|
|
4607
4882
|
});
|
|
4608
|
-
|
|
4609
4883
|
// ../../common/src/formatter.ts
|
|
4610
4884
|
var ANSI_STYLES = {
|
|
4611
4885
|
red: "\x1B[31m",
|
|
@@ -4615,46 +4889,6 @@ var ANSI_RESET = "\x1B[0m";
|
|
|
4615
4889
|
function styleLine(line, style) {
|
|
4616
4890
|
return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
|
|
4617
4891
|
}
|
|
4618
|
-
var CLI_ERROR_CODES = [
|
|
4619
|
-
"invalid_argument",
|
|
4620
|
-
"authentication_required",
|
|
4621
|
-
"permission_denied",
|
|
4622
|
-
"local_permission_denied",
|
|
4623
|
-
"not_found",
|
|
4624
|
-
"rate_limited",
|
|
4625
|
-
"network_error",
|
|
4626
|
-
"timeout",
|
|
4627
|
-
"server_error",
|
|
4628
|
-
"method_not_allowed",
|
|
4629
|
-
"not_supported",
|
|
4630
|
-
"configuration_error",
|
|
4631
|
-
"execution_failed",
|
|
4632
|
-
"unknown_error"
|
|
4633
|
-
];
|
|
4634
|
-
var RETRY_HINTS = [
|
|
4635
|
-
"RetryWillNotFix",
|
|
4636
|
-
"RetryLater",
|
|
4637
|
-
"RetryAfter1Second",
|
|
4638
|
-
"RetryAfter10Seconds",
|
|
4639
|
-
"RetryAfter30Seconds",
|
|
4640
|
-
"RetryAfter60Seconds"
|
|
4641
|
-
];
|
|
4642
|
-
var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
|
|
4643
|
-
var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
|
|
4644
|
-
function isCliErrorCode(value) {
|
|
4645
|
-
return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
|
|
4646
|
-
}
|
|
4647
|
-
function isRetryHint(value) {
|
|
4648
|
-
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
4649
|
-
}
|
|
4650
|
-
var RESULTS = {
|
|
4651
|
-
Success: "Success",
|
|
4652
|
-
Failure: "Failure",
|
|
4653
|
-
ConfigError: "ConfigError",
|
|
4654
|
-
AuthenticationError: "AuthenticationError",
|
|
4655
|
-
ValidationError: "ValidationError",
|
|
4656
|
-
TimeoutError: "TimeoutError"
|
|
4657
|
-
};
|
|
4658
4892
|
var EXIT_CODES = {
|
|
4659
4893
|
Success: 0,
|
|
4660
4894
|
Failure: 1,
|
|
@@ -4663,6 +4897,9 @@ var EXIT_CODES = {
|
|
|
4663
4897
|
ValidationError: 3,
|
|
4664
4898
|
TimeoutError: 4
|
|
4665
4899
|
};
|
|
4900
|
+
function exitCodeForResult(result) {
|
|
4901
|
+
return EXIT_CODES[result] ?? EXIT_CODES.Failure;
|
|
4902
|
+
}
|
|
4666
4903
|
function escapeNonAscii(jsonText) {
|
|
4667
4904
|
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
4668
4905
|
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
@@ -5338,8 +5575,8 @@ function carriesOnlyNulls(value) {
|
|
|
5338
5575
|
}
|
|
5339
5576
|
return false;
|
|
5340
5577
|
}
|
|
5341
|
-
function nameList(names,
|
|
5342
|
-
const shown = names.slice(0,
|
|
5578
|
+
function nameList(names, cap = 12) {
|
|
5579
|
+
const shown = names.slice(0, cap).map((n) => `\`${n}\``);
|
|
5343
5580
|
const rest = names.length - shown.length;
|
|
5344
5581
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5345
5582
|
}
|
|
@@ -5476,40 +5713,11 @@ function defaultErrorCodeForResult(result) {
|
|
|
5476
5713
|
return "unknown_error";
|
|
5477
5714
|
}
|
|
5478
5715
|
}
|
|
5479
|
-
function parseHttpStatusFromMessage2(message) {
|
|
5480
|
-
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
5481
|
-
if (!match)
|
|
5482
|
-
return;
|
|
5483
|
-
const status = Number(match[1]);
|
|
5484
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
5485
|
-
}
|
|
5486
|
-
function defaultErrorCodeForHttpStatus(status) {
|
|
5487
|
-
if (status === undefined)
|
|
5488
|
-
return;
|
|
5489
|
-
if (status === 400 || status === 409 || status === 422) {
|
|
5490
|
-
return "invalid_argument";
|
|
5491
|
-
}
|
|
5492
|
-
if (status === 401)
|
|
5493
|
-
return "authentication_required";
|
|
5494
|
-
if (status === 403)
|
|
5495
|
-
return "permission_denied";
|
|
5496
|
-
if (status === 404)
|
|
5497
|
-
return "not_found";
|
|
5498
|
-
if (status === 405)
|
|
5499
|
-
return "method_not_allowed";
|
|
5500
|
-
if (status === 408)
|
|
5501
|
-
return "timeout";
|
|
5502
|
-
if (status === 429)
|
|
5503
|
-
return "rate_limited";
|
|
5504
|
-
if (status >= 500 && status < 600)
|
|
5505
|
-
return "server_error";
|
|
5506
|
-
return;
|
|
5507
|
-
}
|
|
5508
5716
|
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
5509
5717
|
function defaultErrorCodeForFailure(data) {
|
|
5510
5718
|
if (data.Result === RESULTS.Failure) {
|
|
5511
|
-
const status = data.Context?.httpStatus ??
|
|
5512
|
-
const errorCode =
|
|
5719
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
5720
|
+
const errorCode = classifyHttpStatus(status)?.errorCode;
|
|
5513
5721
|
if (errorCode)
|
|
5514
5722
|
return errorCode;
|
|
5515
5723
|
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
@@ -5518,17 +5726,6 @@ function defaultErrorCodeForFailure(data) {
|
|
|
5518
5726
|
}
|
|
5519
5727
|
return defaultErrorCodeForResult(data.Result);
|
|
5520
5728
|
}
|
|
5521
|
-
function defaultRetryForErrorCode(errorCode) {
|
|
5522
|
-
switch (errorCode) {
|
|
5523
|
-
case "network_error":
|
|
5524
|
-
case "rate_limited":
|
|
5525
|
-
case "server_error":
|
|
5526
|
-
case "timeout":
|
|
5527
|
-
return "RetryLater";
|
|
5528
|
-
default:
|
|
5529
|
-
return "RetryWillNotFix";
|
|
5530
|
-
}
|
|
5531
|
-
}
|
|
5532
5729
|
var OutputFormatter;
|
|
5533
5730
|
((OutputFormatter) => {
|
|
5534
5731
|
function success(data, options) {
|
|
@@ -5560,7 +5757,7 @@ var OutputFormatter;
|
|
|
5560
5757
|
data.Log ??= getLogFilePath() || undefined;
|
|
5561
5758
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
5562
5759
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
5563
|
-
const exitCode =
|
|
5760
|
+
const exitCode = exitCodeForResult(data.Result);
|
|
5564
5761
|
setExitCode(exitCode);
|
|
5565
5762
|
recordCommandFailureTelemetry({
|
|
5566
5763
|
result: data.Result,
|
|
@@ -5654,39 +5851,228 @@ var OutputFormatter;
|
|
|
5654
5851
|
}
|
|
5655
5852
|
OutputFormatter.formatToString = formatToString;
|
|
5656
5853
|
})(OutputFormatter ||= {});
|
|
5657
|
-
// ../../../node_modules/commander/esm.mjs
|
|
5658
|
-
var import__ = __toESM(require_commander(), 1);
|
|
5659
|
-
var {
|
|
5660
|
-
program,
|
|
5661
|
-
createCommand,
|
|
5662
|
-
createArgument,
|
|
5663
|
-
createOption,
|
|
5664
|
-
CommanderError,
|
|
5665
|
-
InvalidArgumentError,
|
|
5666
|
-
InvalidOptionArgumentError,
|
|
5667
|
-
Command,
|
|
5668
|
-
Argument,
|
|
5669
|
-
Option,
|
|
5670
|
-
Help
|
|
5671
|
-
} = import__.default;
|
|
5672
5854
|
|
|
5673
|
-
// ../../common/src/
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5855
|
+
// ../../common/src/pass-through-tail.ts
|
|
5856
|
+
function maybeOption(arg) {
|
|
5857
|
+
return arg.length > 1 && arg[0] === "-";
|
|
5858
|
+
}
|
|
5859
|
+
function tokenizeTail(cmd, tail) {
|
|
5860
|
+
const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
|
|
5861
|
+
const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
|
|
5862
|
+
const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
|
|
5863
|
+
const tokens = [];
|
|
5864
|
+
let firstUnknown = -1;
|
|
5865
|
+
let sentinel = -1;
|
|
5866
|
+
let variadic;
|
|
5867
|
+
let group;
|
|
5868
|
+
let groupIndex = 0;
|
|
5869
|
+
let i = 0;
|
|
5870
|
+
while (i < tail.length || group !== undefined) {
|
|
5871
|
+
const index = group === undefined ? i : groupIndex;
|
|
5872
|
+
const arg = group ?? tail[i++];
|
|
5873
|
+
group = undefined;
|
|
5874
|
+
if (arg === "--") {
|
|
5875
|
+
sentinel = index;
|
|
5876
|
+
tokens.push({ kind: "sentinel", index });
|
|
5877
|
+
for (let j = i;j < tail.length; j++) {
|
|
5878
|
+
tokens.push({
|
|
5879
|
+
kind: "operand",
|
|
5880
|
+
index: j,
|
|
5881
|
+
text: tail[j],
|
|
5882
|
+
literal: true
|
|
5883
|
+
});
|
|
5884
|
+
}
|
|
5885
|
+
break;
|
|
5886
|
+
}
|
|
5887
|
+
if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
|
|
5888
|
+
tokens.push({
|
|
5889
|
+
kind: "option",
|
|
5890
|
+
index,
|
|
5891
|
+
text: arg,
|
|
5892
|
+
option: variadic,
|
|
5893
|
+
value: arg
|
|
5894
|
+
});
|
|
5895
|
+
continue;
|
|
5896
|
+
}
|
|
5897
|
+
variadic = undefined;
|
|
5898
|
+
if (maybeOption(arg)) {
|
|
5899
|
+
const option = find(arg);
|
|
5900
|
+
if (option) {
|
|
5901
|
+
let value;
|
|
5902
|
+
if (option.required) {
|
|
5903
|
+
value = tail[i];
|
|
5904
|
+
if (value !== undefined)
|
|
5905
|
+
i++;
|
|
5906
|
+
} else if (option.optional) {
|
|
5907
|
+
const next = tail[i];
|
|
5908
|
+
if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
|
|
5909
|
+
value = next;
|
|
5910
|
+
i++;
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
tokens.push({
|
|
5914
|
+
kind: "option",
|
|
5915
|
+
index,
|
|
5916
|
+
text: arg,
|
|
5917
|
+
option,
|
|
5918
|
+
...value === undefined ? {} : { value }
|
|
5919
|
+
});
|
|
5920
|
+
variadic = option.variadic ? option : undefined;
|
|
5921
|
+
continue;
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
5925
|
+
const option = find(`-${arg[1]}`);
|
|
5926
|
+
if (option) {
|
|
5927
|
+
if (option.required || option.optional) {
|
|
5928
|
+
tokens.push({
|
|
5929
|
+
kind: "option",
|
|
5930
|
+
index,
|
|
5931
|
+
text: arg,
|
|
5932
|
+
option,
|
|
5933
|
+
value: arg.slice(2)
|
|
5934
|
+
});
|
|
5935
|
+
} else {
|
|
5936
|
+
tokens.push({ kind: "option", index, text: arg, option });
|
|
5937
|
+
group = `-${arg.slice(2)}`;
|
|
5938
|
+
groupIndex = index;
|
|
5939
|
+
}
|
|
5940
|
+
continue;
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
if (/^--[^=]+=/.test(arg)) {
|
|
5944
|
+
const equals = arg.indexOf("=");
|
|
5945
|
+
const option = find(arg.slice(0, equals));
|
|
5946
|
+
if (option && (option.required || option.optional)) {
|
|
5947
|
+
tokens.push({
|
|
5948
|
+
kind: "option",
|
|
5949
|
+
index,
|
|
5950
|
+
text: arg,
|
|
5951
|
+
option,
|
|
5952
|
+
value: arg.slice(equals + 1)
|
|
5953
|
+
});
|
|
5954
|
+
continue;
|
|
5955
|
+
}
|
|
5956
|
+
}
|
|
5957
|
+
if (maybeOption(arg) && !negativeNumber(arg)) {
|
|
5958
|
+
const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
5959
|
+
if (firstUnknown === -1)
|
|
5960
|
+
firstUnknown = index;
|
|
5961
|
+
tokens.push({
|
|
5962
|
+
kind: "unknown",
|
|
5963
|
+
index,
|
|
5964
|
+
text: arg,
|
|
5965
|
+
flag: equals > 0 ? arg.slice(0, equals) : arg,
|
|
5966
|
+
...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
|
|
5967
|
+
});
|
|
5968
|
+
continue;
|
|
5969
|
+
}
|
|
5970
|
+
tokens.push({ kind: "operand", index, text: arg, literal: false });
|
|
5971
|
+
}
|
|
5972
|
+
return { tokens, firstUnknown, sentinel };
|
|
5683
5973
|
}
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5974
|
+
|
|
5975
|
+
// ../../common/src/project-telemetry.ts
|
|
5976
|
+
var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
|
|
5977
|
+
var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
|
|
5978
|
+
var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
|
|
5979
|
+
var RULES = Symbol.for("@uipath/common/projectTargetRules");
|
|
5980
|
+
function logSkipped(what, error) {
|
|
5981
|
+
logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
5982
|
+
}
|
|
5983
|
+
function bounded(work, what) {
|
|
5984
|
+
return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
|
|
5985
|
+
}
|
|
5986
|
+
async function identityWithContext(command, identity) {
|
|
5987
|
+
const props = projectIdentityProperties(identity);
|
|
5988
|
+
if (!identity.projectDirectory || isProjectTelemetryDisabled())
|
|
5989
|
+
return props;
|
|
5990
|
+
for (let node = command;node; node = node.parent ?? undefined) {
|
|
5991
|
+
const resolver = node[CONTEXT_RESOLVER];
|
|
5992
|
+
if (typeof resolver !== "function")
|
|
5993
|
+
continue;
|
|
5994
|
+
try {
|
|
5995
|
+
return {
|
|
5996
|
+
...await resolver(identity.projectDirectory),
|
|
5997
|
+
...props
|
|
5998
|
+
};
|
|
5999
|
+
} catch (error) {
|
|
6000
|
+
logSkipped("solution context lookup", error);
|
|
6001
|
+
return props;
|
|
6002
|
+
}
|
|
5687
6003
|
}
|
|
5688
|
-
return
|
|
5689
|
-
}
|
|
6004
|
+
return props;
|
|
6005
|
+
}
|
|
6006
|
+
function getProjectTelemetryResolver(command) {
|
|
6007
|
+
for (let node = command;node; node = node.parent) {
|
|
6008
|
+
const resolver = node[RESOLVER];
|
|
6009
|
+
if (typeof resolver === "function")
|
|
6010
|
+
return resolver;
|
|
6011
|
+
}
|
|
6012
|
+
return;
|
|
6013
|
+
}
|
|
6014
|
+
function attachProjectTelemetryCapture(command, capture) {
|
|
6015
|
+
command[CAPTURE] = capture;
|
|
6016
|
+
}
|
|
6017
|
+
class ProjectTelemetrySession {
|
|
6018
|
+
resolver;
|
|
6019
|
+
command;
|
|
6020
|
+
target;
|
|
6021
|
+
props = {};
|
|
6022
|
+
explicit = false;
|
|
6023
|
+
input;
|
|
6024
|
+
constructor(resolver, command) {
|
|
6025
|
+
this.resolver = resolver;
|
|
6026
|
+
this.command = command;
|
|
6027
|
+
}
|
|
6028
|
+
async setTarget(path) {
|
|
6029
|
+
this.target = path;
|
|
6030
|
+
if (this.input) {
|
|
6031
|
+
await this.resolve({
|
|
6032
|
+
...this.input,
|
|
6033
|
+
phase: "after",
|
|
6034
|
+
success: true
|
|
6035
|
+
});
|
|
6036
|
+
this.explicit = true;
|
|
6037
|
+
}
|
|
6038
|
+
}
|
|
6039
|
+
async setIdentity(identity) {
|
|
6040
|
+
try {
|
|
6041
|
+
const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
|
|
6042
|
+
if (props !== undefined)
|
|
6043
|
+
this.setProperties(props);
|
|
6044
|
+
} catch (error) {
|
|
6045
|
+
logSkipped("project identity capture", error);
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6048
|
+
setProperties(properties) {
|
|
6049
|
+
try {
|
|
6050
|
+
this.props = { ...properties };
|
|
6051
|
+
this.explicit = true;
|
|
6052
|
+
} catch (error) {
|
|
6053
|
+
logSkipped("project identity properties", error);
|
|
6054
|
+
}
|
|
6055
|
+
}
|
|
6056
|
+
properties() {
|
|
6057
|
+
return { ...this.props };
|
|
6058
|
+
}
|
|
6059
|
+
async resolve(input) {
|
|
6060
|
+
this.input = input;
|
|
6061
|
+
if (this.explicit)
|
|
6062
|
+
return;
|
|
6063
|
+
try {
|
|
6064
|
+
const props = await bounded(this.resolver({
|
|
6065
|
+
...input,
|
|
6066
|
+
target: this.target
|
|
6067
|
+
}), `project identity (${input.phase})`);
|
|
6068
|
+
if (props !== undefined) {
|
|
6069
|
+
this.props = props;
|
|
6070
|
+
}
|
|
6071
|
+
} catch (error) {
|
|
6072
|
+
logSkipped(`project identity (${input.phase})`, error);
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
}
|
|
5690
6076
|
|
|
5691
6077
|
// ../../common/src/telemetry/command-attribution.ts
|
|
5692
6078
|
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
@@ -5932,8 +6318,7 @@ var pollSignalSlot = singleton("PollSignal");
|
|
|
5932
6318
|
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
5933
6319
|
var processContext = {
|
|
5934
6320
|
exit: (code) => {
|
|
5935
|
-
|
|
5936
|
-
setExitCode(code);
|
|
6321
|
+
recordCommandExit(code);
|
|
5937
6322
|
},
|
|
5938
6323
|
get pollSignal() {
|
|
5939
6324
|
return pollSignalSlot.get();
|
|
@@ -5958,6 +6343,8 @@ function recordableArgValue(value, choices) {
|
|
|
5958
6343
|
function extractCommandParams(cmd) {
|
|
5959
6344
|
const params = {};
|
|
5960
6345
|
forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
|
|
6346
|
+
if (name === undefined)
|
|
6347
|
+
return;
|
|
5961
6348
|
const recordable = recordableArgValue(value, choices);
|
|
5962
6349
|
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
|
|
5963
6350
|
});
|
|
@@ -5973,7 +6360,8 @@ function isDefaultedPositional(cmd, index) {
|
|
|
5973
6360
|
function forEachSuppliedArgument(cmd, visit) {
|
|
5974
6361
|
const registered = cmd.registeredArguments ?? [];
|
|
5975
6362
|
const processed = cmd.processedArgs ?? [];
|
|
5976
|
-
|
|
6363
|
+
const bound = boundPositionalCount(cmd);
|
|
6364
|
+
for (let i = 0;i < bound; i++) {
|
|
5977
6365
|
const name = registered[i].name();
|
|
5978
6366
|
if (name && processed[i] !== undefined) {
|
|
5979
6367
|
visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
|
|
@@ -5988,6 +6376,71 @@ function forEachSuppliedArgument(cmd, visit) {
|
|
|
5988
6376
|
visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
|
|
5989
6377
|
}
|
|
5990
6378
|
}
|
|
6379
|
+
forEachPassThroughToken(cmd, bound, (name, value) => {
|
|
6380
|
+
visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
|
|
6381
|
+
});
|
|
6382
|
+
}
|
|
6383
|
+
function boundPositionalCount(cmd) {
|
|
6384
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6385
|
+
if (registered.some((argument) => argument.variadic)) {
|
|
6386
|
+
return registered.length;
|
|
6387
|
+
}
|
|
6388
|
+
if ((cmd.args ?? []).length <= registered.length) {
|
|
6389
|
+
return registered.length;
|
|
6390
|
+
}
|
|
6391
|
+
const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
|
|
6392
|
+
return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
|
|
6393
|
+
}
|
|
6394
|
+
function forEachPassThroughToken(cmd, bound, visit) {
|
|
6395
|
+
const registered = cmd.registeredArguments ?? [];
|
|
6396
|
+
const fillsPositionals = !registered.some((argument) => argument.variadic);
|
|
6397
|
+
const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
|
|
6398
|
+
const repeated = new Map;
|
|
6399
|
+
let nextPositional = bound;
|
|
6400
|
+
for (const token of tokens) {
|
|
6401
|
+
const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
|
|
6402
|
+
if (token.kind === "sentinel")
|
|
6403
|
+
continue;
|
|
6404
|
+
if (token.kind === "operand") {
|
|
6405
|
+
const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
|
|
6406
|
+
const name = claimable ? registered[nextPositional++].name() : undefined;
|
|
6407
|
+
visit(name || undefined, token.text);
|
|
6408
|
+
continue;
|
|
6409
|
+
}
|
|
6410
|
+
if (token.kind === "unknown") {
|
|
6411
|
+
const bare = token.flag.replace(/^-+/, "");
|
|
6412
|
+
const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6413
|
+
const keyable = token.flag.startsWith("--") || token.flag.length === 2;
|
|
6414
|
+
if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
|
|
6415
|
+
visit(key, token.inlineValue ?? true);
|
|
6416
|
+
} else {
|
|
6417
|
+
visit(undefined, token.text);
|
|
6418
|
+
if (token.inlineValue !== undefined) {
|
|
6419
|
+
visit(undefined, token.inlineValue);
|
|
6420
|
+
} else if (!token.flag.startsWith("--") && token.flag.length > 2) {
|
|
6421
|
+
visit(undefined, token.flag.slice(2));
|
|
6422
|
+
}
|
|
6423
|
+
}
|
|
6424
|
+
continue;
|
|
6425
|
+
}
|
|
6426
|
+
if (pastUnknown) {
|
|
6427
|
+
visit(undefined, token.text);
|
|
6428
|
+
if (token.value !== undefined)
|
|
6429
|
+
visit(undefined, token.value);
|
|
6430
|
+
continue;
|
|
6431
|
+
}
|
|
6432
|
+
const option = token.option;
|
|
6433
|
+
const name = option.attributeName();
|
|
6434
|
+
const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
|
|
6435
|
+
const previous = repeated.get(name);
|
|
6436
|
+
if (previous) {
|
|
6437
|
+
previous.push(value);
|
|
6438
|
+
visit(name, previous);
|
|
6439
|
+
} else {
|
|
6440
|
+
repeated.set(name, [value]);
|
|
6441
|
+
visit(name, value);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
5991
6444
|
}
|
|
5992
6445
|
function withheldArgumentValues(cmd) {
|
|
5993
6446
|
const values = [];
|
|
@@ -6049,6 +6502,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6049
6502
|
const telemetryName = commandTelemetryName(commandParts);
|
|
6050
6503
|
const commandPath = commandInvocationPath(commandParts);
|
|
6051
6504
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
6505
|
+
const projectResolver = getProjectTelemetryResolver(command);
|
|
6506
|
+
const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
|
|
6052
6507
|
markCommandStart();
|
|
6053
6508
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
6054
6509
|
try {
|
|
@@ -6061,6 +6516,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6061
6516
|
if (violation) {
|
|
6062
6517
|
return Promise.reject(violation);
|
|
6063
6518
|
}
|
|
6519
|
+
if (projectSession) {
|
|
6520
|
+
return projectSession.resolve({ command, args, phase: "before" }).then(() => {
|
|
6521
|
+
attachProjectTelemetryCapture(command, projectSession);
|
|
6522
|
+
return fn(...args);
|
|
6523
|
+
});
|
|
6524
|
+
}
|
|
6064
6525
|
return fn(...args);
|
|
6065
6526
|
}));
|
|
6066
6527
|
if (error) {
|
|
@@ -6069,22 +6530,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6069
6530
|
const typed = error;
|
|
6070
6531
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6071
6532
|
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
6072
|
-
const
|
|
6533
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6534
|
+
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6535
|
+
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
6073
6536
|
const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
|
|
6074
6537
|
const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
|
|
6075
6538
|
const typedRetry = typed.retry ?? typed.Retry;
|
|
6076
6539
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
6077
6540
|
const typedContext = typed.context ?? typed.Context;
|
|
6078
6541
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
6079
|
-
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6080
6542
|
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
6543
|
+
const errorCode = customErrorCode ?? classified?.errorCode;
|
|
6544
|
+
const retry = customRetry ?? classified?.retry;
|
|
6545
|
+
const errorContext = customContext ?? classified?.context;
|
|
6081
6546
|
OutputFormatter.error({
|
|
6082
6547
|
Result: finalResult,
|
|
6083
|
-
...
|
|
6548
|
+
...errorCode ? { ErrorCode: errorCode } : {},
|
|
6084
6549
|
Message: errorMessage,
|
|
6085
6550
|
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
6086
|
-
...
|
|
6087
|
-
...
|
|
6551
|
+
...retry ? { Retry: retry } : {},
|
|
6552
|
+
...errorContext ? { Context: errorContext } : {}
|
|
6088
6553
|
});
|
|
6089
6554
|
context.exit(fallbackExitCode);
|
|
6090
6555
|
}
|
|
@@ -6093,6 +6558,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6093
6558
|
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
6094
6559
|
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
6095
6560
|
const success = !error && exitCode === 0;
|
|
6561
|
+
if (projectSession) {
|
|
6562
|
+
await projectSession.resolve({
|
|
6563
|
+
command,
|
|
6564
|
+
args,
|
|
6565
|
+
phase: "after",
|
|
6566
|
+
success
|
|
6567
|
+
});
|
|
6568
|
+
}
|
|
6096
6569
|
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
6097
6570
|
error,
|
|
6098
6571
|
exitCode,
|
|
@@ -6110,6 +6583,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6110
6583
|
}
|
|
6111
6584
|
const baseProperties = redactProperties({
|
|
6112
6585
|
...commandParams,
|
|
6586
|
+
...projectSession?.properties(),
|
|
6113
6587
|
...props,
|
|
6114
6588
|
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
6115
6589
|
...buildAgentSessionTelemetry(process.env),
|
|
@@ -6120,6 +6594,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6120
6594
|
});
|
|
6121
6595
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
6122
6596
|
} finally {
|
|
6597
|
+
if (projectSession)
|
|
6598
|
+
attachProjectTelemetryCapture(command, undefined);
|
|
6123
6599
|
releaseSuppliedArgumentValues(supplied);
|
|
6124
6600
|
}
|
|
6125
6601
|
});
|
|
@@ -6585,9 +7061,9 @@ function getProfileStorage() {
|
|
|
6585
7061
|
if (isAuthProfileStorage(existing)) {
|
|
6586
7062
|
return existing;
|
|
6587
7063
|
}
|
|
6588
|
-
const
|
|
6589
|
-
globalSlot2[AUTH_PROFILE_STORAGE_KEY] =
|
|
6590
|
-
return
|
|
7064
|
+
const storage = createProfileStorage();
|
|
7065
|
+
globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
|
|
7066
|
+
return storage;
|
|
6591
7067
|
}
|
|
6592
7068
|
var profileStorage = getProfileStorage();
|
|
6593
7069
|
|
|
@@ -6618,8 +7094,8 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
6618
7094
|
if (normalized === undefined) {
|
|
6619
7095
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
6620
7096
|
}
|
|
6621
|
-
const
|
|
6622
|
-
return
|
|
7097
|
+
const fs = getFileSystem();
|
|
7098
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
6623
7099
|
}
|
|
6624
7100
|
function getActiveAuthProfileFilePath() {
|
|
6625
7101
|
const profile = getActiveAuthProfile();
|
|
@@ -6792,6 +7268,8 @@ var ENV_AUTH_VARS = {
|
|
|
6792
7268
|
};
|
|
6793
7269
|
|
|
6794
7270
|
class EnvAuthConfigError extends Error {
|
|
7271
|
+
errorCode = "configuration_error";
|
|
7272
|
+
retry = "RetryWillNotFix";
|
|
6795
7273
|
constructor(message) {
|
|
6796
7274
|
super(message);
|
|
6797
7275
|
this.name = "EnvAuthConfigError";
|
|
@@ -6830,11 +7308,11 @@ var readAuthFromEnv = () => {
|
|
|
6830
7308
|
if (!rawUrl) {
|
|
6831
7309
|
throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
|
|
6832
7310
|
}
|
|
6833
|
-
const
|
|
7311
|
+
const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
6834
7312
|
return {
|
|
6835
7313
|
loginStatus: "Logged in",
|
|
6836
7314
|
accessToken,
|
|
6837
|
-
baseUrl
|
|
7315
|
+
baseUrl,
|
|
6838
7316
|
organizationName,
|
|
6839
7317
|
organizationId,
|
|
6840
7318
|
tenantName,
|
|
@@ -6875,8 +7353,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
|
|
|
6875
7353
|
async function refreshTokenFingerprint(refreshToken) {
|
|
6876
7354
|
const bytes = new TextEncoder().encode(refreshToken);
|
|
6877
7355
|
if (globalThis.crypto?.subtle) {
|
|
6878
|
-
const
|
|
6879
|
-
return Array.from(new Uint8Array(
|
|
7356
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
7357
|
+
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
6880
7358
|
}
|
|
6881
7359
|
const { createHash } = await import("node:crypto");
|
|
6882
7360
|
return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
|
|
@@ -6885,9 +7363,9 @@ function breakerPathFor(authPath) {
|
|
|
6885
7363
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
6886
7364
|
}
|
|
6887
7365
|
async function loadRefreshBreaker(authPath) {
|
|
6888
|
-
const
|
|
7366
|
+
const fs = getFileSystem();
|
|
6889
7367
|
try {
|
|
6890
|
-
const content = await
|
|
7368
|
+
const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
|
|
6891
7369
|
if (!content)
|
|
6892
7370
|
return {};
|
|
6893
7371
|
const parsed = JSON.parse(content);
|
|
@@ -6898,20 +7376,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
6898
7376
|
}
|
|
6899
7377
|
async function saveRefreshBreaker(authPath, state) {
|
|
6900
7378
|
try {
|
|
6901
|
-
const
|
|
6902
|
-
const
|
|
6903
|
-
await
|
|
6904
|
-
const tempPath = `${
|
|
6905
|
-
await
|
|
6906
|
-
await
|
|
7379
|
+
const fs = getFileSystem();
|
|
7380
|
+
const path = breakerPathFor(authPath);
|
|
7381
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
7382
|
+
const tempPath = `${path}.tmp`;
|
|
7383
|
+
await fs.writeFile(tempPath, JSON.stringify(state));
|
|
7384
|
+
await fs.rename(tempPath, path);
|
|
6907
7385
|
} catch {}
|
|
6908
7386
|
}
|
|
6909
7387
|
async function clearRefreshBreaker(authPath) {
|
|
6910
|
-
const
|
|
6911
|
-
const
|
|
7388
|
+
const fs = getFileSystem();
|
|
7389
|
+
const path = breakerPathFor(authPath);
|
|
6912
7390
|
try {
|
|
6913
|
-
if (await
|
|
6914
|
-
await
|
|
7391
|
+
if (await fs.exists(path)) {
|
|
7392
|
+
await fs.rm(path);
|
|
6915
7393
|
}
|
|
6916
7394
|
} catch {}
|
|
6917
7395
|
}
|
|
@@ -6932,13 +7410,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
|
6932
7410
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
6933
7411
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
6934
7412
|
var getRobotIpcPipeNames = async () => {
|
|
6935
|
-
const
|
|
6936
|
-
const username =
|
|
7413
|
+
const fs = getFileSystem();
|
|
7414
|
+
const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
|
|
6937
7415
|
if (!username) {
|
|
6938
7416
|
throw new Error("Unable to determine current username");
|
|
6939
7417
|
}
|
|
6940
|
-
const tempPath =
|
|
6941
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
7418
|
+
const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
|
|
7419
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
6942
7420
|
};
|
|
6943
7421
|
var defaultIsRobotIpcAvailable = async () => {
|
|
6944
7422
|
if (process.platform === "win32") {
|
|
@@ -6948,20 +7426,20 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
6948
7426
|
if (pipeNamesError || !pipeNames) {
|
|
6949
7427
|
return false;
|
|
6950
7428
|
}
|
|
6951
|
-
const
|
|
7429
|
+
const fs = getFileSystem();
|
|
6952
7430
|
for (const pipeName of pipeNames) {
|
|
6953
|
-
const [existsError, exists] = await catchError2(
|
|
7431
|
+
const [existsError, exists] = await catchError2(fs.exists(pipeName));
|
|
6954
7432
|
if (!existsError && exists === true) {
|
|
6955
7433
|
return true;
|
|
6956
7434
|
}
|
|
6957
7435
|
}
|
|
6958
7436
|
return false;
|
|
6959
7437
|
};
|
|
6960
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
7438
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
|
|
6961
7439
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
6962
7440
|
promise.then((value) => {
|
|
6963
7441
|
clearTimeout(timer);
|
|
6964
|
-
|
|
7442
|
+
resolve(value);
|
|
6965
7443
|
}, (error) => {
|
|
6966
7444
|
clearTimeout(timer);
|
|
6967
7445
|
reject(error);
|
|
@@ -7134,9 +7612,12 @@ var refreshAccessToken = async ({
|
|
|
7134
7612
|
body: tokenParams
|
|
7135
7613
|
});
|
|
7136
7614
|
const tokenData = await tokenResponse.json();
|
|
7137
|
-
if (
|
|
7615
|
+
if (tokenResponse.status === 400 || tokenResponse.status === 401) {
|
|
7138
7616
|
throw new TokenRefreshOAuthError;
|
|
7139
7617
|
}
|
|
7618
|
+
if (!tokenResponse.ok) {
|
|
7619
|
+
throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
|
|
7620
|
+
}
|
|
7140
7621
|
const newAccessToken = tokenData.access_token;
|
|
7141
7622
|
const newRefreshToken = tokenData.refresh_token;
|
|
7142
7623
|
if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
|
|
@@ -7168,9 +7649,9 @@ var errorCode = (err) => {
|
|
|
7168
7649
|
}
|
|
7169
7650
|
return "EUNKNOWN";
|
|
7170
7651
|
};
|
|
7171
|
-
var probeAsync = async (
|
|
7652
|
+
var probeAsync = async (fs, candidate) => {
|
|
7172
7653
|
try {
|
|
7173
|
-
const stats = await
|
|
7654
|
+
const stats = await fs.stat(candidate);
|
|
7174
7655
|
if (stats === null) {
|
|
7175
7656
|
return { exists: false };
|
|
7176
7657
|
}
|
|
@@ -7197,36 +7678,36 @@ var probeAsync = async (fs2, candidate) => {
|
|
|
7197
7678
|
}
|
|
7198
7679
|
};
|
|
7199
7680
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
7200
|
-
const
|
|
7201
|
-
if (
|
|
7202
|
-
const
|
|
7203
|
-
return
|
|
7681
|
+
const fs = getFileSystem();
|
|
7682
|
+
if (fs.path.isAbsolute(envFilePath)) {
|
|
7683
|
+
const probe = await probeAsync(fs, envFilePath);
|
|
7684
|
+
return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
7204
7685
|
exists: false,
|
|
7205
7686
|
absolutePath: envFilePath,
|
|
7206
7687
|
source: "absolute",
|
|
7207
|
-
...
|
|
7688
|
+
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
7208
7689
|
};
|
|
7209
7690
|
}
|
|
7210
|
-
const cwd = opts?.cwd ??
|
|
7691
|
+
const cwd = opts?.cwd ?? fs.env.cwd();
|
|
7211
7692
|
let searchDir = cwd;
|
|
7212
7693
|
while (true) {
|
|
7213
|
-
const candidate =
|
|
7214
|
-
const
|
|
7215
|
-
if (
|
|
7694
|
+
const candidate = fs.path.join(searchDir, envFilePath);
|
|
7695
|
+
const probe = await probeAsync(fs, candidate);
|
|
7696
|
+
if (probe.exists) {
|
|
7216
7697
|
return {
|
|
7217
7698
|
exists: true,
|
|
7218
7699
|
absolutePath: candidate,
|
|
7219
7700
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
7220
7701
|
};
|
|
7221
7702
|
}
|
|
7222
|
-
const parentDir =
|
|
7703
|
+
const parentDir = fs.path.dirname(searchDir);
|
|
7223
7704
|
if (parentDir === searchDir) {
|
|
7224
7705
|
break;
|
|
7225
7706
|
}
|
|
7226
7707
|
searchDir = parentDir;
|
|
7227
7708
|
}
|
|
7228
|
-
const homePath =
|
|
7229
|
-
const probe = await probeAsync(
|
|
7709
|
+
const homePath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
7710
|
+
const probe = await probeAsync(fs, homePath);
|
|
7230
7711
|
if (probe.exists) {
|
|
7231
7712
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
7232
7713
|
}
|
|
@@ -7269,12 +7750,12 @@ var parseEnvContent = (content) => {
|
|
|
7269
7750
|
return env;
|
|
7270
7751
|
};
|
|
7271
7752
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
7272
|
-
const
|
|
7273
|
-
const absolutePath =
|
|
7274
|
-
if (!await
|
|
7753
|
+
const fs = getFileSystem();
|
|
7754
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
7755
|
+
if (!await fs.exists(absolutePath)) {
|
|
7275
7756
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7276
7757
|
}
|
|
7277
|
-
const content = await
|
|
7758
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
7278
7759
|
if (content === null) {
|
|
7279
7760
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
7280
7761
|
}
|
|
@@ -7285,10 +7766,10 @@ var saveEnvFileAsync = async ({
|
|
|
7285
7766
|
data,
|
|
7286
7767
|
merge = true
|
|
7287
7768
|
}) => {
|
|
7288
|
-
const
|
|
7289
|
-
const absolutePath =
|
|
7769
|
+
const fs = getFileSystem();
|
|
7770
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
|
|
7290
7771
|
let existingData = {};
|
|
7291
|
-
if (merge && await
|
|
7772
|
+
if (merge && await fs.exists(absolutePath)) {
|
|
7292
7773
|
try {
|
|
7293
7774
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
7294
7775
|
} catch {}
|
|
@@ -7306,11 +7787,11 @@ var saveEnvFileAsync = async ({
|
|
|
7306
7787
|
const content = `${lines.join(`
|
|
7307
7788
|
`)}
|
|
7308
7789
|
`;
|
|
7309
|
-
const dir =
|
|
7310
|
-
await
|
|
7790
|
+
const dir = fs.path.dirname(absolutePath);
|
|
7791
|
+
await fs.mkdir(dir);
|
|
7311
7792
|
const tempPath = `${absolutePath}.tmp`;
|
|
7312
|
-
await
|
|
7313
|
-
await
|
|
7793
|
+
await fs.writeFile(tempPath, content);
|
|
7794
|
+
await fs.rename(tempPath, absolutePath);
|
|
7314
7795
|
};
|
|
7315
7796
|
|
|
7316
7797
|
// ../../auth/src/loginStatus.ts
|
|
@@ -7434,11 +7915,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
7434
7915
|
return { credentials };
|
|
7435
7916
|
}
|
|
7436
7917
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
7437
|
-
const
|
|
7438
|
-
const globalPath =
|
|
7918
|
+
const fs = getFs();
|
|
7919
|
+
const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
7439
7920
|
if (absolutePath === globalPath)
|
|
7440
7921
|
return;
|
|
7441
|
-
if (!await
|
|
7922
|
+
if (!await fs.exists(globalPath))
|
|
7442
7923
|
return;
|
|
7443
7924
|
try {
|
|
7444
7925
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -7853,6 +8334,51 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
7853
8334
|
function errorMessage(error) {
|
|
7854
8335
|
return error instanceof Error ? error.message : String(error);
|
|
7855
8336
|
}
|
|
8337
|
+
|
|
8338
|
+
// ../../auth/src/authContext.ts
|
|
8339
|
+
class AuthContextUnavailableError extends Error {
|
|
8340
|
+
instructionContext;
|
|
8341
|
+
sessionHint;
|
|
8342
|
+
errorCode = "authentication_required";
|
|
8343
|
+
retry = "RetryWillNotFix";
|
|
8344
|
+
constructor(message, instructionContext = "auth", sessionHint) {
|
|
8345
|
+
super(message);
|
|
8346
|
+
this.instructionContext = instructionContext;
|
|
8347
|
+
this.sessionHint = sessionHint;
|
|
8348
|
+
this.name = "AuthContextUnavailableError";
|
|
8349
|
+
}
|
|
8350
|
+
}
|
|
8351
|
+
var getAuthContext = async (options = {}) => {
|
|
8352
|
+
const status = await getLoginStatusAsync({
|
|
8353
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
8354
|
+
envFilePath: options.envFilePath
|
|
8355
|
+
});
|
|
8356
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
8357
|
+
throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
|
|
8358
|
+
}
|
|
8359
|
+
const tenantName = options.tenant || status.tenantName;
|
|
8360
|
+
if (options.requireOrganizationId && !status.organizationId) {
|
|
8361
|
+
throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
|
|
8362
|
+
}
|
|
8363
|
+
if (options.requireOrganizationName && !status.organizationName) {
|
|
8364
|
+
throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
|
|
8365
|
+
}
|
|
8366
|
+
if (options.requireTenantId && !status.tenantId) {
|
|
8367
|
+
throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
|
|
8368
|
+
}
|
|
8369
|
+
if (options.requireTenantName && !tenantName) {
|
|
8370
|
+
throw new AuthContextUnavailableError("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.", "identity");
|
|
8371
|
+
}
|
|
8372
|
+
return {
|
|
8373
|
+
baseUrl: status.baseUrl,
|
|
8374
|
+
accessToken: status.accessToken,
|
|
8375
|
+
organizationId: status.organizationId,
|
|
8376
|
+
organizationName: status.organizationName,
|
|
8377
|
+
tenantId: status.tenantId,
|
|
8378
|
+
tenantName,
|
|
8379
|
+
identity: status.identity
|
|
8380
|
+
};
|
|
8381
|
+
};
|
|
7856
8382
|
// ../../auth/src/selectTenant.ts
|
|
7857
8383
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
7858
8384
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -7865,19 +8391,14 @@ var SERVICE_PATH = {
|
|
|
7865
8391
|
"llm-gateway": "llmgateway_"
|
|
7866
8392
|
};
|
|
7867
8393
|
var REQUESTING_PRODUCT = "uipath-cli";
|
|
7868
|
-
async function
|
|
7869
|
-
const
|
|
7870
|
-
ensureTokenValidityMinutes: options?.loginValidity
|
|
8394
|
+
async function resolveAuth(options) {
|
|
8395
|
+
const auth = await getAuthContext({
|
|
8396
|
+
ensureTokenValidityMinutes: options?.loginValidity,
|
|
8397
|
+
requireOrganizationId: true
|
|
7871
8398
|
});
|
|
7872
|
-
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
7873
|
-
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
7874
|
-
}
|
|
7875
|
-
if (!status.organizationId) {
|
|
7876
|
-
throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
|
|
7877
|
-
}
|
|
7878
8399
|
return {
|
|
7879
|
-
|
|
7880
|
-
bearerToken: options?.s2sToken ??
|
|
8400
|
+
auth,
|
|
8401
|
+
bearerToken: options?.s2sToken ?? auth.accessToken
|
|
7881
8402
|
};
|
|
7882
8403
|
}
|
|
7883
8404
|
function stripTrailingSlash(s) {
|
|
@@ -7887,9 +8408,9 @@ function stripTrailingSlash(s) {
|
|
|
7887
8408
|
}
|
|
7888
8409
|
return end === s.length ? s : s.slice(0, end);
|
|
7889
8410
|
}
|
|
7890
|
-
function buildUrl(baseUrl,
|
|
8411
|
+
function buildUrl(baseUrl, path, query) {
|
|
7891
8412
|
const trimmed = stripTrailingSlash(baseUrl);
|
|
7892
|
-
const suffix =
|
|
8413
|
+
const suffix = path.startsWith("/") ? path : `/${path}`;
|
|
7893
8414
|
if (!query)
|
|
7894
8415
|
return `${trimmed}${suffix}`;
|
|
7895
8416
|
const search = new URLSearchParams;
|
|
@@ -7908,28 +8429,26 @@ async function readErrorBody(response) {
|
|
|
7908
8429
|
return `${response.status} ${response.statusText}: ${text.slice(0, 1000)}`;
|
|
7909
8430
|
}
|
|
7910
8431
|
async function createAiHttpContext(service, options) {
|
|
7911
|
-
const {
|
|
7912
|
-
const explicitTenantOverride = options?.tenantName
|
|
7913
|
-
const tenantName = options?.tenantName
|
|
7914
|
-
const tenantSegment = explicitTenantOverride ? options?.tenantName :
|
|
8432
|
+
const { auth, bearerToken } = await resolveAuth(options);
|
|
8433
|
+
const explicitTenantOverride = Boolean(options?.tenantName);
|
|
8434
|
+
const tenantName = options?.tenantName || auth.tenantName;
|
|
8435
|
+
const tenantSegment = explicitTenantOverride ? options?.tenantName : auth.tenantId ?? auth.tenantName;
|
|
7915
8436
|
const segments = [
|
|
7916
|
-
|
|
7917
|
-
|
|
8437
|
+
stripTrailingSlash(auth.baseUrl),
|
|
8438
|
+
encodeURIComponent(auth.organizationId)
|
|
7918
8439
|
];
|
|
7919
8440
|
if (tenantSegment) {
|
|
7920
8441
|
segments.push(encodeURIComponent(tenantSegment));
|
|
7921
8442
|
}
|
|
7922
8443
|
segments.push(SERVICE_PATH[service]);
|
|
7923
|
-
const baseUrl = segments.
|
|
8444
|
+
const baseUrl = segments.join("/");
|
|
7924
8445
|
const baseHeaders = {
|
|
7925
8446
|
Authorization: `Bearer ${bearerToken}`,
|
|
7926
|
-
Accept: "application/json"
|
|
8447
|
+
Accept: "application/json",
|
|
8448
|
+
"x-uipath-internal-accountid": auth.organizationId
|
|
7927
8449
|
};
|
|
7928
|
-
if (
|
|
7929
|
-
baseHeaders["x-uipath-internal-
|
|
7930
|
-
}
|
|
7931
|
-
if (!explicitTenantOverride && status.tenantId) {
|
|
7932
|
-
baseHeaders["x-uipath-internal-tenantid"] = status.tenantId;
|
|
8450
|
+
if (!explicitTenantOverride && auth.tenantId) {
|
|
8451
|
+
baseHeaders["x-uipath-internal-tenantid"] = auth.tenantId;
|
|
7933
8452
|
}
|
|
7934
8453
|
baseHeaders["x-uipath-requestingproduct"] = REQUESTING_PRODUCT;
|
|
7935
8454
|
baseHeaders["X-UiPath-LLMGateway-AllowFull4xxResponse"] = "true";
|
|
@@ -7978,8 +8497,8 @@ async function createAiHttpContext(service, options) {
|
|
|
7978
8497
|
};
|
|
7979
8498
|
return {
|
|
7980
8499
|
baseUrl,
|
|
7981
|
-
organizationId:
|
|
7982
|
-
tenantId: explicitTenantOverride ? undefined :
|
|
8500
|
+
organizationId: auth.organizationId,
|
|
8501
|
+
tenantId: explicitTenantOverride ? undefined : auth.tenantId,
|
|
7983
8502
|
tenantName,
|
|
7984
8503
|
requestingProduct: REQUESTING_PRODUCT,
|
|
7985
8504
|
fetchJson,
|
|
@@ -8217,8 +8736,8 @@ function registerGetCommand(customRoutings) {
|
|
|
8217
8736
|
}
|
|
8218
8737
|
|
|
8219
8738
|
// src/commands/custom-routings/index.ts
|
|
8220
|
-
var registerCustomRoutingsCommand = (
|
|
8221
|
-
const customRoutings =
|
|
8739
|
+
var registerCustomRoutingsCommand = (program) => {
|
|
8740
|
+
const customRoutings = program.command("custom-routings").description("Custom routing rules — override the default (product, feature, model→region) mapping per tenant.");
|
|
8222
8741
|
registerGetCommand(customRoutings);
|
|
8223
8742
|
registerCreateCommand(customRoutings);
|
|
8224
8743
|
};
|
|
@@ -8275,8 +8794,8 @@ function registerGetCommand2(organizations) {
|
|
|
8275
8794
|
}
|
|
8276
8795
|
|
|
8277
8796
|
// src/commands/organizations/index.ts
|
|
8278
|
-
var registerOrganizationsCommand = (
|
|
8279
|
-
const organizations =
|
|
8797
|
+
var registerOrganizationsCommand = (program) => {
|
|
8798
|
+
const organizations = program.command("organizations").description("Model Hub organization-scoped views (e.g. per-tenant model counts for the current org).");
|
|
8280
8799
|
registerGetCommand2(organizations);
|
|
8281
8800
|
};
|
|
8282
8801
|
|
|
@@ -8335,8 +8854,8 @@ function registerGetCommand3(policyPreviews) {
|
|
|
8335
8854
|
}
|
|
8336
8855
|
|
|
8337
8856
|
// src/commands/policy-previews/index.ts
|
|
8338
|
-
var registerPolicyPreviewsCommand = (
|
|
8339
|
-
const policyPreviews =
|
|
8857
|
+
var registerPolicyPreviewsCommand = (program) => {
|
|
8858
|
+
const policyPreviews = program.command("policy-previews").description("Preview the tenant configuration that would result from applying a governance policy, before activating it.");
|
|
8340
8859
|
registerGetCommand3(policyPreviews);
|
|
8341
8860
|
};
|
|
8342
8861
|
|
|
@@ -8398,8 +8917,8 @@ function registerListCommand(routingHistory) {
|
|
|
8398
8917
|
}
|
|
8399
8918
|
|
|
8400
8919
|
// src/commands/routing-history/index.ts
|
|
8401
|
-
var registerRoutingHistoryCommand = (
|
|
8402
|
-
const routingHistory =
|
|
8920
|
+
var registerRoutingHistoryCommand = (program) => {
|
|
8921
|
+
const routingHistory = program.command("routing-history").description("Routing-rule change history per (product, feature, model) — who changed what, when.");
|
|
8403
8922
|
registerListCommand(routingHistory);
|
|
8404
8923
|
};
|
|
8405
8924
|
|
|
@@ -8460,26 +8979,26 @@ function registerGetCommand4(tenants) {
|
|
|
8460
8979
|
}
|
|
8461
8980
|
|
|
8462
8981
|
// src/commands/tenants/index.ts
|
|
8463
|
-
var registerTenantsCommand = (
|
|
8464
|
-
const tenants =
|
|
8982
|
+
var registerTenantsCommand = (program) => {
|
|
8983
|
+
const tenants = program.command("tenants").description("Model Hub tenant-scoped views (per-product/per-feature routing rules for the current tenant).");
|
|
8465
8984
|
registerGetCommand4(tenants);
|
|
8466
8985
|
};
|
|
8467
8986
|
|
|
8468
8987
|
// src/tool.ts
|
|
8469
|
-
var
|
|
8988
|
+
var metadata2 = {
|
|
8470
8989
|
name: "model-hub-tool",
|
|
8471
8990
|
version: package_default.version,
|
|
8472
8991
|
description: "UiPath Model Hub view for LLM Gateway routing configuration.",
|
|
8473
8992
|
commandPrefix: "model-hub"
|
|
8474
8993
|
};
|
|
8475
|
-
var
|
|
8476
|
-
registerOrganizationsCommand(
|
|
8477
|
-
registerTenantsCommand(
|
|
8478
|
-
registerCustomRoutingsCommand(
|
|
8479
|
-
registerRoutingHistoryCommand(
|
|
8480
|
-
registerPolicyPreviewsCommand(
|
|
8994
|
+
var registerCommands2 = async (program) => {
|
|
8995
|
+
registerOrganizationsCommand(program);
|
|
8996
|
+
registerTenantsCommand(program);
|
|
8997
|
+
registerCustomRoutingsCommand(program);
|
|
8998
|
+
registerRoutingHistoryCommand(program);
|
|
8999
|
+
registerPolicyPreviewsCommand(program);
|
|
8481
9000
|
};
|
|
8482
9001
|
|
|
8483
|
-
export { Command,
|
|
9002
|
+
export { Command, metadata2, registerCommands2 };
|
|
8484
9003
|
|
|
8485
|
-
//# debugId=
|
|
9004
|
+
//# debugId=2D6549ED1EA5A5C764756E2164756E21
|