@wayai/cli 0.3.128 → 0.3.129

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
@@ -9388,6 +9388,16 @@ function extractApiErrorCode(err) {
9388
9388
  return null;
9389
9389
  }
9390
9390
  }
9391
+ function extractApiRetryAfterSeconds(err) {
9392
+ if (!(err instanceof ApiError)) return null;
9393
+ try {
9394
+ const parsed = JSON.parse(err.body);
9395
+ const seconds = parsed?.details?.retry_after_seconds;
9396
+ return typeof seconds === "number" && Number.isFinite(seconds) && seconds >= 0 ? seconds : null;
9397
+ } catch {
9398
+ return null;
9399
+ }
9400
+ }
9391
9401
  function friendlyHint(err) {
9392
9402
  if (isNetworkError(err)) {
9393
9403
  return "Couldn't reach WayAI \u2014 check your network connection and try again.";
@@ -20002,17 +20012,22 @@ var init_eval_session_control = __esm({
20002
20012
  });
20003
20013
 
20004
20014
  // src/lib/eval-fixture-queue.ts
20015
+ function isQueueableLaunchError(err) {
20016
+ const code = extractApiErrorCode(err);
20017
+ return code !== null && QUEUEABLE_LAUNCH_ERRORS.has(code);
20018
+ }
20005
20019
  async function runWithFixtureQueue(opts) {
20006
20020
  let delay2 = FIXTURE_QUEUE_INITIAL_DELAY_MS;
20007
20021
  for (; ; ) {
20008
20022
  try {
20009
20023
  return await opts.attempt();
20010
20024
  } catch (err) {
20011
- if (extractApiErrorCode(err) !== QUEUEABLE_CONFLICT) throw err;
20025
+ if (!isQueueableLaunchError(err)) throw err;
20012
20026
  if (opts.noQueue) throw err;
20013
20027
  const remaining = opts.deadlineMs - opts.now();
20014
20028
  if (remaining <= 0) throw err;
20015
- const waitMs = Math.min(delay2, remaining);
20029
+ const retryAfterMs = (extractApiRetryAfterSeconds(err) ?? 0) * 1e3;
20030
+ const waitMs = Math.min(Math.max(delay2, retryAfterMs), remaining);
20016
20031
  opts.onWait({ message: extractApiMessage(err), waitMs });
20017
20032
  await opts.sleep(waitMs);
20018
20033
  if (await opts.interrupted?.()) throw err;
@@ -20021,14 +20036,17 @@ async function runWithFixtureQueue(opts) {
20021
20036
  }
20022
20037
  }
20023
20038
  }
20024
- var FIXTURE_QUEUE_INITIAL_DELAY_MS, FIXTURE_QUEUE_MAX_DELAY_MS, QUEUEABLE_CONFLICT;
20039
+ var FIXTURE_QUEUE_INITIAL_DELAY_MS, FIXTURE_QUEUE_MAX_DELAY_MS, QUEUEABLE_LAUNCH_ERRORS;
20025
20040
  var init_eval_fixture_queue = __esm({
20026
20041
  "src/lib/eval-fixture-queue.ts"() {
20027
20042
  "use strict";
20028
20043
  init_errors2();
20029
20044
  FIXTURE_QUEUE_INITIAL_DELAY_MS = 5e3;
20030
20045
  FIXTURE_QUEUE_MAX_DELAY_MS = 3e4;
20031
- QUEUEABLE_CONFLICT = "fixture_target_in_use";
20046
+ QUEUEABLE_LAUNCH_ERRORS = /* @__PURE__ */ new Set([
20047
+ "fixture_target_in_use",
20048
+ "fixture_seed_unavailable"
20049
+ ]);
20032
20050
  }
20033
20051
  });
20034
20052
 
@@ -20204,8 +20222,8 @@ async function pollEvalSession(input) {
20204
20222
  if (await signalController.interrupted()) return;
20205
20223
  console.error(`
20206
20224
  Failed to start session: ${extractApiMessage(err)}`);
20207
- if (extractApiErrorCode(err) === "fixture_target_in_use" && !noQueue) {
20208
- console.error(`Waited ${timeoutSeconds}s for the fixture. Raise --timeout, or use --no-queue to fail immediately.`);
20225
+ if (isQueueableLaunchError(err) && !noQueue) {
20226
+ console.error(`Waited ${timeoutSeconds}s for the fixture to become available. Raise --timeout, or use --no-queue to fail immediately.`);
20209
20227
  }
20210
20228
  console.error(`Session ID: ${sessionId}`);
20211
20229
  console.error(`Stop it if it started anyway: ${manualStopCommand}`);
@@ -25186,7 +25204,7 @@ Flags:
25186
25204
  --connection <name> MCP connection to re-sync \u2014 display name or UUID (sync-mcp)
25187
25205
  --enabled/--disabled Filter evals by status (evals)
25188
25206
  --no-wait Don't wait for eval session to complete (run-eval)
25189
- --no-queue Fail immediately if another session holds the fixture (run-eval; implied by --no-wait)
25207
+ --no-queue Fail immediately instead of waiting for the fixture to free up (run-eval; implied by --no-wait)
25190
25208
  --timeout <seconds> Max wait time for eval session (default: 600)
25191
25209
  --pacing <preset|ms> Run pacing: conservative | balanced | fast | <milliseconds> (run-eval; default balanced)
25192
25210
  --fixture <name> Override the suite's declared seed fixture for this run (run-eval)