opencode-swarm 7.125.0 → 7.125.2

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.
Files changed (50) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +11 -127
  2. package/.opencode/skills/swarm-pr-feedback/references/bot-claim-verification.md +71 -0
  3. package/.opencode/skills/swarm-pr-feedback/references/operational-gotchas.md +49 -0
  4. package/.opencode/skills/swarm-pr-review/SKILL.md +6 -346
  5. package/.opencode/skills/swarm-pr-review/references/parser-dry-run.md +235 -0
  6. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +103 -0
  7. package/.opencode/skills/writing-tests/SKILL.md +4 -123
  8. package/.opencode/skills/writing-tests/references/mock-and-seam-inventory.md +43 -0
  9. package/dist/cli/{config-doctor-be9sxqx8.js → config-doctor-8df6hk58.js} +2 -2
  10. package/dist/cli/{curation-policy-52kt6d7t.js → curation-policy-7pvghg6f.js} +2 -2
  11. package/dist/cli/{curator-hbst8nbc.js → curator-dw2zb74h.js} +13 -13
  12. package/dist/cli/{curator-llm-factory-frde1955.js → curator-llm-factory-bntt6v8j.js} +13 -13
  13. package/dist/cli/{evidence-summary-service-9hq7n9k9.js → evidence-summary-service-v4h2w487.js} +1 -1
  14. package/dist/cli/{guardrail-explain-112kqmbc.js → guardrail-explain-vmr4db9n.js} +14 -14
  15. package/dist/cli/{guardrail-log-c8zcab91.js → guardrail-log-8prd6cnc.js} +3 -3
  16. package/dist/cli/{hive-promoter-448xs2tp.js → hive-promoter-xymt9vf2.js} +13 -13
  17. package/dist/cli/{index-jh6s75f6.js → index-1s7jzcsy.js} +1 -1
  18. package/dist/cli/{index-09vd53pz.js → index-39p1yyag.js} +1 -1
  19. package/dist/cli/{index-dx2c2wjt.js → index-7mtvvt8p.js} +2 -2
  20. package/dist/cli/{index-67hqr2zv.js → index-7ne6q2a0.js} +1 -1
  21. package/dist/cli/{index-amspa811.js → index-8ed9rz7y.js} +122 -45
  22. package/dist/cli/{index-0y6tmm9v.js → index-92xyawa7.js} +1 -1
  23. package/dist/cli/{index-7j3sm7h8.js → index-em4h33my.js} +2 -2
  24. package/dist/cli/{index-4rzzzjtg.js → index-fs02c7tz.js} +277 -16
  25. package/dist/cli/{index-kt0awv1n.js → index-j8ptbcxz.js} +1 -1
  26. package/dist/cli/{index-yt1v62pv.js → index-pgya7cnn.js} +4 -4
  27. package/dist/cli/{index-vtwqjr4z.js → index-ptmhxsaf.js} +3 -3
  28. package/dist/cli/{index-xattnmyb.js → index-qcrah1jk.js} +6 -2
  29. package/dist/cli/{index-6vfvc36k.js → index-sxdh19nk.js} +1 -1
  30. package/dist/cli/{index-n6chz2g8.js → index-tdpct4cz.js} +1 -1
  31. package/dist/cli/{index-99ed0h32.js → index-v3f7jvm8.js} +5 -5
  32. package/dist/cli/{index-9hbwa5x1.js → index-yrk6hfp1.js} +15 -15
  33. package/dist/cli/{index-958hf0yr.js → index-zbsxek49.js} +2 -2
  34. package/dist/cli/index.js +13 -13
  35. package/dist/cli/{knowledge-escalator-htafbhxg.js → knowledge-escalator-47hfstmk.js} +3 -3
  36. package/dist/cli/{knowledge-events-havw8c4t.js → knowledge-events-j5dpp72w.js} +1 -1
  37. package/dist/cli/{knowledge-store-hqngpt2v.js → knowledge-store-58gt7m85.js} +1 -1
  38. package/dist/cli/{knowledge-validator-g7mpnazh.js → knowledge-validator-jjxw5mwc.js} +4 -4
  39. package/dist/cli/{scan-cursor-sx7cvh8v.js → scan-cursor-h8we8dfv.js} +2 -2
  40. package/dist/cli/{schema-2418eqy3.js → schema-xpqbhcyp.js} +1 -1
  41. package/dist/cli/{skill-generator-zggy797r.js → skill-generator-k8d0vff0.js} +5 -5
  42. package/dist/commands/close.d.ts +4 -2
  43. package/dist/config/schema.d.ts +8 -0
  44. package/dist/evidence/documents-retention.d.ts +116 -0
  45. package/dist/evidence/manager.d.ts +17 -0
  46. package/dist/hooks/knowledge-application-gate.d.ts +8 -2
  47. package/dist/hooks/knowledge-application.d.ts +2 -0
  48. package/dist/index.js +376 -368
  49. package/dist/state.d.ts +33 -2
  50. package/package.json +1 -1
