vexp-mcp 3.3.3 → 3.3.4

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.
@@ -2,9 +2,10 @@ import * as net from "net";
2
2
  import * as path from "path";
3
3
  import * as os from "os";
4
4
  import * as fs from "fs";
5
- import { spawn } from "child_process";
5
+ import { execFile, spawn } from "child_process";
6
6
  import { fileURLToPath } from "url";
7
7
  import { randomUUID } from "crypto";
8
+ import { parseEngineVersion, replaceOlderDaemon } from "./daemon-upgrade.js";
8
9
  /**
9
10
  * The quota marker for `workspaceRoot`, or null when absent or no longer binding.
10
11
  *
@@ -68,6 +69,26 @@ export function dailyLimitError(marker) {
68
69
  // "Raise", not "lift": every paid plan has a daily ceiling too.
69
70
  `Paid plans raise the daily limit: https://vexp.dev/#pricing`);
70
71
  }
72
+ /**
73
+ * When this process last held each daemon against its engine, by socket, and
74
+ * the check itself while it runs. Kept here and not on the client: the HTTP
75
+ * transport builds a new DaemonClient for every request, so a client's own
76
+ * memory would make every request the first one.
77
+ */
78
+ const upgradeChecks = new Map();
79
+ const UPGRADE_CHECK_INTERVAL_MS = 30 * 60_000;
80
+ /** `--version` of each engine binary, asked once for the life of the process. */
81
+ const engineVersions = new Map();
82
+ function engineVersionOf(binary) {
83
+ let version = engineVersions.get(binary);
84
+ if (!version) {
85
+ version = new Promise((resolve) => {
86
+ execFile(binary, ["--version"], { timeout: 2_500, env: binaryEnvFor(binary), windowsHide: true }, (err, stdout) => resolve(err ? undefined : parseEngineVersion(String(stdout))));
87
+ });
88
+ engineVersions.set(binary, version);
89
+ }
90
+ return version;
91
+ }
71
92
  /**
72
93
  * Client per comunicare con il vexp-core daemon via Unix socket / Named pipe.
73
94
  * Protocol: JSON lines (newline-delimited JSON).
@@ -168,6 +189,87 @@ export class DaemonClient {
168
189
  setTimeout(done, 4000);
169
190
  });
170
191
  }
192
+ /**
193
+ * Before the first request this process sends to a daemon, and then at most
194
+ * once in thirty minutes, hold the daemon against the engine this server
195
+ * would start, and replace it when it is older (daemon-upgrade.ts has the
196
+ * rules). This server started a daemon only when none answered, so a daemon
197
+ * from before an update of the CLI went on answering agents for as long as
198
+ * it lived (field report, 2026-10-10).
199
+ *
200
+ * Requests that arrive while the check runs wait for it: one sent meanwhile
201
+ * could land on the daemon being stopped. Bounded (1.5 s for the answer,
202
+ * 2.5 s for the engine's version, 6 s for a restart) and silent: whatever
203
+ * it finds or fails at, the request then takes the ordinary path. With the
204
+ * versions in agreement it costs one `index_status`. Off with
205
+ * VEXP_NO_DAEMON_UPGRADE=1, and with VEXP_NO_AUTOSTART=1 like every other
206
+ * start this server makes.
207
+ */
208
+ checkDaemonUpgrade() {
209
+ if (process.env.VEXP_NO_AUTOSTART === "1" || process.env.VEXP_NO_DAEMON_UPGRADE === "1") {
210
+ return Promise.resolve();
211
+ }
212
+ let socket;
213
+ try {
214
+ socket = this.socketPath;
215
+ }
216
+ catch {
217
+ return Promise.resolve();
218
+ }
219
+ const now = Date.now();
220
+ const last = upgradeChecks.get(socket);
221
+ if (last && now - last.at < UPGRADE_CHECK_INTERVAL_MS)
222
+ return last.done;
223
+ const done = this.upgradeDaemonOn(socket).catch(() => { });
224
+ upgradeChecks.set(socket, { at: now, done });
225
+ return done;
226
+ }
227
+ async upgradeDaemonOn(socket) {
228
+ const binary = resolveVexpCoreBinary();
229
+ if (!binary)
230
+ return;
231
+ await replaceOlderDaemon({
232
+ workspace: resolveWorkspaceRoot(this.spawnWorkspaceRoot),
233
+ socket,
234
+ engineVersion: () => engineVersionOf(binary),
235
+ restart: (dir) => this.restartDaemon(binary, dir),
236
+ });
237
+ }
238
+ /** `daemon-cmd restart` in `workspaceRoot`, waited for with a bound. */
239
+ restartDaemon(binary, workspaceRoot) {
240
+ // The retry path of the request that follows must not start a second
241
+ // daemon next to the one this is starting.
242
+ this.lastSpawnAttemptMs = Date.now();
243
+ return new Promise((resolve) => {
244
+ // Environment and options of the start in maybeSpawnDaemon, for the
245
+ // reasons given there: `detached` keeps the child out of libuv's
246
+ // kill-on-close job object on Windows, and `windowsHide` would be
247
+ // ignored next to it.
248
+ const env = binaryEnvFor(binary);
249
+ env.VEXP_WORKSPACE = workspaceRoot;
250
+ const child = spawn(binary, ["daemon-cmd", "restart"], {
251
+ cwd: workspaceRoot,
252
+ stdio: "ignore",
253
+ detached: true,
254
+ env,
255
+ });
256
+ child.unref();
257
+ let settled = false;
258
+ const done = () => {
259
+ if (settled)
260
+ return;
261
+ settled = true;
262
+ clearTimeout(cap);
263
+ resolve();
264
+ };
265
+ child.on("exit", done);
266
+ child.on("error", done);
267
+ // daemon-cmd restart stops the daemon, waits half a second, starts
268
+ // one and waits up to twelve seconds for its socket. Past six the
269
+ // request goes on, and its own retries wait for the rest.
270
+ const cap = setTimeout(done, 6_000);
271
+ });
272
+ }
171
273
  /** Tail of the daemon log files, for actionable connection errors. */
