@hiveai/mcp 0.4.0 → 0.4.1

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
@@ -1469,6 +1469,38 @@ ${m.content}`).join("\n\n---\n\n"),
1469
1469
  if (symbolLocations.length === 0) symbolLocations = void 0;
1470
1470
  }
1471
1471
  }
1472
+ const actionRequired = [];
1473
+ for (const m of outputMemories) {
1474
+ const loaded = byId.get(m.id);
1475
+ if (!loaded?.memory.frontmatter.requires_human_approval) continue;
1476
+ const bodyLines = loaded.memory.body.split("\n");
1477
+ const quoteBlock = bodyLines.filter((l) => l.startsWith("> ")).map((l) => l.slice(2)).join(" ").replace(/^\*«\s*/, "").replace(/\s*»\*$/, "").trim();
1478
+ const headingLine = bodyLines.find((l) => l.startsWith("## "));
1479
+ const summary = headingLine?.replace(/^##\s*/, "").trim() ?? m.id;
1480
+ actionRequired.push({
1481
+ id: m.id,
1482
+ summary,
1483
+ developer_message: quoteBlock || `Une modification externe potentiellement incompatible a \xE9t\xE9 d\xE9tect\xE9e (${m.id}). Veux-tu que j'analyse l'impact et que je propose des mises \xE0 jour ?`
1484
+ });
1485
+ }
1486
+ if (existsSync17(ctx.paths.memoriesDir)) {
1487
+ const allMems = await loadMemoriesFromDir13(ctx.paths.memoriesDir);
1488
+ for (const { memory } of allMems) {
1489
+ const fm = memory.frontmatter;
1490
+ if (!fm.requires_human_approval) continue;
1491
+ if (fm.status === "rejected" || fm.status === "deprecated") continue;
1492
+ if (actionRequired.some((a) => a.id === fm.id)) continue;
1493
+ const bodyLines = memory.body.split("\n");
1494
+ const quoteBlock = bodyLines.filter((l) => l.startsWith("> ")).map((l) => l.slice(2)).join(" ").replace(/^\*«\s*/, "").replace(/\s*»\*$/, "").trim();
1495
+ const headingLine = bodyLines.find((l) => l.startsWith("## "));
1496
+ const summary = headingLine?.replace(/^##\s*/, "").trim() ?? fm.id;
1497
+ actionRequired.push({
1498
+ id: fm.id,
1499
+ summary,
1500
+ developer_message: quoteBlock || `Une modification externe potentiellement incompatible a \xE9t\xE9 d\xE9tect\xE9e (${fm.id}). Veux-tu que j'analyse l'impact et que je propose des mises \xE0 jour ?`
1501
+ });
1502
+ }
1503
+ }
1472
1504
  return {
1473
1505
  ...input.task ? { task: input.task } : {},
1474
1506
  search_mode: searchMode,
@@ -1483,6 +1515,7 @@ ${m.content}`).join("\n\n---\n\n"),
1483
1515
  module_contexts: trimmedModules,
1484
1516
  memories: outputMemories,
1485
1517
  ...symbolLocations ? { symbol_locations: symbolLocations } : {},
1518
+ action_required: actionRequired,
1486
1519
  decay_warnings: decayWarnings,
1487
1520
  setup_warnings: setupWarnings,
1488
1521
  estimated_tokens: totalTokens,
@@ -1919,7 +1952,7 @@ function summarizeTools(events) {
1919
1952
 
1920
1953
  // src/server.ts
1921
1954
  var SERVER_NAME = "haive";
1922
- var SERVER_VERSION = "0.3.3";
1955
+ var SERVER_VERSION = "0.4.1";
1923
1956
  function jsonResult(data) {
1924
1957
  return {
1925
1958
  content: [
@@ -2065,6 +2098,7 @@ function createHaiveServer(options = {}) {
2065
2098
  "everything relevant in a single call under a token budget.",
2066
2099
  "",
2067
2100
  "RETURNS (in order of priority):",
2101
+ " 0. action_required \u2014 \u26A0\uFE0F HANDLE THIS FIRST if non-empty (see protocol below)",
2068
2102
  " 1. last_session \u2014 recap of the previous session (goal, what was done, next steps)",
2069
2103
  " 2. project_context \u2014 .ai/project-context.md (auto-generated from code-map if template)",
2070
2104
  " 3. module_contexts \u2014 relevant .ai/modules/<name>/context.md based on files being edited",
@@ -2073,6 +2107,13 @@ function createHaiveServer(options = {}) {
2073
2107
  " 6. setup_warnings \u2014 actionable warnings if setup is incomplete",
2074
2108
  " 7. decay_warnings \u2014 memories not read in >90 days (consider reviewing)",
2075
2109
  "",
2110
+ "\u26A0\uFE0F ACTION_REQUIRED PROTOCOL \u2014 MANDATORY:",
2111
+ " If action_required[] is non-empty, STOP and for each item:",
2112
+ " 1. Show the developer the exact developer_message field verbatim",
2113
+ " 2. Wait for explicit human confirmation ('yes', 'go ahead', 'oui', etc.)",
2114
+ " 3. Only then proceed with any code changes",
2115
+ " NEVER act autonomously on cross-repo breaking changes, dep bumps, or contract diffs.",
2116
+ "",
2076
2117
  "KEY PARAMETERS:",
2077
2118
  " task \u2014 what you are about to do (1\u20132 sentences) \u2014 ALWAYS provide this",
2078
2119
  " files \u2014 files you are about to edit \u2014 surfaces anchored memories",