nexus-agents 2.120.2 → 2.120.3

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.
@@ -117,7 +117,7 @@ import {
117
117
  DEFAULT_TASK_TTL_MS,
118
118
  DEFAULT_TOOL_RATE_LIMITS,
119
119
  clampTaskTtl
120
- } from "./chunk-GR46LD2P.js";
120
+ } from "./chunk-XOQEPBSL.js";
121
121
  import {
122
122
  resolveInsideRoot
123
123
  } from "./chunk-NUBSJGQZ.js";
@@ -36581,19 +36581,24 @@ async function discoverFromExtendedSource(source, topic, maxResults, logger56, s
36581
36581
  return { items: toDiscoveredItems(result.value), failed: false };
36582
36582
  }
36583
36583
  function computeRelevanceScore(item, topic) {
36584
- const keywords = topic.toLowerCase().split(/[\s,;+\-/]+/).filter((w) => w.length >= 3);
36584
+ const keywords = [
36585
+ ...new Set(
36586
+ topic.toLowerCase().split(/[\s,;+\-/]+/).filter((w) => w.length >= 3)
36587
+ )
36588
+ ];
36585
36589
  if (keywords.length === 0) return 1;
36586
36590
  const titleLower = item.title.toLowerCase();
36587
36591
  const descLower = item.description.toLowerCase();
36588
- let titleMatches = 0;
36589
- let descMatches = 0;
36592
+ let matched = 0;
36593
+ let titleHits = 0;
36590
36594
  for (const keyword of keywords) {
36591
- if (titleLower.includes(keyword)) titleMatches++;
36592
- if (descLower.includes(keyword)) descMatches++;
36595
+ const inTitle = titleLower.includes(keyword);
36596
+ if (inTitle || descLower.includes(keyword)) matched++;
36597
+ if (inTitle) titleHits++;
36593
36598
  }
36594
- const weightedMatches = titleMatches * 2 + descMatches;
36595
- const maxPossible = keywords.length * 3;
36596
- return Math.min(1, weightedMatches / maxPossible);
36599
+ const coverage = matched / keywords.length;
36600
+ const titleFraction = titleHits / keywords.length;
36601
+ return Math.min(1, coverage * 0.8 + titleFraction * 0.2);
36597
36602
  }
36598
36603
  function filterByRelevance2(items, topic, threshold) {
36599
36604
  const scored = items.map((item) => ({
@@ -49129,4 +49134,4 @@ export {
49129
49134
  detectBackend,
49130
49135
  createTaskTracker
49131
49136
  };
49132
- //# sourceMappingURL=chunk-VPTSHWYO.js.map
49137
+ //# sourceMappingURL=chunk-4DUL5HKB.js.map