opencode-swarm 7.158.0 → 7.159.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 (62) hide show
  1. package/README.md +4 -2
  2. package/dist/background/pr-subscriptions.d.ts +31 -15
  3. package/dist/cli/{coder-settlement-5sexsmqz.js → coder-settlement-66mqw0xt.js} +3 -3
  4. package/dist/cli/{config-doctor-ewn2kw6d.js → config-doctor-nkx61b9e.js} +2 -2
  5. package/dist/cli/{core-72wdmzps.js → core-b3db7gf6.js} +1 -1
  6. package/dist/cli/{curator-llm-factory-r8q84m4g.js → curator-llm-factory-c4y1mrr5.js} +20 -20
  7. package/dist/cli/{curator-g06sa98p.js → curator-w4ntvkz5.js} +20 -20
  8. package/dist/cli/{evidence-summary-service-ttd0ntm0.js → evidence-summary-service-vadgnzk6.js} +6 -6
  9. package/dist/cli/{gate-evidence-agnxf7md.js → gate-evidence-0chatz5e.js} +2 -2
  10. package/dist/cli/{guardrail-explain-qf4k176t.js → guardrail-explain-ax2qmsp4.js} +21 -21
  11. package/dist/cli/{guardrail-log-g4qc595v.js → guardrail-log-t3c9g8tc.js} +3 -3
  12. package/dist/cli/{guardrail-reset-zpxk0p1j.js → guardrail-reset-wvdb5sv5.js} +20 -20
  13. package/dist/cli/{hive-promoter-zxy07gjg.js → hive-promoter-mfq3ee0n.js} +20 -20
  14. package/dist/cli/{index-rc93mm6e.js → index-04yrxg0z.js} +1 -1
  15. package/dist/cli/{index-c57cyrwn.js → index-1sdb57jv.js} +3 -3
  16. package/dist/cli/{index-f036tggv.js → index-35grv4jg.js} +3 -3
  17. package/dist/cli/{index-rac2gkvr.js → index-3e8600a7.js} +132 -63
  18. package/dist/cli/{index-rd324153.js → index-6e6qxf5q.js} +15 -1
  19. package/dist/cli/{index-pvs2zw1y.js → index-8jnzp5ct.js} +2 -2
  20. package/dist/cli/{index-745dh1z1.js → index-8kfbdrxa.js} +22 -22
  21. package/dist/cli/{index-1vxmqvpt.js → index-9vt2hknx.js} +1 -1
  22. package/dist/cli/{index-f776m4r5.js → index-b1tenv2s.js} +75 -72
  23. package/dist/cli/{index-6xxpwk5x.js → index-b82tq895.js} +1 -1
  24. package/dist/cli/{index-yfbp4q09.js → index-e2s08v0q.js} +1 -1
  25. package/dist/cli/{index-x71shq8j.js → index-erdsawqz.js} +4 -4
  26. package/dist/cli/{index-y3hdwh66.js → index-fcp41snp.js} +3 -3
  27. package/dist/cli/{index-zawd71cg.js → index-ghjs1n7k.js} +3 -3
  28. package/dist/cli/{index-gm10kvne.js → index-hte1e31d.js} +2 -2
  29. package/dist/cli/{index-vwx0by4y.js → index-k48kgm6z.js} +5 -5
  30. package/dist/cli/{index-bv24pbaj.js → index-k4arrwrz.js} +3 -3
  31. package/dist/cli/{index-x4ftmdha.js → index-mc9qgkwd.js} +531 -100
  32. package/dist/cli/{index-a1884hh4.js → index-pvzaryhr.js} +1 -1
  33. package/dist/cli/{index-663wnh64.js → index-tcbjjppb.js} +26 -2
  34. package/dist/cli/{index-dmfbmnp7.js → index-vywbn766.js} +1 -1
  35. package/dist/cli/{index-fwe1wh6r.js → index-we3nf5as.js} +1 -1
  36. package/dist/cli/{index-5tchehv7.js → index-xmz69g65.js} +1 -1
  37. package/dist/cli/{index-nvta6kcv.js → index-ynjy98vv.js} +2 -2
  38. package/dist/cli/index.js +28 -36
  39. package/dist/cli/{knowledge-escalator-22zaj224.js → knowledge-escalator-x85t1e66.js} +6 -6
  40. package/dist/cli/{knowledge-events-xbx1k408.js → knowledge-events-bwx99mxc.js} +4 -4
  41. package/dist/cli/{knowledge-store-fnm8xh9c.js → knowledge-store-21m81zsa.js} +1 -1
  42. package/dist/cli/{knowledge-validator-t2jztjy1.js → knowledge-validator-yxcadg1p.js} +2 -2
  43. package/dist/cli/{pending-delegations-29rtv1gb.js → pending-delegations-b8qka5nf.js} +1 -1
  44. package/dist/cli/{pr-review-reentry-authorization-25dep81m.js → pr-review-reentry-authorization-wv3ck5kh.js} +20 -20
  45. package/dist/cli/{pr-subscriptions-cgac3ydd.js → pr-subscriptions-j9j70bmd.js} +1 -1
  46. package/dist/cli/{scan-cursor-8acs9kwe.js → scan-cursor-m3w0tapb.js} +2 -2
  47. package/dist/cli/{schema-rjhassd0.js → schema-0b0dqn28.js} +1 -1
  48. package/dist/cli/{scope-persistence-jb1a5dzh.js → scope-persistence-199f7yqc.js} +4 -4
  49. package/dist/cli/{skill-generator-frgppk1w.js → skill-generator-a2ekcbe2.js} +7 -7
  50. package/dist/cli/{worktree-collision-ownership-f5sj6ffa.js → worktree-collision-ownership-5qaab3q7.js} +1 -1
  51. package/dist/cli/{worktree-isolation-5b0w6bha.js → worktree-isolation-esesc842.js} +20 -20
  52. package/dist/commands/close.d.ts +2 -0
  53. package/dist/config/loader.d.ts +3 -0
  54. package/dist/config/project-init.d.ts +11 -7
  55. package/dist/config/schema.d.ts +1 -0
  56. package/dist/index.js +477 -473
  57. package/dist/tools/repo-graph/query.d.ts +1 -0
  58. package/dist/tools/repo-graph/symbol-query.d.ts +47 -0
  59. package/dist/tools/repo-graph/types.d.ts +267 -1
  60. package/dist/tools/repo-graph.d.ts +3 -1
  61. package/opencode-swarm.schema.json +5160 -0
  62. package/package.json +4 -2
