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