@hiveai/mcp 0.2.15 → 0.2.16

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
@@ -163,6 +163,9 @@ async function memSave(input, ctx) {
163
163
  );
164
164
  }
165
165
  const existing = existsSync4(ctx.paths.memoriesDir) ? await loadMemoriesFromDir2(ctx.paths.memoriesDir) : [];
166
+ const invalidPaths = input.paths.filter(
167
+ (p) => !existsSync4(path3.resolve(ctx.paths.root, p))
168
+ );
166
169
  const incomingHash = bodyHash(input.body);
167
170
  const hashDuplicate = existing.find(
168
171
  ({ memory }) => bodyHash(memory.body) === incomingHash && memory.frontmatter.scope === input.scope
@@ -199,7 +202,8 @@ async function memSave(input, ctx) {
199
202
  scope: fm.scope,
200
203
  file_path: topicMatch.filePath,
201
204
  action: "updated",
202
- revision_count: newFrontmatter.revision_count
205
+ revision_count: newFrontmatter.revision_count,
206
+ ...invalidPaths.length > 0 ? { invalid_paths: invalidPaths, warning: `Anchor path(s) not found in project: ${invalidPaths.join(", ")}. They will be marked stale by haive sync.` } : {}
203
207
  };
204
208
  }
205
209
  }
@@ -240,13 +244,18 @@ async function memSave(input, ctx) {
240
244
  }
241
245
  }
242
246
  await writeFile2(file, serializeMemory({ frontmatter, body: input.body }), "utf8");
247
+ const finalWarning = [
248
+ invalidPaths.length > 0 ? `Anchor path(s) not found in project: ${invalidPaths.join(", ")}. They will be marked stale by \`haive sync\`.` : null,
249
+ warning ?? null
250
+ ].filter(Boolean).join(" \u2014 ") || void 0;
243
251
  return {
244
252
  id: frontmatter.id,
245
253
  scope: frontmatter.scope,
246
254
  file_path: file,
247
255
  action: "created",
248
- ...warning ? { warning } : {},
249
- ...similar_found ? { similar_found } : {}
256
+ ...finalWarning ? { warning: finalWarning } : {},
257
+ ...similar_found ? { similar_found } : {},
258
+ ...invalidPaths.length > 0 ? { invalid_paths: invalidPaths } : {}
250
259
  };
251
260
  }
252
261
 
@@ -1081,6 +1090,12 @@ async function memSessionEnd(input, ctx) {
1081
1090
  }
1082
1091
  const body = buildBody(input);
1083
1092
  const topic = recapTopic(input.scope, input.module);
1093
+ const invalidPaths = input.files_touched.filter(
1094
+ (p) => !existsSync16(path7.resolve(ctx.paths.root, p))
1095
+ );
1096
+ if (invalidPaths.length > 0) {
1097
+ console.warn(`[haive] session end: anchor path(s) not found: ${invalidPaths.join(", ")}`);
1098
+ }
1084
1099
  const existing = existsSync16(ctx.paths.memoriesDir) ? await loadMemoriesFromDir12(ctx.paths.memoriesDir) : [];
1085
1100
  const topicMatch = existing.find(
1086
1101
  ({ memory }) => memory.frontmatter.topic === topic && memory.frontmatter.scope === input.scope && (!input.module || memory.frontmatter.module === input.module)
@@ -1299,7 +1314,20 @@ async function getBriefing(input, ctx) {
1299
1314
  await trackReads3(ctx.paths, memories.map((m) => m.id));
1300
1315
  }
1301
1316
  }
1302
- const projectContext = input.include_project_context && existsSync17(ctx.paths.projectContext) ? await readFile3(ctx.paths.projectContext, "utf8") : "";
1317
+ const projectContextRaw = input.include_project_context && existsSync17(ctx.paths.projectContext) ? await readFile3(ctx.paths.projectContext, "utf8") : "";
1318
+ const isTemplateContext = projectContextRaw.includes("TODO \u2014 high-level overview") || projectContextRaw.includes("Generated by `haive init`");
1319
+ const projectContext = isTemplateContext ? "" : projectContextRaw;
1320
+ const setupWarnings = [];
1321
+ if (isTemplateContext) {
1322
+ setupWarnings.push(
1323
+ "project-context.md still contains the default template. Invoke the bootstrap_project MCP prompt to auto-fill it from your codebase. Until then, get_briefing returns no project context."
1324
+ );
1325
+ }
1326
+ if (!existsSync17(ctx.paths.projectContext)) {
1327
+ setupWarnings.push(
1328
+ "No project-context.md found. Run `haive init` then invoke the bootstrap_project MCP prompt."
1329
+ );
1330
+ }
1303
1331
  const moduleContents = input.include_module_contexts ? await loadModuleContexts2(ctx, inferred) : [];
1304
1332
  const memoriesText = memories.map((m) => {
1305
1333
  const unverified = m.status === "proposed" ? " [UNVERIFIED \u2014 not yet validated]" : "";
@@ -1366,10 +1394,15 @@ ${m.content}`).join("\n\n---\n\n"),
1366
1394
  search_mode: searchMode,
1367
1395
  inferred_modules: inferred,
1368
1396
  ...lastSession ? { last_session: lastSession } : {},
1369
- project_context: projectContext ? { content: projectSlice.text, truncated: projectSlice.truncated } : null,
1397
+ project_context: projectContextRaw ? {
1398
+ content: projectSlice.text,
1399
+ truncated: projectSlice.truncated,
1400
+ ...isTemplateContext ? { is_template: true } : {}
1401
+ } : null,
1370
1402
  module_contexts: trimmedModules,
1371
1403
  memories: outputMemories,
1372
1404
  decay_warnings: decayWarnings,
1405
+ setup_warnings: setupWarnings,
1373
1406
  estimated_tokens: totalTokens,
1374
1407
  budget: {
1375
1408
  max_tokens: input.max_tokens,
@@ -1735,7 +1768,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
1735
1768
 
1736
1769
  // src/server.ts
1737
1770
  var SERVER_NAME = "haive";
1738
- var SERVER_VERSION = "0.2.15";
1771
+ var SERVER_VERSION = "0.2.16";
1739
1772
  function jsonResult(data) {
1740
1773
  return {
1741
1774
  content: [