@uipath/aops-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.
@@ -1,8 +1,9 @@
1
1
  import {
2
+ __toESM,
2
3
  __commonJS,
3
- __require,
4
- __toESM
5
- } from "./tool-1de529jm.js";
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((cmd2) => !cmd2._hidden);
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((str2, word) => {
608
- return str2 + word[0].toUpperCase() + word.slice(1);
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 path2 = __require("node:path");
730
- var fs2 = __require("node:fs");
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(argv, parseOptions) {
1180
- if (argv !== undefined && !Array.isArray(argv)) {
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 (argv === undefined && parseOptions.from === undefined) {
1185
+ if (argv2 === undefined && parseOptions.from === undefined) {
1185
1186
  if (process2.versions?.electron) {
1186
1187
  parseOptions.from = "electron";
1187
1188
  }
1188
- const execArgv = process2.execArgv ?? [];
1189
- if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
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 (argv === undefined) {
1194
- argv = process2.argv;
1194
+ if (argv2 === undefined) {
1195
+ argv2 = process2.argv;
1195
1196
  }
1196
- this.rawArgs = argv.slice();
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 = argv[1];
1202
- userArgs = argv.slice(2);
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 = argv[1];
1207
- userArgs = argv.slice(2);
1207
+ this._scriptPath = argv2[1];
1208
+ userArgs = argv2.slice(2);
1208
1209
  } else {
1209
- userArgs = argv.slice(1);
1210
+ userArgs = argv2.slice(1);
1210
1211
  }
1211
1212
  break;
1212
1213
  case "user":
1213
- userArgs = argv.slice(0);
1214
+ userArgs = argv2.slice(0);
1214
1215
  break;
1215
1216
  case "eval":
1216
- userArgs = argv.slice(1);
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 (fs2.existsSync(executableFile))
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 = path2.resolve(baseDir, baseName);
1280
- if (fs2.existsSync(localBin))
1280
+ const localBin = path.resolve(baseDir, baseName);
1281
+ if (fs.existsSync(localBin))
1281
1282
  return localBin;
1282
- if (sourceExt.includes(path2.extname(baseName)))
1283
+ if (sourceExt.includes(path.extname(baseName)))
1283
1284
  return;
1284
- const foundExt = sourceExt.find((ext) => fs2.existsSync(`${localBin}${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 = fs2.realpathSync(this._scriptPath);
1297
+ resolvedScriptPath = fs.realpathSync(this._scriptPath);
1297
1298
  } catch {
1298
1299
  resolvedScriptPath = this._scriptPath;
1299
1300
  }
1300
- executableDir = path2.resolve(path2.dirname(resolvedScriptPath), 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 = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
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(path2.extname(executableFile));
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 = (option2) => {
1740
- const optionKey = option2.attributeName();
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 || option2;
1748
+ return positiveOption || option;
1748
1749
  };
1749
- const getErrorMessage = (option2) => {
1750
- const bestOption = findBestOptionFromValue(option2);
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 = path2.basename(filename, path2.extname(filename));
1902
+ this._name = path.basename(filename, path.extname(filename));
1902
1903
  return this;
1903
1904
  }
1904
- executableDir(path3) {
1905
- if (path3 === undefined)
1905
+ executableDir(path) {
1906
+ if (path === undefined)
1906
1907
  return this._executableDir;
1907
- this._executableDir = path3;
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 exitCode = Number(process2.exitCode ?? 0);
2005
- if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2006
- exitCode = 1;
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(exitCode, "commander.help", "(outputHelp)");
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/aops-tool",
2102
2083
  author: "UiPath",
2103
2084
  license: "SEE LICENSE IN LICENSE.txt",
2104
- version: "1.205.0-preview.281",
2085
+ version: "1.206.0-preview.282",
2105
2086
  description: "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
2106
2087
  private: false,
2107
2088
  repository: {
@@ -2128,6 +2109,7 @@ var package_default = {
2128
2109
  ],
2129
2110
  scripts: {
2130
2111
  build: "bun ../../tools/build-tool.ts",
2112
+ typecheck: "tsc --noEmit",
2131
2113
  package: "bun run build && bun pm pack",
2132
2114
  test: "vitest run",
2133
2115
  "test:coverage": "vitest run --coverage",
@@ -2146,7 +2128,7 @@ var package_default = {
2146
2128
  };
2147
2129
 
2148
2130
  // ../filesystem/src/node.ts
2149
- import { randomUUID } from "node:crypto";
2131
+ import { createHash, randomUUID } from "node:crypto";
2150
2132
  import { existsSync } from "node:fs";
2151
2133
  import * as fs from "node:fs/promises";
2152
2134
  import * as os from "node:os";
@@ -2157,6 +2139,9 @@ var LOCK_MAX_WAIT_MS = 20000;
2157
2139
  var LOCK_MAX_HOLD_MS = 60000;
2158
2140
  var LOCK_RETRY_MIN_MS = 100;
2159
2141
  var LOCK_RETRY_JITTER_MS = 200;
2142
+ var HASH_CHUNK_BYTES = 256 * 1024;
2143
+ var hashBuffers = [];
2144
+ var HASH_BUFFERS_KEPT = 64;
2160
2145
 
2161
2146
  class NodeFileSystem {
2162
2147
  path = {
@@ -2175,7 +2160,7 @@ class NodeFileSystem {
2175
2160
  };
2176
2161
  utils = {
2177
2162
  open: async (url) => {
2178
- const { default: open } = await import("./index-sby22td6.js");
2163
+ const { default: open } = await import("./index-nzr4mx5p.js");
2179
2164
  await open(url);
2180
2165
  }
2181
2166
  };
@@ -2214,6 +2199,15 @@ class NodeFileSystem {
2214
2199
  throw error;
2215
2200
  }
2216
2201
  }
2202
+ async readdirEntries(dirPath) {
2203
+ try {
2204
+ return await fs.readdir(dirPath, { withFileTypes: true });
2205
+ } catch (error) {
2206
+ if (this.isEnoent(error))
2207
+ return [];
2208
+ throw error;
2209
+ }
2210
+ }
2217
2211
  async stat(filePath) {
2218
2212
  try {
2219
2213
  const stats = await fs.stat(filePath);
@@ -2221,7 +2215,8 @@ class NodeFileSystem {
2221
2215
  isFile: () => stats.isFile(),
2222
2216
  isDirectory: () => stats.isDirectory(),
2223
2217
  size: stats.size,
2224
- mtimeMs: stats.mtimeMs
2218
+ mtimeMs: stats.mtimeMs,
2219
+ ctimeMs: stats.ctimeMs
2225
2220
  };
2226
2221
  } catch (error) {
2227
2222
  if (this.isEnoent(error))
@@ -2335,6 +2330,42 @@ class NodeFileSystem {
2335
2330
  throw error;
2336
2331
  }
2337
2332
  }
2333
+ async hashFile(filePath) {
2334
+ let handle;
2335
+ try {
2336
+ handle = await fs.open(filePath, "r");
2337
+ } catch (error) {
2338
+ if (this.isEnoent(error))
2339
+ return null;
2340
+ throw error;
2341
+ }
2342
+ const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
2343
+ try {
2344
+ const opened = await handle.stat();
2345
+ const stats = {
2346
+ isFile: () => opened.isFile(),
2347
+ isDirectory: () => opened.isDirectory(),
2348
+ size: opened.size,
2349
+ mtimeMs: opened.mtimeMs,
2350
+ ctimeMs: opened.ctimeMs
2351
+ };
2352
+ const hash = createHash("sha256");
2353
+ let size = 0;
2354
+ for (;; ) {
2355
+ const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
2356
+ if (bytesRead === 0)
2357
+ break;
2358
+ hash.update(buffer.subarray(0, bytesRead));
2359
+ size += bytesRead;
2360
+ }
2361
+ return { sha256: hash.digest("hex"), size, stats };
2362
+ } finally {
2363
+ if (hashBuffers.length < HASH_BUFFERS_KEPT) {
2364
+ hashBuffers.push(buffer);
2365
+ }
2366
+ await handle.close();
2367
+ }
2368
+ }
2338
2369
  async realpath(filePath) {
2339
2370
  try {
2340
2371
  return await fs.realpath(filePath);
@@ -2385,6 +2416,208 @@ class NodeFileSystem {
2385
2416
  var fsInstance = new NodeFileSystem;
2386
2417
  var getFileSystem = () => fsInstance;
2387
2418
 
2419
+ // ../common/src/telemetry/telemetry-dimensions.ts
2420
+ var BaseDimensions = {
2421
+ ApplicationName: "ApplicationName",
2422
+ ProductVersion: "ProductVersion",
2423
+ InstallationId: "InstallationId",
2424
+ CloudUserId: "CloudUserId",
2425
+ CloudTenantId: "CloudTenantId",
2426
+ CloudOrganizationId: "CloudOrganizationId",
2427
+ IsInternalUser: "IsInternalUser",
2428
+ Environment: "Environment",
2429
+ BaseUrl: "BaseUrl",
2430
+ Region: "Region",
2431
+ Agent: "Agent",
2432
+ AgentVersion: "AgentVersion",
2433
+ AgentModel: "AgentModel",
2434
+ ToolName: "ToolName",
2435
+ ToolVersion: "ToolVersion",
2436
+ ExecutionContext: "ExecutionContext",
2437
+ CiProvider: "CiProvider",
2438
+ SessionIdSource: "SessionIdSource",
2439
+ SessionId: "SessionId"
2440
+ };
2441
+ var CommandDimensions = {
2442
+ IsCommand: "IsCommand",
2443
+ IsReexec: "IsReexec",
2444
+ CommandName: "CommandName",
2445
+ ExitCode: "ExitCode",
2446
+ TerminalOutcome: "TerminalOutcome",
2447
+ ErrorClass: "ErrorClass",
2448
+ TerminalSignal: "TerminalSignal",
2449
+ ErrorMessage: "ErrorMessage",
2450
+ SkillName: "SkillName",
2451
+ ProductArea: "ProductArea",
2452
+ Mode: "Mode"
2453
+ };
2454
+ var ProjectDimensions = {
2455
+ ProjectKey: "ProjectKey",
2456
+ ProjectType: "ProjectType",
2457
+ ProjectIdentityStatus: "ProjectIdentityStatus",
2458
+ SolutionKey: "SolutionKey",
2459
+ SolutionProjectKey: "SolutionProjectKey",
2460
+ SolutionIdentityStatus: "SolutionIdentityStatus",
2461
+ PreviousSolutionKey: "PreviousSolutionKey"
2462
+ };
2463
+ var GUID_KEY_DIMENSIONS = new Set([
2464
+ ProjectDimensions.ProjectKey,
2465
+ ProjectDimensions.SolutionKey,
2466
+ ProjectDimensions.SolutionProjectKey,
2467
+ ProjectDimensions.PreviousSolutionKey
2468
+ ]);
2469
+ var ShipDimensions = {
2470
+ ShipKind: "ShipKind",
2471
+ Target: "Target",
2472
+ ProjectType: "ProjectType",
2473
+ ProjectTypes: "ProjectTypes",
2474
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
2475
+ PackageName: "PackageName",
2476
+ PackageVersion: "PackageVersion",
2477
+ PackageVersionKey: "PackageVersionKey",
2478
+ DeploymentKey: "DeploymentKey",
2479
+ SolutionId: "SolutionId",
2480
+ FolderKey: "FolderKey",
2481
+ FeedId: "FeedId"
2482
+ };
2483
+ var ErrorDimensions = {
2484
+ Result: "Result",
2485
+ ErrorCode: "ErrorCode",
2486
+ Retry: "Retry",
2487
+ ErrorMessage: "ErrorMessage",
2488
+ HttpStatus: "HttpStatus",
2489
+ UpstreamErrorCode: "UpstreamErrorCode"
2490
+ };
2491
+ var AuthDimensions = {
2492
+ AuthenticationMethod: "AuthenticationMethod",
2493
+ Success: "Success",
2494
+ Reason: "Reason"
2495
+ };
2496
+ var SkillsDimensions = {
2497
+ SchemaVersion: "SchemaVersion",
2498
+ AgentType: "AgentType",
2499
+ SkillsVersion: "SkillsVersion",
2500
+ UipSubcommand: "UipSubcommand",
2501
+ FileExtension: "FileExtension",
2502
+ SubagentModel: "SubagentModel",
2503
+ SubagentType: "SubagentType",
2504
+ PermissionMode: "PermissionMode",
2505
+ EffortLevel: "EffortLevel",
2506
+ SessionSource: "SessionSource",
2507
+ Outcome: "Outcome",
2508
+ DurationMs: "DurationMs",
2509
+ Source: "Source"
2510
+ };
2511
+ var PackagerDimensions = {
2512
+ ProjectId: "ProjectId",
2513
+ ProjectType: "ProjectType",
2514
+ SolutionId: "SolutionId"
2515
+ };
2516
+ var ScopeDimensions = {
2517
+ FolderId: "FolderId"
2518
+ };
2519
+ var ID_DIMENSIONS = new Set([
2520
+ BaseDimensions.CloudUserId,
2521
+ BaseDimensions.CloudTenantId,
2522
+ BaseDimensions.CloudOrganizationId,
2523
+ BaseDimensions.InstallationId,
2524
+ ShipDimensions.ArtifactCorrelationKey,
2525
+ ShipDimensions.PackageVersionKey,
2526
+ ShipDimensions.DeploymentKey,
2527
+ ShipDimensions.SolutionId,
2528
+ ShipDimensions.FolderKey,
2529
+ ShipDimensions.FeedId,
2530
+ PackagerDimensions.ProjectId
2531
+ ]);
2532
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
2533
+ var RESERVED_DIMENSION_NAMES = new Set([
2534
+ ...Object.values(BaseDimensions),
2535
+ ...Object.values(CommandDimensions),
2536
+ ...Object.values(ShipDimensions),
2537
+ ...Object.values(ProjectDimensions),
2538
+ ...Object.values(ErrorDimensions),
2539
+ ...Object.values(AuthDimensions),
2540
+ ...Object.values(SkillsDimensions),
2541
+ ...Object.values(PackagerDimensions),
2542
+ ...Object.values(ScopeDimensions)
2543
+ ]);
2544
+ var CURATED_DIMENSIONS = new Set([
2545
+ BaseDimensions.ApplicationName,
2546
+ BaseDimensions.ProductVersion,
2547
+ BaseDimensions.InstallationId,
2548
+ BaseDimensions.CloudUserId,
2549
+ BaseDimensions.CloudTenantId,
2550
+ BaseDimensions.CloudOrganizationId,
2551
+ BaseDimensions.IsInternalUser,
2552
+ BaseDimensions.Environment,
2553
+ BaseDimensions.BaseUrl,
2554
+ BaseDimensions.Region,
2555
+ BaseDimensions.Agent,
2556
+ BaseDimensions.AgentVersion,
2557
+ BaseDimensions.ToolVersion,
2558
+ BaseDimensions.ExecutionContext,
2559
+ BaseDimensions.CiProvider,
2560
+ BaseDimensions.SessionIdSource,
2561
+ BaseDimensions.SessionId,
2562
+ ...Object.values(CommandDimensions),
2563
+ ...Object.values(ShipDimensions),
2564
+ ...Object.values(ProjectDimensions)
2565
+ ]);
2566
+ function lowercaseIdDimensionValues(properties) {
2567
+ let changed = false;
2568
+ const result = {
2569
+ ...properties
2570
+ };
2571
+ for (const key of Object.keys(result)) {
2572
+ const value = result[key];
2573
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
2574
+ continue;
2575
+ }
2576
+ const lowered = value.toLowerCase();
2577
+ if (lowered !== value) {
2578
+ result[key] = lowered;
2579
+ changed = true;
2580
+ }
2581
+ }
2582
+ return changed ? result : properties;
2583
+ }
2584
+
2585
+ // ../common/src/telemetry/project-identity.ts
2586
+ function projectKey(id) {
2587
+ if (typeof id !== "string")
2588
+ return;
2589
+ const key = id.trim().toLowerCase().replaceAll("-", "");
2590
+ return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
2591
+ }
2592
+ function projectIdentityProperties(identity) {
2593
+ const key = identity.id ? projectKey(identity.id) : undefined;
2594
+ return {
2595
+ [ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
2596
+ [ProjectDimensions.ProjectType]: identity.projectType,
2597
+ ...identity.status === "resolved" && key ? {
2598
+ [ProjectDimensions.ProjectKey]: key
2599
+ } : {}
2600
+ };
2601
+ }
2602
+ var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
2603
+ async function withinProjectIdentityBudget(work, onTimeout) {
2604
+ work.catch(() => {
2605
+ return;
2606
+ });
2607
+ let timer;
2608
+ const expired = new Promise((resolve) => {
2609
+ timer = setTimeout(() => {
2610
+ onTimeout?.();
2611
+ resolve(undefined);
2612
+ }, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
2613
+ });
2614
+ try {
2615
+ return await Promise.race([work, expired]);
2616
+ } finally {
2617
+ clearTimeout(timer);
2618
+ }
2619
+ }
2620
+
2388
2621
  // ../common/src/telemetry/pseudonymize.ts
2389
2622
  var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2390
2623
  var PSEUDONYM_HEX_LENGTH = 32;
@@ -2753,8 +2986,8 @@ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
2753
2986
  return `${redactUrl(core)}${trailing}`;
2754
2987
  });
2755
2988
  out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
2756
- out = out.replace(UNC_PATH_PATTERN, (_match, before, path2) => {
2757
- const [core, trailing] = peelTrailingPunctuation(path2);
2989
+ out = out.replace(UNC_PATH_PATTERN, (_match, before, path) => {
2990
+ const [core, trailing] = peelTrailingPunctuation(path);
2758
2991
  return `${before}unc#${pseudonymize(core)}${trailing}`;
2759
2992
  });
2760
2993
  out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
@@ -2848,6 +3081,8 @@ function redactProperty(name, value) {
2848
3081
  if (isSensitiveName(name)) {
2849
3082
  return REDACTED;
2850
3083
  }
3084
+ if (GUID_KEY_DIMENSIONS.has(name))
3085
+ return projectKey(value);
2851
3086
  if (typeof value === "boolean" || typeof value === "number") {
2852
3087
  return value;
2853
3088
  }
@@ -2922,6 +3157,63 @@ function settlePromiseLike(thenable) {
2922
3157
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2923
3158
  }
2924
3159
 
3160
+ // ../common/src/error-codes.ts
3161
+ var CLI_ERROR_CODES = [
3162
+ "invalid_argument",
3163
+ "authentication_required",
3164
+ "permission_denied",
3165
+ "local_permission_denied",
3166
+ "not_found",
3167
+ "rate_limited",
3168
+ "network_error",
3169
+ "timeout",
3170
+ "server_error",
3171
+ "method_not_allowed",
3172
+ "not_supported",
3173
+ "configuration_error",
3174
+ "execution_failed",
3175
+ "unknown_error"
3176
+ ];
3177
+ var RETRY_HINTS = [
3178
+ "RetryWillNotFix",
3179
+ "RetryLater",
3180
+ "RetryAfter1Second",
3181
+ "RetryAfter10Seconds",
3182
+ "RetryAfter30Seconds",
3183
+ "RetryAfter60Seconds"
3184
+ ];
3185
+ var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
3186
+ var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
3187
+ function isCliErrorCode(value) {
3188
+ return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
3189
+ }
3190
+ function isRetryHint(value) {
3191
+ return typeof value === "string" && RETRY_HINT_VALUES.has(value);
3192
+ }
3193
+ function carriedErrorCode(error) {
3194
+ if (!error || typeof error !== "object")
3195
+ return;
3196
+ const code = error.errorCode;
3197
+ return isCliErrorCode(code) ? code : undefined;
3198
+ }
3199
+ function carriedRetry(error) {
3200
+ if (!error || typeof error !== "object")
3201
+ return;
3202
+ const retry = error.retry;
3203
+ return isRetryHint(retry) ? retry : undefined;
3204
+ }
3205
+ function defaultRetryForErrorCode(errorCode) {
3206
+ switch (errorCode) {
3207
+ case "network_error":
3208
+ case "rate_limited":
3209
+ case "server_error":
3210
+ case "timeout":
3211
+ return "RetryLater";
3212
+ default:
3213
+ return "RetryWillNotFix";
3214
+ }
3215
+ }
3216
+
2925
3217
  // ../common/src/error-graph.ts
2926
3218
  function* walkErrorGraph(error) {
2927
3219
  const queue = [error];
@@ -2966,18 +3258,54 @@ function findHttpStatusInGraph(error) {
2966
3258
  return;
2967
3259
  }
2968
3260
 
2969
- // ../common/src/local-permission-codes.ts
2970
- var LOCAL_PERMISSION_ERROR_CODES = new Set([
2971
- "EACCES",
2972
- "EPERM",
2973
- "EROFS"
2974
- ]);
2975
-
2976
- // ../common/src/error-handler.ts
2977
- 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.";
2978
- 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.";
3261
+ // ../common/src/http-status.ts
3262
+ function classifyHttpStatus(status) {
3263
+ if (status === undefined)
3264
+ return;
3265
+ if (status === 400 || status === 409 || status === 413 || status === 422) {
3266
+ return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
3267
+ }
3268
+ if (status === 401) {
3269
+ return {
3270
+ errorCode: "authentication_required",
3271
+ retry: "RetryWillNotFix"
3272
+ };
3273
+ }
3274
+ if (status === 403) {
3275
+ return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
3276
+ }
3277
+ if (status === 404) {
3278
+ return { errorCode: "not_found", retry: "RetryWillNotFix" };
3279
+ }
3280
+ if (status === 405) {
3281
+ return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
3282
+ }
3283
+ if (status === 408) {
3284
+ return { errorCode: "timeout", retry: "RetryLater" };
3285
+ }
3286
+ if (status === 429) {
3287
+ return { errorCode: "rate_limited", retry: "RetryLater" };
3288
+ }
3289
+ if (status >= 500 && status < 600) {
3290
+ return { errorCode: "server_error", retry: "RetryLater" };
3291
+ }
3292
+ return;
3293
+ }
3294
+
3295
+ // ../common/src/local-permission-codes.ts
3296
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
3297
+ "EACCES",
3298
+ "EPERM",
3299
+ "EROFS"
3300
+ ]);
3301
+
3302
+ // ../common/src/error-handler.ts
3303
+ 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.";
3304
+ 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.";
2979
3305
  var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
2980
3306
  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.";
3307
+ 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.";
3308
+ 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.";
2981
3309
  var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
2982
3310
  var NETWORK_ERROR_CODES = new Set([
2983
3311
  "ECONNREFUSED",
@@ -3003,8 +3331,8 @@ var TLS_ERROR_CODES = new Set([
3003
3331
  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.";
3004
3332
  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.";
3005
3333
  var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
3006
- function localPermissionInstructions(code, path2) {
3007
- const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
3334
+ function localPermissionInstructions(code, path) {
3335
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
3008
3336
  if (code === "EROFS") {
3009
3337
  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.";
3010
3338
  }
@@ -3041,12 +3369,12 @@ function describePermissionError(error) {
3041
3369
  const code = matchLocalPermissionCode(cur.code, message);
3042
3370
  if (!code)
3043
3371
  continue;
3044
- const path2 = localPermissionPath(cur.path, message);
3372
+ const path = localPermissionPath(cur.path, message);
3045
3373
  return {
3046
3374
  code,
3047
3375
  message: message ?? code,
3048
- ...path2 !== undefined ? { path: path2 } : {},
3049
- instructions: localPermissionInstructions(code, path2)
3376
+ ...path !== undefined ? { path } : {},
3377
+ instructions: localPermissionInstructions(code, path)
3050
3378
  };
3051
3379
  }
3052
3380
  return;
@@ -3058,11 +3386,25 @@ function matchLocalPermissionCode(code, message) {
3058
3386
  const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
3059
3387
  return match ? match[1] : undefined;
3060
3388
  }
3061
- function localPermissionPath(path2, message) {
3062
- if (typeof path2 === "string")
3063
- return path2;
3389
+ function localPermissionPath(path, message) {
3390
+ if (typeof path === "string")
3391
+ return path;
3064
3392
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
3065
3393
  }
3394
+ function readHeader(response, name) {
3395
+ const headers = response?.headers;
3396
+ if (!headers || typeof headers !== "object")
3397
+ return;
3398
+ if (typeof headers.get === "function") {
3399
+ const value = headers.get(name);
3400
+ if (value)
3401
+ return value;
3402
+ }
3403
+ const plain = headers;
3404
+ const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
3405
+ const value = key === undefined ? undefined : plain[key];
3406
+ return typeof value === "string" && value !== "" ? value : undefined;
3407
+ }
3066
3408
  function isHtmlDocument(body) {
3067
3409
  return /^\s*(<!doctype html|<html\b)/i.test(body);
3068
3410
  }
@@ -3079,36 +3421,9 @@ function retryHintForRetryAfter(seconds) {
3079
3421
  return "RetryAfter60Seconds";
3080
3422
  }
3081
3423
  function classifyError(status, error) {
3082
- if (status === 400 || status === 409 || status === 422) {
3083
- return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
3084
- }
3085
- if (status === 401) {
3086
- return {
3087
- errorCode: "authentication_required",
3088
- retry: "RetryWillNotFix"
3089
- };
3090
- }
3091
- if (status === 403) {
3092
- return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
3093
- }
3094
- if (status === 404) {
3095
- return { errorCode: "not_found", retry: "RetryWillNotFix" };
3096
- }
3097
- if (status === 405) {
3098
- return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
3099
- }
3100
- if (status === 413) {
3101
- return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
3102
- }
3103
- if (status === 408) {
3104
- return { errorCode: "timeout", retry: "RetryLater" };
3105
- }
3106
- if (status === 429) {
3107
- return { errorCode: "rate_limited", retry: "RetryLater" };
3108
- }
3109
- if (status !== undefined && status >= 500 && status < 600) {
3110
- return { errorCode: "server_error", retry: "RetryLater" };
3111
- }
3424
+ const byStatus = classifyHttpStatus(status);
3425
+ if (byStatus)
3426
+ return byStatus;
3112
3427
  if (status === undefined && describePermissionError(error)) {
3113
3428
  return {
3114
3429
  errorCode: "local_permission_denied",
@@ -3124,6 +3439,17 @@ function classifyError(status, error) {
3124
3439
  }
3125
3440
  return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
3126
3441
  }
3442
+ function withCarriedClass(inferred, error) {
3443
+ const errorCode = carriedErrorCode(error);
3444
+ const retry = carriedRetry(error);
3445
+ if (errorCode === undefined || errorCode === inferred.errorCode) {
3446
+ return {
3447
+ errorCode: inferred.errorCode,
3448
+ retry: retry ?? inferred.retry
3449
+ };
3450
+ }
3451
+ return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
3452
+ }
3127
3453
  function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
3128
3454
  if (extractedMessage) {
3129
3455
  return `HTTP ${status}: ${extractedMessage}`;
@@ -3179,9 +3505,14 @@ async function extractErrorDetails(error, options) {
3179
3505
  const classificationStatus = status ?? findHttpStatusInGraph(error);
3180
3506
  const classification = classifyError(classificationStatus, error);
3181
3507
  let retry = classification.retry;
3508
+ const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
3509
+ const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
3510
+ const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
3182
3511
  if (status === 401) {
3183
3512
  message = DEFAULT_401;
3184
3513
  result = "AuthenticationError";
3514
+ } else if (cloudflareBlock) {
3515
+ message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
3185
3516
  } else if (status === 403) {
3186
3517
  message = options?.forbiddenMessage ?? DEFAULT_403;
3187
3518
  result = "AuthenticationError";
@@ -3229,7 +3560,9 @@ async function extractErrorDetails(error, options) {
3229
3560
  }
3230
3561
  }
3231
3562
  let details = rawMessage;
3232
- if (rawBody) {
3563
+ if (htmlForbidden) {
3564
+ details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
3565
+ } else if (rawBody) {
3233
3566
  if (parsedBody) {
3234
3567
  const extra = {};
3235
3568
  if (parsedBody.errorCode)
@@ -3263,6 +3596,8 @@ async function extractErrorDetails(error, options) {
3263
3596
  }
3264
3597
  if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
3265
3598
  context.requestId = parsedBody.requestId;
3599
+ } else if (cloudflareBlock && rayId) {
3600
+ context.requestId = rayId;
3266
3601
  }
3267
3602
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
3268
3603
  context.traceId = parsedBody.traceId;
@@ -3271,16 +3606,7 @@ async function extractErrorDetails(error, options) {
3271
3606
  context.path = permission.path;
3272
3607
  }
3273
3608
  if (status === 429) {
3274
- const resp = response;
3275
- const headersObj = resp?.headers;
3276
- let retryAfterValue;
3277
- if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
3278
- retryAfterValue = headersObj.get("retry-after") ?? undefined;
3279
- }
3280
- if (!retryAfterValue && headersObj && typeof headersObj === "object") {
3281
- const headers = headersObj;
3282
- retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
3283
- }
3609
+ const retryAfterValue = readHeader(response, "retry-after");
3284
3610
  if (retryAfterValue) {
3285
3611
  const seconds = Number(retryAfterValue);
3286
3612
  if (!Number.isNaN(seconds)) {
@@ -3314,9 +3640,8 @@ async function extractErrorDetails(error, options) {
3314
3640
  }
3315
3641
  return {
3316
3642
  result,
3317
- errorCode: classification.errorCode,
3643
+ ...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
3318
3644
  message,
3319
- retry,
3320
3645
  details,
3321
3646
  ...hasContext ? { context } : {},
3322
3647
  ...parsedErrors ? { parsedErrors } : {}
@@ -3326,10 +3651,91 @@ async function extractErrorMessage(error, options) {
3326
3651
  const { message } = await extractErrorDetails(error, options);
3327
3652
  return message;
3328
3653
  }
3329
- // ../common/src/exit-code.ts
3330
- function setExitCode(code) {
3331
- process.exitCode = code;
3654
+ // ../common/src/result-types.ts
3655
+ var RESULTS = {
3656
+ Success: "Success",
3657
+ Failure: "Failure",
3658
+ ConfigError: "ConfigError",
3659
+ AuthenticationError: "AuthenticationError",
3660
+ ValidationError: "ValidationError",
3661
+ TimeoutError: "TimeoutError"
3662
+ };
3663
+ // ../../node_modules/commander/index.js
3664
+ var exports_commander = {};
3665
+ __exportCjs(exports_commander, {
3666
+ program: () => $program,
3667
+ createCommand: () => $createCommand,
3668
+ createOption: () => $createOption,
3669
+ createArgument: () => $createArgument,
3670
+ Command: () => $Command,
3671
+ Option: () => $Option,
3672
+ Argument: () => $Argument,
3673
+ Help: () => $Help,
3674
+ CommanderError: () => $CommanderError,
3675
+ InvalidArgumentError: () => $InvalidArgumentError,
3676
+ InvalidOptionArgumentError: () => $InvalidOptionArgumentError
3677
+ }, {
3678
+ program: (value) => $program = value,
3679
+ createCommand: (value) => $createCommand = value,
3680
+ createOption: (value) => $createOption = value,
3681
+ createArgument: (value) => $createArgument = value,
3682
+ Command: (value) => $Command = value,
3683
+ Option: (value) => $Option = value,
3684
+ Argument: (value) => $Argument = value,
3685
+ Help: (value) => $Help = value,
3686
+ CommanderError: (value) => $CommanderError = value,
3687
+ InvalidArgumentError: (value) => $InvalidArgumentError = value,
3688
+ InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
3689
+ });
3690
+ var { Argument } = require_argument();
3691
+ var { Command: Command2 } = require_command();
3692
+ var { CommanderError, InvalidArgumentError } = require_error();
3693
+ var { Help } = require_help();
3694
+ var { Option } = require_option();
3695
+ var $program = new Command2;
3696
+ var $createCommand = (name) => new Command2(name);
3697
+ var $createOption = (flags, description) => new Option(flags, description);
3698
+ var $createArgument = (name, description) => new Argument(name, description);
3699
+ var $Command = Command2;
3700
+ var $Option = Option;
3701
+ var $Argument = Argument;
3702
+ var $Help = Help;
3703
+ var $CommanderError = CommanderError;
3704
+ var $InvalidArgumentError = InvalidArgumentError;
3705
+ var $InvalidOptionArgumentError = InvalidArgumentError;
3706
+
3707
+ // ../../node_modules/commander/esm.mjs
3708
+ var {
3709
+ program,
3710
+ createCommand,
3711
+ createArgument,
3712
+ createOption,
3713
+ CommanderError: CommanderError2,
3714
+ InvalidArgumentError: InvalidArgumentError2,
3715
+ InvalidOptionArgumentError,
3716
+ Command,
3717
+ Argument: Argument2,
3718
+ Option: Option2,
3719
+ Help: Help2
3720
+ } = exports_commander;
3721
+
3722
+ // ../common/src/command-examples.ts
3723
+ var examplesByCommand = new WeakMap;
3724
+ Command.prototype.examples = function(examples) {
3725
+ examplesByCommand.set(this, examples);
3726
+ return this;
3727
+ };
3728
+ // ../common/src/preview.ts
3729
+ var previewSlot = singleton("PreviewBuild");
3730
+ function isPreviewBuild() {
3731
+ return previewSlot.get(false) ?? false;
3332
3732
  }
3733
+ Command.prototype.previewCommand = function(nameAndArgs, opts) {
3734
+ if (isPreviewBuild()) {
3735
+ return this.command(nameAndArgs, opts);
3736
+ }
3737
+ return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
3738
+ };
3333
3739
 
3334
3740
  // ../common/src/output-context.ts
3335
3741
  function createStorage() {
@@ -3364,8 +3770,8 @@ function getOutputSink() {
3364
3770
 
3365
3771
  // ../common/src/logger.ts
3366
3772
  var logFilePathSlot = singleton("logFilePath");
3367
- function setGlobalLogFilePath(path2) {
3368
- logFilePathSlot.set(path2);
3773
+ function setGlobalLogFilePath(path) {
3774
+ logFilePathSlot.set(path);
3369
3775
  }
3370
3776
  function getGlobalLogFilePath() {
3371
3777
  return logFilePathSlot.get("");
@@ -3433,14 +3839,14 @@ class SimpleLogger {
3433
3839
  return this.fileLoggingEnabled || !!getGlobalLogFilePath();
3434
3840
  }
3435
3841
  writeToFile(formatted) {
3436
- const path2 = this.logFilePath || getGlobalLogFilePath();
3437
- if (!path2)
3842
+ const path = this.logFilePath || getGlobalLogFilePath();
3843
+ if (!path)
3438
3844
  return;
3439
3845
  const timestamp = new Date().toISOString();
3440
3846
  this.pendingWrites = Promise.all([
3441
3847
  this.pendingWrites,
3442
3848
  this.pendingInit
3443
- ]).then(() => getFileSystem().appendFile(path2, `${timestamp} ${formatted}`).catch(() => {}));
3849
+ ]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
3444
3850
  }
3445
3851
  write(formatted) {
3446
3852
  if (this.isFileLoggingActive()) {
@@ -3490,17 +3896,17 @@ class SimpleLogger {
3490
3896
  setGlobalLogFilePath("");
3491
3897
  }
3492
3898
  }
3493
- setLogFile(path2) {
3494
- this.logFilePath = path2;
3495
- setGlobalLogFilePath(path2);
3496
- if (!path2)
3899
+ setLogFile(path) {
3900
+ this.logFilePath = path;
3901
+ setGlobalLogFilePath(path);
3902
+ if (!path)
3497
3903
  return;
3498
3904
  this.fileLoggingEnabled = true;
3499
- const fs2 = getFileSystem();
3905
+ const fs = getFileSystem();
3500
3906
  this.pendingInit = (async () => {
3501
3907
  const [error] = await catchError((async () => {
3502
- await fs2.mkdir(fs2.path.dirname(path2));
3503
- await fs2.writeFile(path2, "");
3908
+ await fs.mkdir(fs.path.dirname(path));
3909
+ await fs.writeFile(path, "");
3504
3910
  })());
3505
3911
  if (error)
3506
3912
  this.fileLoggingEnabled = false;
@@ -3548,18 +3954,111 @@ function getLogFilePath() {
3548
3954
  return logger.getLogFilePath();
3549
3955
  }
3550
3956
 
3957
+ // ../common/src/timings.ts
3958
+ var TIMINGS_ENV_VAR = "UIP_TIMINGS";
3959
+ function createStorage2() {
3960
+ const [error, mod] = catchError(() => __require("node:async_hooks"));
3961
+ if (error || typeof mod?.AsyncLocalStorage !== "function") {
3962
+ return {
3963
+ getStore: () => {
3964
+ return;
3965
+ },
3966
+ run: (_store, fn) => fn()
3967
+ };
3968
+ }
3969
+ return new mod.AsyncLocalStorage;
3970
+ }
3971
+ var storageSlot = singleton("TimingStorage");
3972
+ var stateSlot = singleton("Timings");
3973
+ var rootStartedSlot = singleton("TimingsRootStarted");
3974
+ var longLivedHostSlot = singleton("TimingsLongLivedHost");
3975
+ var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
3976
+ function newState(baseline) {
3977
+ return { baseline, httpMs: 0, httpCalls: 0 };
3978
+ }
3979
+ function getState() {
3980
+ const scoped = storage.getStore();
3981
+ if (scoped) {
3982
+ return scoped;
3983
+ }
3984
+ const pinned = livePinnedState();
3985
+ if (pinned !== undefined) {
3986
+ return pinned;
3987
+ }
3988
+ return newState(processStartIsInvocationStart() ? 0 : performance.now());
3989
+ }
3990
+ function livePinnedState() {
3991
+ const pinned = stateSlot.get();
3992
+ return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
3993
+ }
3994
+ function processStartIsInvocationStart() {
3995
+ return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
3996
+ }
3997
+ function timingsEnabled() {
3998
+ if (typeof process === "undefined") {
3999
+ return false;
4000
+ }
4001
+ const value = process.env?.[TIMINGS_ENV_VAR];
4002
+ if (value === undefined) {
4003
+ return false;
4004
+ }
4005
+ const normalized = value.trim().toLowerCase();
4006
+ return normalized === "1" || normalized === "true";
4007
+ }
4008
+ function recordExitCode(exitCode) {
4009
+ if (!timingsEnabled()) {
4010
+ return;
4011
+ }
4012
+ getState().exitCode = exitCode;
4013
+ }
4014
+ function invocationStartedAt() {
4015
+ return new Date(performance.timeOrigin + getState().baseline);
4016
+ }
4017
+ function invocationElapsedMs() {
4018
+ return performance.now() - getState().baseline;
4019
+ }
4020
+ function markCommandStart() {
4021
+ if (!timingsEnabled()) {
4022
+ return;
4023
+ }
4024
+ getState().commandStart = performance.now();
4025
+ }
4026
+ function recordCommandDuration(durationMs) {
4027
+ if (!timingsEnabled()) {
4028
+ return;
4029
+ }
4030
+ getState().commandMs = durationMs;
4031
+ }
4032
+
4033
+ // ../common/src/exit-code.ts
4034
+ function setExitCode(code) {
4035
+ process.exitCode = code;
4036
+ recordExitCode(code);
4037
+ }
4038
+ var GENERIC_FAILURE_EXIT_CODE = 1;
4039
+ function recordCommandExit(code) {
4040
+ if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
4041
+ return;
4042
+ }
4043
+ setExitCode(code);
4044
+ }
4045
+ function getExitCode() {
4046
+ const code = process.exitCode;
4047
+ return typeof code === "number" ? code : 0;
4048
+ }
4049
+
3551
4050
  // ../common/src/output-codecs.ts
3552
4051
  var yamlSlot = singleton("YamlCodec");
3553
4052
  var jmespathSlot = singleton("JmespathCodec");
3554
4053
  async function loadOutputCodecsAsync(needed) {
3555
4054
  const loads = [];
3556
4055
  if (needed.yaml && yamlSlot.get() === undefined) {
3557
- loads.push(import("./js-yaml-88tdqrtd.js").then((mod) => {
4056
+ loads.push(import("./js-yaml-a2bk27p6.js").then((mod) => {
3558
4057
  yamlSlot.set(mod);
3559
4058
  }));
3560
4059
  }
3561
4060
  if (needed.filter && jmespathSlot.get() === undefined) {
3562
- loads.push(import("./jmespath-231m3hyn.js").then((m)=>__toESM(m.default,1)).then((mod) => {
4061
+ loads.push(import("./jmespath-ab6tdc42.js").then((m)=>__toESM(m.default,1)).then((mod) => {
3563
4062
  jmespathSlot.set(mod);
3564
4063
  }));
3565
4064
  }
@@ -3584,155 +4083,6 @@ function getOutputFilter() {
3584
4083
  return filterSlot.get();
3585
4084
  }
3586
4085
 
3587
- // ../common/src/telemetry/telemetry-dimensions.ts
3588
- var BaseDimensions = {
3589
- ApplicationName: "ApplicationName",
3590
- ProductVersion: "ProductVersion",
3591
- InstallationId: "InstallationId",
3592
- CloudUserId: "CloudUserId",
3593
- CloudTenantId: "CloudTenantId",
3594
- CloudOrganizationId: "CloudOrganizationId",
3595
- IsInternalUser: "IsInternalUser",
3596
- Environment: "Environment",
3597
- BaseUrl: "BaseUrl",
3598
- Region: "Region",
3599
- Agent: "Agent",
3600
- AgentVersion: "AgentVersion",
3601
- AgentModel: "AgentModel",
3602
- ToolName: "ToolName",
3603
- ToolVersion: "ToolVersion",
3604
- ExecutionContext: "ExecutionContext",
3605
- CiProvider: "CiProvider",
3606
- SessionIdSource: "SessionIdSource",
3607
- SessionId: "SessionId"
3608
- };
3609
- var CommandDimensions = {
3610
- IsCommand: "IsCommand",
3611
- IsReexec: "IsReexec",
3612
- CommandName: "CommandName",
3613
- ExitCode: "ExitCode",
3614
- TerminalOutcome: "TerminalOutcome",
3615
- ErrorClass: "ErrorClass",
3616
- TerminalSignal: "TerminalSignal",
3617
- ErrorMessage: "ErrorMessage",
3618
- SkillName: "SkillName",
3619
- ProductArea: "ProductArea",
3620
- Mode: "Mode"
3621
- };
3622
- var ShipDimensions = {
3623
- ShipKind: "ShipKind",
3624
- Target: "Target",
3625
- ProjectType: "ProjectType",
3626
- ProjectTypes: "ProjectTypes",
3627
- ArtifactCorrelationKey: "ArtifactCorrelationKey",
3628
- PackageName: "PackageName",
3629
- PackageVersion: "PackageVersion",
3630
- PackageVersionKey: "PackageVersionKey",
3631
- DeploymentKey: "DeploymentKey",
3632
- SolutionId: "SolutionId",
3633
- FolderKey: "FolderKey",
3634
- FeedId: "FeedId"
3635
- };
3636
- var ErrorDimensions = {
3637
- Result: "Result",
3638
- ErrorCode: "ErrorCode",
3639
- Retry: "Retry",
3640
- ErrorMessage: "ErrorMessage",
3641
- HttpStatus: "HttpStatus",
3642
- UpstreamErrorCode: "UpstreamErrorCode"
3643
- };
3644
- var AuthDimensions = {
3645
- AuthenticationMethod: "AuthenticationMethod",
3646
- Success: "Success",
3647
- Reason: "Reason"
3648
- };
3649
- var SkillsDimensions = {
3650
- SchemaVersion: "SchemaVersion",
3651
- AgentType: "AgentType",
3652
- SkillsVersion: "SkillsVersion",
3653
- UipSubcommand: "UipSubcommand",
3654
- FileExtension: "FileExtension",
3655
- SubagentModel: "SubagentModel",
3656
- SubagentType: "SubagentType",
3657
- PermissionMode: "PermissionMode",
3658
- EffortLevel: "EffortLevel",
3659
- SessionSource: "SessionSource",
3660
- Outcome: "Outcome",
3661
- DurationMs: "DurationMs",
3662
- Source: "Source"
3663
- };
3664
- var PackagerDimensions = {
3665
- ProjectId: "ProjectId",
3666
- ProjectType: "ProjectType",
3667
- SolutionId: "SolutionId"
3668
- };
3669
- var ScopeDimensions = {
3670
- FolderId: "FolderId"
3671
- };
3672
- var ID_DIMENSIONS = new Set([
3673
- BaseDimensions.CloudUserId,
3674
- BaseDimensions.CloudTenantId,
3675
- BaseDimensions.CloudOrganizationId,
3676
- BaseDimensions.InstallationId,
3677
- ShipDimensions.ArtifactCorrelationKey,
3678
- ShipDimensions.PackageVersionKey,
3679
- ShipDimensions.DeploymentKey,
3680
- ShipDimensions.SolutionId,
3681
- ShipDimensions.FolderKey,
3682
- ShipDimensions.FeedId,
3683
- PackagerDimensions.ProjectId
3684
- ]);
3685
- var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
3686
- var RESERVED_DIMENSION_NAMES = new Set([
3687
- ...Object.values(BaseDimensions),
3688
- ...Object.values(CommandDimensions),
3689
- ...Object.values(ShipDimensions),
3690
- ...Object.values(ErrorDimensions),
3691
- ...Object.values(AuthDimensions),
3692
- ...Object.values(SkillsDimensions),
3693
- ...Object.values(PackagerDimensions),
3694
- ...Object.values(ScopeDimensions)
3695
- ]);
3696
- var CURATED_DIMENSIONS = new Set([
3697
- BaseDimensions.ApplicationName,
3698
- BaseDimensions.ProductVersion,
3699
- BaseDimensions.InstallationId,
3700
- BaseDimensions.CloudUserId,
3701
- BaseDimensions.CloudTenantId,
3702
- BaseDimensions.CloudOrganizationId,
3703
- BaseDimensions.IsInternalUser,
3704
- BaseDimensions.Environment,
3705
- BaseDimensions.BaseUrl,
3706
- BaseDimensions.Region,
3707
- BaseDimensions.Agent,
3708
- BaseDimensions.AgentVersion,
3709
- BaseDimensions.ToolVersion,
3710
- BaseDimensions.ExecutionContext,
3711
- BaseDimensions.CiProvider,
3712
- BaseDimensions.SessionIdSource,
3713
- BaseDimensions.SessionId,
3714
- ...Object.values(CommandDimensions),
3715
- ...Object.values(ShipDimensions)
3716
- ]);
3717
- function lowercaseIdDimensionValues(properties) {
3718
- let changed = false;
3719
- const result = {
3720
- ...properties
3721
- };
3722
- for (const key of Object.keys(result)) {
3723
- const value = result[key];
3724
- if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
3725
- continue;
3726
- }
3727
- const lowered = value.toLowerCase();
3728
- if (lowered !== value) {
3729
- result[key] = lowered;
3730
- changed = true;
3731
- }
3732
- }
3733
- return changed ? result : properties;
3734
- }
3735
-
3736
4086
  // ../common/src/telemetry/command-terminal.ts
3737
4087
  var recordedFailureSlot = singleton("CommandTelemetryFailure");
3738
4088
  var AUTH_ERROR_CODES = new Set([
@@ -3851,17 +4201,8 @@ function terminalSignalFor(input, outcome) {
3851
4201
  }
3852
4202
  return outcome === "cancelled" ? "SIGINT" : undefined;
3853
4203
  }
3854
- function classifyHttpStatus(status) {
3855
- if (status === 401 || status === 403) {
3856
- return "auth";
3857
- }
3858
- if (status === 400 || status === 409 || status === 422) {
3859
- return "validation";
3860
- }
3861
- if (status === 408) {
3862
- return "timeout";
3863
- }
3864
- return "network_http";
4204
+ function classifyFailingHttpStatus(status) {
4205
+ return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
3865
4206
  }
3866
4207
  function classifyFromResult(result) {
3867
4208
  switch (result) {
@@ -3941,7 +4282,7 @@ function classifyError2(input) {
3941
4282
  }
3942
4283
  const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
3943
4284
  if (status !== undefined) {
3944
- return classifyHttpStatus(status);
4285
+ return classifyFailingHttpStatus(status);
3945
4286
  }
3946
4287
  return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
3947
4288
  }
@@ -3973,6 +4314,7 @@ function buildCommandTerminalTelemetryProperties(input) {
3973
4314
  var CommonTelemetryEvents = {
3974
4315
  Start: "Application.Start",
3975
4316
  Error: "Application.Error",
4317
+ ProjectActivity: "Cli.ProjectActivity",
3976
4318
  ShipSucceeded: "Cli.ShipSucceeded"
3977
4319
  };
3978
4320
 
@@ -4446,124 +4788,49 @@ class TelemetryService {
4446
4788
  getActiveContext() {
4447
4789
  return this.contextStorage.getContext();
4448
4790
  }
4449
- leafCorrelation(explicit) {
4450
- const context = explicit ?? this.getActiveContext();
4451
- return {
4452
- operationId: context?.operationId ?? this.operationId ?? getTelemetryOperationId(),
4453
- ...context !== undefined ? { parentId: context.id } : {}
4454
- };
4455
- }
4456
- spanFor(name, durationMs, success, properties, context) {
4457
- return {
4458
- name: redactSpanName(name),
4459
- durationMs,
4460
- success,
4461
- properties: this.enrichProperties(properties),
4462
- operationId: context.operationId,
4463
- ...context.parentId !== undefined ? { parentId: context.parentId } : {},
4464
- id: context.id,
4465
- ...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
4466
- };
4467
- }
4468
- enrichProperties(properties) {
4469
- const globalProperties = getGlobalTelemetryProperties();
4470
- const enriched = {
4471
- ...getExecutionContextTelemetryProperties(),
4472
- ...globalProperties,
4473
- ...this.defaultProperties,
4474
- ...redactProperties(properties ?? {}),
4475
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
4476
- [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
4477
- };
4478
- return lowercaseIdDimensionValues(enriched);
4479
- }
4480
- generateId() {
4481
- const bytes = new Uint8Array(8);
4482
- let hex = "";
4483
- do {
4484
- crypto.getRandomValues(bytes);
4485
- hex = "";
4486
- for (const byte of bytes) {
4487
- hex += byte.toString(16).padStart(2, "0");
4488
- }
4489
- } while (/^0+$/.test(hex));
4490
- return hex;
4491
- }
4492
- }
4493
- // ../common/src/timings.ts
4494
- var TIMINGS_ENV_VAR = "UIP_TIMINGS";
4495
- function createStorage2() {
4496
- const [error, mod] = catchError(() => __require("node:async_hooks"));
4497
- if (error || typeof mod?.AsyncLocalStorage !== "function") {
4498
- return {
4499
- getStore: () => {
4500
- return;
4501
- },
4502
- run: (_store, fn) => fn()
4503
- };
4504
- }
4505
- return new mod.AsyncLocalStorage;
4506
- }
4507
- var storageSlot = singleton("TimingStorage");
4508
- var stateSlot = singleton("Timings");
4509
- var rootStartedSlot = singleton("TimingsRootStarted");
4510
- var longLivedHostSlot = singleton("TimingsLongLivedHost");
4511
- var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
4512
- function newState(baseline) {
4513
- return { baseline, httpMs: 0, httpCalls: 0 };
4514
- }
4515
- function getState() {
4516
- const scoped = storage.getStore();
4517
- if (scoped) {
4518
- return scoped;
4519
- }
4520
- const pinned = livePinnedState();
4521
- if (pinned !== undefined) {
4522
- return pinned;
4523
- }
4524
- return newState(processStartIsInvocationStart() ? 0 : performance.now());
4525
- }
4526
- function livePinnedState() {
4527
- const pinned = stateSlot.get();
4528
- return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
4529
- }
4530
- function processStartIsInvocationStart() {
4531
- return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
4532
- }
4533
- function timingsEnabled() {
4534
- if (typeof process === "undefined") {
4535
- return false;
4536
- }
4537
- const value = process.env?.[TIMINGS_ENV_VAR];
4538
- if (value === undefined) {
4539
- return false;
4791
+ leafCorrelation(explicit) {
4792
+ const context = explicit ?? this.getActiveContext();
4793
+ return {
4794
+ operationId: context?.operationId ?? this.operationId ?? getTelemetryOperationId(),
4795
+ ...context !== undefined ? { parentId: context.id } : {}
4796
+ };
4540
4797
  }
4541
- const normalized = value.trim().toLowerCase();
4542
- return normalized === "1" || normalized === "true";
4543
- }
4544
- function recordExitCode(exitCode) {
4545
- if (!timingsEnabled()) {
4546
- return;
4798
+ spanFor(name, durationMs, success, properties, context) {
4799
+ return {
4800
+ name: redactSpanName(name),
4801
+ durationMs,
4802
+ success,
4803
+ properties: this.enrichProperties(properties),
4804
+ operationId: context.operationId,
4805
+ ...context.parentId !== undefined ? { parentId: context.parentId } : {},
4806
+ id: context.id,
4807
+ ...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
4808
+ };
4547
4809
  }
4548
- getState().exitCode = exitCode;
4549
- }
4550
- function invocationStartedAt() {
4551
- return new Date(performance.timeOrigin + getState().baseline);
4552
- }
4553
- function invocationElapsedMs() {
4554
- return performance.now() - getState().baseline;
4555
- }
4556
- function markCommandStart() {
4557
- if (!timingsEnabled()) {
4558
- return;
4810
+ enrichProperties(properties) {
4811
+ const globalProperties = getGlobalTelemetryProperties();
4812
+ const enriched = {
4813
+ ...getExecutionContextTelemetryProperties(),
4814
+ ...globalProperties,
4815
+ ...this.defaultProperties,
4816
+ ...redactProperties(properties ?? {}),
4817
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
4818
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
4819
+ };
4820
+ return lowercaseIdDimensionValues(enriched);
4559
4821
  }
4560
- getState().commandStart = performance.now();
4561
- }
4562
- function recordCommandDuration(durationMs) {
4563
- if (!timingsEnabled()) {
4564
- return;
4822
+ generateId() {
4823
+ const bytes = new Uint8Array(8);
4824
+ let hex = "";
4825
+ do {
4826
+ crypto.getRandomValues(bytes);
4827
+ hex = "";
4828
+ for (const byte of bytes) {
4829
+ hex += byte.toString(16).padStart(2, "0");
4830
+ }
4831
+ } while (/^0+$/.test(hex));
4832
+ return hex;
4565
4833
  }
4566
- getState().commandMs = durationMs;
4567
4834
  }
4568
4835
  // ../common/src/telemetry/proxy-http-agent.ts
4569
4836
  var slot = singleton("ProxyAuthHttpsAgent");
@@ -4571,6 +4838,15 @@ var slot = singleton("ProxyAuthHttpsAgent");
4571
4838
  // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
4572
4839
  var providerSlot = singleton("TelemetryProvider");
4573
4840
 
4841
+ // ../common/src/telemetry/telemetry-config.ts
4842
+ function isTelemetryDisabled() {
4843
+ const value = process.env.UIPATH_TELEMETRY_DISABLED;
4844
+ return value === "1" || value === "true";
4845
+ }
4846
+ function isProjectTelemetryDisabled() {
4847
+ return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
4848
+ }
4849
+
4574
4850
  // ../common/src/telemetry/telemetry-spool.ts
4575
4851
  var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
4576
4852
  var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
@@ -4606,7 +4882,6 @@ var telemetry = new Proxy({}, {
4606
4882
  return typeof value === "function" ? value.bind(instance) : value;
4607
4883
  }
4608
4884
  });
4609
-
4610
4885
  // ../common/src/formatter.ts
4611
4886
  var ANSI_STYLES = {
4612
4887
  red: "\x1B[31m",
@@ -4616,46 +4891,6 @@ var ANSI_RESET = "\x1B[0m";
4616
4891
  function styleLine(line, style) {
4617
4892
  return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
4618
4893
  }
4619
- var CLI_ERROR_CODES = [
4620
- "invalid_argument",
4621
- "authentication_required",
4622
- "permission_denied",
4623
- "local_permission_denied",
4624
- "not_found",
4625
- "rate_limited",
4626
- "network_error",
4627
- "timeout",
4628
- "server_error",
4629
- "method_not_allowed",
4630
- "not_supported",
4631
- "configuration_error",
4632
- "execution_failed",
4633
- "unknown_error"
4634
- ];
4635
- var RETRY_HINTS = [
4636
- "RetryWillNotFix",
4637
- "RetryLater",
4638
- "RetryAfter1Second",
4639
- "RetryAfter10Seconds",
4640
- "RetryAfter30Seconds",
4641
- "RetryAfter60Seconds"
4642
- ];
4643
- var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
4644
- var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
4645
- function isCliErrorCode(value) {
4646
- return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
4647
- }
4648
- function isRetryHint(value) {
4649
- return typeof value === "string" && RETRY_HINT_VALUES.has(value);
4650
- }
4651
- var RESULTS = {
4652
- Success: "Success",
4653
- Failure: "Failure",
4654
- ConfigError: "ConfigError",
4655
- AuthenticationError: "AuthenticationError",
4656
- ValidationError: "ValidationError",
4657
- TimeoutError: "TimeoutError"
4658
- };
4659
4894
  var EXIT_CODES = {
4660
4895
  Success: 0,
4661
4896
  Failure: 1,
@@ -4664,6 +4899,9 @@ var EXIT_CODES = {
4664
4899
  ValidationError: 3,
4665
4900
  TimeoutError: 4
4666
4901
  };
4902
+ function exitCodeForResult(result) {
4903
+ return EXIT_CODES[result] ?? EXIT_CODES.Failure;
4904
+ }
4667
4905
  function escapeNonAscii(jsonText) {
4668
4906
  return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
4669
4907
  const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
@@ -5339,8 +5577,8 @@ function carriesOnlyNulls(value) {
5339
5577
  }
5340
5578
  return false;
5341
5579
  }
5342
- function nameList(names, cap2 = 12) {
5343
- const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
5580
+ function nameList(names, cap = 12) {
5581
+ const shown = names.slice(0, cap).map((n) => `\`${n}\``);
5344
5582
  const rest = names.length - shown.length;
5345
5583
  return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5346
5584
  }
@@ -5477,40 +5715,11 @@ function defaultErrorCodeForResult(result) {
5477
5715
  return "unknown_error";
5478
5716
  }
5479
5717
  }
5480
- function parseHttpStatusFromMessage2(message) {
5481
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
5482
- if (!match)
5483
- return;
5484
- const status = Number(match[1]);
5485
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
5486
- }
5487
- function defaultErrorCodeForHttpStatus(status) {
5488
- if (status === undefined)
5489
- return;
5490
- if (status === 400 || status === 409 || status === 422) {
5491
- return "invalid_argument";
5492
- }
5493
- if (status === 401)
5494
- return "authentication_required";
5495
- if (status === 403)
5496
- return "permission_denied";
5497
- if (status === 404)
5498
- return "not_found";
5499
- if (status === 405)
5500
- return "method_not_allowed";
5501
- if (status === 408)
5502
- return "timeout";
5503
- if (status === 429)
5504
- return "rate_limited";
5505
- if (status >= 500 && status < 600)
5506
- return "server_error";
5507
- return;
5508
- }
5509
5718
  var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
5510
5719
  function defaultErrorCodeForFailure(data) {
5511
5720
  if (data.Result === RESULTS.Failure) {
5512
- const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
5513
- const errorCode = defaultErrorCodeForHttpStatus(status);
5721
+ const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
5722
+ const errorCode = classifyHttpStatus(status)?.errorCode;
5514
5723
  if (errorCode)
5515
5724
  return errorCode;
5516
5725
  if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
@@ -5519,17 +5728,6 @@ function defaultErrorCodeForFailure(data) {
5519
5728
  }
5520
5729
  return defaultErrorCodeForResult(data.Result);
5521
5730
  }
5522
- function defaultRetryForErrorCode(errorCode) {
5523
- switch (errorCode) {
5524
- case "network_error":
5525
- case "rate_limited":
5526
- case "server_error":
5527
- case "timeout":
5528
- return "RetryLater";
5529
- default:
5530
- return "RetryWillNotFix";
5531
- }
5532
- }
5533
5731
  var OutputFormatter;
5534
5732
  ((OutputFormatter) => {
5535
5733
  function success(data, options) {
@@ -5561,7 +5759,7 @@ var OutputFormatter;
5561
5759
  data.Log ??= getLogFilePath() || undefined;
5562
5760
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
5563
5761
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
5564
- const exitCode = EXIT_CODES[data.Result] ?? 1;
5762
+ const exitCode = exitCodeForResult(data.Result);
5565
5763
  setExitCode(exitCode);
5566
5764
  recordCommandFailureTelemetry({
5567
5765
  result: data.Result,
@@ -5655,39 +5853,228 @@ var OutputFormatter;
5655
5853
  }
5656
5854
  OutputFormatter.formatToString = formatToString;
5657
5855
  })(OutputFormatter ||= {});
5658
- // ../../node_modules/commander/esm.mjs
5659
- var import__ = __toESM(require_commander(), 1);
5660
- var {
5661
- program,
5662
- createCommand,
5663
- createArgument,
5664
- createOption,
5665
- CommanderError,
5666
- InvalidArgumentError,
5667
- InvalidOptionArgumentError,
5668
- Command,
5669
- Argument,
5670
- Option,
5671
- Help
5672
- } = import__.default;
5673
5856
 
5674
- // ../common/src/command-examples.ts
5675
- var examplesByCommand = new WeakMap;
5676
- Command.prototype.examples = function(examples) {
5677
- examplesByCommand.set(this, examples);
5678
- return this;
5679
- };
5680
- // ../common/src/preview.ts
5681
- var previewSlot = singleton("PreviewBuild");
5682
- function isPreviewBuild() {
5683
- return previewSlot.get(false) ?? false;
5857
+ // ../common/src/pass-through-tail.ts
5858
+ function maybeOption(arg) {
5859
+ return arg.length > 1 && arg[0] === "-";
5684
5860
  }
5685
- Command.prototype.previewCommand = function(nameAndArgs, opts) {
5686
- if (isPreviewBuild()) {
5687
- return this.command(nameAndArgs, opts);
5861
+ function tokenizeTail(cmd, tail) {
5862
+ const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
5863
+ const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
5864
+ const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
5865
+ const tokens = [];
5866
+ let firstUnknown = -1;
5867
+ let sentinel = -1;
5868
+ let variadic;
5869
+ let group;
5870
+ let groupIndex = 0;
5871
+ let i = 0;
5872
+ while (i < tail.length || group !== undefined) {
5873
+ const index = group === undefined ? i : groupIndex;
5874
+ const arg = group ?? tail[i++];
5875
+ group = undefined;
5876
+ if (arg === "--") {
5877
+ sentinel = index;
5878
+ tokens.push({ kind: "sentinel", index });
5879
+ for (let j = i;j < tail.length; j++) {
5880
+ tokens.push({
5881
+ kind: "operand",
5882
+ index: j,
5883
+ text: tail[j],
5884
+ literal: true
5885
+ });
5886
+ }
5887
+ break;
5888
+ }
5889
+ if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
5890
+ tokens.push({
5891
+ kind: "option",
5892
+ index,
5893
+ text: arg,
5894
+ option: variadic,
5895
+ value: arg
5896
+ });
5897
+ continue;
5898
+ }
5899
+ variadic = undefined;
5900
+ if (maybeOption(arg)) {
5901
+ const option = find(arg);
5902
+ if (option) {
5903
+ let value;
5904
+ if (option.required) {
5905
+ value = tail[i];
5906
+ if (value !== undefined)
5907
+ i++;
5908
+ } else if (option.optional) {
5909
+ const next = tail[i];
5910
+ if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
5911
+ value = next;
5912
+ i++;
5913
+ }
5914
+ }
5915
+ tokens.push({
5916
+ kind: "option",
5917
+ index,
5918
+ text: arg,
5919
+ option,
5920
+ ...value === undefined ? {} : { value }
5921
+ });
5922
+ variadic = option.variadic ? option : undefined;
5923
+ continue;
5924
+ }
5925
+ }
5926
+ if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
5927
+ const option = find(`-${arg[1]}`);
5928
+ if (option) {
5929
+ if (option.required || option.optional) {
5930
+ tokens.push({
5931
+ kind: "option",
5932
+ index,
5933
+ text: arg,
5934
+ option,
5935
+ value: arg.slice(2)
5936
+ });
5937
+ } else {
5938
+ tokens.push({ kind: "option", index, text: arg, option });
5939
+ group = `-${arg.slice(2)}`;
5940
+ groupIndex = index;
5941
+ }
5942
+ continue;
5943
+ }
5944
+ }
5945
+ if (/^--[^=]+=/.test(arg)) {
5946
+ const equals = arg.indexOf("=");
5947
+ const option = find(arg.slice(0, equals));
5948
+ if (option && (option.required || option.optional)) {
5949
+ tokens.push({
5950
+ kind: "option",
5951
+ index,
5952
+ text: arg,
5953
+ option,
5954
+ value: arg.slice(equals + 1)
5955
+ });
5956
+ continue;
5957
+ }
5958
+ }
5959
+ if (maybeOption(arg) && !negativeNumber(arg)) {
5960
+ const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
5961
+ if (firstUnknown === -1)
5962
+ firstUnknown = index;
5963
+ tokens.push({
5964
+ kind: "unknown",
5965
+ index,
5966
+ text: arg,
5967
+ flag: equals > 0 ? arg.slice(0, equals) : arg,
5968
+ ...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
5969
+ });
5970
+ continue;
5971
+ }
5972
+ tokens.push({ kind: "operand", index, text: arg, literal: false });
5688
5973
  }
5689
- return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
5690
- };
5974
+ return { tokens, firstUnknown, sentinel };
5975
+ }
5976
+
5977
+ // ../common/src/project-telemetry.ts
5978
+ var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
5979
+ var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
5980
+ var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
5981
+ var RULES = Symbol.for("@uipath/common/projectTargetRules");
5982
+ function logSkipped(what, error) {
5983
+ logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
5984
+ }
5985
+ function bounded(work, what) {
5986
+ return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
5987
+ }
5988
+ async function identityWithContext(command, identity) {
5989
+ const props = projectIdentityProperties(identity);
5990
+ if (!identity.projectDirectory || isProjectTelemetryDisabled())
5991
+ return props;
5992
+ for (let node = command;node; node = node.parent ?? undefined) {
5993
+ const resolver = node[CONTEXT_RESOLVER];
5994
+ if (typeof resolver !== "function")
5995
+ continue;
5996
+ try {
5997
+ return {
5998
+ ...await resolver(identity.projectDirectory),
5999
+ ...props
6000
+ };
6001
+ } catch (error) {
6002
+ logSkipped("solution context lookup", error);
6003
+ return props;
6004
+ }
6005
+ }
6006
+ return props;
6007
+ }
6008
+ function getProjectTelemetryResolver(command) {
6009
+ for (let node = command;node; node = node.parent) {
6010
+ const resolver = node[RESOLVER];
6011
+ if (typeof resolver === "function")
6012
+ return resolver;
6013
+ }
6014
+ return;
6015
+ }
6016
+ function attachProjectTelemetryCapture(command, capture) {
6017
+ command[CAPTURE] = capture;
6018
+ }
6019
+ class ProjectTelemetrySession {
6020
+ resolver;
6021
+ command;
6022
+ target;
6023
+ props = {};
6024
+ explicit = false;
6025
+ input;
6026
+ constructor(resolver, command) {
6027
+ this.resolver = resolver;
6028
+ this.command = command;
6029
+ }
6030
+ async setTarget(path) {
6031
+ this.target = path;
6032
+ if (this.input) {
6033
+ await this.resolve({
6034
+ ...this.input,
6035
+ phase: "after",
6036
+ success: true
6037
+ });
6038
+ this.explicit = true;
6039
+ }
6040
+ }
6041
+ async setIdentity(identity) {
6042
+ try {
6043
+ const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
6044
+ if (props !== undefined)
6045
+ this.setProperties(props);
6046
+ } catch (error) {
6047
+ logSkipped("project identity capture", error);
6048
+ }
6049
+ }
6050
+ setProperties(properties) {
6051
+ try {
6052
+ this.props = { ...properties };
6053
+ this.explicit = true;
6054
+ } catch (error) {
6055
+ logSkipped("project identity properties", error);
6056
+ }
6057
+ }
6058
+ properties() {
6059
+ return { ...this.props };
6060
+ }
6061
+ async resolve(input) {
6062
+ this.input = input;
6063
+ if (this.explicit)
6064
+ return;
6065
+ try {
6066
+ const props = await bounded(this.resolver({
6067
+ ...input,
6068
+ target: this.target
6069
+ }), `project identity (${input.phase})`);
6070
+ if (props !== undefined) {
6071
+ this.props = props;
6072
+ }
6073
+ } catch (error) {
6074
+ logSkipped(`project identity (${input.phase})`, error);
6075
+ }
6076
+ }
6077
+ }
5691
6078
 
5692
6079
  // ../common/src/telemetry/command-attribution.ts
5693
6080
  var LEGACY_SKILL_NAMESPACE = "uipath:";
@@ -5933,8 +6320,7 @@ var pollSignalSlot = singleton("PollSignal");
5933
6320
  var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
5934
6321
  var processContext = {
5935
6322
  exit: (code) => {
5936
- recordExitCode(code);
5937
- setExitCode(code);
6323
+ recordCommandExit(code);
5938
6324
  },
5939
6325
  get pollSignal() {
5940
6326
  return pollSignalSlot.get();
@@ -5959,6 +6345,8 @@ function recordableArgValue(value, choices) {
5959
6345
  function extractCommandParams(cmd) {
5960
6346
  const params = {};
5961
6347
  forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
6348
+ if (name === undefined)
6349
+ return;
5962
6350
  const recordable = recordableArgValue(value, choices);
5963
6351
  params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
5964
6352
  });
@@ -5974,7 +6362,8 @@ function isDefaultedPositional(cmd, index) {
5974
6362
  function forEachSuppliedArgument(cmd, visit) {
5975
6363
  const registered = cmd.registeredArguments ?? [];
5976
6364
  const processed = cmd.processedArgs ?? [];
5977
- for (let i = 0;i < registered.length; i++) {
6365
+ const bound = boundPositionalCount(cmd);
6366
+ for (let i = 0;i < bound; i++) {
5978
6367
  const name = registered[i].name();
5979
6368
  if (name && processed[i] !== undefined) {
5980
6369
  visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
@@ -5989,6 +6378,71 @@ function forEachSuppliedArgument(cmd, visit) {
5989
6378
  visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
5990
6379
  }
5991
6380
  }
6381
+ forEachPassThroughToken(cmd, bound, (name, value) => {
6382
+ visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
6383
+ });
6384
+ }
6385
+ function boundPositionalCount(cmd) {
6386
+ const registered = cmd.registeredArguments ?? [];
6387
+ if (registered.some((argument) => argument.variadic)) {
6388
+ return registered.length;
6389
+ }
6390
+ if ((cmd.args ?? []).length <= registered.length) {
6391
+ return registered.length;
6392
+ }
6393
+ const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
6394
+ return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
6395
+ }
6396
+ function forEachPassThroughToken(cmd, bound, visit) {
6397
+ const registered = cmd.registeredArguments ?? [];
6398
+ const fillsPositionals = !registered.some((argument) => argument.variadic);
6399
+ const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
6400
+ const repeated = new Map;
6401
+ let nextPositional = bound;
6402
+ for (const token of tokens) {
6403
+ const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
6404
+ if (token.kind === "sentinel")
6405
+ continue;
6406
+ if (token.kind === "operand") {
6407
+ const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
6408
+ const name = claimable ? registered[nextPositional++].name() : undefined;
6409
+ visit(name || undefined, token.text);
6410
+ continue;
6411
+ }
6412
+ if (token.kind === "unknown") {
6413
+ const bare = token.flag.replace(/^-+/, "");
6414
+ const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
6415
+ const keyable = token.flag.startsWith("--") || token.flag.length === 2;
6416
+ if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
6417
+ visit(key, token.inlineValue ?? true);
6418
+ } else {
6419
+ visit(undefined, token.text);
6420
+ if (token.inlineValue !== undefined) {
6421
+ visit(undefined, token.inlineValue);
6422
+ } else if (!token.flag.startsWith("--") && token.flag.length > 2) {
6423
+ visit(undefined, token.flag.slice(2));
6424
+ }
6425
+ }
6426
+ continue;
6427
+ }
6428
+ if (pastUnknown) {
6429
+ visit(undefined, token.text);
6430
+ if (token.value !== undefined)
6431
+ visit(undefined, token.value);
6432
+ continue;
6433
+ }
6434
+ const option = token.option;
6435
+ const name = option.attributeName();
6436
+ const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
6437
+ const previous = repeated.get(name);
6438
+ if (previous) {
6439
+ previous.push(value);
6440
+ visit(name, previous);
6441
+ } else {
6442
+ repeated.set(name, [value]);
6443
+ visit(name, value);
6444
+ }
6445
+ }
5992
6446
  }
5993
6447
  function withheldArgumentValues(cmd) {
5994
6448
  const values = [];
@@ -6050,6 +6504,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6050
6504
  const telemetryName = commandTelemetryName(commandParts);
6051
6505
  const commandPath = commandInvocationPath(commandParts);
6052
6506
  const props = typeof properties === "function" ? properties(...args) : properties;
6507
+ const projectResolver = getProjectTelemetryResolver(command);
6508
+ const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
6053
6509
  markCommandStart();
6054
6510
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
6055
6511
  try {
@@ -6062,6 +6518,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6062
6518
  if (violation) {
6063
6519
  return Promise.reject(violation);
6064
6520
  }
6521
+ if (projectSession) {
6522
+ return projectSession.resolve({ command, args, phase: "before" }).then(() => {
6523
+ attachProjectTelemetryCapture(command, projectSession);
6524
+ return fn(...args);
6525
+ });
6526
+ }
6065
6527
  return fn(...args);
6066
6528
  }));
6067
6529
  if (error) {
@@ -6070,22 +6532,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6070
6532
  const typed = error;
6071
6533
  const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
6072
6534
  const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
6073
- const finalResult = customResult ?? RESULTS.Failure;
6535
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
6536
+ const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
6537
+ const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
6074
6538
  const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
6075
6539
  const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
6076
6540
  const typedRetry = typed.retry ?? typed.Retry;
6077
6541
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
6078
6542
  const typedContext = typed.context ?? typed.Context;
6079
6543
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
6080
- const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
6081
6544
  fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
6545
+ const errorCode = customErrorCode ?? classified?.errorCode;
6546
+ const retry = customRetry ?? classified?.retry;
6547
+ const errorContext = customContext ?? classified?.context;
6082
6548
  OutputFormatter.error({
6083
6549
  Result: finalResult,
6084
- ...customErrorCode ? { ErrorCode: customErrorCode } : {},
6550
+ ...errorCode ? { ErrorCode: errorCode } : {},
6085
6551
  Message: errorMessage,
6086
6552
  Instructions: customInstructions ?? commandHelpHint(commandPath),
6087
- ...customRetry ? { Retry: customRetry } : {},
6088
- ...customContext ? { Context: customContext } : {}
6553
+ ...retry ? { Retry: retry } : {},
6554
+ ...errorContext ? { Context: errorContext } : {}
6089
6555
  });
6090
6556
  context.exit(fallbackExitCode);
6091
6557
  }
@@ -6094,6 +6560,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6094
6560
  const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
6095
6561
  const recordedFailure = takeRecordedCommandFailureTelemetry();
6096
6562
  const success = !error && exitCode === 0;
6563
+ if (projectSession) {
6564
+ await projectSession.resolve({
6565
+ command,
6566
+ args,
6567
+ phase: "after",
6568
+ success
6569
+ });
6570
+ }
6097
6571
  const terminalTelemetry = buildCommandTerminalTelemetryProperties({
6098
6572
  error,
6099
6573
  exitCode,
@@ -6111,6 +6585,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6111
6585
  }
6112
6586
  const baseProperties = redactProperties({
6113
6587
  ...commandParams,
6588
+ ...projectSession?.properties(),
6114
6589
  ...props,
6115
6590
  ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
6116
6591
  ...buildAgentSessionTelemetry(process.env),
@@ -6121,6 +6596,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
6121
6596
  });
6122
6597
  emitInvocationRequest(telemetryName, success, baseProperties);
6123
6598
  } finally {
6599
+ if (projectSession)
6600
+ attachProjectTelemetryCapture(command, undefined);
6124
6601
  releaseSuppliedArgumentValues(supplied);
6125
6602
  }
6126
6603
  });
@@ -6427,14 +6904,14 @@ function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
6427
6904
  function parseBoundedInt(raw, optionName, bounds) {
6428
6905
  const normalized = raw.trim();
6429
6906
  if (normalized === "") {
6430
- throw new InvalidArgumentError(`${optionName} requires a value (got empty).`);
6907
+ throw new InvalidArgumentError2(`${optionName} requires a value (got empty).`);
6431
6908
  }
6432
6909
  if (!/^-?\d+$/.test(normalized)) {
6433
- throw new InvalidArgumentError(`${optionName} must be an integer, got '${normalized}'.`);
6910
+ throw new InvalidArgumentError2(`${optionName} must be an integer, got '${normalized}'.`);
6434
6911
  }
6435
6912
  const n = parseInt(normalized, 10);
6436
6913
  if (n < bounds.min || n > bounds.max) {
6437
- throw new InvalidArgumentError(`${optionName} must be between ${bounds.min} and ${bounds.max}, got ${n}.`);
6914
+ throw new InvalidArgumentError2(`${optionName} must be between ${bounds.min} and ${bounds.max}, got ${n}.`);
6438
6915
  }
6439
6916
  return n;
6440
6917
  }
@@ -6535,7 +7012,7 @@ function abortError(signal) {
6535
7012
  return err;
6536
7013
  }
6537
7014
  function interruptibleSleep(ms, signal) {
6538
- return new Promise((resolve2, reject) => {
7015
+ return new Promise((resolve, reject) => {
6539
7016
  if (signal?.aborted) {
6540
7017
  reject(abortError(signal));
6541
7018
  return;
@@ -6548,7 +7025,7 @@ function interruptibleSleep(ms, signal) {
6548
7025
  };
6549
7026
  const timer = setTimeout(() => {
6550
7027
  cleanup();
6551
- resolve2();
7028
+ resolve();
6552
7029
  }, ms);
6553
7030
  if (signal) {
6554
7031
  onAbort = () => {
@@ -6563,11 +7040,31 @@ function interruptibleSleep(ms, signal) {
6563
7040
  function sanitizeMaxErrors(value) {
6564
7041
  if (value === undefined)
6565
7042
  return POLL_DEFAULTS.maxConsecutiveErrors;
6566
- if (!Number.isFinite(value) || value < 0)
7043
+ if (value < 0)
6567
7044
  return 0;
6568
7045
  return Math.floor(value);
6569
7046
  }
7047
+ function requireFinite(value, field) {
7048
+ if (value !== undefined && !Number.isFinite(value)) {
7049
+ throw new RangeError(`pollUntil: ${field} must be a finite number, got ${String(value)}.`);
7050
+ }
7051
+ }
7052
+ function assertFiniteSettings(options) {
7053
+ requireFinite(options.timeoutMs, "timeoutMs");
7054
+ if (typeof options.intervalMs === "number") {
7055
+ requireFinite(options.intervalMs, "intervalMs");
7056
+ }
7057
+ requireFinite(options.maxConsecutiveErrors, "maxConsecutiveErrors");
7058
+ requireFinite(options.logIntervalMs, "logIntervalMs");
7059
+ if (typeof options.backoff === "object" && options.backoff !== null) {
7060
+ requireFinite(options.backoff.initialMs, "backoff.initialMs");
7061
+ requireFinite(options.backoff.multiplier, "backoff.multiplier");
7062
+ requireFinite(options.backoff.maxMs, "backoff.maxMs");
7063
+ requireFinite(options.backoff.jitter, "backoff.jitter");
7064
+ }
7065
+ }
6570
7066
  function resolveConfig(options) {
7067
+ assertFiniteSettings(options);
6571
7068
  const timeoutMs = Math.max(0, options.timeoutMs ?? POLL_DEFAULTS.timeoutMs);
6572
7069
  const startTime = Date.now();
6573
7070
  return {
@@ -7234,7 +7731,7 @@ var package_default2 = {
7234
7731
  name: "@uipath/sc-sdk",
7235
7732
  author: "UiPath",
7236
7733
  license: "SEE LICENSE IN LICENSE.txt",
7237
- version: "1.205.0",
7734
+ version: "1.206.0",
7238
7735
  description: "SDK for the UiPath SourceControl API — connections, repositories, automation projects, solutions.",
7239
7736
  repository: {
7240
7737
  type: "git",
@@ -8574,9 +9071,9 @@ function getProfileStorage() {
8574
9071
  if (isAuthProfileStorage(existing)) {
8575
9072
  return existing;
8576
9073
  }
8577
- const storage2 = createProfileStorage();
8578
- globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage2;
8579
- return storage2;
9074
+ const storage = createProfileStorage();
9075
+ globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
9076
+ return storage;
8580
9077
  }
8581
9078
  var profileStorage = getProfileStorage();
8582
9079
 
@@ -8607,8 +9104,8 @@ function resolveAuthProfileFilePath(profile) {
8607
9104
  if (normalized === undefined) {
8608
9105
  throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
8609
9106
  }
8610
- const fs2 = getFileSystem();
8611
- return fs2.path.join(fs2.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
9107
+ const fs = getFileSystem();
9108
+ return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
8612
9109
  }
8613
9110
  function getActiveAuthProfileFilePath() {
8614
9111
  const profile = getActiveAuthProfile();
@@ -8781,6 +9278,8 @@ var ENV_AUTH_VARS = {
8781
9278
  };
8782
9279
 
8783
9280
  class EnvAuthConfigError extends Error {
9281
+ errorCode = "configuration_error";
9282
+ retry = "RetryWillNotFix";
8784
9283
  constructor(message) {
8785
9284
  super(message);
8786
9285
  this.name = "EnvAuthConfigError";
@@ -8819,11 +9318,11 @@ var readAuthFromEnv = () => {
8819
9318
  if (!rawUrl) {
8820
9319
  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}).`);
8821
9320
  }
8822
- const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
9321
+ const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
8823
9322
  return {
8824
9323
  loginStatus: "Logged in",
8825
9324
  accessToken,
8826
- baseUrl: baseUrl2,
9325
+ baseUrl,
8827
9326
  organizationName,
8828
9327
  organizationId,
8829
9328
  tenantName,
@@ -8864,8 +9363,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
8864
9363
  async function refreshTokenFingerprint(refreshToken) {
8865
9364
  const bytes = new TextEncoder().encode(refreshToken);
8866
9365
  if (globalThis.crypto?.subtle) {
8867
- const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
8868
- return Array.from(new Uint8Array(digest2), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
9366
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
9367
+ return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
8869
9368
  }
8870
9369
  const { createHash } = await import("node:crypto");
8871
9370
  return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
@@ -8874,9 +9373,9 @@ function breakerPathFor(authPath) {
8874
9373
  return `${authPath}${BREAKER_SUFFIX}`;
8875
9374
  }
8876
9375
  async function loadRefreshBreaker(authPath) {
8877
- const fs2 = getFileSystem();
9376
+ const fs = getFileSystem();
8878
9377
  try {
8879
- const content = await fs2.readFile(breakerPathFor(authPath), "utf-8");
9378
+ const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
8880
9379
  if (!content)
8881
9380
  return {};
8882
9381
  const parsed = JSON.parse(content);
@@ -8887,20 +9386,20 @@ async function loadRefreshBreaker(authPath) {
8887
9386
  }
8888
9387
  async function saveRefreshBreaker(authPath, state) {
8889
9388
  try {
8890
- const fs2 = getFileSystem();
8891
- const path2 = breakerPathFor(authPath);
8892
- await fs2.mkdir(fs2.path.dirname(path2));
8893
- const tempPath = `${path2}.tmp`;
8894
- await fs2.writeFile(tempPath, JSON.stringify(state));
8895
- await fs2.rename(tempPath, path2);
9389
+ const fs = getFileSystem();
9390
+ const path = breakerPathFor(authPath);
9391
+ await fs.mkdir(fs.path.dirname(path));
9392
+ const tempPath = `${path}.tmp`;
9393
+ await fs.writeFile(tempPath, JSON.stringify(state));
9394
+ await fs.rename(tempPath, path);
8896
9395
  } catch {}
8897
9396
  }
8898
9397
  async function clearRefreshBreaker(authPath) {
8899
- const fs2 = getFileSystem();
8900
- const path2 = breakerPathFor(authPath);
9398
+ const fs = getFileSystem();
9399
+ const path = breakerPathFor(authPath);
8901
9400
  try {
8902
- if (await fs2.exists(path2)) {
8903
- await fs2.rm(path2);
9401
+ if (await fs.exists(path)) {
9402
+ await fs.rm(path);
8904
9403
  }
8905
9404
  } catch {}
8906
9405
  }
@@ -8921,13 +9420,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
8921
9420
  var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
8922
9421
  var PIPE_NAME_MAX_LENGTH = 103;
8923
9422
  var getRobotIpcPipeNames = async () => {
8924
- const fs2 = getFileSystem();
8925
- const username = fs2.env.getenv("USER") ?? fs2.env.getenv("USERNAME");
9423
+ const fs = getFileSystem();
9424
+ const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
8926
9425
  if (!username) {
8927
9426
  throw new Error("Unable to determine current username");
8928
9427
  }
8929
- const tempPath = fs2.env.getenv("TMPDIR") ?? "/tmp/";
8930
- return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs2.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
9428
+ const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
9429
+ return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
8931
9430
  };
8932
9431
  var defaultIsRobotIpcAvailable = async () => {
8933
9432
  if (process.platform === "win32") {
@@ -8937,20 +9436,20 @@ var defaultIsRobotIpcAvailable = async () => {
8937
9436
  if (pipeNamesError || !pipeNames) {
8938
9437
  return false;
8939
9438
  }
8940
- const fs2 = getFileSystem();
9439
+ const fs = getFileSystem();
8941
9440
  for (const pipeName of pipeNames) {
8942
- const [existsError, exists] = await catchError2(fs2.exists(pipeName));
9441
+ const [existsError, exists] = await catchError2(fs.exists(pipeName));
8943
9442
  if (!existsError && exists === true) {
8944
9443
  return true;
8945
9444
  }
8946
9445
  }
8947
9446
  return false;
8948
9447
  };
8949
- var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
9448
+ var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
8950
9449
  const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
8951
9450
  promise.then((value) => {
8952
9451
  clearTimeout(timer);
8953
- resolve2(value);
9452
+ resolve(value);
8954
9453
  }, (error) => {
8955
9454
  clearTimeout(timer);
8956
9455
  reject(error);
@@ -9123,9 +9622,12 @@ var refreshAccessToken = async ({
9123
9622
  body: tokenParams
9124
9623
  });
9125
9624
  const tokenData = await tokenResponse.json();
9126
- if (!tokenResponse.ok) {
9625
+ if (tokenResponse.status === 400 || tokenResponse.status === 401) {
9127
9626
  throw new TokenRefreshOAuthError;
9128
9627
  }
9628
+ if (!tokenResponse.ok) {
9629
+ throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
9630
+ }
9129
9631
  const newAccessToken = tokenData.access_token;
9130
9632
  const newRefreshToken = tokenData.refresh_token;
9131
9633
  if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
@@ -9157,9 +9659,9 @@ var errorCode = (err) => {
9157
9659
  }
9158
9660
  return "EUNKNOWN";
9159
9661
  };
9160
- var probeAsync = async (fs2, candidate) => {
9662
+ var probeAsync = async (fs, candidate) => {
9161
9663
  try {
9162
- const stats = await fs2.stat(candidate);
9664
+ const stats = await fs.stat(candidate);
9163
9665
  if (stats === null) {
9164
9666
  return { exists: false };
9165
9667
  }
@@ -9186,36 +9688,36 @@ var probeAsync = async (fs2, candidate) => {
9186
9688
  }
9187
9689
  };
9188
9690
  var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
9189
- const fs2 = getFileSystem();
9190
- if (fs2.path.isAbsolute(envFilePath)) {
9191
- const probe2 = await probeAsync(fs2, envFilePath);
9192
- return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
9691
+ const fs = getFileSystem();
9692
+ if (fs.path.isAbsolute(envFilePath)) {
9693
+ const probe = await probeAsync(fs, envFilePath);
9694
+ return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
9193
9695
  exists: false,
9194
9696
  absolutePath: envFilePath,
9195
9697
  source: "absolute",
9196
- ...probe2.unusable ? { unusable: probe2.unusable } : {}
9698
+ ...probe.unusable ? { unusable: probe.unusable } : {}
9197
9699
  };
9198
9700
  }
9199
- const cwd = opts?.cwd ?? fs2.env.cwd();
9701
+ const cwd = opts?.cwd ?? fs.env.cwd();
9200
9702
  let searchDir = cwd;
9201
9703
  while (true) {
9202
- const candidate = fs2.path.join(searchDir, envFilePath);
9203
- const probe2 = await probeAsync(fs2, candidate);
9204
- if (probe2.exists) {
9704
+ const candidate = fs.path.join(searchDir, envFilePath);
9705
+ const probe = await probeAsync(fs, candidate);
9706
+ if (probe.exists) {
9205
9707
  return {
9206
9708
  exists: true,
9207
9709
  absolutePath: candidate,
9208
9710
  source: searchDir === cwd ? "cwd" : "ancestor"
9209
9711
  };
9210
9712
  }
9211
- const parentDir = fs2.path.dirname(searchDir);
9713
+ const parentDir = fs.path.dirname(searchDir);
9212
9714
  if (parentDir === searchDir) {
9213
9715
  break;
9214
9716
  }
9215
9717
  searchDir = parentDir;
9216
9718
  }
9217
- const homePath = fs2.path.join(fs2.env.homedir(), envFilePath);
9218
- const probe = await probeAsync(fs2, homePath);
9719
+ const homePath = fs.path.join(fs.env.homedir(), envFilePath);
9720
+ const probe = await probeAsync(fs, homePath);
9219
9721
  if (probe.exists) {
9220
9722
  return { exists: true, absolutePath: homePath, source: "home" };
9221
9723
  }
@@ -9258,12 +9760,12 @@ var parseEnvContent = (content) => {
9258
9760
  return env;
9259
9761
  };
9260
9762
  var loadEnvFileAsync = async ({ envPath }) => {
9261
- const fs2 = getFileSystem();
9262
- const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
9263
- if (!await fs2.exists(absolutePath)) {
9763
+ const fs = getFileSystem();
9764
+ const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
9765
+ if (!await fs.exists(absolutePath)) {
9264
9766
  throw new Error(`Environment file not found: ${envPath}`);
9265
9767
  }
9266
- const content = await fs2.readFile(absolutePath, "utf-8");
9768
+ const content = await fs.readFile(absolutePath, "utf-8");
9267
9769
  if (content === null) {
9268
9770
  throw new Error(`Environment file not found: ${envPath}`);
9269
9771
  }
@@ -9274,10 +9776,10 @@ var saveEnvFileAsync = async ({
9274
9776
  data,
9275
9777
  merge = true
9276
9778
  }) => {
9277
- const fs2 = getFileSystem();
9278
- const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.homedir(), envPath);
9779
+ const fs = getFileSystem();
9780
+ const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
9279
9781
  let existingData = {};
9280
- if (merge && await fs2.exists(absolutePath)) {
9782
+ if (merge && await fs.exists(absolutePath)) {
9281
9783
  try {
9282
9784
  existingData = await loadEnvFileAsync({ envPath: absolutePath });
9283
9785
  } catch {}
@@ -9295,11 +9797,11 @@ var saveEnvFileAsync = async ({
9295
9797
  const content = `${lines.join(`
9296
9798
  `)}
9297
9799
  `;
9298
- const dir = fs2.path.dirname(absolutePath);
9299
- await fs2.mkdir(dir);
9800
+ const dir = fs.path.dirname(absolutePath);
9801
+ await fs.mkdir(dir);
9300
9802
  const tempPath = `${absolutePath}.tmp`;
9301
- await fs2.writeFile(tempPath, content);
9302
- await fs2.rename(tempPath, absolutePath);
9803
+ await fs.writeFile(tempPath, content);
9804
+ await fs.rename(tempPath, absolutePath);
9303
9805
  };
9304
9806
 
9305
9807
  // ../auth/src/loginStatus.ts
@@ -9315,7 +9817,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
9315
9817
  saveEnvFile = saveEnvFileAsync,
9316
9818
  getFs = getFileSystem,
9317
9819
  refreshToken: refreshTokenFn = refreshAccessToken,
9318
- resolveConfig: resolveConfig2 = resolveConfigAsync,
9820
+ resolveConfig = resolveConfigAsync,
9319
9821
  robotFallback = tryRobotClientFallback,
9320
9822
  fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
9321
9823
  robotTenantIdCache = defaultRobotTenantIdCache,
@@ -9377,7 +9879,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
9377
9879
  loadEnvFile,
9378
9880
  saveEnvFile,
9379
9881
  refreshFn: refreshTokenFn,
9380
- resolveConfig: resolveConfig2,
9882
+ resolveConfig,
9381
9883
  loadBreaker,
9382
9884
  saveBreaker,
9383
9885
  clearBreaker,
@@ -9423,11 +9925,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
9423
9925
  return { credentials };
9424
9926
  }
9425
9927
  async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
9426
- const fs2 = getFs();
9427
- const globalPath = fs2.path.join(fs2.env.homedir(), envFilePath);
9928
+ const fs = getFs();
9929
+ const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
9428
9930
  if (absolutePath === globalPath)
9429
9931
  return;
9430
- if (!await fs2.exists(globalPath))
9932
+ if (!await fs.exists(globalPath))
9431
9933
  return;
9432
9934
  try {
9433
9935
  const globalCreds = await loadEnvFile({ envPath: globalPath });
@@ -9707,7 +10209,7 @@ async function runRefreshLocked(inputs) {
9707
10209
  loadEnvFile,
9708
10210
  saveEnvFile,
9709
10211
  refreshFn,
9710
- resolveConfig: resolveConfig2,
10212
+ resolveConfig,
9711
10213
  loadBreaker,
9712
10214
  saveBreaker,
9713
10215
  clearBreaker
@@ -9746,7 +10248,7 @@ async function runRefreshLocked(inputs) {
9746
10248
  let refreshedAccess;
9747
10249
  let refreshedRefresh;
9748
10250
  try {
9749
- const config = await resolveConfig2({ customAuthority });
10251
+ const config = await resolveConfig({ customAuthority });
9750
10252
  const refreshed = await refreshFn({
9751
10253
  refreshToken: tokenForIdP,
9752
10254
  tokenEndpoint: config.tokenEndpoint,
@@ -9844,26 +10346,38 @@ function errorMessage(error) {
9844
10346
  }
9845
10347
 
9846
10348
  // ../auth/src/authContext.ts
10349
+ class AuthContextUnavailableError extends Error {
10350
+ instructionContext;
10351
+ sessionHint;
10352
+ errorCode = "authentication_required";
10353
+ retry = "RetryWillNotFix";
10354
+ constructor(message, instructionContext = "auth", sessionHint) {
10355
+ super(message);
10356
+ this.instructionContext = instructionContext;
10357
+ this.sessionHint = sessionHint;
10358
+ this.name = "AuthContextUnavailableError";
10359
+ }
10360
+ }
9847
10361
  var getAuthContext = async (options = {}) => {
9848
10362
  const status = await getLoginStatusAsync({
9849
10363
  ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
9850
10364
  envFilePath: options.envFilePath
9851
10365
  });
9852
10366
  if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
9853
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
10367
+ throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
9854
10368
  }
9855
- const tenantName = options.tenant ?? status.tenantName;
10369
+ const tenantName = options.tenant || status.tenantName;
9856
10370
  if (options.requireOrganizationId && !status.organizationId) {
9857
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
10371
+ throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
9858
10372
  }
9859
10373
  if (options.requireOrganizationName && !status.organizationName) {
9860
- throw new Error("Organization name not available. Ensure you are logged in with an organization context.");
10374
+ throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
9861
10375
  }
9862
10376
  if (options.requireTenantId && !status.tenantId) {
9863
- throw new Error("Tenant ID not available. Ensure UIPATH_TENANT_ID is set.");
10377
+ throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
9864
10378
  }
9865
- if (options.requireTenantName && tenantName === undefined) {
9866
- throw new Error("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.");
10379
+ if (options.requireTenantName && !tenantName) {
10380
+ 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");
9867
10381
  }
9868
10382
  return {
9869
10383
  baseUrl: status.baseUrl,
@@ -10167,7 +10681,7 @@ var package_default3 = {
10167
10681
  name: "@uipath/cicd-sdk",
10168
10682
  author: "UiPath",
10169
10683
  license: "SEE LICENSE IN LICENSE.txt",
10170
- version: "1.205.0",
10684
+ version: "1.206.0",
10171
10685
  description: "SDK for the UiPath StudioAdmin CICD API — pipelines, pipeline executions, partition configuration.",
10172
10686
  repository: {
10173
10687
  type: "git",
@@ -11597,8 +12111,8 @@ var AZURE_PROJECTS_EXAMPLES = [
11597
12111
  }
11598
12112
  }
11599
12113
  ];
11600
- var registerConnectionCommand = (program2) => {
11601
- const connection = program2.command("connection").description([
12114
+ var registerConnectionCommand = (program) => {
12115
+ const connection = program.command("connection").description([
11602
12116
  "Manage SourceControl connections — the per-tenant link to a Git provider",
11603
12117
  "(GitHub or Azure DevOps) that StudioAdmin uses to discover repositories,",
11604
12118
  "automation projects and solutions.",
@@ -11723,7 +12237,7 @@ var registerConnectionCommand = (program2) => {
11723
12237
  }
11724
12238
  const data = pollResult.data;
11725
12239
  const rows = connectionId ? data?.target : data?.states;
11726
- if (!data?.succeeded) {
12240
+ if (!data?.succeeded || !rows) {
11727
12241
  OutputFormatter.error({
11728
12242
  Result: RESULTS.Failure,
11729
12243
  Message: "Sync settled in a non-success state.",
@@ -11845,7 +12359,7 @@ var registerConnectionCommand = (program2) => {
11845
12359
  "",
11846
12360
  "Default `--limit` is 10. Raise it to fetch a bigger batch in one call."
11847
12361
  ].join(`
11848
- `)).argument("<connection-id>", "Connection identifier from `connection list`.").option("--repository-ids <csv>", "Comma-separated repository identifiers from `connection repos`.").option("--target-framework <name>", "Server-side filter on project target framework.").option("--project-type <type>", "Server-side filter on project type (e.g. Process, Library, Agent).").option("--azure-projects-ids <csv>", "Comma-separated Azure DevOps project identifiers (Azure connections only).").option("--organization-identifier <name>", "Azure DevOps organization name (Azure connections only).").option("--sort-by <field>", "Field name to sort by (e.g. name, lastModifiedDate).").option("--sort-order <asc|desc>", "Sort direction. Combine with --sort-by.").option("--offset <n>", "Number of projects to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum projects to return. Defaults to 10. Raise it to fetch a bigger batch in one call.", parsePositiveInt("--limit")).addOption(new Option("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on project name.").examples(PROJECTS_EXAMPLES)).trackedAction(processContext, async (connectionId, options) => {
12362
+ `)).argument("<connection-id>", "Connection identifier from `connection list`.").option("--repository-ids <csv>", "Comma-separated repository identifiers from `connection repos`.").option("--target-framework <name>", "Server-side filter on project target framework.").option("--project-type <type>", "Server-side filter on project type (e.g. Process, Library, Agent).").option("--azure-projects-ids <csv>", "Comma-separated Azure DevOps project identifiers (Azure connections only).").option("--organization-identifier <name>", "Azure DevOps organization name (Azure connections only).").option("--sort-by <field>", "Field name to sort by (e.g. name, lastModifiedDate).").option("--sort-order <asc|desc>", "Sort direction. Combine with --sort-by.").option("--offset <n>", "Number of projects to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum projects to return. Defaults to 10. Raise it to fetch a bigger batch in one call.", parsePositiveInt("--limit")).addOption(new Option2("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option2("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on project name.").examples(PROJECTS_EXAMPLES)).trackedAction(processContext, async (connectionId, options) => {
11849
12363
  const api = await getScApi(ConnectionsApi, options);
11850
12364
  if (!api)
11851
12365
  return;
@@ -11907,7 +12421,7 @@ var registerConnectionCommand = (program2) => {
11907
12421
  "Pagination via `--offset` / `--limit` (`--offset` must be a multiple of `--limit`);",
11908
12422
  "`--search` does substring search on solution name."
11909
12423
  ].join(`
11910
- `)).argument("<connection-id>", "Connection identifier from `connection list`.").option("--offset <n>", "Number of solutions to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum solutions to return. Defaults to 20.", parsePositiveInt("--limit")).addOption(new Option("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on solution name.").examples(SOLUTIONS_EXAMPLES)).trackedAction(processContext, async (connectionId, options) => {
12424
+ `)).argument("<connection-id>", "Connection identifier from `connection list`.").option("--offset <n>", "Number of solutions to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum solutions to return. Defaults to 20.", parsePositiveInt("--limit")).addOption(new Option2("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option2("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on solution name.").examples(SOLUTIONS_EXAMPLES)).trackedAction(processContext, async (connectionId, options) => {
11911
12425
  const api = await getScApi(ConnectionsApi, options);
11912
12426
  if (!api)
11913
12427
  return;
@@ -12114,8 +12628,8 @@ async function resolveJobKey(api, executionId, override) {
12114
12628
  }
12115
12629
  return { jobKey: exec.jobExecutionIdentifier, state: exec.state };
12116
12630
  }
12117
- var registerExecutionCommand = (program2) => {
12118
- const execution = program2.command("execution").description([
12631
+ var registerExecutionCommand = (program) => {
12632
+ const execution = program.command("execution").description([
12119
12633
  "Inspect and control pipeline executions — `get`, `logs --follow`, `details`,",
12120
12634
  "`stop`.",
12121
12635
  "",
@@ -12438,8 +12952,8 @@ var mapExecutionRow = (e) => ({
12438
12952
 
12439
12953
  // src/commands/_shared/load-json.ts
12440
12954
  var loadJsonFile = async (file, contractName) => {
12441
- const fs2 = getFileSystem();
12442
- const [readErr, content] = await catchError(fs2.readFile(file, "utf-8"));
12955
+ const fs = getFileSystem();
12956
+ const [readErr, content] = await catchError(fs.readFile(file, "utf-8"));
12443
12957
  if (readErr || content === null) {
12444
12958
  return emit({
12445
12959
  message: readErr?.message ?? `File not found: ${file}`,
@@ -12537,16 +13051,16 @@ var partitionEditPipelineKeys = (parsed) => {
12537
13051
  var sentEditPipelineFields = (dto) => Object.fromEntries(Object.entries(EditPipelineDtoToJSON(dto)).filter(([, value]) => value !== undefined));
12538
13052
 
12539
13053
  // src/commands/_shared/write-json-file.ts
12540
- var writeJsonFile = async (path2, data) => {
12541
- const fs2 = getFileSystem();
12542
- const absolutePath = fs2.path.resolve(path2);
13054
+ var writeJsonFile = async (path, data) => {
13055
+ const fs = getFileSystem();
13056
+ const absolutePath = fs.path.resolve(path);
12543
13057
  const json = `${JSON.stringify(data, null, 2)}
12544
13058
  `;
12545
- const [err] = await catchError(fs2.writeFile(absolutePath, json));
13059
+ const [err] = await catchError(fs.writeFile(absolutePath, json));
12546
13060
  if (err) {
12547
13061
  OutputFormatter.error({
12548
13062
  Result: RESULTS.Failure,
12549
- Message: `Failed to write '${path2}': ${err.message}`,
13063
+ Message: `Failed to write '${path}': ${err.message}`,
12550
13064
  Instructions: "Verify the parent directory exists, is writable, and that the path is not a directory or a read-only file."
12551
13065
  });
12552
13066
  processContext.exit(1);
@@ -12746,8 +13260,8 @@ var EXECUTIONS_BULK_EXAMPLES = [
12746
13260
  Output: { Code: "PipelineExecutionsBulk", Data: [] }
12747
13261
  }
12748
13262
  ];
12749
- var registerPipelineCommand = (program2) => {
12750
- const pipeline = program2.command("pipeline").description([
13263
+ var registerPipelineCommand = (program) => {
13264
+ const pipeline = program.command("pipeline").description([
12751
13265
  "Manage CICD pipelines — list, fetch, create, update, run, delete.",
12752
13266
  "",
12753
13267
  "**Important: `pipeline update <id> --file` is full-replace (HTTP PUT semantics)** and",
@@ -13393,8 +13907,8 @@ var LIST_EXAMPLES3 = [
13393
13907
  Output: { Code: "ProjectList", Data: [] }
13394
13908
  }
13395
13909
  ];
13396
- var registerProjectCommand = (program2) => {
13397
- const project = program2.command("project").description([
13910
+ var registerProjectCommand = (program) => {
13911
+ const project = program.command("project").description([
13398
13912
  "Inspect automation projects discovered through a SourceControl connection.",
13399
13913
  "",
13400
13914
  "Verbs target a project by its SC service UUID via `--project-id <id>`.",
@@ -13415,7 +13929,7 @@ var registerProjectCommand = (program2) => {
13415
13929
  "mistaken for a complete one. Only an all-connections failure is an error.",
13416
13930
  "Use `--log-level warn` for each connection's underlying error."
13417
13931
  ].join(`
13418
- `)).option("--connections <csv>", "Comma-separated connection identifiers to fan out to. Defaults to every visible connection.").option("--target-framework <name>", "Server-side filter on project target framework.").option("--project-type <type>", "Server-side filter on project type, for example Process, Library, Agent.").option("--offset <n>", "Number of projects to skip per connection. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum projects to return per connection. Defaults to 10. Raise it to fetch a bigger batch.", parsePositiveInt("--limit")).addOption(new Option("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on project name.").examples(LIST_EXAMPLES3)).trackedAction(processContext, async (options) => {
13932
+ `)).option("--connections <csv>", "Comma-separated connection identifiers to fan out to. Defaults to every visible connection.").option("--target-framework <name>", "Server-side filter on project target framework.").option("--project-type <type>", "Server-side filter on project type, for example Process, Library, Agent.").option("--offset <n>", "Number of projects to skip per connection. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum projects to return per connection. Defaults to 10. Raise it to fetch a bigger batch.", parsePositiveInt("--limit")).addOption(new Option2("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option2("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on project name.").examples(LIST_EXAMPLES3)).trackedAction(processContext, async (options) => {
13419
13933
  const connectionsApi = await getScApi(ConnectionsApi, options);
13420
13934
  if (!connectionsApi)
13421
13935
  return;
@@ -13675,7 +14189,7 @@ var registerProjectCommand = (program2) => {
13675
14189
  "`--offset` / `--limit` (`--offset` must be a multiple of `--limit`); `--search`",
13676
14190
  "does substring search on commit message."
13677
14191
  ].join(`
13678
- `)).requiredOption("--project-id <id>", "SC service UUID for the project, from `connection projects`.").option("--path <path>", "Filter the history to commits touching this path.").option("--branch <name>", "Filter the history to a specific branch. Defaults to the default branch.").option("--offset <n>", "Number of commits to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum commits to return. Defaults to 20.", parsePositiveInt("--limit")).addOption(new Option("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on commit message.").examples(COMMITS_EXAMPLES)).trackedAction(processContext, async (options) => {
14192
+ `)).requiredOption("--project-id <id>", "SC service UUID for the project, from `connection projects`.").option("--path <path>", "Filter the history to commits touching this path.").option("--branch <name>", "Filter the history to a specific branch. Defaults to the default branch.").option("--offset <n>", "Number of commits to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum commits to return. Defaults to 20.", parsePositiveInt("--limit")).addOption(new Option2("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option2("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on commit message.").examples(COMMITS_EXAMPLES)).trackedAction(processContext, async (options) => {
13679
14193
  const api = await getScApi(ProjectsApi, options);
13680
14194
  if (!api)
13681
14195
  return;
@@ -13799,8 +14313,8 @@ var PROJECT_FILES_EXAMPLES = [
13799
14313
  }
13800
14314
  }
13801
14315
  ];
13802
- var registerRepoCommand = (program2) => {
13803
- const repo = program2.command("repo").description([
14316
+ var registerRepoCommand = (program) => {
14317
+ const repo = program.command("repo").description([
13804
14318
  "Inspect repositories already linked to a SourceControl connection.",
13805
14319
  "",
13806
14320
  "Repositories are surfaced via `connection repos <connection-id>`. Once you have",
@@ -13893,8 +14407,8 @@ var COMMITS_EXAMPLES2 = [
13893
14407
  Output: { Code: "SolutionCommits", Data: { result: [] } }
13894
14408
  }
13895
14409
  ];
13896
- var registerSolutionCommand = (program2) => {
13897
- const solution = program2.command("solution").description([
14410
+ var registerSolutionCommand = (program) => {
14411
+ const solution = program.command("solution").description([
13898
14412
  "Inspect Studio solutions discovered through a SourceControl connection.",
13899
14413
  "",
13900
14414
  "Solutions are surfaced via `connection solutions <connection-id>`. Use `solution",
@@ -13947,7 +14461,7 @@ var registerSolutionCommand = (program2) => {
13947
14461
  "`--offset` / `--limit` (`--offset` must be a multiple of `--limit`); `--search`",
13948
14462
  "does substring search on commit message."
13949
14463
  ].join(`
13950
- `)).argument("<solution-id>", "Solution identifier from `connection solutions <connection-id>`.").option("--path <path>", "Filter the history to commits touching this path.").option("--branch <name>", "Filter the history to a specific branch. Defaults to the default branch.").option("--offset <n>", "Number of commits to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum commits to return. Defaults to 20.", parsePositiveInt("--limit")).addOption(new Option("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on commit message.").examples(COMMITS_EXAMPLES2)).trackedAction(processContext, async (solutionId, options) => {
14464
+ `)).argument("<solution-id>", "Solution identifier from `connection solutions <connection-id>`.").option("--path <path>", "Filter the history to commits touching this path.").option("--branch <name>", "Filter the history to a specific branch. Defaults to the default branch.").option("--offset <n>", "Number of commits to skip from the start. Must be a multiple of --limit. Defaults to 0.", parseNonNegativeInt("--offset")).option("--limit <n>", "Maximum commits to return. Defaults to 20.", parsePositiveInt("--limit")).addOption(new Option2("--skip <n>").hideHelp().argParser(parseNonNegativeInt("--skip"))).addOption(new Option2("--take <n>").hideHelp().argParser(parsePositiveInt("--take"))).option("--search <term>", "Server-side substring filter on commit message.").examples(COMMITS_EXAMPLES2)).trackedAction(processContext, async (solutionId, options) => {
13951
14465
  const api = await getScApi(SolutionsApi, options);
13952
14466
  if (!api)
13953
14467
  return;
@@ -14001,21 +14515,21 @@ var registerSolutionCommand = (program2) => {
14001
14515
  };
14002
14516
 
14003
14517
  // src/tool.ts
14004
- var metadata = {
14518
+ var metadata2 = {
14005
14519
  name: "aops-tool",
14006
14520
  version: package_default.version,
14007
14521
  description: "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
14008
14522
  commandPrefix: "aops"
14009
14523
  };
14010
- var registerCommands = async (program2) => {
14011
- registerConnectionCommand(program2);
14012
- registerRepoCommand(program2);
14013
- registerProjectCommand(program2);
14014
- registerSolutionCommand(program2);
14015
- registerPipelineCommand(program2);
14016
- registerExecutionCommand(program2);
14524
+ var registerCommands2 = async (program) => {
14525
+ registerConnectionCommand(program);
14526
+ registerRepoCommand(program);
14527
+ registerProjectCommand(program);
14528
+ registerSolutionCommand(program);
14529
+ registerPipelineCommand(program);
14530
+ registerExecutionCommand(program);
14017
14531
  };
14018
14532
 
14019
- export { Command, metadata, registerCommands };
14533
+ export { Command, metadata2, registerCommands2 };
14020
14534
 
14021
- //# debugId=6BC6D12477EEBD7A64756E2164756E21
14535
+ //# debugId=6E088F8FEE23B9DF64756E2164756E21