@hiveai/mcp 0.2.13 → 0.2.15
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 +32 -5
- package/dist/index.js.map +1 -1
- package/dist/server.js +32 -5
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -263,7 +263,8 @@ import { z as z5 } from "zod";
|
|
|
263
263
|
var MemSearchInputSchema = {
|
|
264
264
|
query: z5.string().describe("Substring matched against id, tags, and body"),
|
|
265
265
|
scope: z5.enum(["personal", "team", "module"]).optional().describe("Restrict results to a single scope"),
|
|
266
|
-
type: z5.enum(["convention", "decision", "gotcha", "architecture", "glossary", "attempt"]).optional().describe("Restrict results to a memory type"),
|
|
266
|
+
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."),
|
|
267
|
+
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)."),
|
|
267
268
|
module: z5.string().optional().describe("Restrict results to a module"),
|
|
268
269
|
status: z5.enum(["draft", "proposed", "validated", "deprecated", "stale", "rejected"]).optional().describe("Filter by a single status. Omit to return all statuses."),
|
|
269
270
|
exclude_rejected: z5.boolean().default(false).describe("When true, exclude memories with status=rejected from results."),
|
|
@@ -274,6 +275,9 @@ var MemSearchInputSchema = {
|
|
|
274
275
|
min_score: z5.number().min(0).max(1).default(0).describe("Minimum cosine similarity (semantic mode only)"),
|
|
275
276
|
track: z5.boolean().default(true).describe("Increment read_count on returned memories (used for passive validation)")
|
|
276
277
|
};
|
|
278
|
+
function isSessionRecap(fm) {
|
|
279
|
+
return fm.type === "session_recap";
|
|
280
|
+
}
|
|
277
281
|
async function memSearch(input, ctx) {
|
|
278
282
|
if (!existsSync5(ctx.paths.memoriesDir)) {
|
|
279
283
|
return { matches: [], total: 0, mode: input.semantic ? "literal_fallback" : "literal" };
|
|
@@ -310,6 +314,7 @@ function passesFilters(fm, input) {
|
|
|
310
314
|
if (input.module && fm.module !== input.module) return false;
|
|
311
315
|
if (input.status && fm.status !== input.status) return false;
|
|
312
316
|
if (input.exclude_rejected && fm.status === "rejected") return false;
|
|
317
|
+
if (!input.include_session_recap && isSessionRecap(fm)) return false;
|
|
313
318
|
return true;
|
|
314
319
|
}
|
|
315
320
|
function buildLiteralResult(input, filtered, usage) {
|
|
@@ -418,6 +423,18 @@ async function memVerify(input, ctx) {
|
|
|
418
423
|
let anchorless = 0;
|
|
419
424
|
let updated = 0;
|
|
420
425
|
for (const { memory, filePath } of targets) {
|
|
426
|
+
if (memory.frontmatter.type === "session_recap") {
|
|
427
|
+
anchorless++;
|
|
428
|
+
results.push({
|
|
429
|
+
id: memory.frontmatter.id,
|
|
430
|
+
file_path: filePath,
|
|
431
|
+
stale: false,
|
|
432
|
+
reason: null,
|
|
433
|
+
status_after: memory.frontmatter.status,
|
|
434
|
+
skipped: true
|
|
435
|
+
});
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
421
438
|
const isAnchored = memory.frontmatter.anchor.paths.length > 0 || memory.frontmatter.anchor.symbols.length > 0;
|
|
422
439
|
if (!isAnchored) {
|
|
423
440
|
anchorless++;
|
|
@@ -570,6 +587,7 @@ async function memForFiles(input, ctx) {
|
|
|
570
587
|
const byModule = [];
|
|
571
588
|
const byDomain = [];
|
|
572
589
|
for (const loaded of all) {
|
|
590
|
+
if (loaded.memory.frontmatter.type === "session_recap") continue;
|
|
573
591
|
if (memoryMatchesAnchorPaths(loaded.memory, input.files)) {
|
|
574
592
|
byAnchor.push(toMatch(loaded, "anchor_overlap", usage));
|
|
575
593
|
seen.add(loaded.memory.frontmatter.id);
|
|
@@ -578,6 +596,7 @@ async function memForFiles(input, ctx) {
|
|
|
578
596
|
const pathSegments = extractPathSegments(input.files);
|
|
579
597
|
for (const loaded of all) {
|
|
580
598
|
if (seen.has(loaded.memory.frontmatter.id)) continue;
|
|
599
|
+
if (loaded.memory.frontmatter.type === "session_recap") continue;
|
|
581
600
|
const fm = loaded.memory.frontmatter;
|
|
582
601
|
const moduleHit = fm.module && inferred.includes(fm.module) || fm.tags.some((t) => inferred.includes(t)) || fm.tags.some((t) => {
|
|
583
602
|
const tl = t.toLowerCase();
|
|
@@ -590,6 +609,7 @@ async function memForFiles(input, ctx) {
|
|
|
590
609
|
}
|
|
591
610
|
for (const loaded of all) {
|
|
592
611
|
if (seen.has(loaded.memory.frontmatter.id)) continue;
|
|
612
|
+
if (loaded.memory.frontmatter.type === "session_recap") continue;
|
|
593
613
|
const domain = loaded.memory.frontmatter.domain;
|
|
594
614
|
if (domain && inferred.includes(domain)) {
|
|
595
615
|
byDomain.push(toMatch(loaded, "domain", usage));
|
|
@@ -1123,6 +1143,7 @@ import {
|
|
|
1123
1143
|
inferModulesFromPaths as inferModulesFromPaths2,
|
|
1124
1144
|
isDecaying,
|
|
1125
1145
|
literalMatchesAllTokens as literalMatchesAllTokens2,
|
|
1146
|
+
literalMatchesAnyToken as literalMatchesAnyToken2,
|
|
1126
1147
|
loadMemoriesFromDir as loadMemoriesFromDir13,
|
|
1127
1148
|
loadUsageIndex as loadUsageIndex7,
|
|
1128
1149
|
memoryMatchesAnchorPaths as memoryMatchesAnchorPaths2,
|
|
@@ -1231,9 +1252,15 @@ async function getBriefing(input, ctx) {
|
|
|
1231
1252
|
}
|
|
1232
1253
|
if (input.task) {
|
|
1233
1254
|
const tokens = tokenizeQuery2(input.task);
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1255
|
+
const andHits = allMemories.filter((m) => literalMatchesAllTokens2(m.memory, tokens));
|
|
1256
|
+
for (const loaded of andHits) {
|
|
1257
|
+
addOrUpdate(loaded, "semantic", void 0, "exact");
|
|
1258
|
+
}
|
|
1259
|
+
if (andHits.length === 0 && tokens.length > 1) {
|
|
1260
|
+
for (const loaded of allMemories) {
|
|
1261
|
+
if (literalMatchesAnyToken2(loaded.memory, tokens)) {
|
|
1262
|
+
addOrUpdate(loaded, "semantic", void 0, "partial");
|
|
1263
|
+
}
|
|
1237
1264
|
}
|
|
1238
1265
|
}
|
|
1239
1266
|
if (semanticHits) {
|
|
@@ -1703,7 +1730,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
1703
1730
|
|
|
1704
1731
|
// src/server.ts
|
|
1705
1732
|
var SERVER_NAME = "haive";
|
|
1706
|
-
var SERVER_VERSION = "0.2.
|
|
1733
|
+
var SERVER_VERSION = "0.2.15";
|
|
1707
1734
|
function jsonResult(data) {
|
|
1708
1735
|
return {
|
|
1709
1736
|
content: [
|