memorix 0.2.0 → 0.2.2
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/cli/index.js +29 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -493,6 +493,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
493
493
|
|
|
494
494
|
// src/server.ts
|
|
495
495
|
init_esm_shims();
|
|
496
|
+
import { watch } from "fs";
|
|
496
497
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
497
498
|
import { z } from "zod";
|
|
498
499
|
|
|
@@ -916,6 +917,9 @@ async function reindexObservations() {
|
|
|
916
917
|
return count2;
|
|
917
918
|
}
|
|
918
919
|
|
|
920
|
+
// src/server.ts
|
|
921
|
+
init_orama_store();
|
|
922
|
+
|
|
919
923
|
// src/memory/auto-relations.ts
|
|
920
924
|
init_esm_shims();
|
|
921
925
|
function inferRelationType(obs) {
|
|
@@ -2384,6 +2388,27 @@ async function createMemorixServer(cwd) {
|
|
|
2384
2388
|
}
|
|
2385
2389
|
console.error(`[memorix] Project: ${project.id} (${project.name})`);
|
|
2386
2390
|
console.error(`[memorix] Data dir: ${projectDir2}`);
|
|
2391
|
+
const observationsFile = projectDir2 + "/observations.json";
|
|
2392
|
+
let reloadDebounce = null;
|
|
2393
|
+
try {
|
|
2394
|
+
watch(observationsFile, () => {
|
|
2395
|
+
if (reloadDebounce) clearTimeout(reloadDebounce);
|
|
2396
|
+
reloadDebounce = setTimeout(async () => {
|
|
2397
|
+
try {
|
|
2398
|
+
await resetDb();
|
|
2399
|
+
await initObservations(projectDir2);
|
|
2400
|
+
const count2 = await reindexObservations();
|
|
2401
|
+
if (count2 > 0) {
|
|
2402
|
+
console.error(`[memorix] Hot-reloaded ${count2} observations (external write detected)`);
|
|
2403
|
+
}
|
|
2404
|
+
} catch {
|
|
2405
|
+
}
|
|
2406
|
+
}, 500);
|
|
2407
|
+
});
|
|
2408
|
+
console.error(`[memorix] Watching for external writes (hooks hot-reload enabled)`);
|
|
2409
|
+
} catch {
|
|
2410
|
+
console.error(`[memorix] Warning: could not watch observations file for hot-reload`);
|
|
2411
|
+
}
|
|
2387
2412
|
const server = new McpServer({
|
|
2388
2413
|
name: "memorix",
|
|
2389
2414
|
version: "0.1.0"
|