@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 +39 -6
- package/dist/index.js.map +1 -1
- package/dist/server.js +39 -6
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -158,6 +158,9 @@ async function memSave(input, ctx) {
|
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
const existing = existsSync4(ctx.paths.memoriesDir) ? await loadMemoriesFromDir2(ctx.paths.memoriesDir) : [];
|
|
161
|
+
const invalidPaths = input.paths.filter(
|
|
162
|
+
(p) => !existsSync4(path3.resolve(ctx.paths.root, p))
|
|
163
|
+
);
|
|
161
164
|
const incomingHash = bodyHash(input.body);
|
|
162
165
|
const hashDuplicate = existing.find(
|
|
163
166
|
({ memory }) => bodyHash(memory.body) === incomingHash && memory.frontmatter.scope === input.scope
|
|
@@ -194,7 +197,8 @@ async function memSave(input, ctx) {
|
|
|
194
197
|
scope: fm.scope,
|
|
195
198
|
file_path: topicMatch.filePath,
|
|
196
199
|
action: "updated",
|
|
197
|
-
revision_count: newFrontmatter.revision_count
|
|
200
|
+
revision_count: newFrontmatter.revision_count,
|
|
201
|
+
...invalidPaths.length > 0 ? { invalid_paths: invalidPaths, warning: `Anchor path(s) not found in project: ${invalidPaths.join(", ")}. They will be marked stale by haive sync.` } : {}
|
|
198
202
|
};
|
|
199
203
|
}
|
|
200
204
|
}
|
|
@@ -235,13 +239,18 @@ async function memSave(input, ctx) {
|
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
241
|
await writeFile2(file, serializeMemory({ frontmatter, body: input.body }), "utf8");
|
|
242
|
+
const finalWarning = [
|
|
243
|
+
invalidPaths.length > 0 ? `Anchor path(s) not found in project: ${invalidPaths.join(", ")}. They will be marked stale by \`haive sync\`.` : null,
|
|
244
|
+
warning ?? null
|
|
245
|
+
].filter(Boolean).join(" \u2014 ") || void 0;
|
|
238
246
|
return {
|
|
239
247
|
id: frontmatter.id,
|
|
240
248
|
scope: frontmatter.scope,
|
|
241
249
|
file_path: file,
|
|
242
250
|
action: "created",
|
|
243
|
-
...
|
|
244
|
-
...similar_found ? { similar_found } : {}
|
|
251
|
+
...finalWarning ? { warning: finalWarning } : {},
|
|
252
|
+
...similar_found ? { similar_found } : {},
|
|
253
|
+
...invalidPaths.length > 0 ? { invalid_paths: invalidPaths } : {}
|
|
245
254
|
};
|
|
246
255
|
}
|
|
247
256
|
|
|
@@ -1076,6 +1085,12 @@ async function memSessionEnd(input, ctx) {
|
|
|
1076
1085
|
}
|
|
1077
1086
|
const body = buildBody(input);
|
|
1078
1087
|
const topic = recapTopic(input.scope, input.module);
|
|
1088
|
+
const invalidPaths = input.files_touched.filter(
|
|
1089
|
+
(p) => !existsSync16(path7.resolve(ctx.paths.root, p))
|
|
1090
|
+
);
|
|
1091
|
+
if (invalidPaths.length > 0) {
|
|
1092
|
+
console.warn(`[haive] session end: anchor path(s) not found: ${invalidPaths.join(", ")}`);
|
|
1093
|
+
}
|
|
1079
1094
|
const existing = existsSync16(ctx.paths.memoriesDir) ? await loadMemoriesFromDir12(ctx.paths.memoriesDir) : [];
|
|
1080
1095
|
const topicMatch = existing.find(
|
|
1081
1096
|
({ memory }) => memory.frontmatter.topic === topic && memory.frontmatter.scope === input.scope && (!input.module || memory.frontmatter.module === input.module)
|
|
@@ -1294,7 +1309,20 @@ async function getBriefing(input, ctx) {
|
|
|
1294
1309
|
await trackReads3(ctx.paths, memories.map((m) => m.id));
|
|
1295
1310
|
}
|
|
1296
1311
|
}
|
|
1297
|
-
const
|
|
1312
|
+
const projectContextRaw = input.include_project_context && existsSync17(ctx.paths.projectContext) ? await readFile3(ctx.paths.projectContext, "utf8") : "";
|
|
1313
|
+
const isTemplateContext = projectContextRaw.includes("TODO \u2014 high-level overview") || projectContextRaw.includes("Generated by `haive init`");
|
|
1314
|
+
const projectContext = isTemplateContext ? "" : projectContextRaw;
|
|
1315
|
+
const setupWarnings = [];
|
|
1316
|
+
if (isTemplateContext) {
|
|
1317
|
+
setupWarnings.push(
|
|
1318
|
+
"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."
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
if (!existsSync17(ctx.paths.projectContext)) {
|
|
1322
|
+
setupWarnings.push(
|
|
1323
|
+
"No project-context.md found. Run `haive init` then invoke the bootstrap_project MCP prompt."
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1298
1326
|
const moduleContents = input.include_module_contexts ? await loadModuleContexts2(ctx, inferred) : [];
|
|
1299
1327
|
const memoriesText = memories.map((m) => {
|
|
1300
1328
|
const unverified = m.status === "proposed" ? " [UNVERIFIED \u2014 not yet validated]" : "";
|
|
@@ -1361,10 +1389,15 @@ ${m.content}`).join("\n\n---\n\n"),
|
|
|
1361
1389
|
search_mode: searchMode,
|
|
1362
1390
|
inferred_modules: inferred,
|
|
1363
1391
|
...lastSession ? { last_session: lastSession } : {},
|
|
1364
|
-
project_context:
|
|
1392
|
+
project_context: projectContextRaw ? {
|
|
1393
|
+
content: projectSlice.text,
|
|
1394
|
+
truncated: projectSlice.truncated,
|
|
1395
|
+
...isTemplateContext ? { is_template: true } : {}
|
|
1396
|
+
} : null,
|
|
1365
1397
|
module_contexts: trimmedModules,
|
|
1366
1398
|
memories: outputMemories,
|
|
1367
1399
|
decay_warnings: decayWarnings,
|
|
1400
|
+
setup_warnings: setupWarnings,
|
|
1368
1401
|
estimated_tokens: totalTokens,
|
|
1369
1402
|
budget: {
|
|
1370
1403
|
max_tokens: input.max_tokens,
|
|
@@ -1730,7 +1763,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
1730
1763
|
|
|
1731
1764
|
// src/server.ts
|
|
1732
1765
|
var SERVER_NAME = "haive";
|
|
1733
|
-
var SERVER_VERSION = "0.2.
|
|
1766
|
+
var SERVER_VERSION = "0.2.16";
|
|
1734
1767
|
function jsonResult(data) {
|
|
1735
1768
|
return {
|
|
1736
1769
|
content: [
|