agentsmesh 0.37.0 → 0.38.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.
@@ -137,7 +137,7 @@ declare const DEFAULT_RECALL_LIMIT = 10;
137
137
  * lean; without a budget a broad match can return ~450+ rule-tokens. `--all`
138
138
  * (CLI) bypasses both caps. The top result is always kept (see RankOptions).
139
139
  */
140
- declare const DEFAULT_RECALL_MAX_TOKENS = 400;
140
+ declare const DEFAULT_RECALL_MAX_TOKENS = 1200;
141
141
  /**
142
142
  * Rank matched lessons by relevance and apply optional caps. Three lightweight
143
143
  * signals are weighted-reciprocal-rank-fused (RRF): trigger specificity (inverse
package/dist/lessons.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as RankedLesson, j as LessonsQuery, A as AddLessonInput, a as AddLessonOptions, b as AddLessonResult } from './init-BtgoRmIs.js';
2
- export { c as AddLessonTriggers, D as DEFAULT_RECALL_LIMIT, X as DEFAULT_RECALL_MAX_TOKENS, I as ImportLegacyOptions, d as ImportLegacyReport, Y as LESSONS_LOCK_FILENAME, L as LESSONS_PROCEDURAL_RULE, e as Lesson, f as LessonStatus, g as LessonsGraph, Z as LessonsGraphExistsError, h as LessonsGraphSchema, i as LessonsPaths, M as MatchedLesson, k as MergeLessonsOptions, l as MergeLessonsResult, m as MutateOptions, R as RankOptions, n as RankReason, S as ScaffoldLessonsResult, p as StripMarkersOptions, q as StripMarkersReport, T as Topic, r as Trigger, s as TriggerKind, U as UnknownTopicError, V as ValidationFinding, t as ValidationLevel, u as ValidationReport, v as acquireLessonsLock, w as addLesson, x as graphFilePath, y as importLegacyLessons, _ as lessonsLockPath, z as lessonsPaths, B as loadLessonsGraph, C as mergeLessons, E as mutateLessonsGraph, F as parseGraph, G as queryLessons, H as rankLessons, J as scaffoldLessons, K as serializeGraph, N as stripLegacyMarkers, O as stripMarkersInGraph, P as toRelPath, Q as tryLoadLessonsGraph, W as validateLessonsGraph } from './init-BtgoRmIs.js';
1
+ import { o as RankedLesson, j as LessonsQuery, A as AddLessonInput, a as AddLessonOptions, b as AddLessonResult } from './init-z8Dlr5Cm.js';
2
+ export { c as AddLessonTriggers, D as DEFAULT_RECALL_LIMIT, X as DEFAULT_RECALL_MAX_TOKENS, I as ImportLegacyOptions, d as ImportLegacyReport, Y as LESSONS_LOCK_FILENAME, L as LESSONS_PROCEDURAL_RULE, e as Lesson, f as LessonStatus, g as LessonsGraph, Z as LessonsGraphExistsError, h as LessonsGraphSchema, i as LessonsPaths, M as MatchedLesson, k as MergeLessonsOptions, l as MergeLessonsResult, m as MutateOptions, R as RankOptions, n as RankReason, S as ScaffoldLessonsResult, p as StripMarkersOptions, q as StripMarkersReport, T as Topic, r as Trigger, s as TriggerKind, U as UnknownTopicError, V as ValidationFinding, t as ValidationLevel, u as ValidationReport, v as acquireLessonsLock, w as addLesson, x as graphFilePath, y as importLegacyLessons, _ as lessonsLockPath, z as lessonsPaths, B as loadLessonsGraph, C as mergeLessons, E as mutateLessonsGraph, F as parseGraph, G as queryLessons, H as rankLessons, J as scaffoldLessons, K as serializeGraph, N as stripLegacyMarkers, O as stripMarkersInGraph, P as toRelPath, Q as tryLoadLessonsGraph, W as validateLessonsGraph } from './init-z8Dlr5Cm.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/lessons.js CHANGED
@@ -1587,6 +1587,28 @@ function collectFanout(graph, findings) {
1587
1587
  function normalizeRule2(rule) {
1588
1588
  return rule.trim().replace(/\s+/g, " ").toLowerCase();
1589
1589
  }
1590
+ var TIED_TRIGGER_SET_THRESHOLD = 5;
1591
+ function collectTriggerSetCollisions(graph, findings) {
1592
+ const bySet = /* @__PURE__ */ new Map();
1593
+ for (const [id, lesson] of Object.entries(graph.lessons)) {
1594
+ if (lesson.status !== "active") continue;
1595
+ const key = [...lesson.triggers].sort().join(",");
1596
+ if (key === "") continue;
1597
+ const group = bySet.get(key);
1598
+ if (group === void 0) bySet.set(key, [id]);
1599
+ else group.push(id);
1600
+ }
1601
+ const contested = [...bySet.values()].filter((ids) => ids.length > TIED_TRIGGER_SET_THRESHOLD);
1602
+ if (contested.length === 0) return;
1603
+ const largest = contested.reduce((a, b) => b.length > a.length ? b : a);
1604
+ const affected = contested.reduce((n, ids) => n + ids.length, 0);
1605
+ findings.push({
1606
+ level: "warning",
1607
+ code: "TIED_TRIGGER_SETS",
1608
+ message: `${contested.length} trigger set(s) are each shared by more than ${TIED_TRIGGER_SET_THRESHOLD} active lessons (largest ${largest.length}, ${affected} lessons in total). Identical triggers score identically on specificity, so recall picks among them by weaker signals \u2014 split the triggers so the lesson that matters for a given file can win.`,
1609
+ lessonIds: largest.sort()
1610
+ });
1611
+ }
1590
1612
 
1591
1613
  // src/lessons/validate-keywords.ts
1592
1614
  function collectLowSignalKeywords(graph, findings) {
@@ -1651,6 +1673,7 @@ function validateLessonsGraph(graph, options = {}) {
1651
1673
  collectDuplicateTriggers(graph, findings);
1652
1674
  collectOrphans(graph, findings);
1653
1675
  collectFanout(graph, findings);
1676
+ collectTriggerSetCollisions(graph, findings);
1654
1677
  collectLowSignalKeywords(graph, findings);
1655
1678
  collectStopwordKeywords(graph, findings);
1656
1679
  collectRunnerAnchoredPatterns(graph, findings);
@@ -2244,7 +2267,7 @@ function buildTopicCoherence(matches) {
2244
2267
 
2245
2268
  // src/lessons/ranking.ts
2246
2269
  var DEFAULT_RECALL_LIMIT = 10;
2247
- var DEFAULT_RECALL_MAX_TOKENS = 400;
2270
+ var DEFAULT_RECALL_MAX_TOKENS = 1200;
2248
2271
  var RRF_K = 60;
2249
2272
  var SPECIFICITY_WEIGHT = 5;
2250
2273
  var TOPIC_COHERENCE_WEIGHT = 2;