grepmax 0.26.45 → 0.26.47
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/.claude-plugin/marketplace.json +1 -1
- package/README.md +4 -0
- package/dist/commands/mcp.js +605 -556
- package/dist/lib/daemon/graph-handler.js +1 -1
- package/dist/lib/daemon/rows-handler.js +13 -9
- package/dist/lib/utils/daemon-client.js +4 -1
- package/dist/lib/utils/mcp-execution.js +67 -0
- package/dist/lib/utils/store-access.js +12 -5
- package/package.json +13 -11
- package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
|
@@ -856,5 +856,5 @@ exports.GRAPH_VERB_TIMEOUT_MS = 60000;
|
|
|
856
856
|
* project skips the daemon outright — see isDaemonReadableProject.
|
|
857
857
|
*/
|
|
858
858
|
function callGraphVerb(verb, call) {
|
|
859
|
-
return (0, store_access_1.withStoreRead)(verb, Object.assign({ skipDaemon: !isDaemonReadableProject(call.projectRoot), daemon: () => (0, daemon_client_1.sendDaemonCommand)(Object.assign(Object.assign({ cmd: verb }, encodeScope(call.projectRoot, call.scope)), call.payload), { timeoutMs: exports.GRAPH_VERB_TIMEOUT_MS }), render: call.render, inProcess: call.inProcess }, call.fallback));
|
|
859
|
+
return (0, store_access_1.withStoreRead)(verb, Object.assign({ signal: call.signal, skipDaemon: !isDaemonReadableProject(call.projectRoot), daemon: () => (0, daemon_client_1.sendDaemonCommand)(Object.assign(Object.assign({ cmd: verb }, encodeScope(call.projectRoot, call.scope)), call.payload), { timeoutMs: exports.GRAPH_VERB_TIMEOUT_MS, signal: call.signal }), render: call.render, inProcess: call.inProcess }, call.fallback));
|
|
860
860
|
}
|
|
@@ -570,7 +570,7 @@ function readRows(opts) {
|
|
|
570
570
|
return [];
|
|
571
571
|
const { sendDaemonCommand } = yield Promise.resolve().then(() => __importStar(require("../utils/daemon-client")));
|
|
572
572
|
const { withStoreRead } = yield Promise.resolve().then(() => __importStar(require("../utils/store-access")));
|
|
573
|
-
return withStoreRead(opts.name, Object.assign({ daemon: () => { var _a; return sendDaemonCommand({
|
|
573
|
+
return withStoreRead(opts.name, Object.assign({ signal: opts.signal, daemon: () => { var _a; return sendDaemonCommand({
|
|
574
574
|
cmd: "rows.locate",
|
|
575
575
|
projectRoot: opts.projectRoot,
|
|
576
576
|
scope: scopeToWire(opts.scope),
|
|
@@ -578,14 +578,18 @@ function readRows(opts) {
|
|
|
578
578
|
matches: opts.matches,
|
|
579
579
|
limit: opts.limit,
|
|
580
580
|
scoped: opts.scoped,
|
|
581
|
-
}, { timeoutMs: (_a = opts.timeoutMs) !== null && _a !== void 0 ? _a : 60000 }); }, render: (resp) => { var _a; return ((_a = resp.rows) !== null && _a !== void 0 ? _a : []); }, inProcess: () => withLocalStore(opts.lancedbDir, (deps) =>
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
581
|
+
}, { timeoutMs: (_a = opts.timeoutMs) !== null && _a !== void 0 ? _a : 60000, signal: opts.signal }); }, render: (resp) => { var _a; return ((_a = resp.rows) !== null && _a !== void 0 ? _a : []); }, inProcess: () => withLocalStore(opts.lancedbDir, (deps) => {
|
|
582
|
+
var _a;
|
|
583
|
+
(_a = opts.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
584
|
+
return runLocate(deps, {
|
|
585
|
+
projectRoot: opts.projectRoot,
|
|
586
|
+
scope: opts.scope,
|
|
587
|
+
select: opts.select,
|
|
588
|
+
matches: opts.matches,
|
|
589
|
+
limit: opts.limit,
|
|
590
|
+
scoped: opts.scoped,
|
|
591
|
+
});
|
|
592
|
+
}, opts.vectorDim) }, opts.fallback));
|
|
589
593
|
});
|
|
590
594
|
}
|
|
591
595
|
function handleRowsSkeleton(deps, payload) {
|
|
@@ -69,7 +69,10 @@ const HEARTBEAT_FRESH_THRESHOLD_MS = 150000;
|
|
|
69
69
|
*/
|
|
70
70
|
function sendDaemonCommand(cmd, opts) {
|
|
71
71
|
var _a;
|
|
72
|
-
|
|
72
|
+
var _b;
|
|
73
|
+
if ((_a = opts === null || opts === void 0 ? void 0 : opts.signal) === null || _a === void 0 ? void 0 : _a.aborted)
|
|
74
|
+
return Promise.resolve({ ok: false, error: "aborted" });
|
|
75
|
+
const timeout = (_b = opts === null || opts === void 0 ? void 0 : opts.timeoutMs) !== null && _b !== void 0 ? _b : DEFAULT_TIMEOUT_MS;
|
|
73
76
|
return new Promise((resolve) => {
|
|
74
77
|
var _a, _b;
|
|
75
78
|
let settled = false;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.withoutMcpExecution = withoutMcpExecution;
|
|
13
|
+
exports.mcpSignal = mcpSignal;
|
|
14
|
+
exports.checkMcpCancellation = checkMcpCancellation;
|
|
15
|
+
exports.mcpOperation = mcpOperation;
|
|
16
|
+
exports.withMcpExecution = withMcpExecution;
|
|
17
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
18
|
+
const executions = new node_async_hooks_1.AsyncLocalStorage();
|
|
19
|
+
/** Session background work must not retain the triggering request's signal. */
|
|
20
|
+
function withoutMcpExecution(work) {
|
|
21
|
+
return executions.exit(work);
|
|
22
|
+
}
|
|
23
|
+
function mcpSignal() {
|
|
24
|
+
var _a;
|
|
25
|
+
return (_a = executions.getStore()) === null || _a === void 0 ? void 0 : _a.request.signal;
|
|
26
|
+
}
|
|
27
|
+
/** Check between operations, never race a native query against store close. */
|
|
28
|
+
function checkMcpCancellation() {
|
|
29
|
+
var _a;
|
|
30
|
+
(_a = mcpSignal()) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
31
|
+
}
|
|
32
|
+
/** Counts started operation stages, not completion percentages. No timers. */
|
|
33
|
+
function mcpOperation(message, work) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a;
|
|
36
|
+
checkMcpCancellation();
|
|
37
|
+
const execution = executions.getStore();
|
|
38
|
+
const progressToken = (_a = execution === null || execution === void 0 ? void 0 : execution.request._meta) === null || _a === void 0 ? void 0 : _a.progressToken;
|
|
39
|
+
if (execution && progressToken !== undefined) {
|
|
40
|
+
const progress = ++execution.stages;
|
|
41
|
+
execution.notifications = execution.notifications.then(() => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (execution.request.signal.aborted)
|
|
43
|
+
return;
|
|
44
|
+
try {
|
|
45
|
+
yield execution.request.notify({
|
|
46
|
+
method: "notifications/progress",
|
|
47
|
+
params: { progressToken, progress, message },
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (_a) {
|
|
51
|
+
// Progress is advisory; a peer declining it must not break a read.
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
yield execution.notifications;
|
|
55
|
+
}
|
|
56
|
+
checkMcpCancellation();
|
|
57
|
+
const result = yield work();
|
|
58
|
+
checkMcpCancellation();
|
|
59
|
+
return result;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function withMcpExecution(request, work) {
|
|
63
|
+
// Non-protocol callers (including the catalog's unit fixtures) have no context.
|
|
64
|
+
if (!request)
|
|
65
|
+
return work();
|
|
66
|
+
return executions.run({ request, stages: 0, notifications: Promise.resolve() }, work);
|
|
67
|
+
}
|
|
@@ -271,11 +271,16 @@ function isDaemonBypassed() {
|
|
|
271
271
|
*/
|
|
272
272
|
function withStoreRead(name, opts) {
|
|
273
273
|
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
var _a;
|
|
275
|
-
var
|
|
274
|
+
var _a, _b, _c, _d;
|
|
275
|
+
var _e;
|
|
276
|
+
(_a = opts.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
276
277
|
const runInProcess = () => __awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
var _a, _b;
|
|
279
|
+
(_a = opts.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
277
280
|
try {
|
|
278
|
-
|
|
281
|
+
const result = yield opts.inProcess();
|
|
282
|
+
(_b = opts.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
|
|
283
|
+
return result;
|
|
279
284
|
}
|
|
280
285
|
catch (err) {
|
|
281
286
|
throw asStoreAccessError(err);
|
|
@@ -288,6 +293,7 @@ function withStoreRead(name, opts) {
|
|
|
288
293
|
resp = yield opts.daemon();
|
|
289
294
|
}
|
|
290
295
|
catch (err) {
|
|
296
|
+
(_b = opts.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
|
|
291
297
|
if (isStoreAccessRefused(err))
|
|
292
298
|
throw err;
|
|
293
299
|
const cls = classifyDaemonError(err === null || err === void 0 ? void 0 : err.code);
|
|
@@ -297,6 +303,7 @@ function withStoreRead(name, opts) {
|
|
|
297
303
|
throw err;
|
|
298
304
|
return runInProcess();
|
|
299
305
|
}
|
|
306
|
+
(_c = opts.signal) === null || _c === void 0 ? void 0 : _c.throwIfAborted();
|
|
300
307
|
if (resp.ok) {
|
|
301
308
|
return opts.render ? yield opts.render(resp) : resp;
|
|
302
309
|
}
|
|
@@ -308,13 +315,13 @@ function withStoreRead(name, opts) {
|
|
|
308
315
|
}
|
|
309
316
|
if (cls === "no-daemon" ||
|
|
310
317
|
(opts.fallbackOnOversize && isOversizeError(resp.error)) ||
|
|
311
|
-
((
|
|
318
|
+
((_d = opts.extraFallback) === null || _d === void 0 ? void 0 : _d.call(opts, resp.error)) === true) {
|
|
312
319
|
if (process.env.GMAX_DEBUG === "1") {
|
|
313
320
|
console.error(`[${name}] daemon path unavailable: ${resp.error}`);
|
|
314
321
|
}
|
|
315
322
|
return runInProcess();
|
|
316
323
|
}
|
|
317
|
-
throw new Error(((
|
|
324
|
+
throw new Error(((_e = opts.daemonErrorMessage) !== null && _e !== void 0 ? _e : ((r) => defaultDaemonErrorMessage(name, r)))(resp));
|
|
318
325
|
});
|
|
319
326
|
}
|
|
320
327
|
// --- Spawn guard -----------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grepmax",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.47",
|
|
4
4
|
"author": "Robert Owens <78518764+reowens@users.noreply.github.com>",
|
|
5
5
|
"homepage": "https://github.com/reowens/grepmax",
|
|
6
6
|
"bugs": {
|
|
@@ -80,7 +80,8 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@clack/prompts": "^1.8.1",
|
|
82
82
|
"@huggingface/transformers": "^4.3.0",
|
|
83
|
-
"@modelcontextprotocol/
|
|
83
|
+
"@modelcontextprotocol/server": "2.3.0",
|
|
84
|
+
"@opentelemetry/api": "^1.9.0",
|
|
84
85
|
"@parcel/watcher": "^2.6.0",
|
|
85
86
|
"apache-arrow": "^18.1.0",
|
|
86
87
|
"cli-highlight": "^2.1.11",
|
|
@@ -93,30 +94,31 @@
|
|
|
93
94
|
"openai": "^7.15.0",
|
|
94
95
|
"ora": "^9.4.1",
|
|
95
96
|
"proper-lockfile": "^4.1.2",
|
|
97
|
+
"reflect-metadata": "^0.2.2",
|
|
96
98
|
"uuid": "^14.0.2",
|
|
97
99
|
"web-tree-sitter": "^0.27.0",
|
|
98
|
-
"zod": "^4.6.5"
|
|
99
|
-
"@opentelemetry/api": "^1.9.0",
|
|
100
|
-
"reflect-metadata": "^0.2.2"
|
|
100
|
+
"zod": "^4.6.5"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@biomejs/biome": "2.5.13",
|
|
104
|
+
"@lancedb/lancedb": "0.38.0",
|
|
105
|
+
"@modelcontextprotocol/client": "2.3.0",
|
|
104
106
|
"@types/node": "^26.6.1",
|
|
105
107
|
"@types/proper-lockfile": "^4.1.4",
|
|
108
|
+
"mcp-sdk-v1-fixture": "npm:@modelcontextprotocol/sdk@1.30.0",
|
|
106
109
|
"node-gyp": "^13.0.2",
|
|
107
110
|
"tsx": "^4.23.13",
|
|
108
111
|
"typescript": "^7.0.2",
|
|
109
112
|
"vite": "^8.3.0",
|
|
110
|
-
"vitest": "^5.0.1"
|
|
111
|
-
"@lancedb/lancedb": "0.38.0"
|
|
113
|
+
"vitest": "^5.0.1"
|
|
112
114
|
},
|
|
113
115
|
"optionalDependencies": {
|
|
114
116
|
"@lancedb/lancedb-darwin-arm64": "0.38.0",
|
|
115
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.38.0",
|
|
116
117
|
"@lancedb/lancedb-linux-arm64-gnu": "0.38.0",
|
|
117
|
-
"@lancedb/lancedb-linux-x64-musl": "0.38.0",
|
|
118
118
|
"@lancedb/lancedb-linux-arm64-musl": "0.38.0",
|
|
119
|
-
"@lancedb/lancedb-
|
|
120
|
-
"@lancedb/lancedb-
|
|
119
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.38.0",
|
|
120
|
+
"@lancedb/lancedb-linux-x64-musl": "0.38.0",
|
|
121
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.38.0",
|
|
122
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.38.0"
|
|
121
123
|
}
|
|
122
124
|
}
|