@uipath/ixp-tool 1.201.0 → 1.202.0-preview.136

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,23 +1,11 @@
1
- import {
2
- isBrowser
3
- } from "./tool-9qecd4wb.js";
4
- import {
5
- catchError,
6
- getFileSystem
7
- } from "./tool-7eva0peq.js";
8
- import {
9
- AUTH_FILENAME,
10
- DEFAULT_BASE_URL,
11
- UIPATH_HOME_DIR
12
- } from "./tool-5arsyj36.js";
13
1
  import {
14
2
  __commonJS,
15
3
  __require,
16
4
  __toESM
17
- } from "./tool-0v6na3yp.js";
5
+ } from "./tool-1de529jm.js";
18
6
 
19
7
  // ../../node_modules/commander/lib/error.js
20
- var require_error = __commonJS((exports) => {
8
+ var require_error = __commonJS(function(exports) {
21
9
  class CommanderError extends Error {
22
10
  constructor(exitCode, code, message) {
23
11
  super(message);
@@ -41,7 +29,7 @@ var require_error = __commonJS((exports) => {
41
29
  });
42
30
 
43
31
  // ../../node_modules/commander/lib/argument.js
44
- var require_argument = __commonJS((exports) => {
32
+ var require_argument = __commonJS(function(exports) {
45
33
  var { InvalidArgumentError } = require_error();
46
34
 
47
35
  class Argument {
@@ -121,7 +109,7 @@ var require_argument = __commonJS((exports) => {
121
109
  });
122
110
 
123
111
  // ../../node_modules/commander/lib/help.js
124
- var require_help = __commonJS((exports) => {
112
+ var require_help = __commonJS(function(exports) {
125
113
  var { humanReadableArgName } = require_argument();
126
114
 
127
115
  class Help {
@@ -478,7 +466,7 @@ ${itemIndentStr}`);
478
466
  });
479
467
 
480
468
  // ../../node_modules/commander/lib/option.js
481
- var require_option = __commonJS((exports) => {
469
+ var require_option = __commonJS(function(exports) {
482
470
  var { InvalidArgumentError } = require_error();
483
471
 
484
472
  class Option {
@@ -662,7 +650,7 @@ var require_option = __commonJS((exports) => {
662
650
  });
663
651
 
664
652
  // ../../node_modules/commander/lib/suggestSimilar.js
665
- var require_suggestSimilar = __commonJS((exports) => {
653
+ var require_suggestSimilar = __commonJS(function(exports) {
666
654
  var maxDistance = 3;
667
655
  function editDistance(a, b) {
668
656
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -735,11 +723,11 @@ var require_suggestSimilar = __commonJS((exports) => {
735
723
  });
736
724
 
737
725
  // ../../node_modules/commander/lib/command.js
738
- var require_command = __commonJS((exports) => {
726
+ var require_command = __commonJS(function(exports) {
739
727
  var EventEmitter = __require("node:events").EventEmitter;
740
728
  var childProcess = __require("node:child_process");
741
- var path = __require("node:path");
742
- var fs = __require("node:fs");
729
+ var path2 = __require("node:path");
730
+ var fs2 = __require("node:fs");
743
731
  var process2 = __require("node:process");
744
732
  var { Argument, humanReadableArgName } = require_argument();
745
733
  var { CommanderError } = require_error();
@@ -1274,7 +1262,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1274
1262
  this.processedArgs = [];
1275
1263
  }
1276
1264
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
1277
- if (fs.existsSync(executableFile))
1265
+ if (fs2.existsSync(executableFile))
1278
1266
  return;
1279
1267
  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";
1280
1268
  const executableMissing = `'${executableFile}' does not exist
@@ -1288,12 +1276,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
1288
1276
  let launchWithNode = false;
1289
1277
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1290
1278
  function findFile(baseDir, baseName) {
1291
- const localBin = path.resolve(baseDir, baseName);
1292
- if (fs.existsSync(localBin))
1279
+ const localBin = path2.resolve(baseDir, baseName);
1280
+ if (fs2.existsSync(localBin))
1293
1281
  return localBin;
1294
- if (sourceExt.includes(path.extname(baseName)))
1282
+ if (sourceExt.includes(path2.extname(baseName)))
1295
1283
  return;
1296
- const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
1284
+ const foundExt = sourceExt.find((ext) => fs2.existsSync(`${localBin}${ext}`));
1297
1285
  if (foundExt)
1298
1286
  return `${localBin}${foundExt}`;
1299
1287
  return;
@@ -1305,23 +1293,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1305
1293
  if (this._scriptPath) {
1306
1294
  let resolvedScriptPath;
1307
1295
  try {
1308
- resolvedScriptPath = fs.realpathSync(this._scriptPath);
1296
+ resolvedScriptPath = fs2.realpathSync(this._scriptPath);
1309
1297
  } catch {
1310
1298
  resolvedScriptPath = this._scriptPath;
1311
1299
  }
1312
- executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
1300
+ executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
1313
1301
  }
1314
1302
  if (executableDir) {
1315
1303
  let localFile = findFile(executableDir, executableFile);
1316
1304
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1317
- const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
1305
+ const legacyName = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
1318
1306
  if (legacyName !== this._name) {
1319
1307
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
1320
1308
  }
1321
1309
  }
1322
1310
  executableFile = localFile || executableFile;
1323
1311
  }
1324
- launchWithNode = sourceExt.includes(path.extname(executableFile));
1312
+ launchWithNode = sourceExt.includes(path2.extname(executableFile));
1325
1313
  let proc;
1326
1314
  if (process2.platform !== "win32") {
1327
1315
  if (launchWithNode) {
@@ -1910,13 +1898,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1910
1898
  cmd.helpGroup(this._defaultCommandGroup);
1911
1899
  }
1912
1900
  nameFromFilename(filename) {
1913
- this._name = path.basename(filename, path.extname(filename));
1901
+ this._name = path2.basename(filename, path2.extname(filename));
1914
1902
  return this;
1915
1903
  }
1916
- executableDir(path2) {
1917
- if (path2 === undefined)
1904
+ executableDir(path3) {
1905
+ if (path3 === undefined)
1918
1906
  return this._executableDir;
1919
- this._executableDir = path2;
1907
+ this._executableDir = path3;
1920
1908
  return this;
1921
1909
  }
1922
1910
  helpInformation(contextOptions) {
@@ -2090,7 +2078,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2090
2078
  });
2091
2079
 
2092
2080
  // ../../node_modules/commander/index.js
2093
- var require_commander = __commonJS((exports) => {
2081
+ var require_commander = __commonJS(function(exports) {
2094
2082
  var { Argument } = require_argument();
2095
2083
  var { Command } = require_command();
2096
2084
  var { CommanderError, InvalidArgumentError } = require_error();
@@ -2112,7 +2100,7 @@ var require_commander = __commonJS((exports) => {
2112
2100
  var package_default = {
2113
2101
  name: "@uipath/ixp-tool",
2114
2102
  license: "MIT",
2115
- version: "1.201.0",
2103
+ version: "1.202.0-preview.136",
2116
2104
  description: "Manage UiPath IXP projects, prompts, predictions, and model publishing.",
2117
2105
  private: false,
2118
2106
  repository: {
@@ -2155,11 +2143,753 @@ var package_default = {
2155
2143
  }
2156
2144
  };
2157
2145
 
2146
+ // ../filesystem/src/node.ts
2147
+ import { randomUUID } from "node:crypto";
2148
+ import { existsSync } from "node:fs";
2149
+ import * as fs from "node:fs/promises";
2150
+ import * as os from "node:os";
2151
+ import * as path from "node:path";
2152
+ var LOCK_HEARTBEAT_MS = 5000;
2153
+ var LOCK_STALE_MS = 15000;
2154
+ var LOCK_MAX_WAIT_MS = 20000;
2155
+ var LOCK_MAX_HOLD_MS = 60000;
2156
+ var LOCK_RETRY_MIN_MS = 100;
2157
+ var LOCK_RETRY_JITTER_MS = 200;
2158
+
2159
+ class NodeFileSystem {
2160
+ path = {
2161
+ join: path.join,
2162
+ resolve: path.resolve,
2163
+ relative: path.relative,
2164
+ dirname: path.dirname,
2165
+ isAbsolute: path.isAbsolute,
2166
+ basename: path.basename
2167
+ };
2168
+ env = {
2169
+ cwd: process.cwd,
2170
+ homedir: os.homedir,
2171
+ tmpdir: os.tmpdir,
2172
+ getenv: (key) => process.env[key]
2173
+ };
2174
+ utils = {
2175
+ open: async (url) => {
2176
+ const { default: open } = await import("./index-sby22td6.js");
2177
+ await open(url);
2178
+ }
2179
+ };
2180
+ async readFile(path2, options) {
2181
+ try {
2182
+ if (options) {
2183
+ return await fs.readFile(path2, "utf-8");
2184
+ }
2185
+ return await fs.readFile(path2);
2186
+ } catch (error) {
2187
+ if (this.isEnoent(error))
2188
+ return null;
2189
+ throw error;
2190
+ }
2191
+ }
2192
+ async writeFile(filePath, data) {
2193
+ const dir = path.dirname(filePath);
2194
+ if (dir) {
2195
+ await fs.mkdir(dir, { recursive: true });
2196
+ }
2197
+ await fs.writeFile(filePath, data);
2198
+ }
2199
+ async appendFile(filePath, data) {
2200
+ const dir = path.dirname(filePath);
2201
+ if (dir) {
2202
+ await fs.mkdir(dir, { recursive: true });
2203
+ }
2204
+ await fs.appendFile(filePath, data);
2205
+ }
2206
+ async readdir(dirPath) {
2207
+ try {
2208
+ return await fs.readdir(dirPath);
2209
+ } catch (error) {
2210
+ if (this.isEnoent(error))
2211
+ return [];
2212
+ throw error;
2213
+ }
2214
+ }
2215
+ async stat(filePath) {
2216
+ try {
2217
+ const stats = await fs.stat(filePath);
2218
+ return {
2219
+ isFile: () => stats.isFile(),
2220
+ isDirectory: () => stats.isDirectory(),
2221
+ size: stats.size,
2222
+ mtimeMs: stats.mtimeMs
2223
+ };
2224
+ } catch (error) {
2225
+ if (this.isEnoent(error))
2226
+ return null;
2227
+ throw error;
2228
+ }
2229
+ }
2230
+ async exists(filePath) {
2231
+ return existsSync(filePath);
2232
+ }
2233
+ async mkdir(dirPath) {
2234
+ await fs.mkdir(dirPath, { recursive: true });
2235
+ }
2236
+ async acquireLock(lockPath) {
2237
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
2238
+ const lockFile = `${canonicalPath}.lock`;
2239
+ const ownerId = randomUUID();
2240
+ const start = Date.now();
2241
+ while (true) {
2242
+ try {
2243
+ await fs.writeFile(lockFile, ownerId, { flag: "wx" });
2244
+ return this.createLockRelease(lockFile, ownerId);
2245
+ } catch (error) {
2246
+ if (!this.hasErrnoCode(error, "EEXIST")) {
2247
+ throw error;
2248
+ }
2249
+ const stats = await fs.stat(lockFile).catch(() => null);
2250
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
2251
+ const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
2252
+ if (reclaimed)
2253
+ continue;
2254
+ }
2255
+ if (Date.now() - start > LOCK_MAX_WAIT_MS) {
2256
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
2257
+ }
2258
+ await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
2259
+ }
2260
+ }
2261
+ }
2262
+ async canonicalizeLockTarget(lockPath) {
2263
+ const absolute = path.resolve(lockPath);
2264
+ const fullReal = await fs.realpath(absolute).catch(() => null);
2265
+ if (fullReal)
2266
+ return fullReal;
2267
+ const parent = path.dirname(absolute);
2268
+ const base = path.basename(absolute);
2269
+ const canonicalParent = await fs.realpath(parent).catch(() => parent);
2270
+ return path.join(canonicalParent, base);
2271
+ }
2272
+ createLockRelease(lockFile, ownerId) {
2273
+ const heartbeatStart = Date.now();
2274
+ let heartbeatTimer;
2275
+ let stopped = false;
2276
+ const stopHeartbeat = () => {
2277
+ stopped = true;
2278
+ if (heartbeatTimer)
2279
+ clearTimeout(heartbeatTimer);
2280
+ };
2281
+ const scheduleNextHeartbeat = () => {
2282
+ if (stopped)
2283
+ return;
2284
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
2285
+ stopped = true;
2286
+ return;
2287
+ }
2288
+ heartbeatTimer = setTimeout(() => {
2289
+ runHeartbeat();
2290
+ }, LOCK_HEARTBEAT_MS);
2291
+ heartbeatTimer.unref?.();
2292
+ };
2293
+ const runHeartbeat = async () => {
2294
+ if (stopped)
2295
+ return;
2296
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2297
+ if (stopped)
2298
+ return;
2299
+ if (current !== ownerId) {
2300
+ stopped = true;
2301
+ return;
2302
+ }
2303
+ const now = Date.now() / 1000;
2304
+ await fs.utimes(lockFile, now, now).catch(() => {});
2305
+ scheduleNextHeartbeat();
2306
+ };
2307
+ scheduleNextHeartbeat();
2308
+ let released = false;
2309
+ return async () => {
2310
+ if (released)
2311
+ return;
2312
+ released = true;
2313
+ stopHeartbeat();
2314
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2315
+ if (current === ownerId) {
2316
+ await fs.rm(lockFile, { force: true });
2317
+ }
2318
+ };
2319
+ }
2320
+ async rm(filePath) {
2321
+ await fs.rm(filePath, { recursive: true, force: true });
2322
+ }
2323
+ async rename(oldPath, newPath) {
2324
+ await fs.rename(oldPath, newPath);
2325
+ }
2326
+ async realpath(filePath) {
2327
+ try {
2328
+ return await fs.realpath(filePath);
2329
+ } catch (error) {
2330
+ if (this.isEnoent(error))
2331
+ return filePath;
2332
+ throw error;
2333
+ }
2334
+ }
2335
+ async getTempDir() {
2336
+ return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
2337
+ }
2338
+ async copyDirectory(sourcePath, destPath) {
2339
+ const sourceStats = await this.stat(sourcePath);
2340
+ if (!sourceStats) {
2341
+ throw new Error(`Source directory does not exist: ${sourcePath}`);
2342
+ }
2343
+ if (!sourceStats.isDirectory()) {
2344
+ throw new Error(`Source path is not a directory: ${sourcePath}`);
2345
+ }
2346
+ await this.mkdir(destPath);
2347
+ const entries = await this.readdir(sourcePath);
2348
+ for (const entry of entries) {
2349
+ const srcEntry = path.join(sourcePath, entry);
2350
+ const destEntry = path.join(destPath, entry);
2351
+ const entryStats = await this.stat(srcEntry);
2352
+ if (!entryStats)
2353
+ continue;
2354
+ if (entryStats.isDirectory()) {
2355
+ await this.copyDirectory(srcEntry, destEntry);
2356
+ } else if (entryStats.isFile()) {
2357
+ const content = await this.readFile(srcEntry);
2358
+ if (content !== null) {
2359
+ await this.writeFile(destEntry, content);
2360
+ }
2361
+ }
2362
+ }
2363
+ }
2364
+ isEnoent(error) {
2365
+ return this.hasErrnoCode(error, "ENOENT");
2366
+ }
2367
+ hasErrnoCode(error, code) {
2368
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
2369
+ }
2370
+ }
2371
+
2372
+ // ../filesystem/src/index.ts
2373
+ var fsInstance = new NodeFileSystem;
2374
+ var getFileSystem = () => fsInstance;
2375
+
2376
+ // ../common/src/telemetry/pseudonymize.ts
2377
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
2378
+ var PSEUDONYM_HEX_LENGTH = 32;
2379
+ var SHA256_K = new Uint32Array([
2380
+ 1116352408,
2381
+ 1899447441,
2382
+ 3049323471,
2383
+ 3921009573,
2384
+ 961987163,
2385
+ 1508970993,
2386
+ 2453635748,
2387
+ 2870763221,
2388
+ 3624381080,
2389
+ 310598401,
2390
+ 607225278,
2391
+ 1426881987,
2392
+ 1925078388,
2393
+ 2162078206,
2394
+ 2614888103,
2395
+ 3248222580,
2396
+ 3835390401,
2397
+ 4022224774,
2398
+ 264347078,
2399
+ 604807628,
2400
+ 770255983,
2401
+ 1249150122,
2402
+ 1555081692,
2403
+ 1996064986,
2404
+ 2554220882,
2405
+ 2821834349,
2406
+ 2952996808,
2407
+ 3210313671,
2408
+ 3336571891,
2409
+ 3584528711,
2410
+ 113926993,
2411
+ 338241895,
2412
+ 666307205,
2413
+ 773529912,
2414
+ 1294757372,
2415
+ 1396182291,
2416
+ 1695183700,
2417
+ 1986661051,
2418
+ 2177026350,
2419
+ 2456956037,
2420
+ 2730485921,
2421
+ 2820302411,
2422
+ 3259730800,
2423
+ 3345764771,
2424
+ 3516065817,
2425
+ 3600352804,
2426
+ 4094571909,
2427
+ 275423344,
2428
+ 430227734,
2429
+ 506948616,
2430
+ 659060556,
2431
+ 883997877,
2432
+ 958139571,
2433
+ 1322822218,
2434
+ 1537002063,
2435
+ 1747873779,
2436
+ 1955562222,
2437
+ 2024104815,
2438
+ 2227730452,
2439
+ 2361852424,
2440
+ 2428436474,
2441
+ 2756734187,
2442
+ 3204031479,
2443
+ 3329325298
2444
+ ]);
2445
+ var SHA256_INITIAL_STATE = new Uint32Array([
2446
+ 1779033703,
2447
+ 3144134277,
2448
+ 1013904242,
2449
+ 2773480762,
2450
+ 1359893119,
2451
+ 2600822924,
2452
+ 528734635,
2453
+ 1541459225
2454
+ ]);
2455
+ function rotr(value, bits) {
2456
+ return (value >>> bits | value << 32 - bits) >>> 0;
2457
+ }
2458
+ function sha256Hex(input) {
2459
+ const bytes = new TextEncoder().encode(input);
2460
+ const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
2461
+ const buffer = new Uint8Array(paddedLength);
2462
+ buffer.set(bytes);
2463
+ buffer[bytes.length] = 128;
2464
+ const view = new DataView(buffer.buffer);
2465
+ const bitLength = bytes.length * 8;
2466
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
2467
+ view.setUint32(paddedLength - 4, bitLength >>> 0);
2468
+ const state = SHA256_INITIAL_STATE.slice();
2469
+ const schedule = new Uint32Array(64);
2470
+ for (let offset = 0;offset < paddedLength; offset += 64) {
2471
+ for (let i = 0;i < 16; i++) {
2472
+ schedule[i] = view.getUint32(offset + i * 4);
2473
+ }
2474
+ for (let i = 16;i < 64; i++) {
2475
+ const x = schedule[i - 15];
2476
+ const y = schedule[i - 2];
2477
+ const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3) >>> 0;
2478
+ const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ y >>> 10) >>> 0;
2479
+ schedule[i] = schedule[i - 16] + s0 + schedule[i - 7] + s1 >>> 0;
2480
+ }
2481
+ let a = state[0];
2482
+ let b = state[1];
2483
+ let c = state[2];
2484
+ let d = state[3];
2485
+ let e = state[4];
2486
+ let f = state[5];
2487
+ let g = state[6];
2488
+ let h = state[7];
2489
+ for (let i = 0;i < 64; i++) {
2490
+ const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
2491
+ const ch = (e & f ^ ~e & g) >>> 0;
2492
+ const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
2493
+ const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
2494
+ const maj = (a & b ^ a & c ^ b & c) >>> 0;
2495
+ const temp2 = s0 + maj >>> 0;
2496
+ h = g;
2497
+ g = f;
2498
+ f = e;
2499
+ e = d + temp1 >>> 0;
2500
+ d = c;
2501
+ c = b;
2502
+ b = a;
2503
+ a = temp1 + temp2 >>> 0;
2504
+ }
2505
+ state[0] = state[0] + a >>> 0;
2506
+ state[1] = state[1] + b >>> 0;
2507
+ state[2] = state[2] + c >>> 0;
2508
+ state[3] = state[3] + d >>> 0;
2509
+ state[4] = state[4] + e >>> 0;
2510
+ state[5] = state[5] + f >>> 0;
2511
+ state[6] = state[6] + g >>> 0;
2512
+ state[7] = state[7] + h >>> 0;
2513
+ }
2514
+ let hex = "";
2515
+ for (const word of state) {
2516
+ hex += word.toString(16).padStart(8, "0");
2517
+ }
2518
+ return hex;
2519
+ }
2520
+ function resolveSha256Hex() {
2521
+ try {
2522
+ const nodeCrypto = __require("node:crypto");
2523
+ const createHash = nodeCrypto?.createHash;
2524
+ if (typeof createHash !== "function") {
2525
+ return sha256Hex;
2526
+ }
2527
+ const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
2528
+ return native("abc") === sha256Hex("abc") ? native : sha256Hex;
2529
+ } catch {
2530
+ return sha256Hex;
2531
+ }
2532
+ }
2533
+ var cachedSha256Hex;
2534
+ function digest(input) {
2535
+ cachedSha256Hex ??= resolveSha256Hex();
2536
+ return cachedSha256Hex(input);
2537
+ }
2538
+ function pseudonymize(input) {
2539
+ return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
2540
+ }
2541
+
2542
+ // ../common/src/singleton.ts
2543
+ var PREFIX = "@uipath/common/";
2544
+ var _g = globalThis;
2545
+ function singleton(ctorOrName) {
2546
+ const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
2547
+ const key = Symbol.for(PREFIX + name);
2548
+ return {
2549
+ get(fallback) {
2550
+ return _g[key] ?? fallback;
2551
+ },
2552
+ set(value) {
2553
+ _g[key] = value;
2554
+ },
2555
+ clear() {
2556
+ delete _g[key];
2557
+ },
2558
+ getOrInit(factory, guard) {
2559
+ const existing = _g[key];
2560
+ if (existing != null && typeof existing === "object") {
2561
+ if (!guard || guard(existing)) {
2562
+ return existing;
2563
+ }
2564
+ }
2565
+ const instance = factory();
2566
+ _g[key] = instance;
2567
+ return instance;
2568
+ }
2569
+ };
2570
+ }
2571
+
2572
+ // ../common/src/telemetry/supplied-values.ts
2573
+ var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
2574
+ function activeEntries() {
2575
+ const existing = suppliedValuesSlot.get();
2576
+ return Array.isArray(existing) ? existing : [];
2577
+ }
2578
+ var MIN_SCRUBBABLE_LENGTH = 4;
2579
+ function recordSuppliedArgumentValues(values) {
2580
+ const flat = [];
2581
+ const push = (value) => {
2582
+ if (Array.isArray(value)) {
2583
+ for (const item of value) {
2584
+ push(item);
2585
+ }
2586
+ return;
2587
+ }
2588
+ if (typeof value === "string" && value.length >= MIN_SCRUBBABLE_LENGTH) {
2589
+ flat.push(value);
2590
+ }
2591
+ };
2592
+ push(values);
2593
+ const entry = { values: flat };
2594
+ suppliedValuesSlot.set([...activeEntries(), entry]);
2595
+ return entry;
2596
+ }
2597
+ function releaseSuppliedArgumentValues(entry) {
2598
+ suppliedValuesSlot.set(activeEntries().filter((held) => held !== entry));
2599
+ }
2600
+ function getSuppliedArgumentValues() {
2601
+ const all = new Set;
2602
+ for (const entry of activeEntries()) {
2603
+ for (const value of entry.values) {
2604
+ all.add(value);
2605
+ }
2606
+ }
2607
+ return [...all].sort((a, b) => b.length - a.length);
2608
+ }
2609
+
2610
+ // ../common/src/telemetry/pii-redactor.ts
2611
+ var REDACTED = "[REDACTED]";
2612
+ var MAX_VALUE_LENGTH = 280;
2613
+ var MAX_STACK_LENGTH = 4096;
2614
+ var MAX_SCAN_LENGTH = MAX_STACK_LENGTH;
2615
+ function truncate(value, maxLength) {
2616
+ return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
2617
+ }
2618
+ var SENSITIVE_NAME_TOKENS = new Set([
2619
+ "token",
2620
+ "tokens",
2621
+ "secret",
2622
+ "secrets",
2623
+ "password",
2624
+ "passwords",
2625
+ "pwd",
2626
+ "credential",
2627
+ "credentials",
2628
+ "auth",
2629
+ "authentication",
2630
+ "authorization",
2631
+ "authority",
2632
+ "cert",
2633
+ "certificate",
2634
+ "certificates"
2635
+ ]);
2636
+ var SENSITIVE_KEY_PREFIXES = new Set([
2637
+ "api",
2638
+ "access",
2639
+ "client",
2640
+ "private",
2641
+ "public",
2642
+ "signing",
2643
+ "encryption",
2644
+ "session",
2645
+ "master",
2646
+ "shared",
2647
+ "root",
2648
+ "ssh",
2649
+ "rsa",
2650
+ "aes",
2651
+ "hmac",
2652
+ "oauth"
2653
+ ]);
2654
+ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
2655
+ var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
2656
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
2657
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
2658
+ var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2659
+ var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
2660
+ var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
2661
+ var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
2662
+ var HOST_PORT_PATTERN = /(?<![/@.\w-])(?!\d+\.\d+\.\d+\.\d+:)[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+:\d{1,5}\b/g;
2663
+ var SOURCE_FILE_EXTENSIONS = new Set([
2664
+ "ts",
2665
+ "tsx",
2666
+ "js",
2667
+ "jsx",
2668
+ "mjs",
2669
+ "cjs",
2670
+ "cts",
2671
+ "mts",
2672
+ "py",
2673
+ "cs",
2674
+ "java",
2675
+ "go",
2676
+ "rs",
2677
+ "rb",
2678
+ "php",
2679
+ "sh",
2680
+ "ps1",
2681
+ "json",
2682
+ "jsonc",
2683
+ "yaml",
2684
+ "yml",
2685
+ "xml",
2686
+ "xaml",
2687
+ "md",
2688
+ "txt",
2689
+ "log",
2690
+ "css",
2691
+ "html",
2692
+ "htm",
2693
+ "csproj",
2694
+ "nuspec",
2695
+ "sql"
2696
+ ]);
2697
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
2698
+ var QUOTED_LITERAL_MAX_SPAN = 200;
2699
+ var QUOTED_LITERAL_PATTERN = new RegExp([
2700
+ `(?<![A-Za-z0-9])'(?:[^\\
2701
+ ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?'(?![A-Za-z0-9])`,
2702
+ `(?<![A-Za-z0-9])"(?:[^\\
2703
+ ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
2704
+ ].join("|"), "g");
2705
+ var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
2706
+ var COLLAPSED_BODY = "{…}";
2707
+ var COLLAPSED_BODY_MARKER = "\x01body\x01";
2708
+ var MAX_BODY_NESTING = 8;
2709
+ function collapseJsonBodies(text) {
2710
+ let out = text;
2711
+ for (let pass = 0;pass < MAX_BODY_NESTING; pass++) {
2712
+ const next = out.replace(JSON_BODY_PATTERN, COLLAPSED_BODY_MARKER);
2713
+ if (next === out) {
2714
+ break;
2715
+ }
2716
+ out = next;
2717
+ }
2718
+ return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
2719
+ }
2720
+ var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
2721
+ function peelTrailingPunctuation(match) {
2722
+ const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
2723
+ return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
2724
+ }
2725
+ function redactUrl(raw) {
2726
+ try {
2727
+ const url = new URL(raw);
2728
+ return `${url.protocol}//${url.host}`;
2729
+ } catch {
2730
+ return `url#${pseudonymize(raw)}`;
2731
+ }
2732
+ }
2733
+ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
2734
+ let out = truncate(value, MAX_SCAN_LENGTH);
2735
+ out = out.replace(JWT_PATTERN, () => REDACTED);
2736
+ out = out.replace(URL_PATTERN, (match) => {
2737
+ const [core, trailing] = peelTrailingPunctuation(match);
2738
+ return `${redactUrl(core)}${trailing}`;
2739
+ });
2740
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
2741
+ out = out.replace(UNC_PATH_PATTERN, (_match, before, path2) => {
2742
+ const [core, trailing] = peelTrailingPunctuation(path2);
2743
+ return `${before}unc#${pseudonymize(core)}${trailing}`;
2744
+ });
2745
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
2746
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${pseudonymize(match)}`);
2747
+ out = out.replace(HOST_PORT_PATTERN, (match) => {
2748
+ const split = match.lastIndexOf(":");
2749
+ const host = match.slice(0, split);
2750
+ const extension = host.slice(host.lastIndexOf(".") + 1).toLowerCase();
2751
+ if (SOURCE_FILE_EXTENSIONS.has(extension)) {
2752
+ return match;
2753
+ }
2754
+ return `host#${pseudonymize(host)}:${match.slice(split + 1)}`;
2755
+ });
2756
+ out = out.replace(PADDED_BASE64_PATTERN, () => REDACTED);
2757
+ out = out.replace(BASE64_WITH_PLUS_PATTERN, (match) => match.includes("+") ? REDACTED : match);
2758
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
2759
+ return truncate(out, maxLength);
2760
+ }
2761
+ function redactSpanName(name) {
2762
+ return redactValueDetectors(truncate(name, MAX_SCAN_LENGTH).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`));
2763
+ }
2764
+ var HTTP_DEPENDENCY_NAME = /^([A-Z]+) (\/.*)$/s;
2765
+ function redactHttpDependencyName(name) {
2766
+ const parts = HTTP_DEPENDENCY_NAME.exec(name);
2767
+ if (!parts) {
2768
+ return redactMessage(name);
2769
+ }
2770
+ return `${parts[1]} ${redactMessage(parts[2])}`;
2771
+ }
2772
+ function redactMessage(value) {
2773
+ let out = collapseJsonBodies(truncate(value, MAX_SCAN_LENGTH)).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`);
2774
+ for (const supplied of getSuppliedArgumentValues()) {
2775
+ out = out.split(supplied).join(REDACTED);
2776
+ }
2777
+ return redactValueDetectors(out);
2778
+ }
2779
+ var MESSAGE_NAMES = new Set([
2780
+ "message",
2781
+ "errormessage",
2782
+ "errmessage",
2783
+ "error_message",
2784
+ "msg",
2785
+ "detail",
2786
+ "details",
2787
+ "reason",
2788
+ "instructions",
2789
+ "warning"
2790
+ ]);
2791
+ function isFreeFormValue(name, value) {
2792
+ return MESSAGE_NAMES.has(name.toLowerCase()) || /['"{[]/.test(value);
2793
+ }
2794
+ function redactError(error) {
2795
+ const safe = new Error(redactMessage(error.message ?? ""));
2796
+ safe.name = error.name;
2797
+ safe.stack = typeof error.stack === "string" ? redactStack(error.stack) : undefined;
2798
+ return safe;
2799
+ }
2800
+ function redactStack(stack) {
2801
+ const bounded = truncate(stack, MAX_STACK_LENGTH);
2802
+ const firstBreak = bounded.indexOf(`
2803
+ `);
2804
+ if (firstBreak === -1) {
2805
+ return redactMessage(bounded);
2806
+ }
2807
+ return `${redactMessage(bounded.slice(0, firstBreak))}
2808
+ ${redactValueDetectors(bounded.slice(firstBreak + 1), MAX_STACK_LENGTH)}`;
2809
+ }
2810
+ function nameTokens(name) {
2811
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
2812
+ }
2813
+ function isSensitiveName(name) {
2814
+ const tokens = nameTokens(name);
2815
+ for (let i = 0;i < tokens.length; i++) {
2816
+ const token = tokens[i];
2817
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
2818
+ return true;
2819
+ }
2820
+ if (token === "key" || token === "keys") {
2821
+ const prev = tokens[i - 1];
2822
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
2823
+ return true;
2824
+ }
2825
+ }
2826
+ }
2827
+ return false;
2828
+ }
2829
+ function redactProperty(name, value) {
2830
+ if (value === undefined || value === null) {
2831
+ return;
2832
+ }
2833
+ if (isSensitiveName(name)) {
2834
+ return REDACTED;
2835
+ }
2836
+ if (typeof value === "boolean" || typeof value === "number") {
2837
+ return value;
2838
+ }
2839
+ if (typeof value !== "string") {
2840
+ return "[OBJECT]";
2841
+ }
2842
+ return isFreeFormValue(name, value) ? redactMessage(value) : redactValueDetectors(value);
2843
+ }
2844
+ function redactProperties(properties) {
2845
+ const out = {};
2846
+ for (const [name, value] of Object.entries(properties)) {
2847
+ const redacted = redactProperty(name, value);
2848
+ if (redacted !== undefined) {
2849
+ out[name] = redacted;
2850
+ }
2851
+ }
2852
+ return out;
2853
+ }
2854
+
2158
2855
  // ../common/src/catch-error.ts
2856
+ var MAX_SERIALIZED_LENGTH = 500;
2857
+ var TRUNCATION_SUFFIX = "…(truncated)";
2858
+ var REDACTED2 = "[REDACTED]";
2859
+ function cap(text) {
2860
+ return text.length > MAX_SERIALIZED_LENGTH ? `${text.slice(0, MAX_SERIALIZED_LENGTH)}${TRUNCATION_SUFFIX}` : text;
2861
+ }
2862
+ function omitSensitive(key, value) {
2863
+ return key.length > 0 && isSensitiveName(key) ? REDACTED2 : value;
2864
+ }
2865
+ function describeThrownValue(value) {
2866
+ if (typeof value !== "object" || value === null) {
2867
+ return String(value);
2868
+ }
2869
+ let message;
2870
+ try {
2871
+ message = value.message;
2872
+ } catch {
2873
+ message = undefined;
2874
+ }
2875
+ if (typeof message === "string" && message.length > 0) {
2876
+ return cap(message);
2877
+ }
2878
+ try {
2879
+ const json = JSON.stringify(value, omitSensitive);
2880
+ if (json !== undefined) {
2881
+ return cap(json);
2882
+ }
2883
+ } catch {}
2884
+ return String(value);
2885
+ }
2886
+ function toError(error) {
2887
+ return error instanceof Error ? error : new Error(describeThrownValue(error), { cause: error });
2888
+ }
2159
2889
  function isPromiseLike(value) {
2160
2890
  return value !== null && typeof value === "object" && typeof value.then === "function";
2161
2891
  }
2162
- function catchError2(fnOrPromise) {
2892
+ function catchError(fnOrPromise) {
2163
2893
  if (isPromiseLike(fnOrPromise)) {
2164
2894
  return settlePromiseLike(fnOrPromise);
2165
2895
  }
@@ -2170,17 +2900,11 @@ function catchError2(fnOrPromise) {
2170
2900
  }
2171
2901
  return [undefined, result];
2172
2902
  } catch (error) {
2173
- return [
2174
- error instanceof Error ? error : new Error(String(error)),
2175
- undefined
2176
- ];
2903
+ return [toError(error), undefined];
2177
2904
  }
2178
2905
  }
2179
2906
  function settlePromiseLike(thenable) {
2180
- return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
2181
- error instanceof Error ? error : new Error(String(error)),
2182
- undefined
2183
- ]);
2907
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2184
2908
  }
2185
2909
 
2186
2910
  // ../common/src/error-handler.ts
@@ -2214,8 +2938,8 @@ var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most
2214
2938
  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.";
2215
2939
  var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2216
2940
  var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2217
- function localPermissionInstructions(code, path) {
2218
- const target = path !== undefined ? `'${path}'` : "a local file or resource";
2941
+ function localPermissionInstructions(code, path2) {
2942
+ const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
2219
2943
  if (code === "EROFS") {
2220
2944
  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.";
2221
2945
  }
@@ -2251,12 +2975,12 @@ function describePermissionError(error) {
2251
2975
  const code = matchLocalPermissionCode(cur.code, message);
2252
2976
  if (!code)
2253
2977
  continue;
2254
- const path = localPermissionPath(cur.path, message);
2978
+ const path2 = localPermissionPath(cur.path, message);
2255
2979
  return {
2256
2980
  code,
2257
2981
  message: message ?? code,
2258
- ...path !== undefined ? { path } : {},
2259
- instructions: localPermissionInstructions(code, path)
2982
+ ...path2 !== undefined ? { path: path2 } : {},
2983
+ instructions: localPermissionInstructions(code, path2)
2260
2984
  };
2261
2985
  }
2262
2986
  return;
@@ -2268,9 +2992,9 @@ function matchLocalPermissionCode(code, message) {
2268
2992
  const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
2269
2993
  return match ? match[1] : undefined;
2270
2994
  }
2271
- function localPermissionPath(path, message) {
2272
- if (typeof path === "string")
2273
- return path;
2995
+ function localPermissionPath(path2, message) {
2996
+ if (typeof path2 === "string")
2997
+ return path2;
2274
2998
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2275
2999
  }
2276
3000
  function* walkErrorGraph(error) {
@@ -2379,10 +3103,10 @@ async function extractErrorDetails(error, options) {
2379
3103
  let parsedBody;
2380
3104
  const textFn = response?.text?.bind(response);
2381
3105
  if (textFn) {
2382
- const [bodyError, body] = await catchError2((async () => textFn())());
3106
+ const [bodyError, body] = await catchError((async () => textFn())());
2383
3107
  if (!bodyError && body) {
2384
3108
  rawBody = body;
2385
- const [parseError, parsed] = catchError2(() => JSON.parse(body));
3109
+ const [parseError, parsed] = catchError(() => JSON.parse(body));
2386
3110
  if (!parseError && parsed && typeof parsed === "object") {
2387
3111
  parsedBody = parsed;
2388
3112
  if (parsedBody.errors && typeof parsedBody.errors === "object") {
@@ -2485,7 +3209,7 @@ async function extractErrorDetails(error, options) {
2485
3209
  } else if (typeof err.message === "string") {
2486
3210
  details = err.message;
2487
3211
  } else {
2488
- details = String(error);
3212
+ details = describeThrownValue(error);
2489
3213
  }
2490
3214
  const context = {};
2491
3215
  if (status) {
@@ -2557,73 +3281,14 @@ async function extractErrorDetails(error, options) {
2557
3281
  ...parsedErrors ? { parsedErrors } : {}
2558
3282
  };
2559
3283
  }
2560
- // ../../node_modules/commander/esm.mjs
2561
- var import__ = __toESM(require_commander(), 1);
2562
- var {
2563
- program,
2564
- createCommand,
2565
- createArgument,
2566
- createOption,
2567
- CommanderError,
2568
- InvalidArgumentError,
2569
- InvalidOptionArgumentError,
2570
- Command,
2571
- Argument,
2572
- Option,
2573
- Help
2574
- } = import__.default;
2575
-
2576
- // ../common/src/command-examples.ts
2577
- var examplesByCommand = new WeakMap;
2578
- Command.prototype.examples = function(examples) {
2579
- examplesByCommand.set(this, examples);
2580
- return this;
2581
- };
2582
- // ../common/src/singleton.ts
2583
- var PREFIX = "@uipath/common/";
2584
- var _g = globalThis;
2585
- function singleton(ctorOrName) {
2586
- const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
2587
- const key = Symbol.for(PREFIX + name);
2588
- return {
2589
- get(fallback) {
2590
- return _g[key] ?? fallback;
2591
- },
2592
- set(value) {
2593
- _g[key] = value;
2594
- },
2595
- clear() {
2596
- delete _g[key];
2597
- },
2598
- getOrInit(factory, guard) {
2599
- const existing = _g[key];
2600
- if (existing != null && typeof existing === "object") {
2601
- if (!guard || guard(existing)) {
2602
- return existing;
2603
- }
2604
- }
2605
- const instance = factory();
2606
- _g[key] = instance;
2607
- return instance;
2608
- }
2609
- };
3284
+ // ../common/src/exit-code.ts
3285
+ function setExitCode(code) {
3286
+ process.exitCode = code;
2610
3287
  }
2611
3288
 
2612
- // ../common/src/preview.ts
2613
- var previewSlot = singleton("PreviewBuild");
2614
- function isPreviewBuild() {
2615
- return previewSlot.get(false) ?? false;
2616
- }
2617
- Command.prototype.previewCommand = function(nameAndArgs, opts) {
2618
- if (isPreviewBuild()) {
2619
- return this.command(nameAndArgs, opts);
2620
- }
2621
- return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
2622
- };
2623
-
2624
3289
  // ../common/src/output-context.ts
2625
3290
  function createStorage() {
2626
- const [error, mod] = catchError2(() => __require("node:async_hooks"));
3291
+ const [error, mod] = catchError(() => __require("node:async_hooks"));
2627
3292
  if (error || typeof mod?.AsyncLocalStorage !== "function") {
2628
3293
  return {
2629
3294
  getStore: () => {
@@ -2654,8 +3319,8 @@ function getOutputSink() {
2654
3319
 
2655
3320
  // ../common/src/logger.ts
2656
3321
  var logFilePathSlot = singleton("logFilePath");
2657
- function setGlobalLogFilePath(path) {
2658
- logFilePathSlot.set(path);
3322
+ function setGlobalLogFilePath(path2) {
3323
+ logFilePathSlot.set(path2);
2659
3324
  }
2660
3325
  function getGlobalLogFilePath() {
2661
3326
  return logFilePathSlot.get("");
@@ -2692,7 +3357,7 @@ class SimpleLogger {
2692
3357
  }
2693
3358
  return DEFAULT_LOG_LEVEL;
2694
3359
  }
2695
- const [localStorageError, hasDebug] = catchError2(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
3360
+ const [localStorageError, hasDebug] = catchError(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
2696
3361
  if (!localStorageError && hasDebug) {
2697
3362
  return 0 /* DEBUG */;
2698
3363
  }
@@ -2723,54 +3388,49 @@ class SimpleLogger {
2723
3388
  return this.fileLoggingEnabled || !!getGlobalLogFilePath();
2724
3389
  }
2725
3390
  writeToFile(formatted) {
2726
- const path = this.logFilePath || getGlobalLogFilePath();
2727
- if (!path)
3391
+ const path2 = this.logFilePath || getGlobalLogFilePath();
3392
+ if (!path2)
2728
3393
  return;
2729
3394
  const timestamp = new Date().toISOString();
2730
3395
  this.pendingWrites = Promise.all([
2731
3396
  this.pendingWrites,
2732
3397
  this.pendingInit
2733
- ]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
3398
+ ]).then(() => getFileSystem().appendFile(path2, `${timestamp} ${formatted}`).catch(() => {}));
2734
3399
  }
2735
- debug(message, ...args) {
2736
- if (this.level > 0 /* DEBUG */)
2737
- return;
2738
- const formatted = this.format(`[DEBUG] ${message}`, args);
3400
+ write(formatted) {
2739
3401
  if (this.isFileLoggingActive()) {
2740
3402
  this.writeToFile(formatted);
2741
3403
  } else {
2742
3404
  getOutputSink().writeErr(formatted);
2743
3405
  }
2744
3406
  }
3407
+ debug(message, ...args) {
3408
+ if (this.level > 0 /* DEBUG */)
3409
+ return;
3410
+ const formatted = this.format(`[DEBUG] ${message}`, args);
3411
+ this.write(formatted);
3412
+ }
2745
3413
  info(message, ...args) {
2746
3414
  if (this.level > 1 /* INFO */)
2747
3415
  return;
2748
3416
  const formatted = this.format(message, args);
2749
- if (this.isFileLoggingActive()) {
2750
- this.writeToFile(formatted);
2751
- } else {
2752
- getOutputSink().writeErr(formatted);
2753
- }
3417
+ this.write(formatted);
2754
3418
  }
2755
3419
  warn(message, ...args) {
2756
3420
  if (this.level > 2 /* WARN */)
2757
3421
  return;
2758
3422
  const formatted = this.format(`[WARN] ${message}`, args);
2759
- if (this.isFileLoggingActive()) {
2760
- this.writeToFile(formatted);
2761
- } else {
2762
- getOutputSink().writeErr(formatted);
2763
- }
3423
+ this.write(formatted);
2764
3424
  }
2765
3425
  error(message, ...args) {
2766
3426
  if (this.level > 3 /* ERROR */)
2767
3427
  return;
2768
3428
  const formatted = this.format(`[ERROR] ${message}`, args);
2769
- if (this.isFileLoggingActive()) {
2770
- this.writeToFile(formatted);
2771
- } else {
2772
- getOutputSink().writeErr(formatted);
2773
- }
3429
+ this.write(formatted);
3430
+ }
3431
+ report(message) {
3432
+ const formatted = this.format(message, []);
3433
+ this.write(formatted);
2774
3434
  }
2775
3435
  getLevel() {
2776
3436
  return this.level;
@@ -2785,17 +3445,17 @@ class SimpleLogger {
2785
3445
  setGlobalLogFilePath("");
2786
3446
  }
2787
3447
  }
2788
- setLogFile(path) {
2789
- this.logFilePath = path;
2790
- setGlobalLogFilePath(path);
2791
- if (!path)
3448
+ setLogFile(path2) {
3449
+ this.logFilePath = path2;
3450
+ setGlobalLogFilePath(path2);
3451
+ if (!path2)
2792
3452
  return;
2793
3453
  this.fileLoggingEnabled = true;
2794
- const fs = getFileSystem();
3454
+ const fs2 = getFileSystem();
2795
3455
  this.pendingInit = (async () => {
2796
- const [error] = await catchError2((async () => {
2797
- await fs.mkdir(fs.path.dirname(path));
2798
- await fs.writeFile(path, "");
3456
+ const [error] = await catchError((async () => {
3457
+ await fs2.mkdir(fs2.path.dirname(path2));
3458
+ await fs2.writeFile(path2, "");
2799
3459
  })());
2800
3460
  if (error)
2801
3461
  this.fileLoggingEnabled = false;
@@ -2849,12 +3509,12 @@ var jmespathSlot = singleton("JmespathCodec");
2849
3509
  async function loadOutputCodecsAsync(needed) {
2850
3510
  const loads = [];
2851
3511
  if (needed.yaml && yamlSlot.get() === undefined) {
2852
- loads.push(import("./js-yaml-4ypbq2tt.js").then((mod) => {
3512
+ loads.push(import("./js-yaml-88tdqrtd.js").then((mod) => {
2853
3513
  yamlSlot.set(mod);
2854
3514
  }));
2855
3515
  }
2856
3516
  if (needed.filter && jmespathSlot.get() === undefined) {
2857
- loads.push(import("./index-2fj08e7n.js").then((mod) => {
3517
+ loads.push(import("./index-gpd94m28.js").then((mod) => {
2858
3518
  jmespathSlot.set(mod);
2859
3519
  }));
2860
3520
  }
@@ -3109,7 +3769,7 @@ function readRegistryValue(keyPath, valueName) {
3109
3769
  if (process.platform !== "win32") {
3110
3770
  return "";
3111
3771
  }
3112
- const [error, output] = catchError2(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3772
+ const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3113
3773
  encoding: "utf-8",
3114
3774
  stdio: ["pipe", "pipe", "pipe"]
3115
3775
  }));
@@ -3132,27 +3792,41 @@ class LoggerTelemetryProvider {
3132
3792
  ...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
3133
3793
  };
3134
3794
  }
3135
- async trackEvent(eventName, properties) {
3136
- logger.debug(formatMessage("Event", eventName, this.enrich(properties)));
3795
+ async trackEvent({ name, properties }) {
3796
+ logger.debug(formatMessage("Event", name, this.enrich(properties)));
3137
3797
  }
3138
- async trackException(error, properties) {
3798
+ async trackException({
3799
+ error,
3800
+ properties
3801
+ }) {
3139
3802
  logger.error(formatMessage("Exception", error.message, this.enrich({
3140
3803
  ...properties,
3141
3804
  stack: error.stack
3142
3805
  })));
3143
3806
  }
3144
- async trackRequest(name, duration, success, properties) {
3807
+ async trackRequest({
3808
+ name,
3809
+ durationMs,
3810
+ success,
3811
+ properties
3812
+ }) {
3145
3813
  logger.debug(formatMessage("Request", name, this.enrich({
3146
3814
  ...properties,
3147
- duration: `${duration}ms`,
3815
+ duration: `${durationMs}ms`,
3148
3816
  success
3149
3817
  })));
3150
3818
  }
3151
- async trackDependency(name, type, duration, success, properties) {
3819
+ async trackDependency({
3820
+ name,
3821
+ type,
3822
+ durationMs,
3823
+ success,
3824
+ properties
3825
+ }) {
3152
3826
  logger.debug(formatMessage("Dependency", name, this.enrich({
3153
3827
  ...properties,
3154
3828
  type,
3155
- duration: `${duration}ms`,
3829
+ duration: `${durationMs}ms`,
3156
3830
  success
3157
3831
  })));
3158
3832
  }
@@ -3384,168 +4058,40 @@ function resolveTelemetrySession() {
3384
4058
  if (existing) {
3385
4059
  return existing;
3386
4060
  }
3387
- const declaredHandle = getConfiguredTelemetrySessionId();
3388
- const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
3389
- telemetrySessionSlot.set(resolved);
3390
- return resolved;
3391
- }
3392
- function getTelemetrySessionSource() {
3393
- return resolveTelemetrySession().source;
3394
- }
3395
- function getTelemetryOperationId() {
3396
- const existing = telemetryOperationIdSlot.get();
3397
- if (existing) {
3398
- return existing;
3399
- }
3400
- const inboundTraceId = getInboundTraceContext()?.traceId;
3401
- const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
3402
- telemetryOperationIdSlot.set(generated);
3403
- return generated;
3404
- }
3405
- // ../common/src/telemetry/global-telemetry-properties.ts
3406
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
3407
- function getGlobalTelemetryProperties() {
3408
- return telemetryPropsSlot.get();
3409
- }
3410
-
3411
- // ../common/src/telemetry/pii-redactor.ts
3412
- var REDACTED = "[REDACTED]";
3413
- var MAX_VALUE_LENGTH = 200;
3414
- var SENSITIVE_NAME_TOKENS = new Set([
3415
- "token",
3416
- "tokens",
3417
- "secret",
3418
- "secrets",
3419
- "password",
3420
- "passwords",
3421
- "pwd",
3422
- "credential",
3423
- "credentials",
3424
- "auth",
3425
- "authentication",
3426
- "authorization",
3427
- "authority",
3428
- "cert",
3429
- "certificate",
3430
- "certificates"
3431
- ]);
3432
- var SENSITIVE_KEY_PREFIXES = new Set([
3433
- "api",
3434
- "access",
3435
- "client",
3436
- "private",
3437
- "public",
3438
- "signing",
3439
- "encryption",
3440
- "session",
3441
- "master",
3442
- "shared",
3443
- "root",
3444
- "ssh",
3445
- "rsa",
3446
- "aes",
3447
- "hmac",
3448
- "oauth"
3449
- ]);
3450
- var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
3451
- var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
3452
- var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
3453
- var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
3454
- var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
3455
- var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
3456
- var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
3457
- function shortHash(input) {
3458
- let hash = 2166136261;
3459
- for (let i = 0;i < input.length; i++) {
3460
- hash ^= input.charCodeAt(i);
3461
- hash = Math.imul(hash, 16777619);
3462
- }
3463
- return (hash >>> 0).toString(16).padStart(8, "0");
3464
- }
3465
- function redactUrl(raw) {
3466
- try {
3467
- const url = new URL(raw);
3468
- return `${url.protocol}//${url.host}`;
3469
- } catch {
3470
- return `url#${shortHash(raw)}`;
3471
- }
3472
- }
3473
- function redactValueDetectors(value) {
3474
- let out = value;
3475
- out = out.replace(JWT_PATTERN, () => REDACTED);
3476
- out = out.replace(URL_PATTERN, (match) => {
3477
- const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
3478
- const core = trailing ? match.slice(0, -trailing.length) : match;
3479
- return `${redactUrl(core)}${trailing}`;
3480
- });
3481
- out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
3482
- out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
3483
- out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
3484
- out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
3485
- if (out.length > MAX_VALUE_LENGTH) {
3486
- out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
3487
- }
3488
- return out;
3489
- }
3490
- function redactValue(value) {
3491
- return redactValueDetectors(value);
3492
- }
3493
- function redactError(error) {
3494
- const safe = new Error(redactValueDetectors(error.message ?? ""));
3495
- safe.name = error.name;
3496
- safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
3497
- return safe;
3498
- }
3499
- function nameTokens(name) {
3500
- return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
3501
- }
3502
- function isSensitiveName(name) {
3503
- const tokens = nameTokens(name);
3504
- for (let i = 0;i < tokens.length; i++) {
3505
- const token = tokens[i];
3506
- if (SENSITIVE_NAME_TOKENS.has(token)) {
3507
- return true;
3508
- }
3509
- if (token === "key" || token === "keys") {
3510
- const prev = tokens[i - 1];
3511
- if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
3512
- return true;
3513
- }
3514
- }
3515
- }
3516
- return false;
3517
- }
3518
- function redactProperty(name, value) {
3519
- if (value === undefined || value === null) {
3520
- return;
3521
- }
3522
- if (isSensitiveName(name)) {
3523
- return REDACTED;
3524
- }
3525
- if (typeof value === "boolean" || typeof value === "number") {
3526
- return value;
3527
- }
3528
- if (typeof value !== "string") {
3529
- return "[OBJECT]";
3530
- }
3531
- return redactValueDetectors(value);
4061
+ const declaredHandle = getConfiguredTelemetrySessionId();
4062
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
4063
+ telemetrySessionSlot.set(resolved);
4064
+ return resolved;
3532
4065
  }
3533
- function redactProperties(properties) {
3534
- const out = {};
3535
- for (const [name, value] of Object.entries(properties)) {
3536
- const redacted = redactProperty(name, value);
3537
- if (redacted !== undefined) {
3538
- out[name] = redacted;
3539
- }
4066
+ function getTelemetrySessionSource() {
4067
+ return resolveTelemetrySession().source;
4068
+ }
4069
+ function getTelemetryOperationId() {
4070
+ const existing = telemetryOperationIdSlot.get();
4071
+ if (existing) {
4072
+ return existing;
3540
4073
  }
3541
- return out;
4074
+ const inboundTraceId = getInboundTraceContext()?.traceId;
4075
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
4076
+ telemetryOperationIdSlot.set(generated);
4077
+ return generated;
4078
+ }
4079
+ // ../common/src/telemetry/global-telemetry-properties.ts
4080
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
4081
+ function getGlobalTelemetryProperties() {
4082
+ return telemetryPropsSlot.get();
3542
4083
  }
3543
4084
 
3544
- // ../common/src/telemetry/telemetry-service.ts
3545
- var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
3546
- var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
3547
- var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
4085
+ // ../common/src/telemetry/span-clock.ts
4086
+ function startSpanClock() {
4087
+ const started = performance.now();
4088
+ return {
4089
+ startedAt: new Date(performance.timeOrigin + started),
4090
+ elapsedMs: () => performance.now() - started
4091
+ };
4092
+ }
3548
4093
 
4094
+ // ../common/src/telemetry/telemetry-service.ts
3549
4095
  class TelemetryService {
3550
4096
  telemetryProvider;
3551
4097
  contextStorage;
@@ -3565,36 +4111,39 @@ class TelemetryService {
3565
4111
  this.defaultProperties = properties === undefined ? undefined : { ...this.defaultProperties, ...properties };
3566
4112
  }
3567
4113
  trackEvent(name, properties) {
3568
- const context = this.getCurrentContext();
3569
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3570
- this.telemetryProvider.trackEvent(name, enrichedProperties);
4114
+ this.telemetryProvider.trackEvent({
4115
+ name: redactSpanName(name),
4116
+ properties: this.enrichProperties(properties),
4117
+ ...this.leafCorrelation()
4118
+ });
3571
4119
  }
3572
- trackException(error, properties) {
3573
- const context = this.getCurrentContext();
3574
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3575
- this.telemetryProvider.trackException(redactError(error), enrichedProperties);
4120
+ trackException(error, properties, context) {
4121
+ this.telemetryProvider.trackException({
4122
+ error: redactError(error),
4123
+ properties: this.enrichProperties(properties),
4124
+ ...this.leafCorrelation(context)
4125
+ });
3576
4126
  }
3577
4127
  async trackRequest(name, fn, properties) {
3578
- const parentContext = this.getCurrentContext();
4128
+ const parentContext = this.getActiveContext();
3579
4129
  const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
3580
4130
  const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
4131
+ const clock = startSpanClock();
3581
4132
  const context = {
3582
4133
  operationId,
3583
4134
  ...parentId !== undefined ? { parentId } : {},
3584
- id: this.generateId()
4135
+ id: this.generateId(),
4136
+ startedAt: clock.startedAt
3585
4137
  };
3586
- const startTime = performance.now();
3587
4138
  try {
3588
4139
  const result = await this.contextStorage.run(context, fn);
3589
- const durationMs = performance.now() - startTime;
3590
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3591
- await this.telemetryProvider.trackRequest(name, durationMs, true, enrichedProperties);
4140
+ const durationMs = clock.elapsedMs();
4141
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, true, properties, context));
3592
4142
  return result;
3593
4143
  } catch (error) {
3594
- const durationMs = performance.now() - startTime;
4144
+ const durationMs = clock.elapsedMs();
3595
4145
  const err = error instanceof Error ? error : new Error(String(error));
3596
- const enrichedProperties = this.enrichPropertiesWithContext({ ...properties, errorMessage: err.message }, context);
3597
- await this.telemetryProvider.trackRequest(name, durationMs, false, enrichedProperties);
4146
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, context));
3598
4147
  throw error;
3599
4148
  }
3600
4149
  }
@@ -3603,8 +4152,7 @@ class TelemetryService {
3603
4152
  operationId: this.operationId ?? getTelemetryOperationId(),
3604
4153
  id: this.generateId()
3605
4154
  };
3606
- const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
3607
- this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
4155
+ this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, success, properties, requestContext));
3608
4156
  }
3609
4157
  createRequestContext() {
3610
4158
  const operationId = this.operationId ?? getTelemetryOperationId();
@@ -3612,7 +4160,8 @@ class TelemetryService {
3612
4160
  return {
3613
4161
  operationId,
3614
4162
  ...parentId !== undefined ? { parentId } : {},
3615
- id: this.generateId()
4163
+ id: this.generateId(),
4164
+ startedAt: startSpanClock().startedAt
3616
4165
  };
3617
4166
  }
3618
4167
  inboundParentIdFor(operationId) {
@@ -3623,58 +4172,84 @@ class TelemetryService {
3623
4172
  return this.contextStorage.run(context, fn);
3624
4173
  }
3625
4174
  createDependencyContext() {
3626
- const parentContext = this.getCurrentContext();
4175
+ const parentContext = this.getActiveContext();
3627
4176
  if (!parentContext) {
3628
4177
  return;
3629
4178
  }
3630
4179
  return {
3631
4180
  operationId: parentContext.operationId,
3632
4181
  parentId: parentContext.id,
3633
- id: this.generateId()
4182
+ id: this.generateId(),
4183
+ startedAt: startSpanClock().startedAt
3634
4184
  };
3635
4185
  }
3636
4186
  trackDependencyResult(name, type, durationMs, success, properties, context, resultCode) {
3637
- const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
3638
- this.telemetryProvider.trackDependency(redactValue(name), type, durationMs, success, enrichedProperties, resultCode);
4187
+ this.telemetryProvider.trackDependency({
4188
+ ...this.spanFor(redactHttpDependencyName(name), durationMs, success, properties, context),
4189
+ type,
4190
+ ...resultCode !== undefined ? { resultCode } : {}
4191
+ });
3639
4192
  }
3640
4193
  async trackDependencyOperation(name, type, fn, properties) {
3641
- const parentContext = this.getCurrentContext();
4194
+ const clock = startSpanClock();
4195
+ const parentContext = this.getActiveContext();
3642
4196
  const childContext = parentContext !== undefined ? {
3643
4197
  operationId: parentContext.operationId,
3644
4198
  parentId: parentContext.id,
3645
- id: this.generateId()
3646
- } : this.createRequestContext();
3647
- const startTime = performance.now();
4199
+ id: this.generateId(),
4200
+ startedAt: clock.startedAt
4201
+ } : {
4202
+ ...this.createRequestContext(),
4203
+ startedAt: clock.startedAt
4204
+ };
3648
4205
  try {
3649
4206
  const result = await this.contextStorage.run(childContext, fn);
3650
- const durationMs = performance.now() - startTime;
3651
- const enrichedProperties = this.enrichPropertiesWithContext(properties, childContext);
3652
- await this.telemetryProvider.trackDependency(name, type, durationMs, true, enrichedProperties);
4207
+ const durationMs = clock.elapsedMs();
4208
+ await this.telemetryProvider.trackDependency({
4209
+ ...this.spanFor(name, durationMs, true, properties, childContext),
4210
+ type
4211
+ });
3653
4212
  return result;
3654
4213
  } catch (error) {
3655
- const durationMs = performance.now() - startTime;
4214
+ const durationMs = clock.elapsedMs();
3656
4215
  const err = error instanceof Error ? error : new Error(String(error));
3657
- const enrichedProperties = this.enrichPropertiesWithContext({ ...properties, errorMessage: err.message }, childContext);
3658
- await this.telemetryProvider.trackDependency(name, type, durationMs, false, enrichedProperties);
4216
+ await this.telemetryProvider.trackDependency({
4217
+ ...this.spanFor(name, durationMs, false, { ...properties, errorMessage: err.message }, childContext),
4218
+ type
4219
+ });
3659
4220
  throw error;
3660
4221
  }
3661
4222
  }
3662
- getCurrentContext() {
4223
+ getActiveContext() {
3663
4224
  return this.contextStorage.getContext();
3664
4225
  }
3665
- enrichPropertiesWithContext(properties, context) {
4226
+ leafCorrelation(explicit) {
4227
+ const context = explicit ?? this.getActiveContext();
4228
+ return {
4229
+ operationId: context?.operationId ?? this.operationId ?? getTelemetryOperationId(),
4230
+ ...context !== undefined ? { parentId: context.id } : {}
4231
+ };
4232
+ }
4233
+ spanFor(name, durationMs, success, properties, context) {
4234
+ return {
4235
+ name: redactSpanName(name),
4236
+ durationMs,
4237
+ success,
4238
+ properties: this.enrichProperties(properties),
4239
+ operationId: context.operationId,
4240
+ ...context.parentId !== undefined ? { parentId: context.parentId } : {},
4241
+ id: context.id,
4242
+ ...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
4243
+ };
4244
+ }
4245
+ enrichProperties(properties) {
3666
4246
  const globalProperties = getGlobalTelemetryProperties();
3667
4247
  const enriched = {
3668
4248
  ...getExecutionContextTelemetryProperties(),
3669
4249
  ...globalProperties,
3670
4250
  ...this.defaultProperties,
3671
4251
  ...redactProperties(properties ?? {}),
3672
- [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
3673
- ...context ? {
3674
- [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
3675
- ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
3676
- [TELEMETRY_SPAN_ID_PROPERTY]: context.id
3677
- } : {}
4252
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
3678
4253
  };
3679
4254
  return enriched;
3680
4255
  }
@@ -3691,6 +4266,81 @@ class TelemetryService {
3691
4266
  return hex;
3692
4267
  }
3693
4268
  }
4269
+ // ../common/src/timings.ts
4270
+ var TIMINGS_ENV_VAR = "UIP_TIMINGS";
4271
+ function createStorage2() {
4272
+ const [error, mod] = catchError(() => __require("node:async_hooks"));
4273
+ if (error || typeof mod?.AsyncLocalStorage !== "function") {
4274
+ return {
4275
+ getStore: () => {
4276
+ return;
4277
+ },
4278
+ run: (_store, fn) => fn()
4279
+ };
4280
+ }
4281
+ return new mod.AsyncLocalStorage;
4282
+ }
4283
+ var storageSlot = singleton("TimingStorage");
4284
+ var stateSlot = singleton("Timings");
4285
+ var rootStartedSlot = singleton("TimingsRootStarted");
4286
+ var longLivedHostSlot = singleton("TimingsLongLivedHost");
4287
+ var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
4288
+ function newState(baseline) {
4289
+ return { baseline, httpMs: 0, httpCalls: 0 };
4290
+ }
4291
+ function getState() {
4292
+ const scoped = storage.getStore();
4293
+ if (scoped) {
4294
+ return scoped;
4295
+ }
4296
+ const pinned = livePinnedState();
4297
+ if (pinned !== undefined) {
4298
+ return pinned;
4299
+ }
4300
+ return newState(processStartIsInvocationStart() ? 0 : performance.now());
4301
+ }
4302
+ function livePinnedState() {
4303
+ const pinned = stateSlot.get();
4304
+ return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
4305
+ }
4306
+ function processStartIsInvocationStart() {
4307
+ return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
4308
+ }
4309
+ function timingsEnabled() {
4310
+ if (typeof process === "undefined") {
4311
+ return false;
4312
+ }
4313
+ const value = process.env?.[TIMINGS_ENV_VAR];
4314
+ if (value === undefined) {
4315
+ return false;
4316
+ }
4317
+ const normalized = value.trim().toLowerCase();
4318
+ return normalized === "1" || normalized === "true";
4319
+ }
4320
+ function recordExitCode(exitCode) {
4321
+ if (!timingsEnabled()) {
4322
+ return;
4323
+ }
4324
+ getState().exitCode = exitCode;
4325
+ }
4326
+ function invocationStartedAt() {
4327
+ return new Date(performance.timeOrigin + getState().baseline);
4328
+ }
4329
+ function invocationElapsedMs() {
4330
+ return performance.now() - getState().baseline;
4331
+ }
4332
+ function markCommandStart() {
4333
+ if (!timingsEnabled()) {
4334
+ return;
4335
+ }
4336
+ getState().commandStart = performance.now();
4337
+ }
4338
+ function recordCommandDuration(durationMs) {
4339
+ if (!timingsEnabled()) {
4340
+ return;
4341
+ }
4342
+ getState().commandMs = durationMs;
4343
+ }
3694
4344
  // ../common/src/telemetry/proxy-http-agent.ts
3695
4345
  var slot = singleton("ProxyAuthHttpsAgent");
3696
4346
 
@@ -3711,6 +4361,9 @@ function getGlobalTelemetryInstance() {
3711
4361
  }
3712
4362
  return;
3713
4363
  }
4364
+ function setGlobalTelemetryInstance(instance) {
4365
+ telemetryInstanceSlot.set(instance);
4366
+ }
3714
4367
  var _localTelemetryInstance;
3715
4368
  function getTelemetryInstance() {
3716
4369
  const global = getGlobalTelemetryInstance();
@@ -3718,6 +4371,7 @@ function getTelemetryInstance() {
3718
4371
  return global;
3719
4372
  if (!_localTelemetryInstance) {
3720
4373
  _localTelemetryInstance = new TelemetryService(new LoggerTelemetryProvider, new NodeContextStorage);
4374
+ setGlobalTelemetryInstance(_localTelemetryInstance);
3721
4375
  }
3722
4376
  return _localTelemetryInstance;
3723
4377
  }
@@ -3730,6 +4384,14 @@ var telemetry = new Proxy({}, {
3730
4384
  });
3731
4385
 
3732
4386
  // ../common/src/formatter.ts
4387
+ var ANSI_STYLES = {
4388
+ red: "\x1B[31m",
4389
+ dim: "\x1B[2m"
4390
+ };
4391
+ var ANSI_RESET = "\x1B[0m";
4392
+ function styleLine(line, style) {
4393
+ return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
4394
+ }
3733
4395
  var CLI_ERROR_CODES = [
3734
4396
  "invalid_argument",
3735
4397
  "authentication_required",
@@ -3768,22 +4430,6 @@ var EXIT_CODES = {
3768
4430
  ValidationError: 3,
3769
4431
  TimeoutError: 4
3770
4432
  };
3771
- class SuccessOutput {
3772
- Result = RESULTS.Success;
3773
- Code;
3774
- Data;
3775
- Pagination;
3776
- Instructions;
3777
- Log;
3778
- constructor(code, data) {
3779
- this.Code = code;
3780
- this.Data = data;
3781
- const logPath = getLogFilePath();
3782
- if (logPath) {
3783
- this.Log = logPath;
3784
- }
3785
- }
3786
- }
3787
4433
  function escapeNonAscii(jsonText) {
3788
4434
  return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
3789
4435
  const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
@@ -3848,19 +4494,45 @@ function toPascalCaseKey(key) {
3848
4494
  const lowerCamelKey = toLowerCamelCaseKey(key);
3849
4495
  return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
3850
4496
  }
3851
- function toPascalCaseData(value) {
4497
+ function collectVerbatimRefs(value, into) {
4498
+ if (typeof value !== "object" || value === null)
4499
+ return;
4500
+ if (into.has(value))
4501
+ return;
4502
+ into.add(value);
4503
+ for (const nested of Array.isArray(value) ? value : Object.values(value)) {
4504
+ collectVerbatimRefs(nested, into);
4505
+ }
4506
+ }
4507
+ function toPascalCaseData(value, verbatimKeys, subtrees) {
4508
+ if (subtrees?.mode === "skip" && typeof value === "object" && value !== null && subtrees.refs.has(value)) {
4509
+ return value;
4510
+ }
3852
4511
  if (Array.isArray(value))
3853
- return value.map(toPascalCaseData);
4512
+ return value.map((entry) => toPascalCaseData(entry, verbatimKeys, subtrees));
3854
4513
  if (!isPlainRecord(value))
3855
4514
  return value;
3856
4515
  const result = {};
3857
4516
  for (const [key, nestedValue] of Object.entries(value)) {
3858
- result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
4517
+ const pascalKey = toPascalCaseKey(key);
4518
+ if (verbatimKeys?.has(pascalKey)) {
4519
+ result[pascalKey] = nestedValue;
4520
+ if (subtrees?.mode === "collect") {
4521
+ collectVerbatimRefs(nestedValue, subtrees.refs);
4522
+ }
4523
+ continue;
4524
+ }
4525
+ result[pascalKey] = toPascalCaseData(nestedValue, verbatimKeys, subtrees);
3859
4526
  }
3860
4527
  return result;
3861
4528
  }
3862
- function normalizeDataKeys(data) {
3863
- return toPascalCaseData(data);
4529
+ function normalizeDataKeys(data, verbatimKeys, subtrees) {
4530
+ return toPascalCaseData(data, verbatimKeys, subtrees);
4531
+ }
4532
+ function toVerbatimKeySet(preserve) {
4533
+ if (!Array.isArray(preserve))
4534
+ return;
4535
+ return new Set(preserve.map(toPascalCaseKey));
3864
4536
  }
3865
4537
  function normalizeOutputKeys(data) {
3866
4538
  const result = {};
@@ -3870,7 +4542,7 @@ function normalizeOutputKeys(data) {
3870
4542
  }
3871
4543
  return result;
3872
4544
  }
3873
- function printOutput(data, format = "json", logFn, asciiSafe = false) {
4545
+ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowStyle) {
3874
4546
  if (!data) {
3875
4547
  logFn("Empty response object. No data to display.");
3876
4548
  return;
@@ -3905,7 +4577,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
3905
4577
  if (hasData && !(rows !== null && rows.length === 0)) {
3906
4578
  const logValue = data.Log;
3907
4579
  if (rows !== null) {
3908
- printResizableTable(rows, logFn, logValue);
4580
+ printResizableTable(rows, logFn, logValue, undefined, tableRowStyle);
3909
4581
  } else {
3910
4582
  printVerticalTable(data.Data, logFn, logValue);
3911
4583
  }
@@ -3916,10 +4588,11 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
3916
4588
  }
3917
4589
  }
3918
4590
  }
3919
- function logOutput(data, format = "json") {
4591
+ function logOutput(data, format = "json", tableRowStyle) {
3920
4592
  const sink = getOutputSink();
4593
+ const styleFn = sink.capabilities.isInteractive && sink.capabilities.supportsColor ? tableRowStyle : undefined;
3921
4594
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
3922
- `), needsAsciiSafeJson(sink));
4595
+ `), needsAsciiSafeJson(sink), styleFn);
3923
4596
  }
3924
4597
  function cellToString(val) {
3925
4598
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
@@ -3933,7 +4606,7 @@ function wrapText(text, width) {
3933
4606
  }
3934
4607
  return lines;
3935
4608
  }
3936
- function printTable(data, logFn, externalLogValue) {
4609
+ function printTable(data, logFn, externalLogValue, tableRowStyle) {
3937
4610
  if (data.length === 0)
3938
4611
  return;
3939
4612
  const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
@@ -3943,7 +4616,7 @@ function printTable(data, logFn, externalLogValue) {
3943
4616
  logFn(keys.map((_, i) => "-".repeat(maxWidths[i])).join("-|-"));
3944
4617
  data.forEach((item) => {
3945
4618
  const row = keys.map((key, i) => cellToString(item[key]).padEnd(maxWidths[i])).join(" | ");
3946
- logFn(row);
4619
+ logFn(styleLine(row, tableRowStyle?.(item)));
3947
4620
  });
3948
4621
  if (externalLogValue) {
3949
4622
  logFn("");
@@ -3986,14 +4659,14 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
3986
4659
  logFn(`Log: ${externalLogValue}`);
3987
4660
  }
3988
4661
  }
3989
- function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth) {
4662
+ function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
3990
4663
  if (data.length === 0)
3991
4664
  return;
3992
4665
  const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
3993
4666
  if (keys.length === 0)
3994
4667
  return;
3995
4668
  if (!process.stdout.isTTY) {
3996
- printTable(data, logFn, externalLogValue);
4669
+ printTable(data, logFn, externalLogValue, tableRowStyle);
3997
4670
  return;
3998
4671
  }
3999
4672
  const naturalWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
@@ -4001,7 +4674,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4001
4674
  const totalWidth = naturalWidths.reduce((a, b) => a + b, 0) + separatorTotal;
4002
4675
  const termWidth = availableWidth ?? (process.stdout.columns || 120);
4003
4676
  if (totalWidth <= termWidth) {
4004
- printTable(data, logFn, externalLogValue);
4677
+ printTable(data, logFn, externalLogValue, tableRowStyle);
4005
4678
  return;
4006
4679
  }
4007
4680
  const overflow = totalWidth - termWidth;
@@ -4047,6 +4720,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4047
4720
  logFn(header);
4048
4721
  logFn(keys.map((_, i) => "-".repeat(finalWidths[i])).join("-|-"));
4049
4722
  data.forEach((item) => {
4723
+ const style = tableRowStyle?.(item);
4050
4724
  const cellLines = keys.map((key, i) => wrapText(cellToString(item[key]), finalWidths[i]));
4051
4725
  const lineCount = Math.max(...cellLines.map((l) => l.length));
4052
4726
  for (let line = 0;line < lineCount; line++) {
@@ -4054,7 +4728,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4054
4728
  const val = line < cellLines[i].length ? cellLines[i][line] : "";
4055
4729
  return val.padEnd(finalWidths[i]);
4056
4730
  }).join(" | ");
4057
- logFn(row);
4731
+ logFn(styleLine(row, style));
4058
4732
  }
4059
4733
  });
4060
4734
  if (externalLogValue) {
@@ -4198,30 +4872,36 @@ var OutputFormatter;
4198
4872
  ((OutputFormatter) => {
4199
4873
  function success(data, options) {
4200
4874
  data.Log ??= getLogFilePath() || undefined;
4201
- const normalize = !options?.preserveDataKeys;
4875
+ const normalize = options?.preserveDataKeys !== true;
4876
+ const verbatim = toVerbatimKeySet(options?.preserveDataKeys);
4877
+ const subtrees = verbatim && {
4878
+ refs: new Set,
4879
+ mode: "collect"
4880
+ };
4202
4881
  if (normalize) {
4203
- data.Data = normalizeDataKeys(data.Data);
4882
+ data.Data = normalizeDataKeys(data.Data, verbatim, subtrees);
4204
4883
  }
4205
4884
  const filter = getOutputFilter();
4206
4885
  if (filter) {
4207
4886
  const filtered = applyFilter(data.Data, filter);
4208
- data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
4887
+ data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
4209
4888
  }
4210
- logOutput(normalizeOutputKeys(data), getOutputFormat());
4889
+ logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
4211
4890
  }
4212
4891
  OutputFormatter.success = success;
4213
4892
  function error(data) {
4214
4893
  data.Log ??= getLogFilePath() || undefined;
4215
4894
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
4216
4895
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
4217
- process.exitCode = EXIT_CODES[data.Result] ?? 1;
4896
+ const exitCode = EXIT_CODES[data.Result] ?? 1;
4897
+ setExitCode(exitCode);
4218
4898
  recordCommandFailureTelemetry({
4219
4899
  result: data.Result,
4220
4900
  errorCode: data.ErrorCode,
4221
4901
  retry: data.Retry,
4222
4902
  message: data.Message,
4223
4903
  context: data.Context,
4224
- exitCode: process.exitCode,
4904
+ exitCode,
4225
4905
  errorClass: data.TelemetryErrorClass,
4226
4906
  terminalOutcome: data.TelemetryTerminalOutcome,
4227
4907
  terminalSignal: data.TelemetryTerminalSignal
@@ -4297,6 +4977,39 @@ var OutputFormatter;
4297
4977
  }
4298
4978
  OutputFormatter.formatToString = formatToString;
4299
4979
  })(OutputFormatter ||= {});
4980
+ // ../../node_modules/commander/esm.mjs
4981
+ var import__ = __toESM(require_commander(), 1);
4982
+ var {
4983
+ program,
4984
+ createCommand,
4985
+ createArgument,
4986
+ createOption,
4987
+ CommanderError,
4988
+ InvalidArgumentError,
4989
+ InvalidOptionArgumentError,
4990
+ Command,
4991
+ Argument,
4992
+ Option,
4993
+ Help
4994
+ } = import__.default;
4995
+
4996
+ // ../common/src/command-examples.ts
4997
+ var examplesByCommand = new WeakMap;
4998
+ Command.prototype.examples = function(examples) {
4999
+ examplesByCommand.set(this, examples);
5000
+ return this;
5001
+ };
5002
+ // ../common/src/preview.ts
5003
+ var previewSlot = singleton("PreviewBuild");
5004
+ function isPreviewBuild() {
5005
+ return previewSlot.get(false) ?? false;
5006
+ }
5007
+ Command.prototype.previewCommand = function(nameAndArgs, opts) {
5008
+ if (isPreviewBuild()) {
5009
+ return this.command(nameAndArgs, opts);
5010
+ }
5011
+ return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
5012
+ };
4300
5013
 
4301
5014
  // ../common/src/telemetry/command-attribution.ts
4302
5015
  var LEGACY_SKILL_NAMESPACE = "uipath:";
@@ -4451,6 +5164,57 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
4451
5164
  };
4452
5165
  }
4453
5166
 
5167
+ // ../common/src/telemetry/command-name.ts
5168
+ var TELEMETRY_COMMAND_ROOT = "uip";
5169
+ function commandTelemetryName(parts) {
5170
+ const tokens = [];
5171
+ for (const part of parts) {
5172
+ const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== TELEMETRY_COMMAND_ROOT);
5173
+ if (pieces.every(isCommandToken)) {
5174
+ tokens.push(...pieces);
5175
+ continue;
5176
+ }
5177
+ tokens.push(UNKNOWN_TOKEN);
5178
+ }
5179
+ return [TELEMETRY_COMMAND_ROOT, ...tokens].join(".");
5180
+ }
5181
+ var COMMAND_TOKEN_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
5182
+ var MAX_COMMAND_TOKEN_LENGTH = 32;
5183
+ var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
5184
+ function isCommandToken(token) {
5185
+ return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token) && !/^\d+$/.test(token);
5186
+ }
5187
+ var UNKNOWN_TOKEN = "<unknown>";
5188
+
5189
+ // ../common/src/telemetry/invocation-request.ts
5190
+ var requestContextSlot = singleton("TelemetryInvocationRequestContext");
5191
+ function activeContext() {
5192
+ return telemetry.getActiveContext?.();
5193
+ }
5194
+ function runWithInvocationRequest(fn) {
5195
+ const context = telemetry.createRequestContext();
5196
+ context.startedAt = invocationStartedAt();
5197
+ requestContextSlot.set(context);
5198
+ return telemetry.runWithContext(context, fn);
5199
+ }
5200
+ function ensureInvocationRequestScope(fn) {
5201
+ if (activeContext() !== undefined) {
5202
+ return fn();
5203
+ }
5204
+ const kept = requestContextSlot.get();
5205
+ return kept === undefined ? runWithInvocationRequest(fn) : telemetry.runWithContext(kept, fn);
5206
+ }
5207
+ function getInvocationRequestContext() {
5208
+ return activeContext() ?? requestContextSlot.get();
5209
+ }
5210
+ function emitInvocationRequest(name, success, properties) {
5211
+ const context = getInvocationRequestContext();
5212
+ telemetry.trackRequestResult(name, invocationElapsedMs(), success, properties, context);
5213
+ if (context !== undefined && requestContextSlot.get() === context) {
5214
+ requestContextSlot.clear();
5215
+ }
5216
+ }
5217
+
4454
5218
  // ../common/src/trackedAction.ts
4455
5219
  var pollSignalSlot = singleton("PollSignal");
4456
5220
  var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
@@ -4458,28 +5222,74 @@ var retryHintValues = new Set(RETRY_HINTS);
4458
5222
  var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
4459
5223
  var processContext = {
4460
5224
  exit: (code) => {
4461
- process.exitCode = code;
5225
+ recordExitCode(code);
5226
+ setExitCode(code);
4462
5227
  },
4463
5228
  get pollSignal() {
4464
5229
  return pollSignalSlot.get();
4465
5230
  }
4466
5231
  };
5232
+ var TELEMETRY_ARG_VALUE_WITHHELD = "<provided>";
5233
+ var TELEMETRY_ARG_VALUE_DEFAULTED = "<default>";
5234
+ function recordableArgValue(value, choices) {
5235
+ if (typeof value === "boolean" || typeof value === "number") {
5236
+ return value;
5237
+ }
5238
+ if (choices && choices.length > 0) {
5239
+ if (typeof value === "string" && choices.includes(value)) {
5240
+ return value;
5241
+ }
5242
+ if (Array.isArray(value) && value.length > 0 && value.every((entry) => typeof entry === "string" && choices.includes(entry))) {
5243
+ return value.join(",");
5244
+ }
5245
+ }
5246
+ return TELEMETRY_ARG_VALUE_WITHHELD;
5247
+ }
4467
5248
  function extractCommandParams(cmd) {
4468
5249
  const params = {};
4469
- const add = (name, value) => {
4470
- if (name && value !== undefined) {
4471
- params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
4472
- }
4473
- };
5250
+ forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
5251
+ const recordable = recordableArgValue(value, choices);
5252
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
5253
+ });
5254
+ return params;
5255
+ }
5256
+ function isDefaultedOption(cmd, name) {
5257
+ const source = cmd.getOptionValueSource?.(name);
5258
+ return source === "default" || source === "implied";
5259
+ }
5260
+ function isDefaultedPositional(cmd, index) {
5261
+ return index >= (cmd.args?.length ?? 0);
5262
+ }
5263
+ function forEachSuppliedArgument(cmd, visit) {
4474
5264
  const registered = cmd.registeredArguments ?? [];
4475
5265
  const processed = cmd.processedArgs ?? [];
4476
5266
  for (let i = 0;i < registered.length; i++) {
4477
- add(registered[i].name(), processed[i]);
5267
+ const name = registered[i].name();
5268
+ if (name && processed[i] !== undefined) {
5269
+ visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
5270
+ }
5271
+ }
5272
+ const choicesByAttribute = new Map;
5273
+ for (const option of cmd.options) {
5274
+ choicesByAttribute.set(option.attributeName(), option.argChoices);
4478
5275
  }
4479
5276
  for (const [key, value] of Object.entries(cmd.opts())) {
4480
- add(key, value);
5277
+ if (key && value !== undefined) {
5278
+ visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
5279
+ }
4481
5280
  }
4482
- return params;
5281
+ }
5282
+ function withheldArgumentValues(cmd) {
5283
+ const values = [];
5284
+ forEachSuppliedArgument(cmd, (_name, value, choices, defaulted) => {
5285
+ if (defaulted) {
5286
+ return;
5287
+ }
5288
+ if (recordableArgValue(value, choices) === TELEMETRY_ARG_VALUE_WITHHELD) {
5289
+ values.push(value);
5290
+ }
5291
+ });
5292
+ return values;
4483
5293
  }
4484
5294
  function deriveCommandPath(cmd) {
4485
5295
  const parts = [];
@@ -4494,7 +5304,7 @@ function deriveCommandPath(cmd) {
4494
5304
  if (parts.length > 1) {
4495
5305
  parts.shift();
4496
5306
  }
4497
- return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
5307
+ return commandTelemetryName(parts);
4498
5308
  }
4499
5309
  function isCliErrorCode(value) {
4500
5310
  return typeof value === "string" && cliErrorCodeValues.has(value);
@@ -4534,68 +5344,77 @@ Command.prototype.trackedAction = function(context, fn, properties) {
4534
5344
  });
4535
5345
  const telemetryName = deriveCommandPath(command);
4536
5346
  const props = typeof properties === "function" ? properties(...args) : properties;
4537
- const requestContext = telemetry.createRequestContext();
4538
- const startTime = performance.now();
4539
- let errorMessage;
4540
- let fallbackExitCode = EXIT_CODES.Success;
4541
- clearRecordedCommandFailureTelemetry();
4542
- const [error] = await catchError2(telemetry.runWithContext(requestContext, () => {
4543
- const violation = implicitLimitViolation(command);
4544
- if (violation) {
4545
- return Promise.reject(violation);
4546
- }
4547
- return fn(...args);
4548
- }));
4549
- if (error) {
4550
- errorMessage = error instanceof Error ? error.message : String(error);
4551
- logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
4552
- const typed = error;
4553
- const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
4554
- const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
4555
- const finalResult = customResult ?? RESULTS.Failure;
4556
- const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
4557
- const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
4558
- const typedRetry = typed.retry ?? typed.Retry;
4559
- const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
4560
- const typedContext = typed.context ?? typed.Context;
4561
- const customContext = isErrorContext(typedContext) ? typedContext : undefined;
4562
- const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
4563
- fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
4564
- OutputFormatter.error({
4565
- Result: finalResult,
4566
- ...customErrorCode ? { ErrorCode: customErrorCode } : {},
4567
- Message: errorMessage,
4568
- Instructions: customInstructions ?? commandHelpHint(telemetryName),
4569
- ...customRetry ? { Retry: customRetry } : {},
4570
- ...customContext ? { Context: customContext } : {}
5347
+ markCommandStart();
5348
+ const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
5349
+ try {
5350
+ const startTime = performance.now();
5351
+ let errorMessage;
5352
+ let fallbackExitCode = EXIT_CODES.Success;
5353
+ clearRecordedCommandFailureTelemetry();
5354
+ const [error] = await catchError(ensureInvocationRequestScope(() => {
5355
+ const violation = implicitLimitViolation(command);
5356
+ if (violation) {
5357
+ return Promise.reject(violation);
5358
+ }
5359
+ return fn(...args);
5360
+ }));
5361
+ if (error) {
5362
+ errorMessage = error instanceof Error ? error.message : String(error);
5363
+ logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
5364
+ const typed = error;
5365
+ const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
5366
+ const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
5367
+ const finalResult = customResult ?? RESULTS.Failure;
5368
+ const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
5369
+ const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
5370
+ const typedRetry = typed.retry ?? typed.Retry;
5371
+ const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
5372
+ const typedContext = typed.context ?? typed.Context;
5373
+ const customContext = isErrorContext(typedContext) ? typedContext : undefined;
5374
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
5375
+ fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
5376
+ OutputFormatter.error({
5377
+ Result: finalResult,
5378
+ ...customErrorCode ? { ErrorCode: customErrorCode } : {},
5379
+ Message: errorMessage,
5380
+ Instructions: customInstructions ?? commandHelpHint(telemetryName),
5381
+ ...customRetry ? { Retry: customRetry } : {},
5382
+ ...customContext ? { Context: customContext } : {}
5383
+ });
5384
+ context.exit(fallbackExitCode);
5385
+ }
5386
+ const durationMs = performance.now() - startTime;
5387
+ recordCommandDuration(durationMs);
5388
+ const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
5389
+ const recordedFailure = takeRecordedCommandFailureTelemetry();
5390
+ const success = !error && exitCode === 0;
5391
+ const terminalTelemetry = buildCommandTerminalTelemetryProperties({
5392
+ error,
5393
+ exitCode,
5394
+ recordedFailure,
5395
+ pollSignal: context.pollSignal
4571
5396
  });
4572
- context.exit(fallbackExitCode);
4573
- }
4574
- const durationMs = performance.now() - startTime;
4575
- const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
4576
- const recordedFailure = takeRecordedCommandFailureTelemetry();
4577
- const success = !error && exitCode === 0;
4578
- const terminalTelemetry = buildCommandTerminalTelemetryProperties({
4579
- error,
4580
- exitCode,
4581
- recordedFailure,
4582
- pollSignal: context.pollSignal
4583
- });
4584
- const commandParams = extractCommandParams(command);
4585
- if (props) {
4586
- for (const key of Object.keys(props)) {
4587
- delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
4588
- }
4589
- }
4590
- const baseProperties = redactProperties({
4591
- ...commandParams,
4592
- ...props,
4593
- ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
4594
- command: "true",
4595
- ...terminalTelemetry,
4596
- ...errorMessage ? { errorMessage } : {}
4597
- });
4598
- telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
5397
+ if (terminalTelemetry.error_class === "internal" && error) {
5398
+ telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { command_name: telemetryName }, getInvocationRequestContext());
5399
+ }
5400
+ const commandParams = extractCommandParams(command);
5401
+ if (props) {
5402
+ for (const key of Object.keys(props)) {
5403
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
5404
+ }
5405
+ }
5406
+ const baseProperties = redactProperties({
5407
+ ...commandParams,
5408
+ ...props,
5409
+ ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
5410
+ command: "true",
5411
+ ...terminalTelemetry,
5412
+ ...errorMessage ? { errorMessage } : {}
5413
+ });
5414
+ emitInvocationRequest(telemetryName, success, baseProperties);
5415
+ } finally {
5416
+ releaseSuppliedArgumentValues(supplied);
5417
+ }
4599
5418
  });
4600
5419
  };
4601
5420
  // ../common/src/completer.ts
@@ -4619,6 +5438,204 @@ var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
4619
5438
  // ../common/src/constants.ts
4620
5439
  var DEFAULT_PAGE_SIZE = 50;
4621
5440
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
5441
+ // ../common/src/entity-name-rules.ts
5442
+ var RESERVED_SQL_KEYWORDS_LOWER = new Set(["group", "order"]);
5443
+ var RESERVED_FIELD_NAMES_LOWER = new Set([
5444
+ "id",
5445
+ "createdby",
5446
+ "createtime",
5447
+ "updatedby",
5448
+ "updatetime",
5449
+ "recordowner",
5450
+ "version"
5451
+ ]);
5452
+ var RESERVED_KEYWORDS_LOWER = new Set([
5453
+ "abstract",
5454
+ "as",
5455
+ "base",
5456
+ "bool",
5457
+ "break",
5458
+ "byte",
5459
+ "case",
5460
+ "catch",
5461
+ "char",
5462
+ "checked",
5463
+ "class",
5464
+ "const",
5465
+ "continue",
5466
+ "decimal",
5467
+ "default",
5468
+ "delegate",
5469
+ "do",
5470
+ "double",
5471
+ "else",
5472
+ "enum",
5473
+ "event",
5474
+ "explicit",
5475
+ "extern",
5476
+ "false",
5477
+ "finally",
5478
+ "fixed",
5479
+ "float",
5480
+ "for",
5481
+ "foreach",
5482
+ "goto",
5483
+ "if",
5484
+ "implicit",
5485
+ "in",
5486
+ "int",
5487
+ "interface",
5488
+ "internal",
5489
+ "is",
5490
+ "lock",
5491
+ "long",
5492
+ "namespace",
5493
+ "new",
5494
+ "null",
5495
+ "object",
5496
+ "operator",
5497
+ "out",
5498
+ "override",
5499
+ "params",
5500
+ "private",
5501
+ "protected",
5502
+ "public",
5503
+ "readonly",
5504
+ "ref",
5505
+ "return",
5506
+ "sbyte",
5507
+ "sealed",
5508
+ "short",
5509
+ "sizeof",
5510
+ "stackalloc",
5511
+ "static",
5512
+ "string",
5513
+ "struct",
5514
+ "switch",
5515
+ "this",
5516
+ "throw",
5517
+ "true",
5518
+ "try",
5519
+ "typeof",
5520
+ "uint",
5521
+ "ulong",
5522
+ "unchecked",
5523
+ "unsafe",
5524
+ "ushort",
5525
+ "using",
5526
+ "virtual",
5527
+ "void",
5528
+ "volatile",
5529
+ "while",
5530
+ "addhandler",
5531
+ "addressof",
5532
+ "alias",
5533
+ "and",
5534
+ "andalso",
5535
+ "boolean",
5536
+ "byref",
5537
+ "byval",
5538
+ "call",
5539
+ "cbool",
5540
+ "cbyte",
5541
+ "cchar",
5542
+ "cdate",
5543
+ "cdbl",
5544
+ "cdec",
5545
+ "cint",
5546
+ "clng",
5547
+ "cobj",
5548
+ "csbyte",
5549
+ "cshort",
5550
+ "csng",
5551
+ "cstr",
5552
+ "ctype",
5553
+ "cuint",
5554
+ "culng",
5555
+ "cushort",
5556
+ "date",
5557
+ "declare",
5558
+ "dim",
5559
+ "directcast",
5560
+ "each",
5561
+ "elseif",
5562
+ "end",
5563
+ "endif",
5564
+ "erase",
5565
+ "error",
5566
+ "exit",
5567
+ "friend",
5568
+ "function",
5569
+ "get",
5570
+ "gettype",
5571
+ "getxmlnamespace",
5572
+ "global",
5573
+ "gosub",
5574
+ "goto",
5575
+ "handles",
5576
+ "implements",
5577
+ "imports",
5578
+ "inherits",
5579
+ "integer",
5580
+ "isnot",
5581
+ "let",
5582
+ "lib",
5583
+ "like",
5584
+ "loop",
5585
+ "me",
5586
+ "mod",
5587
+ "module",
5588
+ "mustinherit",
5589
+ "mustoverride",
5590
+ "mybase",
5591
+ "myclass",
5592
+ "narrowing",
5593
+ "next",
5594
+ "not",
5595
+ "nothing",
5596
+ "notinheritable",
5597
+ "notoverridable",
5598
+ "of",
5599
+ "on",
5600
+ "option",
5601
+ "optional",
5602
+ "or",
5603
+ "orelse",
5604
+ "overloads",
5605
+ "overridable",
5606
+ "overrides",
5607
+ "paramarray",
5608
+ "partial",
5609
+ "property",
5610
+ "raiseevent",
5611
+ "redim",
5612
+ "rem",
5613
+ "removehandler",
5614
+ "resume",
5615
+ "select",
5616
+ "set",
5617
+ "shadows",
5618
+ "shared",
5619
+ "single",
5620
+ "step",
5621
+ "stop",
5622
+ "structure",
5623
+ "sub",
5624
+ "synclock",
5625
+ "then",
5626
+ "to",
5627
+ "trycast",
5628
+ "uinteger",
5629
+ "ushort",
5630
+ "variant",
5631
+ "wend",
5632
+ "when",
5633
+ "widening",
5634
+ "with",
5635
+ "withevents",
5636
+ "writeonly",
5637
+ "xor"
5638
+ ]);
4622
5639
  // ../common/src/host-global-options.ts
4623
5640
  var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
4624
5641
  "--output",
@@ -4743,8 +5760,81 @@ function getSdkUserAgentToken(pkg) {
4743
5760
  }
4744
5761
  // ../common/src/telemetry/ship-succeeded.ts
4745
5762
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
5763
+ function getShippedKeys() {
5764
+ const existing = shippedKeysSlot.get();
5765
+ if (existing) {
5766
+ return existing;
5767
+ }
5768
+ const keys = new Set;
5769
+ shippedKeysSlot.set(keys);
5770
+ return keys;
5771
+ }
5772
+ function dedupeKey(payload) {
5773
+ return [
5774
+ payload.command_name,
5775
+ payload.ship_kind,
5776
+ payload.target,
5777
+ payload.project_type,
5778
+ payload.artifact_correlation_key ?? payload.package_version_key ?? payload.deployment_key ?? payload.solution_id ?? payload.package_name ?? ""
5779
+ ].join("|");
5780
+ }
5781
+ function withPseudonymizedIdentifiers(payload) {
5782
+ return {
5783
+ ...payload,
5784
+ ...payload.package_name === undefined ? {} : {
5785
+ package_name: `package#${pseudonymize(payload.package_name)}`
5786
+ },
5787
+ ...payload.artifact_correlation_key === undefined ? {} : {
5788
+ artifact_correlation_key: `artifact#${pseudonymize(payload.artifact_correlation_key)}`
5789
+ }
5790
+ };
5791
+ }
5792
+ function trackShipSucceeded(payload) {
5793
+ const keys = getShippedKeys();
5794
+ const key = dedupeKey(payload);
5795
+ if (keys.has(key)) {
5796
+ return false;
5797
+ }
5798
+ keys.add(key);
5799
+ telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties(withPseudonymizedIdentifiers(payload)));
5800
+ return true;
5801
+ }
4746
5802
  // ../common/src/tool-provider.ts
4747
5803
  var factorySlot = singleton("PackagerFactoryProvider");
5804
+ // ../auth/src/catch-error.ts
5805
+ function isPromiseLike2(value) {
5806
+ return value !== null && typeof value === "object" && typeof value.then === "function";
5807
+ }
5808
+ function catchError2(fnOrPromise) {
5809
+ if (isPromiseLike2(fnOrPromise)) {
5810
+ return settlePromiseLike2(fnOrPromise);
5811
+ }
5812
+ try {
5813
+ const result = fnOrPromise();
5814
+ if (isPromiseLike2(result)) {
5815
+ return settlePromiseLike2(result);
5816
+ }
5817
+ return [undefined, result];
5818
+ } catch (error) {
5819
+ return [
5820
+ error instanceof Error ? error : new Error(String(error)),
5821
+ undefined
5822
+ ];
5823
+ }
5824
+ }
5825
+ function settlePromiseLike2(thenable) {
5826
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
5827
+ error instanceof Error ? error : new Error(String(error)),
5828
+ undefined
5829
+ ]);
5830
+ }
5831
+
5832
+ // ../auth/src/constants.ts
5833
+ var UIPATH_HOME_DIR = ".uipath";
5834
+ var AUTH_FILENAME = ".auth";
5835
+ var DEFAULT_BASE_URL = "https://cloud.uipath.com";
5836
+ var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
5837
+
4748
5838
  // ../auth/src/config.ts
4749
5839
  var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
4750
5840
  var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
@@ -4758,7 +5848,7 @@ class InvalidBaseUrlError extends Error {
4758
5848
  super(`Invalid base URL: "${url}"
4759
5849
  ` + `Reason: ${reason}
4760
5850
 
4761
- ` + `Expected format: an https:// URL, e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
5851
+ ` + `Expected format: an https:// URL (or bare host — https:// is assumed), e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
4762
5852
  ` + `You can specify the URL via:
4763
5853
  ` + ` • --authority flag
4764
5854
  ` + ` • UIPATH_URL environment variable
@@ -4779,10 +5869,16 @@ var normalizeAndValidateBaseUrl = (rawUrl) => {
4779
5869
  while (baseUrl.endsWith("/")) {
4780
5870
  baseUrl = baseUrl.slice(0, -1);
4781
5871
  }
5872
+ const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
5873
+ const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
5874
+ if (!hasScheme && hostCandidate.includes(".")) {
5875
+ baseUrl = `https://${baseUrl}`;
5876
+ }
4782
5877
  const resolvedBaseUrl = baseUrl;
4783
- const [urlError, url] = catchError(() => new URL(resolvedBaseUrl));
5878
+ const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
4784
5879
  if (urlError) {
4785
- throw new InvalidBaseUrlError(baseUrl, `Malformed URL. ${urlError instanceof Error ? urlError.message : "Unknown error"}`);
5880
+ const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
5881
+ throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
4786
5882
  }
4787
5883
  if (url.protocol !== "https:") {
4788
5884
  throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
@@ -4837,6 +5933,11 @@ var resolveConfigAsync = async ({
4837
5933
  };
4838
5934
  };
4839
5935
 
5936
+ // ../auth/src/utils/platform.ts
5937
+ function isBrowser() {
5938
+ return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
5939
+ }
5940
+
4840
5941
  // ../auth/src/authProfile.ts
4841
5942
  var DEFAULT_AUTH_PROFILE = "default";
4842
5943
  var PROFILE_DIR = "profiles";
@@ -4848,7 +5949,7 @@ function isAuthProfileStorage(value) {
4848
5949
  return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
4849
5950
  }
4850
5951
  function createProfileStorage() {
4851
- const [error, mod] = catchError(() => __require("node:async_hooks"));
5952
+ const [error, mod] = catchError2(() => __require("node:async_hooks"));
4852
5953
  if (error || typeof mod?.AsyncLocalStorage !== "function") {
4853
5954
  return {
4854
5955
  getStore: () => {
@@ -4864,9 +5965,9 @@ function getProfileStorage() {
4864
5965
  if (isAuthProfileStorage(existing)) {
4865
5966
  return existing;
4866
5967
  }
4867
- const storage = createProfileStorage();
4868
- globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
4869
- return storage;
5968
+ const storage2 = createProfileStorage();
5969
+ globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage2;
5970
+ return storage2;
4870
5971
  }
4871
5972
  var profileStorage = getProfileStorage();
4872
5973
 
@@ -4897,8 +5998,8 @@ function resolveAuthProfileFilePath(profile) {
4897
5998
  if (normalized === undefined) {
4898
5999
  throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
4899
6000
  }
4900
- const fs = getFileSystem();
4901
- return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
6001
+ const fs2 = getFileSystem();
6002
+ return fs2.path.join(fs2.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
4902
6003
  }
4903
6004
  function getActiveAuthProfileFilePath() {
4904
6005
  const profile = getActiveAuthProfile();
@@ -4979,7 +6080,7 @@ var getTokenExpiration = (accessToken) => {
4979
6080
  // ../auth/src/sessionIdentity.ts
4980
6081
  var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
4981
6082
  var decodeClaims = (accessToken) => {
4982
- const [error, claims] = catchError(() => parseJWT(accessToken));
6083
+ const [error, claims] = catchError2(() => parseJWT(accessToken));
4983
6084
  return error ? undefined : claims;
4984
6085
  };
4985
6086
  var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
@@ -5063,27 +6164,48 @@ var requireEnv = (name) => {
5063
6164
  }
5064
6165
  return value;
5065
6166
  };
6167
+ var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
6168
+ var resolveBaseUrl = (rawUrl, failureContext) => {
6169
+ const [baseUrlError, baseUrl] = catchError2(() => normalizeAndValidateBaseUrl(rawUrl));
6170
+ if (baseUrlError) {
6171
+ if (baseUrlError instanceof InvalidBaseUrlError) {
6172
+ throw baseUrlError;
6173
+ }
6174
+ throw new EnvAuthConfigError(`${failureContext}: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
6175
+ }
6176
+ return baseUrl;
6177
+ };
5066
6178
  var readAuthFromEnv = () => {
5067
6179
  const accessToken = requireEnv(ENV_AUTH_VARS.token);
5068
6180
  const organizationName = requireEnv(ENV_AUTH_VARS.organizationName);
5069
6181
  const organizationId = requireEnv(ENV_AUTH_VARS.organizationId);
5070
6182
  const tenantName = requireEnv(ENV_AUTH_VARS.tenantName);
5071
6183
  const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
5072
- const [parseError, payload] = catchError(() => parseJWT(accessToken));
6184
+ const [parseError, payload] = catchError2(() => parseJWT(accessToken));
5073
6185
  if (parseError) {
5074
- throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a valid JWT: ` + `${parseError instanceof Error ? parseError.message : String(parseError)}`);
6186
+ const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
6187
+ const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
6188
+ if (!rawUrl) {
6189
+ 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}).`);
6190
+ }
6191
+ const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
6192
+ return {
6193
+ loginStatus: "Logged in",
6194
+ accessToken,
6195
+ baseUrl: baseUrl2,
6196
+ organizationName,
6197
+ organizationId,
6198
+ tenantName,
6199
+ tenantId,
6200
+ source: "env-vars" /* EnvironmentVariables */,
6201
+ hint: "Token is opaque (not a JWT) - expiration and identity cannot be " + "determined locally. Commands will fail with 401 once it is revoked or " + `expired. If this was meant to be a JWT instead of a PAT, note: ${parseErrorMessage}`
6202
+ };
5075
6203
  }
5076
6204
  const iss = payload.iss;
5077
6205
  if (typeof iss !== "string" || iss.length === 0) {
5078
6206
  throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} has no 'iss' claim; cannot determine ` + `the UiPath server. Ensure the token was issued by a UiPath identity server.`);
5079
6207
  }
5080
- const [baseUrlError, baseUrl] = catchError(() => normalizeAndValidateBaseUrl(iss));
5081
- if (baseUrlError) {
5082
- if (baseUrlError instanceof InvalidBaseUrlError) {
5083
- throw baseUrlError;
5084
- }
5085
- throw new EnvAuthConfigError(`Failed to derive server URL from token 'iss' claim: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
5086
- }
6208
+ const baseUrl = resolveBaseUrl(iss, "Failed to derive server URL from token 'iss' claim");
5087
6209
  const expiration = getTokenExpiration(accessToken);
5088
6210
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
5089
6211
  const identity = resolveSessionIdentity(accessToken);
@@ -5109,8 +6231,8 @@ var SURFACE_WINDOW_MS = 60 * 60 * 1000;
5109
6231
  async function refreshTokenFingerprint(refreshToken) {
5110
6232
  const bytes = new TextEncoder().encode(refreshToken);
5111
6233
  if (globalThis.crypto?.subtle) {
5112
- const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
5113
- return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
6234
+ const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
6235
+ return Array.from(new Uint8Array(digest2), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
5114
6236
  }
5115
6237
  const { createHash } = await import("node:crypto");
5116
6238
  return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
@@ -5119,9 +6241,9 @@ function breakerPathFor(authPath) {
5119
6241
  return `${authPath}${BREAKER_SUFFIX}`;
5120
6242
  }
5121
6243
  async function loadRefreshBreaker(authPath) {
5122
- const fs = getFileSystem();
6244
+ const fs2 = getFileSystem();
5123
6245
  try {
5124
- const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
6246
+ const content = await fs2.readFile(breakerPathFor(authPath), "utf-8");
5125
6247
  if (!content)
5126
6248
  return {};
5127
6249
  const parsed = JSON.parse(content);
@@ -5132,20 +6254,20 @@ async function loadRefreshBreaker(authPath) {
5132
6254
  }
5133
6255
  async function saveRefreshBreaker(authPath, state) {
5134
6256
  try {
5135
- const fs = getFileSystem();
5136
- const path = breakerPathFor(authPath);
5137
- await fs.mkdir(fs.path.dirname(path));
5138
- const tempPath = `${path}.tmp`;
5139
- await fs.writeFile(tempPath, JSON.stringify(state));
5140
- await fs.rename(tempPath, path);
6257
+ const fs2 = getFileSystem();
6258
+ const path2 = breakerPathFor(authPath);
6259
+ await fs2.mkdir(fs2.path.dirname(path2));
6260
+ const tempPath = `${path2}.tmp`;
6261
+ await fs2.writeFile(tempPath, JSON.stringify(state));
6262
+ await fs2.rename(tempPath, path2);
5141
6263
  } catch {}
5142
6264
  }
5143
6265
  async function clearRefreshBreaker(authPath) {
5144
- const fs = getFileSystem();
5145
- const path = breakerPathFor(authPath);
6266
+ const fs2 = getFileSystem();
6267
+ const path2 = breakerPathFor(authPath);
5146
6268
  try {
5147
- if (await fs.exists(path)) {
5148
- await fs.rm(path);
6269
+ if (await fs2.exists(path2)) {
6270
+ await fs2.rm(path2);
5149
6271
  }
5150
6272
  } catch {}
5151
6273
  }
@@ -5166,43 +6288,43 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
5166
6288
  var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
5167
6289
  var PIPE_NAME_MAX_LENGTH = 103;
5168
6290
  var getRobotIpcPipeNames = async () => {
5169
- const fs = getFileSystem();
5170
- const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
6291
+ const fs2 = getFileSystem();
6292
+ const username = fs2.env.getenv("USER") ?? fs2.env.getenv("USERNAME");
5171
6293
  if (!username) {
5172
6294
  throw new Error("Unable to determine current username");
5173
6295
  }
5174
- const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
5175
- return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
6296
+ const tempPath = fs2.env.getenv("TMPDIR") ?? "/tmp/";
6297
+ return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs2.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
5176
6298
  };
5177
6299
  var defaultIsRobotIpcAvailable = async () => {
5178
6300
  if (process.platform === "win32") {
5179
6301
  return true;
5180
6302
  }
5181
- const [pipeNamesError, pipeNames] = await catchError(getRobotIpcPipeNames());
6303
+ const [pipeNamesError, pipeNames] = await catchError2(getRobotIpcPipeNames());
5182
6304
  if (pipeNamesError || !pipeNames) {
5183
6305
  return false;
5184
6306
  }
5185
- const fs = getFileSystem();
6307
+ const fs2 = getFileSystem();
5186
6308
  for (const pipeName of pipeNames) {
5187
- const [existsError, exists] = await catchError(fs.exists(pipeName));
6309
+ const [existsError, exists] = await catchError2(fs2.exists(pipeName));
5188
6310
  if (!existsError && exists === true) {
5189
6311
  return true;
5190
6312
  }
5191
6313
  }
5192
6314
  return false;
5193
6315
  };
5194
- var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
6316
+ var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
5195
6317
  const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
5196
6318
  promise.then((value) => {
5197
6319
  clearTimeout(timer);
5198
- resolve(value);
6320
+ resolve2(value);
5199
6321
  }, (error) => {
5200
6322
  clearTimeout(timer);
5201
6323
  reject(error);
5202
6324
  });
5203
6325
  });
5204
6326
  var parseResourceUrl = (url) => {
5205
- const [error, parsed] = catchError(() => new URL(url));
6327
+ const [error, parsed] = catchError2(() => new URL(url));
5206
6328
  if (error || !parsed)
5207
6329
  return;
5208
6330
  const segments = parsed.pathname.split("/").filter(Boolean);
@@ -5222,7 +6344,7 @@ var defaultLoadModule = async () => {
5222
6344
  if (!hostLoader) {
5223
6345
  return;
5224
6346
  }
5225
- const [error, mod] = await catchError(() => hostLoader());
6347
+ const [error, mod] = await catchError2(() => hostLoader());
5226
6348
  if (error || !mod) {
5227
6349
  return;
5228
6350
  }
@@ -5248,7 +6370,7 @@ var tryRobotClientFallback = async (options = {}) => {
5248
6370
  const mod = await loadModule();
5249
6371
  if (!mod)
5250
6372
  return;
5251
- const [ctorError, proxy] = catchError(() => new mod.RobotProxyConstructor);
6373
+ const [ctorError, proxy] = catchError2(() => new mod.RobotProxyConstructor);
5252
6374
  if (ctorError || !proxy) {
5253
6375
  return;
5254
6376
  }
@@ -5271,7 +6393,7 @@ var tryRobotClientFallback = async (options = {}) => {
5271
6393
  let organizationIdFromToken;
5272
6394
  let tenantIdFromToken;
5273
6395
  let issuerFromToken;
5274
- const [jwtError, claims] = catchError(() => parseJWT(accessToken));
6396
+ const [jwtError, claims] = catchError2(() => parseJWT(accessToken));
5275
6397
  if (!jwtError && claims) {
5276
6398
  const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
5277
6399
  if (typeof rawOrgId === "string" && rawOrgId.length > 0) {
@@ -5298,7 +6420,7 @@ var tryRobotClientFallback = async (options = {}) => {
5298
6420
  } catch {
5299
6421
  return;
5300
6422
  } finally {
5301
- await catchError(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
6423
+ await catchError2(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
5302
6424
  }
5303
6425
  };
5304
6426
 
@@ -5368,9 +6490,9 @@ var errorCode = (err) => {
5368
6490
  }
5369
6491
  return "EUNKNOWN";
5370
6492
  };
5371
- var probeAsync = async (fs, candidate) => {
6493
+ var probeAsync = async (fs2, candidate) => {
5372
6494
  try {
5373
- const stats = await fs.stat(candidate);
6495
+ const stats = await fs2.stat(candidate);
5374
6496
  if (stats === null) {
5375
6497
  return { exists: false };
5376
6498
  }
@@ -5397,9 +6519,9 @@ var probeAsync = async (fs, candidate) => {
5397
6519
  }
5398
6520
  };
5399
6521
  var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
5400
- const fs = getFileSystem();
5401
- if (fs.path.isAbsolute(envFilePath)) {
5402
- const probe2 = await probeAsync(fs, envFilePath);
6522
+ const fs2 = getFileSystem();
6523
+ if (fs2.path.isAbsolute(envFilePath)) {
6524
+ const probe2 = await probeAsync(fs2, envFilePath);
5403
6525
  return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
5404
6526
  exists: false,
5405
6527
  absolutePath: envFilePath,
@@ -5407,11 +6529,11 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
5407
6529
  ...probe2.unusable ? { unusable: probe2.unusable } : {}
5408
6530
  };
5409
6531
  }
5410
- const cwd = opts?.cwd ?? fs.env.cwd();
6532
+ const cwd = opts?.cwd ?? fs2.env.cwd();
5411
6533
  let searchDir = cwd;
5412
6534
  while (true) {
5413
- const candidate = fs.path.join(searchDir, envFilePath);
5414
- const probe2 = await probeAsync(fs, candidate);
6535
+ const candidate = fs2.path.join(searchDir, envFilePath);
6536
+ const probe2 = await probeAsync(fs2, candidate);
5415
6537
  if (probe2.exists) {
5416
6538
  return {
5417
6539
  exists: true,
@@ -5419,14 +6541,14 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
5419
6541
  source: searchDir === cwd ? "cwd" : "ancestor"
5420
6542
  };
5421
6543
  }
5422
- const parentDir = fs.path.dirname(searchDir);
6544
+ const parentDir = fs2.path.dirname(searchDir);
5423
6545
  if (parentDir === searchDir) {
5424
6546
  break;
5425
6547
  }
5426
6548
  searchDir = parentDir;
5427
6549
  }
5428
- const homePath = fs.path.join(fs.env.homedir(), envFilePath);
5429
- const probe = await probeAsync(fs, homePath);
6550
+ const homePath = fs2.path.join(fs2.env.homedir(), envFilePath);
6551
+ const probe = await probeAsync(fs2, homePath);
5430
6552
  if (probe.exists) {
5431
6553
  return { exists: true, absolutePath: homePath, source: "home" };
5432
6554
  }
@@ -5448,12 +6570,12 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
5448
6570
  };
5449
6571
  };
5450
6572
  var loadEnvFileAsync = async ({ envPath }) => {
5451
- const fs = getFileSystem();
5452
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
5453
- if (!await fs.exists(absolutePath)) {
6573
+ const fs2 = getFileSystem();
6574
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
6575
+ if (!await fs2.exists(absolutePath)) {
5454
6576
  throw new Error(`Environment file not found: ${envPath}`);
5455
6577
  }
5456
- const content = await fs.readFile(absolutePath, "utf-8");
6578
+ const content = await fs2.readFile(absolutePath, "utf-8");
5457
6579
  if (content === null) {
5458
6580
  throw new Error(`Environment file not found: ${envPath}`);
5459
6581
  }
@@ -5482,10 +6604,10 @@ var saveEnvFileAsync = async ({
5482
6604
  data,
5483
6605
  merge = true
5484
6606
  }) => {
5485
- const fs = getFileSystem();
5486
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
6607
+ const fs2 = getFileSystem();
6608
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.homedir(), envPath);
5487
6609
  let existingData = {};
5488
- if (merge && await fs.exists(absolutePath)) {
6610
+ if (merge && await fs2.exists(absolutePath)) {
5489
6611
  try {
5490
6612
  existingData = await loadEnvFileAsync({ envPath: absolutePath });
5491
6613
  } catch {}
@@ -5503,11 +6625,11 @@ var saveEnvFileAsync = async ({
5503
6625
  const content = `${lines.join(`
5504
6626
  `)}
5505
6627
  `;
5506
- const dir = fs.path.dirname(absolutePath);
5507
- await fs.mkdir(dir);
6628
+ const dir = fs2.path.dirname(absolutePath);
6629
+ await fs2.mkdir(dir);
5508
6630
  const tempPath = `${absolutePath}.tmp`;
5509
- await fs.writeFile(tempPath, content);
5510
- await fs.rename(tempPath, absolutePath);
6631
+ await fs2.writeFile(tempPath, content);
6632
+ await fs2.rename(tempPath, absolutePath);
5511
6633
  };
5512
6634
 
5513
6635
  // ../auth/src/loginStatus.ts
@@ -5621,11 +6743,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
5621
6743
  return { credentials };
5622
6744
  }
5623
6745
  async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
5624
- const fs = getFs();
5625
- const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
6746
+ const fs2 = getFs();
6747
+ const globalPath = fs2.path.join(fs2.env.homedir(), envFilePath);
5626
6748
  if (absolutePath === globalPath)
5627
6749
  return;
5628
- if (!await fs.exists(globalPath))
6750
+ if (!await fs2.exists(globalPath))
5629
6751
  return;
5630
6752
  try {
5631
6753
  const globalCreds = await loadEnvFile({ envPath: globalPath });
@@ -5999,7 +7121,7 @@ var TENANT_SELECTION_CODES = new Set([
5999
7121
  var package_default2 = {
6000
7122
  name: "@uipath/ixp-sdk",
6001
7123
  license: "MIT",
6002
- version: "1.201.0",
7124
+ version: "1.202.0-preview.136",
6003
7125
  description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
6004
7126
  repository: {
6005
7127
  type: "git",
@@ -6127,27 +7249,27 @@ var DESIGNTIME_API_VERSION = "1.0";
6127
7249
  function designtimeBasePath(config) {
6128
7250
  return platformBasePath(config, "du_/api/designtimeapi");
6129
7251
  }
6130
- function designtimeUrl(config, path) {
6131
- const separator = path.includes("?") ? "&" : "?";
6132
- return `${designtimeBasePath(config)}${path}${separator}api-version=${DESIGNTIME_API_VERSION}`;
7252
+ function designtimeUrl(config, path2) {
7253
+ const separator = path2.includes("?") ? "&" : "?";
7254
+ return `${designtimeBasePath(config)}${path2}${separator}api-version=${DESIGNTIME_API_VERSION}`;
6133
7255
  }
6134
- async function designtimeGet(config, path, errorMessage2) {
6135
- return request(config, designtimeUrl(config, path), { method: "GET" }, errorMessage2);
7256
+ async function designtimeGet(config, path2, errorMessage2) {
7257
+ return request(config, designtimeUrl(config, path2), { method: "GET" }, errorMessage2);
6136
7258
  }
6137
- async function designtimePost(config, path, body, errorMessage2) {
6138
- return request(config, designtimeUrl(config, path), { method: "POST", body: JSON.stringify(body ?? {}) }, errorMessage2);
7259
+ async function designtimePost(config, path2, body, errorMessage2) {
7260
+ return request(config, designtimeUrl(config, path2), { method: "POST", body: JSON.stringify(body ?? {}) }, errorMessage2);
6139
7261
  }
6140
- async function designtimePut(config, path, body, errorMessage2) {
6141
- return request(config, designtimeUrl(config, path), { method: "PUT", body: JSON.stringify(body ?? {}) }, errorMessage2);
7262
+ async function designtimePut(config, path2, body, errorMessage2) {
7263
+ return request(config, designtimeUrl(config, path2), { method: "PUT", body: JSON.stringify(body ?? {}) }, errorMessage2);
6142
7264
  }
6143
- async function designtimePatch(config, path, body, errorMessage2) {
6144
- return request(config, designtimeUrl(config, path), { method: "PATCH", body: JSON.stringify(body ?? {}) }, errorMessage2);
7265
+ async function designtimePatch(config, path2, body, errorMessage2) {
7266
+ return request(config, designtimeUrl(config, path2), { method: "PATCH", body: JSON.stringify(body ?? {}) }, errorMessage2);
6145
7267
  }
6146
- async function designtimeDelete(config, path, errorMessage2) {
6147
- return request(config, designtimeUrl(config, path), { method: "DELETE" }, errorMessage2);
7268
+ async function designtimeDelete(config, path2, errorMessage2) {
7269
+ return request(config, designtimeUrl(config, path2), { method: "DELETE" }, errorMessage2);
6148
7270
  }
6149
- async function designtimeUploadMultipart(config, path, formData, errorMessage2) {
6150
- const url = designtimeUrl(config, path);
7271
+ async function designtimeUploadMultipart(config, path2, formData, errorMessage2) {
7272
+ const url = designtimeUrl(config, path2);
6151
7273
  const response = await fetch(url, {
6152
7274
  method: "POST",
6153
7275
  headers: baseHeaders(config),
@@ -6159,8 +7281,8 @@ async function designtimeUploadMultipart(config, path, formData, errorMessage2)
6159
7281
  }
6160
7282
  return await response.json();
6161
7283
  }
6162
- async function designtimeDownloadBinary(config, path, errorMessage2) {
6163
- const url = designtimeUrl(config, path);
7284
+ async function designtimeDownloadBinary(config, path2, errorMessage2) {
7285
+ const url = designtimeUrl(config, path2);
6164
7286
  const response = await fetch(url, {
6165
7287
  method: "GET",
6166
7288
  headers: baseHeaders(config)
@@ -6543,7 +7665,7 @@ var DATA_TYPES_DELETE_EXAMPLES = [
6543
7665
  var registerDataTypesCommand = (program2) => {
6544
7666
  const dataTypes = program2.command("data-types").description("Manage data types (entity_defs) — the reusable type definitions fields reference via field_type_id");
6545
7667
  dataTypes.command("add").description("Create a new data type in the project").argument("<project-name>", "Project name").requiredOption("--name <name>", "Data type name").requiredOption("--kind <kind>", "Underlying data type kind: text, date, money, number, boolean, choice").requiredOption("--instructions <text>", "Instructions describing what this type represents and where its values appear").option("--input-value <mode>", "Whether the value appears verbatim in the document (exact-match) or is inferred/computed (inferred). Required when --kind is text or choice; forbidden for date, money, number, and boolean (those kinds don't have this property — matches the IXP UI's radio visibility).").option("--choices <json>", 'Required when --kind choice. JSON array of choices: [{"value":"<canonical>","alternates":["<alt1>","<alt2>",...]}]. `value` (required) is the canonical display name (model output). `alternates` (optional, defaults to []) are alternate spellings the model maps to `value` — omit or set to [] when the canonical value is the only matched form.').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DATA_TYPES_ADD_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6546
- const [err, response] = await catchError2((async () => {
7668
+ const [err, response] = await catchError((async () => {
6547
7669
  const choices = options.choices ? parseChoicesJson(options.choices) : undefined;
6548
7670
  const config = await createIxpConfig({
6549
7671
  tenant: options.tenant
@@ -6571,7 +7693,7 @@ var registerDataTypesCommand = (program2) => {
6571
7693
  }, { preserveDataKeys: true });
6572
7694
  });
6573
7695
  dataTypes.command("update-instructions").description("Replace the instructions on an existing data type").argument("<project-name>", "Project name").requiredOption("--name <name>", "Data type name").requiredOption("--instructions <text>", "New instructions text (replaces the existing instructions)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DATA_TYPES_UPDATE_INSTRUCTIONS_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6574
- const [err, response] = await catchError2((async () => {
7696
+ const [err, response] = await catchError((async () => {
6575
7697
  const config = await createIxpConfig({
6576
7698
  tenant: options.tenant
6577
7699
  });
@@ -6592,7 +7714,7 @@ var registerDataTypesCommand = (program2) => {
6592
7714
  }, { preserveDataKeys: true });
6593
7715
  });
6594
7716
  dataTypes.command("rename").description("Rename a data type. Existing field references stay intact.").argument("<project-name>", "Project name").requiredOption("--name <name>", "Current data type name").requiredOption("--new-name <name>", "New data type name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DATA_TYPES_RENAME_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6595
- const [err, response] = await catchError2((async () => {
7717
+ const [err, response] = await catchError((async () => {
6596
7718
  const config = await createIxpConfig({
6597
7719
  tenant: options.tenant
6598
7720
  });
@@ -6615,7 +7737,7 @@ var registerDataTypesCommand = (program2) => {
6615
7737
  dataTypes.command("delete").description("Delete a data type. IRREVERSIBLE: any field referencing it via field_type_id will break.").argument("<project-name>", "Project name").requiredOption("--name <name>", "Data type name to delete").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(DATA_TYPES_DELETE_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6616
7738
  if (!requireConfirmation(options, `delete data type '${options.name}'`))
6617
7739
  return;
6618
- const [err, response] = await catchError2((async () => {
7740
+ const [err, response] = await catchError((async () => {
6619
7741
  const config = await createIxpConfig({
6620
7742
  tenant: options.tenant
6621
7743
  });
@@ -6718,7 +7840,7 @@ var DEPLOYMENTS_LIST_EXAMPLES = [
6718
7840
  var registerDeploymentsCommand = (program2) => {
6719
7841
  const deployments = program2.command("deployments").description("Manage IXP deployments — deploy trained model versions to Orchestrator folders, move a deployment to another version, and inspect the taxonomy pinned to a version");
6720
7842
  deployments.command("create").description("Deploy a trained model version to an Orchestrator folder, making it callable at runtime by activities and Maestro Flow. Only ever adds a deployment — moving an existing one is `deployments upgrade`.").argument("<project-name>", "Project name").requiredOption("--version <number>", "Trained model version to deploy (non-negative integer). Get available versions from `uip ixp projects list-models <project-name> --output json`.", (raw) => parseBoundedInt(raw, "--version", { min: 0, max: 1e6 })).requiredOption("--folder-key <guid>", "Orchestrator folder key (GUID) to deploy into. Get it from `uip or folders list --output json`.").option("--title <title>", "Title to deploy under (defaults to the project name minus its '-ixp' suffix). Comes back verbatim as DeploymentTitle; the backend slugs and suffixes it into the name the runtime resolves, returned as DeploymentName.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DEPLOYMENTS_CREATE_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6721
- const [err, deployment] = await catchError2((async () => {
7843
+ const [err, deployment] = await catchError((async () => {
6722
7844
  const config = await createIxpConfig({
6723
7845
  tenant: options.tenant
6724
7846
  });
@@ -6740,7 +7862,7 @@ var registerDeploymentsCommand = (program2) => {
6740
7862
  });
6741
7863
  });
6742
7864
  deployments.command("upgrade").description("Move an existing deployment to another trained model version, changing which version every runtime caller of that folder and name gets").argument("<project-name>", "Project name").argument("<deployment-name>", "Deployment to move, addressed by the name the runtime resolves — the DeploymentName field of `uip ixp deployments list <project-name> --output json`, not the title it was created under.").requiredOption("--version <number>", "Trained model version to move the deployment to (non-negative integer). Get available versions from `uip ixp projects list-models <project-name> --output json`.", (raw) => parseBoundedInt(raw, "--version", { min: 0, max: 1e6 })).requiredOption("--folder-key <guid>", "Orchestrator folder key (GUID) hosting the deployment. The same name can be deployed in several folders, so the folder is part of the identity.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DEPLOYMENTS_UPGRADE_EXAMPLES).trackedAction(processContext, async (projectName, deploymentName, options) => {
6743
- const [err, deployment] = await catchError2((async () => {
7865
+ const [err, deployment] = await catchError((async () => {
6744
7866
  const config = await createIxpConfig({
6745
7867
  tenant: options.tenant
6746
7868
  });
@@ -6761,7 +7883,7 @@ var registerDeploymentsCommand = (program2) => {
6761
7883
  });
6762
7884
  });
6763
7885
  deployments.command("list").description("List the project's model deployments, across every version and folder it has been deployed to").argument("<project-name>", "Project name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DEPLOYMENTS_LIST_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6764
- const [err, response] = await catchError2((async () => {
7886
+ const [err, response] = await catchError((async () => {
6765
7887
  const config = await createIxpConfig({
6766
7888
  tenant: options.tenant
6767
7889
  });
@@ -6779,7 +7901,7 @@ var registerDeploymentsCommand = (program2) => {
6779
7901
  });
6780
7902
  });
6781
7903
  deployments.command("get-taxonomy").description("Get the project taxonomy (data types + field groups) at a specific trained model version").argument("<project-name>", "Project name").requiredOption("--version <number>", "Trained model version (non-negative integer). Get available versions from `uip ixp projects list-models <project-name> --output json`.", (raw) => parseBoundedInt(raw, "--version", { min: 0, max: 1e6 })).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DEPLOYMENTS_GET_TAXONOMY_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6782
- const [err, taxonomy] = await catchError2((async () => {
7904
+ const [err, taxonomy] = await catchError((async () => {
6783
7905
  const config = await createIxpConfig({
6784
7906
  tenant: options.tenant
6785
7907
  });
@@ -6845,8 +7967,8 @@ function applyDetectedExtension(targetPath, detectedExt) {
6845
7967
  return targetPath + detectedExt;
6846
7968
  }
6847
7969
  function defaultDownloadPath() {
6848
- const fs = getFileSystem();
6849
- return fs.path.join(fs.env.tmpdir(), "ixp_document");
7970
+ const fs2 = getFileSystem();
7971
+ return fs2.path.join(fs2.env.tmpdir(), "ixp_document");
6850
7972
  }
6851
7973
  var DOCUMENTS_LIST_EXAMPLES = [
6852
7974
  {
@@ -6932,7 +8054,7 @@ var DOCUMENTS_DELETE_EXAMPLES = [
6932
8054
  var registerDocumentsCommand = (program2) => {
6933
8055
  const document = program2.command("documents").description("Read IXP document content");
6934
8056
  document.command("list").description("List all documents in a project").argument("<project-name>", "Project name").option("-l, --limit <number>", "Number of items to return (1-10000)", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of items to skip (0-1000000)", parseOffset, 0).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DOCUMENTS_LIST_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
6935
- const [err, page] = await catchError2((async () => {
8057
+ const [err, page] = await catchError((async () => {
6936
8058
  const config = await createIxpConfig({
6937
8059
  tenant: options.tenant
6938
8060
  });
@@ -6953,16 +8075,16 @@ var registerDocumentsCommand = (program2) => {
6953
8075
  }, { preserveDataKeys: true });
6954
8076
  });
6955
8077
  document.command("download").description("Download the original document file (PDF/PNG/JPG/etc.) for viewing").argument("<project-name>", "Project name").argument("<document-id>", "Document ID").option("-o, --output <path>", "Output file path (extension auto-corrected to match content type)", defaultDownloadPath()).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DOCUMENTS_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (projectName, documentUid, options) => {
6956
- const [err, result] = await catchError2((async () => {
8078
+ const [err, result] = await catchError((async () => {
6957
8079
  const config = await createIxpConfig({
6958
8080
  tenant: options.tenant
6959
8081
  });
6960
8082
  const { buffer, contentType } = await downloadDocument(config, projectName, documentUid);
6961
8083
  const bytes = new Uint8Array(buffer);
6962
8084
  const detectedExt = extensionForContentType(contentType);
6963
- const fs = getFileSystem();
8085
+ const fs2 = getFileSystem();
6964
8086
  const finalPath = applyDetectedExtension(options.output, detectedExt);
6965
- await fs.writeFile(finalPath, bytes);
8087
+ await fs2.writeFile(finalPath, bytes);
6966
8088
  return {
6967
8089
  path: finalPath,
6968
8090
  contentType,
@@ -6985,18 +8107,18 @@ var registerDocumentsCommand = (program2) => {
6985
8107
  });
6986
8108
  });
6987
8109
  document.command("upload").description("Upload a document file to an existing project").argument("<project-name>", "Project name").argument("<file>", "Path to the document file to upload").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(DOCUMENTS_UPLOAD_EXAMPLES).trackedAction(processContext, async (projectName, file, options) => {
6988
- const [err, response] = await catchError2((async () => {
6989
- const fs = getFileSystem();
6990
- const resolvedPath = fs.path.resolve(file);
6991
- const filename = fs.path.basename(resolvedPath);
8110
+ const [err, response] = await catchError((async () => {
8111
+ const fs2 = getFileSystem();
8112
+ const resolvedPath = fs2.path.resolve(file);
8113
+ const filename = fs2.path.basename(resolvedPath);
6992
8114
  const ext = getExtension(filename);
6993
8115
  if (!SUPPORTED_DOCUMENT_EXTENSIONS.has(ext)) {
6994
8116
  throw new Error(`Unsupported file type "${ext || "(none)"}". Supported: ${[...SUPPORTED_DOCUMENT_EXTENSIONS].join(", ")}`);
6995
8117
  }
6996
- if (!await fs.exists(resolvedPath)) {
8118
+ if (!await fs2.exists(resolvedPath)) {
6997
8119
  throw new Error(`File not found: ${resolvedPath}`);
6998
8120
  }
6999
- const fileBuffer = await fs.readFile(resolvedPath);
8121
+ const fileBuffer = await fs2.readFile(resolvedPath);
7000
8122
  if (!fileBuffer) {
7001
8123
  throw new Error(`Failed to read file: ${resolvedPath}`);
7002
8124
  }
@@ -7020,7 +8142,7 @@ var registerDocumentsCommand = (program2) => {
7020
8142
  document.command("delete").description("Delete a document from a project").argument("<project-name>", "Project name").argument("<document-id>", "Document ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(DOCUMENTS_DELETE_EXAMPLES).trackedAction(processContext, async (projectName, documentUid, options) => {
7021
8143
  if (!requireConfirmation(options, `delete document '${documentUid}'`))
7022
8144
  return;
7023
- const [err, response] = await catchError2((async () => {
8145
+ const [err, response] = await catchError((async () => {
7024
8146
  const config = await createIxpConfig({
7025
8147
  tenant: options.tenant
7026
8148
  });
@@ -7116,7 +8238,7 @@ var FIELDS_UPDATE_PROMPTS_EXAMPLES = [
7116
8238
  var registerFieldsCommand = (program2) => {
7117
8239
  const fields = program2.command("fields").description("Edit fields within a project's field groups (label_defs)");
7118
8240
  fields.command("add").description("Add a new field to a field group").argument("<project-name>", "Project name").requiredOption("--group <name>", "Field group (label_def) name").requiredOption("--field <name>", "New field name").requiredOption("--type <type-name>", "Field type — name of an entity_def in the project's taxonomy").requiredOption("--instructions <text>", "Instructions for the new field — describes what to extract and where to find it").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(FIELDS_ADD_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7119
- const [err, response] = await catchError2((async () => {
8241
+ const [err, response] = await catchError((async () => {
7120
8242
  const config = await createIxpConfig({
7121
8243
  tenant: options.tenant
7122
8244
  });
@@ -7140,7 +8262,7 @@ var registerFieldsCommand = (program2) => {
7140
8262
  fields.command("delete").description("Delete a field from a field group").argument("<project-name>", "Project name").requiredOption("--group <name>", "Field group (label_def) name").requiredOption("--field <name>", "Field name to delete").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(FIELDS_DELETE_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7141
8263
  if (!requireConfirmation(options, `delete field '${options.field}'`))
7142
8264
  return;
7143
- const [err, response] = await catchError2((async () => {
8265
+ const [err, response] = await catchError((async () => {
7144
8266
  const config = await createIxpConfig({
7145
8267
  tenant: options.tenant
7146
8268
  });
@@ -7158,7 +8280,7 @@ var registerFieldsCommand = (program2) => {
7158
8280
  }, { preserveDataKeys: true });
7159
8281
  });
7160
8282
  fields.command("rename").description("Rename a field within a field group").argument("<project-name>", "Project name").requiredOption("--group <name>", "Field group (label_def) name").requiredOption("--field <name>", "Current field name").requiredOption("--new-name <name>", "New field name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(FIELDS_RENAME_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7161
- const [err, response] = await catchError2((async () => {
8283
+ const [err, response] = await catchError((async () => {
7162
8284
  const config = await createIxpConfig({
7163
8285
  tenant: options.tenant
7164
8286
  });
@@ -7178,7 +8300,7 @@ var registerFieldsCommand = (program2) => {
7178
8300
  fields.command("change-type").description("Change a field's type. IRREVERSIBLE: existing annotations for this field are deleted.").argument("<project-name>", "Project name").requiredOption("--group <name>", "Field group (label_def) name").requiredOption("--field <name>", "Field name").requiredOption("--type <type-name>", "New field type — name of an entity_def in the project's taxonomy").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(FIELDS_CHANGE_TYPE_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7179
8301
  if (!requireConfirmation(options, `change the type of field '${options.field}' (deletes its annotations)`))
7180
8302
  return;
7181
- const [err, response] = await catchError2((async () => {
8303
+ const [err, response] = await catchError((async () => {
7182
8304
  const config = await createIxpConfig({
7183
8305
  tenant: options.tenant
7184
8306
  });
@@ -7196,7 +8318,7 @@ var registerFieldsCommand = (program2) => {
7196
8318
  }, { preserveDataKeys: true });
7197
8319
  });
7198
8320
  fields.command("update-prompts").description("Bulk-update per-field extraction instructions. Match by moon_form field name; existing definitions preserved.").argument("<project-name>", "Project name").requiredOption("--updates <json>", 'JSON array of per-field instruction updates: [{"name":"Invoice Number","instructions":"..."}]. Match by moon_form field name.').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(FIELDS_UPDATE_PROMPTS_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7199
- const [err, response] = await catchError2((async () => {
8321
+ const [err, response] = await catchError((async () => {
7200
8322
  const rawUpdates = JSON.parse(options.updates);
7201
8323
  if (!Array.isArray(rawUpdates)) {
7202
8324
  throw new Error('--updates must be a JSON array, e.g. [{"name":"Invoice Number","instructions":"..."}]');
@@ -7340,7 +8462,7 @@ var GROUPS_UPDATE_PROMPTS_EXAMPLES = [
7340
8462
  var registerGroupsCommand = (program2) => {
7341
8463
  const groups = program2.command("groups").description("Manage field groups (label_defs) — the document type containers for fields");
7342
8464
  groups.command("add").description("Create a new field group with instructions and at least one field").argument("<project-name>", "Project name").requiredOption("--name <name>", "New field group name").requiredOption("--instructions <text>", "Instructions for the group — describes what kind of document/section it covers").requiredOption("--fields <json>", 'JSON array of fields to create in the group (at least one): [{"name":"...","type":"<type-name>","instructions":"..."}]. `type` is the name of an entity_def in the project taxonomy.').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(GROUPS_ADD_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7343
- const [err, response] = await catchError2((async () => {
8465
+ const [err, response] = await catchError((async () => {
7344
8466
  const fields = parseFieldsJson(options.fields);
7345
8467
  const config = await createIxpConfig({
7346
8468
  tenant: options.tenant
@@ -7366,7 +8488,7 @@ var registerGroupsCommand = (program2) => {
7366
8488
  groups.command("delete").description("Delete a field group. IRREVERSIBLE: all annotations on all fields in the group are deleted.").argument("<project-name>", "Project name").requiredOption("--name <name>", "Field group name to delete").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(GROUPS_DELETE_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7367
8489
  if (!requireConfirmation(options, `delete group '${options.name}'`))
7368
8490
  return;
7369
- const [err, response] = await catchError2((async () => {
8491
+ const [err, response] = await catchError((async () => {
7370
8492
  const config = await createIxpConfig({
7371
8493
  tenant: options.tenant
7372
8494
  });
@@ -7384,7 +8506,7 @@ var registerGroupsCommand = (program2) => {
7384
8506
  }, { preserveDataKeys: true });
7385
8507
  });
7386
8508
  groups.command("rename").description("Rename a field group. Preserves all fields and annotations.").argument("<project-name>", "Project name").requiredOption("--name <name>", "Current field group name").requiredOption("--new-name <name>", "New field group name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(GROUPS_RENAME_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7387
- const [err, response] = await catchError2((async () => {
8509
+ const [err, response] = await catchError((async () => {
7388
8510
  const config = await createIxpConfig({
7389
8511
  tenant: options.tenant
7390
8512
  });
@@ -7404,7 +8526,7 @@ var registerGroupsCommand = (program2) => {
7404
8526
  }, { preserveDataKeys: true });
7405
8527
  });
7406
8528
  groups.command("update-prompts").description("Bulk-update field group (label_def) extraction instructions. Match by group name; existing fields preserved.").argument("<project-name>", "Project name").requiredOption("--updates <json>", 'JSON array of field group instruction updates: [{"name":"Invoice","instructions":"..."}]. Match by label_def name.').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(GROUPS_UPDATE_PROMPTS_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
7407
- const [err, response] = await catchError2((async () => {
8529
+ const [err, response] = await catchError((async () => {
7408
8530
  const updates = parseUpdatesJson(options.updates);
7409
8531
  const config = await createIxpConfig({
7410
8532
  tenant: options.tenant
@@ -7850,7 +8972,7 @@ var registerLabellingsCommand = (program2) => {
7850
8972
  if (!documentUid) {
7851
8973
  getOutputSink().writeErr(PROJECT_WIDE_DEPRECATION_WARNING);
7852
8974
  }
7853
- const [err, result] = await catchError2((async () => {
8975
+ const [err, result] = await catchError((async () => {
7854
8976
  validateConfirmMode(documentUid, options);
7855
8977
  const config = await createIxpConfig({
7856
8978
  tenant: options.tenant
@@ -7891,7 +9013,7 @@ var registerLabellingsCommand = (program2) => {
7891
9013
  });
7892
9014
  });
7893
9015
  labelling.command("unconfirm").description("Remove confirmations from a document — the targeted fields go back to un-annotated state. Use to roll back an earlier confirm or mark-missing when you realize it was a mistake. Every other annotation on the document is carried forward. With --fields alone, each field_id is unconfirmed across every occurrence it appears in. For a repeatable field group, narrow with --group: alone it unconfirms every occurrence; add --occurrence to roll back ONE occurrence (the ergonomic single-line form); or use --updates to roll back SEVERAL occurrences in one atomic call. Mirrors `confirm`'s targeting flags.").argument("<project-name>", "Project name").argument("<document-id>", "Document ID").option("-f, --fields <field-ids>", "Comma-separated field IDs to unconfirm. Without --group, unconfirms each field_id across every occurrence it appears in. With --group + --occurrence, limits to that specific occurrence; omit it to unconfirm every annotated field in the targeted occurrence(s).").option("--group <name>", 'Target field group (label_def). Must be the FULL label path exactly as shown in the "Name" field of `get-predictions` (e.g. "Invoice > Line Items"), not just the leaf name. On its own, unconfirms every occurrence of the group. Add --occurrence to target a single occurrence, or --updates to batch specific occurrences in one call. Combine with --fields to limit to specific fields within the group.').option("--occurrence <index>", "Single-occurrence form: 0-based index of ONE occurrence within --group to unconfirm. Use --fields to limit to specific fields in that occurrence; omit --fields to unconfirm every annotated field there. Requires --group. Mutually exclusive with --updates.").option("--updates <json>", 'Batched form: unconfirm SEVERAL occurrences of --group in one atomic call. JSON array of {"occurrence":<0-based-index>,"fields"?:["<field_id>",...]}. Per entry: omit "fields" to unconfirm every annotated field in that occurrence, or list specific ones. Occurrences not listed are left as-is. Mutually exclusive with --fields and --occurrence.').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(LABELLINGS_UNCONFIRM_EXAMPLES).trackedAction(processContext, async (projectName, documentUid, options) => {
7894
- const [err, result] = await catchError2((async () => {
9016
+ const [err, result] = await catchError((async () => {
7895
9017
  validateUnconfirmMode(options);
7896
9018
  const config = await createIxpConfig({
7897
9019
  tenant: options.tenant
@@ -7914,7 +9036,7 @@ var registerLabellingsCommand = (program2) => {
7914
9036
  }, { preserveDataKeys: true });
7915
9037
  });
7916
9038
  labelling.command("mark-missing").description("Mark fields as missing in a document — the field is annotated as having no value and no location. Use when the field is genuinely absent from the document.").argument("<project-name>", "Project name").argument("<document-id>", "Document ID").requiredOption("-f, --fields <field-ids>", "Comma-separated field IDs to mark as missing").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(LABELLINGS_MARK_MISSING_EXAMPLES).trackedAction(processContext, async (projectName, documentUid, options) => {
7917
- const [err, result] = await catchError2((async () => {
9039
+ const [err, result] = await catchError((async () => {
7918
9040
  const config = await createIxpConfig({
7919
9041
  tenant: options.tenant
7920
9042
  });
@@ -7943,7 +9065,7 @@ var registerLabellingsCommand = (program2) => {
7943
9065
  if (!documentUid) {
7944
9066
  getOutputSink().writeErr(PROJECT_WIDE_DEPRECATION_WARNING);
7945
9067
  }
7946
- const [err, result] = await catchError2((async () => {
9068
+ const [err, result] = await catchError((async () => {
7947
9069
  const config = await createIxpConfig({
7948
9070
  tenant: options.tenant
7949
9071
  });
@@ -8009,7 +9131,7 @@ function parseMetricsModelVersion(raw) {
8009
9131
  return trimmed;
8010
9132
  }
8011
9133
  function sleep(ms) {
8012
- return new Promise((resolve) => setTimeout(resolve, ms));
9134
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
8013
9135
  }
8014
9136
  function isCreatedProjectPropagationError(error) {
8015
9137
  const message = error.message;
@@ -8024,7 +9146,7 @@ async function waitForCreatedProjectReady(config, projectName, waitForUploadSurf
8024
9146
  let lastError = new Error("Project readiness check failed without an error.");
8025
9147
  do {
8026
9148
  if (!projectRead) {
8027
- const [projectErr, fetched] = await catchError2(getProject(config, projectName));
9149
+ const [projectErr, fetched] = await catchError(getProject(config, projectName));
8028
9150
  if (projectErr) {
8029
9151
  lastError = projectErr;
8030
9152
  } else {
@@ -8036,11 +9158,11 @@ async function waitForCreatedProjectReady(config, projectName, waitForUploadSurf
8036
9158
  if (!waitForUploadSurfaces) {
8037
9159
  return project;
8038
9160
  }
8039
- const [taxonomyErr] = await catchError2(getProjectTaxonomy(config, projectName));
9161
+ const [taxonomyErr] = await catchError(getProjectTaxonomy(config, projectName));
8040
9162
  if (taxonomyErr) {
8041
9163
  lastError = taxonomyErr;
8042
9164
  } else {
8043
- const [documentsErr] = await catchError2(listDocuments(config, projectName, { limit: 1 }));
9165
+ const [documentsErr] = await catchError(listDocuments(config, projectName, { limit: 1 }));
8044
9166
  if (!documentsErr) {
8045
9167
  return project;
8046
9168
  }
@@ -8061,7 +9183,7 @@ async function waitForCreatedProjectReady(config, projectName, waitForUploadSurf
8061
9183
  }
8062
9184
  async function uploadCreatedProjectDocument(config, projectName, blob, filename) {
8063
9185
  for (let attempt = 1;; attempt++) {
8064
- const [uploadErr, uploadResult] = await catchError2(uploadDocument(config, projectName, blob, filename));
9186
+ const [uploadErr, uploadResult] = await catchError(uploadDocument(config, projectName, blob, filename));
8065
9187
  if (!uploadErr) {
8066
9188
  return uploadResult;
8067
9189
  }
@@ -8381,7 +9503,7 @@ var PROJECTS_IMPORT_TAXONOMY_EXAMPLES = [
8381
9503
  var registerProjectsCommand = (program2) => {
8382
9504
  const project = program2.command("projects").description("Manage IXP training projects");
8383
9505
  project.command("list").description("List all IXP training projects").option("-l, --limit <number>", "Number of items to return (1-10000)", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of items to skip (0-1000000)", parseOffset, 0).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
8384
- const [err, page] = await catchError2((async () => {
9506
+ const [err, page] = await catchError((async () => {
8385
9507
  const config = await createIxpConfig({
8386
9508
  tenant: options.tenant
8387
9509
  });
@@ -8402,7 +9524,7 @@ var registerProjectsCommand = (program2) => {
8402
9524
  }, { preserveDataKeys: true });
8403
9525
  });
8404
9526
  project.command("get").description("Get an IXP training project by name").argument("<project-name>", "Project name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_GET_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8405
- const [err, p] = await catchError2((async () => {
9527
+ const [err, p] = await catchError((async () => {
8406
9528
  const config = await createIxpConfig({
8407
9529
  tenant: options.tenant
8408
9530
  });
@@ -8422,7 +9544,7 @@ var registerProjectsCommand = (program2) => {
8422
9544
  project.command("delete").description("Permanently delete a project — its documents, taxonomy, and trained models. Irreversible; requires --yes.").argument("<project-name>", "Project name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(PROJECTS_DELETE_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8423
9545
  if (!requireConfirmation(options, `delete project '${projectName}'`))
8424
9546
  return;
8425
- const [err, response] = await catchError2((async () => {
9547
+ const [err, response] = await catchError((async () => {
8426
9548
  const config = await createIxpConfig({
8427
9549
  tenant: options.tenant
8428
9550
  });
@@ -8440,7 +9562,7 @@ var registerProjectsCommand = (program2) => {
8440
9562
  }, { preserveDataKeys: true });
8441
9563
  });
8442
9564
  project.command("update-title").description("Update the display title of a project").argument("<project-name>", "Project name").argument("<new-title>", "New display title").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_UPDATE_TITLE_EXAMPLES).trackedAction(processContext, async (projectName, newTitle, options) => {
8443
- const [err, p] = await catchError2((async () => {
9565
+ const [err, p] = await catchError((async () => {
8444
9566
  const config = await createIxpConfig({
8445
9567
  tenant: options.tenant
8446
9568
  });
@@ -8458,7 +9580,7 @@ var registerProjectsCommand = (program2) => {
8458
9580
  }, { preserveDataKeys: true });
8459
9581
  });
8460
9582
  project.command("update-prompt").description("Update the project's overall extraction instructions — the taxonomy-wide prompt that gives the model context relevant across every field group. Matches the IXP UI's 'Overall extraction instructions' field on the Manage Taxonomy page. Distinct from each field group's own prompt (see `groups update-prompts`) and per-field prompts (see `fields update-prompts`).").argument("<project-name>", "Project name").requiredOption("--prompt <text>", "New overall extraction instructions. Replaces the existing value.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_UPDATE_PROMPT_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8461
- const [err, response] = await catchError2((async () => {
9583
+ const [err, response] = await catchError((async () => {
8462
9584
  const config = await createIxpConfig({
8463
9585
  tenant: options.tenant
8464
9586
  });
@@ -8476,7 +9598,7 @@ var registerProjectsCommand = (program2) => {
8476
9598
  }, { preserveDataKeys: true });
8477
9599
  });
8478
9600
  project.command("get-taxonomy").description("Export the project's raw IXP taxonomy artifact (data types + field groups). This is an IXP-internal format intended for re-import into another project (see `import-taxonomy`), not a curated, human-readable view.").argument("<project-name>", "Project name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_GET_TAXONOMY_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8479
- const [err, taxonomy] = await catchError2((async () => {
9601
+ const [err, taxonomy] = await catchError((async () => {
8480
9602
  const config = await createIxpConfig({
8481
9603
  tenant: options.tenant
8482
9604
  });
@@ -8494,7 +9616,7 @@ var registerProjectsCommand = (program2) => {
8494
9616
  }, { preserveDataKeys: true });
8495
9617
  });
8496
9618
  project.command("configure-model").description("Configure the extraction model settings for a project").argument("<project-name>", "Project name").option("--model <version>", "Extraction model name, validated server-side (e.g. gemini_2_5_flash, gemini_2_5_pro, gpt_4o_2024_05_13)").option("--preprocessing <type>", "Intelligent pre-processing: none, table_mini, table").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_CONFIGURE_MODEL_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8497
- const [err, response] = await catchError2((async () => {
9619
+ const [err, response] = await catchError((async () => {
8498
9620
  if (options.model === undefined && options.preprocessing === undefined) {
8499
9621
  throw new Error("Nothing to configure. Pass --model and/or --preprocessing.");
8500
9622
  }
@@ -8521,7 +9643,7 @@ var registerProjectsCommand = (program2) => {
8521
9643
  }, { preserveDataKeys: true });
8522
9644
  });
8523
9645
  project.command("get-metrics").description("Get validation metrics for an IXP project").argument("<project-name>", "Project name").option("-m, --model-version <version>", "Model version (default: latest)", "latest").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_GET_METRICS_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8524
- const [err, metrics] = await catchError2((async () => {
9646
+ const [err, metrics] = await catchError((async () => {
8525
9647
  const version = parseMetricsModelVersion(options.modelVersion);
8526
9648
  const config = await createIxpConfig({
8527
9649
  tenant: options.tenant
@@ -8540,7 +9662,7 @@ var registerProjectsCommand = (program2) => {
8540
9662
  }, { preserveDataKeys: true });
8541
9663
  });
8542
9664
  project.command("publish").description("Publish a model version, optionally tagging it as live or staging").argument("<project-name>", "Project name").option("-m, --model-version <version>", "Model version to publish (default: latest)").option("--tag <live|staging>", 'Optionally tag the published version. Allowed values: "live" or "staging".').option("-d, --description <text>", "Description for the published version (an empty string clears it)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_PUBLISH_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8543
- const [err, result] = await catchError2((async () => {
9665
+ const [err, result] = await catchError((async () => {
8544
9666
  if (options.tag !== undefined && !IXP_MODEL_TAGS.includes(options.tag)) {
8545
9667
  throw new Error(`Invalid --tag "${options.tag}". Allowed values: ${IXP_MODEL_TAGS.join(", ")}.`);
8546
9668
  }
@@ -8558,6 +9680,13 @@ var registerProjectsCommand = (program2) => {
8558
9680
  processContext.exit(1);
8559
9681
  return;
8560
9682
  }
9683
+ trackShipSucceeded({
9684
+ ship_kind: "publish",
9685
+ target: options.tag ? `ixp_model_${options.tag}` : "ixp_model_untagged",
9686
+ project_type: "ixp_model",
9687
+ command_name: "uip.ixp.projects.publish",
9688
+ artifact_correlation_key: projectName
9689
+ });
8561
9690
  OutputFormatter.success({
8562
9691
  Result: "Success",
8563
9692
  Code: "IxpProjectsPublish",
@@ -8565,7 +9694,7 @@ var registerProjectsCommand = (program2) => {
8565
9694
  }, { preserveDataKeys: true });
8566
9695
  });
8567
9696
  project.command("unpublish").description("Unpublish a model version. The version stays trained and listable; it is only removed from the published set.").argument("<project-name>", "Project name").requiredOption("-m, --model-version <version>", "Model version to unpublish (a non-negative integer)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_UNPUBLISH_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8568
- const [err, result] = await catchError2((async () => {
9697
+ const [err, result] = await catchError((async () => {
8569
9698
  const targetVersion = parseModelVersion(options.modelVersion);
8570
9699
  const config = await createIxpConfig({
8571
9700
  tenant: options.tenant
@@ -8584,7 +9713,7 @@ var registerProjectsCommand = (program2) => {
8584
9713
  }, { preserveDataKeys: true });
8585
9714
  });
8586
9715
  project.command("untag").description("Remove the tag from a model version. The version stays trained and published; only its tag pointer is cleared.").argument("<project-name>", "Project name").requiredOption("--tag <live|staging>", 'Tag to remove (by name). Allowed values: "live" or "staging".').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_UNTAG_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8587
- const [err, result] = await catchError2((async () => {
9716
+ const [err, result] = await catchError((async () => {
8588
9717
  if (!IXP_MODEL_TAGS.includes(options.tag)) {
8589
9718
  throw new Error(`Invalid --tag "${options.tag}". Allowed values: ${IXP_MODEL_TAGS.join(", ")}.`);
8590
9719
  }
@@ -8605,7 +9734,7 @@ var registerProjectsCommand = (program2) => {
8605
9734
  }, { preserveDataKeys: true });
8606
9735
  });
8607
9736
  project.command("list-models").description("List all model versions and tags for a project").argument("<project-name>", "Project name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_LIST_MODELS_EXAMPLES).trackedAction(processContext, async (projectName, options) => {
8608
- const [err, data] = await catchError2((async () => {
9737
+ const [err, data] = await catchError((async () => {
8609
9738
  const config = await createIxpConfig({
8610
9739
  tenant: options.tenant
8611
9740
  });
@@ -8623,18 +9752,18 @@ var registerProjectsCommand = (program2) => {
8623
9752
  }, { preserveDataKeys: true });
8624
9753
  });
8625
9754
  project.command("create").description("Create an IXP project. Given a folder of documents, uploads them and suggests a taxonomy; without a folder, creates an empty project").argument("<name>", "Project name").argument("[folder-path]", "Path to folder containing documents; omit to create an empty project").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-d, --description <text>", "Description of what to extract from the documents").option("--skip-taxonomy", "Create project and upload docs without suggesting a taxonomy").examples(PROJECTS_CREATE_EXAMPLES).trackedAction(processContext, async (name, folder, options) => {
8626
- const [err, result] = await catchError2((async () => {
8627
- const fs = getFileSystem();
9755
+ const [err, result] = await catchError((async () => {
9756
+ const fs2 = getFileSystem();
8628
9757
  const config = await createIxpConfig({
8629
9758
  tenant: options.tenant
8630
9759
  });
8631
9760
  let allFiles = [];
8632
9761
  if (folder !== undefined) {
8633
- const resolvedFolder = fs.path.resolve(folder);
8634
- if (!await fs.exists(resolvedFolder)) {
9762
+ const resolvedFolder = fs2.path.resolve(folder);
9763
+ if (!await fs2.exists(resolvedFolder)) {
8635
9764
  throw new Error(`Folder not found: ${resolvedFolder}`);
8636
9765
  }
8637
- allFiles = (await fs.readdir(resolvedFolder)).filter((f) => SUPPORTED_DOCUMENT_EXTENSIONS.has(getExtension(f))).map((f) => fs.path.join(resolvedFolder, f));
9766
+ allFiles = (await fs2.readdir(resolvedFolder)).filter((f) => SUPPORTED_DOCUMENT_EXTENSIONS.has(getExtension(f))).map((f) => fs2.path.join(resolvedFolder, f));
8638
9767
  if (allFiles.length === 0) {
8639
9768
  throw new Error(`No supported documents found in ${resolvedFolder}. Supported: ${[...SUPPORTED_DOCUMENT_EXTENSIONS].join(", ")}`);
8640
9769
  }
@@ -8658,9 +9787,9 @@ var registerProjectsCommand = (program2) => {
8658
9787
  const attachmentRefs = [];
8659
9788
  const failedUploads = [];
8660
9789
  for (const filePath of allFiles) {
8661
- const filename = fs.path.basename(filePath);
8662
- const [uploadErr, uploadResult] = await catchError2((async () => {
8663
- const fileBuffer = await fs.readFile(filePath);
9790
+ const filename = fs2.path.basename(filePath);
9791
+ const [uploadErr, uploadResult] = await catchError((async () => {
9792
+ const fileBuffer = await fs2.readFile(filePath);
8664
9793
  if (!fileBuffer) {
8665
9794
  throw new Error(`Failed to read file: ${filePath}`);
8666
9795
  }
@@ -8702,7 +9831,7 @@ var registerProjectsCommand = (program2) => {
8702
9831
  let taxonomy;
8703
9832
  const lastAttemptErrors = [];
8704
9833
  for (let attempt = 1;attempt <= 3; attempt++) {
8705
- const [err2, t] = await catchError2((async () => {
9834
+ const [err2, t] = await catchError((async () => {
8706
9835
  const taxonomyResponse = await suggestTaxonomy(config, projectName, options.description || "", taxonomyDocs);
8707
9836
  await importTaxonomy(config, projectName, taxonomyResponse.taxonomy);
8708
9837
  return taxonomyResponse.taxonomy;
@@ -8775,16 +9904,16 @@ var registerProjectsCommand = (program2) => {
8775
9904
  }
8776
9905
  });
8777
9906
  project.command("import-taxonomy").description("Import a taxonomy from a local JSON file into an existing project").argument("<project-name>", "Project name").argument("<file>", "Path to taxonomy JSON file").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECTS_IMPORT_TAXONOMY_EXAMPLES).trackedAction(processContext, async (projectName, file, options) => {
8778
- const [err, result] = await catchError2((async () => {
8779
- const fs = getFileSystem();
9907
+ const [err, result] = await catchError((async () => {
9908
+ const fs2 = getFileSystem();
8780
9909
  const config = await createIxpConfig({
8781
9910
  tenant: options.tenant
8782
9911
  });
8783
- const resolvedFile = fs.path.resolve(file);
8784
- if (!await fs.exists(resolvedFile)) {
9912
+ const resolvedFile = fs2.path.resolve(file);
9913
+ if (!await fs2.exists(resolvedFile)) {
8785
9914
  throw new Error(`Taxonomy file not found: ${resolvedFile}`);
8786
9915
  }
8787
- const contents = await fs.readFile(resolvedFile, "utf-8");
9916
+ const contents = await fs2.readFile(resolvedFile, "utf-8");
8788
9917
  if (contents === null) {
8789
9918
  throw new Error(`Failed to read taxonomy file: ${resolvedFile}`);
8790
9919
  }
@@ -8843,4 +9972,4 @@ var registerCommands = async (program2) => {
8843
9972
 
8844
9973
  export { package_default, Command, metadata, registerCommands };
8845
9974
 
8846
- //# debugId=F34ED4C1536D1D8464756E2164756E21
9975
+ //# debugId=51E7603847BA1B1464756E2164756E21