@uipath/llmgw-tool 1.201.0-preview.115 → 1.201.0-preview.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-egbaaydw.js";
6
+ } from "./tool-g0n3949d.js";
7
7
  import"./tool-0v6na3yp.js";
8
8
 
9
9
  // src/index.ts
@@ -2100,7 +2100,7 @@ var require_commander = __commonJS((exports) => {
2100
2100
  var package_default = {
2101
2101
  name: "@uipath/llmgw-tool",
2102
2102
  license: "MIT",
2103
- version: "1.201.0-preview.115",
2103
+ version: "1.201.0-preview.121",
2104
2104
  description: "CLI plugin for UiPath AI Trust Layer Bring-Your-Own LLM connections.",
2105
2105
  private: false,
2106
2106
  repository: {
@@ -2426,17 +2426,18 @@ var TLS_ERROR_CODES = new Set([
2426
2426
  ]);
2427
2427
  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.";
2428
2428
  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.";
2429
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2430
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2431
+ function localPermissionInstructions(code, path2) {
2432
+ const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
2433
+ if (code === "EROFS") {
2434
+ 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.";
2435
+ }
2436
+ const remedy = process.platform === "win32" ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
2437
+ return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
2438
+ }
2429
2439
  function describeConnectivityError(error) {
2430
- const queue = [error];
2431
- const seen = new Set;
2432
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2433
- const current = queue.shift();
2434
- if (current === null || typeof current !== "object")
2435
- continue;
2436
- if (seen.has(current))
2437
- continue;
2438
- seen.add(current);
2439
- const cur = current;
2440
+ for (const cur of walkErrorGraph(error)) {
2440
2441
  const code = typeof cur.code === "string" ? cur.code : undefined;
2441
2442
  const message = typeof cur.message === "string" ? cur.message : undefined;
2442
2443
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -2455,6 +2456,49 @@ function describeConnectivityError(error) {
2455
2456
  instructions: NETWORK_INSTRUCTIONS
2456
2457
  };
2457
2458
  }
2459
+ }
2460
+ return;
2461
+ }
2462
+ function describePermissionError(error) {
2463
+ for (const cur of walkErrorGraph(error)) {
2464
+ const message = typeof cur.message === "string" ? cur.message : undefined;
2465
+ const code = matchLocalPermissionCode(cur.code, message);
2466
+ if (!code)
2467
+ continue;
2468
+ const path2 = localPermissionPath(cur.path, message);
2469
+ return {
2470
+ code,
2471
+ message: message ?? code,
2472
+ ...path2 !== undefined ? { path: path2 } : {},
2473
+ instructions: localPermissionInstructions(code, path2)
2474
+ };
2475
+ }
2476
+ return;
2477
+ }
2478
+ function matchLocalPermissionCode(code, message) {
2479
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
2480
+ return code;
2481
+ }
2482
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
2483
+ return match ? match[1] : undefined;
2484
+ }
2485
+ function localPermissionPath(path2, message) {
2486
+ if (typeof path2 === "string")
2487
+ return path2;
2488
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2489
+ }
2490
+ function* walkErrorGraph(error) {
2491
+ const queue = [error];
2492
+ const seen = new Set;
2493
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2494
+ const current = queue.shift();
2495
+ if (current === null || typeof current !== "object")
2496
+ continue;
2497
+ if (seen.has(current))
2498
+ continue;
2499
+ seen.add(current);
2500
+ const cur = current;
2501
+ yield cur;
2458
2502
  if (cur.cause !== undefined)
2459
2503
  queue.push(cur.cause);
2460
2504
  if (Array.isArray(cur.errors))
@@ -2515,6 +2559,12 @@ function classifyError(status, error) {
2515
2559
  if (status !== undefined && status >= 500 && status < 600) {
2516
2560
  return { errorCode: "server_error", retry: "RetryLater" };
2517
2561
  }
2562
+ if (status === undefined && describePermissionError(error)) {
2563
+ return {
2564
+ errorCode: "local_permission_denied",
2565
+ retry: "RetryWillNotFix"
2566
+ };
2567
+ }
2518
2568
  const connectivity = describeConnectivityError(error);
2519
2569
  if (connectivity) {
2520
2570
  return {
@@ -2617,6 +2667,16 @@ async function extractErrorDetails(error, options) {
2617
2667
  message = `${message}: ${connectivity.message}`;
2618
2668
  }
2619
2669
  }
2670
+ const permission = status === undefined ? describePermissionError(error) : undefined;
2671
+ if (permission) {
2672
+ if (permission.message !== message && !message.includes(permission.message)) {
2673
+ message = `${message}: ${permission.message}`;
2674
+ }
2675
+ if (!message.includes(permission.instructions)) {
2676
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
2677
+ message = `${punctuated} ${permission.instructions}`;
2678
+ }
2679
+ }
2620
2680
  let details = rawMessage;
2621
2681
  if (rawBody) {
2622
2682
  if (parsedBody) {
@@ -2656,6 +2716,9 @@ async function extractErrorDetails(error, options) {
2656
2716
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
2657
2717
  context.traceId = parsedBody.traceId;
2658
2718
  }
2719
+ if (permission?.path !== undefined) {
2720
+ context.path = permission.path;
2721
+ }
2659
2722
  if (status === 429) {
2660
2723
  const resp = response;
2661
2724
  const headersObj = resp?.headers;
@@ -3889,6 +3952,7 @@ var CLI_ERROR_CODES = [
3889
3952
  "invalid_argument",
3890
3953
  "authentication_required",
3891
3954
  "permission_denied",
3955
+ "local_permission_denied",
3892
3956
  "not_found",
3893
3957
  "rate_limited",
3894
3958
  "network_error",
@@ -4324,12 +4388,16 @@ function defaultErrorCodeForHttpStatus(status) {
4324
4388
  return "server_error";
4325
4389
  return;
4326
4390
  }
4391
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
4327
4392
  function defaultErrorCodeForFailure(data) {
4328
4393
  if (data.Result === RESULTS.Failure) {
4329
4394
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
4330
4395
  const errorCode = defaultErrorCodeForHttpStatus(status);
4331
4396
  if (errorCode)
4332
4397
  return errorCode;
4398
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
4399
+ return "local_permission_denied";
4400
+ }
4333
4401
  }
4334
4402
  return defaultErrorCodeForResult(data.Result);
4335
4403
  }
@@ -4818,11 +4886,10 @@ var ScreenLogger;
4818
4886
  })(ScreenLogger ||= {});
4819
4887
  // ../../common/src/sdk-user-agent.ts
4820
4888
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
4821
- // ../../common/src/tool-provider.ts
4822
- var factorySlot = singleton("PackagerFactoryProvider");
4823
- var moduleSlot = singleton("ToolModuleProvider");
4824
4889
  // ../../common/src/telemetry/ship-succeeded.ts
4825
4890
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
4891
+ // ../../common/src/tool-provider.ts
4892
+ var factorySlot = singleton("PackagerFactoryProvider");
4826
4893
  // ../llmgw-sdk/dist/index.js
4827
4894
  import { createRequire } from "node:module";
4828
4895
  import fs2 from "node:fs";
@@ -6992,6 +7059,7 @@ function errorMessage(error) {
6992
7059
  }
6993
7060
  init_constants();
6994
7061
  init_src();
7062
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
6995
7063
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
6996
7064
  var INVALID_TENANT_CODE = "INVALID_TENANT";
6997
7065
  var TENANT_SELECTION_CODES = new Set([
@@ -8371,4 +8439,4 @@ var registerCommands = async (program2) => {
8371
8439
 
8372
8440
  export { Command, metadata, registerCommands };
8373
8441
 
8374
- //# debugId=801C1713391F216F64756E2164756E21
8442
+ //# debugId=ED4F4D4BA49A1A1564756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-egbaaydw.js";
4
+ } from "./tool-g0n3949d.js";
5
5
  import"./tool-0v6na3yp.js";
6
6
  export {
7
7
  registerCommands,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/llmgw-tool",
3
3
  "license": "MIT",
4
- "version": "1.201.0-preview.115",
4
+ "version": "1.201.0-preview.121",
5
5
  "description": "CLI plugin for UiPath AI Trust Layer Bring-Your-Own LLM connections.",
6
6
  "private": false,
7
7
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "files": [
24
24
  "dist"
25
25
  ],
26
- "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
26
+ "gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
27
27
  }