opencode-swarm-plugin 0.45.2 → 0.45.4

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
@@ -35190,8 +35190,8 @@ var require_req = __commonJS((exports, module) => {
35190
35190
  if (req.originalUrl) {
35191
35191
  _req.url = req.originalUrl;
35192
35192
  } else {
35193
- const path5 = req.path;
35194
- _req.url = typeof path5 === "string" ? path5 : req.url ? req.url.path || req.url : undefined;
35193
+ const path3 = req.path;
35194
+ _req.url = typeof path3 === "string" ? path3 : req.url ? req.url.path || req.url : undefined;
35195
35195
  }
35196
35196
  if (req.query) {
35197
35197
  _req.query = req.query;
@@ -35347,14 +35347,14 @@ var require_redact = __commonJS((exports, module) => {
35347
35347
  }
35348
35348
  return obj;
35349
35349
  }
35350
- function parsePath(path5) {
35350
+ function parsePath(path3) {
35351
35351
  const parts2 = [];
35352
35352
  let current = "";
35353
35353
  let inBrackets = false;
35354
35354
  let inQuotes = false;
35355
35355
  let quoteChar = "";
35356
- for (let i = 0;i < path5.length; i++) {
35357
- const char = path5[i];
35356
+ for (let i = 0;i < path3.length; i++) {
35357
+ const char = path3[i];
35358
35358
  if (!inBrackets && char === ".") {
35359
35359
  if (current) {
35360
35360
  parts2.push(current);
@@ -35485,10 +35485,10 @@ var require_redact = __commonJS((exports, module) => {
35485
35485
  return current;
35486
35486
  }
35487
35487
  function redactPaths(obj, paths, censor, remove7 = false) {
35488
- for (const path5 of paths) {
35489
- const parts2 = parsePath(path5);
35488
+ for (const path3 of paths) {
35489
+ const parts2 = parsePath(path3);
35490
35490
  if (parts2.includes("*")) {
35491
- redactWildcardPath(obj, parts2, censor, path5, remove7);
35491
+ redactWildcardPath(obj, parts2, censor, path3, remove7);
35492
35492
  } else {
35493
35493
  if (remove7) {
35494
35494
  removeKey(obj, parts2);
@@ -35575,8 +35575,8 @@ var require_redact = __commonJS((exports, module) => {
35575
35575
  }
35576
35576
  } else {
35577
35577
  if (afterWildcard.includes("*")) {
35578
- const wrappedCensor = typeof censor === "function" ? (value, path5) => {
35579
- const fullPath = [...pathArray.slice(0, pathLength), ...path5];
35578
+ const wrappedCensor = typeof censor === "function" ? (value, path3) => {
35579
+ const fullPath = [...pathArray.slice(0, pathLength), ...path3];
35580
35580
  return censor(value, fullPath);
35581
35581
  } : censor;
35582
35582
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove7);
@@ -35613,8 +35613,8 @@ var require_redact = __commonJS((exports, module) => {
35613
35613
  return null;
35614
35614
  }
35615
35615
  const pathStructure = new Map;
35616
- for (const path5 of pathsToClone) {
35617
- const parts2 = parsePath(path5);
35616
+ for (const path3 of pathsToClone) {
35617
+ const parts2 = parsePath(path3);
35618
35618
  let current = pathStructure;
35619
35619
  for (let i = 0;i < parts2.length; i++) {
35620
35620
  const part = parts2[i];
@@ -35666,24 +35666,24 @@ var require_redact = __commonJS((exports, module) => {
35666
35666
  }
35667
35667
  return cloneSelectively(obj, pathStructure);
35668
35668
  }
35669
- function validatePath(path5) {
35670
- if (typeof path5 !== "string") {
35669
+ function validatePath(path3) {
35670
+ if (typeof path3 !== "string") {
35671
35671
  throw new Error("Paths must be (non-empty) strings");
35672
35672
  }
35673
- if (path5 === "") {
35673
+ if (path3 === "") {
35674
35674
  throw new Error("Invalid redaction path ()");
35675
35675
  }
35676
- if (path5.includes("..")) {
35677
- throw new Error(`Invalid redaction path (${path5})`);
35676
+ if (path3.includes("..")) {
35677
+ throw new Error(`Invalid redaction path (${path3})`);
35678
35678
  }
35679
- if (path5.includes(",")) {
35680
- throw new Error(`Invalid redaction path (${path5})`);
35679
+ if (path3.includes(",")) {
35680
+ throw new Error(`Invalid redaction path (${path3})`);
35681
35681
  }
35682
35682
  let bracketCount = 0;
35683
35683
  let inQuotes = false;
35684
35684
  let quoteChar = "";
35685
- for (let i = 0;i < path5.length; i++) {
35686
- const char = path5[i];
35685
+ for (let i = 0;i < path3.length; i++) {
35686
+ const char = path3[i];
35687
35687
  if ((char === '"' || char === "'") && bracketCount > 0) {
35688
35688
  if (!inQuotes) {
35689
35689
  inQuotes = true;
@@ -35697,20 +35697,20 @@ var require_redact = __commonJS((exports, module) => {
35697
35697
  } else if (char === "]" && !inQuotes) {
35698
35698
  bracketCount--;
35699
35699
  if (bracketCount < 0) {
35700
- throw new Error(`Invalid redaction path (${path5})`);
35700
+ throw new Error(`Invalid redaction path (${path3})`);
35701
35701
  }
35702
35702
  }
35703
35703
  }
35704
35704
  if (bracketCount !== 0) {
35705
- throw new Error(`Invalid redaction path (${path5})`);
35705
+ throw new Error(`Invalid redaction path (${path3})`);
35706
35706
  }
35707
35707
  }
35708
35708
  function validatePaths(paths) {
35709
35709
  if (!Array.isArray(paths)) {
35710
35710
  throw new TypeError("paths must be an array");
35711
35711
  }
35712
- for (const path5 of paths) {
35713
- validatePath(path5);
35712
+ for (const path3 of paths) {
35713
+ validatePath(path3);
35714
35714
  }
35715
35715
  }
35716
35716
  function slowRedact(options2 = {}) {
@@ -35872,8 +35872,8 @@ var require_redaction = __commonJS((exports, module) => {
35872
35872
  if (shape[k] === null) {
35873
35873
  o[k] = (value) => topCensor(value, [k]);
35874
35874
  } else {
35875
- const wrappedCensor = typeof censor === "function" ? (value, path5) => {
35876
- return censor(value, [k, ...path5]);
35875
+ const wrappedCensor = typeof censor === "function" ? (value, path3) => {
35876
+ return censor(value, [k, ...path3]);
35877
35877
  } : censor;
35878
35878
  o[k] = Redact({
35879
35879
  paths: shape[k],
@@ -36081,10 +36081,10 @@ var require_atomic_sleep = __commonJS((exports, module) => {
36081
36081
 
36082
36082
  // ../../node_modules/.bun/sonic-boom@4.2.0/node_modules/sonic-boom/index.js
36083
36083
  var require_sonic_boom = __commonJS((exports, module) => {
36084
- var fs4 = __require("fs");
36084
+ var fs2 = __require("fs");
36085
36085
  var EventEmitter = __require("events");
36086
36086
  var inherits = __require("util").inherits;
36087
- var path5 = __require("path");
36087
+ var path3 = __require("path");
36088
36088
  var sleep5 = require_atomic_sleep();
36089
36089
  var assert2 = __require("assert");
36090
36090
  var BUSY_WRITE_TIMEOUT = 100;
@@ -36139,21 +36139,21 @@ var require_sonic_boom = __commonJS((exports, module) => {
36139
36139
  if (sonic.sync) {
36140
36140
  try {
36141
36141
  if (sonic.mkdir)
36142
- fs4.mkdirSync(path5.dirname(file2), { recursive: true });
36143
- const fd = fs4.openSync(file2, flags, mode);
36142
+ fs2.mkdirSync(path3.dirname(file2), { recursive: true });
36143
+ const fd = fs2.openSync(file2, flags, mode);
36144
36144
  fileOpened(null, fd);
36145
36145
  } catch (err) {
36146
36146
  fileOpened(err);
36147
36147
  throw err;
36148
36148
  }
36149
36149
  } else if (sonic.mkdir) {
36150
- fs4.mkdir(path5.dirname(file2), { recursive: true }, (err) => {
36150
+ fs2.mkdir(path3.dirname(file2), { recursive: true }, (err) => {
36151
36151
  if (err)
36152
36152
  return fileOpened(err);
36153
- fs4.open(file2, flags, mode, fileOpened);
36153
+ fs2.open(file2, flags, mode, fileOpened);
36154
36154
  });
36155
36155
  } else {
36156
- fs4.open(file2, flags, mode, fileOpened);
36156
+ fs2.open(file2, flags, mode, fileOpened);
36157
36157
  }
36158
36158
  }
36159
36159
  function SonicBoom(opts) {
@@ -36194,16 +36194,16 @@ var require_sonic_boom = __commonJS((exports, module) => {
36194
36194
  this.flush = flushBuffer;
36195
36195
  this.flushSync = flushBufferSync;
36196
36196
  this._actualWrite = actualWriteBuffer;
36197
- fsWriteSync = () => fs4.writeSync(this.fd, this._writingBuf);
36198
- fsWrite = () => fs4.write(this.fd, this._writingBuf, this.release);
36197
+ fsWriteSync = () => fs2.writeSync(this.fd, this._writingBuf);
36198
+ fsWrite = () => fs2.write(this.fd, this._writingBuf, this.release);
36199
36199
  } else if (contentMode === undefined || contentMode === kContentModeUtf8) {
36200
36200
  this._writingBuf = "";
36201
36201
  this.write = write;
36202
36202
  this.flush = flush;
36203
36203
  this.flushSync = flushSync;
36204
36204
  this._actualWrite = actualWrite;
36205
- fsWriteSync = () => fs4.writeSync(this.fd, this._writingBuf, "utf8");
36206
- fsWrite = () => fs4.write(this.fd, this._writingBuf, "utf8", this.release);
36205
+ fsWriteSync = () => fs2.writeSync(this.fd, this._writingBuf, "utf8");
36206
+ fsWrite = () => fs2.write(this.fd, this._writingBuf, "utf8", this.release);
36207
36207
  } else {
36208
36208
  throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
36209
36209
  }
@@ -36259,7 +36259,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36259
36259
  }
36260
36260
  }
36261
36261
  if (this._fsync) {
36262
- fs4.fsyncSync(this.fd);
36262
+ fs2.fsyncSync(this.fd);
36263
36263
  }
36264
36264
  const len = this._len;
36265
36265
  if (this._reopening) {
@@ -36372,7 +36372,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36372
36372
  const onDrain = () => {
36373
36373
  if (!this._fsync) {
36374
36374
  try {
36375
- fs4.fsync(this.fd, (err) => {
36375
+ fs2.fsync(this.fd, (err) => {
36376
36376
  this._flushPending = false;
36377
36377
  cb(err);
36378
36378
  });
@@ -36474,7 +36474,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36474
36474
  const fd = this.fd;
36475
36475
  this.once("ready", () => {
36476
36476
  if (fd !== this.fd) {
36477
- fs4.close(fd, (err) => {
36477
+ fs2.close(fd, (err) => {
36478
36478
  if (err) {
36479
36479
  return this.emit("error", err);
36480
36480
  }
@@ -36523,7 +36523,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36523
36523
  buf = this._bufs[0];
36524
36524
  }
36525
36525
  try {
36526
- const n = fs4.writeSync(this.fd, buf, "utf8");
36526
+ const n = fs2.writeSync(this.fd, buf, "utf8");
36527
36527
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
36528
36528
  buf = releasedBufObj.writingBuf;
36529
36529
  this._len = releasedBufObj.len;
@@ -36539,7 +36539,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36539
36539
  }
36540
36540
  }
36541
36541
  try {
36542
- fs4.fsyncSync(this.fd);
36542
+ fs2.fsyncSync(this.fd);
36543
36543
  } catch {}
36544
36544
  }
36545
36545
  function flushBufferSync() {
@@ -36559,7 +36559,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36559
36559
  buf = mergeBuf(this._bufs[0], this._lens[0]);
36560
36560
  }
36561
36561
  try {
36562
- const n = fs4.writeSync(this.fd, buf);
36562
+ const n = fs2.writeSync(this.fd, buf);
36563
36563
  buf = buf.subarray(n);
36564
36564
  this._len = Math.max(this._len - n, 0);
36565
36565
  if (buf.length <= 0) {
@@ -36587,13 +36587,13 @@ var require_sonic_boom = __commonJS((exports, module) => {
36587
36587
  this._writingBuf = this._writingBuf || this._bufs.shift() || "";
36588
36588
  if (this.sync) {
36589
36589
  try {
36590
- const written = fs4.writeSync(this.fd, this._writingBuf, "utf8");
36590
+ const written = fs2.writeSync(this.fd, this._writingBuf, "utf8");
36591
36591
  release(null, written);
36592
36592
  } catch (err) {
36593
36593
  release(err);
36594
36594
  }
36595
36595
  } else {
36596
- fs4.write(this.fd, this._writingBuf, "utf8", release);
36596
+ fs2.write(this.fd, this._writingBuf, "utf8", release);
36597
36597
  }
36598
36598
  }
36599
36599
  function actualWriteBuffer() {
@@ -36602,7 +36602,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36602
36602
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
36603
36603
  if (this.sync) {
36604
36604
  try {
36605
- const written = fs4.writeSync(this.fd, this._writingBuf);
36605
+ const written = fs2.writeSync(this.fd, this._writingBuf);
36606
36606
  release(null, written);
36607
36607
  } catch (err) {
36608
36608
  release(err);
@@ -36611,7 +36611,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
36611
36611
  if (kCopyBuffer) {
36612
36612
  this._writingBuf = Buffer.from(this._writingBuf);
36613
36613
  }
36614
- fs4.write(this.fd, this._writingBuf, release);
36614
+ fs2.write(this.fd, this._writingBuf, release);
36615
36615
  }
36616
36616
  }
36617
36617
  function actualClose(sonic) {
@@ -36627,11 +36627,11 @@ var require_sonic_boom = __commonJS((exports, module) => {
36627
36627
  sonic._lens = [];
36628
36628
  assert2(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
36629
36629
  try {
36630
- fs4.fsync(sonic.fd, closeWrapped);
36630
+ fs2.fsync(sonic.fd, closeWrapped);
36631
36631
  } catch {}
36632
36632
  function closeWrapped() {
36633
36633
  if (sonic.fd !== 1 && sonic.fd !== 2) {
36634
- fs4.close(sonic.fd, done7);
36634
+ fs2.close(sonic.fd, done7);
36635
36635
  } else {
36636
36636
  done7();
36637
36637
  }
@@ -36877,7 +36877,7 @@ var require_thread_stream = __commonJS((exports, module) => {
36877
36877
  var { version: version2 } = require_package();
36878
36878
  var { EventEmitter } = __require("events");
36879
36879
  var { Worker } = __require("worker_threads");
36880
- var { join: join12 } = __require("path");
36880
+ var { join: join11 } = __require("path");
36881
36881
  var { pathToFileURL } = __require("url");
36882
36882
  var { wait } = require_wait();
36883
36883
  var {
@@ -36913,7 +36913,7 @@ var require_thread_stream = __commonJS((exports, module) => {
36913
36913
  function createWorker(stream, opts) {
36914
36914
  const { filename, workerData } = opts;
36915
36915
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
36916
- const toExecute = bundlerOverrides["thread-stream-worker"] || join12(__dirname, "lib", "worker.js");
36916
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join11(__dirname, "lib", "worker.js");
36917
36917
  const worker = new Worker(toExecute, {
36918
36918
  ...opts.workerOpts,
36919
36919
  trackUnmanagedFds: false,
@@ -37297,7 +37297,7 @@ var require_transport = __commonJS((exports, module) => {
37297
37297
  var __dirname = "/home/runner/work/swarm-tools/swarm-tools/node_modules/.bun/pino@9.14.0/node_modules/pino/lib";
37298
37298
  var { createRequire: createRequire2 } = __require("module");
37299
37299
  var getCallers = require_caller();
37300
- var { join: join12, isAbsolute: isAbsolute2, sep: sep3 } = __require("node:path");
37300
+ var { join: join11, isAbsolute: isAbsolute2, sep: sep3 } = __require("node:path");
37301
37301
  var sleep5 = require_atomic_sleep();
37302
37302
  var onExit4 = require_on_exit_leak_free();
37303
37303
  var ThreadStream = require_thread_stream();
@@ -37360,7 +37360,7 @@ var require_transport = __commonJS((exports, module) => {
37360
37360
  throw new Error("only one of target or targets can be specified");
37361
37361
  }
37362
37362
  if (targets) {
37363
- target = bundlerOverrides["pino-worker"] || join12(__dirname, "worker.js");
37363
+ target = bundlerOverrides["pino-worker"] || join11(__dirname, "worker.js");
37364
37364
  options2.targets = targets.filter((dest) => dest.target).map((dest) => {
37365
37365
  return {
37366
37366
  ...dest,
@@ -37377,7 +37377,7 @@ var require_transport = __commonJS((exports, module) => {
37377
37377
  });
37378
37378
  });
37379
37379
  } else if (pipeline) {
37380
- target = bundlerOverrides["pino-worker"] || join12(__dirname, "worker.js");
37380
+ target = bundlerOverrides["pino-worker"] || join11(__dirname, "worker.js");
37381
37381
  options2.pipelines = [pipeline.map((dest) => {
37382
37382
  return {
37383
37383
  ...dest,
@@ -37399,7 +37399,7 @@ var require_transport = __commonJS((exports, module) => {
37399
37399
  return origin;
37400
37400
  }
37401
37401
  if (origin === "pino/file") {
37402
- return join12(__dirname, "..", "file.js");
37402
+ return join11(__dirname, "..", "file.js");
37403
37403
  }
37404
37404
  let fixTarget2;
37405
37405
  for (const filePath of callers) {
@@ -38337,7 +38337,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
38337
38337
  return circularValue;
38338
38338
  }
38339
38339
  let res = "";
38340
- let join12 = ",";
38340
+ let join11 = ",";
38341
38341
  const originalIndentation = indentation;
38342
38342
  if (Array.isArray(value)) {
38343
38343
  if (value.length === 0) {
@@ -38351,7 +38351,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
38351
38351
  indentation += spacer;
38352
38352
  res += `
38353
38353
  ${indentation}`;
38354
- join12 = `,
38354
+ join11 = `,
38355
38355
  ${indentation}`;
38356
38356
  }
38357
38357
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -38359,13 +38359,13 @@ ${indentation}`;
38359
38359
  for (;i < maximumValuesToStringify - 1; i++) {
38360
38360
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
38361
38361
  res += tmp2 !== undefined ? tmp2 : "null";
38362
- res += join12;
38362
+ res += join11;
38363
38363
  }
38364
38364
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
38365
38365
  res += tmp !== undefined ? tmp : "null";
38366
38366
  if (value.length - 1 > maximumBreadth) {
38367
38367
  const removedKeys = value.length - maximumBreadth - 1;
38368
- res += `${join12}"... ${getItemCount(removedKeys)} not stringified"`;
38368
+ res += `${join11}"... ${getItemCount(removedKeys)} not stringified"`;
38369
38369
  }
38370
38370
  if (spacer !== "") {
38371
38371
  res += `
@@ -38386,7 +38386,7 @@ ${originalIndentation}`;
38386
38386
  let separator = "";
38387
38387
  if (spacer !== "") {
38388
38388
  indentation += spacer;
38389
- join12 = `,
38389
+ join11 = `,
38390
38390
  ${indentation}`;
38391
38391
  whitespace = " ";
38392
38392
  }
@@ -38400,13 +38400,13 @@ ${indentation}`;
38400
38400
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
38401
38401
  if (tmp !== undefined) {
38402
38402
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
38403
- separator = join12;
38403
+ separator = join11;
38404
38404
  }
38405
38405
  }
38406
38406
  if (keyLength > maximumBreadth) {
38407
38407
  const removedKeys = keyLength - maximumBreadth;
38408
38408
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
38409
- separator = join12;
38409
+ separator = join11;
38410
38410
  }
38411
38411
  if (spacer !== "" && separator.length > 1) {
38412
38412
  res = `
@@ -38446,7 +38446,7 @@ ${originalIndentation}`;
38446
38446
  }
38447
38447
  const originalIndentation = indentation;
38448
38448
  let res = "";
38449
- let join12 = ",";
38449
+ let join11 = ",";
38450
38450
  if (Array.isArray(value)) {
38451
38451
  if (value.length === 0) {
38452
38452
  return "[]";
@@ -38459,7 +38459,7 @@ ${originalIndentation}`;
38459
38459
  indentation += spacer;
38460
38460
  res += `
38461
38461
  ${indentation}`;
38462
- join12 = `,
38462
+ join11 = `,
38463
38463
  ${indentation}`;
38464
38464
  }
38465
38465
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -38467,13 +38467,13 @@ ${indentation}`;
38467
38467
  for (;i < maximumValuesToStringify - 1; i++) {
38468
38468
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
38469
38469
  res += tmp2 !== undefined ? tmp2 : "null";
38470
- res += join12;
38470
+ res += join11;
38471
38471
  }
38472
38472
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
38473
38473
  res += tmp !== undefined ? tmp : "null";
38474
38474
  if (value.length - 1 > maximumBreadth) {
38475
38475
  const removedKeys = value.length - maximumBreadth - 1;
38476
- res += `${join12}"... ${getItemCount(removedKeys)} not stringified"`;
38476
+ res += `${join11}"... ${getItemCount(removedKeys)} not stringified"`;
38477
38477
  }
38478
38478
  if (spacer !== "") {
38479
38479
  res += `
@@ -38486,7 +38486,7 @@ ${originalIndentation}`;
38486
38486
  let whitespace = "";
38487
38487
  if (spacer !== "") {
38488
38488
  indentation += spacer;
38489
- join12 = `,
38489
+ join11 = `,
38490
38490
  ${indentation}`;
38491
38491
  whitespace = " ";
38492
38492
  }
@@ -38495,7 +38495,7 @@ ${indentation}`;
38495
38495
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
38496
38496
  if (tmp !== undefined) {
38497
38497
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
38498
- separator = join12;
38498
+ separator = join11;
38499
38499
  }
38500
38500
  }
38501
38501
  if (spacer !== "" && separator.length > 1) {
@@ -38552,20 +38552,20 @@ ${originalIndentation}`;
38552
38552
  indentation += spacer;
38553
38553
  let res2 = `
38554
38554
  ${indentation}`;
38555
- const join13 = `,
38555
+ const join12 = `,
38556
38556
  ${indentation}`;
38557
38557
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
38558
38558
  let i = 0;
38559
38559
  for (;i < maximumValuesToStringify - 1; i++) {
38560
38560
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
38561
38561
  res2 += tmp2 !== undefined ? tmp2 : "null";
38562
- res2 += join13;
38562
+ res2 += join12;
38563
38563
  }
38564
38564
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
38565
38565
  res2 += tmp !== undefined ? tmp : "null";
38566
38566
  if (value.length - 1 > maximumBreadth) {
38567
38567
  const removedKeys = value.length - maximumBreadth - 1;
38568
- res2 += `${join13}"... ${getItemCount(removedKeys)} not stringified"`;
38568
+ res2 += `${join12}"... ${getItemCount(removedKeys)} not stringified"`;
38569
38569
  }
38570
38570
  res2 += `
38571
38571
  ${originalIndentation}`;
@@ -38581,16 +38581,16 @@ ${originalIndentation}`;
38581
38581
  return '"[Object]"';
38582
38582
  }
38583
38583
  indentation += spacer;
38584
- const join12 = `,
38584
+ const join11 = `,
38585
38585
  ${indentation}`;
38586
38586
  let res = "";
38587
38587
  let separator = "";
38588
38588
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
38589
38589
  if (isTypedArrayWithEntries(value)) {
38590
- res += stringifyTypedArray(value, join12, maximumBreadth);
38590
+ res += stringifyTypedArray(value, join11, maximumBreadth);
38591
38591
  keys3 = keys3.slice(value.length);
38592
38592
  maximumPropertiesToStringify -= value.length;
38593
- separator = join12;
38593
+ separator = join11;
38594
38594
  }
38595
38595
  if (deterministic) {
38596
38596
  keys3 = sort2(keys3, comparator);
@@ -38601,13 +38601,13 @@ ${indentation}`;
38601
38601
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
38602
38602
  if (tmp !== undefined) {
38603
38603
  res += `${separator}${strEscape(key2)}: ${tmp}`;
38604
- separator = join12;
38604
+ separator = join11;
38605
38605
  }
38606
38606
  }
38607
38607
  if (keyLength > maximumBreadth) {
38608
38608
  const removedKeys = keyLength - maximumBreadth;
38609
38609
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
38610
- separator = join12;
38610
+ separator = join11;
38611
38611
  }
38612
38612
  if (separator !== "") {
38613
38613
  res = `
@@ -64724,411 +64724,6 @@ var observabilityTools = {
64724
64724
  swarm_insights
64725
64725
  };
64726
64726
 
64727
- // src/eval-runner.ts
64728
- init_dist();
64729
- import { runEvalite } from "evalite/runner";
64730
- import { createInMemoryStorage } from "evalite/in-memory-storage";
64731
- import fs3 from "node:fs/promises";
64732
- import path4 from "node:path";
64733
-
64734
- // src/eval-history.ts
64735
- import * as fs2 from "node:fs";
64736
- import * as path3 from "node:path";
64737
- var DEFAULT_EVAL_HISTORY_PATH = ".opencode/eval-history.jsonl";
64738
- var VARIANCE_THRESHOLD = 0.1;
64739
- var BOOTSTRAP_THRESHOLD = 10;
64740
- var STABILIZATION_THRESHOLD = 50;
64741
- function getEvalHistoryPath(projectPath) {
64742
- return path3.join(projectPath, DEFAULT_EVAL_HISTORY_PATH);
64743
- }
64744
- function ensureEvalHistoryDir(projectPath) {
64745
- const historyPath = getEvalHistoryPath(projectPath);
64746
- const dir = path3.dirname(historyPath);
64747
- if (!fs2.existsSync(dir)) {
64748
- fs2.mkdirSync(dir, { recursive: true });
64749
- }
64750
- }
64751
- function recordEvalRun(projectPath, run) {
64752
- ensureEvalHistoryDir(projectPath);
64753
- const historyPath = getEvalHistoryPath(projectPath);
64754
- const line = `${JSON.stringify(run)}
64755
- `;
64756
- fs2.appendFileSync(historyPath, line, "utf-8");
64757
- }
64758
- function readAllRecords(projectPath) {
64759
- const historyPath = getEvalHistoryPath(projectPath);
64760
- if (!fs2.existsSync(historyPath)) {
64761
- return [];
64762
- }
64763
- const content = fs2.readFileSync(historyPath, "utf-8");
64764
- const lines = content.trim().split(`
64765
- `).filter(Boolean);
64766
- return lines.map((line) => JSON.parse(line));
64767
- }
64768
- function getScoreHistory(projectPath, evalName) {
64769
- return readAllRecords(projectPath).filter((run) => run.eval_name === evalName);
64770
- }
64771
- function calculateVariance(scores) {
64772
- if (scores.length <= 1) {
64773
- return 0;
64774
- }
64775
- const mean = scores.reduce((sum2, score) => sum2 + score, 0) / scores.length;
64776
- const variance5 = scores.reduce((sum2, score) => {
64777
- const deviation = score - mean;
64778
- return sum2 + deviation * deviation;
64779
- }, 0) / scores.length;
64780
- return variance5;
64781
- }
64782
- function getPhase(projectPath, evalName) {
64783
- const history = getScoreHistory(projectPath, evalName);
64784
- if (history.length < BOOTSTRAP_THRESHOLD) {
64785
- return "bootstrap";
64786
- }
64787
- if (history.length <= STABILIZATION_THRESHOLD) {
64788
- return "stabilization";
64789
- }
64790
- const scores = history.map((run) => run.score);
64791
- const variance5 = calculateVariance(scores);
64792
- if (variance5 < VARIANCE_THRESHOLD) {
64793
- return "production";
64794
- }
64795
- return "stabilization";
64796
- }
64797
-
64798
- // src/eval-gates.ts
64799
- var DEFAULT_THRESHOLDS = {
64800
- stabilization: 0.1,
64801
- production: 0.05
64802
- };
64803
- function calculateBaseline(history, currentScore) {
64804
- if (history.length === 0) {
64805
- return currentScore;
64806
- }
64807
- return history.reduce((sum2, run) => sum2 + run.score, 0) / history.length;
64808
- }
64809
- function calculateRegression(baseline, currentScore) {
64810
- if (baseline === 0) {
64811
- return 0;
64812
- }
64813
- return (baseline - currentScore) / baseline;
64814
- }
64815
- function formatRegressionMessage(regressionPercent, baseline, currentScore) {
64816
- return `${(regressionPercent * 100).toFixed(1)}% regression (baseline: ${baseline.toFixed(2)}, current: ${currentScore.toFixed(2)})`;
64817
- }
64818
- function checkGate(projectPath, evalName, currentScore, config2) {
64819
- const thresholds = {
64820
- stabilization: config2?.stabilizationThreshold ?? DEFAULT_THRESHOLDS.stabilization,
64821
- production: config2?.productionThreshold ?? DEFAULT_THRESHOLDS.production
64822
- };
64823
- const phase = getPhase(projectPath, evalName);
64824
- const history = getScoreHistory(projectPath, evalName);
64825
- if (phase === "bootstrap") {
64826
- return {
64827
- passed: true,
64828
- phase: "bootstrap",
64829
- message: `Bootstrap phase (${history.length}/10 runs) - collecting data`,
64830
- currentScore
64831
- };
64832
- }
64833
- const baseline = calculateBaseline(history, currentScore);
64834
- const regressionPercent = calculateRegression(baseline, currentScore);
64835
- const regressionMsg = formatRegressionMessage(regressionPercent, baseline, currentScore);
64836
- if (phase === "stabilization") {
64837
- if (regressionPercent > thresholds.stabilization) {
64838
- return {
64839
- passed: true,
64840
- phase: "stabilization",
64841
- message: `Stabilization phase: ${regressionMsg} - exceeds ${(thresholds.stabilization * 100).toFixed(0)}% threshold but still passing`,
64842
- baseline,
64843
- currentScore,
64844
- regressionPercent
64845
- };
64846
- }
64847
- if (history.length > 50) {
64848
- const scores = history.map((run) => run.score);
64849
- const variance5 = calculateVariance(scores);
64850
- return {
64851
- passed: true,
64852
- phase: "stabilization",
64853
- message: `Stabilization phase: ${regressionMsg} - acceptable. High variance (${variance5.toFixed(3)}) prevents production phase.`,
64854
- baseline,
64855
- currentScore,
64856
- regressionPercent
64857
- };
64858
- }
64859
- return {
64860
- passed: true,
64861
- phase: "stabilization",
64862
- message: `Stabilization phase: ${regressionMsg} - acceptable`,
64863
- baseline,
64864
- currentScore,
64865
- regressionPercent
64866
- };
64867
- }
64868
- if (regressionPercent > thresholds.production) {
64869
- return {
64870
- passed: false,
64871
- phase: "production",
64872
- message: `Production phase FAIL: ${regressionMsg} - exceeds ${(thresholds.production * 100).toFixed(0)}% threshold`,
64873
- baseline,
64874
- currentScore,
64875
- regressionPercent
64876
- };
64877
- }
64878
- return {
64879
- passed: true,
64880
- phase: "production",
64881
- message: `Production phase: ${regressionMsg} - acceptable`,
64882
- baseline,
64883
- currentScore,
64884
- regressionPercent
64885
- };
64886
- }
64887
-
64888
- // src/eval-learning.ts
64889
- var DEFAULT_EVAL_LEARNING_CONFIG = {
64890
- dropThreshold: 0.15,
64891
- windowSize: 5
64892
- };
64893
- function calculateRollingAverage(history, windowSize = 5) {
64894
- if (history.length === 0) {
64895
- return 0;
64896
- }
64897
- const recentRuns = history.slice(-windowSize);
64898
- const sum2 = recentRuns.reduce((acc, run) => acc + run.score, 0);
64899
- return sum2 / recentRuns.length;
64900
- }
64901
- function isSignificantDrop(currentScore, baseline, threshold = 0.15) {
64902
- if (baseline === 0) {
64903
- return false;
64904
- }
64905
- const drop3 = (baseline - currentScore) / baseline;
64906
- return drop3 >= threshold;
64907
- }
64908
- function formatFailureContext(evalName, currentScore, baseline, scorerContext) {
64909
- const dropPercentage = baseline > 0 ? (baseline - currentScore) / baseline * 100 : 0;
64910
- const lines = [
64911
- `Eval "${evalName}" regression detected:`,
64912
- `- Current score: ${currentScore.toFixed(2)}`,
64913
- `- Baseline (rolling avg): ${baseline.toFixed(2)}`,
64914
- `- Drop: ${dropPercentage.toFixed(1)}%`
64915
- ];
64916
- if (scorerContext) {
64917
- lines.push("", "Scorer context:", scorerContext);
64918
- }
64919
- lines.push("", "Action: Review recent changes that may have caused regression.", "Query this memory when generating future prompts for this eval.");
64920
- return lines.join(`
64921
- `);
64922
- }
64923
- async function learnFromEvalFailure(evalName, currentScore, history, memoryAdapter, options2) {
64924
- const config2 = options2?.config ?? DEFAULT_EVAL_LEARNING_CONFIG;
64925
- const baseline = calculateRollingAverage(history, config2.windowSize);
64926
- const dropPercentage = baseline > 0 ? (baseline - currentScore) / baseline : 0;
64927
- const significant = isSignificantDrop(currentScore, baseline, config2.dropThreshold);
64928
- const result = {
64929
- triggered: significant,
64930
- baseline,
64931
- current: currentScore,
64932
- drop_percentage: dropPercentage
64933
- };
64934
- if (significant) {
64935
- const information = formatFailureContext(evalName, currentScore, baseline, options2?.scorerContext);
64936
- const tags = ["eval-failure", evalName, "regression"].join(",");
64937
- const metadata = JSON.stringify({
64938
- eval_name: evalName,
64939
- baseline_score: baseline,
64940
- current_score: currentScore,
64941
- drop_percentage: dropPercentage,
64942
- timestamp: new Date().toISOString()
64943
- });
64944
- const storeResult = await memoryAdapter.store({
64945
- information,
64946
- tags,
64947
- metadata
64948
- });
64949
- if (storeResult.id) {
64950
- result.memory_id = storeResult.id;
64951
- }
64952
- }
64953
- return result;
64954
- }
64955
-
64956
- // src/eval-runner.ts
64957
- async function runEvals(options2 = {}) {
64958
- const {
64959
- cwd = process.cwd(),
64960
- suiteFilter,
64961
- scoreThreshold,
64962
- outputPath: userOutputPath
64963
- } = options2;
64964
- try {
64965
- const projectRoot = cwd.endsWith("src") ? path4.dirname(cwd) : cwd;
64966
- const evalsDir = path4.join(projectRoot, "evals");
64967
- let evalPath;
64968
- if (suiteFilter) {
64969
- try {
64970
- const files = await fs3.readdir(evalsDir);
64971
- const matchingFiles = files.filter((f) => f.toLowerCase().includes(suiteFilter.toLowerCase()));
64972
- if (matchingFiles.length === 0) {
64973
- return {
64974
- success: true,
64975
- totalSuites: 0,
64976
- totalEvals: 0,
64977
- averageScore: 0,
64978
- suites: []
64979
- };
64980
- }
64981
- evalPath = path4.join(evalsDir, matchingFiles[0]);
64982
- } catch (err) {
64983
- return {
64984
- success: false,
64985
- totalSuites: 0,
64986
- totalEvals: 0,
64987
- averageScore: 0,
64988
- suites: [],
64989
- error: `Failed to read evals directory: ${err instanceof Error ? err.message : String(err)}`
64990
- };
64991
- }
64992
- } else {
64993
- evalPath = evalsDir;
64994
- }
64995
- const outputPath = userOutputPath || path4.join(projectRoot, `.evalite-results-${Date.now()}.json`);
64996
- const isTemporaryOutput = !userOutputPath;
64997
- const storage = createInMemoryStorage();
64998
- await runEvalite({
64999
- path: evalPath,
65000
- cwd: projectRoot,
65001
- mode: "run-once-and-exit",
65002
- scoreThreshold,
65003
- outputPath,
65004
- hideTable: true,
65005
- storage,
65006
- disableServer: true
65007
- });
65008
- let outputJson;
65009
- try {
65010
- outputJson = await fs3.readFile(outputPath, "utf-8");
65011
- } catch (err) {
65012
- return {
65013
- success: false,
65014
- totalSuites: 0,
65015
- totalEvals: 0,
65016
- averageScore: 0,
65017
- suites: [],
65018
- error: `No results file generated: ${err instanceof Error ? err.message : String(err)}`
65019
- };
65020
- }
65021
- const output = JSON.parse(outputJson);
65022
- if (isTemporaryOutput) {
65023
- await fs3.unlink(outputPath).catch(() => {});
65024
- }
65025
- const suites = output.evals.map((evalItem) => ({
65026
- name: evalItem.name,
65027
- filepath: evalItem.filepath,
65028
- status: evalItem.status,
65029
- duration: evalItem.duration,
65030
- averageScore: evalItem.averageScore,
65031
- evalCount: evalItem.results.length,
65032
- evals: evalItem.results.map((r) => ({
65033
- input: r.input,
65034
- output: r.output,
65035
- expected: r.expected,
65036
- scores: r.scores.map((s) => ({
65037
- name: s.name,
65038
- score: s.score,
65039
- description: s.description
65040
- }))
65041
- }))
65042
- }));
65043
- for (const suite of suites) {
65044
- const history = getScoreHistory(projectRoot, suite.name);
65045
- recordEvalRun(projectRoot, {
65046
- timestamp: new Date().toISOString(),
65047
- eval_name: suite.name,
65048
- score: suite.averageScore,
65049
- run_count: history.length + 1
65050
- });
65051
- }
65052
- const gateResults = [];
65053
- for (const suite of suites) {
65054
- const history = getScoreHistory(projectRoot, suite.name);
65055
- const gate = checkGate(projectRoot, suite.name, suite.averageScore);
65056
- gateResults.push({ suite: suite.name, ...gate });
65057
- if (!gate.passed) {
65058
- try {
65059
- const memoryAdapter = await getMemoryAdapter();
65060
- await learnFromEvalFailure(suite.name, suite.averageScore, history, memoryAdapter);
65061
- } catch (e) {
65062
- console.warn(`Failed to store learning for ${suite.name}:`, e);
65063
- }
65064
- }
65065
- }
65066
- const totalEvals = suites.reduce((sum2, s) => sum2 + s.evalCount, 0);
65067
- const averageScore = suites.length > 0 ? suites.reduce((sum2, s) => sum2 + s.averageScore, 0) / suites.length : 0;
65068
- const thresholdPassed = scoreThreshold === undefined || averageScore * 100 >= scoreThreshold;
65069
- return {
65070
- success: thresholdPassed,
65071
- totalSuites: suites.length,
65072
- totalEvals,
65073
- averageScore,
65074
- suites,
65075
- gateResults
65076
- };
65077
- } catch (error45) {
65078
- return {
65079
- success: false,
65080
- totalSuites: 0,
65081
- totalEvals: 0,
65082
- averageScore: 0,
65083
- suites: [],
65084
- error: error45 instanceof Error ? error45.message : String(error45)
65085
- };
65086
- }
65087
- }
65088
- var eval_run = tool({
65089
- description: `Run evalite evals programmatically and get structured results with scores.
65090
-
65091
- Use this to:
65092
- - Run all evals in evals/ directory
65093
- - Filter by specific eval suite (e.g., "coordinator", "compaction")
65094
- - Enforce score thresholds for quality gates
65095
- - Get per-suite and per-eval scores
65096
-
65097
- Returns structured JSON with:
65098
- - success: boolean (true if all tests passed threshold)
65099
- - totalSuites: number of eval suites run
65100
- - totalEvals: number of individual test cases
65101
- - averageScore: 0-1 score across all suites
65102
- - suites: array of suite results with scores
65103
-
65104
- Example usage:
65105
- - Run all evals: eval_run()
65106
- - Run coordinator evals: eval_run({ suiteFilter: "coordinator" })
65107
- - Enforce 80% threshold: eval_run({ scoreThreshold: 80 })`,
65108
- args: {
65109
- suiteFilter: tool.schema.string().optional().describe('Optional filter to run specific eval suite (e.g., "coordinator", "compaction"). Matches against eval file paths using substring matching.'),
65110
- scoreThreshold: tool.schema.number().optional().describe("Optional minimum average score threshold (0-100). If average score falls below this, result.success will be false. Useful for CI quality gates."),
65111
- includeDetailedResults: tool.schema.boolean().optional().describe("Include individual eval results with input/output/scores in response. Set to false (default) for summary only to save token usage.")
65112
- },
65113
- execute: async (args2) => {
65114
- const result = await runEvals({
65115
- cwd: process.cwd(),
65116
- suiteFilter: args2.suiteFilter,
65117
- scoreThreshold: args2.scoreThreshold
65118
- });
65119
- const includeDetails = args2.includeDetailedResults === true;
65120
- if (!includeDetails) {
65121
- for (const suite of result.suites) {
65122
- delete suite.evals;
65123
- }
65124
- }
65125
- return JSON.stringify(result, null, 2);
65126
- }
65127
- });
65128
- var evalTools = {
65129
- eval_run
65130
- };
65131
-
65132
64727
  // src/contributor-tools.ts
65133
64728
  init_dist();
65134
64729
  init_zod();
@@ -65974,13 +65569,13 @@ function getMetricsSummary(metrics) {
65974
65569
 
65975
65570
  // src/logger.ts
65976
65571
  var import_pino = __toESM(require_pino(), 1);
65977
- import { mkdirSync as mkdirSync6, existsSync as existsSync9 } from "node:fs";
65978
- import { join as join12 } from "node:path";
65572
+ import { mkdirSync as mkdirSync5, existsSync as existsSync8 } from "node:fs";
65573
+ import { join as join11 } from "node:path";
65979
65574
  import { homedir as homedir3 } from "node:os";
65980
- var DEFAULT_LOG_DIR = join12(homedir3(), ".config", "swarm-tools", "logs");
65575
+ var DEFAULT_LOG_DIR = join11(homedir3(), ".config", "swarm-tools", "logs");
65981
65576
  function ensureLogDir(logDir) {
65982
- if (!existsSync9(logDir)) {
65983
- mkdirSync6(logDir, { recursive: true });
65577
+ if (!existsSync8(logDir)) {
65578
+ mkdirSync5(logDir, { recursive: true });
65984
65579
  }
65985
65580
  }
65986
65581
  function createTransport(filename, logDir) {
@@ -65998,7 +65593,7 @@ function createTransport(filename, logDir) {
65998
65593
  return {
65999
65594
  target: "pino-roll",
66000
65595
  options: {
66001
- file: join12(logDir, filename),
65596
+ file: join11(logDir, filename),
66002
65597
  frequency: "daily",
66003
65598
  extension: "log",
66004
65599
  limit: { count: 14 },
@@ -67272,6 +66867,161 @@ async function resetStorage() {
67272
66867
 
67273
66868
  // src/index.ts
67274
66869
  init_skills();
66870
+
66871
+ // src/eval-history.ts
66872
+ import * as fs2 from "node:fs";
66873
+ import * as path3 from "node:path";
66874
+ var DEFAULT_EVAL_HISTORY_PATH = ".opencode/eval-history.jsonl";
66875
+ var VARIANCE_THRESHOLD = 0.1;
66876
+ var BOOTSTRAP_THRESHOLD = 10;
66877
+ var STABILIZATION_THRESHOLD = 50;
66878
+ function getEvalHistoryPath(projectPath) {
66879
+ return path3.join(projectPath, DEFAULT_EVAL_HISTORY_PATH);
66880
+ }
66881
+ function ensureEvalHistoryDir(projectPath) {
66882
+ const historyPath = getEvalHistoryPath(projectPath);
66883
+ const dir = path3.dirname(historyPath);
66884
+ if (!fs2.existsSync(dir)) {
66885
+ fs2.mkdirSync(dir, { recursive: true });
66886
+ }
66887
+ }
66888
+ function recordEvalRun(projectPath, run) {
66889
+ ensureEvalHistoryDir(projectPath);
66890
+ const historyPath = getEvalHistoryPath(projectPath);
66891
+ const line = `${JSON.stringify(run)}
66892
+ `;
66893
+ fs2.appendFileSync(historyPath, line, "utf-8");
66894
+ }
66895
+ function readAllRecords(projectPath) {
66896
+ const historyPath = getEvalHistoryPath(projectPath);
66897
+ if (!fs2.existsSync(historyPath)) {
66898
+ return [];
66899
+ }
66900
+ const content = fs2.readFileSync(historyPath, "utf-8");
66901
+ const lines = content.trim().split(`
66902
+ `).filter(Boolean);
66903
+ return lines.map((line) => JSON.parse(line));
66904
+ }
66905
+ function getScoreHistory(projectPath, evalName) {
66906
+ return readAllRecords(projectPath).filter((run) => run.eval_name === evalName);
66907
+ }
66908
+ function calculateVariance(scores) {
66909
+ if (scores.length <= 1) {
66910
+ return 0;
66911
+ }
66912
+ const mean = scores.reduce((sum2, score) => sum2 + score, 0) / scores.length;
66913
+ const variance5 = scores.reduce((sum2, score) => {
66914
+ const deviation = score - mean;
66915
+ return sum2 + deviation * deviation;
66916
+ }, 0) / scores.length;
66917
+ return variance5;
66918
+ }
66919
+ function getPhase(projectPath, evalName) {
66920
+ const history = getScoreHistory(projectPath, evalName);
66921
+ if (history.length < BOOTSTRAP_THRESHOLD) {
66922
+ return "bootstrap";
66923
+ }
66924
+ if (history.length <= STABILIZATION_THRESHOLD) {
66925
+ return "stabilization";
66926
+ }
66927
+ const scores = history.map((run) => run.score);
66928
+ const variance5 = calculateVariance(scores);
66929
+ if (variance5 < VARIANCE_THRESHOLD) {
66930
+ return "production";
66931
+ }
66932
+ return "stabilization";
66933
+ }
66934
+ // src/eval-gates.ts
66935
+ var DEFAULT_THRESHOLDS = {
66936
+ stabilization: 0.1,
66937
+ production: 0.05
66938
+ };
66939
+ function calculateBaseline(history, currentScore) {
66940
+ if (history.length === 0) {
66941
+ return currentScore;
66942
+ }
66943
+ return history.reduce((sum2, run) => sum2 + run.score, 0) / history.length;
66944
+ }
66945
+ function calculateRegression(baseline, currentScore) {
66946
+ if (baseline === 0) {
66947
+ return 0;
66948
+ }
66949
+ return (baseline - currentScore) / baseline;
66950
+ }
66951
+ function formatRegressionMessage(regressionPercent, baseline, currentScore) {
66952
+ return `${(regressionPercent * 100).toFixed(1)}% regression (baseline: ${baseline.toFixed(2)}, current: ${currentScore.toFixed(2)})`;
66953
+ }
66954
+ function checkGate(projectPath, evalName, currentScore, config2) {
66955
+ const thresholds = {
66956
+ stabilization: config2?.stabilizationThreshold ?? DEFAULT_THRESHOLDS.stabilization,
66957
+ production: config2?.productionThreshold ?? DEFAULT_THRESHOLDS.production
66958
+ };
66959
+ const phase = getPhase(projectPath, evalName);
66960
+ const history = getScoreHistory(projectPath, evalName);
66961
+ if (phase === "bootstrap") {
66962
+ return {
66963
+ passed: true,
66964
+ phase: "bootstrap",
66965
+ message: `Bootstrap phase (${history.length}/10 runs) - collecting data`,
66966
+ currentScore
66967
+ };
66968
+ }
66969
+ const baseline = calculateBaseline(history, currentScore);
66970
+ const regressionPercent = calculateRegression(baseline, currentScore);
66971
+ const regressionMsg = formatRegressionMessage(regressionPercent, baseline, currentScore);
66972
+ if (phase === "stabilization") {
66973
+ if (regressionPercent > thresholds.stabilization) {
66974
+ return {
66975
+ passed: true,
66976
+ phase: "stabilization",
66977
+ message: `Stabilization phase: ${regressionMsg} - exceeds ${(thresholds.stabilization * 100).toFixed(0)}% threshold but still passing`,
66978
+ baseline,
66979
+ currentScore,
66980
+ regressionPercent
66981
+ };
66982
+ }
66983
+ if (history.length > 50) {
66984
+ const scores = history.map((run) => run.score);
66985
+ const variance5 = calculateVariance(scores);
66986
+ return {
66987
+ passed: true,
66988
+ phase: "stabilization",
66989
+ message: `Stabilization phase: ${regressionMsg} - acceptable. High variance (${variance5.toFixed(3)}) prevents production phase.`,
66990
+ baseline,
66991
+ currentScore,
66992
+ regressionPercent
66993
+ };
66994
+ }
66995
+ return {
66996
+ passed: true,
66997
+ phase: "stabilization",
66998
+ message: `Stabilization phase: ${regressionMsg} - acceptable`,
66999
+ baseline,
67000
+ currentScore,
67001
+ regressionPercent
67002
+ };
67003
+ }
67004
+ if (regressionPercent > thresholds.production) {
67005
+ return {
67006
+ passed: false,
67007
+ phase: "production",
67008
+ message: `Production phase FAIL: ${regressionMsg} - exceeds ${(thresholds.production * 100).toFixed(0)}% threshold`,
67009
+ baseline,
67010
+ currentScore,
67011
+ regressionPercent
67012
+ };
67013
+ }
67014
+ return {
67015
+ passed: true,
67016
+ phase: "production",
67017
+ message: `Production phase: ${regressionMsg} - acceptable`,
67018
+ baseline,
67019
+ currentScore,
67020
+ regressionPercent
67021
+ };
67022
+ }
67023
+
67024
+ // src/index.ts
67275
67025
  init_swarm_validation();
67276
67026
 
67277
67027
  // src/swarm-signature.ts
@@ -67558,7 +67308,6 @@ var SwarmPlugin = async (input) => {
67558
67308
  ...memoryTools,
67559
67309
  ...observabilityTools,
67560
67310
  ...researchTools,
67561
- ...evalTools,
67562
67311
  ...contributorTools
67563
67312
  },
67564
67313
  event: async ({ event }) => {