@hir4ta/memoria 0.15.0 → 0.15.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "memoria",
3
3
  "description": "A plugin that provides long-term memory for Claude Code. It automatically saves context lost during auto-compact, offering features for session restoration, recording technical decisions, and learning developer patterns.",
4
- "version": "0.15.0",
4
+ "version": "0.15.1",
5
5
  "author": {
6
6
  "name": "hir4ta"
7
7
  },
package/dist/lib/db.js CHANGED
@@ -5,11 +5,14 @@ import { homedir } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  var originalEmit = process.emit;
8
- process.emit = (name, data, ...args) => {
9
- if (name === "warning" && typeof data === "object" && data?.name === "ExperimentalWarning" && data?.message?.includes("SQLite")) {
8
+ process.emit = (event, ...args) => {
9
+ if (event === "warning" && typeof args[0] === "object" && args[0] !== null && "name" in args[0] && args[0].name === "ExperimentalWarning" && "message" in args[0] && typeof args[0].message === "string" && args[0].message.includes("SQLite")) {
10
10
  return false;
11
11
  }
12
- return originalEmit.call(process, name, data, ...args);
12
+ return originalEmit.apply(
13
+ process,
14
+ [event, ...args]
15
+ );
13
16
  };
14
17
  var { DatabaseSync } = await import("node:sqlite");
15
18
  var __filename = fileURLToPath(import.meta.url);
@@ -35,9 +38,6 @@ function getGlobalDbDir() {
35
38
  function getGlobalDbPath() {
36
39
  return join(getGlobalDbDir(), "global.db");
37
40
  }
38
- function getDbPath(memoriaDir) {
39
- return join(memoriaDir, "local.db");
40
- }
41
41
  function configurePragmas(db) {
42
42
  db.exec("PRAGMA journal_mode = WAL");
43
43
  db.exec("PRAGMA busy_timeout = 5000");
@@ -58,17 +58,6 @@ function initGlobalDatabase() {
58
58
  }
59
59
  return db;
60
60
  }
61
- function initDatabase(memoriaDir) {
62
- const dbPath = getDbPath(memoriaDir);
63
- const db = new DatabaseSync(dbPath);
64
- configurePragmas(db);
65
- const schemaPath = join(__dirname, "schema.sql");
66
- if (existsSync(schemaPath)) {
67
- const schema = readFileSync(schemaPath, "utf-8");
68
- db.exec(schema);
69
- }
70
- return db;
71
- }
72
61
  function openGlobalDatabase() {
73
62
  const dbPath = getGlobalDbPath();
74
63
  if (!existsSync(dbPath)) {
@@ -78,15 +67,6 @@ function openGlobalDatabase() {
78
67
  configurePragmas(db);
79
68
  return db;
80
69
  }
81
- function openDatabase(memoriaDir) {
82
- const dbPath = getDbPath(memoriaDir);
83
- if (!existsSync(dbPath)) {
84
- return null;
85
- }
86
- const db = new DatabaseSync(dbPath);
87
- configurePragmas(db);
88
- return db;
89
- }
90
70
  function getRepositoryInfo(projectPath) {
91
71
  const result = {
92
72
  repository: null,
@@ -300,19 +280,19 @@ function getUniqueRepositories(db) {
300
280
  function deleteInteractionsByProject(db, projectPath) {
301
281
  const stmt = db.prepare("DELETE FROM interactions WHERE project_path = ?");
302
282
  const result = stmt.run(projectPath);
303
- return result.changes;
283
+ return Number(result.changes);
304
284
  }
305
285
  function deleteInteractionsBefore(db, beforeDate) {
306
286
  const stmt = db.prepare("DELETE FROM interactions WHERE timestamp < ?");
307
287
  const result = stmt.run(beforeDate);
308
- return result.changes;
288
+ return Number(result.changes);
309
289
  }
310
290
  function deleteBackupsByProject(db, projectPath) {
311
291
  const stmt = db.prepare(
312
292
  "DELETE FROM pre_compact_backups WHERE project_path = ?"
313
293
  );
314
294
  const result = stmt.run(projectPath);
315
- return result.changes;
295
+ return Number(result.changes);
316
296
  }
317
297
  function countInteractions(db, filter) {
318
298
  const conditions = [];
@@ -349,7 +329,6 @@ export {
349
329
  deleteInteractionsByProject,
350
330
  getAllBackups,
351
331
  getCurrentUser,
352
- getDbPath,
353
332
  getDbStats,
354
333
  getGlobalDbDir,
355
334
  getGlobalDbPath,
@@ -365,11 +344,9 @@ export {
365
344
  getUniqueRepositories,
366
345
  hasInteractions,
367
346
  hasInteractionsForSessionIds,
368
- initDatabase,
369
347
  initGlobalDatabase,
370
348
  insertInteractions,
371
349
  insertPreCompactBackup,
372
- openDatabase,
373
350
  openGlobalDatabase,
374
351
  searchInteractions
375
352
  };
package/dist/server.js CHANGED
@@ -2884,11 +2884,14 @@ import { homedir } from "node:os";
2884
2884
  import { dirname, join as join2 } from "node:path";
2885
2885
  import { fileURLToPath } from "node:url";
2886
2886
  var originalEmit = process.emit;
2887
- process.emit = (name, data, ...args) => {
2888
- if (name === "warning" && typeof data === "object" && data?.name === "ExperimentalWarning" && data?.message?.includes("SQLite")) {
2887
+ process.emit = (event, ...args) => {
2888
+ if (event === "warning" && typeof args[0] === "object" && args[0] !== null && "name" in args[0] && args[0].name === "ExperimentalWarning" && "message" in args[0] && typeof args[0].message === "string" && args[0].message.includes("SQLite")) {
2889
2889
  return false;
2890
2890
  }
2891
- return originalEmit.call(process, name, data, ...args);
2891
+ return originalEmit.apply(
2892
+ process,
2893
+ [event, ...args]
2894
+ );
2892
2895
  };
2893
2896
  var { DatabaseSync } = await import("node:sqlite");
2894
2897
  var __filename = fileURLToPath(import.meta.url);
@@ -2914,9 +2917,6 @@ function getGlobalDbDir() {
2914
2917
  function getGlobalDbPath() {
2915
2918
  return join2(getGlobalDbDir(), "global.db");
2916
2919
  }
2917
- function getDbPath(memoriaDir2) {
2918
- return join2(memoriaDir2, "local.db");
2919
- }
2920
2920
  function configurePragmas(db) {
2921
2921
  db.exec("PRAGMA journal_mode = WAL");
2922
2922
  db.exec("PRAGMA busy_timeout = 5000");
@@ -2931,15 +2931,6 @@ function openGlobalDatabase() {
2931
2931
  configurePragmas(db);
2932
2932
  return db;
2933
2933
  }
2934
- function openDatabase(memoriaDir2) {
2935
- const dbPath = getDbPath(memoriaDir2);
2936
- if (!existsSync2(dbPath)) {
2937
- return null;
2938
- }
2939
- const db = new DatabaseSync(dbPath);
2940
- configurePragmas(db);
2941
- return db;
2942
- }
2943
2934
  function getInteractionsBySessionIdsAndOwner(db, sessionIds, owner) {
2944
2935
  if (sessionIds.length === 0) {
2945
2936
  return [];
@@ -3753,10 +3744,7 @@ app.get("/api/sessions/:id/interactions", async (c) => {
3753
3744
  const sessionsDir = path3.join(memoriaDir2, "sessions");
3754
3745
  try {
3755
3746
  const currentUser = getCurrentUser();
3756
- let db = openGlobalDatabase();
3757
- if (!db) {
3758
- db = openDatabase(memoriaDir2);
3759
- }
3747
+ const db = openGlobalDatabase();
3760
3748
  if (!db) {
3761
3749
  return c.json({ interactions: [], count: 0, isOwner: false });
3762
3750
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hir4ta/memoria",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Long-term memory plugin for Claude Code - automated session saving, recording technical decisions, and web dashboard",
5
5
  "keywords": [
6
6
  "claude",