@hiveai/mcp 0.10.1 → 0.10.3

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.d.ts CHANGED
@@ -362,8 +362,11 @@ interface AntiPatternsWarning {
362
362
  scope: string;
363
363
  confidence: string;
364
364
  body_preview: string;
365
- reasons: Array<"anchor" | "literal" | "semantic">;
365
+ reasons: Array<"anchor" | "literal" | "semantic" | "sensor">;
366
366
  semantic_score?: number;
367
+ /** When a regex sensor fired: its self-correction message and severity. */
368
+ sensor_message?: string;
369
+ sensor_severity?: "warn" | "block";
367
370
  /** Memory tags — used downstream (e.g. pre_commit_check) to weight a warning by topic. */
368
371
  tags?: string[];
369
372
  /** Anchor paths of the memory — lets the gate tell what kind of file this warning is about. */
package/dist/server.js CHANGED
@@ -2441,6 +2441,7 @@ function runCommand(cmd, args, cwd) {
2441
2441
  // src/tools/anti-patterns-check.ts
2442
2442
  import { existsSync as existsSync22 } from "fs";
2443
2443
  import {
2444
+ addedLinesFromDiff,
2444
2445
  deriveConfidence as deriveConfidence6,
2445
2446
  getUsage as getUsage7,
2446
2447
  isRetiredMemory as isRetiredMemory2,
@@ -2448,6 +2449,8 @@ import {
2448
2449
  loadUsageIndex as loadUsageIndex9,
2449
2450
  literalMatchesAnyToken as literalMatchesAnyToken3,
2450
2451
  memoryMatchesAnchorPaths as memoryMatchesAnchorPaths4,
2452
+ runRegexSensor,
2453
+ sensorAppliesToPath,
2451
2454
  tokenizeQuery as tokenizeQuery3
2452
2455
  } from "@hiveai/core";
2453
2456
  import { z as z24 } from "zod";
@@ -2585,6 +2588,29 @@ async function antiPatternsCheck(input, ctx) {
2585
2588
  }
2586
2589
  }
2587
2590
  }
2591
+ if (input.diff) {
2592
+ const added = addedLinesFromDiff(input.diff);
2593
+ const scanText = added.trim().length > 0 ? added : input.diff;
2594
+ for (const { memory } of negative) {
2595
+ const sensor = memory.frontmatter.sensor;
2596
+ if (!sensor || sensor.kind !== "regex") continue;
2597
+ const anchorPaths = memory.frontmatter.anchor.paths;
2598
+ const inScope = input.paths.length === 0 || input.paths.some((p) => sensorAppliesToPath(sensor, anchorPaths, p));
2599
+ if (!inScope) continue;
2600
+ const hit = runRegexSensor(memory.frontmatter.id, sensor, {
2601
+ path: input.paths[0] ?? "",
2602
+ content: scanText
2603
+ });
2604
+ if (hit) {
2605
+ upsert(memory.frontmatter, memory.body, "sensor");
2606
+ const w = seen.get(memory.frontmatter.id);
2607
+ if (w) {
2608
+ w.sensor_message = hit.message;
2609
+ w.sensor_severity = hit.severity;
2610
+ }
2611
+ }
2612
+ }
2613
+ }
2588
2614
  if (input.semantic && input.diff) {
2589
2615
  try {
2590
2616
  const mod = await import("@hiveai/embeddings");
@@ -2603,7 +2629,7 @@ async function antiPatternsCheck(input, ctx) {
2603
2629
  }
2604
2630
  const warnings = [...seen.values()].sort((a, b) => {
2605
2631
  const score = (w) => {
2606
- const reasonW = (w.reasons.includes("anchor") ? 4 : 0) + (w.reasons.includes("literal") ? 2 : 0) + (w.reasons.includes("semantic") ? 1 : 0);
2632
+ const reasonW = (w.reasons.includes("sensor") ? 8 : 0) + (w.reasons.includes("anchor") ? 4 : 0) + (w.reasons.includes("literal") ? 2 : 0) + (w.reasons.includes("semantic") ? 1 : 0);
2607
2633
  const confW = w.confidence === "authoritative" ? 3 : w.confidence === "trusted" ? 2 : w.confidence === "low" ? 1 : 0;
2608
2634
  return reasonW + confW + (w.semantic_score ?? 0);
2609
2635
  };
@@ -3872,7 +3898,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
3872
3898
  // src/server.ts
3873
3899
  import { loadConfigSync } from "@hiveai/core";
3874
3900
  var SERVER_NAME = "haive";
3875
- var SERVER_VERSION = "0.10.1";
3901
+ var SERVER_VERSION = "0.10.3";
3876
3902
  function jsonResult(data) {
3877
3903
  return {
3878
3904
  content: [