@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/server.js CHANGED
@@ -1138,6 +1138,8 @@ import { existsSync as existsSync15 } from "fs";
1138
1138
  import path5 from "path";
1139
1139
  import {
1140
1140
  extractSensorExamples,
1141
+ extractTestFilePathsFromCommand,
1142
+ hasPendingTestMarker,
1141
1143
  judgeProposedSensor,
1142
1144
  loadMemoriesFromDir as loadMemoriesFromDir13,
1143
1145
  serializeMemory as serializeMemory7
@@ -1261,6 +1263,24 @@ async function proposeSensor(input, ctx) {
1261
1263
  }
1262
1264
  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}.` : "";
1263
1265
  if (kind !== "regex") {
1266
+ const referencedTests = extractTestFilePathsFromCommand(input.command.trim()).filter((rel) => existsSync15(path5.resolve(ctx.paths.root, rel)));
1267
+ const pendingTests = [];
1268
+ for (const rel of referencedTests) {
1269
+ try {
1270
+ if (hasPendingTestMarker(await readFile3(path5.resolve(ctx.paths.root, rel), "utf8"))) pendingTests.push(rel);
1271
+ } catch {
1272
+ }
1273
+ }
1274
+ if (pendingTests.length > 0 && input.severity === "block") {
1275
+ return {
1276
+ accepted: false,
1277
+ memory_id: input.memory_id,
1278
+ severity: input.severity,
1279
+ reason: "oracle-pending",
1280
+ 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.`,
1281
+ self_check: { silent_on_current: false, fires_on_bad: null, fired_on: pendingTests }
1282
+ };
1283
+ }
1264
1284
  const verdictCmd = runCommandForValidation(input.command.trim(), ctx.paths.root, input.timeout_ms);
1265
1285
  const anchorPathsCmd = input.paths.length > 0 ? input.paths : found.memory.frontmatter.anchor.paths;
1266
1286
  if (verdictCmd.status !== "passed" && input.severity === "block") {
@@ -1294,7 +1314,7 @@ ${verdictCmd.detail}`,
1294
1314
  accepted: true,
1295
1315
  memory_id: input.memory_id,
1296
1316
  severity: input.severity,
1297
- 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,
1317
+ 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,
1298
1318
  self_check: { silent_on_current: verdictCmd.status === "passed", fires_on_bad: null, fired_on: [] }
1299
1319
  };
1300
1320
  }
@@ -1379,7 +1399,10 @@ async function memTried(input, ctx) {
1379
1399
  if (!existsSync16(ctx.paths.haiveDir)) {
1380
1400
  throw new Error(`No .ai/ directory at ${ctx.paths.root}. Run 'hivelore init' first.`);
1381
1401
  }
1382
- const slug = input.what.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 5).join("-");
1402
+ const SLUG_STOPWORDS = /* @__PURE__ */ new Set(["and", "or", "the", "a", "an", "of", "to", "in", "for", "with", "on", "at", "by"]);
1403
+ const words = input.what.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 5);
1404
+ while (words.length > 2 && SLUG_STOPWORDS.has(words[words.length - 1])) words.pop();
1405
+ const slug = words.join("-");
1383
1406
  const scope = input.scope ?? (input.sensor ? "team" : "personal");
1384
1407
  const baseFm = buildFrontmatter2({
1385
1408
  type: "attempt",
@@ -2858,7 +2881,7 @@ function oneLine(value) {
2858
2881
  return value.replace(/\s+/g, " ").replace(/"/g, '\\"').trim().slice(0, 120);
2859
2882
  }
2860
2883
  function serverVersion() {
2861
- return true ? "0.39.0" : "dev";
2884
+ return true ? "0.39.1" : "dev";
2862
2885
  }
2863
2886
 
2864
2887
  // src/tools/code-map.ts
@@ -4286,7 +4309,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
4286
4309
  // src/server.ts
4287
4310
  import { hasRecentBriefingMarker, loadConfigSync } from "@hivelore/core";
4288
4311
  var SERVER_NAME = "hivelore";
4289
- var SERVER_VERSION = "0.39.0";
4312
+ var SERVER_VERSION = "0.39.1";
4290
4313
  function jsonResult(data) {
4291
4314
  return {
4292
4315
  content: [