@uipath/eval-tool 1.203.0-preview.203 → 1.204.0-preview.206

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
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
- Command
4
- } from "./tool-pa6awsya.js";
3
+ metadata,
4
+ registerCommands
5
+ } from "./tool-80vkb32z.js";
5
6
  import {
6
- metadata2,
7
- registerCommands2
8
- } from "./tool-r9mtm8ew.js";
7
+ Command
8
+ } from "./tool-jpgd82xt.js";
9
+ import"./tool-1de529jm.js";
9
10
 
10
11
  // src/index.ts
11
12
  var program = new Command;
12
- program.name(metadata2.commandPrefix).description(metadata2.description).version(metadata2.version);
13
- await registerCommands2(program);
13
+ program.name(metadata.commandPrefix).description(metadata.description).version(metadata.version);
14
+ await registerCommands(program);
14
15
  await program.parseAsync(process.argv);
15
16
 
16
- //# debugId=C08E57297796321864756E2164756E21
17
+ //# debugId=7FEA55D2A244CE4064756E2164756E21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __commonJS
3
- } from "./tool-epsr41wx.js";
3
+ } from "./tool-1de529jm.js";
4
4
 
5
5
  // ../../node_modules/jmespath/jmespath.js
6
6
  var require_jmespath = __commonJS(function(exports) {
@@ -1,3 +1,5 @@
1
+ import"./tool-1de529jm.js";
2
+
1
3
  // ../../node_modules/js-yaml/dist/js-yaml.mjs
2
4
  function getDefaultExportFromCjs(x) {
3
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -3148,4 +3150,4 @@ export {
3148
3150
  types
3149
3151
  };
3150
3152
 
3151
- //# debugId=41DC6971B94BC54964756E2164756E21
3153
+ //# debugId=9FA8E718B2F80BEA64756E2164756E21
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => {
18
18
  return cached;
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
22
  if (mod && typeof mod === "object" || typeof mod === "function") {
23
23
  for (let key of __getOwnPropNames(mod))
24
24
  if (!__hasOwnProp.call(to, key))
@@ -32,17 +32,8 @@ var __toESM = (mod, isNodeMode, target) => {
32
32
  return to;
33
33
  };
34
34
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
35
- var __exportCjs = (target, getters, setters) => {
36
- for (var name in getters)
37
- __defProp(target, name, {
38
- get: getters[name],
39
- set: setters[name],
40
- enumerable: true,
41
- configurable: true
42
- });
43
- };
44
35
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
45
36
 
46
- export { __toESM, __commonJS, __exportCjs, __require };
37
+ export { __toESM, __commonJS, __require };
47
38
 
48
- //# debugId=6692E9B4C735B07364756E2164756E21
39
+ //# debugId=4A15A0D6FCDB684764756E2164756E21
@@ -1,18 +1,24 @@
1
1
  import {
2
+ OutputFormatter,
3
+ Pagination,
4
+ RESULTS,
5
+ carriedInstructions,
2
6
  catchError,
7
+ extractErrorDetails,
3
8
  extractErrorMessage,
4
- RESULTS,
5
- Pagination,
6
- OutputFormatter,
7
- processContext,
8
- getAuthContext
9
- } from "./tool-pa6awsya.js";
9
+ getAuthContext,
10
+ instructionsFor,
11
+ processContext
12
+ } from "./tool-jpgd82xt.js";
13
+ import {
14
+ __require
15
+ } from "./tool-1de529jm.js";
10
16
  // package.json
11
17
  var package_default = {
12
18
  name: "@uipath/eval-tool",
13
19
  author: "UiPath",
14
20
  license: "SEE LICENSE IN LICENSE.txt",
15
- version: "1.203.0-preview.203",
21
+ version: "1.204.0-preview.206",
16
22
  description: "Manage runtime evaluations, evaluators, eval sets, evaluations, and schedules.",
17
23
  private: false,
18
24
  repository: {
@@ -76,6 +82,31 @@ async function resolveEvalAuth(tenant) {
76
82
  tenantId: ctx.tenantId ?? ""
77
83
  };
78
84
  }
85
+
86
+ class EvalApiError extends Error {
87
+ status;
88
+ response;
89
+ constructor(method, url, status, statusText, body, headers) {
90
+ super(`${method} ${url} returned ${status}`);
91
+ this.name = "EvalApiError";
92
+ this.status = status;
93
+ this.response = {
94
+ status,
95
+ statusText,
96
+ headers,
97
+ text: () => Promise.resolve(body)
98
+ };
99
+ }
100
+ }
101
+
102
+ class EvalResponseError extends Error {
103
+ instructions;
104
+ constructor(message, instructions) {
105
+ super(message);
106
+ this.name = "EvalResponseError";
107
+ this.instructions = instructions;
108
+ }
109
+ }
79
110
  async function evalApiRequest(url, headers, method, body) {
80
111
  const response = await fetch(url, {
81
112
  method,
@@ -84,15 +115,14 @@ async function evalApiRequest(url, headers, method, body) {
84
115
  });
85
116
  const text = await response.text();
86
117
  if (!response.ok) {
87
- const hint = response.status === 401 ? " Token may have expired — run 'uip login' and retry." : "";
88
- throw new Error(`${method} ${url.split("?")[0]} returned ${response.status}: ${text}${hint}`);
118
+ throw new EvalApiError(method, url.split("?")[0] ?? url, response.status, response.statusText, text, response.headers);
89
119
  }
90
120
  if (!text)
91
121
  return {};
92
122
  try {
93
123
  return JSON.parse(text);
94
124
  } catch {
95
- throw new Error(`API returned non-JSON response (${response.status}): ${text.slice(0, 200)}`);
125
+ throw new EvalResponseError(`API returned non-JSON response (${response.status}): ${text.slice(0, 200)}`, "The endpoint answered with something other than JSON — check the base URL in use with 'uip whoami' and the service status, then retry.");
96
126
  }
97
127
  }
98
128
  async function resolveEvalAuthOrFail(tenant) {
@@ -108,19 +138,41 @@ async function resolveEvalAuthOrFail(tenant) {
108
138
  }
109
139
  return auth;
110
140
  }
141
+ function evalFailureInstructions(details, fallback, error) {
142
+ if (details.parsedErrors) {
143
+ const flagged = Object.entries(details.parsedErrors).map(([field, messages]) => field === "$" ? messages.join(" ") : `${field}: ${messages.join(" ")}`).join(" ");
144
+ return `The service rejected the request body: ${flagged} Fix the request and retry; Errors carries the same map per field.`;
145
+ }
146
+ const carried = carriedInstructions(error);
147
+ if (carried) {
148
+ return carried;
149
+ }
150
+ if (details.context?.httpStatus === 404) {
151
+ return fallback;
152
+ }
153
+ return instructionsFor("backend", error);
154
+ }
111
155
  async function evalApiRequestOrFail(url, headers, method, instructions, body) {
112
156
  const [err, data] = await catchError(evalApiRequest(url, headers, method, body));
113
157
  if (err) {
114
- OutputFormatter.error({
115
- Result: RESULTS.Failure,
116
- Message: err.message,
117
- Instructions: instructions
118
- });
158
+ OutputFormatter.error(await evalFailureEnvelope(err, instructions));
119
159
  processContext.exit(1);
120
160
  return null;
121
161
  }
122
162
  return data;
123
163
  }
164
+ async function evalFailureEnvelope(error, fallbackInstructions) {
165
+ const details = await extractErrorDetails(error);
166
+ return {
167
+ Result: details.result,
168
+ ErrorCode: details.errorCode,
169
+ Message: details.message,
170
+ Instructions: evalFailureInstructions(details, fallbackInstructions, error),
171
+ Retry: details.retry,
172
+ ...details.parsedErrors ? { Errors: details.parsedErrors } : {},
173
+ ...details.context ? { Context: details.context } : {}
174
+ };
175
+ }
124
176
  function parseIntOrFail(value, flag, min = 0) {
125
177
  const n = Number.parseInt(value, 10);
126
178
  if (Number.isNaN(n) || n < min) {
@@ -858,7 +910,7 @@ async function submitRun(evalSetId, items, evaluators, batchSize, agentsApiBase,
858
910
  };
859
911
  const raw = await evalApiRequest(`${agentsApiBase}/unifiedEvals/workloads/executeAndEvaluate`, authHeaders, "POST", body);
860
912
  if (raw === null || typeof raw !== "object" || !("evalSetRunId" in raw)) {
861
- throw new Error("API response did not contain evalSetRunId. The run may not have been created.");
913
+ throw new EvalResponseError("API response did not contain evalSetRunId. The run may not have been created.", "List the process's runs with 'uip eval run list --process-key <process-key>' to see whether the run was created before submitting it again.");
862
914
  }
863
915
  return String(raw.evalSetRunId);
864
916
  }
@@ -962,11 +1014,7 @@ async function resolveFromEvalSet(options) {
962
1014
  const folderKey = options.folderKey ?? evalSet.folderKey;
963
1015
  const [submitErr, evalSetRunId] = await catchError(submitRun(evalSetId, items, evaluatorConfigs, batchSize, auth.agentsApiBase, auth.authHeaders, folderKey, auth.tenantId, options.processKey, evalSet.workloadId));
964
1016
  if (submitErr) {
965
- OutputFormatter.error({
966
- Result: RESULTS.Failure,
967
- Message: submitErr.message,
968
- Instructions: "Check that the package is published and the eval set is configured correctly."
969
- });
1017
+ OutputFormatter.error(await evalFailureEnvelope(submitErr, "Check that the package is published and the eval set is configured correctly."));
970
1018
  processContext.exit(1);
971
1019
  return;
972
1020
  }
@@ -1020,7 +1068,7 @@ async function resolveInline(options) {
1020
1068
  folderKey = options.folderKey;
1021
1069
  folderLabel = folderKey;
1022
1070
  } else {
1023
- const { createApiClient, PersonalWorkspacesApi } = await import("./index-24qchvk6.js");
1071
+ const { createApiClient, PersonalWorkspacesApi } = await import("./index-ynehe0js.js");
1024
1072
  const [wsApiErr, wsApi] = await catchError(createApiClient(PersonalWorkspacesApi, {
1025
1073
  tenant: options.tenant
1026
1074
  }));
@@ -1056,11 +1104,7 @@ async function resolveInline(options) {
1056
1104
  const evalSetId = options.evalSetId ?? ZERO_GUID;
1057
1105
  const [submitErr, evalSetRunId] = await catchError(submitRun(evalSetId, items, evaluators, batchSize, auth.agentsApiBase, auth.authHeaders, folderKey, auth.tenantId, options.processKey, options.workloadId));
1058
1106
  if (submitErr) {
1059
- OutputFormatter.error({
1060
- Result: RESULTS.Failure,
1061
- Message: submitErr.message,
1062
- Instructions: "Check that the package is published and the eval set ID is correct."
1063
- });
1107
+ OutputFormatter.error(await evalFailureEnvelope(submitErr, "Check that the package is published and the eval set ID is correct."));
1064
1108
  processContext.exit(1);
1065
1109
  return;
1066
1110
  }
@@ -1323,6 +1367,7 @@ function formatEvalSet(es) {
1323
1367
  Description: es.description ?? "",
1324
1368
  Version: es.version ?? "-",
1325
1369
  BatchSize: es.batchSize ?? "-",
1370
+ TimeoutMinutes: es.timeoutMinutes ?? "-",
1326
1371
  EvaluatorRefs: es.evaluatorRefs,
1327
1372
  CreatedAt: es.createdAt,
1328
1373
  ...es.updatedAt ? { UpdatedAt: es.updatedAt } : {}
@@ -1578,16 +1623,16 @@ function registerEvalCommand(program) {
1578
1623
  }
1579
1624
 
1580
1625
  // src/tool.ts
1581
- var metadata2 = {
1626
+ var metadata = {
1582
1627
  name: "eval-tool",
1583
1628
  version: package_default.version,
1584
1629
  description: "Run runtime evaluations, manage evaluators, eval sets, evaluations, and schedules.",
1585
1630
  commandPrefix: "eval"
1586
1631
  };
1587
- var registerCommands2 = async (program) => {
1632
+ var registerCommands = async (program) => {
1588
1633
  registerEvalCommand(program);
1589
1634
  };
1590
1635
 
1591
- export { metadata2, registerCommands2 };
1636
+ export { metadata, registerCommands };
1592
1637
 
1593
- //# debugId=EFBD09296909983C64756E2164756E21
1638
+ //# debugId=3A36BD658832390564756E2164756E21