@hiveai/mcp 0.15.0 → 0.17.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/index.js +54 -22
- package/dist/index.js.map +1 -1
- package/dist/server.js +54 -22
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1575,6 +1575,7 @@ import {
|
|
|
1575
1575
|
deriveConfidence as deriveConfidence4,
|
|
1576
1576
|
estimateTokens,
|
|
1577
1577
|
evaluateSkillActivation,
|
|
1578
|
+
compactAutoRecapBody,
|
|
1578
1579
|
extractActionsBriefBody,
|
|
1579
1580
|
getUsage as getUsage6,
|
|
1580
1581
|
inferModulesFromPaths as inferModulesFromPaths2,
|
|
@@ -1608,7 +1609,12 @@ import { z as z19 } from "zod";
|
|
|
1608
1609
|
import { readdir as readdir3, readFile as readFile4 } from "fs/promises";
|
|
1609
1610
|
import { existsSync as existsSync20 } from "fs";
|
|
1610
1611
|
import path10 from "path";
|
|
1611
|
-
import {
|
|
1612
|
+
import {
|
|
1613
|
+
classifyMemoryPriority as coreClassifyPriority,
|
|
1614
|
+
isGlobPath,
|
|
1615
|
+
pathsOverlap,
|
|
1616
|
+
priorityRank as corePriorityRank
|
|
1617
|
+
} from "@hiveai/core";
|
|
1612
1618
|
function compactSummary(body) {
|
|
1613
1619
|
for (const line of body.split("\n")) {
|
|
1614
1620
|
const trimmed = line.replace(/^#+\s*/, "").trim();
|
|
@@ -1626,21 +1632,23 @@ function classifyMemoryPriority(memory, loaded, inputFiles, inputSymbols) {
|
|
|
1626
1632
|
(sym) => inputSymbols.some((wanted) => wanted.toLowerCase() === sym.toLowerCase())
|
|
1627
1633
|
)
|
|
1628
1634
|
);
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1635
|
+
const semantic = memory.semantic_score ?? 0;
|
|
1636
|
+
return coreClassifyPriority({
|
|
1637
|
+
type: memory.type,
|
|
1638
|
+
tags: fm?.tags ?? memory.tags ?? [],
|
|
1639
|
+
requiresHumanApproval: Boolean(fm?.requires_human_approval),
|
|
1640
|
+
directAnchor,
|
|
1641
|
+
directSymbol,
|
|
1642
|
+
exactTaskMatch: memory.match_quality === "exact",
|
|
1643
|
+
strongSemantic: semantic >= 0.65,
|
|
1644
|
+
usefulSemantic: semantic >= 0.35,
|
|
1645
|
+
moduleOrDomainMatch: memory.reasons.includes("module") || memory.reasons.includes("domain"),
|
|
1646
|
+
tagTaskMatch: false
|
|
1647
|
+
// MCP ranking doesn't use a separate tag-token signal
|
|
1648
|
+
});
|
|
1641
1649
|
}
|
|
1642
1650
|
function priorityRank(priority) {
|
|
1643
|
-
return priority
|
|
1651
|
+
return corePriorityRank(priority);
|
|
1644
1652
|
}
|
|
1645
1653
|
function classifyBriefingQuality(memories, context) {
|
|
1646
1654
|
const mustRead = memories.filter((m) => m.priority === "must_read").length;
|
|
@@ -1809,7 +1817,9 @@ async function getBriefing(input, ctx) {
|
|
|
1809
1817
|
id: fm.id,
|
|
1810
1818
|
scope: fm.scope,
|
|
1811
1819
|
revision_count: fm.revision_count ?? 0,
|
|
1812
|
-
|
|
1820
|
+
// Auto-generated recaps are low-signal tool dumps — compact them so they inform without
|
|
1821
|
+
// dominating the briefing head. Human/post_task recaps pass through unchanged.
|
|
1822
|
+
body: compactAutoRecapBody(r.memory.body)
|
|
1813
1823
|
};
|
|
1814
1824
|
}
|
|
1815
1825
|
const allMemories = allLoaded.filter(({ memory }) => {
|
|
@@ -2682,6 +2692,27 @@ function tokenizeDiffForLiteral(diff) {
|
|
|
2682
2692
|
const wordTokens = source.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length >= 4 && !CODE_STOPWORDS.has(t));
|
|
2683
2693
|
return [.../* @__PURE__ */ new Set([...wsTokens, ...wordTokens])];
|
|
2684
2694
|
}
|
|
2695
|
+
function stripAiDirHunks(diff) {
|
|
2696
|
+
if (!diff.includes("diff --git")) return diff;
|
|
2697
|
+
const out = [];
|
|
2698
|
+
let block = [];
|
|
2699
|
+
let keep = true;
|
|
2700
|
+
const flush = () => {
|
|
2701
|
+
if (keep) out.push(...block);
|
|
2702
|
+
block = [];
|
|
2703
|
+
keep = true;
|
|
2704
|
+
};
|
|
2705
|
+
for (const line of diff.split("\n")) {
|
|
2706
|
+
if (line.startsWith("diff --git ")) {
|
|
2707
|
+
flush();
|
|
2708
|
+
const target = line.match(/ b\/(.+)$/)?.[1] ?? "";
|
|
2709
|
+
keep = !target.startsWith(".ai/");
|
|
2710
|
+
}
|
|
2711
|
+
block.push(line);
|
|
2712
|
+
}
|
|
2713
|
+
flush();
|
|
2714
|
+
return out.join("\n");
|
|
2715
|
+
}
|
|
2685
2716
|
async function antiPatternsCheck(input, ctx) {
|
|
2686
2717
|
if (!input.diff && input.paths.length === 0) {
|
|
2687
2718
|
return {
|
|
@@ -2737,10 +2768,11 @@ async function antiPatternsCheck(input, ctx) {
|
|
|
2737
2768
|
}
|
|
2738
2769
|
}
|
|
2739
2770
|
}
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
const
|
|
2743
|
-
const
|
|
2771
|
+
const scanDiff = input.diff ? stripAiDirHunks(input.diff) : input.diff;
|
|
2772
|
+
if (scanDiff) {
|
|
2773
|
+
const tokens = tokenizeDiffForLiteral(scanDiff);
|
|
2774
|
+
const added = addedLinesFromDiff(scanDiff);
|
|
2775
|
+
const addedText = added.trim().length > 0 ? added : scanDiff;
|
|
2744
2776
|
if (tokens.length > 0) {
|
|
2745
2777
|
for (const { memory } of negative) {
|
|
2746
2778
|
if (literalMatchesAnyToken3(memory, tokens)) {
|
|
@@ -2770,10 +2802,10 @@ async function antiPatternsCheck(input, ctx) {
|
|
|
2770
2802
|
}
|
|
2771
2803
|
}
|
|
2772
2804
|
}
|
|
2773
|
-
if (input.semantic &&
|
|
2805
|
+
if (input.semantic && scanDiff) {
|
|
2774
2806
|
try {
|
|
2775
2807
|
const mod = await import("@hiveai/embeddings");
|
|
2776
|
-
const result = await mod.semanticSearch(ctx.paths,
|
|
2808
|
+
const result = await mod.semanticSearch(ctx.paths, scanDiff, { limit: input.limit * 2 });
|
|
2777
2809
|
if (result) {
|
|
2778
2810
|
const negativeIds = new Set(negative.map(({ memory }) => memory.frontmatter.id));
|
|
2779
2811
|
for (const hit of result.hits) {
|
|
@@ -4150,7 +4182,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
4150
4182
|
// src/server.ts
|
|
4151
4183
|
import { hasRecentBriefingMarker, loadConfigSync } from "@hiveai/core";
|
|
4152
4184
|
var SERVER_NAME = "haive";
|
|
4153
|
-
var SERVER_VERSION = "0.
|
|
4185
|
+
var SERVER_VERSION = "0.17.0";
|
|
4154
4186
|
function jsonResult(data) {
|
|
4155
4187
|
return {
|
|
4156
4188
|
content: [
|