opencode-swarm 7.121.4 → 7.122.0

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 (37) hide show
  1. package/dist/cli/{curation-policy-10wnhpwn.js → curation-policy-cj1tpzr5.js} +2 -2
  2. package/dist/cli/{curator-3azybqrw.js → curator-3rze3pd4.js} +8 -8
  3. package/dist/cli/{curator-llm-factory-6rafny5e.js → curator-llm-factory-8rg0f77t.js} +8 -8
  4. package/dist/cli/{guardrail-explain-d1m747g5.js → guardrail-explain-hdsxa2c5.js} +9 -9
  5. package/dist/cli/{hive-promoter-4xnj3fdk.js → hive-promoter-dh38qd9m.js} +8 -8
  6. package/dist/cli/{index-5a3xsnzg.js → index-3r1w7xky.js} +1 -1
  7. package/dist/cli/{index-35xyj7gn.js → index-3sx27bxt.js} +26 -3
  8. package/dist/cli/{index-982hhpcm.js → index-68aggz0v.js} +1 -1
  9. package/dist/cli/{index-q0fv0xec.js → index-ahxrne50.js} +143 -84
  10. package/dist/cli/{index-x4fwtd59.js → index-gr7ssnj9.js} +3 -3
  11. package/dist/cli/{index-db82jxt7.js → index-j33zb3cx.js} +2 -2
  12. package/dist/cli/{index-2k6z335c.js → index-jzpv74mq.js} +9 -9
  13. package/dist/cli/{index-0f800qg7.js → index-ny13nr0x.js} +2 -2
  14. package/dist/cli/{index-j8349ac0.js → index-rkd6qwjh.js} +1 -1
  15. package/dist/cli/{index-ft6jw816.js → index-xdsj4qtd.js} +3 -3
  16. package/dist/cli/index.js +8 -8
  17. package/dist/cli/{knowledge-escalator-8ajq1fhb.js → knowledge-escalator-sya06p12.js} +3 -3
  18. package/dist/cli/{knowledge-events-2sjy3aa7.js → knowledge-events-xzps61a9.js} +3 -1
  19. package/dist/cli/{knowledge-store-27cesthc.js → knowledge-store-qg66a93n.js} +1 -1
  20. package/dist/cli/{knowledge-validator-9keh3p8j.js → knowledge-validator-gar6wv4f.js} +4 -4
  21. package/dist/cli/{scan-cursor-qmsmmg1b.js → scan-cursor-nx5y5k7r.js} +2 -2
  22. package/dist/cli/{skill-generator-hkyxdc3j.js → skill-generator-nt5qxafq.js} +5 -5
  23. package/dist/hooks/cohort-cache.d.ts +44 -0
  24. package/dist/hooks/hive-promoter.d.ts +4 -3
  25. package/dist/hooks/host-boundary.d.ts +147 -0
  26. package/dist/hooks/incremental-verify.d.ts +3 -0
  27. package/dist/hooks/knowledge-events.d.ts +25 -2
  28. package/dist/hooks/knowledge-injector.d.ts +9 -1
  29. package/dist/hooks/knowledge-receipt-validator.d.ts +98 -0
  30. package/dist/hooks/micro-reflector.d.ts +3 -0
  31. package/dist/hooks/pr-auto-subscribe.d.ts +3 -0
  32. package/dist/hooks/promotion-evidence-store.d.ts +33 -0
  33. package/dist/index.js +237 -230
  34. package/dist/services/knowledge-diagnostics.d.ts +12 -0
  35. package/dist/session/snapshot-writer.d.ts +5 -0
  36. package/dist/state.d.ts +11 -0
  37. package/package.json +1 -1
@@ -95,15 +95,15 @@ import {
95
95
  retireSkill,
96
96
  selectCandidateEntries,
97
97
  syncBundledProjectSkillsIfMissingAsync
98
- } from "./index-x4fwtd59.js";
98
+ } from "./index-gr7ssnj9.js";
99
99
  import {
100
100
  readRecentEscalations
101
- } from "./index-ft6jw816.js";
101
+ } from "./index-xdsj4qtd.js";
102
102
  import {
103
103
  alreadyCuratedThisGeneration,
104
104
  claimNextScanBatch,
105
105
  resolveCohortId
106
- } from "./index-j8349ac0.js";
106
+ } from "./index-rkd6qwjh.js";
107
107
  import {
108
108
  CURATOR_INIT_PROMPT,
109
109
  CURATOR_PHASE_PROMPT,
@@ -136,11 +136,11 @@ import {
136
136
  validateActionability,
137
137
  validateActionableFields,
138
138
  validateLesson
139
- } from "./index-db82jxt7.js";
139
+ } from "./index-j33zb3cx.js";
140
140
  import {
141
141
  authorizeCuration,
142
142
  buildConfigFingerprintInput
143
- } from "./index-5a3xsnzg.js";
143
+ } from "./index-3r1w7xky.js";
144
144
  import {
145
145
  cohortConfigFingerprint
146
146
  } from "./index-rtry5xyf.js";
