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.
package/dist/engine.js CHANGED
@@ -33966,6 +33966,28 @@ function collectFanout(graph, findings) {
33966
33966
  function normalizeRule(rule) {
33967
33967
  return rule.trim().replace(/\s+/g, " ").toLowerCase();
33968
33968
  }
33969
+ var TIED_TRIGGER_SET_THRESHOLD = 5;
33970
+ function collectTriggerSetCollisions(graph, findings) {
33971
+ const bySet = /* @__PURE__ */ new Map();
33972
+ for (const [id, lesson] of Object.entries(graph.lessons)) {
33973
+ if (lesson.status !== "active") continue;
33974
+ const key = [...lesson.triggers].sort().join(",");
33975
+ if (key === "") continue;
33976
+ const group = bySet.get(key);
33977
+ if (group === void 0) bySet.set(key, [id]);
33978
+ else group.push(id);
33979
+ }
33980
+ const contested = [...bySet.values()].filter((ids) => ids.length > TIED_TRIGGER_SET_THRESHOLD);
33981
+ if (contested.length === 0) return;
33982
+ const largest = contested.reduce((a, b) => b.length > a.length ? b : a);
33983
+ const affected = contested.reduce((n, ids) => n + ids.length, 0);
33984
+ findings.push({
33985
+ level: "warning",
33986
+ code: "TIED_TRIGGER_SETS",
33987
+ 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.`,
33988
+ lessonIds: largest.sort()
33989
+ });
33990
+ }
33969
33991
 
33970
33992
  // src/lessons/ranking-text.ts
33971
33993
  var STOP = /* @__PURE__ */ new Set([
@@ -34200,6 +34222,7 @@ function validateLessonsGraph(graph, options = {}) {
34200
34222
  collectDuplicateTriggers(graph, findings);
34201
34223
  collectOrphans(graph, findings);
34202
34224
  collectFanout(graph, findings);
34225
+ collectTriggerSetCollisions(graph, findings);
34203
34226
  collectLowSignalKeywords(graph, findings);
34204
34227
  collectStopwordKeywords(graph, findings);
34205
34228
  collectRunnerAnchoredPatterns(graph, findings);