@remnic/bench 9.3.606 → 9.3.608

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.d.ts CHANGED
@@ -237,6 +237,7 @@ interface ProviderConfig {
237
237
  maxAttempts?: number;
238
238
  baseBackoffMs?: number;
239
239
  timeoutMs?: number;
240
+ retryOnTimeout?: boolean;
240
241
  max429WaitMs?: number;
241
242
  };
242
243
  disableThinking?: boolean;
@@ -621,6 +622,7 @@ interface ProviderBaseConfig {
621
622
  maxAttempts?: number;
622
623
  baseBackoffMs?: number;
623
624
  timeoutMs?: number;
625
+ retryOnTimeout?: boolean;
624
626
  max429WaitMs?: number;
625
627
  };
626
628
  /** Suppress thinking/reasoning tokens for thinking-capable models (Qwen 3.5, Gemma 4, DeepSeek). */
package/dist/index.js CHANGED
@@ -5943,6 +5943,7 @@ var DEFAULTS = {
5943
5943
  maxAttempts: 3,
5944
5944
  baseBackoffMs: 1e3,
5945
5945
  timeoutMs: 12e4,
5946
+ retryOnTimeout: false,
5946
5947
  max429WaitMs: 0
5947
5948
  };
5948
5949
  function normalizeRetryFetchOptions(options) {
@@ -5950,11 +5951,15 @@ function normalizeRetryFetchOptions(options) {
5950
5951
  maxAttempts: options?.maxAttempts ?? DEFAULTS.maxAttempts,
5951
5952
  baseBackoffMs: options?.baseBackoffMs ?? DEFAULTS.baseBackoffMs,
5952
5953
  timeoutMs: options?.timeoutMs ?? DEFAULTS.timeoutMs,
5954
+ retryOnTimeout: options?.retryOnTimeout ?? DEFAULTS.retryOnTimeout,
5953
5955
  max429WaitMs: options?.max429WaitMs ?? DEFAULTS.max429WaitMs
5954
5956
  };
5955
5957
  if (!Number.isInteger(normalized.maxAttempts) || normalized.maxAttempts <= 0) {
5956
5958
  throw new Error("retryFetch maxAttempts must be a positive integer");
5957
5959
  }
5960
+ if (typeof normalized.retryOnTimeout !== "boolean") {
5961
+ throw new Error("retryFetch retryOnTimeout must be a boolean");
5962
+ }
5958
5963
  for (const field of ["baseBackoffMs", "timeoutMs", "max429WaitMs"]) {
5959
5964
  if (!Number.isFinite(normalized[field]) || normalized[field] < 0) {
5960
5965
  throw new Error(`retryFetch ${field} must be a finite non-negative number`);
@@ -5977,6 +5982,9 @@ function isTransientError(err) {
5977
5982
  const msg = err.message.toLowerCase();
5978
5983
  return msg.includes("econnrefused") || msg.includes("econnreset") || msg.includes("etimedout") || msg.includes("econnaborted") || msg.includes("socket hang up") || msg.includes("fetch failed") || err.name === "AbortError";
5979
5984
  }
5985
+ function isAbortError(err) {
5986
+ return err instanceof Error && err.name === "AbortError";
5987
+ }
5980
5988
  function parseRetryAfterMs(value) {
5981
5989
  if (value === null || value.length === 0) return void 0;
5982
5990
  const asNumber2 = Number(value);
@@ -6041,7 +6049,11 @@ async function retryFetch(url, init, options) {
6041
6049
  const controller = new AbortController();
6042
6050
  const onCallerAbort = () => controller.abort();
6043
6051
  callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
6044
- const timeout = setTimeout(() => controller.abort(), opts.timeoutMs);
6052
+ let timeoutFired = false;
6053
+ const timeout = setTimeout(() => {
6054
+ timeoutFired = true;
6055
+ controller.abort();
6056
+ }, opts.timeoutMs);
6045
6057
  try {
6046
6058
  const { signal: _callerSignal, ...initWithoutSignal } = init;
6047
6059
  const response = await fetch(url, { ...initWithoutSignal, signal: controller.signal });
@@ -6069,10 +6081,7 @@ async function retryFetch(url, init, options) {
6069
6081
  headers: new Headers(response.headers)
6070
6082
  });
6071
6083
  last429IsStale = false;
6072
- let waitMs = retryAfter != null ? Math.max(retryAfter, 100) : Math.min(
6073
- opts.baseBackoffMs * Math.pow(2, attempt - 1),
6074
- MAX_429_BACKOFF_S * 1e3
6075
- );
6084
+ let waitMs = retryAfter != null ? Math.max(retryAfter, 100) : Math.min(opts.baseBackoffMs * Math.pow(2, attempt - 1), MAX_429_BACKOFF_S * 1e3);
6076
6085
  if (opts.max429WaitMs > 0) {
6077
6086
  waitMs = Math.min(waitMs, remainingExtendedBudgetMs());
6078
6087
  }
@@ -6118,15 +6127,27 @@ async function retryFetch(url, init, options) {
6118
6127
  callerSignal?.removeEventListener("abort", onCallerAbort);
6119
6128
  throw err;
6120
6129
  }
6121
- if (!isTransientError(err)) {
6130
+ if (timeoutFired && isAbortError(err)) {
6131
+ const timeoutError = new Error(
6132
+ `retryFetch timed out after ${opts.timeoutMs}ms (attempt ${attempt}/${opts.maxAttempts})`
6133
+ );
6134
+ lastError = timeoutError;
6135
+ last429IsStale = true;
6122
6136
  callerSignal?.removeEventListener("abort", onCallerAbort);
6123
- throw err;
6124
- }
6125
- lastError = err instanceof Error ? err : new Error(String(err));
6126
- last429IsStale = true;
6127
- callerSignal?.removeEventListener("abort", onCallerAbort);
6128
- if (attempt >= opts.maxAttempts) {
6129
- throw lastError;
6137
+ if (!opts.retryOnTimeout || attempt >= opts.maxAttempts) {
6138
+ throw timeoutError;
6139
+ }
6140
+ } else {
6141
+ if (!isTransientError(err)) {
6142
+ callerSignal?.removeEventListener("abort", onCallerAbort);
6143
+ throw err;
6144
+ }
6145
+ lastError = err instanceof Error ? err : new Error(String(err));
6146
+ last429IsStale = true;
6147
+ callerSignal?.removeEventListener("abort", onCallerAbort);
6148
+ if (attempt >= opts.maxAttempts) {
6149
+ throw lastError;
6150
+ }
6130
6151
  }
6131
6152
  }
6132
6153
  if (attempt < opts.maxAttempts) {
@@ -23523,6 +23544,10 @@ function collectEvidenceTimestamps(page) {
23523
23544
  const timestamp = parseTimelineEntry(entry);
23524
23545
  if (timestamp !== null) timestamps.add(timestamp);
23525
23546
  }
23547
+ for (const entry of page.timeline) {
23548
+ const timestamp = parseTimelineEntry(entry);
23549
+ if (timestamp !== null) timestamps.add(timestamp);
23550
+ }
23526
23551
  return [...timestamps];
23527
23552
  }
23528
23553
  function parseTimestamp(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/bench",
3
- "version": "9.3.606",
3
+ "version": "9.3.608",
4
4
  "description": "Retrieval latency ladder benchmarks + CI regression gates for @remnic/core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "hyparquet": "^1.25.7",
36
36
  "yaml": "^2.4.2",
37
- "@remnic/core": "^9.3.606"
37
+ "@remnic/core": "^9.3.608"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsup": "^8.5.1",