@bsbofmusic/memos-memu-local-memory-tools-for-agent 1.0.2 → 1.0.4
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/bin/mcp-server.js +1 -1
- package/package.json +1 -1
- package/src/tools/install.js +6 -7
- package/src/tools/memos.js +10 -3
- package/src/tools/verify.js +26 -13
package/bin/mcp-server.js
CHANGED
|
@@ -16,7 +16,7 @@ import { memuk_search } from '../src/tools/memuk.js';
|
|
|
16
16
|
import { verify_memory_system } from '../src/tools/verify.js';
|
|
17
17
|
|
|
18
18
|
const server = new Server(
|
|
19
|
-
{ name: 'memos-memu-local-memory-tools-for-agent', version: '1.0.
|
|
19
|
+
{ name: 'memos-memu-local-memory-tools-for-agent', version: '1.0.4' },
|
|
20
20
|
{ capabilities: { tools: {} } }
|
|
21
21
|
);
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsbofmusic/memos-memu-local-memory-tools-for-agent",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "MCP server — one-shot install + query for memos (PostgreSQL) and memuK (SQLite) local memory. Designed for OpenClaw agents.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
package/src/tools/install.js
CHANGED
|
@@ -125,6 +125,8 @@ export async function install_memory_system() {
|
|
|
125
125
|
fs.mkdirSync(memukDir, { recursive: true });
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// Always initialize as a fresh SQLite DB — overwrite if exists to avoid
|
|
129
|
+
// schema corruption from partial appends.
|
|
128
130
|
const schema = `
|
|
129
131
|
CREATE TABLE IF NOT EXISTS memu_memory_items (
|
|
130
132
|
id TEXT PRIMARY KEY,
|
|
@@ -146,16 +148,13 @@ CREATE TABLE IF NOT EXISTS memu_raw_memos (
|
|
|
146
148
|
created_ts INTEGER,
|
|
147
149
|
synced_at TEXT DEFAULT (datetime('now', 'localtime'))
|
|
148
150
|
);
|
|
151
|
+
-- Initialize checkpoint with a placeholder so table is not empty
|
|
152
|
+
INSERT OR IGNORE INTO memu_sync_checkpoint (key, value) VALUES ('last_memo_id', '0');
|
|
149
153
|
`.trim();
|
|
150
154
|
|
|
151
155
|
try {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
fs.writeSync(fd, '\n' + schema + '\n');
|
|
155
|
-
fs.closeSync(fd);
|
|
156
|
-
} else {
|
|
157
|
-
fs.writeFileSync(env.memukPath, schema + '\n');
|
|
158
|
-
}
|
|
156
|
+
// Always write fresh schema — avoids partial schema from previous installs
|
|
157
|
+
fs.writeFileSync(env.memukPath, schema + '\n');
|
|
159
158
|
const testCount = sqlite('SELECT COUNT(*) FROM memu_memory_items;', env.memukPath).trim();
|
|
160
159
|
report.ok('memuK SQLite', `Schema initialized · ${testCount} memory_items`);
|
|
161
160
|
} catch (err) {
|
package/src/tools/memos.js
CHANGED
|
@@ -46,9 +46,16 @@ FROM (
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const lines = rows.map((r, i) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
// created_ts is bigint (milliseconds) — parse safely
|
|
50
|
+
let ts = 'unknown';
|
|
51
|
+
try {
|
|
52
|
+
const ms = typeof r.created_ts === 'number' ? r.created_ts : parseInt(String(r.created_ts));
|
|
53
|
+
if (ms > 1e12) {
|
|
54
|
+
ts = new Date(ms).toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' });
|
|
55
|
+
} else if (ms > 1e9) {
|
|
56
|
+
ts = new Date(ms * 1000).toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' });
|
|
57
|
+
}
|
|
58
|
+
} catch {}
|
|
52
59
|
return `─── ${i + 1}. [id:${r.id}] ${ts} (${r.visibility}) ───\n${r.content}`;
|
|
53
60
|
});
|
|
54
61
|
|
package/src/tools/verify.js
CHANGED
|
@@ -78,21 +78,34 @@ export async function verify_memory_system() {
|
|
|
78
78
|
|
|
79
79
|
// 6. MCPorter config
|
|
80
80
|
check('MCPorter config', () => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
// Check both possible locations
|
|
82
|
+
const cfgPaths = [
|
|
83
|
+
path.join(env.workspaceDir, 'mcporter.json'),
|
|
84
|
+
path.join(env.workspaceDir, 'config', 'mcporter.json'),
|
|
85
|
+
path.join(env.workspaceDir, 'workspace', 'config', 'mcporter.json'),
|
|
86
|
+
];
|
|
87
|
+
let foundPath = null;
|
|
88
|
+
let cfg = null;
|
|
89
|
+
for (const p of cfgPaths) {
|
|
90
|
+
if (fs.existsSync(p)) {
|
|
91
|
+
try {
|
|
92
|
+
cfg = JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
93
|
+
foundPath = p;
|
|
94
|
+
break;
|
|
95
|
+
} catch {}
|
|
96
|
+
}
|
|
84
97
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const hasEntry = cfg?.servers?.['memos-memu-local-memory-tools-for-agent'];
|
|
88
|
-
return {
|
|
89
|
-
component: 'MCPorter config',
|
|
90
|
-
status: hasEntry ? 'PASS' : 'FAIL',
|
|
91
|
-
detail: hasEntry ? 'MCP server entry found' : 'MCP server entry missing',
|
|
92
|
-
};
|
|
93
|
-
} catch (err) {
|
|
94
|
-
return { component: 'MCPorter config', status: 'FAIL', detail: `JSON parse error: ${err.message}` };
|
|
98
|
+
if (!foundPath || !cfg) {
|
|
99
|
+
return { component: 'MCPorter config', status: 'FAIL', detail: 'mcporter.json not found in expected paths' };
|
|
95
100
|
}
|
|
101
|
+
const hasEntry =
|
|
102
|
+
cfg?.servers?.['memos-memu-local-memory-tools-for-agent'] ||
|
|
103
|
+
cfg?.mcpServers?.['memos-memu-local-memory-tools-for-agent'];
|
|
104
|
+
return {
|
|
105
|
+
component: 'MCPorter config',
|
|
106
|
+
status: hasEntry ? 'PASS' : 'FAIL',
|
|
107
|
+
detail: hasEntry ? `Entry found in ${foundPath}` : `No MCP entry in ${foundPath}`,
|
|
108
|
+
};
|
|
96
109
|
});
|
|
97
110
|
|
|
98
111
|
// 7. Cron
|