@lotargo/memory_plugin 1.4.6 → 1.4.601
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.
|
@@ -22,12 +22,9 @@ export const DEFAULT_CONFIG = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
let cachedConfig = null;
|
|
25
|
+
let cachedMtimeMs = 0;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
if (cachedConfig) {
|
|
28
|
-
return cachedConfig;
|
|
29
|
-
}
|
|
30
|
-
|
|
27
|
+
function loadConfigFromDisk() {
|
|
31
28
|
ensureDirSync();
|
|
32
29
|
|
|
33
30
|
if (fs.existsSync(CONFIG_FILE)) {
|
|
@@ -35,6 +32,7 @@ export function getConfig() {
|
|
|
35
32
|
const raw = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
36
33
|
const parsed = JSON.parse(raw);
|
|
37
34
|
cachedConfig = Object.freeze({ ...DEFAULT_CONFIG, ...parsed });
|
|
35
|
+
cachedMtimeMs = fs.statSync(CONFIG_FILE).mtimeMs;
|
|
38
36
|
return cachedConfig;
|
|
39
37
|
} catch (err) {
|
|
40
38
|
console.warn("Failed to read config file, falling back to defaults:", err.message);
|
|
@@ -46,11 +44,24 @@ export function getConfig() {
|
|
|
46
44
|
return cachedConfig;
|
|
47
45
|
}
|
|
48
46
|
|
|
47
|
+
export function getConfig() {
|
|
48
|
+
try {
|
|
49
|
+
const mtimeMs = fs.statSync(CONFIG_FILE).mtimeMs;
|
|
50
|
+
if (cachedConfig && mtimeMs === cachedMtimeMs) {
|
|
51
|
+
return cachedConfig;
|
|
52
|
+
}
|
|
53
|
+
} catch (err) {
|
|
54
|
+
// Config file missing — fall through to load/create.
|
|
55
|
+
}
|
|
56
|
+
return loadConfigFromDisk();
|
|
57
|
+
}
|
|
58
|
+
|
|
49
59
|
export function saveConfig(newConfig) {
|
|
50
60
|
ensureDirSync();
|
|
51
61
|
cachedConfig = Object.freeze({ ...DEFAULT_CONFIG, ...newConfig });
|
|
52
62
|
try {
|
|
53
63
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(cachedConfig, null, 2), "utf-8");
|
|
64
|
+
cachedMtimeMs = fs.statSync(CONFIG_FILE).mtimeMs;
|
|
54
65
|
} catch (err) {
|
|
55
66
|
console.error("Failed to write config file:", err.message);
|
|
56
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotargo/memory_plugin",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.601",
|
|
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",
|