opencode-swarm-plugin 0.45.2 → 0.45.3

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/plugin.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 = `
@@ -64273,411 +64273,6 @@ var observabilityTools = {
64273
64273
  swarm_insights
64274
64274
  };
64275
64275
 
64276
- // src/eval-runner.ts
64277
- init_dist();
64278
- import { runEvalite } from "evalite/runner";
64279
- import { createInMemoryStorage } from "evalite/in-memory-storage";
64280
- import fs3 from "node:fs/promises";
64281
- import path4 from "node:path";
64282
-
64283
- // src/eval-history.ts
64284
- import * as fs2 from "node:fs";
64285
- import * as path3 from "node:path";
64286
- var DEFAULT_EVAL_HISTORY_PATH = ".opencode/eval-history.jsonl";
64287
- var VARIANCE_THRESHOLD = 0.1;
64288
- var BOOTSTRAP_THRESHOLD = 10;
64289
- var STABILIZATION_THRESHOLD = 50;
64290
- function getEvalHistoryPath(projectPath) {
64291
- return path3.join(projectPath, DEFAULT_EVAL_HISTORY_PATH);
64292
- }
64293
- function ensureEvalHistoryDir(projectPath) {
64294
- const historyPath = getEvalHistoryPath(projectPath);
64295
- const dir = path3.dirname(historyPath);
64296
- if (!fs2.existsSync(dir)) {
64297
- fs2.mkdirSync(dir, { recursive: true });
64298
- }
64299
- }
64300
- function recordEvalRun(projectPath, run) {
64301
- ensureEvalHistoryDir(projectPath);
64302
- const historyPath = getEvalHistoryPath(projectPath);
64303
- const line = `${JSON.stringify(run)}
64304
- `;
64305
- fs2.appendFileSync(historyPath, line, "utf-8");
64306
- }
64307
- function readAllRecords(projectPath) {
64308
- const historyPath = getEvalHistoryPath(projectPath);
64309
- if (!fs2.existsSync(historyPath)) {
64310
- return [];
64311
- }
64312
- const content = fs2.readFileSync(historyPath, "utf-8");
64313
- const lines = content.trim().split(`
64314
- `).filter(Boolean);
64315
- return lines.map((line) => JSON.parse(line));
64316
- }
64317
- function getScoreHistory(projectPath, evalName) {
64318
- return readAllRecords(projectPath).filter((run) => run.eval_name === evalName);
64319
- }
64320
- function calculateVariance(scores) {
64321
- if (scores.length <= 1) {
64322
- return 0;
64323
- }
64324
- const mean = scores.reduce((sum2, score) => sum2 + score, 0) / scores.length;
64325
- const variance5 = scores.reduce((sum2, score) => {
64326
- const deviation = score - mean;
64327
- return sum2 + deviation * deviation;
64328
- }, 0) / scores.length;
64329
- return variance5;
64330
- }
64331
- function getPhase(projectPath, evalName) {
64332
- const history = getScoreHistory(projectPath, evalName);
64333
- if (history.length < BOOTSTRAP_THRESHOLD) {
64334
- return "bootstrap";
64335
- }
64336
- if (history.length <= STABILIZATION_THRESHOLD) {
64337
- return "stabilization";
64338
- }
64339
- const scores = history.map((run) => run.score);
64340
- const variance5 = calculateVariance(scores);
64341
- if (variance5 < VARIANCE_THRESHOLD) {
64342
- return "production";
64343
- }
64344
- return "stabilization";
64345
- }
64346
-
64347
- // src/eval-gates.ts
64348
- var DEFAULT_THRESHOLDS = {
64349
- stabilization: 0.1,
64350
- production: 0.05
64351
- };
64352
- function calculateBaseline(history, currentScore) {
64353
- if (history.length === 0) {
64354
- return currentScore;
64355
- }
64356
- return history.reduce((sum2, run) => sum2 + run.score, 0) / history.length;
64357
- }
64358
- function calculateRegression(baseline, currentScore) {
64359
- if (baseline === 0) {
64360
- return 0;
64361
- }
64362
- return (baseline - currentScore) / baseline;
64363
- }
64364
- function formatRegressionMessage(regressionPercent, baseline, currentScore) {
64365
- return `${(regressionPercent * 100).toFixed(1)}% regression (baseline: ${baseline.toFixed(2)}, current: ${currentScore.toFixed(2)})`;
64366
- }
64367
- function checkGate(projectPath, evalName, currentScore, config2) {
64368
- const thresholds = {
64369
- stabilization: config2?.stabilizationThreshold ?? DEFAULT_THRESHOLDS.stabilization,
64370
- production: config2?.productionThreshold ?? DEFAULT_THRESHOLDS.production
64371
- };
64372
- const phase = getPhase(projectPath, evalName);
64373
- const history = getScoreHistory(projectPath, evalName);
64374
- if (phase === "bootstrap") {
64375
- return {
64376
- passed: true,
64377
- phase: "bootstrap",
64378
- message: `Bootstrap phase (${history.length}/10 runs) - collecting data`,
64379
- currentScore
64380
- };
64381
- }
64382
- const baseline = calculateBaseline(history, currentScore);
64383
- const regressionPercent = calculateRegression(baseline, currentScore);
64384
- const regressionMsg = formatRegressionMessage(regressionPercent, baseline, currentScore);
64385
- if (phase === "stabilization") {
64386
- if (regressionPercent > thresholds.stabilization) {
64387
- return {
64388
- passed: true,
64389
- phase: "stabilization",
64390
- message: `Stabilization phase: ${regressionMsg} - exceeds ${(thresholds.stabilization * 100).toFixed(0)}% threshold but still passing`,
64391
- baseline,
64392
- currentScore,
64393
- regressionPercent
64394
- };
64395
- }
64396
- if (history.length > 50) {
64397
- const scores = history.map((run) => run.score);
64398
- const variance5 = calculateVariance(scores);
64399
- return {
64400
- passed: true,
64401
- phase: "stabilization",
64402
- message: `Stabilization phase: ${regressionMsg} - acceptable. High variance (${variance5.toFixed(3)}) prevents production phase.`,
64403
- baseline,
64404
- currentScore,
64405
- regressionPercent
64406
- };
64407
- }
64408
- return {
64409
- passed: true,
64410
- phase: "stabilization",
64411
- message: `Stabilization phase: ${regressionMsg} - acceptable`,
64412
- baseline,
64413
- currentScore,
64414
- regressionPercent
64415
- };
64416
- }
64417
- if (regressionPercent > thresholds.production) {
64418
- return {
64419
- passed: false,
64420
- phase: "production",
64421
- message: `Production phase FAIL: ${regressionMsg} - exceeds ${(thresholds.production * 100).toFixed(0)}% threshold`,
64422
- baseline,
64423
- currentScore,
64424
- regressionPercent
64425
- };
64426
- }
64427
- return {
64428
- passed: true,
64429
- phase: "production",
64430
- message: `Production phase: ${regressionMsg} - acceptable`,
64431
- baseline,
64432
- currentScore,
64433
- regressionPercent
64434
- };
64435
- }
64436
-
64437
- // src/eval-learning.ts
64438
- var DEFAULT_EVAL_LEARNING_CONFIG = {
64439
- dropThreshold: 0.15,
64440
- windowSize: 5
64441
- };
64442
- function calculateRollingAverage(history, windowSize = 5) {
64443
- if (history.length === 0) {
64444
- return 0;
64445
- }
64446
- const recentRuns = history.slice(-windowSize);
64447
- const sum2 = recentRuns.reduce((acc, run) => acc + run.score, 0);
64448
- return sum2 / recentRuns.length;
64449
- }
64450
- function isSignificantDrop(currentScore, baseline, threshold = 0.15) {
64451
- if (baseline === 0) {
64452
- return false;
64453
- }
64454
- const drop3 = (baseline - currentScore) / baseline;
64455
- return drop3 >= threshold;
64456
- }
64457
- function formatFailureContext(evalName, currentScore, baseline, scorerContext) {
64458
- const dropPercentage = baseline > 0 ? (baseline - currentScore) / baseline * 100 : 0;
64459
- const lines = [
64460
- `Eval "${evalName}" regression detected:`,
64461
- `- Current score: ${currentScore.toFixed(2)}`,
64462
- `- Baseline (rolling avg): ${baseline.toFixed(2)}`,
64463
- `- Drop: ${dropPercentage.toFixed(1)}%`
64464
- ];
64465
- if (scorerContext) {
64466
- lines.push("", "Scorer context:", scorerContext);
64467
- }
64468
- lines.push("", "Action: Review recent changes that may have caused regression.", "Query this memory when generating future prompts for this eval.");
64469
- return lines.join(`
64470
- `);
64471
- }
64472
- async function learnFromEvalFailure(evalName, currentScore, history, memoryAdapter, options2) {
64473
- const config2 = options2?.config ?? DEFAULT_EVAL_LEARNING_CONFIG;
64474
- const baseline = calculateRollingAverage(history, config2.windowSize);
64475
- const dropPercentage = baseline > 0 ? (baseline - currentScore) / baseline : 0;
64476
- const significant = isSignificantDrop(currentScore, baseline, config2.dropThreshold);
64477
- const result = {
64478
- triggered: significant,
64479
- baseline,
64480
- current: currentScore,
64481
- drop_percentage: dropPercentage
64482
- };
64483
- if (significant) {
64484
- const information = formatFailureContext(evalName, currentScore, baseline, options2?.scorerContext);
64485
- const tags = ["eval-failure", evalName, "regression"].join(",");
64486
- const metadata = JSON.stringify({
64487
- eval_name: evalName,
64488
- baseline_score: baseline,
64489
- current_score: currentScore,
64490
- drop_percentage: dropPercentage,
64491
- timestamp: new Date().toISOString()
64492
- });
64493
- const storeResult = await memoryAdapter.store({
64494
- information,
64495
- tags,
64496
- metadata
64497
- });
64498
- if (storeResult.id) {
64499
- result.memory_id = storeResult.id;
64500
- }
64501
- }
64502
- return result;
64503
- }
64504
-
64505
- // src/eval-runner.ts
64506
- async function runEvals(options2 = {}) {
64507
- const {
64508
- cwd = process.cwd(),
64509
- suiteFilter,
64510
- scoreThreshold,
64511
- outputPath: userOutputPath
64512
- } = options2;
64513
- try {
64514
- const projectRoot = cwd.endsWith("src") ? path4.dirname(cwd) : cwd;
64515
- const evalsDir = path4.join(projectRoot, "evals");
64516
- let evalPath;
64517
- if (suiteFilter) {
64518
- try {
64519
- const files = await fs3.readdir(evalsDir);
64520
- const matchingFiles = files.filter((f) => f.toLowerCase().includes(suiteFilter.toLowerCase()));
64521
- if (matchingFiles.length === 0) {
64522
- return {
64523
- success: true,
64524
- totalSuites: 0,
64525
- totalEvals: 0,
64526
- averageScore: 0,
64527
- suites: []
64528
- };
64529
- }
64530
- evalPath = path4.join(evalsDir, matchingFiles[0]);
64531
- } catch (err) {
64532
- return {
64533
- success: false,
64534
- totalSuites: 0,
64535
- totalEvals: 0,
64536
- averageScore: 0,
64537
- suites: [],
64538
- error: `Failed to read evals directory: ${err instanceof Error ? err.message : String(err)}`
64539
- };
64540
- }
64541
- } else {
64542
- evalPath = evalsDir;
64543
- }
64544
- const outputPath = userOutputPath || path4.join(projectRoot, `.evalite-results-${Date.now()}.json`);
64545
- const isTemporaryOutput = !userOutputPath;
64546
- const storage = createInMemoryStorage();
64547
- await runEvalite({
64548
- path: evalPath,
64549
- cwd: projectRoot,
64550
- mode: "run-once-and-exit",
64551
- scoreThreshold,
64552
- outputPath,
64553
- hideTable: true,
64554
- storage,
64555
- disableServer: true
64556
- });
64557
- let outputJson;
64558
- try {
64559
- outputJson = await fs3.readFile(outputPath, "utf-8");
64560
- } catch (err) {
64561
- return {
64562
- success: false,
64563
- totalSuites: 0,
64564
- totalEvals: 0,
64565
- averageScore: 0,
64566
- suites: [],
64567
- error: `No results file generated: ${err instanceof Error ? err.message : String(err)}`
64568
- };
64569
- }
64570
- const output = JSON.parse(outputJson);
64571
- if (isTemporaryOutput) {
64572
- await fs3.unlink(outputPath).catch(() => {});
64573
- }
64574
- const suites = output.evals.map((evalItem) => ({
64575
- name: evalItem.name,
64576
- filepath: evalItem.filepath,
64577
- status: evalItem.status,
64578
- duration: evalItem.duration,
64579
- averageScore: evalItem.averageScore,
64580
- evalCount: evalItem.results.length,
64581
- evals: evalItem.results.map((r) => ({
64582
- input: r.input,
64583
- output: r.output,
64584
- expected: r.expected,
64585
- scores: r.scores.map((s) => ({
64586
- name: s.name,
64587
- score: s.score,
64588
- description: s.description
64589
- }))
64590
- }))
64591
- }));
64592
- for (const suite of suites) {
64593
- const history = getScoreHistory(projectRoot, suite.name);
64594
- recordEvalRun(projectRoot, {
64595
- timestamp: new Date().toISOString(),
64596
- eval_name: suite.name,
64597
- score: suite.averageScore,
64598
- run_count: history.length + 1
64599
- });
64600
- }
64601
- const gateResults = [];
64602
- for (const suite of suites) {
64603
- const history = getScoreHistory(projectRoot, suite.name);
64604
- const gate = checkGate(projectRoot, suite.name, suite.averageScore);
64605
- gateResults.push({ suite: suite.name, ...gate });
64606
- if (!gate.passed) {
64607
- try {
64608
- const memoryAdapter = await getMemoryAdapter();
64609
- await learnFromEvalFailure(suite.name, suite.averageScore, history, memoryAdapter);
64610
- } catch (e) {
64611
- console.warn(`Failed to store learning for ${suite.name}:`, e);
64612
- }
64613
- }
64614
- }
64615
- const totalEvals = suites.reduce((sum2, s) => sum2 + s.evalCount, 0);
64616
- const averageScore = suites.length > 0 ? suites.reduce((sum2, s) => sum2 + s.averageScore, 0) / suites.length : 0;
64617
- const thresholdPassed = scoreThreshold === undefined || averageScore * 100 >= scoreThreshold;
64618
- return {
64619
- success: thresholdPassed,
64620
- totalSuites: suites.length,
64621
- totalEvals,
64622
- averageScore,
64623
- suites,
64624
- gateResults
64625
- };
64626
- } catch (error45) {
64627
- return {
64628
- success: false,
64629
- totalSuites: 0,
64630
- totalEvals: 0,
64631
- averageScore: 0,
64632
- suites: [],
64633
- error: error45 instanceof Error ? error45.message : String(error45)
64634
- };
64635
- }
64636
- }
64637
- var eval_run = tool({
64638
- description: `Run evalite evals programmatically and get structured results with scores.
64639
-
64640
- Use this to:
64641
- - Run all evals in evals/ directory
64642
- - Filter by specific eval suite (e.g., "coordinator", "compaction")
64643
- - Enforce score thresholds for quality gates
64644
- - Get per-suite and per-eval scores
64645
-
64646
- Returns structured JSON with:
64647
- - success: boolean (true if all tests passed threshold)
64648
- - totalSuites: number of eval suites run
64649
- - totalEvals: number of individual test cases
64650
- - averageScore: 0-1 score across all suites
64651
- - suites: array of suite results with scores
64652
-
64653
- Example usage:
64654
- - Run all evals: eval_run()
64655
- - Run coordinator evals: eval_run({ suiteFilter: "coordinator" })
64656
- - Enforce 80% threshold: eval_run({ scoreThreshold: 80 })`,
64657
- args: {
64658
- 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.'),
64659
- 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."),
64660
- 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.")
64661
- },
64662
- execute: async (args2) => {
64663
- const result = await runEvals({
64664
- cwd: process.cwd(),
64665
- suiteFilter: args2.suiteFilter,
64666
- scoreThreshold: args2.scoreThreshold
64667
- });
64668
- const includeDetails = args2.includeDetailedResults === true;
64669
- if (!includeDetails) {
64670
- for (const suite of result.suites) {
64671
- delete suite.evals;
64672
- }
64673
- }
64674
- return JSON.stringify(result, null, 2);
64675
- }
64676
- });
64677
- var evalTools = {
64678
- eval_run
64679
- };
64680
-
64681
64276
  // src/contributor-tools.ts
64682
64277
  init_dist();
64683
64278
  init_zod();
@@ -65499,13 +65094,13 @@ function getMetricsSummary(metrics) {
65499
65094
 
65500
65095
  // src/logger.ts
65501
65096
  var import_pino = __toESM(require_pino(), 1);
65502
- import { mkdirSync as mkdirSync6, existsSync as existsSync9 } from "node:fs";
65503
- import { join as join12 } from "node:path";
65097
+ import { mkdirSync as mkdirSync5, existsSync as existsSync8 } from "node:fs";
65098
+ import { join as join11 } from "node:path";
65504
65099
  import { homedir as homedir3 } from "node:os";
65505
- var DEFAULT_LOG_DIR = join12(homedir3(), ".config", "swarm-tools", "logs");
65100
+ var DEFAULT_LOG_DIR = join11(homedir3(), ".config", "swarm-tools", "logs");
65506
65101
  function ensureLogDir(logDir) {
65507
- if (!existsSync9(logDir)) {
65508
- mkdirSync6(logDir, { recursive: true });
65102
+ if (!existsSync8(logDir)) {
65103
+ mkdirSync5(logDir, { recursive: true });
65509
65104
  }
65510
65105
  }
65511
65106
  function createTransport(filename, logDir) {
@@ -65523,7 +65118,7 @@ function createTransport(filename, logDir) {
65523
65118
  return {
65524
65119
  target: "pino-roll",
65525
65120
  options: {
65526
- file: join12(logDir, filename),
65121
+ file: join11(logDir, filename),
65527
65122
  frequency: "daily",
65528
65123
  extension: "log",
65529
65124
  limit: { count: 14 },
@@ -66518,7 +66113,6 @@ var SwarmPlugin = async (input) => {
66518
66113
  ...memoryTools,
66519
66114
  ...observabilityTools,
66520
66115
  ...researchTools,
66521
- ...evalTools,
66522
66116
  ...contributorTools
66523
66117
  },
66524
66118
  event: async ({ event }) => {