@@ -4,11 +4,11 @@ import {
4
4
  } from "./index-dtn0pne5.js";
5
5
  import {
6
6
  loadPluginConfigWithMeta
7
- } from "./index-663wnh64.js";
7
+ } from "./index-tcbjjppb.js";
8
8
  import {
9
9
  KnowledgeConfigSchema,
10
10
  init_schema
11
- } from "./index-f776m4r5.js";
11
+ } from "./index-b1tenv2s.js";
12
12
  import {
13
13
  resolveHiveEventsPath
14
14
  } from "./index-ae75rja9.js";
@@ -2793,7 +2793,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
2793
2793
  }
2794
2794
  let bumps = 0;
2795
2795
  if (deltas.length > 0) {
2796
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-fnm8xh9c.js");
2796
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-21m81zsa.js");
2797
2797
  bumps = await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
2798
2798
  }
2799
2799
  return {
@@ -15,13 +15,13 @@ import {
15
15
  protectedRoots,
16
16
  redactDecisionLineForArchive,
17
17
  stableCanonicalStringify
18
- } from "./index-rc93mm6e.js";
18
+ } from "./index-04yrxg0z.js";
19
19
  import {
20
20
  detectStraySwarmDirs,
21
21
  readDoctorArtifact,
22
22
  removeStraySwarmDir,
23
23
  runConfigDoctor
24
- } from "./index-rd324153.js";
24
+ } from "./index-6e6qxf5q.js";
25
25
  import {
26
26
  MAX_TRANSIENT_RETRIES,
27
27
  archiveEvidence,
@@ -68,7 +68,7 @@ import {
68
68
  validateProjectRoot,
69
69
  validateSymlinkBoundary,
70
70
  validateTargetWithinRoot
71
- } from "./index-bv24pbaj.js";
71
+ } from "./index-k4arrwrz.js";
72
72
  import {
73
73
  EvaluationTaskV1Schema,
74
74
  GateAuditManifestV1Schema,
@@ -129,15 +129,15 @@ import {
129
129
  retireSkill,
130
130
  selectCandidateEntries,
131
131
  syncBundledProjectSkillsIfMissingAsync
132
- } from "./index-y3hdwh66.js";
132
+ } from "./index-fcp41snp.js";
133
133
  import {
134
134
  readRecentEscalations
135
- } from "./index-vwx0by4y.js";
135
+ } from "./index-k48kgm6z.js";
136
136
  import {
137
137
  alreadyCuratedThisGeneration,
138
138
  claimNextScanBatch,
139
139
  resolveCohortId
140
- } from "./index-5tchehv7.js";
140
+ } from "./index-xmz69g65.js";
141
141
  import {
142
142
  CURATOR_INIT_PROMPT,
143
143
  CURATOR_PHASE_PROMPT,
@@ -161,7 +161,7 @@ import {
161
161
  listActive,
162
162
  subscribe,
163
163
  unsubscribe
164
- } from "./index-x4ftmdha.js";
164
+ } from "./index-mc9qgkwd.js";
165
165
  import {
166
166
  clearWorktreeMergeStatus,
167
167
  getAllWorktreeMergeFailures,
@@ -173,7 +173,7 @@ import {
173
173
  listCoderSettlementWalStates,
174
174
  recoverCoderSettlement,
175
175
  recoverStaleCoderSettlements
176
- } from "./index-c57cyrwn.js";
176
+ } from "./index-1sdb57jv.js";
177
177
  import {
178
178
  parsePorcelainV2Snapshot,
179
179
  resolveCommitCountSince,
@@ -217,7 +217,7 @@ import {
217
217
  validateActionableFields,
218
218
  validateLesson,
219
219
  validateSkillPath
220
- } from "./index-dmfbmnp7.js";
220
+ } from "./index-vywbn766.js";
221
221
  import {
222
222
  authorizeCuration,
223
223
  buildConfigFingerprintInput
@@ -252,12 +252,12 @@ import {
252
252
  transitionTaskWorkflowEvidence,
253
253
  withTaskEvidenceTransaction,
254
254
  writeWorkflowWalFile
255
- } from "./index-fwe1wh6r.js";
255
+ } from "./index-we3nf5as.js";
256
256
  import {
257
257
  makeWorktreeBranchName,
258
258
  provisionWorktree,
259
259
  removeWorktree
260
- } from "./index-a1884hh4.js";
260
+ } from "./index-pvzaryhr.js";
261
261
  import {
262
262
  DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
263
263
  DELEGATION_COMPACTION_HIGH_WATER_BYTES,
@@ -272,7 +272,7 @@ import {
272
272
  scanBackgroundCoderReservationsForAdmission,
273
273
  scanDelegationsForRecovery,
274
274
  sweepStaleDelegations
275
- } from "./index-yfbp4q09.js";
275
+ } from "./index-e2s08v0q.js";
276
276
  import {
277
277
  compositeSessionKey,
278
278
  sessionKeySuffix
@@ -283,7 +283,7 @@ import {
283
283
  clearAllScopes,
284
284
  clearScopeBindingFromDisk,
285
285
  clearScopeBindings
286
- } from "./index-nvta6kcv.js";
286
+ } from "./index-ynjy98vv.js";
287
287
  import {
288
288
  appendLedgerEvent,
289
289
  computePlanHash,
@@ -298,7 +298,7 @@ import {
298
298
  readPlanEpochIdentity,
299
299
  replayFromLedgerWithStatus,
300
300
  takeSnapshotEvent
301
- } from "./index-6xxpwk5x.js";
301
+ } from "./index-b82tq895.js";
302
302
  import {
303
303
  CORE_EVENT_LOCKED,
304
304
  appendCoreEventSync,
@@ -357,7 +357,7 @@ import {
357
357
  transactFile,
358
358
  transactKnowledge,
359
359
  wordBigrams
360
- } from "./index-x71shq8j.js";
360
+ } from "./index-erdsawqz.js";
361
361
  import {
362
362
  MAX_EVENT_LOG_ENTRIES,
363
363
  _internals as _internals2,
@@ -373,10 +373,10 @@ import {
373
373
  recordKnowledgeEvent,
374
374
  recordPhaseCloseIntent,
375
375
  resolveKnowledgeEventsPath
376
- } from "./index-f036tggv.js";
376
+ } from "./index-35grv4jg.js";
377
377
  import {
378
378
  resolveWorktreeIsolationConfig
379
- } from "./index-gm10kvne.js";
379
+ } from "./index-hte1e31d.js";
380
380
  import {
381
381
  RetrospectiveEvidenceSchema
382
382
  } from "./index-gprxjmm7.js";
