opencode-swarm 7.166.2 → 7.166.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.opencode/skills/council/SKILL.md +4 -1
  2. package/.opencode/skills/deep-dive/SKILL.md +1 -1
  3. package/.opencode/skills/deep-research/SKILL.md +4 -1
  4. package/.opencode/skills/gate-attribution/SKILL.md +3 -0
  5. package/.opencode/skills/pre-phase-briefing/SKILL.md +8 -0
  6. package/.opencode/skills/swarm-pr-review/SKILL.md +30 -30
  7. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  8. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  9. package/dist/cli/{coder-settlement-pv86n7n4.js → coder-settlement-yynntj5j.js} +11 -11
  10. package/dist/cli/{config-doctor-fy1aytwt.js → config-doctor-8asc35km.js} +2 -2
  11. package/dist/cli/{core-1d9vqbt4.js → core-qrbhs2q4.js} +1 -1
  12. package/dist/cli/{curation-policy-gnpgc3z7.js → curation-policy-bvxf5pxv.js} +9 -6
  13. package/dist/cli/{curator-drift-efmgp1v2.js → curator-drift-20m2ab5w.js} +4 -4
  14. package/dist/cli/curator-llm-factory-rs4921ks.js +71 -0
  15. package/dist/cli/{curator-a4rbehfr.js → curator-qk4xmkv4.js} +37 -36
  16. package/dist/cli/{evidence-summary-service-dvp1kbm4.js → evidence-summary-service-rktcp3s4.js} +15 -15
  17. package/dist/cli/{gate-evidence-qf27gdfx.js → gate-evidence-k6nzqca1.js} +6 -6
  18. package/dist/cli/guardrail-explain-jdspxzjr.js +72 -0
  19. package/dist/cli/{guardrail-log-qhw3knjt.js → guardrail-log-962pzjev.js} +7 -7
  20. package/dist/cli/{guardrail-reset-84ydxdg3.js → guardrail-reset-dv02t0bm.js} +37 -36
  21. package/dist/cli/{hive-promoter-y2daybf6.js → hive-promoter-9zzr28p2.js} +37 -36
  22. package/dist/cli/{index-ytsts0zj.js → index-0v6bf0j9.js} +1 -1
  23. package/dist/cli/{index-bysyj3z4.js → index-1aex5zd9.js} +1 -1
  24. package/dist/cli/{index-p0r5fn7y.js → index-251vrmge.js} +2 -2
  25. package/dist/cli/{index-sxe3t040.js → index-2w0beg3s.js} +2 -2
  26. package/dist/cli/{index-sxsyd7kf.js → index-3ct7fd75.js} +6 -6
  27. package/dist/cli/{index-jr6tppv9.js → index-3nm1b3t2.js} +7 -7
  28. package/dist/cli/{index-22sannyk.js → index-3s194swm.js} +36 -10
  29. package/dist/cli/{index-ft1tnx0e.js → index-5bd84nxc.js} +1 -1
  30. package/dist/cli/{index-gy55mc55.js → index-5qws47d4.js} +3369 -2820
  31. package/dist/cli/{index-7pp8fz4j.js → index-6d4dc99f.js} +1 -1
  32. package/dist/cli/{index-nthqfxzz.js → index-75f9jj3h.js} +2 -2
  33. package/dist/cli/{index-x4azb6qj.js → index-7g5kdtvw.js} +2 -2
  34. package/dist/cli/{index-qmp4gxac.js → index-8ewgab6z.js} +1 -1
  35. package/dist/cli/{index-0a0jsbhg.js → index-9eswrdp5.js} +1 -1
  36. package/dist/cli/{index-x8cvbkjs.js → index-9wv6a3jx.js} +2 -2
  37. package/dist/cli/{index-c0eyq4rp.js → index-bxrxqwce.js} +4 -4
  38. package/dist/cli/{index-bks56jbg.js → index-f6zgz02s.js} +3 -3
  39. package/dist/cli/{index-2n1v8ft1.js → index-gccxen4x.js} +5 -1
  40. package/dist/cli/{index-7mxrqy4r.js → index-gr5wg0nj.js} +7 -7
  41. package/dist/cli/{index-st47knj6.js → index-gsftf6c8.js} +3 -3
  42. package/dist/cli/{index-wz258yje.js → index-kwervbv6.js} +11 -11
  43. package/dist/cli/{index-3nww2vnx.js → index-kz44j3qe.js} +8 -8
  44. package/dist/cli/{index-19hjpqsy.js → index-m21x1bkx.js} +17 -9
  45. package/dist/cli/{index-j81kpway.js → index-m3tx1q9v.js} +1 -1
  46. package/dist/cli/{index-z1kmkh72.js → index-m9q6f3ty.js} +2 -2
  47. package/dist/cli/{index-3wtfrjcx.js → index-n189w64j.js} +3 -3
  48. package/dist/cli/{index-ty0wg9yp.js → index-n65x6e1y.js} +5 -5
  49. package/dist/cli/{index-hgphhnrp.js → index-qd619x3r.js} +2 -2
  50. package/dist/cli/{index-fkk7x6sy.js → index-qd726agw.js} +2 -2
  51. package/dist/cli/{index-jgtje76m.js → index-qv4byzwp.js} +94 -29
  52. package/dist/cli/{index-c23w8t46.js → index-qww0h314.js} +11 -6
  53. package/dist/cli/{index-y3dtdn2f.js → index-rk10x4zr.js} +1 -1
  54. package/dist/cli/{index-4kwxpnf8.js → index-sahf5yz3.js} +1 -1
  55. package/dist/cli/{index-e0bjbadr.js → index-shqhq68n.js} +8 -3
  56. package/dist/cli/{index-kd68b6mg.js → index-st1zw5ps.js} +2 -2
  57. package/dist/cli/{index-14z9en94.js → index-t8tw1bhs.js} +1 -1
  58. package/dist/cli/{index-9ccxcjdm.js → index-v5wanchr.js} +4 -4
  59. package/dist/cli/index-vzm6zre7.js +167 -0
  60. package/dist/cli/{index-8nv3bc9h.js → index-wd86yj53.js} +4 -4
  61. package/dist/cli/{index-nrdj94za.js → index-x8c42y8s.js} +39 -38
  62. package/dist/cli/{index-hbjax6hy.js → index-z62gdhkd.js} +8 -8
  63. package/dist/cli/index.js +37 -36
  64. package/dist/cli/{knowledge-escalator-aq7gzhpd.js → knowledge-escalator-w4bfnks3.js} +13 -12
  65. package/dist/cli/{knowledge-events-9z5sskyv.js → knowledge-events-wmnx8m6b.js} +10 -10
  66. package/dist/cli/{knowledge-link-ps2v4s18.js → knowledge-link-w1fwqts4.js} +4 -4
  67. package/dist/cli/{knowledge-store-1hzt2a0t.js → knowledge-store-5442ph4m.js} +8 -5
  68. package/dist/cli/{knowledge-validator-xe1fza7c.js → knowledge-validator-5rmardr4.js} +8 -7
  69. package/dist/cli/{pending-delegations-0nfjg7vp.js → pending-delegations-ea6zpqw2.js} +12 -11
  70. package/dist/cli/{pr-subscriptions-8974hwa0.js → pr-subscriptions-yqxt0avv.js} +12 -11
  71. package/dist/cli/{pr-workflow-gate-xgak5wvz.js → pr-workflow-gate-px36rczj.js} +37 -36
  72. package/dist/cli/{runner-7zqbp81n.js → runner-nmrjv7te.js} +5 -5
  73. package/dist/cli/{scan-cursor-hc4v0c90.js → scan-cursor-efrage98.js} +7 -6
  74. package/dist/cli/{schema-w1hsvw1h.js → schema-w2sds948.js} +3 -1
  75. package/dist/cli/{scope-persistence-k17003v4.js → scope-persistence-dd7p3tdv.js} +15 -14
  76. package/dist/cli/{skill-generator-tbxgpc9x.js → skill-generator-c0720k51.js} +15 -14
  77. package/dist/cli/{snapshot-coordination-init-vaf34wf0.js → snapshot-coordination-init-dp42vvme.js} +37 -36
  78. package/dist/cli/{telemetry-8qn4eag5.js → telemetry-ce0tx41h.js} +1 -1
  79. package/dist/cli/{workspace-snapshot-y85jy6gs.js → workspace-snapshot-0kxj2grt.js} +3 -3
  80. package/dist/cli/{worktree-collision-ownership-r3jdke7h.js → worktree-collision-ownership-emh2yhpx.js} +13 -12
  81. package/dist/cli/{worktree-isolation-sa1tbqff.js → worktree-isolation-a8f1yahq.js} +37 -36
  82. package/dist/commands/close.d.ts +82 -0
  83. package/dist/config/schema.d.ts +9 -0
  84. package/dist/context-map/capsule-persistence.d.ts +13 -8
  85. package/dist/hooks/delegate-ack-collector.d.ts +7 -0
  86. package/dist/hooks/knowledge-store.d.ts +7 -0
  87. package/dist/hooks/review-receipt.d.ts +29 -1
  88. package/dist/index.js +554 -551
  89. package/dist/knowledge/curation-policy.d.ts +7 -0
  90. package/dist/memory/consolidation-log.d.ts +9 -0
  91. package/dist/memory/injector.d.ts +7 -0
  92. package/dist/memory/run-log.d.ts +8 -0
  93. package/dist/retention/caps.d.ts +33 -0
  94. package/dist/retention/dir-prune.d.ts +72 -0
  95. package/dist/retention/jsonl-cap.d.ts +84 -0
  96. package/dist/retention/sweep.d.ts +67 -0
  97. package/dist/services/compaction-service.d.ts +14 -0
  98. package/dist/services/skill-changelog.d.ts +20 -0
  99. package/dist/summaries/manager.d.ts +41 -4
  100. package/dist/test-impact/history-store.d.ts +16 -0
  101. package/dist/turbo/epic/calibration.d.ts +16 -1
  102. package/dist/turbo/epic/divergence-recorder.d.ts +11 -0
  103. package/opencode-swarm.schema.json +15 -0
  104. package/package.json +1 -1
  105. package/dist/cli/curator-llm-factory-cwg62ynw.js +0 -70
  106. package/dist/cli/guardrail-explain-zskpzgsr.js +0 -71
