@uipath/llm-gateway-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.
Files changed (2) hide show
  1. package/dist/tool.js +83 -15
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -2100,7 +2100,7 @@ var require_commander = __commonJS((exports) => {
2100
2100
  var package_default = {
2101
2101
  name: "@uipath/llm-gateway-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 LLM Gateway model discovery.",
2105
2105
  private: false,
2106
2106
  repository: {
@@ -2422,17 +2422,18 @@ var TLS_ERROR_CODES = new Set([
2422
2422
  ]);
2423
2423
  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.";
2424
2424
  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.";
2425
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2426
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2427
+ function localPermissionInstructions(code, path2) {
2428
+ const target = path2 !== undefined ? `'${path2}'` : "a local file or resource";
2429
+ if (code === "EROFS") {
2430
+ 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.";
2431
+ }
2432
+ 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.";
2433
+ 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}`;
2434
+ }
2425
2435
  function describeConnectivityError(error) {
2426
- const queue = [error];
2427
- const seen = new Set;
2428
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2429
- const current = queue.shift();
2430
- if (current === null || typeof current !== "object")
2431
- continue;
2432
- if (seen.has(current))
2433
- continue;
2434
- seen.add(current);
2435
- const cur = current;
2436
+ for (const cur of walkErrorGraph(error)) {
2436
2437
  const code = typeof cur.code === "string" ? cur.code : undefined;
2437
2438
  const message = typeof cur.message === "string" ? cur.message : undefined;
2438
2439
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -2451,6 +2452,49 @@ function describeConnectivityError(error) {
2451
2452
  instructions: NETWORK_INSTRUCTIONS
2452
2453
  };
2453
2454
  }
2455
+ }
2456
+ return;
2457
+ }
2458
+ function describePermissionError(error) {
2459
+ for (const cur of walkErrorGraph(error)) {
2460
+ const message = typeof cur.message === "string" ? cur.message : undefined;
2461
+ const code = matchLocalPermissionCode(cur.code, message);
2462
+ if (!code)
2463
+ continue;
2464
+ const path2 = localPermissionPath(cur.path, message);
2465
+ return {
2466
+ code,
2467
+ message: message ?? code,
2468
+ ...path2 !== undefined ? { path: path2 } : {},
2469
+ instructions: localPermissionInstructions(code, path2)
2470
+ };
2471
+ }
2472
+ return;
2473
+ }
2474
+ function matchLocalPermissionCode(code, message) {
2475
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
2476
+ return code;
2477
+ }
2478
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
2479
+ return match ? match[1] : undefined;
2480
+ }
2481
+ function localPermissionPath(path2, message) {
2482
+ if (typeof path2 === "string")
2483
+ return path2;
2484
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2485
+ }
2486
+ function* walkErrorGraph(error) {
2487
+ const queue = [error];
2488
+ const seen = new Set;
2489
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2490
+ const current = queue.shift();
2491
+ if (current === null || typeof current !== "object")
2492
+ continue;
2493
+ if (seen.has(current))
2494
+ continue;
2495
+ seen.add(current);
2496
+ const cur = current;
2497
+ yield cur;
2454
2498
  if (cur.cause !== undefined)
2455
2499
  queue.push(cur.cause);
2456
2500
  if (Array.isArray(cur.errors))
@@ -2511,6 +2555,12 @@ function classifyError(status, error) {
2511
2555
  if (status !== undefined && status >= 500 && status < 600) {
2512
2556
  return { errorCode: "server_error", retry: "RetryLater" };
2513
2557
  }
2558
+ if (status === undefined && describePermissionError(error)) {
2559
+ return {
2560
+ errorCode: "local_permission_denied",
2561
+ retry: "RetryWillNotFix"
2562
+ };
2563
+ }
2514
2564
  const connectivity = describeConnectivityError(error);
2515
2565
  if (connectivity) {
2516
2566
  return {
@@ -2613,6 +2663,16 @@ async function extractErrorDetails(error, options) {
2613
2663
  message = `${message}: ${connectivity.message}`;
2614
2664
  }
2615
2665
  }
2666
+ const permission = status === undefined ? describePermissionError(error) : undefined;
2667
+ if (permission) {
2668
+ if (permission.message !== message && !message.includes(permission.message)) {
2669
+ message = `${message}: ${permission.message}`;
2670
+ }
2671
+ if (!message.includes(permission.instructions)) {
2672
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
2673
+ message = `${punctuated} ${permission.instructions}`;
2674
+ }
2675
+ }
2616
2676
  let details = rawMessage;
2617
2677
  if (rawBody) {
2618
2678
  if (parsedBody) {
@@ -2652,6 +2712,9 @@ async function extractErrorDetails(error, options) {
2652
2712
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
2653
2713
  context.traceId = parsedBody.traceId;
2654
2714
  }
2715
+ if (permission?.path !== undefined) {
2716
+ context.path = permission.path;
2717
+ }
2655
2718
  if (status === 429) {
2656
2719
  const resp = response;
2657
2720
  const headersObj = resp?.headers;
@@ -3885,6 +3948,7 @@ var CLI_ERROR_CODES = [
3885
3948
  "invalid_argument",
3886
3949
  "authentication_required",
3887
3950
  "permission_denied",
3951
+ "local_permission_denied",
3888
3952
  "not_found",
3889
3953
  "rate_limited",
3890
3954
  "network_error",
@@ -4320,12 +4384,16 @@ function defaultErrorCodeForHttpStatus(status) {
4320
4384
  return "server_error";
4321
4385
  return;
4322
4386
  }
4387
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
4323
4388
  function defaultErrorCodeForFailure(data) {
4324
4389
  if (data.Result === RESULTS.Failure) {
4325
4390
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
4326
4391
  const errorCode = defaultErrorCodeForHttpStatus(status);
4327
4392
  if (errorCode)
4328
4393
  return errorCode;
4394
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
4395
+ return "local_permission_denied";
4396
+ }
4329
4397
  }
4330
4398
  return defaultErrorCodeForResult(data.Result);
4331
4399
  }
@@ -4814,11 +4882,10 @@ var ScreenLogger;
4814
4882
  })(ScreenLogger ||= {});
4815
4883
  // ../../common/src/sdk-user-agent.ts
4816
4884
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
4817
- // ../../common/src/tool-provider.ts
4818
- var factorySlot = singleton("PackagerFactoryProvider");
4819
- var moduleSlot = singleton("ToolModuleProvider");
4820
4885
  // ../../common/src/telemetry/ship-succeeded.ts
4821
4886
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
4887
+ // ../../common/src/tool-provider.ts
4888
+ var factorySlot = singleton("PackagerFactoryProvider");
4822
4889
  // ../llmgw-sdk/dist/index.js
4823
4890
  import { createRequire } from "node:module";
4824
4891
  import fs2 from "node:fs";
@@ -6988,6 +7055,7 @@ function errorMessage(error) {
6988
7055
  }
6989
7056
  init_constants();
6990
7057
  init_src();
7058
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
6991
7059
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
6992
7060
  var INVALID_TENANT_CODE = "INVALID_TENANT";
6993
7061
  var TENANT_SELECTION_CODES = new Set([
@@ -7249,4 +7317,4 @@ export {
7249
7317
  metadata
7250
7318
  };
7251
7319
 
7252
- //# debugId=393E330771BA900564756E2164756E21
7320
+ //# debugId=6D7B25699B3C126264756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/llm-gateway-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 LLM Gateway model discovery.",
6
6
  "private": false,
7
7
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "publishConfig": {
24
24
  "registry": "https://registry.npmjs.org/"
25
25
  },
26
- "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
26
+ "gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
27
27
  }