@hiveai/mcp 0.9.26 → 0.9.28

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
@@ -358,6 +358,10 @@ interface AntiPatternsWarning {
358
358
  body_preview: string;
359
359
  reasons: Array<"anchor" | "literal" | "semantic">;
360
360
  semantic_score?: number;
361
+ /** Memory tags — used downstream (e.g. pre_commit_check) to weight a warning by topic. */
362
+ tags?: string[];
363
+ /** Anchor paths of the memory — lets the gate tell what kind of file this warning is about. */
364
+ anchor_paths?: string[];
361
365
  }
362
366
  interface AntiPatternsCheckOutput {
363
367
  /** Total number of attempt+gotcha memories that exist in this project. */
package/dist/server.js CHANGED
@@ -1221,7 +1221,8 @@ var SessionTracker = class {
1221
1221
  const ranPostTask = this.events.some(
1222
1222
  (e) => e.tool === "mem_session_end" && !e.summary?.startsWith("Auto-captured")
1223
1223
  );
1224
- if (!ranPostTask && existsSync16(this.ctx.paths.haiveDir)) {
1224
+ const isSubstantialSession = totalCalls >= 3 || writingTools.length > 0;
1225
+ if (!ranPostTask && isSubstantialSession && existsSync16(this.ctx.paths.haiveDir)) {
1225
1226
  try {
1226
1227
  const memoriesSaved = writingTools.map((e) => e.summary ?? "").filter(Boolean).slice(0, 20);
1227
1228
  const payload = {
@@ -1399,6 +1400,7 @@ import {
1399
1400
  isGlobPath,
1400
1401
  isAutoPromoteEligible,
1401
1402
  isDecaying,
1403
+ isStackPackSeed,
1402
1404
  literalMatchesAllTokens as literalMatchesAllTokens2,
1403
1405
  literalMatchesAnyToken as literalMatchesAnyToken2,
1404
1406
  loadCodeMap,
@@ -1412,7 +1414,8 @@ import {
1412
1414
  serializeMemory as serializeMemory9,
1413
1415
  tokenizeQuery as tokenizeQuery2,
1414
1416
  trackReads as trackReads3,
1415
- truncateToTokens
1417
+ truncateToTokens,
1418
+ writeBriefingMarker
1416
1419
  } from "@hiveai/core";
1417
1420
  import { z as z17 } from "zod";
1418
1421
  var GetBriefingInputSchema = {
@@ -1866,6 +1869,16 @@ When done, call \`mem_session_end\` to acknowledge \u2014 this clears the pendin
1866
1869
  );
1867
1870
  }
1868
1871
  }
1872
+ if (existsSync18(ctx.paths.haiveDir)) {
1873
+ await writeBriefingMarker(ctx.paths, {
1874
+ sessionId: process.env.HAIVE_SESSION_ID,
1875
+ ...input.task ? { task: input.task } : {},
1876
+ source: "mcp-get-briefing",
1877
+ files: input.files,
1878
+ memoryIds: outputMemories.map((m) => m.id)
1879
+ }).catch(() => {
1880
+ });
1881
+ }
1869
1882
  return {
1870
1883
  ...input.task ? { task: input.task } : {},
1871
1884
  search_mode: searchMode,
@@ -1920,6 +1933,9 @@ function classifyMemoryPriority(memory, loaded, inputFiles, inputSymbols) {
1920
1933
  if (fm?.requires_human_approval || directAnchor || directSymbol || memory.type === "attempt" && (memory.match_quality === "exact" || strongSemantic) || memory.type === "skill" && (memory.match_quality === "exact" || strongSemantic)) {
1921
1934
  return "must_read";
1922
1935
  }
1936
+ if (isStackPackSeed(fm)) {
1937
+ return "background";
1938
+ }
1923
1939
  if (memory.type === "skill" || memory.reasons.includes("module") || memory.reasons.includes("domain") || memory.match_quality === "exact" || usefulSemantic) {
1924
1940
  return "useful";
1925
1941
  }
@@ -2449,6 +2465,8 @@ async function antiPatternsCheck(input, ctx) {
2449
2465
  confidence: deriveConfidence6(fm, u),
2450
2466
  body_preview: body.split("\n").slice(0, 5).join("\n").slice(0, 400),
2451
2467
  reasons: [reason],
2468
+ tags: fm.tags ?? [],
2469
+ anchor_paths: fm.anchor?.paths ?? [],
2452
2470
  ...score !== void 0 ? { semantic_score: score } : {}
2453
2471
  });
2454
2472
  };
@@ -3074,8 +3092,45 @@ function fileTypeDowngradeReason(warning, paths) {
3074
3092
  if (configOnly && !warning.reasons.includes("anchor") && !hasStrongSemantic(warning)) {
3075
3093
  return "package/config-only change; warning has no anchor on these files and no strong semantic match \u2014 downgraded to info.";
3076
3094
  }
3095
+ const touchesBuildFile = paths.some(isPackageOrConfigPath);
3096
+ if (!touchesBuildFile && isBuildScopedWarning(warning) && !warning.reasons.includes("anchor") && !hasStrongSemantic(warning)) {
3097
+ return "build/packaging gotcha, but no package/build file changed \u2014 downgraded to info.";
3098
+ }
3077
3099
  return null;
3078
3100
  }
3101
+ function isBuildScopedWarning(warning) {
3102
+ const tags = warning.tags ?? [];
3103
+ if (tags.some((t) => BUILD_SCOPED_TAGS.has(t.toLowerCase()))) return true;
3104
+ const anchors = warning.anchor_paths ?? [];
3105
+ return anchors.length > 0 && anchors.every(isPackageOrConfigPath);
3106
+ }
3107
+ var BUILD_SCOPED_TAGS = /* @__PURE__ */ new Set([
3108
+ "npm",
3109
+ "pnpm",
3110
+ "yarn",
3111
+ "publish",
3112
+ "install",
3113
+ "packaging",
3114
+ "package",
3115
+ "build",
3116
+ "tsup",
3117
+ "bundler",
3118
+ "monorepo",
3119
+ "workspace",
3120
+ "versioning",
3121
+ "version",
3122
+ "dev-workflow",
3123
+ "hotswap",
3124
+ "ci",
3125
+ "workflow",
3126
+ "release",
3127
+ "changelog",
3128
+ "dependencies",
3129
+ "deps",
3130
+ "dependency",
3131
+ "tooling",
3132
+ "config"
3133
+ ]);
3079
3134
  function hasStrongSemantic(warning) {
3080
3135
  return warning.reasons.includes("semantic") && (warning.semantic_score ?? 0) >= 0.65;
3081
3136
  }
@@ -3086,9 +3141,36 @@ function isDocLikePath(file) {
3086
3141
  function isPackageOrConfigPath(file) {
3087
3142
  const lower = file.toLowerCase();
3088
3143
  const base = lower.split("/").pop() ?? lower;
3089
- return lower.endsWith("package.json") || lower.endsWith("package-lock.json") || lower.endsWith("pnpm-lock.yaml") || lower.endsWith("yarn.lock") || lower.endsWith("bun.lockb") || lower.endsWith(".config.ts") || lower.endsWith(".config.js") || lower.endsWith(".json") || lower.endsWith(".yml") || lower.endsWith(".yaml") || lower.endsWith(".toml") || lower.startsWith(".github/workflows/") || lower.startsWith(".github/") && lower.endsWith(".yml") || // Dotfiles that are pure configuration/tooling — never trigger runtime gotchas
3144
+ return lower.endsWith("package.json") || lower.endsWith("package-lock.json") || lower.endsWith("pnpm-lock.yaml") || lower.endsWith("yarn.lock") || lower.endsWith("bun.lockb") || lower.endsWith(".config.ts") || lower.endsWith(".config.js") || isJsonConfigFile(base) || lower.endsWith(".yml") || lower.endsWith(".yaml") || lower.endsWith(".toml") || lower.startsWith(".github/workflows/") || lower.startsWith(".github/") && lower.endsWith(".yml") || // Dotfiles that are pure configuration/tooling — never trigger runtime gotchas
3090
3145
  base === ".gitignore" || base === ".gitattributes" || base === ".gitmodules" || base === ".editorconfig" || base === ".nvmrc" || base === ".node-version" || base === ".npmrc" || base === ".yarnrc" || base === ".yarnrc.yml" || base === ".dockerignore" || base === "dockerfile" || base.startsWith("dockerfile.") || base === ".env.example" || base === ".env.template" || lower.endsWith(".prettierrc") || lower.endsWith(".eslintrc") || lower.endsWith(".eslintignore") || lower.endsWith(".prettierignore") || lower.endsWith(".stylelintrc") || lower.endsWith(".browserslistrc");
3091
3146
  }
3147
+ function isJsonConfigFile(base) {
3148
+ const knownConfigs = /* @__PURE__ */ new Set([
3149
+ "tsconfig.json",
3150
+ "jsconfig.json",
3151
+ "deno.json",
3152
+ "deno.jsonc",
3153
+ "nx.json",
3154
+ "turbo.json",
3155
+ "lerna.json",
3156
+ "rush.json",
3157
+ "jest.config.json",
3158
+ "vitest.config.json",
3159
+ "babel.config.json",
3160
+ ".babelrc.json",
3161
+ ".swcrc",
3162
+ ".mocharc.json",
3163
+ "renovate.json",
3164
+ "dependabot.json",
3165
+ ".prettierrc.json",
3166
+ ".eslintrc.json",
3167
+ ".stylelintrc.json"
3168
+ ]);
3169
+ if (knownConfigs.has(base)) return true;
3170
+ if (/^tsconfig\..+\.json$/.test(base)) return true;
3171
+ if (/^\.[a-z]+rc\.json$/.test(base)) return true;
3172
+ return false;
3173
+ }
3092
3174
  function repairCommandForWarning(warning, paths) {
3093
3175
  const firstPath = paths[0];
3094
3176
  return firstPath ? `haive briefing --files "${firstPath}" --task "review ${warning.id}"` : `haive memory show ${warning.id}`;
@@ -3679,7 +3761,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
3679
3761
  // src/server.ts
3680
3762
  import { loadConfigSync } from "@hiveai/core";
3681
3763
  var SERVER_NAME = "haive";
3682
- var SERVER_VERSION = "0.9.26";
3764
+ var SERVER_VERSION = "0.9.28";
3683
3765
  function jsonResult(data) {
3684
3766
  return {
3685
3767
  content: [