@@ -399,7 +399,7 @@ import {
399
399
  init_loader,
400
400
  loadPluginConfig,
401
401
  loadPluginConfigWithMeta
402
- } from "./index-663wnh64.js";
402
+ } from "./index-tcbjjppb.js";
403
403
  import {
404
404
  DEFAULT_HARNESS_EVOLUTION_CONFIG,
405
405
  DEFAULT_PR_REVIEW_RESILIENCE_CONFIG,
@@ -415,7 +415,7 @@ import {
415
415
  package_default,
416
416
  resolveAutoReviewConfig,
417
417
  stripKnownSwarmPrefix
418
- } from "./index-f776m4r5.js";
418
+ } from "./index-b1tenv2s.js";
419
419
  import {
420
420
  init_git_executable,
421
421
  resolveGitExecutable,
@@ -21040,7 +21040,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
21040
21040
  };
21041
21041
  }
21042
21042
  async function sweepActiveNearDuplicates(directory, options = {}) {
21043
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-zawd71cg.js");
21043
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ghjs1n7k.js");
21044
21044
  const { config } = loadPluginConfigWithMeta2(directory);
21045
21045
  const sweepConfig = config.learning?.dedup_sweep;
21046
21046
  if (sweepConfig?.enabled === false)
@@ -22170,7 +22170,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
22170
22170
  }
22171
22171
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
22172
22172
  try {
22173
- const skillModule = await import("./skill-generator-frgppk1w.js");
22173
+ const skillModule = await import("./skill-generator-a2ekcbe2.js");
22174
22174
  for (const cand of skillCandidates) {
22175
22175
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
22176
22176
  continue;
@@ -22642,7 +22642,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
22642
22642
  } catch {}
22643
22643
  }
