@hivelore/mcp 0.43.2 → 0.44.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/README.md +1 -1
- package/dist/index.js +38 -7
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js +40 -8
- package/dist/server.js.map +1 -1
- package/package.json +16 -3
package/dist/server.d.ts
CHANGED
|
@@ -365,6 +365,7 @@ interface AntiPatternsCheckInput {
|
|
|
365
365
|
limit: number;
|
|
366
366
|
semantic: boolean;
|
|
367
367
|
min_semantic_score?: number;
|
|
368
|
+
track?: boolean;
|
|
368
369
|
}
|
|
369
370
|
interface AntiPatternsWarning {
|
|
370
371
|
id: string;
|
|
@@ -834,5 +835,6 @@ declare function printHaiveMcpVersion(): void;
|
|
|
834
835
|
declare function runHaiveMcpStdio(options: {
|
|
835
836
|
root?: string;
|
|
836
837
|
}): Promise<void>;
|
|
838
|
+
declare function writeMcpRuntimeMarker(context: HaiveContext): Promise<void>;
|
|
837
839
|
|
|
838
|
-
export { type AnchorFrameworkGroup, type AntiPatternsCheckInput, type AntiPatternsCheckOutput, type AstMatch, type AstScanResult, type BriefingOutput, type CodeMapInput, type CodeMapToolOutput, type CodeSearchInput, type CodeSearchOutput, ENFORCEMENT_PROFILE_TOOLS, EXPERIMENTAL_PROFILE_TOOLS, type GetBriefingInput, type GetRecapInput, type GetRecapOutput, MAINTENANCE_PROFILE_TOOLS, type MemConflictCandidatesInput, type MemDistillInput, type MemDistillOutput, type MemRelevantToInput, type MemRelevantToOutput, type MemResolveProjectInput, type MemSuggestTopicInput, type MemTimelineInput, type MemTriedOutput, type PreCommitCheckInput, type PreCommitCheckOutput, type ProposeSensorOutput, SERVER_NAME, SERVER_VERSION, type ScaffoldTestOutput, TOOL_PROFILES, type ToolProfile, antiPatternsCheck, astEngineAvailable, astLangForPath, codeMapTool, codeSearch, createHaiveServer, detectTestFrameworkForPaths, detectTestFrameworksForAnchors, getAllowedToolsForProfile, getBriefing, getRecap, memConflictCandidates, memDistill, memRelevantTo, memResolveProject, memSuggestTopic, memTimeline, memTried, parseMcpCliArgs, preCommitCheck, printHaiveMcpVersion, proposeSensor, readPresumedCorrectTargets, runAstPattern, runAstSensorOnContent, runHaiveMcpStdio, scaffoldTest };
|
|
840
|
+
export { type AnchorFrameworkGroup, type AntiPatternsCheckInput, type AntiPatternsCheckOutput, type AstMatch, type AstScanResult, type BriefingOutput, type CodeMapInput, type CodeMapToolOutput, type CodeSearchInput, type CodeSearchOutput, ENFORCEMENT_PROFILE_TOOLS, EXPERIMENTAL_PROFILE_TOOLS, type GetBriefingInput, type GetRecapInput, type GetRecapOutput, MAINTENANCE_PROFILE_TOOLS, type MemConflictCandidatesInput, type MemDistillInput, type MemDistillOutput, type MemRelevantToInput, type MemRelevantToOutput, type MemResolveProjectInput, type MemSuggestTopicInput, type MemTimelineInput, type MemTriedOutput, type PreCommitCheckInput, type PreCommitCheckOutput, type ProposeSensorOutput, SERVER_NAME, SERVER_VERSION, type ScaffoldTestOutput, TOOL_PROFILES, type ToolProfile, antiPatternsCheck, astEngineAvailable, astLangForPath, codeMapTool, codeSearch, createHaiveServer, detectTestFrameworkForPaths, detectTestFrameworksForAnchors, getAllowedToolsForProfile, getBriefing, getRecap, memConflictCandidates, memDistill, memRelevantTo, memResolveProject, memSuggestTopic, memTimeline, memTried, parseMcpCliArgs, preCommitCheck, printHaiveMcpVersion, proposeSensor, readPresumedCorrectTargets, runAstPattern, runAstSensorOnContent, runHaiveMcpStdio, scaffoldTest, writeMcpRuntimeMarker };
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// src/server.ts
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { mkdir as mkdir8, writeFile as writeFile15 } from "fs/promises";
|
|
5
|
+
import path15 from "path";
|
|
4
6
|
|
|
5
7
|
// src/context.ts
|
|
6
8
|
import { findProjectRoot, resolveHaivePaths } from "@hivelore/core";
|
|
@@ -3197,7 +3199,7 @@ function oneLine(value) {
|
|
|
3197
3199
|
return value.replace(/\s+/g, " ").replace(/"/g, '\\"').trim().slice(0, 120);
|
|
3198
3200
|
}
|
|
3199
3201
|
function serverVersion() {
|
|
3200
|
-
return true ? "0.
|
|
3202
|
+
return true ? "0.44.0" : "dev";
|
|
3201
3203
|
}
|
|
3202
3204
|
|
|
3203
3205
|
// src/tools/code-map.ts
|
|
@@ -3483,7 +3485,8 @@ var AntiPatternsCheckInputSchema = {
|
|
|
3483
3485
|
),
|
|
3484
3486
|
min_semantic_score: z26.number().min(0).max(1).default(0.45).describe(
|
|
3485
3487
|
"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."
|
|
3486
|
-
)
|
|
3488
|
+
),
|
|
3489
|
+
track: z26.boolean().default(true).describe("Record real prevention outcomes. Set false for eval/selftest probes so synthetic cases never inflate ROI.")
|
|
3487
3490
|
};
|
|
3488
3491
|
function tokenizeDiffForLiteral(diff) {
|
|
3489
3492
|
const lines = diff.split("\n");
|
|
@@ -3676,7 +3679,9 @@ async function antiPatternsCheck(input, ctx) {
|
|
|
3676
3679
|
}).slice(0, input.limit);
|
|
3677
3680
|
const isHardBlockCatch = (w) => w.reasons.includes("sensor");
|
|
3678
3681
|
const strongCatches = warnings.filter(isHardBlockCatch);
|
|
3679
|
-
|
|
3682
|
+
if (input.track !== false) {
|
|
3683
|
+
await recordPreventionHits(ctx.paths, strongCatches.map((w) => w.id), "anti-pattern");
|
|
3684
|
+
}
|
|
3680
3685
|
return {
|
|
3681
3686
|
scanned: negative.length,
|
|
3682
3687
|
warnings
|
|
@@ -4458,13 +4463,14 @@ Main code areas detected: ${areas}
|
|
|
4458
4463
|
import { z as z35 } from "zod";
|
|
4459
4464
|
var PostTaskArgsSchema = {
|
|
4460
4465
|
task_summary: z35.string().optional().describe("One sentence describing what you just did"),
|
|
4461
|
-
files_touched: z35.
|
|
4466
|
+
files_touched: z35.string().optional().describe("Files you created or modified during the task, as CSV or a JSON array string")
|
|
4462
4467
|
};
|
|
4463
4468
|
function postTaskPrompt(args, ctx) {
|
|
4464
4469
|
const taskLine = args.task_summary ? `
|
|
4465
4470
|
Task just completed: **${args.task_summary}**` : "";
|
|
4466
|
-
const
|
|
4467
|
-
|
|
4471
|
+
const filesTouched = parsePromptFilesTouched(args.files_touched);
|
|
4472
|
+
const filesLine = filesTouched.length > 0 ? `
|
|
4473
|
+
Files touched: ${filesTouched.map((f) => `\`${f}\``).join(", ")}` : "";
|
|
4468
4474
|
const text = `You have just finished a task. Before closing this session, take 60 seconds to capture what you learned.
|
|
4469
4475
|
${taskLine}${filesLine}
|
|
4470
4476
|
|
|
@@ -4553,6 +4559,20 @@ When done, respond with a brief summary: "Saved N memories: [list of IDs]. Sessi
|
|
|
4553
4559
|
]
|
|
4554
4560
|
};
|
|
4555
4561
|
}
|
|
4562
|
+
function parsePromptFilesTouched(input) {
|
|
4563
|
+
const raw = input?.trim();
|
|
4564
|
+
if (!raw) return [];
|
|
4565
|
+
if (raw.startsWith("[")) {
|
|
4566
|
+
try {
|
|
4567
|
+
const parsed = JSON.parse(raw);
|
|
4568
|
+
if (Array.isArray(parsed)) {
|
|
4569
|
+
return parsed.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean);
|
|
4570
|
+
}
|
|
4571
|
+
} catch {
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
return raw.split(",").map((value) => value.trim()).filter(Boolean);
|
|
4575
|
+
}
|
|
4556
4576
|
|
|
4557
4577
|
// src/prompts/import-docs.ts
|
|
4558
4578
|
import { z as z36 } from "zod";
|
|
@@ -4626,7 +4646,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
4626
4646
|
// src/server.ts
|
|
4627
4647
|
import { hasRecentBriefingMarker, loadConfigSync } from "@hivelore/core";
|
|
4628
4648
|
var SERVER_NAME = "hivelore";
|
|
4629
|
-
var SERVER_VERSION = "0.
|
|
4649
|
+
var SERVER_VERSION = "0.44.0";
|
|
4630
4650
|
function jsonResult(data) {
|
|
4631
4651
|
return {
|
|
4632
4652
|
content: [
|
|
@@ -5565,11 +5585,22 @@ function printHaiveMcpVersion() {
|
|
|
5565
5585
|
}
|
|
5566
5586
|
async function runHaiveMcpStdio(options) {
|
|
5567
5587
|
const { server, context } = createHaiveServer({ root: options.root, env: process.env });
|
|
5588
|
+
await writeMcpRuntimeMarker(context).catch(() => {
|
|
5589
|
+
});
|
|
5568
5590
|
console.error(
|
|
5569
5591
|
`[haive-mcp] starting server v${SERVER_VERSION} (project root: ${context.paths.root})`
|
|
5570
5592
|
);
|
|
5571
5593
|
await server.connect(new StdioServerTransport());
|
|
5572
5594
|
}
|
|
5595
|
+
async function writeMcpRuntimeMarker(context) {
|
|
5596
|
+
await mkdir8(context.paths.runtimeDir, { recursive: true });
|
|
5597
|
+
await writeFile15(path15.join(context.paths.runtimeDir, "mcp-server.json"), JSON.stringify({
|
|
5598
|
+
version: SERVER_VERSION,
|
|
5599
|
+
pid: process.pid,
|
|
5600
|
+
started_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5601
|
+
command: "hivelore mcp --stdio"
|
|
5602
|
+
}, null, 2), "utf8");
|
|
5603
|
+
}
|
|
5573
5604
|
export {
|
|
5574
5605
|
ENFORCEMENT_PROFILE_TOOLS,
|
|
5575
5606
|
EXPERIMENTAL_PROFILE_TOOLS,
|
|
@@ -5603,6 +5634,7 @@ export {
|
|
|
5603
5634
|
runAstPattern,
|
|
5604
5635
|
runAstSensorOnContent,
|
|
5605
5636
|
runHaiveMcpStdio,
|
|
5606
|
-
scaffoldTest
|
|
5637
|
+
scaffoldTest,
|
|
5638
|
+
writeMcpRuntimeMarker
|
|
5607
5639
|
};
|
|
5608
5640
|
//# sourceMappingURL=server.js.map
|