@hivelore/mcp 0.39.0 → 0.39.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
@@ -1140,6 +1140,8 @@ import { existsSync as existsSync15 } from "fs";
1140
1140
  import path5 from "path";
1141
1141
  import {
1142
1142
  extractSensorExamples,
1143
+ extractTestFilePathsFromCommand,
1144
+ hasPendingTestMarker,
1143
1145
  judgeProposedSensor,
1144
1146
  loadMemoriesFromDir as loadMemoriesFromDir13,
1145
1147
  serializeMemory as serializeMemory7
@@ -1263,6 +1265,24 @@ async function proposeSensor(input, ctx) {
1263
1265
  }
1264
1266
  const personalScopeNudge = found.memory.frontmatter.scope === "personal" ? ` Note: this lesson is personal-scoped, so the sensor guards only YOUR machine (personal memories are gitignored). Promote it so the gate travels with the repo: hivelore memory promote ${input.memory_id}.` : "";
1265
1267
  if (kind !== "regex") {
1268
+ const referencedTests = extractTestFilePathsFromCommand(input.command.trim()).filter((rel) => existsSync15(path5.resolve(ctx.paths.root, rel)));
1269
+ const pendingTests = [];
1270
+ for (const rel of referencedTests) {
1271
+ try {
1272
+ if (hasPendingTestMarker(await readFile3(path5.resolve(ctx.paths.root, rel), "utf8"))) pendingTests.push(rel);
1273
+ } catch {
1274
+ }
1275
+ }
1276
+ if (pendingTests.length > 0 && input.severity === "block") {
1277
+ return {
1278
+ accepted: false,
1279
+ memory_id: input.memory_id,
1280
+ severity: input.severity,
1281
+ reason: "oracle-pending",
1282
+ guidance: `The routed test is still a PENDING stub (${pendingTests.join(", ")}) \u2014 it passes on anything, so the sensor would enforce nothing while reporting protection. Write the assertion (RED on the incident, GREEN once fixed), run it, then re-propose.`,
1283
+ self_check: { silent_on_current: false, fires_on_bad: null, fired_on: pendingTests }
1284
+ };
1285
+ }
1266
1286
  const verdictCmd = runCommandForValidation(input.command.trim(), ctx.paths.root, input.timeout_ms);
1267
1287
  const anchorPathsCmd = input.paths.length > 0 ? input.paths : found.memory.frontmatter.anchor.paths;
1268
1288
  if (verdictCmd.status !== "passed" && input.severity === "block") {
@@ -1296,7 +1316,7 @@ ${verdictCmd.detail}`,
1296
1316
  accepted: true,
1297
1317
  memory_id: input.memory_id,
1298
1318
  severity: input.severity,
1299
- guidance: (verdictCmd.status === "passed" ? "Command oracle passes on the current tree; the gate now runs it when the diff touches the sensor's paths (requires enforcement.runCommandSensors=true)." : `Accepted at warn severity, but note: ${verdictCmd.status} on the current tree (${verdictCmd.detail}).`) + personalScopeNudge,
1319
+ guidance: (verdictCmd.status === "passed" ? "Command oracle passes on the current tree; the gate now runs it when the diff touches the sensor's paths (requires enforcement.runCommandSensors=true)." : `Accepted at warn severity, but note: ${verdictCmd.status} on the current tree (${verdictCmd.detail}).`) + (pendingTests.length > 0 ? ` Note: the routed test is still a PENDING stub (${pendingTests.join(", ")}) \u2014 it passes on anything; write the assertion to make this oracle real.` : "") + personalScopeNudge,
1300
1320
  self_check: { silent_on_current: verdictCmd.status === "passed", fires_on_bad: null, fired_on: [] }
1301
1321
  };
1302
1322
  }
@@ -1381,7 +1401,10 @@ async function memTried(input, ctx) {
1381
1401
  if (!existsSync16(ctx.paths.haiveDir)) {
1382
1402
  throw new Error(`No .ai/ directory at ${ctx.paths.root}. Run 'hivelore init' first.`);
1383
1403
  }
1384
- const slug = input.what.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 5).join("-");
1404
+ const SLUG_STOPWORDS = /* @__PURE__ */ new Set(["and", "or", "the", "a", "an", "of", "to", "in", "for", "with", "on", "at", "by"]);
1405
+ const words = input.what.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 5);
1406
+ while (words.length > 2 && SLUG_STOPWORDS.has(words[words.length - 1])) words.pop();
1407
+ const slug = words.join("-");
1385
1408
  const scope = input.scope ?? (input.sensor ? "team" : "personal");
1386
1409
  const baseFm = buildFrontmatter2({
1387
1410
  type: "attempt",
@@ -2852,7 +2875,7 @@ function oneLine(value) {
2852
2875
  return value.replace(/\s+/g, " ").replace(/"/g, '\\"').trim().slice(0, 120);
2853
2876
  }
2854
2877
  function serverVersion() {
2855
- return true ? "0.39.0" : "dev";
2878
+ return true ? "0.39.1" : "dev";
2856
2879
  }
2857
2880
 
2858
2881
  // src/tools/code-map.ts
@@ -4280,7 +4303,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
4280
4303
  // src/server.ts
4281
4304
  import { hasRecentBriefingMarker, loadConfigSync } from "@hivelore/core";
4282
4305
  var SERVER_NAME = "hivelore";
4283
- var SERVER_VERSION = "0.39.0";
4306
+ var SERVER_VERSION = "0.39.1";
4284
4307
  function jsonResult(data) {
4285
4308
  return {
4286
4309
  content: [