opencode-swarm 7.117.0 → 7.118.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 (40) hide show
  1. package/dist/cli/{config-doctor-htzxe394.js → config-doctor-p73yfdz0.js} +2 -2
  2. package/dist/cli/{curator-fr2m5hna.js → curator-920swpnk.js} +10 -10
  3. package/dist/cli/{curator-llm-factory-m0kvna8n.js → curator-llm-factory-kqt1f4sw.js} +10 -10
  4. package/dist/cli/{guardrail-explain-xjgk822d.js → guardrail-explain-bycz51b0.js} +11 -11
  5. package/dist/cli/{guardrail-log-dzbqcgz9.js → guardrail-log-qjqgg7pz.js} +3 -3
  6. package/dist/cli/{hive-promoter-zpk5jmx0.js → hive-promoter-w9pgfs6w.js} +15 -10
  7. package/dist/cli/{index-m7hc7nn7.js → index-11q1t6g0.js} +1 -1
  8. package/dist/cli/{index-vkdr12ek.js → index-34tsqvqb.js} +1894 -1327
  9. package/dist/cli/{index-n3sm9ewn.js → index-470tykwx.js} +2 -2
  10. package/dist/cli/{index-dc3j6jmk.js → index-5hze8ztj.js} +10 -21
  11. package/dist/cli/{index-m43zgtjn.js → index-bcg89pt8.js} +1 -1
  12. package/dist/cli/{index-8j5d3ytd.js → index-g2wrs7jy.js} +1 -1
  13. package/dist/cli/{index-af94ke83.js → index-jbdgpqpj.js} +3 -3
  14. package/dist/cli/{index-pgtqxat4.js → index-k83hebh1.js} +12 -12
  15. package/dist/cli/{index-nvc0nsvg.js → index-pdk1n8yh.js} +2 -0
  16. package/dist/cli/{index-c9m5skgs.js → index-pjhfe7c3.js} +2 -2
  17. package/dist/cli/{index-aws8yhwq.js → index-qx5z58a7.js} +19 -31
  18. package/dist/cli/{index-hskmya46.js → index-sb9x6xjj.js} +3 -3
  19. package/dist/cli/{index-4f4zv8pb.js → index-wpgv6hht.js} +25 -1
  20. package/dist/cli/index.js +10 -10
  21. package/dist/cli/{knowledge-escalator-bmk725p4.js → knowledge-escalator-gt1q632m.js} +4 -4
  22. package/dist/cli/{knowledge-events-px14n75v.js → knowledge-events-0bjdtdsb.js} +2 -2
  23. package/dist/cli/{knowledge-store-z9znvtn2.js → knowledge-store-fm2300xf.js} +7 -2
  24. package/dist/cli/{knowledge-validator-7r5t821g.js → knowledge-validator-91kx3eqv.js} +3 -3
  25. package/dist/cli/{schema-bqn7g3ez.js → schema-7c484wjz.js} +1 -1
  26. package/dist/cli/{skill-generator-4d3w8sqt.js → skill-generator-t47xyfps.js} +5 -5
  27. package/dist/commands/promote.d.ts +3 -0
  28. package/dist/commands/registry.d.ts +2 -2
  29. package/dist/config/schema.d.ts +8 -4
  30. package/dist/hooks/curator-postmortem.d.ts +1 -1
  31. package/dist/hooks/hive-policy.d.ts +81 -0
  32. package/dist/hooks/hive-promoter.d.ts +147 -28
  33. package/dist/hooks/hive-transaction.d.ts +113 -0
  34. package/dist/hooks/knowledge-events.d.ts +2 -1
  35. package/dist/hooks/knowledge-store.d.ts +6 -5
  36. package/dist/hooks/knowledge-types.d.ts +87 -0
  37. package/dist/index.js +325 -315
  38. package/dist/knowledge/hive-paths.d.ts +51 -0
  39. package/dist/services/knowledge-diagnostics.d.ts +18 -0
  40. package/package.json +1 -1
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-vkdr12ek.js";
15
+ } from "./index-34tsqvqb.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-8j5d3ytd.js";
22
+ } from "./index-g2wrs7jy.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
@@ -1,7 +1,8 @@
1
1
  // @bun
