@bsbofmusic/memos-memu-local-memory-tools-for-agent 1.0.4 → 1.1.0

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 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.4' },
19
+ { name: 'memos-memu-local-memory-tools-for-agent', version: '1.0.5' },
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.4",
3
+ "version": "1.1.0",
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/shared/db.js CHANGED
@@ -44,7 +44,7 @@ export function sqlite(sql, dbPath) {
44
44
  const safeSql = sql.replace(/"/g, '""');
45
45
  try {
46
46
  const out = execSync(
47
- `/usr/bin/sqlite3 "${db}" "${safeSql}"`,
47
+ `/usr/bin/sqlite3 -json "${db}" "${safeSql}"`,
48
48
  { timeout: 10000 }
49
49
  ).toString();
50
50
  return out;
@@ -92,16 +92,12 @@ export function dockerContainerRunning(name) {
92
92
  }
93
93
 
94
94
  export function parseSqlite(output) {
95
- const lines = output.split('\n').filter(l => l.trim() && !l.startsWith('--'));
96
- return lines.map(line => {
97
- const pipe = line.split('|');
98
- return {
99
- id: pipe[0]?.trim() ?? '',
100
- summary: pipe[1]?.trim() ?? '',
101
- memory_type: pipe[2]?.trim() ?? '',
102
- happened_at: pipe[3]?.trim() ?? '',
103
- };
104
- });
95
+ try {
96
+ const rows = JSON.parse(output.trim());
97
+ return Array.isArray(rows) ? rows : [];
98
+ } catch {
99
+ return [];
100
+ }
105
101
  }
106
102
 
107
103
  export function parsePsqlJson(output) {
@@ -37,7 +37,11 @@ FROM (
37
37
  };
38
38
  }
39
39
 
40
- const rows = parsePsqlJson(raw);
40
+ let rows = parsePsqlJson(raw);
41
+
42
+ // Defensive slice: enforce limit cap at application level
43
+ if (!Array.isArray(rows)) rows = [];
44
+ if (rows.length > lim) rows = rows.slice(0, lim);
41
45
 
42
46
  if (!rows.length) {
43
47
  return {
@@ -36,6 +36,10 @@ LIMIT ${lim};`.trim();
36
36
  };
37
37
  }
38
38
 
39
+ // Defensive slice: enforce limit cap at application level
40
+ if (!Array.isArray(rows)) rows = [];
41
+ if (rows.length > lim) rows = rows.slice(0, lim);
42
+
39
43
  if (!rows.length) {
40
44
  return {
41
45
  content: [{ type: 'text', text: `✅ memuK search "${query}" returned 0 results.` }],
@@ -43,7 +47,7 @@ LIMIT ${lim};`.trim();
43
47
  }
44
48
 
45
49
  const lines = rows.map(
46
- (r, i) => `─── ${i + 1}. [${r.memory_type}] ${r.happened_at || 'n/a'} ───\n${r.summary}`
50
+ (r, i) => `─── ${i + 1}. [${r.memory_type || 'imported'}] ${r.happened_at || 'n/a'} ───\n${r.summary || ''}`
47
51
  );
48
52
 
49
53
  return {