opencode-swarm 7.124.0 → 7.125.1

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 (70) hide show
  1. package/.opencode/skills/critic-gate/SKILL.md +8 -0
  2. package/.opencode/skills/swarm/SKILL.md +12 -8
  3. package/.opencode/skills/swarm-pr-feedback/SKILL.md +245 -171
  4. package/.opencode/skills/swarm-pr-feedback/references/bot-claim-verification.md +71 -0
  5. package/.opencode/skills/swarm-pr-feedback/references/operational-gotchas.md +49 -0
  6. package/.opencode/skills/swarm-pr-review/SKILL.md +238 -412
  7. package/.opencode/skills/swarm-pr-review/references/parser-dry-run.md +235 -0
  8. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +103 -0
  9. package/.opencode/skills/writing-tests/SKILL.md +4 -123
  10. package/.opencode/skills/writing-tests/references/mock-and-seam-inventory.md +43 -0
  11. package/README.md +3 -1
  12. package/dist/background/lane-output-store.d.ts +10 -0
  13. package/dist/background/pending-delegations.d.ts +3 -0
  14. package/dist/background/workspace-snapshot.d.ts +59 -0
  15. package/dist/cli/{config-doctor-53mnpeke.js → config-doctor-g3m2q646.js} +2 -2
  16. package/dist/cli/{curation-policy-ny033330.js → curation-policy-vgbx8530.js} +2 -2
  17. package/dist/cli/{curator-llm-factory-e0tjz8qq.js → curator-llm-factory-7pvqy94w.js} +15 -14
  18. package/dist/cli/{curator-nvn1pdq6.js → curator-xk4g1nx2.js} +15 -14
  19. package/dist/cli/{evidence-summary-service-9hq7n9k9.js → evidence-summary-service-v4h2w487.js} +1 -1
  20. package/dist/cli/{guardrail-explain-d3dd57nf.js → guardrail-explain-wfk16bpr.js} +16 -15
  21. package/dist/cli/{guardrail-log-3q2z9axs.js → guardrail-log-5zz9xx6z.js} +3 -3
  22. package/dist/cli/{hive-promoter-9gbpepgm.js → hive-promoter-njwc5rt0.js} +15 -14
  23. package/dist/cli/{pending-delegations-e3bcqj77.js → index-0cz1ws47.js} +4 -18
  24. package/dist/cli/{index-3yyr4ynk.js → index-3k8pg467.js} +1 -1
  25. package/dist/cli/{index-x2mmnrnx.js → index-83rwq7pb.js} +1 -1
  26. package/dist/cli/{index-c6crt5rs.js → index-8yvqkbw7.js} +12 -2
  27. package/dist/cli/{index-z0m4angq.js → index-93cq8t5b.js} +5 -5
  28. package/dist/cli/{index-8pz0ypxz.js → index-cz6fv84h.js} +17 -16
  29. package/dist/cli/{index-mkkx1a4f.js → index-dsf1yv4s.js} +1588 -891
  30. package/dist/cli/{index-4rzzzjtg.js → index-fs02c7tz.js} +277 -16
  31. package/dist/cli/{index-zjedv2bd.js → index-ghteqdy1.js} +2 -2
  32. package/dist/cli/{index-13d2g7k9.js → index-kvrk3h8p.js} +1 -1
  33. package/dist/cli/{index-eeg04r0x.js → index-kws8zn6y.js} +1 -1
  34. package/dist/cli/index-mg54y5gc.js +564 -0
  35. package/dist/cli/{index-qd77aft9.js → index-mhhmecsw.js} +2 -2
  36. package/dist/cli/{index-2x4maxte.js → index-mwdcvh0e.js} +4 -4
  37. package/dist/cli/{index-e19mxn9f.js → index-pbjenws7.js} +1 -1
  38. package/dist/cli/{index-wqwpzhv1.js → index-rpg8qqjs.js} +2 -2
  39. package/dist/cli/{index-tyg0zezw.js → index-tn3shyqj.js} +3 -3
  40. package/dist/cli/{index-htbjqftb.js → index-txragda9.js} +1 -1
  41. package/dist/cli/{index-v5ecczts.js → index-z4sc6yxc.js} +1 -1
  42. package/dist/cli/index.js +15 -14
  43. package/dist/cli/{knowledge-escalator-r1s01m3z.js → knowledge-escalator-jtyykzqc.js} +3 -3
  44. package/dist/cli/{knowledge-events-a9hmxvke.js → knowledge-events-qhr97sy9.js} +1 -1
  45. package/dist/cli/{knowledge-store-jt31br5k.js → knowledge-store-332x3pjv.js} +1 -1
  46. package/dist/cli/{knowledge-validator-9vrwxr3z.js → knowledge-validator-3t8tgzsz.js} +4 -4
  47. package/dist/cli/pending-delegations-7j8xqg5f.js +34 -0
  48. package/dist/cli/{scan-cursor-bkjtsawg.js → scan-cursor-q21c9k9q.js} +2 -2
  49. package/dist/cli/{schema-y3z416z7.js → schema-y2d7j2jk.js} +1 -1
  50. package/dist/cli/{skill-generator-794hyndw.js → skill-generator-3gkxx98d.js} +5 -5
  51. package/dist/cli/workspace-snapshot-c9pxxt9a.js +48 -0
  52. package/dist/commands/close.d.ts +4 -2
  53. package/dist/commands/registry.d.ts +1 -1
  54. package/dist/config/schema.d.ts +4 -0
  55. package/dist/evidence/documents-retention.d.ts +116 -0
  56. package/dist/evidence/manager.d.ts +17 -0
  57. package/dist/hooks/pr-workflow-gate.d.ts +211 -0
  58. package/dist/hooks/pr-workflow-response-gate.d.ts +23 -0
  59. package/dist/hooks/pr-workflow-session-resolver.d.ts +14 -0
  60. package/dist/index.js +563 -523
  61. package/dist/tools/complete-pr-workflow.d.ts +5 -0
  62. package/dist/tools/dispatch-lanes.d.ts +44 -0
  63. package/dist/tools/index.d.ts +2 -0
  64. package/dist/tools/manifest.d.ts +2 -0
  65. package/dist/tools/run-pr-feedback-stage-a.d.ts +69 -0
  66. package/dist/tools/tool-metadata.d.ts +8 -0
  67. package/dist/tools/write-pr-review-trigger-eval.d.ts +56 -46
  68. package/package.json +1 -1
  69. package/dist/cli/index-dqh3zhhc.js +0 -133
  70. package/dist/cli/workspace-snapshot-eyf6gd0d.js +0 -22
@@ -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
 
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-13d2g7k9.js";
4
+ } from "./index-kvrk3h8p.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,7 +9,7 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-2x4maxte.js";
12
+ } from "./index-mwdcvh0e.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
15
  } from "./index-q27bajqb.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-rtry5xyf.js";
5
5
  import {
6
6
  readKnowledgeEvents
7
- } from "./index-x2mmnrnx.js";
7
+ } from "./index-83rwq7pb.js";
8
8
  import {
9
9
  isLinked,
10
10
  readLinkPointer,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-2x4maxte.js";
5
+ } from "./index-mwdcvh0e.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
8
  } from "./index-q27bajqb.js";