@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 CHANGED
@@ -1164,9 +1164,11 @@ import {
1164
1164
  isDecaying,
1165
1165
  literalMatchesAllTokens as literalMatchesAllTokens2,
1166
1166
  literalMatchesAnyToken as literalMatchesAnyToken2,
1167
+ loadCodeMap,
1167
1168
  loadMemoriesFromDir as loadMemoriesFromDir13,
1168
1169
  loadUsageIndex as loadUsageIndex7,
1169
1170
  memoryMatchesAnchorPaths as memoryMatchesAnchorPaths2,
1171
+ queryCodeMap,
1170
1172
  tokenizeQuery as tokenizeQuery2,
1171
1173
  trackReads as trackReads3,
1172
1174
  truncateToTokens
@@ -1190,6 +1192,9 @@ var GetBriefingInputSchema = {
1190
1192
  track: z17.boolean().default(true).describe("Increment read_count on returned memories"),
1191
1193
  format: z17.enum(["full", "compact"]).default("full").describe(
1192
1194
  "Output format: 'full' returns complete memory bodies; 'compact' returns id + 1-line summary only (call mem_get for details)."
1195
+ ),
1196
+ symbols: z17.array(z17.string()).default([]).describe(
1197
+ "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."
1193
1198
  )
1194
1199
  };
1195
1200
  async function getBriefing(input, ctx) {
@@ -1251,6 +1256,7 @@ async function getBriefing(input, ctx) {
1251
1256
  tags: fm.tags,
1252
1257
  status: fm.status,
1253
1258
  confidence: deriveConfidence4(fm, u),
1259
+ ...fm.status === "draft" || fm.status === "proposed" ? { unverified: true } : {},
1254
1260
  read_count: u.read_count,
1255
1261
  reasons: [reason],
1256
1262
  match_quality: matchQuality ?? "partial",
@@ -1389,6 +1395,37 @@ ${m.content}`).join("\n\n---\n\n"),
1389
1395
  if (isDecaying(u, createdAt)) decayWarnings.push(m.id);
1390
1396
  }
1391
1397
  const outputMemories = input.format === "compact" ? trimmedMemories.map((m) => ({ ...m, body: compactSummary(m.body) })) : trimmedMemories;
1398
+ let symbolLocations;
1399
+ const symbolsToLookup = new Set(input.symbols);
1400
+ for (const m of outputMemories) {
1401
+ const loaded = byId.get(m.id);
1402
+ for (const sym of loaded?.memory.frontmatter.anchor.symbols ?? []) {
1403
+ symbolsToLookup.add(sym);
1404
+ }
1405
+ }
1406
+ if (symbolsToLookup.size > 0) {
1407
+ const codeMap = await loadCodeMap(ctx.paths);
1408
+ if (codeMap) {
1409
+ symbolLocations = [];
1410
+ for (const sym of symbolsToLookup) {
1411
+ const { files } = queryCodeMap(codeMap, { symbol: sym });
1412
+ if (files.length > 0) {
1413
+ symbolLocations.push({
1414
+ symbol: sym,
1415
+ locations: files.flatMap(
1416
+ (f) => f.entry.exports.filter((e) => e.name.toLowerCase().includes(sym.toLowerCase())).map((e) => ({
1417
+ file: f.path,
1418
+ kind: e.kind,
1419
+ line: e.line,
1420
+ ...e.description ? { description: e.description } : {}
1421
+ }))
1422
+ )
1423
+ });
1424
+ }
1425
+ }
1426
+ if (symbolLocations.length === 0) symbolLocations = void 0;
1427
+ }
1428
+ }
1392
1429
  return {
1393
1430
  ...input.task ? { task: input.task } : {},
1394
1431
  search_mode: searchMode,
@@ -1401,6 +1438,7 @@ ${m.content}`).join("\n\n---\n\n"),
1401
1438
  } : null,
1402
1439
  module_contexts: trimmedModules,
1403
1440
  memories: outputMemories,
1441
+ ...symbolLocations ? { symbol_locations: symbolLocations } : {},
1404
1442
  decay_warnings: decayWarnings,
1405
1443
  setup_warnings: setupWarnings,
1406
1444
  estimated_tokens: totalTokens,
@@ -1450,7 +1488,7 @@ async function loadModuleContexts2(ctx, modules) {
1450
1488
  }
1451
1489
 
1452
1490
  // src/tools/code-map.ts
1453
- import { loadCodeMap, queryCodeMap } from "@hiveai/core";
1491
+ import { loadCodeMap as loadCodeMap2, queryCodeMap as queryCodeMap2 } from "@hiveai/core";
1454
1492
  import { z as z18 } from "zod";
1455
1493
  var CodeMapInputSchema = {
1456
1494
  file: z18.string().optional().describe("Filter to files whose path contains this substring"),
@@ -1458,7 +1496,7 @@ var CodeMapInputSchema = {
1458
1496
  max_files: z18.number().int().positive().default(40).describe("Cap on returned files")
1459
1497
  };
1460
1498
  async function codeMapTool(input, ctx) {
1461
- const map = await loadCodeMap(ctx.paths);
1499
+ const map = await loadCodeMap2(ctx.paths);
1462
1500
  if (!map) {
1463
1501
  return {
1464
1502
  available: false,
@@ -1466,7 +1504,7 @@ async function codeMapTool(input, ctx) {
1466
1504
  notice: "No code map found. Run `haive index code` to generate `.ai/code-map.json`."
1467
1505
  };
1468
1506
  }
1469
- const { files } = queryCodeMap(map, { file: input.file, symbol: input.symbol });
1507
+ const { files } = queryCodeMap2(map, { file: input.file, symbol: input.symbol });
1470
1508
  return {
1471
1509
  available: true,
1472
1510
  generated_at: map.generated_at,
@@ -1768,7 +1806,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
1768
1806
 
1769
1807
  // src/server.ts
1770
1808
  var SERVER_NAME = "haive";
1771
- var SERVER_VERSION = "0.2.16";
1809
+ var SERVER_VERSION = "0.3.0";
1772
1810
  function jsonResult(data) {
1773
1811
  return {
1774
1812
  content: [