grepmax 0.5.2 → 0.5.3
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/commands/mcp.js
CHANGED
|
@@ -522,9 +522,11 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
522
522
|
else {
|
|
523
523
|
lines.push("Callers: none");
|
|
524
524
|
}
|
|
525
|
-
// Callees
|
|
525
|
+
// Callees (cap at 15)
|
|
526
526
|
if (graph.callees.length > 0) {
|
|
527
|
-
|
|
527
|
+
const capped = graph.callees.slice(0, 15);
|
|
528
|
+
const suffix = graph.callees.length > 15 ? ` (+${graph.callees.length - 15} more)` : "";
|
|
529
|
+
lines.push(`Calls: ${capped.join(", ")}${suffix}`);
|
|
528
530
|
}
|
|
529
531
|
else {
|
|
530
532
|
lines.push("Calls: none");
|
|
@@ -591,7 +593,12 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
591
593
|
if (entries.length === 0) {
|
|
592
594
|
return ok("No symbols found. Run 'gmax index' to build the index.");
|
|
593
595
|
}
|
|
594
|
-
const lines = entries.map((e) =>
|
|
596
|
+
const lines = entries.map((e) => {
|
|
597
|
+
const rel = e.path.startsWith(projectRoot)
|
|
598
|
+
? e.path.slice(projectRoot.length + 1)
|
|
599
|
+
: e.path;
|
|
600
|
+
return `${e.symbol}\t${rel}:${e.line}`;
|
|
601
|
+
});
|
|
595
602
|
return ok(lines.join("\n"));
|
|
596
603
|
}
|
|
597
604
|
catch (e) {
|
|
@@ -602,9 +609,10 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
602
609
|
}
|
|
603
610
|
function handleIndexStatus() {
|
|
604
611
|
return __awaiter(this, void 0, void 0, function* () {
|
|
605
|
-
var _a, _b, _c
|
|
612
|
+
var _a, _b, _c;
|
|
606
613
|
try {
|
|
607
614
|
const config = (0, index_config_1.readIndexConfig)(config_1.PATHS.configPath);
|
|
615
|
+
const globalConfig = (0, index_config_1.readGlobalConfig)();
|
|
608
616
|
const projects = (0, project_registry_1.listProjects)();
|
|
609
617
|
const db = getVectorDb();
|
|
610
618
|
const stats = yield db.getStats();
|
|
@@ -625,7 +633,7 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
625
633
|
}
|
|
626
634
|
const lines = [
|
|
627
635
|
`Index: ~/.gmax/lancedb (${stats.chunks} chunks, ${fileCount} files)`,
|
|
628
|
-
`Model: ${(_b = config === null || config === void 0 ? void 0 : config.embedModel) !== null && _b !== void 0 ? _b : "unknown"} (${(_c = config === null || config === void 0 ? void 0 : config.vectorDim) !== null && _c !== void 0 ? _c : "?"}d, ${
|
|
636
|
+
`Model: ${(_b = config === null || config === void 0 ? void 0 : config.embedModel) !== null && _b !== void 0 ? _b : "unknown"} (${(_c = config === null || config === void 0 ? void 0 : config.vectorDim) !== null && _c !== void 0 ? _c : "?"}d, ${globalConfig.embedMode})`,
|
|
629
637
|
(config === null || config === void 0 ? void 0 : config.indexedAt)
|
|
630
638
|
? `Last indexed: ${config.indexedAt}`
|
|
631
639
|
: "",
|
|
@@ -96,9 +96,18 @@ def load_model():
|
|
|
96
96
|
print("[mlx-embed] Model ready on Metal GPU.")
|
|
97
97
|
|
|
98
98
|
|
|
99
|
+
async def idle_watchdog():
|
|
100
|
+
while True:
|
|
101
|
+
await asyncio.sleep(60)
|
|
102
|
+
if time.time() - last_activity > IDLE_TIMEOUT_S:
|
|
103
|
+
print("[mlx-embed] Idle timeout, shutting down")
|
|
104
|
+
os._exit(0)
|
|
105
|
+
|
|
106
|
+
|
|
99
107
|
@asynccontextmanager
|
|
100
108
|
async def lifespan(app: FastAPI):
|
|
101
109
|
load_model()
|
|
110
|
+
asyncio.create_task(idle_watchdog())
|
|
102
111
|
yield
|
|
103
112
|
|
|
104
113
|
|
|
@@ -102,9 +102,18 @@ def load_model():
|
|
|
102
102
|
print("[summarizer] Model ready on Metal GPU.")
|
|
103
103
|
|
|
104
104
|
|
|
105
|
+
async def idle_watchdog():
|
|
106
|
+
while True:
|
|
107
|
+
await asyncio.sleep(60)
|
|
108
|
+
if time.time() - last_activity > IDLE_TIMEOUT_S:
|
|
109
|
+
print("[summarizer] Idle timeout, shutting down")
|
|
110
|
+
os._exit(0)
|
|
111
|
+
|
|
112
|
+
|
|
105
113
|
@asynccontextmanager
|
|
106
114
|
async def lifespan(app: FastAPI):
|
|
107
115
|
load_model()
|
|
116
|
+
asyncio.create_task(idle_watchdog())
|
|
108
117
|
yield
|
|
109
118
|
|
|
110
119
|
|
package/package.json
CHANGED