@hiveai/mcp 0.12.0 → 0.12.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.
package/dist/server.js CHANGED
@@ -1495,6 +1495,7 @@ import {
1495
1495
  loadMemoriesFromDir as loadMemoriesFromDir14,
1496
1496
  loadUsageIndex as loadUsageIndex8,
1497
1497
  memoryMatchesAnchorPaths as memoryMatchesAnchorPaths2,
1498
+ rankMemoriesLexical as rankMemoriesLexical2,
1498
1499
  queryCodeMap,
1499
1500
  resolveBriefingBudget,
1500
1501
  serializeMemory as serializeMemory9,
@@ -1814,13 +1815,25 @@ async function getBriefing(input, ctx) {
1814
1815
  }
1815
1816
  if (act.applicable && act.activated) activatedSkills.add(id);
1816
1817
  }
1818
+ const lexNorm = /* @__PURE__ */ new Map();
1819
+ if (input.task) {
1820
+ const candidates = [...seen.keys()].map((id) => byId.get(id)).filter((x) => Boolean(x));
1821
+ const lex = rankMemoriesLexical2(candidates, input.task, candidates.length);
1822
+ const maxScore = lex.scores.reduce((m, s) => s > m ? s : m, 0);
1823
+ if (maxScore > 0) {
1824
+ lex.ranked.forEach((loaded, i) => {
1825
+ lexNorm.set(loaded.memory.frontmatter.id, (lex.scores[i] ?? 0) / maxScore);
1826
+ });
1827
+ }
1828
+ }
1817
1829
  const ranked = [...seen.values()].sort((a, b) => {
1818
1830
  const reasonScore = (m) => (m.type === "attempt" ? 3 : 0) + (m.reasons.includes("anchor") ? 4 : 0) + (m.reasons.includes("symbol") ? 4 : 0) + (m.reasons.includes("module") ? 2 : 0) + (m.reasons.includes("semantic") ? 2 : 0) + (m.reasons.includes("domain") ? 1 : 0);
1819
1831
  const confidenceScore = (m) => m.confidence === "authoritative" ? 4 : m.confidence === "trusted" ? 3 : m.confidence === "low" ? 1 : m.confidence === "stale" ? -2 : 0;
1820
1832
  const impactScore = (m) => (m.impact_score ?? 0) * 3;
1821
1833
  const activationBoost = (m) => activatedSkills.has(m.id) ? 5 : 0;
1822
- const sa = priorityRank(classifyMemoryPriority(a, byId.get(a.id), input.files, input.symbols)) * 100 + reasonScore(a) + confidenceScore(a) + impactScore(a) + activationBoost(a) + (a.semantic_score ?? 0);
1823
- const sb = priorityRank(classifyMemoryPriority(b, byId.get(b.id), input.files, input.symbols)) * 100 + reasonScore(b) + confidenceScore(b) + impactScore(b) + activationBoost(b) + (b.semantic_score ?? 0);
1834
+ const lexScore = (m) => 12 * (lexNorm.get(m.id) ?? 0);
1835
+ const sa = priorityRank(classifyMemoryPriority(a, byId.get(a.id), input.files, input.symbols)) * 100 + reasonScore(a) + confidenceScore(a) + impactScore(a) + activationBoost(a) + lexScore(a) + (a.semantic_score ?? 0);
1836
+ const sb = priorityRank(classifyMemoryPriority(b, byId.get(b.id), input.files, input.symbols)) * 100 + reasonScore(b) + confidenceScore(b) + impactScore(b) + activationBoost(b) + lexScore(b) + (b.semantic_score ?? 0);
1824
1837
  return sb - sa;
1825
1838
  });
1826
1839
  for (const mem of ranked.slice(0, briefingMaxMemories)) {
@@ -4004,7 +4017,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
4004
4017
  // src/server.ts
4005
4018
  import { hasRecentBriefingMarker, loadConfigSync } from "@hiveai/core";
4006
4019
  var SERVER_NAME = "haive";
4007
- var SERVER_VERSION = "0.12.0";
4020
+ var SERVER_VERSION = "0.12.3";
4008
4021
  function jsonResult(data) {
4009
4022
  return {
4010
4023
  content: [