22644
22644
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
22645
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-22zaj224.js");
22645
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-x85t1e66.js");
22646
22646
  for (const { id } of contradictedEntries) {
22647
22647
  try {
22648
22648
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -23461,7 +23461,7 @@ async function runCuratorPostMortem(directory, options = {}) {
23461
23461
  warnings.push("Failed to collect knowledge summary.");
23462
23462
  }
23463
23463
  try {
23464
- const { getScanStatus } = await import("./scan-cursor-8acs9kwe.js");
23464
+ const { getScanStatus } = await import("./scan-cursor-m3w0tapb.js");
23465
23465
  const scanStatus = await getScanStatus(directory);
23466
23466
  if (scanStatus.remaining_estimate > 0) {
23467
23467
  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.`);
@@ -23633,9 +23633,9 @@ var _internals27 = {
23633
23633
  verifyPostMortemKnowledgeActions,
23634
23634
  repairPostMortemActions,
23635
23635
  loadDefaultKnowledgeConfig: async (directory) => {
23636
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-rjhassd0.js");
23636
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-0b0dqn28.js");
23637
23637
  try {
23638
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-zawd71cg.js");
23638
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ghjs1n7k.js");
23639
23639
  const loaded = loadPluginConfigWithMeta2(directory);
23640
23640
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
23641
23641
  } catch {
@@ -23643,11 +23643,11 @@ var _internals27 = {
23643
23643
  }
23644
23644
  },
23645
23645
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
23646
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-g06sa98p.js");
23646
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-w4ntvkz5.js");
23647
23647
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
23648
23648
  },
23649
23649
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
23650
- const { checkHivePromotions } = await import("./hive-promoter-zxy07gjg.js");
23650
+ const { checkHivePromotions } = await import("./hive-promoter-mfq3ee0n.js");
23651
23651
  return checkHivePromotions(entries, knowledgeConfig, directory);
23652
23652
  },
23653
23653
  applyProposalTriage: async (directory, triage) => {
@@ -23656,7 +23656,7 @@ var _internals27 = {
23656
23656
  activateProposal,
23657
23657
  listSkills: listSkills2,
23658
23658
  sanitizeSlug
23659
- } = await import("./skill-generator-frgppk1w.js");
23659
+ } = await import("./skill-generator-a2ekcbe2.js");
23660
23660
  const result = {
23661
23661
  approved: [],
23662
23662
  rejected: [],
@@ -24986,9 +24986,9 @@ function hashContent(content) {
24986
24986
  return createHash13("sha1").update(content).digest("hex");
24987
24987
  }
24988
24988
  async function loadConfigForPolicyCurator(directory) {
24989
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-rjhassd0.js");
24989
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-0b0dqn28.js");
24990
24990
  try {
24991
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-zawd71cg.js");
24991
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ghjs1n7k.js");
24992
24992
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
24993
24993
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
24994
24994
  } catch {
@@ -25466,12 +25466,15 @@ RETRY: your last output was missing ${result.missing.join("; ")}; produce valid
25466
25466
  }
25467
25467
  async function appendCuratorSkippedEvent(directory, record) {
25468
25468
  try {
25469
+ const redactedLesson = redactSecrets(record.lesson);
25469
25470
  appendCoreEventSync(directory, {
25470
25471
  timestamp: new Date().toISOString(),
25471
25472
  event: "curator_skipped",
25472
25473
  entry_id: record.entry_id,
25473
- lesson: record.lesson.slice(0, 200),
25474
- reason: record.reason
25474
+ content_hash: hashContent(redactedLesson),
25475
+ lesson: redactedLesson.slice(0, 200),
25476
+ reason: record.reason,
25477
+ ...record.duplicate_target_id ? { duplicate_target_id: record.duplicate_target_id } : {}
25475
25478
  });
25476
25479
  } catch {}
25477
25480
  }
@@ -25624,12 +25627,6 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
25624
25627
  continue;
25625
25628
  }
25626
25629
  }
25627
- const duplicate = findActiveSwarmNearDuplicate(lesson, snapshotPlusNew, config.dedup_threshold);
25628
- if (duplicate) {
25629
- pendingReinforcementIds.add(duplicate.id);
25630
- skipped++;
25631
- continue;
25632
- }
25633
25630
  const entry = {
25634
25631
  id: crypto.randomUUID(),
25635
25632
  tier: "swarm",
@@ -25657,6 +25654,18 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
25657
25654
  project_name: projectName,
25658
25655
  auto_generated: true
25659
25656
  };
25657
+ const duplicate = findActiveSwarmNearDuplicate(lesson, snapshotPlusNew, config.dedup_threshold);
25658
+ if (duplicate) {
25659
+ pendingReinforcementIds.add(duplicate.id);
25660
+ skipped++;
25661
+ await appendCuratorSkippedEvent(directory, {
25662
+ entry_id: entry.id,
25663
+ lesson,
25664
+ reason: "near_duplicate",
25665
+ duplicate_target_id: duplicate.id
25666
+ });
25667
+ continue;
25668
+ }
25660
25669
  const actionability = validateActionability(entry);
25661
25670
  if (!actionability.actionable && options?.llmDelegate) {
25662
25671
  pendingBatchEnrichment.push({ entry, lesson, category, tags });
@@ -25730,17 +25739,35 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
25730
25739
  try {
25731
25740
  await appendUnactionable(directory, entry, "insight_unactionable");
25732
25741
  } catch {}
25742
+ await appendCuratorSkippedEvent(directory, {
25743
+ entry_id: entry.id,
25744
+ lesson: entry.lesson,
25745
+ reason: "insight_unactionable"
25746
+ });
25733
25747
  continue;
25734
25748
  }
25735
25749
  const marker = insightAdmissionMarker(resolveInsightCandidateId(cand));
25736
- if (findActiveEntryWithInsightMarker(snapshotPlusNew, marker)) {
25750
+ const admitted = findActiveEntryWithInsightMarker(snapshotPlusNew, marker);
25751
+ if (admitted) {
25737
25752
  skipped++;
25753
+ await appendCuratorSkippedEvent(directory, {
25754
+ entry_id: entry.id,
25755
+ lesson: entry.lesson,
25756
+ reason: "already_admitted",
25757
+ duplicate_target_id: admitted.id
25758
+ });
25738
25759
  continue;
25739
25760
  }
25740
25761
  const duplicate = findActiveSwarmNearDuplicate(entry.lesson, snapshotPlusNew, config.dedup_threshold);
25741
25762
  if (duplicate) {
25742
25763
  insightReinforcements.push({ entryId: duplicate.id, marker });
25743
25764
  skipped++;
25765
+ await appendCuratorSkippedEvent(directory, {
25766
+ entry_id: entry.id,
25767
+ lesson: entry.lesson,
25768
+ reason: "near_duplicate",
25769
+ duplicate_target_id: duplicate.id
25770
+ });
25744
25771
  continue;
25745
25772
  }
25746
25773
  toAdd.push(entry);
@@ -25749,6 +25776,7 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
25749
25776
  } catch {}
25750
25777
  let stored = 0;
25751
25778
  let reinforced = 0;
25779
+ const transactionSkipEvents = [];
25752
25780
  if (toAdd.length > 0 || pendingReinforcementIds.size > 0 || insightReinforcements.length > 0) {
25753
25781
  await transactKnowledge(knowledgePath, (current) => {
25754
25782
  let changed = false;
@@ -25787,13 +25815,26 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
25787
25815
  const trulyNew = [];
25788
25816
  for (const entry of toAdd) {
25789
25817
  const marker = findInsightAdmissionMarker(entry.source_knowledge_ids);
25790
- if (marker && findActiveEntryWithInsightMarker(current, marker)) {
25818
+ const admitted = marker ? findActiveEntryWithInsightMarker(current, marker) : undefined;
25819
+ if (admitted) {
25791
25820
  skipped++;
25821
+ transactionSkipEvents.push({
25822
+ entry_id: entry.id,
25823
+ lesson: entry.lesson,
25824
+ reason: "already_admitted",
25825
+ duplicate_target_id: admitted.id
25826
+ });
25792
25827
  continue;
25793
25828
  }
25794
25829
  const duplicate = findActiveSwarmNearDuplicate(entry.lesson, current, config.dedup_threshold);
25795
25830
  if (duplicate) {
25796
25831
  skipped++;
25832
+ transactionSkipEvents.push({
25833
+ entry_id: entry.id,
25834
+ lesson: entry.lesson,
25835
+ reason: "near_duplicate",
25836
+ duplicate_target_id: duplicate.id
25837
+ });
25797
25838
  const result = reinforceSwarmKnowledgeEntry(duplicate, {
25798
25839
  phase_number: phaseInfo.phase_number,
25799
25840
  confirmed_at: new Date().toISOString(),
@@ -25816,6 +25857,9 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
25816
25857
  }
25817
25858
  return changed ? current : null;
25818
25859
  });
25860
+ for (const event of transactionSkipEvents) {
25861
+ await appendCuratorSkippedEvent(directory, event);
25862
+ }
25819
25863
  }
25820
25864
  await enforceKnowledgeCap(knowledgePath, config.swarm_max_entries);
25821
25865
  if (stored > 0) {
@@ -26022,7 +26066,7 @@ function safeRealpathSync(targetPath, fallback, realpathResolver = realpathSync3
26022
26066
  }
26023
26067
 
26024
26068
  // src/tools/repo-graph/types.ts
26025
- var GRAPH_SCHEMA_VERSION = "1.5.0";
26069
+ var GRAPH_SCHEMA_VERSION = "1.6.0";
26026
26070
  var DEFAULT_MAX_SOURCE_BYTES = 1024 * 1024;
26027
26071
  var FILE_ROLE_VALUES = [
26028
26072
  "api_route",
@@ -26111,6 +26155,15 @@ var SYMBOL_EDGE_RESOLUTION_VALUES = [
26111
26155
  "heuristic",
26112
26156
  "unresolved"
26113
26157
  ];
26158
+ var GRAPH_SYMBOL_KIND_VALUES = [
26159
+ "function",
26160
+ "class",
26161
+ "const",
26162
+ "type",
26163
+ "interface",
26164
+ "enum",
26165
+ "method"
26166
+ ];
26114
26167
  var PACKAGE_BOUNDARY_ROOTS = new Set([
26115
26168
  "packages",
26116
26169
  "crates",
@@ -26154,6 +26207,7 @@ var SECURITY_KIND_SET = new Set(SECURITY_KIND_VALUES);
26154
26207
  var SECURITY_CONFIDENCE_SET = new Set(SECURITY_CONFIDENCE_VALUES);
26155
26208
  var ONTOLOGY_FINDING_SEVERITY_SET = new Set(ONTOLOGY_FINDING_SEVERITY_VALUES);
26156
26209
  var IMPORT_TYPE_SET = new Set(IMPORT_TYPE_VALUES);
26210
+ var GRAPH_SYMBOL_KIND_SET = new Set(GRAPH_SYMBOL_KIND_VALUES);
26157
26211
  function validateWorkspace(workspace) {
26158
26212
  if (!workspace || typeof workspace !== "string" || workspace.trim() === "") {
26159
26213
  throw new Error("Invalid workspace: must be a non-empty string");
@@ -33127,7 +33181,7 @@ function buildReflectionDataSummary(data) {
33127
33181
  lines.push("KNOWLEDGE DELTA:");
33128
33182
  lines.push(` - ${kd.sessionKnowledgeCreated} knowledge entries created this session.`);
33129
33183
  if (kd.curation) {
33130
- lines.push(` - Curation (finalize batch): ${kd.curation.stored} stored, ${kd.curation.reinforced} reinforced, ${kd.curation.skipped} skipped, ${kd.curation.rejected} rejected, ${kd.curation.quarantined} quarantined.`);
33184
+ lines.push(` - Curation (finalize batch): ${kd.curation.stored} stored, ${kd.curation.reinforced} reinforced, ${kd.curation.skipped} skipped (dedup/already-admitted; audit: .swarm/events.jsonl curator_skipped), ${kd.curation.rejected} rejected (validator-refused; ledger: .swarm/knowledge-rejected.jsonl), ${kd.curation.quarantined} quarantined (actionability-gated; queue: .swarm/knowledge-unactionable.jsonl; audit: .swarm/events.jsonl curator_skipped).`);
33131
33185
  }
33132
33186
  if (kd.admitted !== undefined || kd.reinforcedRealtime !== undefined || kd.rejectedCurator !== undefined) {
33133
33187
  lines.push(` - Realtime admission: ${kd.admitted ?? 0} admitted, ${kd.reinforcedRealtime ?? 0} reinforced, ${kd.rejectedCurator ?? 0} curator-rejected (from durable markers).`);
@@ -33163,7 +33217,7 @@ function buildSignalsBlock(data) {
33163
33217
  lines.push("**Knowledge Delta**");
33164
33218
  lines.push(`- ${kd.sessionKnowledgeCreated} knowledge entries created this session.`);
33165
33219
  if (kd.curation) {
33166
- lines.push(`- Curation (finalize batch): ${kd.curation.stored} stored, ${kd.curation.reinforced} reinforced, ${kd.curation.skipped} skipped, ${kd.curation.rejected} rejected, ${kd.curation.quarantined} quarantined.`);
33220
+ lines.push(`- Curation (finalize batch): ${kd.curation.stored} stored, ${kd.curation.reinforced} reinforced, ${kd.curation.skipped} skipped (dedup/already-admitted; audit: .swarm/events.jsonl curator_skipped), ${kd.curation.rejected} rejected (validator-refused; ledger: .swarm/knowledge-rejected.jsonl), ${kd.curation.quarantined} quarantined (actionability-gated; queue: .swarm/knowledge-unactionable.jsonl; audit: .swarm/events.jsonl curator_skipped).`);
33167
33221
  }
33168
33222
  if (kd.admitted !== undefined || kd.reinforcedRealtime !== undefined || kd.rejectedCurator !== undefined) {
33169
33223
  lines.push(`- Realtime admission: ${kd.admitted ?? 0} admitted, ${kd.reinforcedRealtime ?? 0} reinforced, ${kd.rejectedCurator ?? 0} curator-rejected (from durable markers).`);
@@ -36682,6 +36736,17 @@ async function runAbortableSkillReview(req, timeoutMs) {
36682
36736
  clearTimeout(timeout);
36683
36737
  }
36684
36738
  }
36739
+ async function archiveCloseSummary(ctx, closeSummaryPath, summaryWritten) {
36740
+ if (!summaryWritten || ctx.archiveStageFailed || !ctx.archiveDir)
36741
+ return;
36742
+ try {
36743
+ await fs17.copyFile(closeSummaryPath, path47.join(ctx.archiveDir, "close-summary.md"));
36744
+ } catch (error2) {
36745
+ const msg = error2 instanceof Error ? error2.message : String(error2);
36746
+ ctx.warnings.push(`Failed to archive close-summary.md: ${msg}`);
36747
+ log("[close-command] Failed to archive close-summary.md:", error2);
36748
+ }
36749
+ }
36685
36750
  function normalizeLessonText(text) {
36686
36751
  return (text ?? "").trim().toLowerCase();
36687
36752
  }
@@ -37176,7 +37241,7 @@ async function runFinalizeStage(ctx) {
37176
37241
  }
37177
37242
  }
37178
37243
  try {
37179
- const { CuratorConfigSchema: CCS } = await import("./schema-rjhassd0.js");
37244
+ const { CuratorConfigSchema: CCS } = await import("./schema-0b0dqn28.js");
37180
37245
  const { config: pmLoadedConfig } = _internals41.loadPluginConfigWithMeta(ctx.directory);
37181
37246
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
37182
37247
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -37919,13 +37984,16 @@ No active state was archived or removed. Fix the reported durable-state problem,
37919
37984
  ...ctx.warnings.length > 0 ? ["## Warnings", ...ctx.warnings.map((w) => `- ${w}`), ""] : []
37920
37985
  ].join(`
37921
37986
  `);
37987
+ let closeSummaryWritten = false;
37922
37988
  try {
37923
37989
  await atomicWriteSwarmFile(closeSummaryPath, summaryContent);
37990
+ closeSummaryWritten = true;
37924
37991
  } catch (error2) {
37925
37992
  const msg = error2 instanceof Error ? error2.message : String(error2);
37926
37993
  ctx.warnings.push(`Failed to write close-summary.md: ${msg}`);
37927
37994
  log("[close-command] Failed to write close-summary.md:", error2);
37928
37995
  }
37996
+ await archiveCloseSummary(ctx, closeSummaryPath, closeSummaryWritten);
37929
37997
  try {
37930
37998
  const sessionIdsToEnd = [...swarmState.agentSessions.keys()];
37931
37999
  for (const sessionId of sessionIdsToEnd) {
@@ -38050,6 +38118,7 @@ var _internals41 = {
38050
38118
  runFinalizeRewardSweep,
38051
38119
  acquireFinalizeLock,
38052
38120
  runArchiveStage,
38121
+ archiveCloseSummary,
38053
38122
  runArchiveEvidenceRetention,
38054
38123
  runCleanStage,
38055
38124
  runAlignStage,
@@ -39395,9 +39464,9 @@ var _internals45 = {
39395
39464
  loadPluginConfigWithMeta,
39396
39465
  loadCuratorDeps: async () => {
39397
39466
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
39398
- import("./schema-rjhassd0.js"),
39399
- import("./curator-g06sa98p.js"),
39400
- import("./curator-llm-factory-r8q84m4g.js")
39467
+ import("./schema-0b0dqn28.js"),
39468
+ import("./curator-w4ntvkz5.js"),
39469
+ import("./curator-llm-factory-c4y1mrr5.js")
39401
39470
  ]);
39402
39471
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
39403
39472
  }
@@ -40406,7 +40475,7 @@ async function computeCurationDiagnostics(directory, entries) {
40406
40475
  let scanCompleted = false;
40407
40476
  let scanRemaining = 0;
40408
40477
  try {
40409
- const { getScanStatus } = await import("./scan-cursor-8acs9kwe.js");
40478
+ const { getScanStatus } = await import("./scan-cursor-m3w0tapb.js");
40410
40479
  const status = await getScanStatus(directory);
40411
40480
  scanGeneration = status.generation;
40412
40481
  scanCompleted = status.completed;
@@ -40416,10 +40485,10 @@ async function computeCurationDiagnostics(directory, entries) {
40416
40485
  try {
40417
40486
  const { isLinked: isLinked2 } = await import("./knowledge-link-cj2abbae.js");
40418
40487
  if (isLinked2(directory)) {
40419
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-rjhassd0.js");
40488
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-0b0dqn28.js");
40420
40489
  let config;
40421
40490
  try {
40422
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-zawd71cg.js");
40491
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-ghjs1n7k.js");
40423
40492
  const loaded = loadPluginConfigWithMeta2(directory);
40424
40493
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
40425
40494
  } catch {
@@ -41739,7 +41808,7 @@ async function handleDoctorCommand(directory, args) {
41739
41808
  const result = runConfigDoctor(config, directory);
41740
41809
  let output;
41741
41810
  if (enableAutoFix && result.hasAutoFixableIssues) {
41742
- const { runConfigDoctorWithFixes } = await import("./config-doctor-ewn2kw6d.js");
41811
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-nkx61b9e.js");
41743
41812
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
41744
41813
  applyLossy: true
41745
41814
  });
@@ -42679,7 +42748,7 @@ async function handleEvidenceCommand(directory, args) {
42679
42748
  return formatTaskEvidenceMarkdown(evidenceData);
42680
42749
  }
42681
42750
  async function handleEvidenceSummaryCommand(directory) {
42682
- const { buildEvidenceSummary } = await import("./evidence-summary-service-ttd0ntm0.js");
42751
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-vadgnzk6.js");
42683
42752
  const artifact = await buildEvidenceSummary(directory);
42684
42753
  if (!artifact) {
42685
42754
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -79786,7 +79855,7 @@ function buildDetailedHelp(commandName, entry) {
79786
79855
  async function handleHelpCommand(ctx) {
79787
79856
  const targetCommand = ctx.args.join(" ");
79788
79857
  if (!targetCommand) {
79789
- const { buildHelpText } = await import("./index-745dh1z1.js");
79858
+ const { buildHelpText } = await import("./index-8kfbdrxa.js");
79790
79859
  return buildHelpText();
79791
79860
  }
79792
79861
  const tokens = targetCommand.split(/\s+/);
@@ -79795,7 +79864,7 @@ async function handleHelpCommand(ctx) {
79795
79864
  return _internals100.buildDetailedHelp(resolved.key, resolved.entry);
79796
79865
  }
79797
79866
  const similar = _internals100.findSimilarCommands(targetCommand);
79798
- const { buildHelpText: fullHelp } = await import("./index-745dh1z1.js");
79867
+ const { buildHelpText: fullHelp } = await import("./index-8kfbdrxa.js");
79799
79868
  if (similar.length > 0) {
79800
79869
  return `Command '/swarm ${targetCommand}' not found.
79801
79870
 
@@ -80126,7 +80195,7 @@ var COMMAND_REGISTRY = {
80126
80195
  },
80127
80196
  "guardrail explain": {
80128
80197
  handler: async (ctx) => {
80129
- const { handleGuardrailExplain } = await import("./guardrail-explain-qf4k176t.js");
80198
+ const { handleGuardrailExplain } = await import("./guardrail-explain-ax2qmsp4.js");
80130
80199
  return handleGuardrailExplain(ctx.directory, ctx.args);
80131
80200
  },
80132
80201
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -80136,7 +80205,7 @@ var COMMAND_REGISTRY = {
80136
80205
  },
80137
80206
  "guardrail reset": {
80138
80207
  handler: async (ctx) => {
80139
- const { handleGuardrailReset } = await import("./guardrail-reset-zpxk0p1j.js");
80208
+ const { handleGuardrailReset } = await import("./guardrail-reset-wvdb5sv5.js");
80140
80209
  return handleGuardrailReset(ctx.args, ctx.sessionID);
80141
80210
  },
80142
80211
  description: "Reset one exact active invocation/action circuit after repair",
@@ -80145,7 +80214,7 @@ var COMMAND_REGISTRY = {
80145
80214
  },
80146
80215
  "guardrail-explain": {
80147
80216
  handler: async (ctx) => {
80148
- const { handleGuardrailExplain } = await import("./guardrail-explain-qf4k176t.js");
80217
+ const { handleGuardrailExplain } = await import("./guardrail-explain-ax2qmsp4.js");
80149
80218
  return handleGuardrailExplain(ctx.directory, ctx.args);
80150
80219
  },
80151
80220
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -80155,7 +80224,7 @@ var COMMAND_REGISTRY = {
80155
80224
  },
80156
80225
  "guardrail-reset": {
80157
80226
  handler: async (ctx) => {
80158
- const { handleGuardrailReset } = await import("./guardrail-reset-zpxk0p1j.js");
80227
+ const { handleGuardrailReset } = await import("./guardrail-reset-wvdb5sv5.js");
80159
80228
  return handleGuardrailReset(ctx.args, ctx.sessionID);
80160
80229
  },
80161
80230
  description: "Reset one exact active invocation/action circuit after repair",
@@ -80165,7 +80234,7 @@ var COMMAND_REGISTRY = {
80165
80234
  },
80166
80235
  "guardrail-log": {
80167
80236
  handler: async (ctx) => {
80168
- const { handleGuardrailLog } = await import("./guardrail-log-g4qc595v.js");
80237
+ const { handleGuardrailLog } = await import("./guardrail-log-t3c9g8tc.js");
80169
80238
  return handleGuardrailLog(ctx.directory, ctx.args);
80170
80239
  },
80171
80240
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -86158,7 +86227,7 @@ function getDisplayFinalPromptPressure() {
86158
86227
  async function rehydratePrSubscriptions(sessionID, directory) {
86159
86228
  const map = new Map;
86160
86229
  try {
86161
- const { listActive: listActive2 } = await import("./pr-subscriptions-cgac3ydd.js");
86230
+ const { listActive: listActive2 } = await import("./pr-subscriptions-j9j70bmd.js");
86162
86231
  const records = await listActive2(directory);
86163
86232
  for (const record of records) {
86164
86233
  if (record.sessionID !== sessionID)
@@ -86604,7 +86673,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
86604
86673
  return extracted === expectedSessionId;
86605
86674
  }
86606
86675
  async function inspectStandardWorktreeCollisionOwnership(identity) {
86607
- const collisionOwnership = await import("./worktree-collision-ownership-f5sj6ffa.js");
86676
+ const collisionOwnership = await import("./worktree-collision-ownership-5qaab3q7.js");
86608
86677
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
86609
86678
  }
86610
86679
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -87013,7 +87082,7 @@ async function precreateStandardWorktreeSession(args) {
87013
87082
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
87014
87083
  if (laneProfile) {
87015
87084
  try {
87016
- const { writeLaneProfileToDiskReal } = await import("./core-72wdmzps.js");
87085
+ const { writeLaneProfileToDiskReal } = await import("./core-b3db7gf6.js");
87017
87086
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
87018
87087
  } catch {}
87019
87088
  }
@@ -87938,7 +88007,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
87938
88007
  }
87939
88008
  clearWorktreeMergeStatus(statusKey);
87940
88009
  try {
87941
- const { removeLaneProfileFromDiskReal } = await import("./core-72wdmzps.js");
88010
+ const { removeLaneProfileFromDiskReal } = await import("./core-b3db7gf6.js");
87942
88011
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
87943
88012
  } catch {}
87944
88013
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -6,7 +6,7 @@ import {
6
6
  PluginConfigSchema,
7
7
  init_schema,
8
8
  stripKnownSwarmPrefix
9
- } from "./index-f776m4r5.js";
9
+ } from "./index-b1tenv2s.js";
10
10
  import {
11
11
  ALL_AGENT_NAMES,
12
12
  init_constants
@@ -1183,6 +1183,20 @@ function validateConfigKey(path2, value) {
1183
1183
  }
1184
1184
  break;
1185
1185
  }
1186
+ case "$schema": {
1187
+ if (value !== undefined && typeof value !== "string") {
1188
+ findings.push({
1189
+ id: "invalid-$schema-type",
1190
+ title: "Invalid $schema type",
1191
+ description: `"$schema" must be a string (JSON Schema URL), got ${typeof value}`,
1192
+ severity: "error",
1193
+ path: "$schema",
1194
+ currentValue: value,
1195
+ autoFixable: false
1196
+ });
1197
+ }
1198
+ break;
1199
+ }
1186
1200
  case "full_auto": {
1187
1201
  emitObjectTypeMismatch("full_auto", value, findings);
1188
1202
  break;
@@ -14,14 +14,14 @@ import {
14
14
  detectWindowsWrites,
15
15
  getSharedClassifierGuardrailBlock,
16
16
  resolveWriteTargets
17
- } from "./index-rac2gkvr.js";
17
+ } from "./index-3e8600a7.js";
18
18
  import {
19
19
  checkFileAuthority,
20
20
  classifyFile,
21
21
  isInDeclaredScope,
22
22
  redactPath,
23
23
  redactShellCommand
24
- } from "./index-rc93mm6e.js";
24
+ } from "./index-04yrxg0z.js";
25
25
 
26
26
  // src/services/guardrail-explain-service.ts
27
27
  import path from "path";