kibi-mcp 0.19.2 → 0.20.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.
@@ -21,7 +21,14 @@ export function initializeDiagnosticMode(enabled = DIAGNOSTIC_MODE_ENABLED) {
21
21
  return;
22
22
  }
23
23
  const workspaceRoot = resolveWorkspaceRoot();
24
- diagnosticUsageLogPath = path.join(workspaceRoot, ".kb", "usage.log");
24
+ // Evaluators may run an independent read-only verification client in the
25
+ // same fixture workspace after the model. Allow that client to use a
26
+ // separate receipt so model-originated usage can be reconciled without
27
+ // accidentally treating verifier calls as model evidence. Normal Kibi
28
+ // operation remains rooted at `.kb/usage.log`.
29
+ diagnosticUsageLogPath =
30
+ process.env.KIBI_MCP_DIAGNOSTIC_USAGE_LOG_PATH ??
31
+ path.join(workspaceRoot, ".kb", "usage.log");
25
32
  process.env.KIBI_MCP_DIAGNOSTIC_MODE = "1";
26
33
  }
27
34
  export function appendUsageLogLine(entry) {
@@ -84,8 +84,9 @@ export const PROMPTS = [
84
84
  "## Rules",
85
85
  "- Never apply bootstrap writes without user-facing preview and explicit approval.",
86
86
  "- `kb_autopilot_generate` is strictly read-only; synthesis is the backend, not the actor.",
87
- "- Prefer MCP tools; CLI routes are available when MCP is unavailable.",
88
- "- If Kibi MCP tools are visible, use MCP. If MCP availability is unknown and a trusted local Kibi CLI is available, use its dedicated JSON routes with `--input <file|->`.",
87
+ "- MCP tools and the trusted project-local CLI are peer surfaces; choose by what is visible and approved here.",
88
+ "- If Kibi MCP tools are visible and approved, use MCP.",
89
+ "- Otherwise, in a trusted workspace, use the project-local CLI's dedicated JSON routes with `--input <file|->`.",
89
90
  "- If neither interface is available, Kibi operation is blocked; tell the operator to enable MCP or the trusted project-local CLI. Do not infer MCP availability from config file existence.",
90
91
  "- Do not read or edit `.kb/` files directly. Query before mutate. Run `kb_upsert` sequentially. Run `kb_check` before completion.",
91
92
  ].join("\n"),
@@ -44,6 +44,20 @@ function nearestPackageJson(startPath) {
44
44
  current = parent;
45
45
  }
46
46
  }
47
+ function nearestPackageJsonFromDirectory(startPath) {
48
+ let current = path.resolve(startPath);
49
+ while (true) {
50
+ const candidate = path.join(current, "package.json");
51
+ if (existsSync(candidate)) {
52
+ return candidate;
53
+ }
54
+ const parent = path.dirname(current);
55
+ if (parent === current) {
56
+ return null;
57
+ }
58
+ current = parent;
59
+ }
60
+ }
47
61
  function packageInfoFromEntrypoint(entrypoint) {
48
62
  const normalizedEntrypoint = path.resolve(entrypoint);
49
63
  const packageJsonPath = nearestPackageJson(normalizedEntrypoint);
@@ -62,7 +76,11 @@ export function readRunningPackageInfo(entrypointUrl) {
62
76
  }
63
77
  export function resolveProjectLocalMcp(cwd) {
64
78
  try {
65
- const projectRequire = createRequire(path.join(path.resolve(cwd), "package.json"));
79
+ const projectPackageJson = nearestPackageJsonFromDirectory(cwd);
80
+ if (!projectPackageJson) {
81
+ return null;
82
+ }
83
+ const projectRequire = createRequire(projectPackageJson);
66
84
  const resolved = projectRequire.resolve(PACKAGE_NAME);
67
85
  const entrypoint = realpathSync.native?.(resolved) ?? realpathSync(resolved);
68
86
  return packageInfoFromEntrypoint(entrypoint);
@@ -76,6 +94,7 @@ export function resolveProjectLocalMcp(cwd) {
76
94
  }
77
95
  }
78
96
  export function compareMcpResolution(running, projectLocal) {
97
+ // implements REQ-cursor-agent-plugin-standard-v1
79
98
  const diagnosticText = JSON.stringify({ running, projectLocal });
80
99
  const forbiddenVersionObserved = diagnosticText.includes(FORBIDDEN_VERSION);
81
100
  if (!projectLocal) {
@@ -92,16 +111,14 @@ export function compareMcpResolution(running, projectLocal) {
92
111
  forbiddenVersionObserved,
93
112
  };
94
113
  }
95
- if (path.resolve(running.packageRoot) !== path.resolve(projectLocal.packageRoot)) {
96
- return {
97
- stale: true,
98
- reason: `package root mismatch: running ${running.packageRoot}, project-local ${projectLocal.packageRoot}`,
99
- forbiddenVersionObserved,
100
- };
101
- }
114
+ // Same version: the running build is the version the project pins. Re-entering
115
+ // a same-version copy (e.g. a bun-store published install) abandons the local
116
+ // dev build for an identical-version store copy, which defeats local
117
+ // dogfooding and can silently drop unreleased local fixes. Only re-enter on a
118
+ // genuine version mismatch.
102
119
  return {
103
120
  stale: false,
104
- reason: "running kibi-mcp matches project-local kibi-mcp",
121
+ reason: "running kibi-mcp matches the project-local version",
105
122
  forbiddenVersionObserved,
106
123
  };
107
124
  }
@@ -2,5 +2,9 @@ import { statusSpec } from "kibi-cli/operations";
2
2
  import { createDiscoveryContext } from "./discovery-adapter.js";
3
3
  export async function handleKbStatus(prolog, args) {
4
4
  // implements REQ-kibi-operation-interface-parity
5
+ // Freshness is read-after-write sensitive: invalidate the PrologProcess query
6
+ // cache so kb_status always reflects the current workspace state rather than
7
+ // a stale earlier-in-session result.
8
+ prolog.invalidateCache();
5
9
  return statusSpec.execute(args, createDiscoveryContext(prolog));
6
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-mcp",
3
- "version": "0.19.2",
3
+ "version": "0.20.1",
4
4
  "dependencies": {
5
5
  "@modelcontextprotocol/sdk": "^1.26.0",
6
6
  "ajv": "^8.18.0",
@@ -9,8 +9,8 @@
9
9
  "fast-glob": "^3.2.12",
10
10
  "gray-matter": "^4.0.3",
11
11
  "js-yaml": "^4.1.0",
12
- "kibi-cli": "^0.16.0",
13
- "kibi-core": "^0.7.1",
12
+ "kibi-cli": "^0.17.0",
13
+ "kibi-core": "^0.8.0",
14
14
  "mcpcat": "^0.1.12",
15
15
  "ts-morph": "^23.0.0",
16
16
  "zod": "^4.3.6"