@hiveai/mcp 0.2.16 → 0.3.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 +42 -4
- package/dist/index.js.map +1 -1
- package/dist/server.js +42 -4
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1159,9 +1159,11 @@ import {
|
|
|
1159
1159
|
isDecaying,
|
|
1160
1160
|
literalMatchesAllTokens as literalMatchesAllTokens2,
|
|
1161
1161
|
literalMatchesAnyToken as literalMatchesAnyToken2,
|
|
1162
|
+
loadCodeMap,
|
|
1162
1163
|
loadMemoriesFromDir as loadMemoriesFromDir13,
|
|
1163
1164
|
loadUsageIndex as loadUsageIndex7,
|
|
1164
1165
|
memoryMatchesAnchorPaths as memoryMatchesAnchorPaths2,
|
|
1166
|
+
queryCodeMap,
|
|
1165
1167
|
tokenizeQuery as tokenizeQuery2,
|
|
1166
1168
|
trackReads as trackReads3,
|
|
1167
1169
|
truncateToTokens
|
|
@@ -1185,6 +1187,9 @@ var GetBriefingInputSchema = {
|
|
|
1185
1187
|
track: z17.boolean().default(true).describe("Increment read_count on returned memories"),
|
|
1186
1188
|
format: z17.enum(["full", "compact"]).default("full").describe(
|
|
1187
1189
|
"Output format: 'full' returns complete memory bodies; 'compact' returns id + 1-line summary only (call mem_get for details)."
|
|
1190
|
+
),
|
|
1191
|
+
symbols: z17.array(z17.string()).default([]).describe(
|
|
1192
|
+
"Symbol names to look up in the code-map (e.g. ['PaymentService', 'TenantFilter']). Returns the file(s) exporting each symbol so agents don't need to grep. Requires `haive index code` to have been run."
|
|
1188
1193
|
)
|
|
1189
1194
|
};
|
|
1190
1195
|
async function getBriefing(input, ctx) {
|
|
@@ -1246,6 +1251,7 @@ async function getBriefing(input, ctx) {
|
|
|
1246
1251
|
tags: fm.tags,
|
|
1247
1252
|
status: fm.status,
|
|
1248
1253
|
confidence: deriveConfidence4(fm, u),
|
|
1254
|
+
...fm.status === "draft" || fm.status === "proposed" ? { unverified: true } : {},
|
|
1249
1255
|
read_count: u.read_count,
|
|
1250
1256
|
reasons: [reason],
|
|
1251
1257
|
match_quality: matchQuality ?? "partial",
|
|
@@ -1384,6 +1390,37 @@ ${m.content}`).join("\n\n---\n\n"),
|
|
|
1384
1390
|
if (isDecaying(u, createdAt)) decayWarnings.push(m.id);
|
|
1385
1391
|
}
|
|
1386
1392
|
const outputMemories = input.format === "compact" ? trimmedMemories.map((m) => ({ ...m, body: compactSummary(m.body) })) : trimmedMemories;
|
|
1393
|
+
let symbolLocations;
|
|
1394
|
+
const symbolsToLookup = new Set(input.symbols);
|
|
1395
|
+
for (const m of outputMemories) {
|
|
1396
|
+
const loaded = byId.get(m.id);
|
|
1397
|
+
for (const sym of loaded?.memory.frontmatter.anchor.symbols ?? []) {
|
|
1398
|
+
symbolsToLookup.add(sym);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
if (symbolsToLookup.size > 0) {
|
|
1402
|
+
const codeMap = await loadCodeMap(ctx.paths);
|
|
1403
|
+
if (codeMap) {
|
|
1404
|
+
symbolLocations = [];
|
|
1405
|
+
for (const sym of symbolsToLookup) {
|
|
1406
|
+
const { files } = queryCodeMap(codeMap, { symbol: sym });
|
|
1407
|
+
if (files.length > 0) {
|
|
1408
|
+
symbolLocations.push({
|
|
1409
|
+
symbol: sym,
|
|
1410
|
+
locations: files.flatMap(
|
|
1411
|
+
(f) => f.entry.exports.filter((e) => e.name.toLowerCase().includes(sym.toLowerCase())).map((e) => ({
|
|
1412
|
+
file: f.path,
|
|
1413
|
+
kind: e.kind,
|
|
1414
|
+
line: e.line,
|
|
1415
|
+
...e.description ? { description: e.description } : {}
|
|
1416
|
+
}))
|
|
1417
|
+
)
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
if (symbolLocations.length === 0) symbolLocations = void 0;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1387
1424
|
return {
|
|
1388
1425
|
...input.task ? { task: input.task } : {},
|
|
1389
1426
|
search_mode: searchMode,
|
|
@@ -1396,6 +1433,7 @@ ${m.content}`).join("\n\n---\n\n"),
|
|
|
1396
1433
|
} : null,
|
|
1397
1434
|
module_contexts: trimmedModules,
|
|
1398
1435
|
memories: outputMemories,
|
|
1436
|
+
...symbolLocations ? { symbol_locations: symbolLocations } : {},
|
|
1399
1437
|
decay_warnings: decayWarnings,
|
|
1400
1438
|
setup_warnings: setupWarnings,
|
|
1401
1439
|
estimated_tokens: totalTokens,
|
|
@@ -1445,7 +1483,7 @@ async function loadModuleContexts2(ctx, modules) {
|
|
|
1445
1483
|
}
|
|
1446
1484
|
|
|
1447
1485
|
// src/tools/code-map.ts
|
|
1448
|
-
import { loadCodeMap, queryCodeMap } from "@hiveai/core";
|
|
1486
|
+
import { loadCodeMap as loadCodeMap2, queryCodeMap as queryCodeMap2 } from "@hiveai/core";
|
|
1449
1487
|
import { z as z18 } from "zod";
|
|
1450
1488
|
var CodeMapInputSchema = {
|
|
1451
1489
|
file: z18.string().optional().describe("Filter to files whose path contains this substring"),
|
|
@@ -1453,7 +1491,7 @@ var CodeMapInputSchema = {
|
|
|
1453
1491
|
max_files: z18.number().int().positive().default(40).describe("Cap on returned files")
|
|
1454
1492
|
};
|
|
1455
1493
|
async function codeMapTool(input, ctx) {
|
|
1456
|
-
const map = await
|
|
1494
|
+
const map = await loadCodeMap2(ctx.paths);
|
|
1457
1495
|
if (!map) {
|
|
1458
1496
|
return {
|
|
1459
1497
|
available: false,
|
|
@@ -1461,7 +1499,7 @@ async function codeMapTool(input, ctx) {
|
|
|
1461
1499
|
notice: "No code map found. Run `haive index code` to generate `.ai/code-map.json`."
|
|
1462
1500
|
};
|
|
1463
1501
|
}
|
|
1464
|
-
const { files } =
|
|
1502
|
+
const { files } = queryCodeMap2(map, { file: input.file, symbol: input.symbol });
|
|
1465
1503
|
return {
|
|
1466
1504
|
available: true,
|
|
1467
1505
|
generated_at: map.generated_at,
|
|
@@ -1763,7 +1801,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
1763
1801
|
|
|
1764
1802
|
// src/server.ts
|
|
1765
1803
|
var SERVER_NAME = "haive";
|
|
1766
|
-
var SERVER_VERSION = "0.
|
|
1804
|
+
var SERVER_VERSION = "0.3.0";
|
|
1767
1805
|
function jsonResult(data) {
|
|
1768
1806
|
return {
|
|
1769
1807
|
content: [
|