172
274
  daemonLogTail(maxLines = 12) {
173
275
  const workspaceRoot = resolveWorkspaceRoot(this.spawnWorkspaceRoot);
@@ -221,6 +323,10 @@ export class DaemonClient {
221
323
  * Invia una richiesta al daemon con retry per errori di connessione transienti.
222
324
  */
223
325
  async call(tool, params) {
326
+ await this.checkDaemonUpgrade();
327
+ return this.callWithRetries(tool, params);
328
+ }
329
+ async callWithRetries(tool, params) {
224
330
  let lastError;
225
331
  for (let attempt = 0; attempt <= DaemonClient.MAX_RETRIES; attempt++) {
226
332
  try {
@@ -501,7 +607,8 @@ export class DaemonClient {
501
607
  */
502
608
  async health() {
503
609
  try {
504
- await this.call("index_status", {});
610
+ // A probe, not a use: it never replaces a daemon.
611
+ await this.callWithRetries("index_status", {});
505
612
  return true;
506
613
  }
507
614
  catch {
@@ -0,0 +1,358 @@
1
+ import * as fs from "fs";
2
+ import * as net from "net";
3
+ import * as os from "os";
4
+ import * as path from "path";
5
+ /**
6
+ * An older daemon is replaced at the next use.
7
+ *
8
+ * A daemon is one long-lived process per workspace, and a launcher started
9
+ * one only when the socket did not answer. So after `npm install -g
10
+ * vexp-cli@latest` every project went on being served by the build its
11
+ * daemon had started with, until someone restarted it by hand (field
12
+ * report, 2026-10-10). The extension has replaced an older daemon at window
13
+ * start since 2.4.0 (vexp-vscode daemon-manager.ts); the CLI and the Node
14
+ * MCP server had no such rule, and this is it.
15
+ *
16
+ * Lockstep with packages/vexp-cli/src/daemon-upgrade.ts. This server cannot
17
+ * import the CLI at runtime, so it carries its own copy, and the CLI's
18
+ * test/daemon-upgrade.lockstep.test.ts holds the two to the same text,
19
+ * function by function. The two helpers the CLI imports are copied here
20
+ * under the same test.
21
+ */
22
+ /** Copy of isOlderVersion in vexp-cli/src/mcp-supervisor.ts, which carries
23
+ * the tests of the order. */
24
+ function isOlderVersion(recorded, mine) {
25
+ if (!recorded)
26
+ return true;
27
+ if (recorded === mine)
28
+ return false;
29
+ const parts = (v) => {
30
+ const nums = v.split("-")[0].split(".").map((n) => Number.parseInt(n, 10));
31
+ return nums.length === 3 && nums.every((n) => Number.isFinite(n)) ? nums : null;
32
+ };
33
+ const a = parts(recorded);
34
+ const b = parts(mine);
35
+ if (!a || !b)
36
+ return true;
37
+ for (let i = 0; i < 3; i++) {
38
+ if (a[i] !== b[i])
39
+ return a[i] < b[i];
40
+ }
41
+ return false;
42
+ }
43
+ /** Copy of vexpHome in vexp-cli/src/state-home.ts: the directory vexp keeps
44
+ * its own state in (`<here>/.vexp`). */
45
+ function vexpHome() {
46
+ const h = process.env.VEXP_HOME;
47
+ if (h && path.isAbsolute(h))
48
+ return h;
49
+ return os.homedir();
50
+ }
51
+ /** How long a workspace is left alone after a replacement was tried for it. */
52
+ export const UPGRADE_COOLDOWN_MS = 10 * 60_000;
53
+ /** How long the daemon is given to answer `index_status`. */
54
+ export const UPGRADE_STATUS_TIMEOUT_MS = 1_500;
55
+ /**
56
+ * Whether a launcher replaces the daemon that answered. The rules, in order:
57
+ *
58
+ * 1. Switched off: VEXP_NO_DAEMON_UPGRADE=1, or VEXP_NO_AUTOSTART=1, which
59
+ * already means "start nothing on my behalf".
60
+ * 2. A version that is missing, or is not a version: nothing to compare.
61
+ * 3. ORDERED, not merely different. An older daemon is replaced and a newer
62
+ * one is left alone: two installs at two versions never converge under
63
+ * "different", each replaces the other's daemon at its next use (the
64
+ * extension learnt it with three editors on one machine, 3.1.1).
65
+ * 4. A daemon running the engine inside an editor extension's folder
66
+ * belongs to an editor window, which starts the same build again the
67
+ * moment this one stops. It changes when the editor updates.
68
+ * 5. A daemon still building or syncing its index is left to finish, since
69
+ * a restart begins the sync again; it is replaced at a later use. Only
70
+ * "healthy" is a settled state: the engine also answers "empty" and
71
+ * "degraded" before its startup sync is done.
72
+ * 6. The seat belt: one attempt per workspace in ten minutes, whatever
73
+ * kept the last one from taking. A launcher never restarts a daemon on
74
+ * every invocation.
75
+ */
76
+ export function daemonUpgradeDecision(o) {
77
+ if (o.disabled)
78
+ return { replace: false, why: "switched off" };
79
+ // isOlderVersion counts what it cannot parse as older: right for a pid
80
+ // record it must take over, wrong for a process it would restart.
81
+ const version = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
82
+ if (!o.running || !o.engine || !version.test(o.running) || !version.test(o.engine)) {
83
+ return { replace: false, why: "version unknown" };
84
+ }
85
+ if (!isOlderVersion(o.running, o.engine))
86
+ return { replace: false, why: "daemon is not older" };
87
+ if (o.exe && /vexp\.vexp-vscode-\d/i.test(o.exe))
88
+ return { replace: false, why: "started by an editor window" };
89
+ if (o.status !== "healthy")
90
+ return { replace: false, why: "index not settled" };
91
+ // Either side of now: a record from a clock that was ahead holds as well.
92
+ if (o.lastAttemptMs !== undefined && Math.abs(o.nowMs - o.lastAttemptMs) < UPGRADE_COOLDOWN_MS) {
93
+ return { replace: false, why: "tried in the last ten minutes" };
94
+ }
95
+ return { replace: true };
96
+ }
97
+ /**
98
+ * Where the attempts are remembered: vexp's own state directory, one small
99
+ * file for the machine, shared by the CLI and the MCP server so that they
100
+ * keep ONE cool-down between them. Not a file in `<workspace>/.vexp/`:
101
+ * everything there has to be named in the .gitignore the engine generates,
102
+ * and a file this side added on its own would show up in `git status`.
103
+ */
104
+ export function upgradeAttemptsPath() {
105
+ return path.join(vexpHome(), ".vexp", "daemon-upgrade.json");
106
+ }
107
+ /** The key a workspace's attempt is kept under: its resolved path, so the
108
+ * two launchers agree however each was told the folder; lowercased on
109
+ * Windows, as the daemon registry is. */
110
+ export function upgradeAttemptKey(workspace) {
111
+ let resolved = path.resolve(workspace);
112
+ try {
113
+ resolved = fs.realpathSync.native(resolved);
114
+ }
115
+ catch {
116
+ /* not there: the spelling given */
117
+ }
118
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
119
+ }
120
+ /** Workspace key -> epoch ms of the last attempt. A file that is missing,
121
+ * corrupt or of another shape reads as no attempts. */
122
+ export function readUpgradeAttempts(file = upgradeAttemptsPath()) {
123
+ const attempts = {};
124
+ try {
125
+ const raw = JSON.parse(fs.readFileSync(file, "utf-8"));
126
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
127
+ return attempts;
128
+ for (const [key, at] of Object.entries(raw)) {
129
+ if (typeof at === "number" && Number.isFinite(at))
130
+ attempts[key] = at;
131
+ }
132
+ }
133
+ catch {
134
+ /* no file yet, or not JSON */
135
+ }
136
+ return attempts;
137
+ }
138
+ /**
139
+ * Remember that a replacement is being tried for `workspace`. Entries past
140
+ * their cool-down are dropped on the way, so the file stays as small as the
141
+ * last ten minutes. Temp file and rename: a reader never sees half a file.
142
+ * Two processes writing at once can lose one entry, which costs at most one
143
+ * extra attempt. Returns false when nothing could be written: the caller
144
+ * then does not restart, because without the record nothing would stop it
145
+ * from restarting again at the next invocation.
146
+ */
147
+ export function recordUpgradeAttempt(workspace, nowMs, file = upgradeAttemptsPath()) {
148
+ try {
149
+ const kept = {};
150
+ for (const [key, at] of Object.entries(readUpgradeAttempts(file))) {
151
+ if (Math.abs(nowMs - at) < UPGRADE_COOLDOWN_MS)
152
+ kept[key] = at;
153
+ }
154
+ kept[upgradeAttemptKey(workspace)] = nowMs;
155
+ const content = JSON.stringify(kept, null, 2) + "\n";
156
+ fs.mkdirSync(path.dirname(file), { recursive: true });
157
+ const tmp = `${file}.tmp-${process.pid}-${nowMs}`;
158
+ try {
159
+ fs.writeFileSync(tmp, content, "utf-8");
160
+ fs.renameSync(tmp, file);
161
+ }
162
+ catch {
163
+ // A Windows rename refused because another process holds the target.
164
+ try {
165
+ fs.unlinkSync(tmp);
166
+ }
167
+ catch {
168
+ /* never written */
169
+ }
170
+ fs.writeFileSync(file, content, "utf-8");
171
+ }
172
+ return true;
173
+ }
174
+ catch {
175
+ return false;
176
+ }
177
+ }
178
+ /**
179
+ * `index_status` from the daemon listening on `socket`, or null when it does
180
+ * not answer in time. One JSON line each way.
181
+ *
182
+ * No session id, like the extension's version probe and doctor's: a request
183
+ * that carries one opens a row in the daemon's session map, where the
184
+ * sidebar's probe once read as an agent with 360 tool calls an hour (field
185
+ * report, 2026-09-28). A launcher asks before every command.
186
+ */
187
+ export function queryIndexStatus(socket, timeoutMs) {
188
+ return new Promise((resolve) => {
189
+ let sock;
190
+ try {
191
+ sock = net.createConnection({ path: socket });
192
+ }
193
+ catch {
194
+ resolve(null);
195
+ return;
196
+ }
197
+ let buf = "";
198
+ let settled = false;
199
+ const finish = (answer) => {
200
+ if (settled)
201
+ return;
202
+ settled = true;
203
+ clearTimeout(timer);
204
+ sock.destroy();
205
+ resolve(answer);
206
+ };
207
+ const timer = setTimeout(() => finish(null), timeoutMs);
208
+ sock.on("connect", () => {
209
+ sock.write(JSON.stringify({ id: 1, tool: "index_status", params: {} }) + "\n");
210
+ });
211
+ sock.on("data", (chunk) => {
212
+ buf += chunk.toString();
213
+ const end = buf.indexOf("\n");
214
+ if (end === -1)
215
+ return;
216
+ try {
217
+ const result = JSON.parse(buf.slice(0, end))?.result;
218
+ finish(result && typeof result === "object" && !Array.isArray(result) ? result : null);
219
+ }
220
+ catch {
221
+ finish(null);
222
+ }
223
+ });
224
+ sock.on("error", () => finish(null));
225
+ sock.on("close", () => finish(null));
226
+ });
227
+ }
228
+ /** The version in what `vexp-core --version` prints (`vexp-core 3.3.3`): its
229
+ * last word, as the extension and doctor read it. */
230
+ export function parseEngineVersion(stdout) {
231
+ const last = stdout.trim().split(/\s+/).pop();
232
+ return last ? last : undefined;
233
+ }
234
+ /**
235
+ * The folder `daemon-cmd` works on when run in `dir`: the nearest one with a
236
+ * `.git` at or above it, else `dir` itself (find_repo_root in vexp-core).
237
+ */
238
+ export function daemonCmdRoot(dir) {
239
+ let start = path.resolve(dir);
240
+ try {
241
+ start = fs.realpathSync.native(start);
242
+ }
243
+ catch {
244
+ /* not there: the spelling given */
245
+ }
246
+ let current = start;
247
+ for (;;) {
248
+ if (fs.existsSync(path.join(current, ".git")))
249
+ return current;
250
+ const parent = path.dirname(current);
251
+ if (parent === current)
252
+ return start;
253
+ current = parent;
254
+ }
255
+ }
256
+ /**
257
+ * Why `daemon-cmd restart` run in `dir` would not put a new daemon in the
258
+ * old one's place, or null when it would. A replacement must never end as a
259
+ * removal, or as a second daemon somewhere else:
260
+ *
261
+ * - the stop half reads `<dir>/.vexp/daemon.pid`; with none there it stops
262
+ * nothing, and the start half then races the daemon that is still up;
263
+ * - `daemon-cmd` works on the git root at or above its cwd, so for a
264
+ * workspace below one it would start a daemon on the folder above;
265
+ * - the engine refuses to start on the home directory, so a daemon an older
266
+ * build left there would be stopped and not come back.
267
+ */
268
+ export function whyNotRestartable(dir) {
269
+ let isDir = false;
270
+ try {
271
+ isDir = fs.statSync(dir).isDirectory();
272
+ }
273
+ catch {
274
+ /* gone */
275
+ }
276
+ if (!isDir)
277
+ return "workspace folder not found";
278
+ if (!fs.existsSync(path.join(dir, ".vexp", "daemon.pid")))
279
+ return "no pid file in the workspace";
280
+ const key = upgradeAttemptKey(dir);
281
+ if (upgradeAttemptKey(daemonCmdRoot(dir)) !== key)
282
+ return "daemon-cmd works on the git root above";
283
+ if (process.env.VEXP_ALLOW_HOME_WORKSPACE !== "1" && key === upgradeAttemptKey(vexpHome())) {
284
+ return "the home directory is not a workspace";
285
+ }
286
+ return null;
287
+ }
288
+ /**
289
+ * Ask the daemon on `socket` what it is and, when the rules above say so,
290
+ * restart it with this launcher's engine. Never throws; a daemon that does
291
+ * not answer is nobody's to replace.
292
+ *
293
+ * The daemon's own `workspace_root` names the folder to restart in, when it
294
+ * gives one: a session in a subfolder or in a connected repo is served by
295
+ * the daemon of another folder, and that is the one to replace.
296
+ *
297
+ * The attempt is recorded BEFORE the restart, so that a restart which hangs,
298
+ * fails or does not change the version is still the one attempt of its ten
299
+ * minutes.
300
+ */
301
+ export async function replaceOlderDaemon(o) {
302
+ const disabled = process.env.VEXP_NO_DAEMON_UPGRADE === "1" || process.env.VEXP_NO_AUTOSTART === "1";
303
+ if (disabled)
304
+ return { replaced: false, why: "switched off", up: false };
305
+ const text = (v) => (typeof v === "string" && v.length > 0 ? v : undefined);
306
+ const left = (why) => ({ replaced: false, why, up: true });
307
+ try {
308
+ const status = await queryIndexStatus(o.socket, UPGRADE_STATUS_TIMEOUT_MS);
309
+ if (!status)
310
+ return { replaced: false, why: "no answer", up: false };
311
+ const running = text(status.daemon_version);
312
+ if (!running)
313
+ return left("version unknown");
314
+ if (o.launcherVersion && !isOlderVersion(running, o.launcherVersion))
315
+ return left("daemon is not older");
316
+ const engine = await o.engineVersion();
317
+ const dir = text(status.workspace_root) ?? o.workspace;
318
+ const file = o.attemptsFile ?? upgradeAttemptsPath();
319
+ const nowMs = o.nowMs ?? Date.now();
320
+ const decision = daemonUpgradeDecision({
321
+ running,
322
+ engine,
323
+ exe: text(status.daemon_exe),
324
+ status: text(status.status),
325
+ lastAttemptMs: readUpgradeAttempts(file)[upgradeAttemptKey(dir)],
326
+ nowMs,
327
+ disabled,
328
+ });
329
+ if (!decision.replace)
330
+ return left(decision.why);
331
+ if (!engine)
332
+ return left("version unknown");
333
+ const unfit = whyNotRestartable(dir);
334
+ if (unfit)
335
+ return left(unfit);
336
+ if (!recordUpgradeAttempt(dir, nowMs, file))
337
+ return left("attempt could not be recorded");
338
+ try {
339
+ await o.restart(dir);
340
+ }
341
+ catch {
342
+ return { replaced: false, why: "restart failed", up: false };
343
+ }
344
+ if (o.confirm) {
345
+ // The restart ran and did not fail. One answer makes it no
346
+ // replacement: the older version again, from a daemon the stop did
347
+ // not end or that its owner started anew. A daemon too busy starting
348
+ // to answer is the new one.
349
+ const after = text((await queryIndexStatus(o.socket, UPGRADE_STATUS_TIMEOUT_MS))?.daemon_version);
350
+ if (after && isOlderVersion(after, engine))
351
+ return left("restart did not take");
352
+ }
353
+ return { replaced: true, running, engine };
354
+ }
355
+ catch {
356
+ return { replaced: false, why: "check failed", up: false };
357
+ }
358
+ }
@@ -14,6 +14,30 @@ export const INDEX_STATUS_DEFINITION = {
14
14
  required: [],
15
15
  },
16
16
  };
17
+ /**
18
+ * The seed gate's kinds as this tool prints them under the ledger, and how
19
+ * many prompts were searched and left unoriented. From index_status's
20
+ * `hook_activity`; a daemon without the gate sends none of the three keys
21
+ * (no line, zero), and a value that is not a positive number is none.
22
+ */
23
+ export function gateActivityLines(hook) {
24
+ const h = hook && typeof hook === "object" && !Array.isArray(hook) ? hook : {};
25
+ const n = (v) => (typeof v === "number" && Number.isFinite(v) && v > 0 ? v : 0);
26
+ const unanchored = n(h.abstained_unanchored);
27
+ const withheld = n(h.abstained_hintcap);
28
+ const lists = n(h.evidence_alone);
29
+ const lines = [];
30
+ if (unanchored > 0) {
31
+ lines.push(`- Not oriented: ${unanchored} typed prompt(s) were searched and nothing found passed the seed gate (nothing sent, not counted as analyzed, no orientation spent)`);
32
+ }
33
+ if (withheld > 0) {
34
+ lines.push(`- Notices withheld: ${withheld} (the one-line notice is sent once per session; not counted as analyzed)`);
35
+ }
36
+ if (lists > 0) {
37
+ lines.push(`- Of the orientation hints served, ${lists} were a definition list alone, served while the seed was switched off (ambient_seed = false or VEXP_AMBIENT_SEED=0)`);
38
+ }
39
+ return { lines, unoriented: unanchored + withheld };
40
+ }
17
41
  export async function handleIndexStatus(params, daemon) {
18
42
  IndexStatusSchema.parse(params);
19
43
  // Client-side: how THIS MCP process resolved its target (before talking to any
@@ -145,7 +169,13 @@ function formatStatusAsText(status, targeting) {
145
169
  if ((lg.measured_calls ?? 0) > 0) {
146
170
  lines.push(`- Measured: ${lg.measured_calls} tool call(s), ~${(lg.measured_tokens_saved ?? 0).toLocaleString()} tokens saved (full-read baseline minus served)`);
147
171
  }
148
- if ((lg.prompts_analyzed ?? 0) === 0 && (lg.measured_calls ?? 0) === 0) {
172
+ // The seed gate's kinds (see `gateActivityLines`). The first two are
173
+ // prompts nothing was sent for, in no number above: a window made of
174
+ // them read here as "No classified prompts", to the agent whose prompts
175
+ // had each been searched.
176
+ const gate = gateActivityLines(status.hook_activity);
177
+ lines.push(...gate.lines);
178
+ if ((lg.prompts_analyzed ?? 0) === 0 && (lg.measured_calls ?? 0) === 0 && gate.unoriented === 0) {
149
179
  lines.push("- No classified prompts or tool calls in this window.");
150
180
  }
151
181
  lines.push("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vexp-mcp",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "license": "UNLICENSED",
5
5
  "description": "vexp MCP server — AI context tools for coding agents",
6
6
  "type": "module",