@uipath/agent-tool 1.204.0-preview.254 → 1.205.0-preview.256

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.
@@ -0,0 +1,28 @@
1
+ import {
2
+ getAuthContext
3
+ } from "./packager-tool-vwsq85y7.js";
4
+
5
+ // ../solution-sdk/src/solution-auth.ts
6
+ async function getSolutionAuthContext(options) {
7
+ const ctx = await getAuthContext({
8
+ tenant: options.tenant,
9
+ ensureTokenValidityMinutes: options.loginValidity ?? 10,
10
+ envFilePath: options.envFilePath,
11
+ requireOrganizationId: true,
12
+ requireTenantName: true
13
+ });
14
+ const organizationId = ctx.organizationId;
15
+ const tenantName = ctx.tenantName;
16
+ const basePath = `${ctx.baseUrl}/${organizationId}/${tenantName}/automationsolutions_`;
17
+ return {
18
+ accessToken: ctx.accessToken,
19
+ basePath,
20
+ organizationId,
21
+ tenantName,
22
+ identity: ctx.identity
23
+ };
24
+ }
25
+
26
+ export { getSolutionAuthContext };
27
+
28
+ //# debugId=F76D3832B86881B164756E2164756E21
@@ -1,3 +1,6 @@
1
+ import {
2
+ getFileSystem
3
+ } from "./packager-tool-je2re4j6.js";
1
4
  import {
2
5
  __commonJS,
3
6
  __require,
@@ -2650,236 +2653,6 @@ var {
2650
2653
  Help
2651
2654
  } = import__.default;
2652
2655
 
2653
- // ../filesystem/src/node.ts
2654
- import { randomUUID } from "node:crypto";
2655
- import { existsSync } from "node:fs";
2656
- import * as fs from "node:fs/promises";
2657
- import * as os from "node:os";
2658
- import * as path from "node:path";
2659
- var LOCK_HEARTBEAT_MS = 5000;
2660
- var LOCK_STALE_MS = 15000;
2661
- var LOCK_MAX_WAIT_MS = 20000;
2662
- var LOCK_MAX_HOLD_MS = 60000;
2663
- var LOCK_RETRY_MIN_MS = 100;
2664
- var LOCK_RETRY_JITTER_MS = 200;
2665
-
2666
- class NodeFileSystem {
2667
- path = {
2668
- join: path.join,
2669
- resolve: path.resolve,
2670
- relative: path.relative,
2671
- dirname: path.dirname,
2672
- isAbsolute: path.isAbsolute,
2673
- basename: path.basename
2674
- };
2675
- env = {
2676
- cwd: process.cwd,
2677
- homedir: os.homedir,
2678
- tmpdir: os.tmpdir,
2679
- getenv: (key) => process.env[key]
2680
- };
2681
- utils = {
2682
- open: async (url) => {
2683
- const { default: open } = await import("./index-h8cph72k.js");
2684
- await open(url);
2685
- }
2686
- };
2687
- async readFile(path2, options) {
2688
- try {
2689
- if (options) {
2690
- return await fs.readFile(path2, "utf-8");
2691
- }
2692
- return await fs.readFile(path2);
2693
- } catch (error) {
2694
- if (this.isEnoent(error))
2695
- return null;
2696
- throw error;
2697
- }
2698
- }
2699
- async writeFile(filePath, data) {
2700
- const dir = path.dirname(filePath);
2701
- if (dir) {
2702
- await fs.mkdir(dir, { recursive: true });
2703
- }
2704
- await fs.writeFile(filePath, data);
2705
- }
2706
- async appendFile(filePath, data) {
2707
- const dir = path.dirname(filePath);
2708
- if (dir) {
2709
- await fs.mkdir(dir, { recursive: true });
2710
- }
2711
- await fs.appendFile(filePath, data);
2712
- }
2713
- async readdir(dirPath) {
2714
- try {
2715
- return await fs.readdir(dirPath);
2716
- } catch (error) {
2717
- if (this.isEnoent(error))
2718
- return [];
2719
- throw error;
2720
- }
2721
- }
2722
- async stat(filePath) {
2723
- try {
2724
- const stats = await fs.stat(filePath);
2725
- return {
2726
- isFile: () => stats.isFile(),
2727
- isDirectory: () => stats.isDirectory(),
2728
- size: stats.size,
2729
- mtimeMs: stats.mtimeMs
2730
- };
2731
- } catch (error) {
2732
- if (this.isEnoent(error))
2733
- return null;
2734
- throw error;
2735
- }
2736
- }
2737
- async exists(filePath) {
2738
- return existsSync(filePath);
2739
- }
2740
- async mkdir(dirPath) {
2741
- await fs.mkdir(dirPath, { recursive: true });
2742
- }
2743
- async acquireLock(lockPath) {
2744
- const canonicalPath = await this.canonicalizeLockTarget(lockPath);
2745
- const lockFile = `${canonicalPath}.lock`;
2746
- const ownerId = randomUUID();
2747
- const start = Date.now();
2748
- while (true) {
2749
- try {
2750
- await fs.writeFile(lockFile, ownerId, { flag: "wx" });
2751
- return this.createLockRelease(lockFile, ownerId);
2752
- } catch (error) {
2753
- if (!this.hasErrnoCode(error, "EEXIST")) {
2754
- throw error;
2755
- }
2756
- const stats = await fs.stat(lockFile).catch(() => null);
2757
- if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
2758
- const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
2759
- if (reclaimed)
2760
- continue;
2761
- }
2762
- if (Date.now() - start > LOCK_MAX_WAIT_MS) {
2763
- throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
2764
- }
2765
- await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
2766
- }
2767
- }
2768
- }
2769
- async canonicalizeLockTarget(lockPath) {
2770
- const absolute = path.resolve(lockPath);
2771
- const fullReal = await fs.realpath(absolute).catch(() => null);
2772
- if (fullReal)
2773
- return fullReal;
2774
- const parent = path.dirname(absolute);
2775
- const base = path.basename(absolute);
2776
- const canonicalParent = await fs.realpath(parent).catch(() => parent);
2777
- return path.join(canonicalParent, base);
2778
- }
2779
- createLockRelease(lockFile, ownerId) {
2780
- const heartbeatStart = Date.now();
2781
- let heartbeatTimer;
2782
- let stopped = false;
2783
- const stopHeartbeat = () => {
2784
- stopped = true;
2785
- if (heartbeatTimer)
2786
- clearTimeout(heartbeatTimer);
2787
- };
2788
- const scheduleNextHeartbeat = () => {
2789
- if (stopped)
2790
- return;
2791
- if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
2792
- stopped = true;
2793
- return;
2794
- }
2795
- heartbeatTimer = setTimeout(() => {
2796
- runHeartbeat();
2797
- }, LOCK_HEARTBEAT_MS);
2798
- heartbeatTimer.unref?.();
2799
- };
2800
- const runHeartbeat = async () => {
2801
- if (stopped)
2802
- return;
2803
- const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2804
- if (stopped)
2805
- return;
2806
- if (current !== ownerId) {
2807
- stopped = true;
2808
- return;
2809
- }
2810
- const now = Date.now() / 1000;
2811
- await fs.utimes(lockFile, now, now).catch(() => {});
2812
- scheduleNextHeartbeat();
2813
- };
2814
- scheduleNextHeartbeat();
2815
- let released = false;
2816
- return async () => {
2817
- if (released)
2818
- return;
2819
- released = true;
2820
- stopHeartbeat();
2821
- const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
2822
- if (current === ownerId) {
2823
- await fs.rm(lockFile, { force: true });
2824
- }
2825
- };
2826
- }
2827
- async rm(filePath) {
2828
- await fs.rm(filePath, { recursive: true, force: true });
2829
- }
2830
- async rename(oldPath, newPath) {
2831
- await fs.rename(oldPath, newPath);
2832
- }
2833
- async realpath(filePath) {
2834
- try {
2835
- return await fs.realpath(filePath);
2836
- } catch (error) {
2837
- if (this.isEnoent(error))
2838
- return filePath;
2839
- throw error;
2840
- }
2841
- }
2842
- async getTempDir() {
2843
- return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
2844
- }
2845
- async copyDirectory(sourcePath, destPath) {
2846
- const sourceStats = await this.stat(sourcePath);
2847
- if (!sourceStats) {
2848
- throw new Error(`Source directory does not exist: ${sourcePath}`);
2849
- }
2850
- if (!sourceStats.isDirectory()) {
2851
- throw new Error(`Source path is not a directory: ${sourcePath}`);
2852
- }
2853
- await this.mkdir(destPath);
2854
- const entries = await this.readdir(sourcePath);
2855
- for (const entry of entries) {
2856
- const srcEntry = path.join(sourcePath, entry);
2857
- const destEntry = path.join(destPath, entry);
2858
- const entryStats = await this.stat(srcEntry);
2859
- if (!entryStats)
2860
- continue;
2861
- if (entryStats.isDirectory()) {
2862
- await this.copyDirectory(srcEntry, destEntry);
2863
- } else if (entryStats.isFile()) {
2864
- const content = await this.readFile(srcEntry);
2865
- if (content !== null) {
2866
- await this.writeFile(destEntry, content);
2867
- }
2868
- }
2869
- }
2870
- }
2871
- isEnoent(error) {
2872
- return this.hasErrnoCode(error, "ENOENT");
2873
- }
2874
- hasErrnoCode(error, code) {
2875
- return typeof error === "object" && error !== null && "code" in error && error.code === code;
2876
- }
2877
- }
2878
-
2879
- // ../filesystem/src/index.ts
2880
- var fsInstance = new NodeFileSystem;
2881
- var getFileSystem = () => fsInstance;
2882
-
2883
2656
  // ../common/src/error-graph.ts
