@hiveai/mcp 0.2.12 → 0.2.14
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 +33 -6
- package/dist/index.js.map +1 -1
- package/dist/server.js +33 -6
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -268,7 +268,8 @@ import { z as z5 } from "zod";
|
|
|
268
268
|
var MemSearchInputSchema = {
|
|
269
269
|
query: z5.string().describe("Substring matched against id, tags, and body"),
|
|
270
270
|
scope: z5.enum(["personal", "team", "module"]).optional().describe("Restrict results to a single scope"),
|
|
271
|
-
type: z5.enum(["convention", "decision", "gotcha", "architecture", "glossary", "attempt"]).optional().describe("Restrict results to a memory type"),
|
|
271
|
+
type: z5.enum(["convention", "decision", "gotcha", "architecture", "glossary", "attempt", "session_recap"]).optional().describe("Restrict results to a memory type. session_recap is excluded by default \u2014 use type='session_recap' to include them."),
|
|
272
|
+
include_session_recap: z5.boolean().default(false).describe("Include session_recap memories in search results (excluded by default \u2014 they surface in get_briefing as last_session)."),
|
|
272
273
|
module: z5.string().optional().describe("Restrict results to a module"),
|
|
273
274
|
status: z5.enum(["draft", "proposed", "validated", "deprecated", "stale", "rejected"]).optional().describe("Filter by a single status. Omit to return all statuses."),
|
|
274
275
|
exclude_rejected: z5.boolean().default(false).describe("When true, exclude memories with status=rejected from results."),
|
|
@@ -279,6 +280,9 @@ var MemSearchInputSchema = {
|
|
|
279
280
|
min_score: z5.number().min(0).max(1).default(0).describe("Minimum cosine similarity (semantic mode only)"),
|
|
280
281
|
track: z5.boolean().default(true).describe("Increment read_count on returned memories (used for passive validation)")
|
|
281
282
|
};
|
|
283
|
+
function isSessionRecap(fm) {
|
|
284
|
+
return fm.type === "session_recap";
|
|
285
|
+
}
|
|
282
286
|
async function memSearch(input, ctx) {
|
|
283
287
|
if (!existsSync5(ctx.paths.memoriesDir)) {
|
|
284
288
|
return { matches: [], total: 0, mode: input.semantic ? "literal_fallback" : "literal" };
|
|
@@ -315,6 +319,7 @@ function passesFilters(fm, input) {
|
|
|
315
319
|
if (input.module && fm.module !== input.module) return false;
|
|
316
320
|
if (input.status && fm.status !== input.status) return false;
|
|
317
321
|
if (input.exclude_rejected && fm.status === "rejected") return false;
|
|
322
|
+
if (!input.include_session_recap && isSessionRecap(fm)) return false;
|
|
318
323
|
return true;
|
|
319
324
|
}
|
|
320
325
|
function buildLiteralResult(input, filtered, usage) {
|
|
@@ -423,6 +428,18 @@ async function memVerify(input, ctx) {
|
|
|
423
428
|
let anchorless = 0;
|
|
424
429
|
let updated = 0;
|
|
425
430
|
for (const { memory, filePath } of targets) {
|
|
431
|
+
if (memory.frontmatter.type === "session_recap") {
|
|
432
|
+
anchorless++;
|
|
433
|
+
results.push({
|
|
434
|
+
id: memory.frontmatter.id,
|
|
435
|
+
file_path: filePath,
|
|
436
|
+
stale: false,
|
|
437
|
+
reason: null,
|
|
438
|
+
status_after: memory.frontmatter.status,
|
|
439
|
+
skipped: true
|
|
440
|
+
});
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
426
443
|
const isAnchored = memory.frontmatter.anchor.paths.length > 0 || memory.frontmatter.anchor.symbols.length > 0;
|
|
427
444
|
if (!isAnchored) {
|
|
428
445
|
anchorless++;
|
|
@@ -575,6 +592,7 @@ async function memForFiles(input, ctx) {
|
|
|
575
592
|
const byModule = [];
|
|
576
593
|
const byDomain = [];
|
|
577
594
|
for (const loaded of all) {
|
|
595
|
+
if (loaded.memory.frontmatter.type === "session_recap") continue;
|
|
578
596
|
if (memoryMatchesAnchorPaths(loaded.memory, input.files)) {
|
|
579
597
|
byAnchor.push(toMatch(loaded, "anchor_overlap", usage));
|
|
580
598
|
seen.add(loaded.memory.frontmatter.id);
|
|
@@ -583,6 +601,7 @@ async function memForFiles(input, ctx) {
|
|
|
583
601
|
const pathSegments = extractPathSegments(input.files);
|
|
584
602
|
for (const loaded of all) {
|
|
585
603
|
if (seen.has(loaded.memory.frontmatter.id)) continue;
|
|
604
|
+
if (loaded.memory.frontmatter.type === "session_recap") continue;
|
|
586
605
|
const fm = loaded.memory.frontmatter;
|
|
587
606
|
const moduleHit = fm.module && inferred.includes(fm.module) || fm.tags.some((t) => inferred.includes(t)) || fm.tags.some((t) => {
|
|
588
607
|
const tl = t.toLowerCase();
|
|
@@ -595,6 +614,7 @@ async function memForFiles(input, ctx) {
|
|
|
595
614
|
}
|
|
596
615
|
for (const loaded of all) {
|
|
597
616
|
if (seen.has(loaded.memory.frontmatter.id)) continue;
|
|
617
|
+
if (loaded.memory.frontmatter.type === "session_recap") continue;
|
|
598
618
|
const domain = loaded.memory.frontmatter.domain;
|
|
599
619
|
if (domain && inferred.includes(domain)) {
|
|
600
620
|
byDomain.push(toMatch(loaded, "domain", usage));
|
|
@@ -1091,7 +1111,7 @@ async function memSessionEnd(input, ctx) {
|
|
|
1091
1111
|
}
|
|
1092
1112
|
const frontmatter = buildFrontmatter4({
|
|
1093
1113
|
type: "session_recap",
|
|
1094
|
-
slug: "
|
|
1114
|
+
slug: "recap",
|
|
1095
1115
|
scope: input.scope,
|
|
1096
1116
|
module: input.module,
|
|
1097
1117
|
tags: ["session", "recap"],
|
|
@@ -1128,6 +1148,7 @@ import {
|
|
|
1128
1148
|
inferModulesFromPaths as inferModulesFromPaths2,
|
|
1129
1149
|
isDecaying,
|
|
1130
1150
|
literalMatchesAllTokens as literalMatchesAllTokens2,
|
|
1151
|
+
literalMatchesAnyToken as literalMatchesAnyToken2,
|
|
1131
1152
|
loadMemoriesFromDir as loadMemoriesFromDir13,
|
|
1132
1153
|
loadUsageIndex as loadUsageIndex7,
|
|
1133
1154
|
memoryMatchesAnchorPaths as memoryMatchesAnchorPaths2,
|
|
@@ -1236,9 +1257,15 @@ async function getBriefing(input, ctx) {
|
|
|
1236
1257
|
}
|
|
1237
1258
|
if (input.task) {
|
|
1238
1259
|
const tokens = tokenizeQuery2(input.task);
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1260
|
+
const andHits = allMemories.filter((m) => literalMatchesAllTokens2(m.memory, tokens));
|
|
1261
|
+
for (const loaded of andHits) {
|
|
1262
|
+
addOrUpdate(loaded, "semantic", void 0, "exact");
|
|
1263
|
+
}
|
|
1264
|
+
if (andHits.length === 0 && tokens.length > 1) {
|
|
1265
|
+
for (const loaded of allMemories) {
|
|
1266
|
+
if (literalMatchesAnyToken2(loaded.memory, tokens)) {
|
|
1267
|
+
addOrUpdate(loaded, "semantic", void 0, "partial");
|
|
1268
|
+
}
|
|
1242
1269
|
}
|
|
1243
1270
|
}
|
|
1244
1271
|
if (semanticHits) {
|
|
@@ -1708,7 +1735,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
1708
1735
|
|
|
1709
1736
|
// src/server.ts
|
|
1710
1737
|
var SERVER_NAME = "haive";
|
|
1711
|
-
var SERVER_VERSION = "0.2.
|
|
1738
|
+
var SERVER_VERSION = "0.2.14";
|
|
1712
1739
|
function jsonResult(data) {
|
|
1713
1740
|
return {
|
|
1714
1741
|
content: [
|