@@ -5,22 +5,26 @@ import {
5
5
  import {
6
6
  effectiveRetrievalOutcomes,
7
7
  readAuthoritativeKnowledgeCounterRollups
8
- } from "./index-3nww2vnx.js";
8
+ } from "./index-kz44j3qe.js";
9
9
  import {
10
10
  ALLOWED_SKILL_PATH_PREFIXES,
11
11
  validateSkillPath
12
- } from "./index-8nv3bc9h.js";
12
+ } from "./index-wd86yj53.js";
13
13
  import {
14
14
  computeOutcomeSignal,
15
15
  readKnowledge,
16
16
  resolveHiveKnowledgePath,
17
17
  resolveSwarmKnowledgePath,
18
18
  transactKnowledge
19
- } from "./index-22sannyk.js";
19
+ } from "./index-3s194swm.js";
20
+ import {
21
+ appendCappedJsonl,
22
+ resolveRetentionCap
23
+ } from "./index-vzm6zre7.js";
20
24
  import {
21
25
  atomicWriteFileAnyRoot,
22
26
  atomicWriteSwarmFile
23
- } from "./index-19hjpqsy.js";
27
+ } from "./index-m21x1bkx.js";
24
28
  import {
25
29
  canonicalRootKeyFresh
26
30
  } from "./index-7qefgq4j.js";