2884
2657
  function* walkErrorGraph(error) {
2885
2658
  const queue = [error];
@@ -2961,8 +2734,8 @@ var TLS_ERROR_CODES = new Set([
2961
2734
  var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
2962
2735
  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.";
2963
2736
  var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
2964
- function localPermissionInstructions(code, path2) {
2965
- const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
2737
+ function localPermissionInstructions(code, path) {
2738
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
2966
2739
  if (code === "EROFS") {
2967
2740
  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.";
2968
2741
  }
@@ -2999,12 +2772,12 @@ function describePermissionError(error) {
2999
2772
  const code = matchLocalPermissionCode(cur.code, message);
3000
2773
  if (!code)
3001
2774
  continue;
3002
- const path2 = localPermissionPath(cur.path, message);
2775
+ const path = localPermissionPath(cur.path, message);
3003
2776
  return {
3004
2777
  code,
3005
2778
  message: message ?? code,
3006
- ...path2 !== undefined ? { path: path2 } : {},
3007
- instructions: localPermissionInstructions(code, path2)
2779
+ ...path !== undefined ? { path } : {},
2780
+ instructions: localPermissionInstructions(code, path)
3008
2781
  };
3009
2782
  }
3010
2783
  return;
@@ -3016,9 +2789,9 @@ function matchLocalPermissionCode(code, message) {
3016
2789
  const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
3017
2790
  return match ? match[1] : undefined;
3018
2791
  }
3019
- function localPermissionPath(path2, message) {
3020
- if (typeof path2 === "string")
3021
- return path2;
2792
+ function localPermissionPath(path, message) {
2793
+ if (typeof path === "string")
2794
+ return path;
3022
2795
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
3023
2796
  }
3024
2797
  function isHtmlDocument(body) {
@@ -3310,16 +3083,16 @@ function parseAttachmentSpec(spec) {
3310
3083
  throw new Error(`Invalid --attachment format: '${spec}'. Expected 'name=path' where name matches a file-typed workflow input variable.`);
3311
3084
  }
3312
3085
  const name = spec.substring(0, eq);
3313
- const path2 = spec.substring(eq + 1);
3314
- if (!name || !path2) {
3086
+ const path = spec.substring(eq + 1);
3087
+ if (!name || !path) {
3315
3088
  throw new Error(`Invalid --attachment format: '${spec}'. Expected 'name=path' with non-empty name and path.`);
3316
3089
  }
3317
- return { name, path: path2 };
3090
+ return { name, path };
3318
3091
  }
3319
3092
  async function readAttachmentSpecs(specs) {
3320
- const fs2 = getFileSystem();
3093
+ const fs = getFileSystem();
3321
3094
  return Promise.all(specs.map(async (spec) => {
3322
- const bytes = await fs2.readFile(spec.path).catch(async (err) => {
3095
+ const bytes = await fs.readFile(spec.path).catch(async (err) => {
3323
3096
  throw new Error(`Cannot read --attachment '${spec.path}' for variable '${spec.name}': ${await extractErrorMessage(err)}`, { cause: err });
3324
3097
  });
3325
3098
  if (bytes === null) {
@@ -3328,7 +3101,7 @@ async function readAttachmentSpecs(specs) {
3328
3101
  return {
3329
3102
  ...spec,
3330
3103
  bytes,
3331
- fileName: fs2.path.basename(spec.path)
3104
+ fileName: fs.path.basename(spec.path)
3332
3105
  };
3333
3106
  }));
3334
3107
  }
@@ -3370,13 +3143,13 @@ function getOutputSink() {
3370
3143
 
3371
3144
  // ../common/src/logger.ts
3372
3145
  var logFilePathSlot = singleton("logFilePath");
3373
- function setGlobalLogFilePath(path2) {
3374
- logFilePathSlot.set(path2);
3146
+ function setGlobalLogFilePath(path) {
3147
+ logFilePathSlot.set(path);
3375
3148
  }
3376
3149
  function getGlobalLogFilePath() {
3377
3150
  return logFilePathSlot.get("");
3378
3151
  }
3379
- var DEFAULT_LOG_LEVEL = 3 /* ERROR */;
3152
+ var DEFAULT_LOG_LEVEL = 2 /* WARN */;
3380
3153
 
3381
3154
  class SimpleLogger {
3382
3155
  __brand = "SimpleLogger";
@@ -3439,14 +3212,14 @@ class SimpleLogger {
3439
3212
  return this.fileLoggingEnabled || !!getGlobalLogFilePath();
3440
3213
  }
3441
3214
  writeToFile(formatted) {
3442
- const path2 = this.logFilePath || getGlobalLogFilePath();
3443
- if (!path2)
3215
+ const path = this.logFilePath || getGlobalLogFilePath();
3216
+ if (!path)
3444
3217
  return;
3445
3218
  const timestamp = new Date().toISOString();
3446
3219
  this.pendingWrites = Promise.all([
3447
3220
  this.pendingWrites,
3448
3221
  this.pendingInit
3449
- ]).then(() => getFileSystem().appendFile(path2, `${timestamp} ${formatted}`).catch(() => {}));
3222
+ ]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
3450
3223
  }
3451
3224
  write(formatted) {
3452
3225
  if (this.isFileLoggingActive()) {
@@ -3496,17 +3269,17 @@ class SimpleLogger {
3496
3269
  setGlobalLogFilePath("");
3497
3270
  }
3498
3271
  }
3499
- setLogFile(path2) {
3500
- this.logFilePath = path2;
3501
- setGlobalLogFilePath(path2);
3502
- if (!path2)
3272
+ setLogFile(path) {
3273
+ this.logFilePath = path;
3274
+ setGlobalLogFilePath(path);
3275
+ if (!path)
3503
3276
  return;
3504
3277
  this.fileLoggingEnabled = true;
3505
- const fs2 = getFileSystem();
3278
+ const fs = getFileSystem();
3506
3279
  this.pendingInit = (async () => {
3507
3280
  const [error] = await catchError((async () => {
3508
- await fs2.mkdir(fs2.path.dirname(path2));
3509
- await fs2.writeFile(path2, "");
3281
+ await fs.mkdir(fs.path.dirname(path));
3282
+ await fs.writeFile(path, "");
3510
3283
  })());
3511
3284
  if (error)
3512
3285
  this.fileLoggingEnabled = false;
@@ -3643,7 +3416,9 @@ var ErrorDimensions = {
3643
3416
  Result: "Result",
3644
3417
  ErrorCode: "ErrorCode",
3645
3418
  Retry: "Retry",
3646
- ErrorMessage: "ErrorMessage"
3419
+ ErrorMessage: "ErrorMessage",
3420
+ HttpStatus: "HttpStatus",
3421
+ UpstreamErrorCode: "UpstreamErrorCode"
3647
3422
  };
3648
3423
  var AuthDimensions = {
3649
3424
  AuthenticationMethod: "AuthenticationMethod",
@@ -4631,7 +4406,9 @@ var CLI_ERROR_CODES = [
4631
4406
  "timeout",
4632
4407
  "server_error",
4633
4408
  "method_not_allowed",
4409
+ "not_supported",
4634
4410
  "configuration_error",
4411
+ "execution_failed",
4635
4412
  "unknown_error"
4636
4413
  ];
4637
4414
  var RETRY_HINTS = [
@@ -5588,7 +5365,9 @@ var OutputFormatter;
5588
5365
  [ErrorDimensions.Result]: data.Result,
5589
5366
  [ErrorDimensions.ErrorCode]: data.ErrorCode,
5590
5367
  [ErrorDimensions.Retry]: data.Retry,
5591
- [ErrorDimensions.ErrorMessage]: data.Message
5368
+ [ErrorDimensions.ErrorMessage]: data.Message,
5369
+ [ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
5370
+ [ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
5592
5371
  });
5593
5372
  }
5594
5373
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -6520,6 +6299,10 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
6520
6299
  function installSdkUserAgentHeader(BaseApiClass, userAgent) {
6521
6300
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
6522
6301
  }
6302
+ // ../common/src/shell-quote.ts
6303
+ function quoteForShell(value) {
6304
+ return `'${value.replace(/'/g, "'\\''")}'`;
6305
+ }
6523
6306
  // ../common/src/solution-project-types.ts
6524
6307
  var LIBRARY_NOT_A_PROJECT = "A library cannot be a project inside a solution — it is a reusable .nupkg that other projects consume as a NuGet dependency, not a deployable unit. Build and publish it on its own ('uip rpa pack <project-dir> <output-path>', then 'uip or libraries upload --file <nupkg-path>'), and reference it from a project's dependencies. To make the published library part of this solution, add it as a resource instead: 'uip solution resources add --source remote --kind Library --name <library-name>'.";
6525
6308
  function unsupportedSolutionProjectType(projectType) {
@@ -6532,6 +6315,6 @@ function unsupportedSolutionProjectType(projectType) {
6532
6315
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
6533
6316
  // ../common/src/tool-provider.ts
6534
6317
  var factorySlot = singleton("PackagerFactoryProvider");
6535
- export { getFileSystem, catchError, extractErrorDetails, extractErrorMessage, extractErrorMessageSync, appendOption, ATTACHMENT_UPLOAD_INSTRUCTIONS, parseAttachmentSpec, readAttachmentSpecs, logger, RESULTS, OutputFormatter, summarizePlatformBody, Command, processContext, isGuid, mimeTypeForFileName, parseBoundedInt, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, unsupportedSolutionProjectType };
6318
+ export { catchError, extractErrorDetails, extractErrorMessage, extractErrorMessageSync, appendOption, ATTACHMENT_UPLOAD_INSTRUCTIONS, parseAttachmentSpec, readAttachmentSpecs, logger, RESULTS, OutputFormatter, summarizePlatformBody, Command, processContext, isGuid, mimeTypeForFileName, parseBoundedInt, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, quoteForShell, unsupportedSolutionProjectType };
6536
6319
 
6537
- //# debugId=17CFAAB7DDFB3F3F64756E2164756E21
6320
+ //# debugId=5C45FC6CF7FE9FD064756E2164756E21
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  catchError,
3
3
  logger,
4
+ quoteForShell,
4
5
  unsupportedSolutionProjectType
5
- } from "./packager-tool-2tf3hrem.js";
6
+ } from "./packager-tool-fza8z686.js";
6
7
 
7
8
  // ../solution-sdk/src/solution-file.ts
8
9
  var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
@@ -466,7 +467,7 @@ function buildRegistrationSuccessInstructions(solutionDir) {
466
467
  return [
467
468
  "The project is listed in the parent solution manifest.",
468
469
  "Packing or uploading the solution will sync solution resources automatically.",
469
- `To sync resources before packaging, run 'uip solution resources refresh --solution-folder "${solutionDir}"'.`
470
+ `To sync resources before packaging, run: uip solution resources refresh --solution-folder ${quoteForShell(solutionDir)}`
470
471
  ].join(`
471
472
  `);
472
473
  }
@@ -537,4 +538,4 @@ async function findSolutionFileUpward(fs, startDir) {
537
538
 
538
539
  export { normalizeProjectType, toPortableRelativePath, readUipxFile, createSolutionManifest, autoScaffoldSolution, prepareProjectLocation, resolveSolutionDir, updateUipxSolutionId, findSolutionFile, updateSolutionFile, tryRegisterProjectInParentSolution, findNearestParentUipxFile, readSolutionManifest, isProjectRegisteredInSolution, findSolutionFileUpward };
539
540
 
540
- //# debugId=C68E91587DBDE36C64756E2164756E21
541
+ //# debugId=DDAB1B523F5F442564756E2164756E21