2
2
  import {
3
+ resolveHiveEventsPath,
3
4
  resolveKnowledgeStoreDir
4
- } from "./index-4f4zv8pb.js";
5
+ } from "./index-wpgv6hht.js";
5
6
  import {
6
7
  init_logger,
7
8
  warn
@@ -22,7 +23,6 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
22
23
  import { randomUUID } from "crypto";
23
24
  import { existsSync } from "fs";
24
25
  import { appendFile, mkdir, readFile, stat } from "fs/promises";
25
- import * as os from "os";
26
26
  import * as path from "path";
27
27
  init_logger();
28
28
  var KNOWLEDGE_EVENT_SCHEMA_VERSION = 1;
@@ -44,19 +44,7 @@ function resolveKnowledgeEventsPath(directory) {
44
44
  function resolveKnowledgeCounterBaselinePath(directory) {
45
45
  return path.join(resolveKnowledgeStoreDir(directory), "knowledge-counter-baseline.json");
46
46
  }
47
- function resolveHiveEventsPath() {
48
- const platform = process.platform;
49
- const home = process.env.HOME || os.homedir();
50
- let dir;
51
- if (platform === "win32") {
52
- dir = path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "opencode-swarm", "Data");
53
- } else if (platform === "darwin") {
54
- dir = path.join(home, "Library", "Application Support", "opencode-swarm");
55
- } else {
56
- dir = path.join(process.env.XDG_DATA_HOME || path.join(home, ".local", "share"), "opencode-swarm");
57
- }
58
- return path.join(dir, "shared-knowledge-events.jsonl");
59
- }
47
+ var resolveHiveEventsPath2 = resolveHiveEventsPath;
60
48
  function resolveLegacyApplicationLogPath(directory) {
61
49
  return path.join(resolveKnowledgeStoreDir(directory), "knowledge-application.jsonl");
62
50
  }
@@ -117,13 +105,14 @@ async function recordKnowledgeEvent(directory, event) {
117
105
  }
118
106
  async function appendHiveKnowledgeEvent(event) {
119
107
  const populated = withDefaults(event);
120
- const filePath = resolveHiveEventsPath();
108
+ const filePath = resolveHiveEventsPath2();
121
109
  const dirPath = path.dirname(filePath);
122
110
  await mkdir(dirPath, { recursive: true });
123
111
  let release;
124
112
  try {
125
113
  release = await import_proper_lockfile.default.lock(dirPath, {
126
- retries: { retries: 200, minTimeout: 10, maxTimeout: 100 }
114
+ retries: { retries: 200, minTimeout: 10, maxTimeout: 100 },
115
+ stale: 5000
127
116
  });
128
117
  await appendFile(filePath, `${JSON.stringify(populated)}
129
118
  `, "utf-8");
@@ -177,7 +166,7 @@ async function readKnowledgeEvents(directory, maxEvents) {
177
166
  return out;
178
167
  }
179
168
  async function readHiveKnowledgeEvents() {
180
- const filePath = resolveHiveEventsPath();
169
+ const filePath = resolveHiveEventsPath2();
181
170
  if (!existsSync(filePath))
182
171
  return [];
183
172
  const content = await readFile(filePath, "utf-8");
@@ -594,7 +583,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
594
583
  deltas.push({ id, delta });
595
584
  }
596
585
  if (deltas.length > 0) {
597
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-z9znvtn2.js");
586
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-fm2300xf.js");
598
587
  await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
599
588
  }
600
589
  return {
@@ -622,11 +611,11 @@ var _internals = {
622
611
  applyKnowledgeVerdictFeedback,
623
612
  newTraceId,
624
613
  newEventId,
625
- resolveHiveEventsPath,
614
+ resolveHiveEventsPath: resolveHiveEventsPath2,
626
615
  appendHiveKnowledgeEvent,
627
616
  recordHiveKnowledgeEvent,
628
617
  readHiveKnowledgeEvents,
629
618
  mergeRollupInto
630
619
  };
631
620
 
632
- export { KNOWLEDGE_EVENT_SCHEMA_VERSION, MAX_EVENT_LOG_ENTRIES, RECEIPT_EVENT_TYPES, resolveKnowledgeEventsPath, resolveKnowledgeCounterBaselinePath, resolveHiveEventsPath, resolveLegacyApplicationLogPath, newTraceId, newEventId, appendKnowledgeEvent, recordKnowledgeEvent, appendHiveKnowledgeEvent, recordHiveKnowledgeEvent, readKnowledgeEvents, readHiveKnowledgeEvents, readLegacyApplicationRecords, MAX_VIOLATION_TIMESTAMPS, recomputeCounters, countViolationsInWindow, countEntryViolationsInWindow, countEntryContradictionsInWindow, readKnowledgeCounterRollups, effectiveRetrievalOutcomes, applyKnowledgeVerdictFeedback, _internals };
621
+ export { KNOWLEDGE_EVENT_SCHEMA_VERSION, MAX_EVENT_LOG_ENTRIES, RECEIPT_EVENT_TYPES, resolveKnowledgeEventsPath, resolveKnowledgeCounterBaselinePath, resolveHiveEventsPath2 as resolveHiveEventsPath, resolveLegacyApplicationLogPath, newTraceId, newEventId, appendKnowledgeEvent, recordKnowledgeEvent, appendHiveKnowledgeEvent, recordHiveKnowledgeEvent, readKnowledgeEvents, readHiveKnowledgeEvents, readLegacyApplicationRecords, MAX_VIOLATION_TIMESTAMPS, recomputeCounters, countViolationsInWindow, countEntryViolationsInWindow, countEntryContradictionsInWindow, readKnowledgeCounterRollups, effectiveRetrievalOutcomes, applyKnowledgeVerdictFeedback, _internals };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-8j5d3ytd.js";
5
+ } from "./index-g2wrs7jy.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  stripKnownSwarmPrefix
4
- } from "./index-nvc0nsvg.js";
4
+ } from "./index-pdk1n8yh.js";
5
5
  import {
6
6
  init_logger,
7
7
  warn
@@ -4,7 +4,7 @@ import {
4
4
  countEntryViolationsInWindow,
5
5
  readKnowledgeEvents,
6
6
  recordKnowledgeEvent
7
- } from "./index-dc3j6jmk.js";
7
+ } from "./index-5hze8ztj.js";
8
8
  import {
9
9
  jaccardBigram,
10
10
  readKnowledge,
@@ -12,7 +12,7 @@ import {
12
12
  resolveSwarmKnowledgePath,
13
13
  transactKnowledge,
14
14
  wordBigrams
15
- } from "./index-aws8yhwq.js";
15
+ } from "./index-qx5z58a7.js";
16
16
  import {
17
17
  isActiveStatus
18
18
  } from "./index-bfwt3abw.js";
@@ -188,7 +188,7 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
188
188
  alreadyInactive: true
189
189
  };