@@ -458,7 +458,7 @@ function detectPowerShellEscape(command) {
458
458
  var init_edge_cases = () => {};
459
459
 
460
460
  // src/sandbox/win32/restricted-environment-executor.ts
461
- import { Buffer } from "buffer";
461
+ import { Buffer as Buffer2 } from "buffer";
462
462
  import { spawnSync as spawnSync3 } from "child_process";
463
463
  import * as os2 from "os";
464
464
  import * as path2 from "path";
@@ -618,7 +618,7 @@ class WindowsSandboxExecutor {
618
618
  }
619
619
  const safePath = getSafeWindowsPath();
620
620
  const { cmdExe, powerShellExe } = getWindowsExecutablePaths();
621
- const commandBase64 = Buffer.from(command, "utf8").toString("base64");
621
+ const commandBase64 = Buffer2.from(command, "utf8").toString("base64");
622
622
  const escapedTemp = psSingleQuoteEscape(temp);
623
623
  const escapedPath = psSingleQuoteEscape(safePath);
624
624
  const escapedCmdExe = psSingleQuoteEscape(cmdExe);
@@ -698,7 +698,7 @@ try {
698
698
  [Console]::Error.WriteLine($_.Exception.Message);
699
699
  exit 1;
700
700
  }`;
701
- const encodedScript = Buffer.from(psScript, "utf16le").toString("base64");
701
+ const encodedScript = Buffer2.from(psScript, "utf16le").toString("base64");
702
702
  const escapedPowerShellExe = psSingleQuoteEscape(powerShellExe);
703
703
  return `& '${escapedPowerShellExe}' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -EncodedCommand ${encodedScript}; exit $LASTEXITCODE`;
704
704
  }
@@ -3430,7 +3430,7 @@ import {
3430
3430
  rmSync,
3431
3431
  statSync as statSync2
3432
3432
  } from "fs";
3433
- import * as fs6 from "fs/promises";
3433
+ import * as fs7 from "fs/promises";
3434
3434
  import * as os4 from "os";
3435
3435
  import * as path12 from "path";
3436
3436
 
@@ -4510,6 +4510,242 @@ async function archiveEvaluationArtifacts(args) {
4510
4510
  });
4511
4511
  }
4512
4512
 
4513
+ // src/evidence/documents-retention.ts
4514
+ import * as fs6 from "fs";
4515
+ import * as fsp from "fs/promises";
4516
+ import * as readline from "readline";
4517
+ var EVIDENCE_CACHE_FILE = "evidence-cache/documents.jsonl";
4518
+ var MAX_READ_BYTES = 100 * 1024 * 1024;
4519
+ var RENAME_MAX_ATTEMPTS = 5;
4520
+ var RENAME_BACKOFF_MS = 10;
4521
+ var RENAME_RETRY_CODES = new Set(["EPERM", "EBUSY", "ENOTEMPTY", "EACCES"]);
4522
+ var _internals10 = {
4523
+ stat: (p) => fsp.stat(p),
4524
+ createReadStream: (p, options) => fs6.createReadStream(p, options),
4525
+ openSync: (p, flags) => fs6.openSync(p, flags),
4526
+ writeSync: (fd, data, position) => fs6.writeSync(fd, data, position),
4527
+ fsyncSync: (fd) => fs6.fsyncSync(fd),
4528
+ closeSync: (fd) => fs6.closeSync(fd),
4529
+ renameWithRetry: atomicRenameWithRetry,
4530
+ unlink: (p) => fsp.unlink(p)
4531
+ };
4532
+ async function atomicRenameWithRetry(src, dst, renameFn = fsp.rename) {
4533
+ let lastErr;
4534
+ for (let attempt = 0;attempt < RENAME_MAX_ATTEMPTS; attempt++) {
4535
+ try {
4536
+ await renameFn(src, dst);
4537
+ return;
4538
+ } catch (err) {
4539
+ lastErr = err;
4540
+ const code = err?.code;
4541
+ if (!code || !RENAME_RETRY_CODES.has(code)) {
4542
+ throw err;
4543
+ }
4544
+ if (attempt < RENAME_MAX_ATTEMPTS - 1) {
4545
+ await new Promise((resolve3) => setTimeout(resolve3, RENAME_BACKOFF_MS));
4546
+ }
4547
+ }
4548
+ }
4549
+ throw lastErr;
4550
+ }
4551
+ function emptyResult(dryRun) {
4552
+ return {
4553
+ inventory: 0,
4554
+ selected: 0,
4555
+ archived: 0,
4556
+ corrupt: 0,
4557
+ bytesBefore: 0,
4558
+ bytesAfter: 0,
4559
+ dryRun,
4560
+ aborted: false
4561
+ };
4562
+ }
4563
+ async function readCacheRows(filePath) {
4564
+ const stat2 = await _internals10.stat(filePath);
4565
+ const bytesBefore = stat2.size;
4566
+ const stream = _internals10.createReadStream(filePath, {
4567
+ encoding: "utf8",
4568
+ highWaterMark: 64 * 1024
4569
+ });
4570
+ const rl = readline.createInterface({
4571
+ input: stream,
4572
+ crlfDelay: Infinity
4573
+ });
4574
+ const rows = [];
4575
+ let corrupt = 0;
4576
+ let bytesRead = 0;
4577
+ let aborted = false;
4578
+ try {
4579
+ for await (const line of rl) {
4580
+ const lineBytes = Buffer.byteLength(line, "utf8") + 1;
4581
+ bytesRead += lineBytes;
4582
+ if (bytesRead > MAX_READ_BYTES) {
4583
+ aborted = true;
4584
+ break;
4585
+ }
4586
+ if (line.length === 0)
4587
+ continue;
4588
+ let record = null;
4589
+ try {
4590
+ const parsed = JSON.parse(line);
4591
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4592
+ record = parsed;
4593
+ } else {
4594
+ corrupt++;
4595
+ continue;
4596
+ }
4597
+ } catch {
4598
+ corrupt++;
4599
+ continue;
4600
+ }
4601
+ rows.push({ raw: line, bytes: lineBytes, record });
4602
+ }
4603
+ } finally {
4604
+ rl.close();
4605
+ stream.destroy();
4606
+ }
4607
+ return { rows, corrupt, aborted, bytesBefore };
4608
+ }
4609
+ function oldestFirst(a, b) {
4610
+ const at = typeof a.record?.capturedAt === "string" ? a.record.capturedAt : "";
4611
+ const bt = typeof b.record?.capturedAt === "string" ? b.record.capturedAt : "";
4612
+ if (at === bt)
4613
+ return a.raw.localeCompare(b.raw);
4614
+ return at.localeCompare(bt);
4615
+ }
4616
+ function selectSurvivors(rows, maxRecords, maxBytes) {
4617
+ const ordered = [...rows].sort(oldestFirst);
4618
+ let keepFrom = 0;
4619
+ if (typeof maxRecords === "number" && ordered.length > maxRecords) {
4620
+ keepFrom = ordered.length - maxRecords;
4621
+ }
4622
+ if (typeof maxBytes === "number" && maxBytes > 0) {
4623
+ let total = 0;
4624
+ for (let i = keepFrom;i < ordered.length; i++) {
4625
+ total += ordered[i].bytes;
4626
+ }
4627
+ while (keepFrom < ordered.length && total > maxBytes) {
4628
+ total -= ordered[keepFrom].bytes;
4629
+ keepFrom++;
4630
+ }
4631
+ }
4632
+ const survivors = ordered.slice(keepFrom);
4633
+ const selected = rows.length - survivors.length;
4634
+ return { survivors, selected };
4635
+ }
4636
+ async function rewriteAtomic(filePath, survivors) {
4637
+ const tmpPath = `${filePath}.tmp.${Date.now()}.${process.pid}`;
4638
+ const payload = survivors.length > 0 ? `${survivors.map((row) => row.raw).join(`
4639
+ `)}
4640
+ ` : "";
4641
+ let succeeded = false;
4642
+ const fd = _internals10.openSync(tmpPath, "w");
4643
+ try {
4644
+ _internals10.writeSync(fd, payload, 0);
4645
+ _internals10.fsyncSync(fd);
4646
+ _internals10.closeSync(fd);
4647
+ await _internals10.renameWithRetry(tmpPath, filePath);
4648
+ succeeded = true;
4649
+ } catch (err) {
4650
+ try {
4651
+ _internals10.closeSync(fd);
4652
+ } catch {}
4653
+ const msg = err instanceof Error ? err.message : String(err);
4654
+ throw new Error(`documents-cache rewrite failed: ${msg}`);
4655
+ } finally {
4656
+ if (!succeeded) {
4657
+ try {
4658
+ await _internals10.unlink(tmpPath);
4659
+ } catch {}
4660
+ }
4661
+ }
4662
+ return Buffer.byteLength(payload, "utf8");
4663
+ }
4664
+ async function pruneEvidenceDocuments(args) {
4665
+ const dryRun = args.dryRun === true;
4666
+ const capsUnset = (typeof args.maxBytes !== "number" || args.maxBytes <= 0) && (typeof args.maxRecords !== "number" || args.maxRecords <= 0);
4667
+ const filePath = validateSwarmPath(args.directory, EVIDENCE_CACHE_FILE);
4668
+ let stat2;
4669
+ try {
4670
+ stat2 = await _internals10.stat(filePath);
4671
+ } catch (err) {
4672
+ const code = err?.code;
4673
+ if (code === "ENOENT")
4674
+ return emptyResult(dryRun);
4675
+ throw err;
4676
+ }
4677
+ if (capsUnset) {
4678
+ return {
4679
+ inventory: 0,
4680
+ selected: 0,
4681
+ archived: 0,
4682
+ corrupt: 0,
4683
+ bytesBefore: stat2.size,
4684
+ bytesAfter: stat2.size,
4685
+ dryRun,
4686
+ aborted: false
4687
+ };
4688
+ }
4689
+ let readResult;
4690
+ try {
4691
+ readResult = await readCacheRows(filePath);
4692
+ } catch (err) {
4693
+ const msg = err instanceof Error ? err.message : String(err);
4694
+ warn(`documents-cache prune: read failed: ${msg}`);
4695
+ throw err;
4696
+ }
4697
+ if (readResult.aborted) {
4698
+ warn(`documents-cache prune: aborted, file exceeds ${MAX_READ_BYTES} bytes; left untouched`);
4699
+ return {
4700
+ inventory: readResult.rows.length,
4701
+ selected: 0,
4702
+ archived: 0,
4703
+ corrupt: readResult.corrupt,
4704
+ bytesBefore: readResult.bytesBefore,
4705
+ bytesAfter: readResult.bytesBefore,
4706
+ dryRun,
4707
+ aborted: true
4708
+ };
4709
+ }
4710
+ const { survivors, selected } = selectSurvivors(readResult.rows, args.maxRecords, args.maxBytes);
4711
+ if (dryRun) {
4712
+ const bytesAfter2 = survivors.reduce((sum, row) => sum + row.bytes, 0);
4713
+ return {
4714
+ inventory: readResult.rows.length,
4715
+ selected,
4716
+ archived: 0,
4717
+ corrupt: readResult.corrupt,
4718
+ bytesBefore: readResult.bytesBefore,
4719
+ bytesAfter: bytesAfter2,
4720
+ dryRun: true,
4721
+ aborted: false
4722
+ };
4723
+ }
4724
+ if (selected === 0 && readResult.corrupt === 0) {
4725
+ return {
4726
+ inventory: readResult.rows.length,
4727
+ selected: 0,
4728
+ archived: 0,
4729
+ corrupt: 0,
4730
+ bytesBefore: readResult.bytesBefore,
4731
+ bytesAfter: readResult.bytesBefore,
4732
+ dryRun: false,
4733
+ aborted: false
4734
+ };
4735
+ }
4736
+ const bytesAfter = await rewriteAtomic(filePath, survivors);
4737
+ return {
4738
+ inventory: readResult.rows.length,
4739
+ selected,
4740
+ archived: selected,
4741
+ corrupt: readResult.corrupt,
4742
+ bytesBefore: readResult.bytesBefore,
4743
+ bytesAfter,
4744
+ dryRun: false,
4745
+ aborted: false
4746
+ };
4747
+ }
4748
+
4513
4749
  // src/evidence/manager.ts
4514
4750
  var VALID_EVIDENCE_TYPES = [
4515
4751
  "review",
@@ -4608,11 +4844,11 @@ function validateProjectRoot(directory) {
4608
4844
  }
4609
4845
  }
4610
4846
  async function saveEvidence(directory, taskId, evidence) {
4611
- _internals10.validateProjectRoot(directory);
4847
+ _internals11.validateProjectRoot(directory);
4612
4848
  const sanitizedTaskId = sanitizeTaskId2(taskId);
4613
4849
  const relativePath = path12.join("evidence", sanitizedTaskId, "evidence.json");
4614
4850
  validateSwarmPath(directory, relativePath);
4615
- _internals10.validateEvidence(evidence);
4851
+ _internals11.validateEvidence(evidence);
4616
4852
  return withEvidenceLock(directory, relativePath, "evidence-manager", sanitizedTaskId, async () => {
4617
4853
  const evidencePath = validateSwarmPath(directory, relativePath);
4618
4854
  const evidenceDir = path12.dirname(evidencePath);
@@ -4661,7 +4897,7 @@ async function saveEvidence(directory, taskId, evidence) {
4661
4897
  const tempPath = path12.join(evidenceDir, `evidence.json.tmp.${Date.now()}.${process.pid}`);
4662
4898
  try {
4663
4899
  await bunWrite(tempPath, bundleJson);
4664
- await fs6.rename(tempPath, evidencePath);
4900
+ await fs7.rename(tempPath, evidencePath);
4665
4901
  } catch (error2) {
4666
4902
  try {
4667
4903
  rmSync(tempPath, { force: true });
@@ -4718,7 +4954,7 @@ async function loadEvidence(directory, taskId) {
4718
4954
  return { status: "invalid_schema", errors: ["Invalid JSON"] };
4719
4955
  }
4720
4956
  if (isFlatRetrospective(parsed)) {
4721
- const wrappedBundle = _internals10.wrapFlatRetrospective(parsed, sanitizedTaskId);
4957
+ const wrappedBundle = _internals11.wrapFlatRetrospective(parsed, sanitizedTaskId);
4722
4958
  try {
4723
4959
  const validated = EvidenceBundleSchema.parse(wrappedBundle);
4724
4960
  try {
@@ -4728,7 +4964,7 @@ async function loadEvidence(directory, taskId) {
4728
4964
  const tempPath = path12.join(evidenceDir, `evidence.json.tmp.${Date.now()}.${process.pid}`);
4729
4965
  try {
4730
4966
  await bunWrite(tempPath, bundleJson);
4731
- await fs6.rename(tempPath, evidencePath);
4967
+ await fs7.rename(tempPath, evidencePath);
4732
4968
  } catch (writeError) {
4733
4969
  try {
4734
4970
  rmSync(tempPath, { force: true });
@@ -4807,15 +5043,15 @@ async function checkRequirementCoverage(phase, directory) {
4807
5043
  const relativePath = path12.join("evidence", `req-coverage-phase-${phase}.json`);
4808
5044
  const absolutePath = path12.resolve(directory, ".swarm", relativePath);
4809
5045
  try {
4810
- await fs6.access(absolutePath);
5046
+ await fs7.access(absolutePath);
4811
5047
  return { exists: true, path: absolutePath };
4812
5048
  } catch {
4813
5049
  return { exists: false, path: absolutePath };
4814
5050
  }
4815
5051
  }
4816
5052
  async function archiveEvidence(directory, maxAgeDays, maxBundles, options) {
4817
- const taskIds = await _internals10.listEvidenceTaskIds(directory);
4818
- const cutoffDate = options?.now ? new Date(options.now) : _internals10.now();
5053
+ const taskIds = await _internals11.listEvidenceTaskIds(directory);
5054
+ const cutoffDate = options?.now ? new Date(options.now) : _internals11.now();
4819
5055
  cutoffDate.setDate(cutoffDate.getDate() - maxAgeDays);
4820
5056
  const cutoffIso = cutoffDate.toISOString();
4821
5057
  const selected = new Set;
@@ -4827,7 +5063,7 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles, options) {
4827
5063
  for (const taskId of taskIds) {
4828
5064
  let result;
4829
5065
  try {
4830
- result = await _internals10.loadEvidence(directory, taskId);
5066
+ result = await _internals11.loadEvidence(directory, taskId);
4831
5067
  } catch {
4832
5068
  warn("archive: skipping corrupt or unreadable evidence for task", taskId);
4833
5069
  continue;
@@ -4855,7 +5091,7 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles, options) {
4855
5091
  }
4856
5092
  if (!options?.dryRun) {
4857
5093
  for (const taskId of [...selected].sort()) {
4858
- const deleted = await _internals10.deleteEvidence(directory, taskId);
5094
+ const deleted = await _internals11.deleteEvidence(directory, taskId);
4859
5095
  if (deleted)
4860
5096
  archived.push(taskId);
4861
5097
  else
@@ -4869,6 +5105,29 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles, options) {
4869
5105
  dryRun: options?.dryRun,
4870
5106
  now: options?.now
4871
5107
  });
5108
+ let documentsCache = {
5109
+ inventory: 0,
5110
+ selected: 0,
5111
+ archived: 0,
5112
+ corrupt: 0,
5113
+ bytesBefore: 0,
5114
+ bytesAfter: 0,
5115
+ dryRun: options?.dryRun === true,
5116
+ aborted: false
5117
+ };
5118
+ if (typeof options?.cacheMaxBytes === "number" && options.cacheMaxBytes > 0 || typeof options?.cacheMaxRecords === "number" && options.cacheMaxRecords > 0) {
5119
+ try {
5120
+ documentsCache = await _internals11.pruneEvidenceDocuments({
5121
+ directory,
5122
+ maxBytes: options?.cacheMaxBytes,
5123
+ maxRecords: options?.cacheMaxRecords,
5124
+ dryRun: options?.dryRun
5125
+ });
5126
+ } catch (error2) {
5127
+ const msg = error2 instanceof Error ? error2.message : String(error2);
5128
+ warn(`archiveEvidence: documents-cache prune failed (fail-open): ${msg}`);
5129
+ }
5130
+ }
4872
5131
  if (options?.report) {
4873
5132
  return {
4874
5133
  inventoryEvidence: [...taskIds].sort(),
@@ -4877,7 +5136,8 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles, options) {
4877
5136
  selectedEvidenceByCount: [...selectedByCount].sort(),
4878
5137
  archivedEvidence: archived.sort(),
4879
5138
  failedEvidence: failed.sort(),
4880
- evaluation
5139
+ evaluation,
5140
+ documentsCache
4881
5141
  };
4882
5142
  }
4883
5143
  return archived.sort();
@@ -4885,7 +5145,7 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles, options) {
4885
5145
  function validateEvidence(evidence) {
4886
5146
  return EvidenceSchema.parse(evidence);
4887
5147
  }
4888
- var _internals10 = {
5148
+ var _internals11 = {
4889
5149
  wrapFlatRetrospective,
4890
5150
  loadEvidence,
4891
5151
  listEvidenceTaskIds,
@@ -4893,6 +5153,7 @@ var _internals10 = {
4893
5153
  validateEvidence,
4894
5154
  saveEvidence,
4895
5155
  deleteEvidence,
5156
+ pruneEvidenceDocuments,
4896
5157
  now: () => new Date
4897
5158
  };
4898
5159
 
@@ -8,7 +8,7 @@ import {
8
8
  init_constants,
9
9
  init_schema,
10
10
  resolveExternalSkillsConfig
11
- } from "./index-xattnmyb.js";
11
+ } from "./index-qcrah1jk.js";
12
12
  import {
13
13
  advisoryWarn,
14
14
  init_warning_buffer
@@ -650,7 +650,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
650
650
  const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
651
651
  if (atFloor.length === 0 && recovered.length === 0)
652
652
  return;
653
- const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-havw8c4t.js");
653
+ const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-j5dpp72w.js");
654
654
  const rollups = await readKnowledgeCounterRollups(directory);
655
655
  const flagIds = new Set;
656
656
  for (const e of atFloor) {
@@ -717,11 +717,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
717
717
  });
718
718
  }
719
719
  if (action === "quarantine" && toQuarantine.length > 0) {
720
- const { quarantineEntry } = await import("./knowledge-validator-g7mpnazh.js");
721
- const { KnowledgeConfigSchema } = await import("./schema-2418eqy3.js");
720
+ const { quarantineEntry } = await import("./knowledge-validator-jjxw5mwc.js");
721
+ const { KnowledgeConfigSchema } = await import("./schema-xpqbhcyp.js");
722
722
  let config;
723
723
  try {
724
- const { loadPluginConfigWithMeta } = await import("./index-958hf0yr.js");
724
+ const { loadPluginConfigWithMeta } = await import("./index-zbsxek49.js");
725
725
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
726
726
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
727
727
  } catch {
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-dx2c2wjt.js";
5
+ } from "./index-7mtvvt8p.js";
6
6
  import {
7
7
  computeOutcomeSignal,
8
8
  readKnowledge,
9
9
  resolveHiveKnowledgePath,
10
10
  resolveSwarmKnowledgePath,
11
11
  transactKnowledge
12
- } from "./index-yt1v62pv.js";
12
+ } from "./index-pgya7cnn.js";
13
13
  import {
14
14
  effectiveRetrievalOutcomes,
15
15
  readKnowledgeCounterRollups
16
- } from "./index-n6chz2g8.js";
16
+ } from "./index-tdpct4cz.js";
17
17
  import {
18
18
  init_knowledge_types,
19
19
  isActiveStatus
@@ -1220,7 +1220,9 @@ var init_schema = __esm(() => {
1220
1220
  enabled: exports_external.boolean().default(true),
1221
1221
  max_age_days: exports_external.number().min(1).max(365).default(90),
1222
1222
  max_bundles: exports_external.number().min(10).max(1e4).default(1000),
1223
- auto_archive: exports_external.boolean().default(false)
1223
+ auto_archive: exports_external.boolean().default(false),
1224
+ cache_max_bytes: exports_external.number().min(512).max(50 * 1024 * 1024).optional(),
1225
+ cache_max_records: exports_external.number().min(10).max(1e5).optional()
1224
1226
  });
1225
1227
  GateFeatureSchema = exports_external.object({
1226
1228
  enabled: exports_external.boolean().default(true)
@@ -1942,7 +1944,9 @@ var init_schema = __esm(() => {
1942
1944
  "phase_complete",
1943
1945
  "task",
1944
1946
  "Task"
1945
- ])
1947
+ ]),
1948
+ max_gate_denials: exports_external.number().int().min(1).max(100).default(5),
1949
+ gate_staleness_ms: exports_external.number().int().min(1e4).max(3600000).default(600000)
1946
1950
  });
1947
1951
  SkillPropagationAudienceSchema = exports_external.string().max(64).refine((value) => value !== "swarm-plugin", {
1948
1952
  message: "swarm-plugin is reserved for plugin-internal skill routing"
@@ -3,7 +3,7 @@ import {
3
3
  init_constants,
4
4
  init_schema,
5
5
  stripKnownSwarmPrefix
6
- } from "./index-xattnmyb.js";
6
+ } from "./index-qcrah1jk.js";
7
7
  import {
8
8
  init_logger,
9
9
  warn
@@ -608,7 +608,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
608
608
  deltas.push({ id, delta });
609
609
  }
610
610
  if (deltas.length > 0) {
611
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-hqngpt2v.js");
611
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-58gt7m85.js");
612
612
  await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
613
613
  }
614
614
  return {
@@ -6,13 +6,13 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  transactKnowledge,
8
8
  wordBigrams
9
- } from "./index-yt1v62pv.js";
9
+ } from "./index-pgya7cnn.js";
10
10
  import {
11
11
  countEntryContradictionsInWindow,
12
12
  countEntryViolationsInWindow,
13
13
  readKnowledgeEvents,
14
14
  recordKnowledgeEvent
15
- } from "./index-n6chz2g8.js";
15
+ } from "./index-tdpct4cz.js";
16
16
  import {
17
17
  init_knowledge_types,
18
18
  isActiveStatus
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
190
190
  alreadyInactive: true
191
191
  };
192
192
  }
193
- const { quarantineEntry } = await import("./knowledge-validator-g7mpnazh.js");
193
+ const { quarantineEntry } = await import("./knowledge-validator-jjxw5mwc.js");
194
194
  let policyConfig;
195
195
  try {
196
- const { KnowledgeConfigSchema } = await import("./schema-2418eqy3.js");
197
- const { loadPluginConfigWithMeta } = await import("./index-958hf0yr.js");
196
+ const { KnowledgeConfigSchema } = await import("./schema-xpqbhcyp.js");
197
+ const { loadPluginConfigWithMeta } = await import("./index-zbsxek49.js");
198
198
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
199
199
  policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
200
200
  } catch {
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-7j3sm7h8.js";
4
+ } from "./index-em4h33my.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-jh6s75f6.js";
7
+ } from "./index-1s7jzcsy.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  SWARM_COMMAND_TOOL_ALLOWLIST,
@@ -83,28 +83,28 @@ import {
83
83
  handleWriteRetroCommand,
84
84
  normalizeSwarmCommandInput,
85
85
  resolveCommand
86
- } from "./index-amspa811.js";
87
- import"./index-6vfvc36k.js";
88
- import"./index-0y6tmm9v.js";
89
- import"./index-4rzzzjtg.js";
86
+ } from "./index-8ed9rz7y.js";
87
+ import"./index-sxdh19nk.js";
88
+ import"./index-92xyawa7.js";
89
+ import"./index-fs02c7tz.js";
90
90
  import"./index-4905hd2m.js";
91
91
  import"./index-134d35c1.js";
92
92
  import"./index-6n2jpz7x.js";
93
- import"./index-vtwqjr4z.js";
94
- import"./index-99ed0h32.js";
95
- import"./index-09vd53pz.js";
93
+ import"./index-ptmhxsaf.js";
94
+ import"./index-v3f7jvm8.js";
95
+ import"./index-39p1yyag.js";
96
96
  import"./index-vxv732ex.js";
97
97
  import"./index-c8s9a3zh.js";
98
98
  import"./index-s9mj4rb9.js";
99
99
  import"./index-23zsx7dm.js";
100
- import"./index-dx2c2wjt.js";
101
- import"./index-67hqr2zv.js";
100
+ import"./index-7mtvvt8p.js";
101
+ import"./index-7ne6q2a0.js";
102
102
  import"./index-rtry5xyf.js";
103
- import"./index-yt1v62pv.js";
104
- import"./index-n6chz2g8.js";
103
+ import"./index-pgya7cnn.js";
104
+ import"./index-tdpct4cz.js";
105
105
  import"./index-ae75rja9.js";
106
106
  import"./index-q27bajqb.js";
107
- import"./index-kt0awv1n.js";
107
+ import"./index-j8ptbcxz.js";
108
108
  import"./index-k5jrywpr.js";
109
109
  import"./index-n832052r.js";
110
110
  import {
@@ -113,7 +113,7 @@ import {
113
113
  init_constants,
114
114
  init_schema,
115
115
  stripKnownSwarmPrefix
116
- } from "./index-xattnmyb.js";
116
+ } from "./index-qcrah1jk.js";
117
117
  import"./index-bk5tah7q.js";
118
118
  import"./index-8fwhhayc.js";
119
119
  import"./index-q1exe2b3.js";
@@ -6,7 +6,7 @@ import {
6
6
  loadPluginConfigWithMeta,
7
7
  loadPluginConfigWithMetaAsync,
8
8
  resolveWorktreeIsolationConfig
9
- } from "./index-kt0awv1n.js";
9
+ } from "./index-j8ptbcxz.js";
10
10
  import {
11
11
  ApprovalEvidenceSchema,
12
12
  BaseEvidenceSchema,
@@ -58,7 +58,7 @@ import {
58
58
  WorktreeIsolationConfigSchema,
59
59
  isQAAgent,
60
60
  isSubagent
61
- } from "./index-xattnmyb.js";
61
+ } from "./index-qcrah1jk.js";
62
62
  import"./index-bk5tah7q.js";
63
63
  import {
64
64
  MigrationStatusSchema,
package/dist/cli/index.js CHANGED
@@ -7,34 +7,34 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-amspa811.js";
11
- import"./index-6vfvc36k.js";
12
- import"./index-0y6tmm9v.js";
13
- import"./index-4rzzzjtg.js";
10
+ } from "./index-8ed9rz7y.js";
11
+ import"./index-sxdh19nk.js";
12
+ import"./index-92xyawa7.js";
13
+ import"./index-fs02c7tz.js";
14
14
  import"./index-4905hd2m.js";
15
15
  import"./index-134d35c1.js";
16
16
  import"./index-6n2jpz7x.js";
17
- import"./index-vtwqjr4z.js";
18
- import"./index-99ed0h32.js";
19
- import"./index-09vd53pz.js";
17
+ import"./index-ptmhxsaf.js";
18
+ import"./index-v3f7jvm8.js";
19
+ import"./index-39p1yyag.js";
20
20
  import"./index-vxv732ex.js";
21
21
  import"./index-c8s9a3zh.js";
22
22
  import"./index-s9mj4rb9.js";
23
23
  import"./index-23zsx7dm.js";
24
- import"./index-dx2c2wjt.js";
25
- import"./index-67hqr2zv.js";
24
+ import"./index-7mtvvt8p.js";
25
+ import"./index-7ne6q2a0.js";
26
26
  import"./index-rtry5xyf.js";
27
- import"./index-yt1v62pv.js";
28
- import"./index-n6chz2g8.js";
27
+ import"./index-pgya7cnn.js";
28
+ import"./index-tdpct4cz.js";
29
29
  import"./index-ae75rja9.js";
30
30
  import"./index-q27bajqb.js";
31
- import"./index-kt0awv1n.js";
31
+ import"./index-j8ptbcxz.js";
32
32
  import"./index-k5jrywpr.js";
33
33
  import"./index-n832052r.js";
34
34
  import {
35
35
  DEFAULT_AGENT_CONFIGS,
36
36
  init_constants
37
- } from "./index-xattnmyb.js";
37
+ } from "./index-qcrah1jk.js";
38
38
  import"./index-bk5tah7q.js";
39
39
  import"./index-8fwhhayc.js";
40
40
  import"./index-q1exe2b3.js";
@@ -8,9 +8,9 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-99ed0h32.js";
12
- import"./index-yt1v62pv.js";
13
- import"./index-n6chz2g8.js";
11
+ } from "./index-v3f7jvm8.js";
12
+ import"./index-pgya7cnn.js";
13
+ import"./index-tdpct4cz.js";
14
14
  import"./index-ae75rja9.js";
15
15
  import"./index-q27bajqb.js";
16
16
  import"./index-bk5tah7q.js";