grepmax 0.26.30 → 0.26.33
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 -2
- package/dist/commands/context.js +12 -8
- package/dist/commands/doctor.js +7 -9
- package/dist/commands/droid.js +2 -1
- package/dist/commands/extract.js +8 -11
- package/dist/commands/impact.js +5 -8
- package/dist/commands/mcp.js +38 -41
- package/dist/commands/peek.js +6 -9
- package/dist/commands/search-output.js +10 -11
- package/dist/commands/search-run.js +5 -4
- package/dist/commands/search-skeletons.js +2 -1
- package/dist/commands/search.js +5 -4
- package/dist/commands/serve.js +2 -1
- package/dist/commands/similar.js +7 -6
- package/dist/commands/skeleton.js +17 -22
- package/dist/commands/test-find.js +5 -8
- package/dist/config.js +6 -5
- package/dist/eval-oss.js +4 -3
- package/dist/eval-tokens.js +4 -4
- package/dist/eval.js +2 -5
- package/dist/index.js +4 -3
- package/dist/lib/daemon/daemon.js +36 -29
- package/dist/lib/daemon/graph-handler.js +2 -1
- package/dist/lib/daemon/mlx-server-manager.js +10 -9
- package/dist/lib/daemon/rows-handler.js +11 -13
- package/dist/lib/daemon/search-handler.js +6 -5
- package/dist/lib/daemon/vector-handler.js +2 -1
- package/dist/lib/daemon/watcher-manager.js +4 -2
- package/dist/lib/graph/graph-builder.js +4 -10
- package/dist/lib/graph/graph-traversal.js +0 -0
- package/dist/lib/index/batch-processor.js +13 -12
- package/dist/lib/index/chunker.js +22 -23
- package/dist/lib/index/syncer.js +2 -2
- package/dist/lib/llm/investigate.js +5 -4
- package/dist/lib/llm/review.js +2 -1
- package/dist/lib/llm/tools.js +6 -5
- package/dist/lib/output/agent-search-formatter.js +3 -2
- package/dist/lib/output/compact-results.js +16 -12
- package/dist/lib/search/searcher.js +11 -13
- package/dist/lib/setup/model-loader.js +1 -1
- package/dist/lib/skeleton/body-fields.js +2 -1
- package/dist/lib/skeleton/skeletonizer.js +8 -7
- package/dist/lib/store/vector-db.js +6 -5
- package/dist/lib/utils/formatter.js +5 -4
- package/dist/lib/utils/stale-hint.js +4 -3
- package/dist/lib/utils/store-access.js +2 -1
- package/dist/lib/workers/embeddings/granite.js +2 -1
- package/dist/lib/workers/pool.js +14 -10
- package/package.json +13 -15
- package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
|
@@ -94,15 +94,12 @@ function syncIndex(projectRoot, lancedbDir) {
|
|
|
94
94
|
daemon: () => __awaiter(this, void 0, void 0, function* () {
|
|
95
95
|
var _a;
|
|
96
96
|
try {
|
|
97
|
-
const done = yield (0, daemon_client_1.sendStreamingCommand)({ cmd: "ensure-project", root: projectRoot }, (msg) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
filePath: typeof msg.filePath === "string" ? msg.filePath : "",
|
|
104
|
-
});
|
|
105
|
-
});
|
|
97
|
+
const done = yield (0, daemon_client_1.sendStreamingCommand)({ cmd: "ensure-project", root: projectRoot }, (msg) => { var _a, _b, _c; return onProgress({
|
|
98
|
+
processed: Number((_a = msg.processed) !== null && _a !== void 0 ? _a : 0),
|
|
99
|
+
total: Number((_b = msg.total) !== null && _b !== void 0 ? _b : 0),
|
|
100
|
+
indexed: Number((_c = msg.indexed) !== null && _c !== void 0 ? _c : 0),
|
|
101
|
+
filePath: typeof msg.filePath === "string" ? msg.filePath : "",
|
|
102
|
+
}); });
|
|
106
103
|
return Object.assign(Object.assign({}, done), { ok: done.ok !== false });
|
|
107
104
|
}
|
|
108
105
|
catch (err) {
|
|
@@ -156,13 +153,10 @@ function lookupSkeleton(projectRoot, lancedbDir, req) {
|
|
|
156
153
|
path: req.path,
|
|
157
154
|
symbol: req.symbol,
|
|
158
155
|
}, { timeoutMs: 30000 }),
|
|
159
|
-
render: (resp) => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
skeleton: ((_b = resp.skeleton) !== null && _b !== void 0 ? _b : null),
|
|
164
|
-
});
|
|
165
|
-
},
|
|
156
|
+
render: (resp) => { var _a, _b; return ({
|
|
157
|
+
path: ((_a = resp.path) !== null && _a !== void 0 ? _a : null),
|
|
158
|
+
skeleton: ((_b = resp.skeleton) !== null && _b !== void 0 ? _b : null),
|
|
159
|
+
}); },
|
|
166
160
|
inProcess: () => (0, rows_handler_1.withLocalStore)(lancedbDir, (deps) => (0, rows_handler_1.runSkeleton)(deps, Object.assign({ projectRoot }, req))),
|
|
167
161
|
fallbackOnUnknownVerb: true,
|
|
168
162
|
});
|
|
@@ -208,11 +202,12 @@ Examples:
|
|
|
208
202
|
gmax skeleton "auth logic" Search, skeletonize top matches
|
|
209
203
|
`)
|
|
210
204
|
.action((target, options, _cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
211
|
-
var _a
|
|
205
|
+
var _a;
|
|
206
|
+
var _b, _c, _d, _e;
|
|
212
207
|
try {
|
|
213
208
|
// Initialize
|
|
214
209
|
yield (0, setup_helpers_1.ensureSetup)();
|
|
215
|
-
const projectRoot = (
|
|
210
|
+
const projectRoot = (_b = (0, project_root_1.findProjectRoot)(process.cwd())) !== null && _b !== void 0 ? _b : process.cwd();
|
|
216
211
|
const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
|
|
217
212
|
const lancedbDir = paths.lancedbDir;
|
|
218
213
|
// Sync if requested
|
|
@@ -228,7 +223,7 @@ Examples:
|
|
|
228
223
|
// Determine mode based on target. Prefer an existing cwd-relative
|
|
229
224
|
// match so callers inside a subdirectory (or nested subrepo) can pass
|
|
230
225
|
// paths relative to where they are.
|
|
231
|
-
const resolvedTarget = (
|
|
226
|
+
const resolvedTarget = (_c = (0, path_containment_1.resolveContainedExistingPath)(projectRoot, target)) !== null && _c !== void 0 ? _c : (0, path_containment_1.resolveContainedPath)(projectRoot, target, {
|
|
232
227
|
verifyExistingTarget: true,
|
|
233
228
|
});
|
|
234
229
|
// Directory mode is unsupported. Auto-picking files from a directory
|
|
@@ -252,7 +247,7 @@ Examples:
|
|
|
252
247
|
.map((t) => t.trim())
|
|
253
248
|
.filter(Boolean);
|
|
254
249
|
for (const t of targets) {
|
|
255
|
-
const filePath = (
|
|
250
|
+
const filePath = (_d = (0, path_containment_1.resolveContainedExistingPath)(projectRoot, t)) !== null && _d !== void 0 ? _d : (0, path_containment_1.resolveContainedPath)(projectRoot, t, {
|
|
256
251
|
verifyExistingTarget: true,
|
|
257
252
|
});
|
|
258
253
|
if (!fs.existsSync(filePath)) {
|
|
@@ -267,7 +262,7 @@ Examples:
|
|
|
267
262
|
}
|
|
268
263
|
if (isFilePath(target)) {
|
|
269
264
|
// === FILE MODE ===
|
|
270
|
-
const filePath = (
|
|
265
|
+
const filePath = (_e = (0, path_containment_1.resolveContainedExistingPath)(projectRoot, target)) !== null && _e !== void 0 ? _e : (0, path_containment_1.resolveContainedPath)(projectRoot, target, {
|
|
271
266
|
verifyExistingTarget: true,
|
|
272
267
|
});
|
|
273
268
|
if (!fs.existsSync(filePath)) {
|
|
@@ -335,7 +330,7 @@ Examples:
|
|
|
335
330
|
const seenPaths = new Set();
|
|
336
331
|
const filePaths = [];
|
|
337
332
|
for (const result of searchData) {
|
|
338
|
-
const resultPath = (
|
|
333
|
+
const resultPath = (_a = result.metadata) === null || _a === void 0 ? void 0 : _a.path;
|
|
339
334
|
if (resultPath && !seenPaths.has(resultPath)) {
|
|
340
335
|
seenPaths.add(resultPath);
|
|
341
336
|
filePaths.push(resultPath);
|
|
@@ -87,14 +87,11 @@ exports.testFind = new commander_1.Command("test")
|
|
|
87
87
|
projectRoot,
|
|
88
88
|
scope,
|
|
89
89
|
payload: { target },
|
|
90
|
-
render: (resp) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
symbolFamilies: (_b = resp.symbolFamilies) !== null && _b !== void 0 ? _b : null,
|
|
96
|
-
});
|
|
97
|
-
},
|
|
90
|
+
render: (resp) => { var _a, _b; return ({
|
|
91
|
+
symbols: (_a = resp.symbols) !== null && _a !== void 0 ? _a : [],
|
|
92
|
+
resolvedAsFile: resp.resolvedAsFile === true,
|
|
93
|
+
symbolFamilies: (_b = resp.symbolFamilies) !== null && _b !== void 0 ? _b : null,
|
|
94
|
+
}); },
|
|
98
95
|
inProcess: () => (0, graph_handler_1.runGraphResolve)(localDb(), { target, projectRoot }),
|
|
99
96
|
});
|
|
100
97
|
if (symbols.length === 0) {
|
package/dist/config.js
CHANGED
|
@@ -151,11 +151,12 @@ function describeChunkerGap(indexedVersion) {
|
|
|
151
151
|
* from the global config) so this module stays free of config I/O.
|
|
152
152
|
*/
|
|
153
153
|
function describeEmbeddingGap(stored, current) {
|
|
154
|
-
var _a, _b
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const
|
|
154
|
+
var _a, _b;
|
|
155
|
+
var _c, _d, _e, _f, _g, _h;
|
|
156
|
+
const fromModel = (_c = stored.modelTier) !== null && _c !== void 0 ? _c : exports.DEFAULT_MODEL_TIER;
|
|
157
|
+
const toModel = (_d = current.modelTier) !== null && _d !== void 0 ? _d : exports.DEFAULT_MODEL_TIER;
|
|
158
|
+
const fromDim = (_f = (_e = stored.vectorDim) !== null && _e !== void 0 ? _e : (_a = exports.MODEL_TIERS[fromModel]) === null || _a === void 0 ? void 0 : _a.vectorDim) !== null && _f !== void 0 ? _f : exports.CONFIG.VECTOR_DIM;
|
|
159
|
+
const toDim = (_h = (_g = current.vectorDim) !== null && _g !== void 0 ? _g : (_b = exports.MODEL_TIERS[toModel]) === null || _b === void 0 ? void 0 : _b.vectorDim) !== null && _h !== void 0 ? _h : exports.CONFIG.VECTOR_DIM;
|
|
159
160
|
const dimChanged = fromDim !== toDim;
|
|
160
161
|
const modelChanged = fromModel !== toModel;
|
|
161
162
|
if (!dimChanged && !modelChanged)
|
package/dist/eval-oss.js
CHANGED
|
@@ -321,7 +321,8 @@ const DATASETS = {
|
|
|
321
321
|
// lodash `merge`) whose answer chunk legitimately doesn't carry the symbol in
|
|
322
322
|
// `defined_symbols`. end_line falls back to start_line + 200 when missing.
|
|
323
323
|
function chunkMatches(chunk, expectedFile, expectedLine, expectedSymbol) {
|
|
324
|
-
var _a, _b, _c
|
|
324
|
+
var _a, _b, _c;
|
|
325
|
+
var _d, _e, _f;
|
|
325
326
|
const path = String(((_a = chunk.metadata) === null || _a === void 0 ? void 0 : _a.path) || "").toLowerCase();
|
|
326
327
|
if (!path.endsWith(`/${expectedFile.toLowerCase()}`) &&
|
|
327
328
|
!path.endsWith(expectedFile.toLowerCase())) {
|
|
@@ -334,8 +335,8 @@ function chunkMatches(chunk, expectedFile, expectedLine, expectedSymbol) {
|
|
|
334
335
|
return true;
|
|
335
336
|
}
|
|
336
337
|
// (a) line-range match — chunks are 0-indexed start_line; expected line is 1-indexed
|
|
337
|
-
const start = Number((
|
|
338
|
-
const numLines = Number((_f = (
|
|
338
|
+
const start = Number((_e = (_d = (_b = chunk.generated_metadata) === null || _b === void 0 ? void 0 : _b.start_line) !== null && _d !== void 0 ? _d : chunk.start_line) !== null && _e !== void 0 ? _e : 0);
|
|
339
|
+
const numLines = Number((_f = (_c = chunk.generated_metadata) === null || _c === void 0 ? void 0 : _c.num_lines) !== null && _f !== void 0 ? _f : 0);
|
|
339
340
|
const end = numLines > 0 ? start + numLines : start + 200;
|
|
340
341
|
return expectedLine - 1 >= start && expectedLine - 1 <= end;
|
|
341
342
|
}
|
package/dist/eval-tokens.js
CHANGED
|
@@ -85,9 +85,10 @@ function aggregate(ratios) {
|
|
|
85
85
|
}
|
|
86
86
|
function run() {
|
|
87
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
var _a
|
|
88
|
+
var _a;
|
|
89
|
+
var _b, _c;
|
|
89
90
|
const root = process.cwd();
|
|
90
|
-
const projectRoot = (
|
|
91
|
+
const projectRoot = (_b = (0, project_root_1.findProjectRoot)(root)) !== null && _b !== void 0 ? _b : root;
|
|
91
92
|
const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
|
|
92
93
|
const vectorDb = new vector_db_1.VectorDB(paths.lancedbDir);
|
|
93
94
|
const searcher = new searcher_1.Searcher(vectorDb);
|
|
@@ -140,8 +141,7 @@ function run() {
|
|
|
140
141
|
try {
|
|
141
142
|
const lines = (0, node_fs_1.readFileSync)(absPath, "utf8").split("\n");
|
|
142
143
|
symbolTokens = estTokens(lines.slice(start, end + 1).join("\n"));
|
|
143
|
-
symbolLabel =
|
|
144
|
-
(_c = (_b = top.defined_symbols) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : "";
|
|
144
|
+
symbolLabel = (_c = (_a = top.defined_symbols) === null || _a === void 0 ? void 0 : _a[0]) !== null && _c !== void 0 ? _c : "";
|
|
145
145
|
}
|
|
146
146
|
catch (_e) {
|
|
147
147
|
// Top-hit file unreadable — symbol cost stays 0 (pointer-only).
|
package/dist/eval.js
CHANGED
|
@@ -435,7 +435,7 @@ exports.cases = [
|
|
|
435
435
|
{
|
|
436
436
|
query: "Where do we download models via a worker thread to avoid ONNX in main thread?",
|
|
437
437
|
expectedPath: "src/lib/setup/model-loader.ts",
|
|
438
|
-
note: "downloadModels spawns worker with
|
|
438
|
+
note: "downloadModels spawns worker with the tsx loader when dev.",
|
|
439
439
|
},
|
|
440
440
|
{
|
|
441
441
|
query: "Where do we check areModelsDownloaded before running setup?",
|
|
@@ -524,10 +524,7 @@ function evaluateCase(response, evalCase, timeMs) {
|
|
|
524
524
|
const path = ((_b = (_a = chunk.metadata) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || "";
|
|
525
525
|
return expectedPaths.some((expected) => path.includes(expected));
|
|
526
526
|
});
|
|
527
|
-
const avoidRank = response.data.findIndex((chunk) => {
|
|
528
|
-
var _a, _b, _c;
|
|
529
|
-
return (_b = (_a = chunk.metadata) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(((_c = evalCase.avoidPath) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || "_____");
|
|
530
|
-
});
|
|
527
|
+
const avoidRank = response.data.findIndex((chunk) => { var _a, _b, _c; return (_b = (_a = chunk.metadata) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(((_c = evalCase.avoidPath) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || "_____"); });
|
|
531
528
|
const hitAvoid = evalCase.avoidPath && avoidRank >= 0 && (rank === -1 || avoidRank < rank);
|
|
532
529
|
const found = rank >= 0 && !hitAvoid;
|
|
533
530
|
const rr = found ? 1 / (rank + 1) : 0;
|
package/dist/index.js
CHANGED
|
@@ -96,9 +96,10 @@ if (legacyProjectData) {
|
|
|
96
96
|
}
|
|
97
97
|
// Wire global --store to per-command --root so cross-project queries work
|
|
98
98
|
commander_1.program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
99
|
-
var _a, _b
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
var _a, _b;
|
|
100
|
+
var _c;
|
|
101
|
+
const globals = (_c = (_a = actionCommand.optsWithGlobals) === null || _a === void 0 ? void 0 : _a.call(actionCommand)) !== null && _c !== void 0 ? _c : {};
|
|
102
|
+
if (globals.store && !((_b = actionCommand.getOptionValue) === null || _b === void 0 ? void 0 : _b.call(actionCommand, "root"))) {
|
|
102
103
|
try {
|
|
103
104
|
actionCommand.setOptionValue("root", globals.store);
|
|
104
105
|
}
|
|
@@ -620,7 +620,8 @@ class Daemon {
|
|
|
620
620
|
return this.operations.status;
|
|
621
621
|
}
|
|
622
622
|
resourceGenerationId() {
|
|
623
|
-
var _a
|
|
623
|
+
var _a;
|
|
624
|
+
var _b;
|
|
624
625
|
return (_b = (_a = this.resources) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
|
|
625
626
|
}
|
|
626
627
|
hasUnfinishedRebuild() {
|
|
@@ -661,7 +662,8 @@ class Daemon {
|
|
|
661
662
|
try {
|
|
662
663
|
yield this.withProjectLock(root, ac.signal, () => __awaiter(this, void 0, void 0, function* () {
|
|
663
664
|
return this.runSharedOperation("index-pending", ac.signal, (operationSignal) => __awaiter(this, void 0, void 0, function* () {
|
|
664
|
-
var _a, _b
|
|
665
|
+
var _a, _b;
|
|
666
|
+
var _c, _d;
|
|
665
667
|
// Bail if shutdown raced ahead of us between iteration and lock
|
|
666
668
|
// acquisition. Starting now would race the store close below.
|
|
667
669
|
if (this.shuttingDown)
|
|
@@ -683,9 +685,9 @@ class Daemon {
|
|
|
683
685
|
vectorDb: this.vectorDb,
|
|
684
686
|
metaCache: this.metaCache,
|
|
685
687
|
signal: operationSignal,
|
|
686
|
-
generation: (
|
|
687
|
-
embedMode: (
|
|
688
|
-
workerPool: (
|
|
688
|
+
generation: (_c = this.activeGeneration) !== null && _c !== void 0 ? _c : undefined,
|
|
689
|
+
embedMode: (_a = this.activeConfig) === null || _a === void 0 ? void 0 : _a.embedMode,
|
|
690
|
+
workerPool: (_d = this.workerPool) !== null && _d !== void 0 ? _d : undefined,
|
|
689
691
|
onProgress: () => {
|
|
690
692
|
this.resetActivity();
|
|
691
693
|
},
|
|
@@ -724,7 +726,7 @@ class Daemon {
|
|
|
724
726
|
}
|
|
725
727
|
}
|
|
726
728
|
finally {
|
|
727
|
-
(
|
|
729
|
+
(_b = this.vectorDb) === null || _b === void 0 ? void 0 : _b.resumeMaintenanceLoop();
|
|
728
730
|
if (!this.shuttingDown) {
|
|
729
731
|
try {
|
|
730
732
|
yield this.watchProjectWithinOperation(root);
|
|
@@ -765,12 +767,13 @@ class Daemon {
|
|
|
765
767
|
* on every search to annotate partial-result responses (Phase 6).
|
|
766
768
|
*/
|
|
767
769
|
indexState(root) {
|
|
768
|
-
var _a
|
|
770
|
+
var _a;
|
|
771
|
+
var _b, _c, _d;
|
|
769
772
|
const processor = this.processors.get(root);
|
|
770
|
-
const batchPending = (
|
|
771
|
-
const processing = (
|
|
773
|
+
const batchPending = (_b = processor === null || processor === void 0 ? void 0 : processor.progress.pendingFiles) !== null && _b !== void 0 ? _b : 0;
|
|
774
|
+
const processing = (_c = processor === null || processor === void 0 ? void 0 : processor.progress.processing) !== null && _c !== void 0 ? _c : false;
|
|
772
775
|
// status === "pending" means the initial full index hasn't completed.
|
|
773
|
-
const initialPending = ((
|
|
776
|
+
const initialPending = ((_a = (0, project_registry_1.getProject)(root)) === null || _a === void 0 ? void 0 : _a.status) === "pending";
|
|
774
777
|
// A full index (--reset / initial) bypasses the batch processor; its
|
|
775
778
|
// onProgress feeds indexProgress, giving a real remaining count.
|
|
776
779
|
const fullIdx = this.indexProgress.get(root);
|
|
@@ -846,7 +849,8 @@ class Daemon {
|
|
|
846
849
|
return this.ready;
|
|
847
850
|
}
|
|
848
851
|
getDiskPressure() {
|
|
849
|
-
var _a
|
|
852
|
+
var _a;
|
|
853
|
+
var _b;
|
|
850
854
|
return (_b = (_a = this.vectorDb) === null || _a === void 0 ? void 0 : _a.diskPressure) !== null && _b !== void 0 ? _b : "unknown";
|
|
851
855
|
}
|
|
852
856
|
getMlxStatus() {
|
|
@@ -967,7 +971,8 @@ class Daemon {
|
|
|
967
971
|
}
|
|
968
972
|
addProjectLocked(root, conn, signal, previousProject) {
|
|
969
973
|
return __awaiter(this, void 0, void 0, function* () {
|
|
970
|
-
var _a
|
|
974
|
+
var _a;
|
|
975
|
+
var _b, _c, _d;
|
|
971
976
|
if (!this.vectorDb || !this.metaCache || !this.activeConfig) {
|
|
972
977
|
(0, ipc_handler_1.writeDone)(conn, { ok: false, error: "daemon resources not ready" });
|
|
973
978
|
return;
|
|
@@ -996,9 +1001,9 @@ class Daemon {
|
|
|
996
1001
|
vectorDb: this.vectorDb,
|
|
997
1002
|
metaCache: this.metaCache,
|
|
998
1003
|
signal,
|
|
999
|
-
generation: (
|
|
1004
|
+
generation: (_b = this.activeGeneration) !== null && _b !== void 0 ? _b : undefined,
|
|
1000
1005
|
embedMode: this.activeConfig.embedMode,
|
|
1001
|
-
workerPool: (
|
|
1006
|
+
workerPool: (_c = this.workerPool) !== null && _c !== void 0 ? _c : undefined,
|
|
1002
1007
|
onProgress: (info) => {
|
|
1003
1008
|
this.resetActivity();
|
|
1004
1009
|
const now = Date.now();
|
|
@@ -1030,7 +1035,7 @@ class Daemon {
|
|
|
1030
1035
|
this.clearPendingIndexRetry(root);
|
|
1031
1036
|
(0, project_registry_1.stampProjectFullSync)({
|
|
1032
1037
|
root,
|
|
1033
|
-
name: (
|
|
1038
|
+
name: (_d = project === null || project === void 0 ? void 0 : project.name) !== null && _d !== void 0 ? _d : path.basename(root),
|
|
1034
1039
|
generation: result.generation,
|
|
1035
1040
|
embedMode: result.embedMode,
|
|
1036
1041
|
chunkCount,
|
|
@@ -1069,7 +1074,7 @@ class Daemon {
|
|
|
1069
1074
|
}
|
|
1070
1075
|
finally {
|
|
1071
1076
|
stopHeartbeat();
|
|
1072
|
-
(
|
|
1077
|
+
(_a = this.vectorDb) === null || _a === void 0 ? void 0 : _a.resumeMaintenanceLoop();
|
|
1073
1078
|
}
|
|
1074
1079
|
});
|
|
1075
1080
|
}
|
|
@@ -1115,7 +1120,8 @@ class Daemon {
|
|
|
1115
1120
|
*/
|
|
1116
1121
|
reindexOneProject(root, opts, signal, onProgress) {
|
|
1117
1122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1118
|
-
var _a
|
|
1123
|
+
var _a;
|
|
1124
|
+
var _b, _c;
|
|
1119
1125
|
if (!this.vectorDb || !this.metaCache) {
|
|
1120
1126
|
throw new Error("daemon resources not ready");
|
|
1121
1127
|
}
|
|
@@ -1133,8 +1139,8 @@ class Daemon {
|
|
|
1133
1139
|
vectorDb: this.vectorDb,
|
|
1134
1140
|
metaCache: this.metaCache,
|
|
1135
1141
|
signal,
|
|
1136
|
-
generation: (
|
|
1137
|
-
embedMode: (
|
|
1142
|
+
generation: (_b = this.activeGeneration) !== null && _b !== void 0 ? _b : undefined,
|
|
1143
|
+
embedMode: (_a = this.activeConfig) === null || _a === void 0 ? void 0 : _a.embedMode,
|
|
1138
1144
|
workerPool: (_c = this.workerPool) !== null && _c !== void 0 ? _c : undefined,
|
|
1139
1145
|
onProgress: (info) => {
|
|
1140
1146
|
this.resetActivity();
|
|
@@ -1168,7 +1174,8 @@ class Daemon {
|
|
|
1168
1174
|
this.shutdownAbortControllers.add(ac);
|
|
1169
1175
|
try {
|
|
1170
1176
|
yield this.withProjectLock(root, ac.signal, () => this.runSharedOperation("index-project", ac.signal, (operationSignal) => __awaiter(this, void 0, void 0, function* () {
|
|
1171
|
-
var _a
|
|
1177
|
+
var _a;
|
|
1178
|
+
var _b;
|
|
1172
1179
|
if (!this.vectorDb || !this.metaCache) {
|
|
1173
1180
|
(0, ipc_handler_1.writeDone)(conn, {
|
|
1174
1181
|
ok: false,
|
|
@@ -1203,7 +1210,7 @@ class Daemon {
|
|
|
1203
1210
|
chunkCount,
|
|
1204
1211
|
chunkerVersion: opts.reset
|
|
1205
1212
|
? config_1.CONFIG.CHUNKER_VERSION
|
|
1206
|
-
: ((
|
|
1213
|
+
: ((_b = project === null || project === void 0 ? void 0 : project.chunkerVersion) !== null && _b !== void 0 ? _b : 1),
|
|
1207
1214
|
expectedFingerprint: result.registryExpectation.embeddingFingerprint,
|
|
1208
1215
|
expectedRebuildId: result.registryExpectation.rebuildId,
|
|
1209
1216
|
});
|
|
@@ -1226,7 +1233,7 @@ class Daemon {
|
|
|
1226
1233
|
}
|
|
1227
1234
|
finally {
|
|
1228
1235
|
stopHeartbeat();
|
|
1229
|
-
(
|
|
1236
|
+
(_a = this.vectorDb) === null || _a === void 0 ? void 0 : _a.resumeMaintenanceLoop();
|
|
1230
1237
|
}
|
|
1231
1238
|
})));
|
|
1232
1239
|
}
|
|
@@ -1466,9 +1473,9 @@ class Daemon {
|
|
|
1466
1473
|
this.ready = false;
|
|
1467
1474
|
this.resources = null;
|
|
1468
1475
|
let recoveryError;
|
|
1469
|
-
yield
|
|
1476
|
+
yield targetPool === null || targetPool === void 0 ? void 0 : targetPool.destroy({ requireExit: true }).catch((cause) => {
|
|
1470
1477
|
recoveryError !== null && recoveryError !== void 0 ? recoveryError : (recoveryError = cause);
|
|
1471
|
-
})
|
|
1478
|
+
});
|
|
1472
1479
|
if (targetDb) {
|
|
1473
1480
|
yield targetDb
|
|
1474
1481
|
.close({ releaseLease: false, requireClosed: true })
|
|
@@ -1516,7 +1523,7 @@ class Daemon {
|
|
|
1516
1523
|
}
|
|
1517
1524
|
catch (cause) {
|
|
1518
1525
|
recoveryError = cause;
|
|
1519
|
-
yield
|
|
1526
|
+
yield restoredPool === null || restoredPool === void 0 ? void 0 : restoredPool.destroy({ requireExit: true }).catch(() => { });
|
|
1520
1527
|
if (restoredDb) {
|
|
1521
1528
|
yield restoredDb.close().catch(() => { });
|
|
1522
1529
|
}
|
|
@@ -2018,7 +2025,7 @@ class Daemon {
|
|
|
2018
2025
|
yield this.drainOperationsBounded(operationDrain, projectDrain);
|
|
2019
2026
|
// Stop LLM server if running
|
|
2020
2027
|
try {
|
|
2021
|
-
yield (
|
|
2028
|
+
yield (_b = this.llmServer) === null || _b === void 0 ? void 0 : _b.stop();
|
|
2022
2029
|
}
|
|
2023
2030
|
catch (_j) { }
|
|
2024
2031
|
// Destroy worker pool to prevent orphaned child processes
|
|
@@ -2053,15 +2060,15 @@ class Daemon {
|
|
|
2053
2060
|
this.processors.clear();
|
|
2054
2061
|
// Close shared resources
|
|
2055
2062
|
try {
|
|
2056
|
-
yield (
|
|
2063
|
+
yield (_c = this.metaCache) === null || _c === void 0 ? void 0 : _c.close();
|
|
2057
2064
|
}
|
|
2058
2065
|
catch (_m) { }
|
|
2059
2066
|
if (strictResourceShutdown) {
|
|
2060
|
-
yield (
|
|
2067
|
+
yield (_d = this.vectorDb) === null || _d === void 0 ? void 0 : _d.close({ requireClosed: true });
|
|
2061
2068
|
}
|
|
2062
2069
|
else {
|
|
2063
2070
|
try {
|
|
2064
|
-
yield (
|
|
2071
|
+
yield (_e = this.vectorDb) === null || _e === void 0 ? void 0 : _e.close();
|
|
2065
2072
|
}
|
|
2066
2073
|
catch (_o) { }
|
|
2067
2074
|
}
|
|
@@ -536,7 +536,8 @@ function findFileCycles(deps, prefix, top) {
|
|
|
536
536
|
* `top` caps each list; `deadTotal` reports the full pre-cap dead count.
|
|
537
537
|
*/
|
|
538
538
|
function computeAudit(rows, prefix, top) {
|
|
539
|
-
var _a
|
|
539
|
+
var _a;
|
|
540
|
+
var _b;
|
|
540
541
|
// First definition of a symbol wins (matches GraphBuilder semantics).
|
|
541
542
|
const defs = new Map();
|
|
542
543
|
// Distinct files defining each name — name-based edges can't tell same-name
|
|
@@ -72,7 +72,8 @@ class MlxServerManager {
|
|
|
72
72
|
return !this.enabled || this.deps.getShuttingDown();
|
|
73
73
|
}
|
|
74
74
|
sleep(ms) {
|
|
75
|
-
var _a, _b
|
|
75
|
+
var _a, _b;
|
|
76
|
+
var _c;
|
|
76
77
|
return ((_c = (_b = (_a = this.deps).sleep) === null || _b === void 0 ? void 0 : _b.call(_a, ms)) !== null && _c !== void 0 ? _c : new Promise((resolve) => setTimeout(resolve, ms)));
|
|
77
78
|
}
|
|
78
79
|
probeHealth(port) {
|
|
@@ -202,7 +203,8 @@ class MlxServerManager {
|
|
|
202
203
|
}
|
|
203
204
|
ensureInternal(model) {
|
|
204
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
-
var _a, _b, _c
|
|
206
|
+
var _a, _b, _c;
|
|
207
|
+
var _d, _e, _f, _g, _h;
|
|
206
208
|
this.phase = "probing";
|
|
207
209
|
const health = yield this.probeHealth(this.port);
|
|
208
210
|
if (this.shouldStop())
|
|
@@ -254,15 +256,15 @@ class MlxServerManager {
|
|
|
254
256
|
console.warn("[daemon] MLX embed server not found — falling back to CPU embeddings");
|
|
255
257
|
return;
|
|
256
258
|
}
|
|
257
|
-
const owner = (
|
|
258
|
-
const openLog = (
|
|
259
|
-
const closeFd = (
|
|
259
|
+
const owner = (_d = (_b = (_a = this.deps).createOwnerToken) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _d !== void 0 ? _d : (0, node_crypto_1.randomUUID)();
|
|
260
|
+
const openLog = (_e = this.deps.openLog) !== null && _e !== void 0 ? _e : log_rotate_1.openRotatedLog;
|
|
261
|
+
const closeFd = (_f = this.deps.closeFd) !== null && _f !== void 0 ? _f : fs.closeSync;
|
|
260
262
|
const logFd = openLog(path.join(config_1.PATHS.logsDir, "mlx-embed-server.log"));
|
|
261
263
|
const env = Object.assign(Object.assign({}, process.env), { MLX_EMBED_MODEL: model, GMAX_EMBED_OWNER_TOKEN: owner, HF_HOME: (0, mlx_hf_cache_1.resolveMlxHfHome)(model) });
|
|
262
264
|
this.phase = "starting";
|
|
263
265
|
let child;
|
|
264
266
|
try {
|
|
265
|
-
child = ((
|
|
267
|
+
child = ((_g = this.deps.spawn) !== null && _g !== void 0 ? _g : node_child_process_1.spawn)("uv", ["run", "python", "server.py"], {
|
|
266
268
|
cwd: serverDir,
|
|
267
269
|
detached: true,
|
|
268
270
|
stdio: ["ignore", logFd, logFd],
|
|
@@ -338,8 +340,7 @@ class MlxServerManager {
|
|
|
338
340
|
child.off("error", onError);
|
|
339
341
|
child.off("exit", onExit);
|
|
340
342
|
yield this.terminateOwned(candidate);
|
|
341
|
-
this.lastError =
|
|
342
|
-
(_h = (_g = startup.error) === null || _g === void 0 ? void 0 : _g.message) !== null && _h !== void 0 ? _h : (this.shouldStop() ? "MLX startup cancelled" : "MLX startup timed out");
|
|
343
|
+
this.lastError = (_h = (_c = startup.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _h !== void 0 ? _h : (this.shouldStop() ? "MLX startup cancelled" : "MLX startup timed out");
|
|
343
344
|
if (!this.shouldStop()) {
|
|
344
345
|
this.phase = "failed";
|
|
345
346
|
console.error(`[daemon] ${this.lastError} — falling back to CPU embeddings`);
|
|
@@ -353,7 +354,7 @@ class MlxServerManager {
|
|
|
353
354
|
return this.stopFlight;
|
|
354
355
|
const flight = (() => __awaiter(this, void 0, void 0, function* () {
|
|
355
356
|
var _a;
|
|
356
|
-
yield (
|
|
357
|
+
yield (_a = this.ensureFlight) === null || _a === void 0 ? void 0 : _a.catch(() => { });
|
|
357
358
|
if (this.stable.kind === "owned") {
|
|
358
359
|
const owned = this.stable;
|
|
359
360
|
yield this.terminateOwned(owned);
|
|
@@ -555,7 +555,8 @@ function handleRowsLocate(deps, payload) {
|
|
|
555
555
|
*/
|
|
556
556
|
function runSkeleton(deps, req) {
|
|
557
557
|
return __awaiter(this, void 0, void 0, function* () {
|
|
558
|
-
var _a
|
|
558
|
+
var _a;
|
|
559
|
+
var _b;
|
|
559
560
|
if (!deps.vectorDb)
|
|
560
561
|
throw new ReadVerbError("daemon not ready");
|
|
561
562
|
(_a = deps.touchActivity) === null || _a === void 0 ? void 0 : _a.call(deps);
|
|
@@ -607,18 +608,15 @@ function readRows(opts) {
|
|
|
607
608
|
return [];
|
|
608
609
|
const { sendDaemonCommand } = yield Promise.resolve().then(() => __importStar(require("../utils/daemon-client")));
|
|
609
610
|
const { withStoreRead } = yield Promise.resolve().then(() => __importStar(require("../utils/store-access")));
|
|
610
|
-
return withStoreRead(opts.name, Object.assign({ daemon: () => {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
scoped: opts.scoped,
|
|
620
|
-
}, { timeoutMs: (_a = opts.timeoutMs) !== null && _a !== void 0 ? _a : 60000 });
|
|
621
|
-
}, render: (resp) => { var _a; return ((_a = resp.rows) !== null && _a !== void 0 ? _a : []); }, inProcess: () => withLocalStore(opts.lancedbDir, (deps) => runLocate(deps, {
|
|
611
|
+
return withStoreRead(opts.name, Object.assign({ daemon: () => { var _a; return sendDaemonCommand({
|
|
612
|
+
cmd: "rows.locate",
|
|
613
|
+
projectRoot: opts.projectRoot,
|
|
614
|
+
scope: scopeToWire(opts.scope),
|
|
615
|
+
select: opts.select,
|
|
616
|
+
matches: opts.matches,
|
|
617
|
+
limit: opts.limit,
|
|
618
|
+
scoped: opts.scoped,
|
|
619
|
+
}, { 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) => runLocate(deps, {
|
|
622
620
|
projectRoot: opts.projectRoot,
|
|
623
621
|
scope: opts.scope,
|
|
624
622
|
select: opts.select,
|
|
@@ -54,13 +54,14 @@ const project_registry_1 = require("../utils/project-registry");
|
|
|
54
54
|
*/
|
|
55
55
|
function handleDaemonSearch(deps, payload, signal) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
var _a, _b, _c, _d
|
|
57
|
+
var _a, _b, _c, _d;
|
|
58
|
+
var _e, _f;
|
|
58
59
|
const { vectorDb, workerPool } = deps;
|
|
59
60
|
if (!vectorDb || !workerPool) {
|
|
60
61
|
return { ok: false, error: "daemon not ready" };
|
|
61
62
|
}
|
|
62
63
|
const root = payload.projectRoot;
|
|
63
|
-
const roots = (
|
|
64
|
+
const roots = (_e = (_a = payload.filters) === null || _a === void 0 ? void 0 : _a.projectRoots) !== null && _e !== void 0 ? _e : [root];
|
|
64
65
|
for (const candidateRoot of roots) {
|
|
65
66
|
const project = (0, project_registry_1.getProject)(candidateRoot);
|
|
66
67
|
if ((project === null || project === void 0 ? void 0 : project.status) === "indexed" &&
|
|
@@ -80,7 +81,7 @@ function handleDaemonSearch(deps, payload, signal) {
|
|
|
80
81
|
// An indexed project nobody holds a watch lease on is served from its
|
|
81
82
|
// last-synced vectors — watching is per session now, not a precondition
|
|
82
83
|
// for reading. Only unknown, never-indexed roots get "not watched".
|
|
83
|
-
const status = (
|
|
84
|
+
const status = (_b = (0, project_registry_1.getProject)(root)) === null || _b === void 0 ? void 0 : _b.status;
|
|
84
85
|
const indexingNow = deps.indexProgress.has(root) || status === "pending";
|
|
85
86
|
if (!indexingNow && status !== "indexed") {
|
|
86
87
|
return {
|
|
@@ -112,7 +113,7 @@ function handleDaemonSearch(deps, payload, signal) {
|
|
|
112
113
|
return { ok: false, error: "search_failed", hint: msg };
|
|
113
114
|
}
|
|
114
115
|
const response = { ok: true, data: result.data };
|
|
115
|
-
if ((
|
|
116
|
+
if ((_c = result.warnings) === null || _c === void 0 ? void 0 : _c.length)
|
|
116
117
|
response.warnings = result.warnings;
|
|
117
118
|
// Annotate partial results when the index is still catching up, so an
|
|
118
119
|
// agent can caveat or retry. Only attached when actually indexing (the
|
|
@@ -130,7 +131,7 @@ function handleDaemonSearch(deps, payload, signal) {
|
|
|
130
131
|
const seen = new Set();
|
|
131
132
|
const skeletons = {};
|
|
132
133
|
for (const chunk of result.data) {
|
|
133
|
-
const p = (
|
|
134
|
+
const p = (_f = chunk.path) !== null && _f !== void 0 ? _f : (_d = chunk.metadata) === null || _d === void 0 ? void 0 : _d.path;
|
|
134
135
|
if (!p || seen.has(p))
|
|
135
136
|
continue;
|
|
136
137
|
seen.add(p);
|
|
@@ -41,7 +41,8 @@ const read_verbs_1 = require("./read-verbs");
|
|
|
41
41
|
const rows_handler_1 = require("./rows-handler");
|
|
42
42
|
function runSimilar(deps, req) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
var _a
|
|
44
|
+
var _a;
|
|
45
|
+
var _b;
|
|
45
46
|
if (!deps.vectorDb)
|
|
46
47
|
throw new rows_handler_1.ReadVerbError("daemon not ready");
|
|
47
48
|
(_a = deps.touchActivity) === null || _a === void 0 ? void 0 : _a.call(deps);
|
|
@@ -248,7 +248,8 @@ class WatcherManager {
|
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
isRootDegraded(root) {
|
|
251
|
-
var _a
|
|
251
|
+
var _a;
|
|
252
|
+
var _b;
|
|
252
253
|
return (this.degradedRoots.has(root) ||
|
|
253
254
|
((_b = (_a = this.terminalFailures.get(root)) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0) > 0);
|
|
254
255
|
}
|
|
@@ -487,7 +488,8 @@ class WatcherManager {
|
|
|
487
488
|
catchupScan(root, processor, signal) {
|
|
488
489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
489
490
|
var _a, e_1, _b, _c;
|
|
490
|
-
var _d
|
|
491
|
+
var _d;
|
|
492
|
+
var _e;
|
|
491
493
|
const { isFileCached } = yield Promise.resolve().then(() => __importStar(require("../utils/cache-check")));
|
|
492
494
|
const metaCache = this.deps.getMetaCache();
|
|
493
495
|
const vectorDb = this.deps.getVectorDb();
|