@hiveai/mcp 0.11.0 → 0.12.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 +17 -49
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +7 -0
- package/dist/server.js +17 -49
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2516,7 +2516,10 @@ function runCommand(cmd, args, cwd) {
|
|
|
2516
2516
|
import { existsSync as existsSync24 } from "fs";
|
|
2517
2517
|
import {
|
|
2518
2518
|
addedLinesFromDiff,
|
|
2519
|
+
buildDocFrequency,
|
|
2520
|
+
CODE_STOPWORDS,
|
|
2519
2521
|
deriveConfidence as deriveConfidence6,
|
|
2522
|
+
diffHasDistinctiveOverlap,
|
|
2520
2523
|
getUsage as getUsage8,
|
|
2521
2524
|
isRetiredMemory as isRetiredMemory2,
|
|
2522
2525
|
loadMemoriesFromDir as loadMemoriesFromDir18,
|
|
@@ -2543,53 +2546,6 @@ var AntiPatternsCheckInputSchema = {
|
|
|
2543
2546
|
"Minimum cosine score for semantic-only anti-pattern hits. Anchor/literal matches still surface. Default 0.45 keeps broad, weakly-related memories out of review noise."
|
|
2544
2547
|
)
|
|
2545
2548
|
};
|
|
2546
|
-
var CODE_STOPWORDS = /* @__PURE__ */ new Set([
|
|
2547
|
-
"import",
|
|
2548
|
-
"export",
|
|
2549
|
-
"function",
|
|
2550
|
-
"return",
|
|
2551
|
-
"const",
|
|
2552
|
-
"let",
|
|
2553
|
-
"var",
|
|
2554
|
-
"class",
|
|
2555
|
-
"public",
|
|
2556
|
-
"private",
|
|
2557
|
-
"protected",
|
|
2558
|
-
"static",
|
|
2559
|
-
"this",
|
|
2560
|
-
"true",
|
|
2561
|
-
"false",
|
|
2562
|
-
"null",
|
|
2563
|
-
"undefined",
|
|
2564
|
-
"void",
|
|
2565
|
-
"async",
|
|
2566
|
-
"await",
|
|
2567
|
-
"from",
|
|
2568
|
-
"type",
|
|
2569
|
-
"interface",
|
|
2570
|
-
"extends",
|
|
2571
|
-
"implements",
|
|
2572
|
-
"number",
|
|
2573
|
-
"string",
|
|
2574
|
-
"boolean",
|
|
2575
|
-
"value",
|
|
2576
|
-
"default",
|
|
2577
|
-
"case",
|
|
2578
|
-
"break",
|
|
2579
|
-
"continue",
|
|
2580
|
-
"throw",
|
|
2581
|
-
"catch",
|
|
2582
|
-
"finally",
|
|
2583
|
-
"else",
|
|
2584
|
-
"while",
|
|
2585
|
-
"for",
|
|
2586
|
-
"new",
|
|
2587
|
-
"super",
|
|
2588
|
-
"yield",
|
|
2589
|
-
"module",
|
|
2590
|
-
"require",
|
|
2591
|
-
"console"
|
|
2592
|
-
]);
|
|
2593
2549
|
function tokenizeDiffForLiteral(diff) {
|
|
2594
2550
|
const lines = diff.split("\n");
|
|
2595
2551
|
const looksLikeDiff = lines.some((l) => /^[+-]/.test(l));
|
|
@@ -2622,6 +2578,7 @@ async function antiPatternsCheck(input, ctx) {
|
|
|
2622
2578
|
return { scanned: 0, warnings: [], notice: "No attempt/gotcha memories found yet." };
|
|
2623
2579
|
}
|
|
2624
2580
|
const usage = await loadUsageIndex10(ctx.paths);
|
|
2581
|
+
const docFreq = buildDocFrequency(negative.map(({ memory }) => memory.body));
|
|
2625
2582
|
const seen = /* @__PURE__ */ new Map();
|
|
2626
2583
|
const upsert = (fm, body, reason, score) => {
|
|
2627
2584
|
const existing = seen.get(fm.id);
|
|
@@ -2655,10 +2612,16 @@ async function antiPatternsCheck(input, ctx) {
|
|
|
2655
2612
|
}
|
|
2656
2613
|
if (input.diff) {
|
|
2657
2614
|
const tokens = tokenizeDiffForLiteral(input.diff);
|
|
2615
|
+
const added = addedLinesFromDiff(input.diff);
|
|
2616
|
+
const addedText = added.trim().length > 0 ? added : input.diff;
|
|
2658
2617
|
if (tokens.length > 0) {
|
|
2659
2618
|
for (const { memory } of negative) {
|
|
2660
2619
|
if (literalMatchesAnyToken3(memory, tokens)) {
|
|
2661
2620
|
upsert(memory.frontmatter, memory.body, "literal");
|
|
2621
|
+
if (diffHasDistinctiveOverlap(addedText, memory.body, docFreq)) {
|
|
2622
|
+
const w = seen.get(memory.frontmatter.id);
|
|
2623
|
+
if (w) w.distinctive_literal = true;
|
|
2624
|
+
}
|
|
2662
2625
|
}
|
|
2663
2626
|
}
|
|
2664
2627
|
}
|
|
@@ -3291,7 +3254,12 @@ function classifyWarning(warning, paths, anchoredBlocks = false) {
|
|
|
3291
3254
|
const hasSemantic = warning.reasons.includes("semantic");
|
|
3292
3255
|
const semanticScore = warning.semantic_score ?? 0;
|
|
3293
3256
|
const highConfidence = warning.confidence === "authoritative" || warning.confidence === "trusted";
|
|
3294
|
-
if (anchoredBlocks && highConfidence && warning.scope !== "personal" && warning.reasons.includes("anchor") &&
|
|
3257
|
+
if (anchoredBlocks && highConfidence && warning.scope !== "personal" && warning.reasons.includes("anchor") && // A literal overlap only corroborates a BLOCK when it is on a token *distinctive*
|
|
3258
|
+
// to this gotcha (rare in the corpus). Sharing a common domain word ("memory",
|
|
3259
|
+
// "scope", "version") — or a version-bump diff — no longer hard-blocks; it falls
|
|
3260
|
+
// through to `review` below. This kills the incidental-token false positives that
|
|
3261
|
+
// made agents work for nothing. A moderate semantic match still corroborates.
|
|
3262
|
+
(warning.distinctive_literal === true || hasSemantic && semanticScore >= 0.45)) {
|
|
3295
3263
|
if (warning.has_sensor && !warning.reasons.includes("sensor")) {
|
|
3296
3264
|
return {
|
|
3297
3265
|
...warning,
|
|
@@ -4038,7 +4006,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
4038
4006
|
// src/server.ts
|
|
4039
4007
|
import { hasRecentBriefingMarker, loadConfigSync } from "@hiveai/core";
|
|
4040
4008
|
var SERVER_NAME = "haive";
|
|
4041
|
-
var SERVER_VERSION = "0.
|
|
4009
|
+
var SERVER_VERSION = "0.12.0";
|
|
4042
4010
|
function jsonResult(data) {
|
|
4043
4011
|
return {
|
|
4044
4012
|
content: [
|