@remnic/bench 9.3.612 → 9.3.614

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
@@ -389,6 +389,8 @@ interface RunBenchmarkOptions {
389
389
  outputDir?: string;
390
390
  limit?: number;
391
391
  seed?: number;
392
+ /** Override the number of full-mode benchmark iterations. Quick mode remains single-run. */
393
+ iterations?: number;
392
394
  adapterMode?: string;
393
395
  runtimeProfile?: BenchRuntimeProfile | null;
394
396
  system: BenchMemoryAdapter;
package/dist/index.js CHANGED
@@ -7316,6 +7316,7 @@ var SECRET_KEY_SEGMENT_SUFFIXES = /* @__PURE__ */ new Set([
7316
7316
  "bearertoken",
7317
7317
  "clientsecret",
7318
7318
  "secretkey",
7319
+ "secretaccesskey",
7319
7320
  "privatekey"
7320
7321
  ]);
7321
7322
  var SECRET_MATERIAL_DESCRIPTORS = /* @__PURE__ */ new Set([
@@ -7343,7 +7344,7 @@ function isSecretSegments(segments) {
7343
7344
  return true;
7344
7345
  }
7345
7346
  for (let width = 2; width <= Math.min(3, segments.length); width += 1) {
7346
- const candidate = segments.slice(-width).join("");
7347
+ const candidate = segments.slice(segments.length - width).join("");
7347
7348
  if (SECRET_KEY_SEGMENT_SUFFIXES.has(candidate)) {
7348
7349
  return true;
7349
7350
  }
@@ -10639,6 +10640,7 @@ function rougeL(predicted, expected) {
10639
10640
  return 2 * precision * recall / (precision + recall);
10640
10641
  }
10641
10642
  function recallAtK(retrieved, relevant, k) {
10643
+ if (!Number.isInteger(k) || k <= 0) return 0;
10642
10644
  if (relevant.length === 0) return 1;
10643
10645
  const topK = retrieved.slice(0, k).map(normalizeText);
10644
10646
  const relevantSet = new Set(relevant.map(normalizeText));
@@ -19924,7 +19926,7 @@ function resolveTrialLimit2(raw) {
19924
19926
  if (raw === void 0 || raw === null) {
19925
19927
  return void 0;
19926
19928
  }
19927
- const parsed = typeof raw === "number" ? raw : Number(raw);
19929
+ const parsed = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim().length > 0 && /^[0-9]+$/.test(raw.trim()) ? Number(raw.trim()) : Number.NaN;
19928
19930
  if (!Number.isInteger(parsed) || parsed < 0) {
19929
19931
  throw new Error(
19930
19932
  "MemoryAgentBench benchmarkOptions.trialLimit must be a non-negative integer."
@@ -26584,12 +26586,16 @@ import path29 from "path";
26584
26586
 
26585
26587
  // src/run-seeds.ts
26586
26588
  function buildBenchmarkRunSeeds(runCount, baseSeed) {
26587
- if (!Number.isInteger(runCount) || runCount <= 0) {
26588
- throw new Error("benchmark run count must be a positive integer");
26589
+ if (!Number.isSafeInteger(runCount) || runCount <= 0) {
26590
+ throw new Error("benchmark run count must be a positive integer within JavaScript safe integer range");
26589
26591
  }
26590
26592
  const firstSeed = baseSeed ?? 0;
26591
- if (!Number.isInteger(firstSeed) || firstSeed < 0) {
26592
- throw new Error("benchmark seed must be a non-negative integer");
26593
+ if (!Number.isSafeInteger(firstSeed) || firstSeed < 0) {
26594
+ throw new Error("benchmark seed must be a non-negative integer within JavaScript safe integer range");
26595
+ }
26596
+ const maxOffset = Number.MAX_SAFE_INTEGER - firstSeed;
26597
+ if (runCount - 1 > maxOffset) {
26598
+ throw new Error("benchmark seed sequence must stay within JavaScript safe integer range");
26593
26599
  }
26594
26600
  return Array.from({ length: runCount }, (_, index) => firstSeed + index);
26595
26601
  }
@@ -28498,15 +28504,6 @@ async function runContradictionDetectionBenchmark(options) {
28498
28504
  const remnicVersion = await getRemnicVersion();
28499
28505
  const totalLatencyMs = tasks.reduce((sum, task) => sum + task.latencyMs, 0);
28500
28506
  const meanQueryLatencyMs = tasks.length > 0 ? totalLatencyMs / tasks.length : 0;
28501
- tasks.push({
28502
- taskId: "_aggregate_verdict_metrics",
28503
- question: "Per-verdict precision/recall/F1",
28504
- expected: "see scores",
28505
- actual: "see scores",
28506
- scores: verdictScores,
28507
- latencyMs: 0,
28508
- tokens: { input: 0, output: 0 }
28509
- });
28510
28507
  return {
28511
28508
  meta: {
28512
28509
  id: randomUUID29(),
@@ -28536,7 +28533,10 @@ async function runContradictionDetectionBenchmark(options) {
28536
28533
  },
28537
28534
  results: {
28538
28535
  tasks,
28539
- aggregates: aggregateTaskScores(tasks.map((task) => task.scores))
28536
+ aggregates: {
28537
+ ...aggregateTaskScores(tasks.map((task) => task.scores)),
28538
+ ...aggregateTaskScores([verdictScores])
28539
+ }
28540
28540
  },
28541
28541
  environment: {
28542
28542
  os: process.platform,
@@ -30004,7 +30004,7 @@ async function runCustomBenchmark(spec, options) {
30004
30004
  `Custom benchmark "${spec.name}" uses llm_judge scoring but no judge provider is configured.`
30005
30005
  );
30006
30006
  }
30007
- const runCount = resolveBenchmarkRunCount(options.mode);
30007
+ const runCount = resolveBenchmarkRunCount(options.mode, options.iterations);
30008
30008
  const tasksPerRun = selectTasks(spec, options.limit);
30009
30009
  const totalTaskCount = runCount * tasksPerRun.length;
30010
30010
  let completedTaskCount = 0;
@@ -30021,7 +30021,7 @@ async function runCustomBenchmark(spec, options) {
30021
30021
  options.onTaskComplete?.(taskResult, completedTaskCount, totalTaskCount);
30022
30022
  }
30023
30023
  ),
30024
- void 0,
30024
+ options.iterations,
30025
30025
  options.seed
30026
30026
  );
30027
30027
  const tasks = runs.flat();
@@ -32286,10 +32286,11 @@ function createMitigatedTarget(config) {
32286
32286
  const timestamps = [];
32287
32287
  function recordAndCheck(now) {
32288
32288
  const cutoff = now - budgetWindowMs;
32289
- while (timestamps.length > 0 && timestamps[0].ts <= cutoff) {
32289
+ while (timestamps.length > 0 && timestamps[0].ts < cutoff) {
32290
32290
  timestamps.shift();
32291
32291
  }
32292
- if (timestamps.length >= budgetHardLimit) {
32292
+ const projected = timestamps.length + 1;
32293
+ if (projected >= budgetHardLimit) {
32293
32294
  return false;
32294
32295
  }
32295
32296
  timestamps.push({ ts: now });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/bench",
3
- "version": "9.3.612",
3
+ "version": "9.3.614",
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.612"
37
+ "@remnic/core": "^9.3.614"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsup": "^8.5.1",