190
190
  }
191
- const { quarantineEntry } = await import("./knowledge-validator-7r5t821g.js");
191
+ const { quarantineEntry } = await import("./knowledge-validator-91kx3eqv.js");
192
192
  await quarantineEntry(directory, entryId, `repeat_contradiction: ${count} contradicted events in ${windowDays}d`, "auto");
193
193
  return { quarantined: true, entryId, contradictionsInWindow: count };
194
194
  } catch {
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-n3sm9ewn.js";
4
+ } from "./index-470tykwx.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-m43zgtjn.js";
7
+ } from "./index-bcg89pt8.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  SWARM_COMMAND_TOOL_ALLOWLIST,
@@ -83,27 +83,27 @@ import {
83
83
  handleWriteRetroCommand,
84
84
  normalizeSwarmCommandInput,
85
85
  resolveCommand
86
- } from "./index-vkdr12ek.js";
86
+ } from "./index-34tsqvqb.js";
87
87
  import"./index-nprawcc0.js";
88
- import"./index-8j5d3ytd.js";
88
+ import"./index-g2wrs7jy.js";
89
89
  import"./index-c8s9a3zh.js";
90
- import"./index-m7hc7nn7.js";
90
+ import"./index-11q1t6g0.js";
91
91
  import {
92
92
  AGENT_TOOL_MAP,
93
93
  ORCHESTRATOR_NAME,
94
94
  stripKnownSwarmPrefix
95
- } from "./index-nvc0nsvg.js";
95
+ } from "./index-pdk1n8yh.js";
96
96
  import"./index-xdsd2hma.js";
97
97
  import"./index-scww5b77.js";
98
98
  import"./index-4905hd2m.js";
99
99
  import"./index-5bcrp3bc.js";
100
- import"./index-hskmya46.js";
101
- import"./index-c9m5skgs.js";
102
- import"./index-af94ke83.js";
103
- import"./index-dc3j6jmk.js";
104
- import"./index-aws8yhwq.js";
100
+ import"./index-sb9x6xjj.js";
101
+ import"./index-pjhfe7c3.js";
102
+ import"./index-jbdgpqpj.js";
103
+ import"./index-5hze8ztj.js";
104
+ import"./index-qx5z58a7.js";
105
105
  import"./index-bfwt3abw.js";
106
- import"./index-4f4zv8pb.js";
106
+ import"./index-wpgv6hht.js";
107
107
  import"./index-vxv732ex.js";
108
108
  import"./index-8fwhhayc.js";
109
109
  import"./index-q1exe2b3.js";