@@ -170,7 +170,7 @@ import {
170
170
  transactFile,
171
171
  transactKnowledge,
172
172
  wordBigrams
173
- } from "./index-0f800qg7.js";
173
+ } from "./index-ny13nr0x.js";
174
174
  import {
175
175
  MAX_EVENT_LOG_ENTRIES,
176
176
  _internals,
@@ -180,7 +180,7 @@ import {
180
180
  recordHiveKnowledgeEvent,
181
181
  recordKnowledgeEvent,
182
182
  resolveKnowledgeEventsPath
183
- } from "./index-35xyj7gn.js";
183
+ } from "./index-3sx27bxt.js";
184
184
  import {
185
185
  resolveHiveDataDir,
186
186
  resolveHiveEventsPath,
@@ -9858,7 +9858,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
9858
9858
  }
9859
9859
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
9860
9860
  try {
9861
- const skillModule = await import("./skill-generator-hkyxdc3j.js");
9861
+ const skillModule = await import("./skill-generator-nt5qxafq.js");
9862
9862
  for (const cand of skillCandidates) {
9863
9863
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
9864
9864
  continue;
@@ -10195,7 +10195,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
10195
10195
  } catch {}
10196
10196
  }
10197
10197
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
10198
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-8ajq1fhb.js");
10198
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-sya06p12.js");
10199
10199
  for (const { id } of contradictedEntries) {
10200
10200
  try {
10201
10201
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -10993,7 +10993,7 @@ async function runCuratorPostMortem(directory, options = {}) {
10993
10993
  warnings.push("Failed to collect knowledge summary.");
10994
10994
  }
10995
10995
  try {
10996
- const { getScanStatus } = await import("./scan-cursor-qmsmmg1b.js");
10996
+ const { getScanStatus } = await import("./scan-cursor-nx5y5k7r.js");
10997
10997
  const scanStatus = await getScanStatus(directory);
10998
10998
  if (scanStatus.remaining_estimate > 0) {
10999
10999
  warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
@@ -11175,11 +11175,11 @@ var _internals16 = {
11175
11175
  }
11176
11176
  },
11177
11177
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
11178
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-3azybqrw.js");
11178
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-3rze3pd4.js");
11179
11179
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
11180
11180
  },
11181
11181
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
11182
- const { checkHivePromotions } = await import("./hive-promoter-4xnj3fdk.js");
11182
+ const { checkHivePromotions } = await import("./hive-promoter-dh38qd9m.js");
11183
11183
  return checkHivePromotions(entries, knowledgeConfig, directory);
11184
11184
  },
11185
11185
  applyProposalTriage: async (directory, triage) => {
@@ -11188,7 +11188,7 @@ var _internals16 = {
11188
11188
  activateProposal,
11189
11189
  listSkills: listSkills2,
11190
11190
  sanitizeSlug
11191
- } = await import("./skill-generator-hkyxdc3j.js");
11191
+ } = await import("./skill-generator-nt5qxafq.js");
11192
11192
  const result = {
11193
11193
  approved: [],
11194
11194
  rejected: [],
@@ -11429,6 +11429,54 @@ var _internals17 = {
11429
11429
  path: path19
11430
11430
  };
11431
11431
 
11432
+ // src/hooks/promotion-evidence-store.ts
11433
+ import {
11434
+ appendFile as appendFile3,
11435
+ mkdir as mkdir7,
11436
+ readFile as readFile6,
11437
+ rename as rename4,
11438
+ writeFile as writeFile5
11439
+ } from "fs/promises";
11440
+ init_logger();
11441
+ function resolvePromotionEvidencePath(directory) {
11442
+ return validateSwarmPath(directory, "knowledge-promotion-evidence.jsonl");
11443
+ }
11444
+ function parseRecord(line) {
11445
+ try {
11446
+ const o = JSON.parse(line);
11447
+ if (typeof o.cohort_id === "string" && typeof o.entry_id === "string" && typeof o.retrieval_trace_id === "string" && (o.receipt_outcome === "applied" || o.receipt_outcome === "violated" || o.receipt_outcome === "contradicted") && typeof o.receipt_event_id === "string" && typeof o.timestamp === "string") {
11448
+ return o;
11449
+ }
11450
+ } catch {}
11451
+ return null;
11452
+ }
11453
+ async function loadPromotionEvidenceByEntry(directory) {
11454
+ const filePath = resolvePromotionEvidencePath(directory);
11455
+ let content;
11456
+ try {
11457
+ content = await readFile6(filePath, "utf-8");
11458
+ } catch {
11459
+ return {};
11460
+ }
11461
+ const out = {};
11462
+ for (const line of content.split(`
11463
+ `)) {
11464
+ const trimmed = line.trim();
11465
+ if (!trimmed)
11466
+ continue;
11467
+ const rec = parseRecord(trimmed);
11468
+ if (!rec)
11469
+ continue;
11470
+ const bucket = out[rec.entry_id];
11471
+ if (bucket) {
11472
+ bucket.push(rec);
11473
+ } else {
11474
+ out[rec.entry_id] = [rec];
11475
+ }
11476
+ }
11477
+ return out;
11478
+ }
11479
+
11432
11480
  // src/hooks/hive-promoter.ts
11433
11481
  function carryActionableFields(source) {
11434
11482
  const out = {};
@@ -11537,7 +11585,7 @@ async function checkHivePromotions(swarmEntries, config, directory) {
11537
11585
  return empty;
11538
11586
  }
11539
11587
  const sourceCohort = await _internals18.resolveCohortId(directory);
11540
- const evidence = await _internals18.loadPromotionEvidence(swarmEntries);
11588
+ const evidence = await _internals18.loadPromotionEvidence(directory);
11541
11589
  const diagnostics = [];
11542
11590
  const activeSwarm = swarmEntries.filter((e) => isActiveStatus(e.status));
11543
11591
  const activeSwarmBigrams = activeSwarm.map((e) => typeof e.lesson === "string" ? wordBigrams(e.lesson) : new Set);
@@ -11844,7 +11892,7 @@ var _internals18 = {
11844
11892
  transactHiveStore,
11845
11893
  validateLesson,
11846
11894
  authorizeCuration,
11847
- loadPromotionEvidence: async (_swarmEntries) => ({}),
11895
+ loadPromotionEvidence: async (directory) => loadPromotionEvidenceByEntry(directory),
11848
11896
  loadDefaultKnowledgeConfig: () => KnowledgeConfigSchema.parse({})
11849
11897
  };
11850
11898
  function createHivePromoterHook(directory, config) {
@@ -12091,23 +12139,23 @@ async function promoteFromSwarm(directory, lessonId, options, config) {
12091
12139
  import { createHash as createHash5 } from "crypto";
12092
12140
  import { existsSync as existsSync13 } from "fs";
12093
12141
  import {
12094
- appendFile as appendFile3,
12095
- mkdir as mkdir8,
12096
- readFile as readFile8,
12142
+ appendFile as appendFile4,
12143
+ mkdir as mkdir9,
12144
+ readFile as readFile9,
12097
12145
  realpath,
12098
- writeFile as writeFile7
12146
+ writeFile as writeFile8
12099
12147
  } from "fs/promises";
12100
12148
  import * as path25 from "path";
12101
12149
 
12102
12150
  // src/services/synonym-map.ts
12103
12151
  var import_proper_lockfile3 = __toESM(require_proper_lockfile(), 1);
12104
12152
  import {
12105
- mkdir as mkdir7,
12106
- readFile as readFile6,
12107
- rename as rename4,
12153
+ mkdir as mkdir8,
12154
+ readFile as readFile7,
12155
+ rename as rename5,
12108
12156
  stat as stat2,
12109
12157
  unlink,
12110
- writeFile as writeFile5
12158
+ writeFile as writeFile6
12111
12159
  } from "fs/promises";
12112
12160
  import * as path21 from "path";
12113
12161
  var SYNONYM_MAP_FILENAME = "synonym-map.json";
@@ -12257,18 +12305,18 @@ async function readSynonymMap(directory, maxPairs = DEFAULT_MAX_PAIRS) {
12257
12305
  const st = await stat2(filePath);
12258
12306
  if (st.size > ceiling)
12259
12307
  return emptySynonymMap();
12260
- const raw = await readFile6(filePath, "utf-8");
12308
+ const raw = await readFile7(filePath, "utf-8");
12261
12309
  return coerceSynonymMap(JSON.parse(raw), maxPairs);
12262
12310
  } catch {
12263
12311
  return emptySynonymMap();
12264
12312
  }
12265
12313
  }
12266
12314
  async function writeSynonymMapAtomic(filePath, map) {
12267
- await mkdir7(path21.dirname(filePath), { recursive: true });
12315
+ await mkdir8(path21.dirname(filePath), { recursive: true });
12268
12316
  const tmp = `${filePath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
12269
12317
  try {
12270
- await writeFile5(tmp, JSON.stringify(map, null, 2), "utf-8");
12271
- await rename4(tmp, filePath);
12318
+ await writeFile6(tmp, JSON.stringify(map, null, 2), "utf-8");
12319
+ await rename5(tmp, filePath);
12272
12320
  } finally {
12273
12321
  try {
12274
12322
  await unlink(tmp);
@@ -12278,7 +12326,7 @@ async function writeSynonymMapAtomic(filePath, map) {
12278
12326
  async function rebuildSynonymMap(directory, entries, maxPairs = DEFAULT_MAX_PAIRS) {
12279
12327
  const filePath = resolveSynonymMapPath(directory);
12280
12328
  const dir = path21.dirname(filePath);
12281
- await mkdir7(dir, { recursive: true });
12329
+ await mkdir8(dir, { recursive: true });
12282
12330
  let release = null;
12283
12331
  try {
12284
12332
  release = await import_proper_lockfile3.default.lock(dir, {
@@ -12302,10 +12350,13 @@ init_logger();
12302
12350
 
12303
12351
  // src/hooks/micro-reflector.ts
12304
12352
  import { existsSync as existsSync12 } from "fs";
12305
- import { readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
12353
+ import { readFile as readFile8, writeFile as writeFile7 } from "fs/promises";
12306
12354
  import * as path24 from "path";
12307
12355
  init_logger();
12308
12356
 
12357
+ // src/hooks/guardrails/stored-input-args.ts
12358
+ var storedInputArgs = new Map;
12359
+
12309
12360
  // src/hooks/skill-propagation-gate.ts
12310
12361
  import * as fs9 from "fs";
12311
12362
  import * as path23 from "path";
@@ -13607,7 +13658,7 @@ async function readTaskTrajectory(directory, taskId) {
13607
13658
  const filePath = validateSwarmPath(directory, rel);
13608
13659
  if (!existsSync12(filePath))
13609
13660
  return [];
13610
- const content = await readFile7(filePath, "utf-8");
13661
+ const content = await readFile8(filePath, "utf-8");
13611
13662
  const out = [];
13612
13663
  for (const line of content.split(`
13613
13664
  `)) {
@@ -14135,8 +14186,8 @@ RETRY: your last output was missing ${result.missing.join("; ")}; produce valid
14135
14186
  async function appendCuratorSkippedEvent(directory, record) {
14136
14187
  try {
14137
14188
  const filePath = path25.join(directory, ".swarm", "events.jsonl");
14138
- await mkdir8(path25.dirname(filePath), { recursive: true });
14139
- await appendFile3(filePath, `${JSON.stringify({
14189
+ await mkdir9(path25.dirname(filePath), { recursive: true });
14190
+ await appendFile4(filePath, `${JSON.stringify({
14140
14191
  timestamp: new Date().toISOString(),
14141
14192
  event: "curator_skipped",
14142
14193
  entry_id: record.entry_id,
@@ -14178,11 +14229,11 @@ async function consumeInsightCandidates(directory, batchLimit = MESO_INSIGHT_BAT
14178
14229
  if (!existsSync13(filePath))
14179
14230
  return [];
14180
14231
  const consumed = [];
14181
- await transactFile(filePath, async (p) => readInsightJsonl(await readFile8(p, "utf-8").catch(() => "")), async (p, data) => {
14232
+ await transactFile(filePath, async (p) => readInsightJsonl(await readFile9(p, "utf-8").catch(() => "")), async (p, data) => {
14182
14233
  const body = data.length === 0 ? "" : `${data.map((c) => JSON.stringify(c)).join(`
14183
14234
  `)}
14184
14235
  `;
14185
- await writeFile7(p, body, "utf-8");
14236
+ await writeFile8(p, body, "utf-8");
14186
14237
  }, (all) => {
14187
14238
  if (all.length === 0)
14188
14239
  return null;
@@ -15108,12 +15159,12 @@ async function writeSessionReflection(directory, result) {
15108
15159
 
15109
15160
  // src/services/skill-improver.ts
15110
15161
  import { existsSync as existsSync15 } from "fs";
15111
- import { mkdir as mkdir10, readFile as readFile9, rename as rename5, writeFile as writeFile9 } from "fs/promises";
15162
+ import { mkdir as mkdir11, readFile as readFile10, rename as rename6, writeFile as writeFile10 } from "fs/promises";
15112
15163
  import * as path28 from "path";
15113
15164
  init_logger();
15114
15165
 
15115
15166
  // src/services/trajectory-cluster.ts
15116
- import { mkdir as mkdir9, writeFile as writeFile8 } from "fs/promises";
15167
+ import { mkdir as mkdir10, writeFile as writeFile9 } from "fs/promises";
15117
15168
  import * as path27 from "path";
15118
15169
  init_logger();
15119
15170
  var MACRO_TRAJECTORY_WINDOW = 200;
@@ -15247,11 +15298,11 @@ async function writeMotifProposals(directory, opts = {}) {
15247
15298
  return result;
15248
15299
  const max = opts.maxProposals ?? 10;
15249
15300
  const proposalsDir = validateSwarmPath(directory, path27.join("skills", "proposals"));
15250
- await mkdir9(proposalsDir, { recursive: true });
15301
+ await mkdir10(proposalsDir, { recursive: true });
15251
15302
  for (const motif of motifs.slice(0, max)) {
15252
15303
  const slug = `motif-${slugify(motif.signature)}`;
15253
15304
  const filePath = path27.join(proposalsDir, `${slug}.md`);
15254
- await writeFile8(filePath, buildMotifProposal(motif), "utf-8");
15305
+ await writeFile9(filePath, buildMotifProposal(motif), "utf-8");
15255
15306
  result.proposalsWritten.push(filePath);
15256
15307
  }
15257
15308
  return result;
@@ -15392,11 +15443,11 @@ async function writeSuccessMotifProposals(directory, opts = {}) {
15392
15443
  return result;
15393
15444
  const max = opts.maxProposals ?? 10;
15394
15445
  const proposalsDir = validateSwarmPath(directory, path27.join("skills", "proposals"));
15395
- await mkdir9(proposalsDir, { recursive: true });
15446
+ await mkdir10(proposalsDir, { recursive: true });
15396
15447
  for (const motif of motifs.slice(0, max)) {
15397
15448
  const slug = workflowSlug(motif.signature);
15398
15449
  const filePath = path27.join(proposalsDir, `${slug}.md`);
15399
- await writeFile8(filePath, buildWorkflowProposal(motif), "utf-8");
15450
+ await writeFile9(filePath, buildWorkflowProposal(motif), "utf-8");
15400
15451
  result.proposalsWritten.push(filePath);
15401
15452
  }
15402
15453
  return result;
@@ -15518,10 +15569,10 @@ function timestampSlug(d) {
15518
15569
  return d.toISOString().replace(/[:.]/g, "-");
15519
15570
  }
15520
15571
  async function atomicWrite(p, content) {
15521
- await mkdir10(path28.dirname(p), { recursive: true });
15572
+ await mkdir11(path28.dirname(p), { recursive: true });
15522
15573
  const tmp = `${p}.tmp-${process.pid}-${Date.now()}`;
15523
- await writeFile9(tmp, content, "utf-8");
15524
- await rename5(tmp, p);
15574
+ await writeFile10(tmp, content, "utf-8");
15575
+ await rename6(tmp, p);
15525
15576
  }
15526
15577
  async function gatherInventory(directory) {
15527
15578
  const swarm = await readKnowledge(resolveSwarmKnowledgePath(directory));
@@ -15535,7 +15586,7 @@ async function gatherInventory(directory) {
15535
15586
  for (const skill of skills.active) {
15536
15587
  let content;
15537
15588
  try {
15538
- content = await readFile9(skill.path, "utf-8");
15589
+ content = await readFile10(skill.path, "utf-8");
15539
15590
  } catch {
15540
15591
  continue;
15541
15592
  }
@@ -15711,7 +15762,7 @@ async function reconcileStaleActiveSkills(directory, options = {}) {
15711
15762
  for (const skill of skills.active) {
15712
15763
  let content;
15713
15764
  try {
15714
- content = await readFile9(skill.path, "utf-8");
15765
+ content = await readFile10(skill.path, "utf-8");
15715
15766
  } catch {
15716
15767
  continue;
15717
15768
  }
@@ -17878,7 +17929,7 @@ async function handleConfigCommand(directory, _args) {
17878
17929
 
17879
17930
  // src/services/skill-consolidation.ts
17880
17931
  import { existsSync as existsSync19 } from "fs";
17881
- import { mkdir as mkdir11, readFile as readFile10, rename as rename6, writeFile as writeFile10 } from "fs/promises";
17932
+ import { mkdir as mkdir12, readFile as readFile11, rename as rename7, writeFile as writeFile11 } from "fs/promises";
17882
17933
  import * as path33 from "path";
17883
17934
  var DEFAULT_CONSOLIDATION_INTERVAL_HOURS = 24;
17884
17935
  var DEFAULT_CONSOLIDATION_MAX_CALLS_PER_RUN = 1;
@@ -17892,7 +17943,7 @@ async function readState2(directory) {
17892
17943
  if (!existsSync19(filePath))
17893
17944
  return {};
17894
17945
  try {
17895
- const parsed = JSON.parse(await readFile10(filePath, "utf-8"));
17946
+ const parsed = JSON.parse(await readFile11(filePath, "utf-8"));
17896
17947
  if (!parsed || typeof parsed !== "object")
17897
17948
  return {};
17898
17949
  return parsed;
@@ -17901,10 +17952,10 @@ async function readState2(directory) {
17901
17952
  }
17902
17953
  }
17903
17954
  async function atomicWrite2(filePath, content) {
17904
- await mkdir11(path33.dirname(filePath), { recursive: true });
17955
+ await mkdir12(path33.dirname(filePath), { recursive: true });
17905
17956
  const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
17906
- await writeFile10(tmp, content, "utf-8");
17907
- await rename6(tmp, filePath);
17957
+ await writeFile11(tmp, content, "utf-8");
17958
+ await rename7(tmp, filePath);
17908
17959
  }
17909
17960
  async function writeState2(directory, state) {
17910
17961
  await atomicWrite2(consolidationStatePath(directory), `${JSON.stringify(state, null, 2)}
@@ -18191,7 +18242,7 @@ import { promisify as promisify2 } from "util";
18191
18242
  // src/tools/co-change-analyzer.ts
18192
18243
  import * as child_process4 from "child_process";
18193
18244
  import { randomUUID as randomUUID5 } from "crypto";
18194
- import { readdir, readFile as readFile11, stat as stat3 } from "fs/promises";
18245
+ import { readdir, readFile as readFile12, stat as stat3 } from "fs/promises";
18195
18246
  import * as path34 from "path";
18196
18247
  import { promisify } from "util";
18197
18248
  function getExecFileAsync() {
@@ -18318,7 +18369,7 @@ async function getStaticEdges(directory) {
18318
18369
  const sourceFiles = await scanSourceFiles(directory);
18319
18370
  for (const sourceFile of sourceFiles) {
18320
18371
  try {
18321
- const content = await readFile11(sourceFile, "utf-8");
18372
+ const content = await readFile12(sourceFile, "utf-8");
18322
18373
  const importRegex = /(?:import|require)\s*(?:\(?\s*['"`]|.*?from\s+['"`])([^'"`]+)['"`]/g;
18323
18374
  for (let match = importRegex.exec(content);match !== null; match = importRegex.exec(content)) {
18324
18375
  const importPath = match[1].trim();
@@ -18966,8 +19017,8 @@ var _internals29 = {
18966
19017
  loadCuratorDeps: async () => {
18967
19018
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
18968
19019
  import("./schema-vwxpsk6j.js"),
18969
- import("./curator-3azybqrw.js"),
18970
- import("./curator-llm-factory-6rafny5e.js")
19020
+ import("./curator-3rze3pd4.js"),
19021
+ import("./curator-llm-factory-8rg0f77t.js")
18971
19022
  ]);
18972
19023
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
18973
19024
  }
@@ -19465,7 +19516,7 @@ import { fileURLToPath } from "url";
19465
19516
  // package.json
19466
19517
  var package_default = {
19467
19518
  name: "opencode-swarm",
19468
- version: "7.121.4",
19519
+ version: "7.122.0",
19469
19520
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
19470
19521
  main: "dist/index.js",
19471
19522
  types: "dist/index.d.ts",
@@ -19639,7 +19690,7 @@ init_executor();
19639
19690
 
19640
19691
  // src/services/knowledge-diagnostics.ts
19641
19692
  import { existsSync as existsSync21 } from "fs";
19642
- import { readFile as readFile12 } from "fs/promises";
19693
+ import { readFile as readFile13 } from "fs/promises";
19643
19694
  import { join as join32 } from "path";
19644
19695
 
19645
19696
  // src/services/version-check.ts
@@ -19716,7 +19767,7 @@ var INSIGHT_BACKLOG_WARN = 50;
19716
19767
  async function readRawLines(filePath) {
19717
19768
  if (!existsSync21(filePath))
19718
19769
  return { entries: [], corrupt: 0 };
19719
- const content = await readFile12(filePath, "utf-8");
19770
+ const content = await readFile13(filePath, "utf-8");
19720
19771
  const entries = [];
19721
19772
  let corrupt = 0;
19722
19773
  for (const line of content.split(`
@@ -19880,7 +19931,15 @@ async function computeKnowledgeDebug(directory) {
19880
19931
  synonym_pairs: synonymPairs,
19881
19932
  enforced_directives: enforcedDirectives,
19882
19933
  escalated_directives: escalatedDirectives,
19883
- events_by_type: eventsByType
19934
+ events_by_type: eventsByType,
19935
+ shown_vs_applied: {
19936
+ shown: eventsByType.retrieved ?? 0,
19937
+ applied_explicit: eventsByType.applied ?? 0,
19938
+ ignored: eventsByType.ignored ?? 0,
19939
+ contradicted: eventsByType.contradicted ?? 0,
19940
+ violated: eventsByType.violated ?? 0,
19941
+ no_relevant: eventsByType.no_relevant ?? 0
19942
+ }
19884
19943
  },
19885
19944
  cohort: {
19886
19945
  linked: cohortLinked,
@@ -19906,7 +19965,7 @@ async function computeCurationDiagnostics(directory, entries) {
19906
19965
  let scanCompleted = false;
19907
19966
  let scanRemaining = 0;
19908
19967
  try {
19909
- const { getScanStatus } = await import("./scan-cursor-qmsmmg1b.js");
19968
+ const { getScanStatus } = await import("./scan-cursor-nx5y5k7r.js");
19910
19969
  const status = await getScanStatus(directory);
19911
19970
  scanGeneration = status.generation;
19912
19971
  scanCompleted = status.completed;
@@ -19926,7 +19985,7 @@ async function computeCurationDiagnostics(directory, entries) {
19926
19985
  config = KnowledgeConfigSchema2.parse({});
19927
19986
  }
19928
19987
  const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
19929
- const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-10wnhpwn.js");
19988
+ const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-cj1tpzr5.js");
19930
19989
  const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
19931
19990
  const cohortFp = await readCohortConfigFingerprint(directory);
19932
19991
  configMatch = cohortFp === null ? null : currentFp === cohortFp;
@@ -19961,7 +20020,7 @@ async function countPendingProposals(directory) {
19961
20020
  if (!existsSync21(proposalsPath))
19962
20021
  return 0;
19963
20022
  try {
19964
- const content = await readFile12(proposalsPath, "utf-8");
20023
+ const content = await readFile13(proposalsPath, "utf-8");
19965
20024
  let n = 0;
19966
20025
  for (const line of content.split(`
19967
20026
  `)) {
@@ -19983,7 +20042,7 @@ async function safeJsonlCount(filePath) {
19983
20042
  if (!filePath || !existsSync21(filePath))
19984
20043
  return 0;
19985
20044
  try {
19986
- const content = await readFile12(filePath, "utf-8");
20045
+ const content = await readFile13(filePath, "utf-8");
19987
20046
  let n = 0;
19988
20047
  for (const line of content.split(`
19989
20048
  `)) {
@@ -27433,6 +27492,9 @@ function serializeAgentSession(s) {
27433
27492
  },
27434
27493
  ...s.autoProceedNudgeDone !== undefined && {
27435
27494
  autoProceedNudgeDone: s.autoProceedNudgeDone
27495
+ },
27496
+ ...s.cachedCohortId !== undefined && {
27497
+ cachedCohortId: s.cachedCohortId
27436
27498
  }
27437
27499
  };
27438
27500
  }
@@ -27882,7 +27944,7 @@ import { join as join45 } from "path";
27882
27944
  init_logger();
27883
27945
  import { randomUUID as randomUUID7 } from "crypto";
27884
27946
  import { existsSync as existsSync32, readFileSync as readFileSync21 } from "fs";
27885
- import { mkdir as mkdir12, readFile as readFile13, writeFile as writeFile11 } from "fs/promises";
27947
+ import { mkdir as mkdir13, readFile as readFile14, writeFile as writeFile12 } from "fs/promises";
27886
27948
  import * as os9 from "os";
27887
27949
  import * as path54 from "path";
27888
27950
  async function migrateKnowledgeToExternal(_directory, _config) {
@@ -27947,9 +28009,9 @@ var _internals44 = {
27947
28009
  resolveLegacyHiveKnowledgePath,
27948
28010
  existsSync: existsSync32,
27949
28011
  readFileSync: readFileSync21,
27950
- readFile: readFile13,
27951
- mkdir: mkdir12,
27952
- writeFile: writeFile11
28012
+ readFile: readFile14,
28013
+ mkdir: mkdir13,
28014
+ writeFile: writeFile12
27953
28015
  };
27954
28016
  async function migrateContextToKnowledge(directory, config) {
27955
28017
  const sentinelPath = path54.join(directory, ".swarm", ".knowledge-migrated");
@@ -27973,7 +28035,7 @@ async function migrateContextToKnowledge(directory, config) {
27973
28035
  skippedReason: "no-context-file"
27974
28036
  };
27975
28037
  }
27976
- const contextContent = await readFile13(contextPath, "utf-8");
28038
+ const contextContent = await readFile14(contextPath, "utf-8");
27977
28039
  if (contextContent.trim().length === 0) {
27978
28040
  return {
27979
28041
  migrated: false,
@@ -28762,13 +28824,13 @@ var _internals45 = {
28762
28824
  };
28763
28825
 
28764
28826
  // src/commands/link.ts
28765
- import { mkdir as mkdir14, writeFile as writeFile12 } from "fs/promises";
28827
+ import { mkdir as mkdir15, writeFile as writeFile13 } from "fs/promises";
28766
28828
  import * as path56 from "path";
28767
28829
 
28768
28830
  // src/knowledge/family-migration.ts
28769
28831
  var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
28770
28832
  import { existsSync as existsSync33, readFileSync as readFileSync22 } from "fs";
28771
- import { mkdir as mkdir13 } from "fs/promises";
28833
+ import { mkdir as mkdir14 } from "fs/promises";
28772
28834
  import * as path55 from "path";
28773
28835
 
28774
28836
  // src/knowledge/family-manifest.ts
@@ -29153,7 +29215,7 @@ async function snapshotSourceFamily(storeDir) {
29153
29215
  const snapshot = {};
29154
29216
  let release = null;
29155
29217
  try {
29156
- await mkdir13(storeDir, { recursive: true });
29218
+ await mkdir14(storeDir, { recursive: true });
29157
29219
  } catch {}
29158
29220
  try {
29159
29221
  release = await import_proper_lockfile5.default.lock(storeDir, {
@@ -29172,7 +29234,7 @@ async function snapshotSourceFamily(storeDir) {
29172
29234
  return snapshot;
29173
29235
  }
29174
29236
  async function migrateKnowledgeFamily(destinationDir, sourceDir) {
29175
- await mkdir13(destinationDir, { recursive: true });
29237
+ await mkdir14(destinationDir, { recursive: true });
29176
29238
  let destRelease = null;
29177
29239
  try {
29178
29240
  destRelease = await import_proper_lockfile5.default.lock(destinationDir, {
@@ -29322,8 +29384,8 @@ ${formatStatus(directory)}`;
29322
29384
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
29323
29385
  const config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
29324
29386
  const fingerprint = cohortConfigFingerprint(buildConfigFingerprintInput(config));
29325
- await mkdir14(linkDir, { recursive: true });
29326
- await writeFile12(path56.join(linkDir, "cohort-config.json"), JSON.stringify({ fingerprint, updated_at: new Date().toISOString() }, null, 2), "utf-8");
29387
+ await mkdir15(linkDir, { recursive: true });
29388
+ await writeFile13(path56.join(linkDir, "cohort-config.json"), JSON.stringify({ fingerprint, updated_at: new Date().toISOString() }, null, 2), "utf-8");
29327
29389
  } catch {}
29328
29390
  const relinkNote = existing ? `
29329
29391
  (Re-linked from previous link "${existing.linkId}".)` : "";
@@ -29865,14 +29927,14 @@ var CuratorOutputMemoryDecisionSchema = exports_external.object({
29865
29927
  curatorMemoryDecisions: exports_external.array(CuratorMemoryDecisionSchema).max(20).optional()
29866
29928
  }).passthrough();
29867
29929
  // src/memory/consolidation-log.ts
29868
- import { appendFile as appendFile4, mkdir as mkdir15, readFile as readFile15 } from "fs/promises";
29930
+ import { appendFile as appendFile5, mkdir as mkdir16, readFile as readFile16 } from "fs/promises";
29869
29931
  import * as path58 from "path";
29870
29932
  var LOG_RELATIVE_PATH = path58.join("memory", "consolidation-log.jsonl");
29871
29933
  async function readConsolidationLog(directory) {
29872
29934
  const filePath = validateSwarmPath(directory, LOG_RELATIVE_PATH);
29873
29935
  let raw;
29874
29936
  try {
29875
- raw = await readFile15(filePath, "utf-8");
29937
+ raw = await readFile16(filePath, "utf-8");
29876
29938
  } catch {
29877
29939
  return [];
29878
29940
  }
@@ -38263,7 +38325,7 @@ async function handleSpecifyCommand(_directory, args) {
38263
38325
 
38264
38326
  // src/services/status-service.ts
38265
38327
  import * as fsSync2 from "fs";
38266
- import { readFile as readFile17 } from "fs/promises";
38328
+ import { readFile as readFile18 } from "fs/promises";
38267
38329
  import * as path76 from "path";
38268
38330
 
38269
38331
  // src/hooks/extractors.ts
@@ -38824,7 +38886,7 @@ async function safeLineCount(filePath) {
38824
38886
  try {
38825
38887
  if (!fsSync2.existsSync(filePath))
38826
38888
  return 0;
38827
- const content = await readFile17(filePath, "utf-8");
38889
+ const content = await readFile18(filePath, "utf-8");
38828
38890
  let n = 0;
38829
38891
  for (const line of content.split(`
38830
38892
  `)) {
@@ -39294,7 +39356,7 @@ function buildDetailedHelp(commandName, entry) {
39294
39356
  async function handleHelpCommand(ctx) {
39295
39357
  const targetCommand = ctx.args.join(" ");
39296
39358
  if (!targetCommand) {
39297
- const { buildHelpText } = await import("./index-2k6z335c.js");
39359
+ const { buildHelpText } = await import("./index-jzpv74mq.js");
39298
39360
  return buildHelpText();
39299
39361
  }
39300
39362
  const tokens = targetCommand.split(/\s+/);
@@ -39303,7 +39365,7 @@ async function handleHelpCommand(ctx) {
39303
39365
  return _internals63.buildDetailedHelp(resolved.key, resolved.entry);
39304
39366
  }
39305
39367
  const similar = _internals63.findSimilarCommands(targetCommand);
39306
- const { buildHelpText: fullHelp } = await import("./index-2k6z335c.js");
39368
+ const { buildHelpText: fullHelp } = await import("./index-jzpv74mq.js");
39307
39369
  if (similar.length > 0) {
39308
39370
  return `Command '/swarm ${targetCommand}' not found.
39309
39371
 
@@ -39436,7 +39498,7 @@ var COMMAND_REGISTRY = {
39436
39498
  },
39437
39499
  "guardrail explain": {
39438
39500
  handler: async (ctx) => {
39439
- const { handleGuardrailExplain } = await import("./guardrail-explain-d1m747g5.js");
39501
+ const { handleGuardrailExplain } = await import("./guardrail-explain-hdsxa2c5.js");
39440
39502
  return handleGuardrailExplain(ctx.directory, ctx.args);
39441
39503
  },
39442
39504
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -39446,7 +39508,7 @@ var COMMAND_REGISTRY = {
39446
39508
  },
39447
39509
  "guardrail-explain": {
39448
39510
  handler: async (ctx) => {
39449
- const { handleGuardrailExplain } = await import("./guardrail-explain-d1m747g5.js");
39511
+ const { handleGuardrailExplain } = await import("./guardrail-explain-hdsxa2c5.js");
39450
39512
  return handleGuardrailExplain(ctx.directory, ctx.args);
39451
39513
  },
39452
39514
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -43018,9 +43080,6 @@ var loggedFirstCalls = new Set;
43018
43080
  // src/hooks/guardrails/messages-transform.ts
43019
43081
  var TRANSIENT_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504, 529]);
43020
43082
 
43021
- // src/hooks/guardrails/stored-input-args.ts
43022
- var storedInputArgs = new Map;
43023
-
43024
43083
  // src/commands/command-dispatch.ts
43025
43084
  function normalizeSwarmCommandInput(command, argumentText) {
43026
43085
  if (command !== "swarm" && !command.startsWith("swarm-")) {
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-db82jxt7.js";
5
+ } from "./index-j33zb3cx.js";
6
6
  import {
7
7
  computeOutcomeSignal,
8
8
  readKnowledge,
9
9
  resolveHiveKnowledgePath,
10
10
  resolveSwarmKnowledgePath,
11
11
  transactKnowledge
12
- } from "./index-0f800qg7.js";
12
+ } from "./index-ny13nr0x.js";
13
13
  import {
14
14
  effectiveRetrievalOutcomes,
15
15
  readKnowledgeCounterRollups
16
- } from "./index-35xyj7gn.js";
16
+ } from "./index-3sx27bxt.js";
17
17
  import {
18
18
  isActiveStatus
19
19
  } from "./index-4rhcth7a.js";