@lotargo/memory_plugin 1.5.2 → 1.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.
|
@@ -247,7 +247,17 @@ export function registerMemoryTools(server) {
|
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
const
|
|
250
|
+
const resolveTargetKey = async (projectPath) => {
|
|
251
|
+
if (!projectPath) return null;
|
|
252
|
+
try {
|
|
253
|
+
const { resolveProjectIdentity } = await import("../identity.js");
|
|
254
|
+
const identity = await resolveProjectIdentity(projectPath);
|
|
255
|
+
if (identity) return identity.key;
|
|
256
|
+
} catch (e) {}
|
|
257
|
+
return canonicalPath(projectPath);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const target = (await resolveTargetKey(project)) ?? (await projectKey(null, null));
|
|
251
261
|
const label = project ? target : await projectName();
|
|
252
262
|
if (scope !== "project") {
|
|
253
263
|
const global = await readMemory(GLOBAL_KEY);
|
package/opencode-plugin/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const {
|
|
|
20
20
|
factBody,
|
|
21
21
|
autoGenerateTitle,
|
|
22
22
|
metaBadges,
|
|
23
|
+
isExpiredLine,
|
|
23
24
|
} = await import("../mcp-server/fact_format.js");
|
|
24
25
|
|
|
25
26
|
const {
|
|
@@ -452,7 +453,17 @@ export const MemoryPlugin = async ({ directory, worktree, client }) => {
|
|
|
452
453
|
return `${index}. ${lineText}`;
|
|
453
454
|
};
|
|
454
455
|
|
|
455
|
-
const
|
|
456
|
+
const resolveTargetKey = async (projectPath) => {
|
|
457
|
+
if (!projectPath) return null;
|
|
458
|
+
try {
|
|
459
|
+
const { resolveProjectIdentity } = await import("../mcp-server/identity.js");
|
|
460
|
+
const identity = await resolveProjectIdentity(projectPath);
|
|
461
|
+
if (identity) return identity.key;
|
|
462
|
+
} catch (e) {}
|
|
463
|
+
return canonicalPath(projectPath);
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const target = await resolveTargetKey(project) ?? await projectKey(worktree, directory);
|
|
456
467
|
const label = project ? target : await projectName(worktree, directory);
|
|
457
468
|
|
|
458
469
|
const collect = async (entries, key) => {
|
|
@@ -665,7 +676,7 @@ export const MemoryPlugin = async ({ directory, worktree, client }) => {
|
|
|
665
676
|
let rag = {};
|
|
666
677
|
try {
|
|
667
678
|
const { getDatabase } = await import("../mcp-server/db/database.js");
|
|
668
|
-
const db = getDatabase();
|
|
679
|
+
const db = await getDatabase();
|
|
669
680
|
rag.documents = db.prepare("SELECT COUNT(*) AS c FROM documents").get().c;
|
|
670
681
|
rag.sections = db.prepare("SELECT COUNT(*) AS c FROM sections").get().c;
|
|
671
682
|
rag.chunks = db.prepare("SELECT COUNT(*) AS c FROM micro_chunks").get().c;
|
|
@@ -679,7 +690,7 @@ export const MemoryPlugin = async ({ directory, worktree, client }) => {
|
|
|
679
690
|
try {
|
|
680
691
|
const { getDatabase } = await import("../mcp-server/db/database.js");
|
|
681
692
|
const { resolveProjectIdentity, listIdentities } = await import("../mcp-server/identity.js");
|
|
682
|
-
const db = getDatabase();
|
|
693
|
+
const db = await getDatabase();
|
|
683
694
|
const identity = await resolveProjectIdentity(directory || process.cwd());
|
|
684
695
|
const all = await listIdentities(db);
|
|
685
696
|
identityLines.push(
|
|
@@ -864,7 +875,7 @@ export const MemoryPlugin = async ({ directory, worktree, client }) => {
|
|
|
864
875
|
},
|
|
865
876
|
async execute({ action, docId, snapshotPath }) {
|
|
866
877
|
const { getDatabase } = await import("../mcp-server/db/database.js");
|
|
867
|
-
const db = getDatabase();
|
|
878
|
+
const db = await getDatabase();
|
|
868
879
|
|
|
869
880
|
if (action === "stats") {
|
|
870
881
|
const docCount = db.prepare("SELECT COUNT(*) as cnt FROM documents").get().cnt;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotargo/memory_plugin",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "100% local hybrid RAG memory for AI coding agents (OpenCode, Claude Code, Codex, Antigravity). MCP server + plugin: persistent user facts, document ingestion, vector + SQLite FTS5 retrieval across sessions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "opencode-plugin/index.js",
|