@@ -1559,6 +1559,8 @@ var KnowledgeConfigSchema = exports_external.object({
1559
1559
  contradiction_quarantine_window_days: exports_external.number().int().positive().default(30),
1560
1560
  promoted_demotion_min_negative_phases: exports_external.number().int().positive().default(3),
1561
1561
  promoted_demotion_signal_threshold: exports_external.number().min(-1).max(1).default(OUTCOME_BLOCK_THRESHOLD),
1562
+ promotion_min_terminal_applications: exports_external.number().min(0).max(100).default(0),
1563
+ promotion_min_distinct_cohorts: exports_external.number().min(0).max(50).default(0),
1562
1564
  realtime_learning_nudge: exports_external.object({
1563
1565
  enabled: exports_external.boolean().default(true),
1564
1566
  first_after_tool_calls: exports_external.number().int().min(1).max(1000).default(10),
@@ -6,10 +6,10 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  resolveSwarmRejectedPath,
8
8
  transactKnowledge
9
- } from "./index-aws8yhwq.js";
9
+ } from "./index-qx5z58a7.js";
10
10
  import {
11
11
  resolveKnowledgeStoreDir
12
- } from "./index-4f4zv8pb.js";
12
+ } from "./index-wpgv6hht.js";
13
13
  import {
14
14
  init_logger,
15
15
  warn
@@ -3,8 +3,11 @@ import {
3
3
  isActiveStatus
4
4
  } from "./index-bfwt3abw.js";
5
5
  import {
6
+ resolveHiveEventsPath,
7
+ resolveHiveKnowledgePath,
8
+ resolveHiveRejectedPath,
6
9
  resolveKnowledgeStoreDir
7
- } from "./index-4f4zv8pb.js";
10
+ } from "./index-wpgv6hht.js";
8
11
  import {
9
12
  init_logger,
10
13
  log
@@ -87,27 +90,9 @@ function resolveSwarmRejectedPath(directory) {
87
90
  function resolveSwarmRetractionsPath(directory) {
88
91
  return path.join(resolveKnowledgeStoreDir(directory), "knowledge-retractions.jsonl");
89
92
  }
90
- function resolveHiveKnowledgePath() {
91
- const platform = process.platform;
92
- const home = process.env.HOME || os.homedir();
93
- let dataDir;
94
- if (platform === "win32") {
95
- dataDir = path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "opencode-swarm", "Data");
96
- } else if (platform === "darwin") {
97
- dataDir = path.join(home, "Library", "Application Support", "opencode-swarm");
98
- } else {
99
- dataDir = path.join(process.env.XDG_DATA_HOME || path.join(home, ".local", "share"), "opencode-swarm");
100
- }
101
- return path.join(dataDir, "shared-learnings.jsonl");
102
- }
103
- function resolveHiveRejectedPath() {
104
- const hivePath = resolveHiveKnowledgePath();
105
- return path.join(path.dirname(hivePath), "shared-learnings-rejected.jsonl");
106
- }
107
- function resolveHiveEventsPath() {
108
- const hivePath = resolveHiveKnowledgePath();
109
- return path.join(path.dirname(hivePath), "shared-knowledge-events.jsonl");
110
- }
93
+ var resolveHiveKnowledgePath2 = resolveHiveKnowledgePath;
94
+ var resolveHiveRejectedPath2 = resolveHiveRejectedPath;
95
+ var resolveHiveEventsPath2 = resolveHiveEventsPath;
111
96
  function parseKnowledgeContent(content, max) {
112
97
  const results = [];
113
98
  for (const line of content.split(`
@@ -189,6 +174,9 @@ function normalizeEntry(raw) {
189
174
  if (typeof obj.recent_negative_phase_count !== "number") {
190
175
  obj.recent_negative_phase_count = 0;
191
176
  }
177
+ if (!Array.isArray(obj.confirmed_by)) {
178
+ obj.confirmed_by = [];
179
+ }
192
180
  const arrayFields = [
193
181
  "triggers",
194
182
  "required_actions",
@@ -310,7 +298,7 @@ async function getArchivedKnowledgeIds(directory) {
310
298
  } catch {}
311
299
  }
312
300
  } catch {}
313
- const hivePath = resolveHiveKnowledgePath();
301
+ const hivePath = resolveHiveKnowledgePath2();
314
302
  try {
315
303
  const content = await readFile(hivePath, "utf-8");
316
304
  const lines = content.split(`
@@ -567,7 +555,7 @@ async function bumpKnowledgeConfidenceBatch(directory, deltas, options) {
567
555
  if (deltas.length === 0)
568
556
  return;
569
557
  const swarmPath = resolveSwarmKnowledgePath(directory);
570
- const hivePath = resolveHiveKnowledgePath();
558
+ const hivePath = resolveHiveKnowledgePath2();
571
559
  const touchedSwarm = [];
572
560
  const touchedHive = [];
573
561
  try {
@@ -595,7 +583,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
595
583
  const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
596
584
  if (atFloor.length === 0 && recovered.length === 0)
597
585
  return;
598
- const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-px14n75v.js");
586
+ const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-0bjdtdsb.js");
599
587
  const rollups = await readKnowledgeCounterRollups(directory);
600
588
  const flagIds = new Set;
601
589
  for (const e of atFloor) {
@@ -611,7 +599,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
611
599
  if (flagIds.size === 0)
612
600
  return;
613
601
  const swarmPath = resolveSwarmKnowledgePath(directory);
614
- const hivePath = resolveHiveKnowledgePath();
602
+ const hivePath = resolveHiveKnowledgePath2();
615
603
  const toQuarantine = [];
616
604
  await transactKnowledge(swarmPath, (swarmEntries) => {
617
605
  const now = new Date().toISOString();
@@ -662,7 +650,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
662
650
  });
663
651
  }
664
652
  if (action === "quarantine" && toQuarantine.length > 0) {
665
- const { quarantineEntry } = await import("./knowledge-validator-7r5t821g.js");
653
+ const { quarantineEntry } = await import("./knowledge-validator-91kx3eqv.js");
666
654
  for (const { id } of toQuarantine) {
667
655
  await quarantineEntry(directory, id, "confidence_floor_negative_outcome", "auto").catch((err) => {
668
656
  log("[knowledge-store] confidence-floor quarantine failed (best-effort):", err instanceof Error ? err.message : String(err));
@@ -720,9 +708,9 @@ var _internals = {
720
708
  getPlatformConfigDir,
721
709
  resolveSwarmKnowledgePath,
722
710
  resolveSwarmRejectedPath,
723
- resolveHiveKnowledgePath,
724
- resolveHiveRejectedPath,
725
- resolveHiveEventsPath,
711
+ resolveHiveKnowledgePath: resolveHiveKnowledgePath2,
712
+ resolveHiveRejectedPath: resolveHiveRejectedPath2,
713
+ resolveHiveEventsPath: resolveHiveEventsPath2,
726
714
  readKnowledge,
727
715
  parseKnowledgeContent,
728
716
  readRejectedLessons,
@@ -745,4 +733,4 @@ var _internals = {
745
733
  getArchivedKnowledgeIds
746
734
  };
747
735
 
748
- export { findActiveSwarmNearDuplicate, reinforceSwarmKnowledgeEntry, getPlatformConfigDir, resolveSwarmKnowledgePath, resolveSwarmRejectedPath, resolveSwarmRetractionsPath, resolveHiveKnowledgePath, resolveHiveRejectedPath, resolveHiveEventsPath, readKnowledge, normalizeEntry, readRejectedLessons, readRetractionRecords, appendRetractionRecord, appendKnowledge, rewriteKnowledge, transactFile, transactKnowledge, getArchivedKnowledgeIds, appendKnowledgeWithCapEnforcement, enforceKnowledgeCap, sweepAgedEntries, sweepStaleTodos, appendRejectedLesson, normalize, wordBigrams, jaccardBigram, findNearDuplicate, computeConfidence, MAX_CONFIRMED_BY, confirmEntriesPhase, OUTCOME_SIGNAL_SMOOTHING, computeOutcomeSignal, inferTags, bumpKnowledgeConfidenceBatch, _internals };
736
+ export { findActiveSwarmNearDuplicate, reinforceSwarmKnowledgeEntry, getPlatformConfigDir, resolveSwarmKnowledgePath, resolveSwarmRejectedPath, resolveSwarmRetractionsPath, resolveHiveKnowledgePath2 as resolveHiveKnowledgePath, resolveHiveRejectedPath2 as resolveHiveRejectedPath, resolveHiveEventsPath2 as resolveHiveEventsPath, readKnowledge, normalizeEntry, readRejectedLessons, readRetractionRecords, appendRetractionRecord, appendKnowledge, rewriteKnowledge, transactFile, transactKnowledge, getArchivedKnowledgeIds, appendKnowledgeWithCapEnforcement, enforceKnowledgeCap, selectKnowledgeCapSurvivors, sweepAgedEntries, sweepStaleTodos, appendRejectedLesson, normalize, wordBigrams, jaccardBigram, findNearDuplicate, computeConfidence, MAX_CONFIRMED_BY, confirmEntriesPhase, OUTCOME_SIGNAL_SMOOTHING, computeOutcomeSignal, inferTags, bumpKnowledgeConfidenceBatch, _internals };
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-c9m5skgs.js";
5
+ } from "./index-pjhfe7c3.js";
6
6
  import {
7
7
  effectiveRetrievalOutcomes,
8
8
  readKnowledgeCounterRollups
9
- } from "./index-dc3j6jmk.js";
9
+ } from "./index-5hze8ztj.js";
10
10
  import {
11
11
  computeOutcomeSignal,
12
12
  readKnowledge,
13
13
  resolveHiveKnowledgePath,
14
14
  resolveSwarmKnowledgePath,
15
15
  transactKnowledge
16
- } from "./index-aws8yhwq.js";
16
+ } from "./index-qx5z58a7.js";
17
17
  import {
18
18
  isActiveStatus
19
19
  } from "./index-bfwt3abw.js";
@@ -234,4 +234,28 @@ function isLinked(directory) {
234
234
  return readLinkPointer(directory) !== null;
235
235
  }
236
236
 
237
- export { resolveLinkDir, sanitizeLinkId, readLinkPointer, getLinkedLocalKnowledgeStatus, writeLinkPointer, removeLinkPointer, resolveKnowledgeStoreDir, isLinked };
237
+ // src/knowledge/hive-paths.ts
238
+ import * as os2 from "os";
239
+ import * as path2 from "path";
240
+ function resolveHiveDataDir() {
241
+ const platform = process.platform;
242
+ const home = process.env.HOME || os2.homedir();
243
+ if (platform === "win32") {
244
+ return path2.join(process.env.LOCALAPPDATA || path2.join(home, "AppData", "Local"), "opencode-swarm", "Data");
245
+ }
246
+ if (platform === "darwin") {
247
+ return path2.join(home, "Library", "Application Support", "opencode-swarm");
248
+ }
249
+ return path2.join(process.env.XDG_DATA_HOME || path2.join(home, ".local", "share"), "opencode-swarm");
250
+ }
251
+ function resolveHiveKnowledgePath() {
252
+ return path2.join(resolveHiveDataDir(), "shared-learnings.jsonl");
253
+ }
254
+ function resolveHiveRejectedPath() {
255
+ return path2.join(resolveHiveDataDir(), "shared-learnings-rejected.jsonl");
256
+ }
257
+ function resolveHiveEventsPath() {
258
+ return path2.join(resolveHiveDataDir(), "shared-knowledge-events.jsonl");
259
+ }
260
+
261
+ export { resolveLinkDir, sanitizeLinkId, readLinkPointer, getLinkedLocalKnowledgeStatus, writeLinkPointer, removeLinkPointer, resolveKnowledgeStoreDir, isLinked, resolveHiveDataDir, resolveHiveKnowledgePath, resolveHiveRejectedPath, resolveHiveEventsPath };
package/dist/cli/index.js CHANGED
@@ -7,25 +7,25 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-vkdr12ek.js";
10
+ } from "./index-34tsqvqb.js";
11
11
  import"./index-nprawcc0.js";
12
- import"./index-8j5d3ytd.js";
12
+ import"./index-g2wrs7jy.js";
13
13
  import"./index-c8s9a3zh.js";
14
- import"./index-m7hc7nn7.js";
14
+ import"./index-11q1t6g0.js";
15
15
  import {
16
16
  DEFAULT_AGENT_CONFIGS
17
- } from "./index-nvc0nsvg.js";
17
+ } from "./index-pdk1n8yh.js";
18
18
  import"./index-xdsd2hma.js";
19
19
  import"./index-scww5b77.js";
20
20
  import"./index-4905hd2m.js";
21
21
  import"./index-5bcrp3bc.js";
22
- import"./index-hskmya46.js";
23
- import"./index-c9m5skgs.js";
24
- import"./index-af94ke83.js";
25
- import"./index-dc3j6jmk.js";
26
- import"./index-aws8yhwq.js";
22
+ import"./index-sb9x6xjj.js";
23
+ import"./index-pjhfe7c3.js";
24
+ import"./index-jbdgpqpj.js";
25
+ import"./index-5hze8ztj.js";
26
+ import"./index-qx5z58a7.js";
27
27
  import"./index-bfwt3abw.js";
28
- import"./index-4f4zv8pb.js";
28
+ import"./index-wpgv6hht.js";
29
29
  import"./index-vxv732ex.js";
30
30
  import"./index-8fwhhayc.js";
31
31
  import"./index-q1exe2b3.js";
@@ -8,11 +8,11 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-af94ke83.js";
12
- import"./index-dc3j6jmk.js";
13
- import"./index-aws8yhwq.js";
11
+ } from "./index-jbdgpqpj.js";
12
+ import"./index-5hze8ztj.js";
13
+ import"./index-qx5z58a7.js";
14
14
  import"./index-bfwt3abw.js";
15
- import"./index-4f4zv8pb.js";
15
+ import"./index-wpgv6hht.js";
16
16
  import"./index-zgwm4ryv.js";
17
17
  import"./index-0pfqcjp6.js";
18
18
  import"./index-42cx6g2h.js";
@@ -25,8 +25,8 @@ import {
25
25
  resolveKnowledgeCounterBaselinePath,
26
26
  resolveKnowledgeEventsPath,
27
27
  resolveLegacyApplicationLogPath
28
- } from "./index-dc3j6jmk.js";
29
- import"./index-4f4zv8pb.js";
28
+ } from "./index-5hze8ztj.js";
29
+ import"./index-wpgv6hht.js";
30
30
  import"./index-zgwm4ryv.js";
31
31
  import"./index-0pfqcjp6.js";
32
32
  import"./index-42cx6g2h.js";
@@ -29,14 +29,17 @@ import {
29
29
  resolveSwarmRejectedPath,
30
30
  resolveSwarmRetractionsPath,
31
31
  rewriteKnowledge,
32
+ selectKnowledgeCapSurvivors,
32
33
  sweepAgedEntries,
33
34
  sweepStaleTodos,
34
35
  transactFile,
35
36
  transactKnowledge,
36
37
  wordBigrams
37
- } from "./index-aws8yhwq.js";
38
+ } from "./index-qx5z58a7.js";
38
39
  import"./index-bfwt3abw.js";
39
- import"./index-4f4zv8pb.js";
40
+ import {
41
+ resolveHiveDataDir
42
+ } from "./index-wpgv6hht.js";
40
43
  import"./index-zgwm4ryv.js";
41
44
  import"./index-0pfqcjp6.js";
42
45
  import"./index-42cx6g2h.js";
@@ -51,6 +54,7 @@ export {
51
54
  transactFile,
52
55
  sweepStaleTodos,
53
56
  sweepAgedEntries,
57
+ selectKnowledgeCapSurvivors,
54
58
  rewriteKnowledge,
55
59
  resolveSwarmRetractionsPath,
56
60
  resolveSwarmRejectedPath,
@@ -58,6 +62,7 @@ export {
58
62
  resolveHiveRejectedPath,
59
63
  resolveHiveKnowledgePath,
60
64
  resolveHiveEventsPath,
65
+ resolveHiveDataDir,
61
66
  readRetractionRecords,
62
67
  readRejectedLessons,
63
68
  readKnowledge,
@@ -23,10 +23,10 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-c9m5skgs.js";
27
- import"./index-aws8yhwq.js";
26
+ } from "./index-pjhfe7c3.js";
27
+ import"./index-qx5z58a7.js";
28
28
  import"./index-bfwt3abw.js";
29
- import"./index-4f4zv8pb.js";
29
+ import"./index-wpgv6hht.js";
30
30
  import"./index-zgwm4ryv.js";
31
31
  import"./index-0pfqcjp6.js";
32
32
  import"./index-42cx6g2h.js";
@@ -87,7 +87,7 @@ import {
87
87
  resolveGeneratedAgentRole,
88
88
  resolveGuardrailsConfig,
89
89
  stripKnownSwarmPrefix
90
- } from "./index-nvc0nsvg.js";
90
+ } from "./index-pdk1n8yh.js";
91
91
  import"./index-bfwt3abw.js";
92
92
  import"./index-p0arc26j.js";
93
93
  import"./index-293f68mj.js";
@@ -33,12 +33,12 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-hskmya46.js";
37
- import"./index-c9m5skgs.js";
38
- import"./index-dc3j6jmk.js";
39
- import"./index-aws8yhwq.js";
36
+ } from "./index-sb9x6xjj.js";
37
+ import"./index-pjhfe7c3.js";
38
+ import"./index-5hze8ztj.js";
39
+ import"./index-qx5z58a7.js";
40
40
  import"./index-bfwt3abw.js";
41
- import"./index-4f4zv8pb.js";
41
+ import"./index-wpgv6hht.js";
42
42
  import"./index-zgwm4ryv.js";
43
43
  import"./index-0pfqcjp6.js";
44
44
  import"./index-42cx6g2h.js";
@@ -6,5 +6,8 @@
6
6
  * - /swarm promote "<lesson text>" — Promote direct text
7
7
  * - /swarm promote --category <category> "<lesson text>" — Promote with category
8
8
  * - /swarm promote --from-swarm <lesson-id> — Promote from existing swarm lesson
9
+ * - /swarm promote --force --reason "<why>" ... — Override failed policy gates
10
+ * with a durable, audited override record (issue #1847 §4). An exact entry id
11
+ * alone is NEVER authorization to bypass policy; an explicit override is.
9
12
  */
10
13
  export declare function handlePromoteCommand(directory: string, args: string[]): Promise<string>;
@@ -689,8 +689,8 @@ export declare const COMMAND_REGISTRY: {
689
689
  };
690
690
  readonly promote: {
691
691
  readonly handler: (ctx: CommandContext) => Promise<string>;
692
- readonly description: "Manually promote lesson to hive knowledge";
693
- readonly details: "Promotes a lesson directly to hive knowledge (--category flag sets category) or references an existing swarm lesson by ID (--from-swarm). Validates lesson text before promotion. Either direct text or --from-swarm ID is required.";
692
+ readonly description: "Manually promote lesson to hive knowledge (policy-gated; --force --reason overrides with audit)";
693
+ readonly details: "Promotes a lesson directly to hive knowledge (--category flag sets category) or references an existing swarm lesson by ID (--from-swarm). Promotion runs the one policy evaluator inside a single cross-process transaction (#1847). A policy failure blocks promotion unless --force --reason \"<why>\" is supplied, which records a durable, audited override. An exact entry id alone is never authorization to bypass policy. Either direct text or --from-swarm ID is required.";
694
694
  readonly args: "--category <category>, --from-swarm <lesson-id>, <lesson-text>";
695
695
  readonly category: "utility";
696
696
  readonly toolPolicy: "none";
@@ -420,9 +420,9 @@ export declare const LintConfigSchema: z.ZodObject<{
420
420
  fix: "fix";
421
421
  }>>;
422
422
  linter: z.ZodDefault<z.ZodEnum<{
423
+ auto: "auto";
423
424
  biome: "biome";
424
425
  eslint: "eslint";
425
- auto: "auto";
426
426
  }>>;
427
427
  patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
428
428
  exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -630,6 +630,8 @@ export declare const KnowledgeConfigSchema: z.ZodObject<{
630
630
  contradiction_quarantine_window_days: z.ZodDefault<z.ZodNumber>;
631
631
  promoted_demotion_min_negative_phases: z.ZodDefault<z.ZodNumber>;
632
632
  promoted_demotion_signal_threshold: z.ZodDefault<z.ZodNumber>;
633
+ promotion_min_terminal_applications: z.ZodDefault<z.ZodNumber>;
634
+ promotion_min_distinct_cohorts: z.ZodDefault<z.ZodNumber>;
633
635
  realtime_learning_nudge: z.ZodDefault<z.ZodObject<{
634
636
  enabled: z.ZodDefault<z.ZodBoolean>;
635
637
  first_after_tool_calls: z.ZodDefault<z.ZodNumber>;
@@ -1068,8 +1070,8 @@ export declare const ParallelizationConfigSchema: z.ZodObject<{
1068
1070
  export type ParallelizationConfig = z.infer<typeof ParallelizationConfigSchema>;
1069
1071
  export declare const WorktreeIsolationConfigSchema: z.ZodObject<{
1070
1072
  policy: z.ZodDefault<z.ZodEnum<{
1071
- disabled: "disabled";
1072
1073
  auto: "auto";
1074
+ disabled: "disabled";
1073
1075
  required: "required";
1074
1076
  }>>;
1075
1077
  merge_strategy: z.ZodDefault<z.ZodEnum<{
@@ -1852,9 +1854,9 @@ export declare const PluginConfigSchema: z.ZodObject<{
1852
1854
  fix: "fix";
1853
1855
  }>>;
1854
1856
  linter: z.ZodDefault<z.ZodEnum<{
1857
+ auto: "auto";
1855
1858
  biome: "biome";
1856
1859
  eslint: "eslint";
1857
- auto: "auto";
1858
1860
  }>>;
1859
1861
  patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
1860
1862
  exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -1940,6 +1942,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
1940
1942
  contradiction_quarantine_window_days: z.ZodDefault<z.ZodNumber>;
1941
1943
  promoted_demotion_min_negative_phases: z.ZodDefault<z.ZodNumber>;
1942
1944
  promoted_demotion_signal_threshold: z.ZodDefault<z.ZodNumber>;
1945
+ promotion_min_terminal_applications: z.ZodDefault<z.ZodNumber>;
1946
+ promotion_min_distinct_cohorts: z.ZodDefault<z.ZodNumber>;
1943
1947
  realtime_learning_nudge: z.ZodDefault<z.ZodObject<{
1944
1948
  enabled: z.ZodDefault<z.ZodBoolean>;
1945
1949
  first_after_tool_calls: z.ZodDefault<z.ZodNumber>;
@@ -2255,8 +2259,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
2255
2259
  }, z.core.$strip>>;
2256
2260
  worktree: z.ZodOptional<z.ZodObject<{
2257
2261
  policy: z.ZodDefault<z.ZodEnum<{
2258
- disabled: "disabled";
2259
2262
  auto: "auto";
2263
+ disabled: "disabled";
2260
2264
  required: "required";
2261
2265
  }>>;
2262
2266
  merge_strategy: z.ZodDefault<z.ZodEnum<{
@@ -136,7 +136,7 @@ export declare const _internals: {
136
136
  applied: number;
137
137
  skipped: number;
138
138
  }>;
139
- checkHivePromotions: (entries: SwarmKnowledgeEntry[], knowledgeConfig: KnowledgeConfig) => Promise<import("./hive-promoter.js").HivePromotionSummary>;
139
+ checkHivePromotions: (entries: SwarmKnowledgeEntry[], knowledgeConfig: KnowledgeConfig, directory: string) => Promise<import("./hive-promoter.js").HivePromotionSummary>;
140
140
  applyProposalTriage: (directory: string, triage: ParsedPostMortemActions["queueTriage"]) => Promise<{
141
141
  approved: string[];
142
142
  rejected: string[];