@@ -43,7 +47,7 @@ import {
43
47
 
44
48
  // src/services/skill-generator.ts
45
49
  import { existsSync as existsSync2, unlinkSync } from "fs";
46
- import { mkdir as mkdir4, readFile as readFile4, unlink, writeFile as writeFile3 } from "fs/promises";
50
+ import { mkdir as mkdir3, readFile as readFile4, unlink as unlink2, writeFile as writeFile3 } from "fs/promises";
47
51
  import * as path4 from "path";
48
52
 
49
53
  // src/config/bundled-skills.ts
@@ -406,34 +410,95 @@ init_knowledge_types();
406
410
  init_logger();
407
411
 
408
412
  // src/services/skill-changelog.ts
409
- init_logger();
410
- import { appendFile, mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
413
+ import { readdir as readdir2, readFile as readFile2, rename as rename2, unlink, writeFile as writeFile2 } from "fs/promises";
411
414
  import * as path2 from "path";
412
- var MAX_CHANGELOG_ENTRIES_PER_SKILL = 200;
415
+ init_logger();
416
+ var MAX_SKILL_CHANGELOG_ENTRIES_PER_SKILL = 200;
417
+ var MAX_SKILL_CHANGELOG_GLOBAL_ENTRIES = 1e4;
413
418
  function resolveSkillChangelogPath(directory, slug) {
414
419
  if (slug.includes("..") || slug.includes("/") || slug.includes("\\")) {
415
420
  throw new Error(`Invalid skill slug: ${slug} \u2014 must not contain "..", "/" or "\\"`);
416
421
  }
417
422
  return path2.join(directory, ".swarm", "skill-changelogs", `${slug}.jsonl`);
418
423
  }
419
- async function appendSkillChangelog(directory, slug, entry) {
420
- const filePath = resolveSkillChangelogPath(directory, slug);
421
- const dirPath = path2.dirname(filePath);
422
- await mkdir2(dirPath, { recursive: true });
423
- await appendFile(filePath, `${JSON.stringify(entry)}
424
+ async function rewriteLinesAtomically(filePath, lines) {
425
+ const tmpPath = `${filePath}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 8)}`;
426
+ await writeFile2(tmpPath, `${lines.join(`
427
+ `)}
424
428
  `, "utf-8");
425
429
  try {
426
- const content = await readFile2(filePath, "utf-8");
430
+ await rename2(tmpPath, filePath);
431
+ } catch (err) {
432
+ await unlink(tmpPath).catch(() => {});
433
+ throw err;
434
+ }
435
+ }
436
+ async function enforceGlobalEntryCap(dirPath) {
437
+ const cap = resolveRetentionCap("MAX_SKILL_CHANGELOG_GLOBAL_ENTRIES", MAX_SKILL_CHANGELOG_GLOBAL_ENTRIES);
438
+ let files;
439
+ try {
440
+ files = (await readdir2(dirPath)).filter((name) => name.endsWith(".jsonl"));
441
+ } catch {
442
+ return;
443
+ }
444
+ const linesByFile = new Map;
445
+ const stamped = [];
446
+ for (const file of files) {
447
+ let content;
448
+ try {
449
+ content = await readFile2(path2.join(dirPath, file), "utf-8");
450
+ } catch {
451
+ continue;
452
+ }
427
453
  const lines = content.split(`
428
454
  `).filter((line) => line.trim().length > 0);
429
- if (lines.length > MAX_CHANGELOG_ENTRIES_PER_SKILL) {
430
- const trimmed = lines.slice(lines.length - MAX_CHANGELOG_ENTRIES_PER_SKILL);
431
- await writeFile2(filePath, `${trimmed.join(`
432
- `)}
433
- `, "utf-8");
455
+ linesByFile.set(file, lines);
456
+ for (let i = 0;i < lines.length; i++) {
457
+ let timestamp = "";
458
+ try {
459
+ const parsed = JSON.parse(lines[i]);
460
+ if (typeof parsed.timestamp === "string")
461
+ timestamp = parsed.timestamp;
462
+ } catch {}
463
+ stamped.push({ file, index: i, timestamp });
434
464
  }
465
+ }
466
+ if (stamped.length <= cap)
467
+ return;
468
+ stamped.sort((a, b) => {
469
+ if (a.timestamp !== b.timestamp) {
470
+ return a.timestamp < b.timestamp ? -1 : 1;
471
+ }
472
+ if (a.file !== b.file)
473
+ return a.file < b.file ? -1 : 1;
474
+ return a.index - b.index;
475
+ });
476
+ const drop = new Set;
477
+ for (let i = 0;i < stamped.length - cap; i++) {
478
+ const item = stamped[i];
479
+ drop.add(`${item.file}\x00${item.index}`);
480
+ }
481
+ for (const [file, lines] of linesByFile) {
482
+ const kept = lines.filter((_, index) => !drop.has(`${file}\x00${index}`));
483
+ if (kept.length === lines.length)
484
+ continue;
485
+ const filePath = path2.join(dirPath, file);
486
+ if (kept.length === 0) {
487
+ await unlink(filePath).catch(() => {});
488
+ continue;
489
+ }
490
+ await rewriteLinesAtomically(filePath, kept);
491
+ }
492
+ }
493
+ async function appendSkillChangelog(directory, slug, entry) {
494
+ const filePath = resolveSkillChangelogPath(directory, slug);
495
+ await appendCappedJsonl(filePath, JSON.stringify(entry), {
496
+ maxEntries: resolveRetentionCap("MAX_SKILL_CHANGELOG_ENTRIES_PER_SKILL", MAX_SKILL_CHANGELOG_ENTRIES_PER_SKILL)
497
+ });
498
+ try {
499
+ await enforceGlobalEntryCap(path2.dirname(filePath));
435
500
  } catch (err) {
436
- warn(`[skill-changelog] FIFO trim failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`);
501
+ warn(`[skill-changelog] global ceiling enforcement failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`);
437
502
  }
438
503
  }
439
504
 
@@ -442,8 +507,8 @@ import { createHash } from "crypto";
442
507
  import { existsSync } from "fs";
443
508
  import {
444
509
  lstat as lstat2,
445
- mkdir as mkdir3,
446
- readdir as readdir2,
510
+ mkdir as mkdir2,
511
+ readdir as readdir3,
447
512
  readFile as readFile3,
448
513
  realpath,
449
514
  stat as stat2
@@ -559,7 +624,7 @@ async function loadEvalSet(directory, slug) {
559
624
  }
560
625
  let entries;
561
626
  try {
562
- entries = await readdir2(root);
627
+ entries = await readdir3(root);
563
628
  } catch (err) {
564
629
  return {
565
630
  status: "invalid",
@@ -760,7 +825,7 @@ async function evaluateSkillChange(req) {
760
825
  };
761
826
  }
762
827
  async function atomicWrite(filePath, content) {
763
- await mkdir3(path3.dirname(filePath), { recursive: true });
828
+ await mkdir2(path3.dirname(filePath), { recursive: true });
764
829
  await atomicWriteSwarmFile(filePath, content);
765
830
  }
766
831
  async function appendRejectedSkillEdit(req, evaluation) {
@@ -871,7 +936,7 @@ async function writeEvalStub(directory, slug, cases) {
871
936
  return { written: false, path: stubPath, reason: "no directive fields" };
872
937
  }
873
938
  try {
874
- await mkdir4(path4.dirname(stubPath), { recursive: true });
939
+ await mkdir3(path4.dirname(stubPath), { recursive: true });
875
940
  await atomicWrite2(stubPath, `${JSON.stringify({ cases })}
876
941
  `);
877
942
  return { written: true, path: stubPath };
@@ -1106,7 +1171,7 @@ function escapeMarkdown(s) {
1106
1171
  return s.replace(/[\r\n]+/g, " ").slice(0, 280);
1107
1172
  }
1108
1173
  async function atomicWrite2(p, content) {
1109
- await mkdir4(path4.dirname(p), { recursive: true });
1174
+ await mkdir3(path4.dirname(p), { recursive: true });
1110
1175
  await atomicWriteFileAnyRoot(p, content);
1111
1176
  }
1112
1177
  async function generateSkills(req) {
@@ -1864,7 +1929,7 @@ async function retireSkill(directory, slug, reason) {
1864
1929
  retiredAt: new Date().toISOString(),
1865
1930
  reason: reason ?? "manual_retire"
1866
1931
  });
1867
- await mkdir4(markerDir, { recursive: true });
1932
+ await mkdir3(markerDir, { recursive: true });
1868
1933
  await writeFile3(markerPath, markerContent, "utf-8");
1869
1934
  let clearedLinks = [];
1870
1935
  try {
@@ -1954,13 +2019,13 @@ async function clearSkillLinks(directory, skillFilePath, slug, mode) {
1954
2019
  return cleared;
1955
2020
  }
1956
2021
  async function markSkillStale(skillDir, reason) {
1957
- await mkdir4(skillDir, { recursive: true });
2022
+ await mkdir3(skillDir, { recursive: true });
1958
2023
  await writeFile3(path4.join(skillDir, "stale.marker"), reason, "utf-8");
1959
2024
  }
1960
2025
  async function clearSkillStale(skillDir) {
1961
2026
  const markerPath = path4.join(skillDir, "stale.marker");
1962
2027
  try {
1963
- await unlink(markerPath);
2028
+ await unlink2(markerPath);
1964
2029
  } catch (err) {
1965
2030
  if (err instanceof Error && "code" in err && err.code === "ENOENT") {
1966
2031
  return;
@@ -2,15 +2,19 @@
2
2
  import {
3
3
  cohortConfigFingerprint
4
4
  } from "./index-rtry5xyf.js";
5
+ import {
6
+ appendCappedJsonl,
7
+ resolveRetentionCap
8
+ } from "./index-vzm6zre7.js";
5
9
  import {
6
10
  isLinked,
7
11
  readLinkPointer,
8
12
  resolveKnowledgeStoreDir,
9
13
  resolveLinkDir
10
- } from "./index-14z9en94.js";
14
+ } from "./index-t8tw1bhs.js";
11
15
 
12
16
  // src/knowledge/curation-policy.ts
13
- import { appendFile, mkdir as mkdir2, readFile as readFile2 } from "fs/promises";
17
+ import { readFile as readFile2 } from "fs/promises";
14
18
  import * as path2 from "path";
15
19
 
16
20
  // src/knowledge/worktree-identity.ts
@@ -85,6 +89,7 @@ async function resolveWorktreeId(directory) {
85
89
 
86
90
  // src/knowledge/curation-policy.ts
87
91
  var DEFAULT_QUORUM = { minCohortEvidence: 3 };
92
+ var MAX_CURATION_PROPOSALS = 200;
88
93
  async function authorizeCuration(input, context, quorum = DEFAULT_QUORUM) {
89
94
  const { directory, action, entryId } = input;
90
95
  const proposal = {
@@ -99,9 +104,9 @@ async function authorizeCuration(input, context, quorum = DEFAULT_QUORUM) {
99
104
  queueMicrotask(async () => {
100
105
  try {
101
106
  const storeDir = _internals2.resolveKnowledgeStoreDir(directory);
102
- await mkdir2(storeDir, { recursive: true });
103
- await appendFile(path2.join(storeDir, "curation-proposals.jsonl"), `${JSON.stringify(p)}
104
- `, "utf-8");
107
+ await appendCappedJsonl(path2.join(storeDir, "curation-proposals.jsonl"), JSON.stringify(p), {
108
+ maxEntries: resolveRetentionCap("MAX_CURATION_PROPOSALS", MAX_CURATION_PROPOSALS)
109
+ });
105
110
  } catch {}
106
111
  });
107
112
  };
@@ -241,4 +246,4 @@ var _internals2 = {
241
246
  resolveKnowledgeStoreDir
242
247
  };
243
248
 
244
- export { authorizeCuration, buildConfigFingerprintInput, readCohortConfigFingerprint, _internals2 as _internals };
249
+ export { MAX_CURATION_PROPOSALS, authorizeCuration, buildConfigFingerprintInput, readCohortConfigFingerprint, _internals2 as _internals };
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-n4fzmqz8.js";
8
8
  import {
9
9
  atomicWriteSwarmFileSync
10
- } from "./index-19hjpqsy.js";
10
+ } from "./index-m21x1bkx.js";
11
11
  import {
12
12
  canonicalRootKeyFresh,
13
13
  lexicalRootAliasKey
@@ -7,7 +7,7 @@ import {
7
7
  readCachedTextFile,
8
8
  wasObservedToExist,
9
9
  wasRecentlyWrittenByThisProcess
10
- } from "./index-19hjpqsy.js";
10
+ } from "./index-m21x1bkx.js";
11
11
  import {
12
12
  SwarmError
13
13
  } from "./index-ee6ydtfe.js";
@@ -21,7 +21,7 @@ var package_default;
21
21
  var init_package = __esm(() => {
22
22
  package_default = {
23
23
  name: "opencode-swarm",
24
- version: "7.166.2",
24
+ version: "7.166.4",
25
25
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
26
26
  main: "dist/index.js",
27
27
  types: "dist/index.d.ts",
@@ -320,7 +320,7 @@ function resolveExternalSkillsConfig(input) {
320
320
  };
321
321
  return merged;
322
322
  }
323
- var _internals, SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX = 3, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_SECTION_SCHEMAS, GateConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GATE_CONFIG_READERS, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewFinalConfigSchema, AutoReviewConfigObjectSchema, AutoReviewConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, GitConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, INVALID_CHECKPOINT_PROTO_FIELD = "__swarm_invalid_checkpoint_proto__", FORBIDDEN_CHECKPOINT_CONFIG_KEYS, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationAudienceSchema, SkillPropagationConfigSchema, HarnessRelativePathSchema, HarnessEvolutionConfigSchema, DEFAULT_HARNESS_EVOLUTION_CONFIG, SkillImproverConfigSchema, SkillsConfigSchema, SkillOptConfigSchema, DEFAULT_SKILL_OPT_CONFIG, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, DEFAULT_PR_REVIEW_RESILIENCE_CONFIG, PrReviewResilienceConfigSchema, DEFAULT_PR_REVIEW_LEGACY_TRANSCRIPT_COMPATIBILITY = false, PluginConfigSchema;
323
+ var _internals, SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX = 3, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_SECTION_SCHEMAS, GateConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GATE_CONFIG_READERS, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, RetentionConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewFinalConfigSchema, AutoReviewConfigObjectSchema, AutoReviewConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, GitConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, INVALID_CHECKPOINT_PROTO_FIELD = "__swarm_invalid_checkpoint_proto__", FORBIDDEN_CHECKPOINT_CONFIG_KEYS, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationAudienceSchema, SkillPropagationConfigSchema, HarnessRelativePathSchema, HarnessEvolutionConfigSchema, DEFAULT_HARNESS_EVOLUTION_CONFIG, SkillImproverConfigSchema, SkillsConfigSchema, SkillOptConfigSchema, DEFAULT_SKILL_OPT_CONFIG, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, DEFAULT_PR_REVIEW_RESILIENCE_CONFIG, PrReviewResilienceConfigSchema, DEFAULT_PR_REVIEW_LEGACY_TRANSCRIPT_COMPATIBILITY = false, PluginConfigSchema;
324
324
  var init_schema = __esm(() => {
325
325
  init_zod();
326
326
  init_package();
@@ -519,6 +519,10 @@ var init_schema = __esm(() => {
519
519
  retention_days: exports_external.number().min(1).max(365).default(7),
520
520
  exempt_tools: exports_external.array(exports_external.string()).default([...SUMMARIZER_EXEMPT_TOOL_NAMES])
521
521
  });
522
+ RetentionConfigSchema = exports_external.object({
523
+ enabled: exports_external.boolean().default(true),
524
+ dry_run: exports_external.boolean().default(false)
525
+ }).prefault({});
522
526
  ReviewPassesConfigSchema = exports_external.object({
523
527
  always_security_review: exports_external.boolean().default(false),
524
528
  security_globs: exports_external.array(exports_external.string()).default([
@@ -1684,6 +1688,7 @@ var init_schema = __esm(() => {
1684
1688
  repo_graph: RepoGraphConfigSchema.prefault({}).describe("Repository dependency-graph settings (builder excludes, incremental refresh). Nested defaults materialize when the whole section is omitted."),
1685
1689
  evidence: EvidenceConfigSchema.optional().describe("Evidence retention and storage settings."),
1686
1690
  summaries: SummaryConfigSchema.optional().describe("Summary generation settings."),
1691
+ retention: RetentionConfigSchema.describe("Retention sweep settings (issue #2483)."),
1687
1692
  review_passes: ReviewPassesConfigSchema.optional().describe("Dual-pass security review settings."),
1688
1693
  adversarial_detection: AdversarialDetectionConfigSchema.optional().describe("Same-model adversarial checker detection settings."),
1689
1694
  adversarial_testing: AdversarialTestingConfigSchema.optional().describe("Cross-model adversarial testing settings."),
@@ -1897,4 +1902,4 @@ var init_schema = __esm(() => {
1897
1902
  });
1898
1903
  });
1899
1904
 
1900
- export { init_package, package_default, DEFAULT_MODEL_CONTEXT_TOKENS, init_context_window, _internals, isKnownCanonicalRole, getCanonicalAgentRole, resolveGeneratedAgentRole, stripKnownSwarmPrefix, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_SECTION_SCHEMAS, GateConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GATE_CONFIG_READERS, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewConfigSchema, resolveAutoReviewConfig, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, GitConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, resolveGuardrailsConfig, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, HarnessEvolutionConfigSchema, DEFAULT_HARNESS_EVOLUTION_CONFIG, SkillImproverConfigSchema, SkillsConfigSchema, SkillOptConfigSchema, DEFAULT_SKILL_OPT_CONFIG, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, resolveExternalSkillsConfig, DEFAULT_PR_REVIEW_RESILIENCE_CONFIG, PrReviewResilienceConfigSchema, DEFAULT_PR_REVIEW_LEGACY_TRANSCRIPT_COMPATIBILITY, PluginConfigSchema, init_schema };
1905
+ export { init_package, package_default, DEFAULT_MODEL_CONTEXT_TOKENS, init_context_window, _internals, isKnownCanonicalRole, getCanonicalAgentRole, resolveGeneratedAgentRole, stripKnownSwarmPrefix, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_SECTION_SCHEMAS, GateConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GATE_CONFIG_READERS, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, RetentionConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewConfigSchema, resolveAutoReviewConfig, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, GitConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, resolveGuardrailsConfig, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, HarnessEvolutionConfigSchema, DEFAULT_HARNESS_EVOLUTION_CONFIG, SkillImproverConfigSchema, SkillsConfigSchema, SkillOptConfigSchema, DEFAULT_SKILL_OPT_CONFIG, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, resolveExternalSkillsConfig, DEFAULT_PR_REVIEW_RESILIENCE_CONFIG, PrReviewResilienceConfigSchema, DEFAULT_PR_REVIEW_LEGACY_TRANSCRIPT_COMPATIBILITY, PluginConfigSchema, init_schema };
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  init_loader,
4
4
  loadPluginConfigWithMeta
5
- } from "./index-0a0jsbhg.js";
5
+ } from "./index-9eswrdp5.js";
6
6
  import {
7
7
  init_schema
8
- } from "./index-e0bjbadr.js";
8
+ } from "./index-shqhq68n.js";
9
9
  import {
10
10
  DEFAULT_WORKTREE_ISOLATION_CONFIG,
11
11
  init_constants
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  atomicWriteFile
4
- } from "./index-sxe3t040.js";
4
+ } from "./index-2w0beg3s.js";
5
5
  import {
6
6
  canonicalRootKeyFresh
7
7
  } from "./index-7qefgq4j.js";
@@ -2,20 +2,20 @@
2
2
  import {
3
3
  derivePlanId,
4
4
  derivePlanIdentityHash
5
- } from "./index-7pp8fz4j.js";
5
+ } from "./index-6d4dc99f.js";
6
6
  import {
7
7
  assertProjectRoot,
8
8
  withEvidenceLock
9
- } from "./index-sxe3t040.js";
9
+ } from "./index-2w0beg3s.js";
10
10
  import {
11
11
  emit
12
- } from "./index-bks56jbg.js";
12
+ } from "./index-f6zgz02s.js";
13
13
  import {
14
14
  ExecutionProfileSchema,
15
15
  PlanSchema,
16
16
  TaskStatusSchema,
17
17
  init_loader
18
- } from "./index-0a0jsbhg.js";
18
+ } from "./index-9eswrdp5.js";
19
19
  import {
20
20
  criticalWarn,
21
21
  init_logger,
@@ -0,0 +1,167 @@
1
+ // @bun
2
+ // src/retention/caps.ts
3
+ var overrides = new Map;
4
+ function resolveRetentionCap(name, defaultValue) {
5
+ const override = overrides.get(name);
6
+ if (override !== undefined && Number.isFinite(override) && override >= 1) {
7
+ return override;
8
+ }
9
+ return defaultValue;
10
+ }
11
+
12
+ // src/retention/jsonl-cap.ts
13
+ import * as fs from "fs";
14
+ import * as path from "path";
15
+ var RENAME_MAX_ATTEMPTS = 4;
16
+ var RENAME_RETRY_DELAY_MS = 50;
17
+ var appendChains = new Map;
18
+ function withFileLock(filePath, task) {
19
+ const key = path.resolve(filePath);
20
+ const tail = appendChains.get(key) ?? Promise.resolve();
21
+ const run = tail.then(task, task);
22
+ const settled = run.then(() => {
23
+ if ((appendChains.get(key) ?? settled) === settled) {
24
+ appendChains.delete(key);
25
+ }
26
+ }, () => {
27
+ if ((appendChains.get(key) ?? settled) === settled) {
28
+ appendChains.delete(key);
29
+ }
30
+ });
31
+ appendChains.set(key, settled);
32
+ return run;
33
+ }
34
+ function sleep(ms) {
35
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
36
+ }
37
+ async function renameWithRetry(from, to) {
38
+ let lastError;
39
+ for (let attempt = 1;attempt <= RENAME_MAX_ATTEMPTS; attempt++) {
40
+ try {
41
+ await fs.promises.rename(from, to);
42
+ return;
43
+ } catch (error) {
44
+ lastError = error;
45
+ const code = typeof error === "object" && error !== null && "code" in error ? String(error.code) : "";
46
+ if (code !== "EBUSY" && code !== "EPERM" && code !== "EEXIST" && code !== "ENOTEMPTY") {
47
+ throw error;
48
+ }
49
+ if (attempt < RENAME_MAX_ATTEMPTS) {
50
+ await sleep(RENAME_RETRY_DELAY_MS);
51
+ }
52
+ }
53
+ }
54
+ throw lastError instanceof Error ? lastError : new Error(String(lastError));
55
+ }
56
+ function wholeLines(content) {
57
+ return content.split(`
58
+ `).map((line) => line.trim()).filter((line) => line.length > 0);
59
+ }
60
+ function selectCompactionSurvivors(lines, opts) {
61
+ const kept = [];
62
+ let keptBytes = 0;
63
+ for (let i = lines.length - 1;i >= 0; i--) {
64
+ if (kept.length >= opts.maxEntries)
65
+ break;
66
+ const line = lines[i];
67
+ const lineBytes = Buffer.byteLength(`${line}
68
+ `, "utf-8");
69
+ if (kept.length > 0 && opts.maxBytes !== undefined && keptBytes + lineBytes > opts.maxBytes) {
70
+ break;
71
+ }
72
+ kept.unshift(line);
73
+ keptBytes += lineBytes;
74
+ }
75
+ return kept;
76
+ }
77
+ async function appendAndCap(filePath, line, opts) {
78
+ const directory = path.dirname(filePath);
79
+ fs.mkdirSync(directory, { recursive: true });
80
+ const record = `${line.trim()}
81
+ `;
82
+ let existing = "";
83
+ try {
84
+ existing = await fs.promises.readFile(filePath, "utf-8");
85
+ } catch {}
86
+ const lines = wholeLines(existing);
87
+ const combined = [...lines, line.trim()];
88
+ const survivors = selectCompactionSurvivors(combined, opts);
89
+ const dropped = combined.length - survivors.length;
90
+ if (dropped > 0) {
91
+ const compactedLines = combined.slice(dropped, combined.length - 1);
92
+ const compacted = compactedLines.length > 0 ? `${compactedLines.join(`
93
+ `)}
94
+ ` : "";
95
+ const tmp = path.join(directory, `.${path.basename(filePath)}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 8)}`);
96
+ fs.writeFileSync(tmp, compacted, "utf-8");
97
+ try {
98
+ await renameWithRetry(tmp, filePath);
99
+ } catch (error) {
100
+ try {
101
+ fs.unlinkSync(tmp);
102
+ } catch {}
103
+ throw error instanceof Error ? error : new Error(String(error));
104
+ }
105
+ if (opts.onPrune) {
106
+ try {
107
+ opts.onPrune(dropped);
108
+ } catch {}
109
+ }
110
+ }
111
+ await fs.promises.appendFile(filePath, record, "utf-8");
112
+ }
113
+ async function appendCappedJsonl(filePath, line, opts) {
114
+ return withFileLock(filePath, () => appendAndCap(filePath, line, opts));
115
+ }
116
+ async function readTailInternal(filePath, opts) {
117
+ let content;
118
+ let tailTruncated = false;
119
+ try {
120
+ if (opts.maxBytes !== undefined) {
121
+ const stat = await fs.promises.stat(filePath);
122
+ if (stat.size > opts.maxBytes) {
123
+ const handle = await fs.promises.open(filePath, "r");
124
+ try {
125
+ const start = Math.max(0, stat.size - opts.maxBytes);
126
+ const buf = Buffer.alloc(opts.maxBytes);
127
+ await handle.read(buf, 0, opts.maxBytes, start);
128
+ content = buf.toString("utf-8");
129
+ } finally {
130
+ await handle.close();
131
+ }
132
+ const firstNewline = content.indexOf(`
133
+ `);
134
+ if (firstNewline >= 0)
135
+ content = content.slice(firstNewline + 1);
136
+ } else {
137
+ content = await fs.promises.readFile(filePath, "utf-8");
138
+ }
139
+ } else {
140
+ content = await fs.promises.readFile(filePath, "utf-8");
141
+ }
142
+ } catch {
143
+ return { records: [], tailTruncated: false };
144
+ }
145
+ if (content.length > 0 && !content.endsWith(`
146
+ `)) {
147
+ tailTruncated = true;
148
+ }
149
+ const lines = wholeLines(content);
150
+ const take = opts.maxEntries !== undefined ? lines.slice(-opts.maxEntries) : lines;
151
+ const records = [];
152
+ for (const line of take) {
153
+ try {
154
+ records.push(JSON.parse(line));
155
+ } catch {}
156
+ }
157
+ return { records, tailTruncated };
158
+ }
159
+ async function readTailJsonl(filePath, opts) {
160
+ const { records } = await readTailInternal(filePath, opts);
161
+ return records;
162
+ }
163
+ async function readTailJsonlDetailed(filePath, opts) {
164
+ return readTailInternal(filePath, opts);
165
+ }
166
+
167
+ export { resolveRetentionCap, appendCappedJsonl, readTailJsonl, readTailJsonlDetailed };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-c23w8t46.js";
4
+ } from "./index-qww0h314.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,13 +9,13 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-22sannyk.js";
12
+ } from "./index-3s194swm.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
- } from "./index-14z9en94.js";
15
+ } from "./index-t8tw1bhs.js";
16
16
  import {
17
17
  atomicWriteFile
18
- } from "./index-sxe3t040.js";
18
+ } from "./index-2w0beg3s.js";
19
19
  import {
20
20
  require_proper_lockfile
21
21
  } from "./index-7g4c7s5r.js";