@aeriondyseti/vector-memory-mcp 2.2.2 → 2.2.6

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.
Files changed (31) hide show
  1. package/README.md +33 -13
  2. package/package.json +8 -7
  3. package/scripts/lancedb-extract.ts +111 -46
  4. package/scripts/migrate-from-lancedb.ts +2 -2
  5. package/scripts/smoke-test.ts +1 -1
  6. package/scripts/sync-version.ts +35 -0
  7. package/scripts/warmup.ts +2 -2
  8. package/{src → server}/config/index.ts +10 -2
  9. package/{src/db → server/core}/connection.ts +10 -2
  10. package/{src/db → server/core}/conversation.repository.ts +1 -1
  11. package/{src/services → server/core}/conversation.service.ts +2 -2
  12. package/{src/db → server/core}/memory.repository.ts +5 -1
  13. package/{src/services → server/core}/memory.service.ts +20 -4
  14. package/server/core/migration.service.ts +882 -0
  15. package/server/core/migrations.ts +115 -0
  16. package/{src/services → server/core}/parsers/claude-code.parser.ts +1 -1
  17. package/{src/services → server/core}/parsers/types.ts +1 -1
  18. package/{src → server}/index.ts +13 -10
  19. package/{src → server}/migration.ts +2 -2
  20. package/{src → server/transports}/http/mcp-transport.ts +2 -2
  21. package/{src → server/transports}/http/server.ts +34 -4
  22. package/{src → server/transports}/mcp/handlers.ts +5 -5
  23. package/server/transports/mcp/resources.ts +161 -0
  24. package/{src → server/transports}/mcp/server.ts +14 -3
  25. package/server/utils/formatting.ts +143 -0
  26. package/src/db/migrations.ts +0 -108
  27. /package/{src/types → server/core}/conversation.ts +0 -0
  28. /package/{src/services → server/core}/embeddings.service.ts +0 -0
  29. /package/{src/types → server/core}/memory.ts +0 -0
  30. /package/{src/db → server/core}/sqlite-utils.ts +0 -0
  31. /package/{src → server/transports}/mcp/tools.ts +0 -0
@@ -1,108 +0,0 @@
1
- import type { Database } from "bun:sqlite";
2
-
3
- /**
4
- * Check if a table exists and is a vec0 virtual table (from the old sqlite-vec schema).
5
- */
6
- function isVec0Table(db: Database, tableName: string): boolean {
7
- const row = db
8
- .prepare(
9
- `SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?`,
10
- )
11
- .get(tableName) as { sql: string } | null;
12
- return row?.sql?.toLowerCase().includes("vec0") ?? false;
13
- }
14
-
15
- /**
16
- * Migrate a vec0 virtual table to a plain BLOB table.
17
- * Copies id + vector data, drops the vec0 table and its shadow tables, then
18
- * creates the new plain table with the copied data.
19
- */
20
- function migrateVec0ToBlob(db: Database, tableName: string): void {
21
- const tmpTable = `${tableName}_migration_tmp`;
22
-
23
- db.exec(`CREATE TABLE IF NOT EXISTS ${tmpTable} (id TEXT PRIMARY KEY, vector BLOB NOT NULL)`);
24
- db.exec(`INSERT OR IGNORE INTO ${tmpTable} (id, vector) SELECT id, vector FROM ${tableName}`);
25
- db.exec(`DROP TABLE ${tableName}`);
26
- db.exec(`CREATE TABLE ${tableName} (id TEXT PRIMARY KEY, vector BLOB NOT NULL)`);
27
- db.exec(`INSERT INTO ${tableName} (id, vector) SELECT id, vector FROM ${tmpTable}`);
28
- db.exec(`DROP TABLE ${tmpTable}`);
29
- }
30
-
31
- /**
32
- * Run all schema migrations. Safe to call on every startup (uses IF NOT EXISTS).
33
- */
34
- export function runMigrations(db: Database): void {
35
- // -- Memories --
36
- db.exec(`
37
- CREATE TABLE IF NOT EXISTS memories (
38
- id TEXT PRIMARY KEY,
39
- content TEXT NOT NULL,
40
- metadata TEXT NOT NULL DEFAULT '{}',
41
- created_at INTEGER NOT NULL,
42
- updated_at INTEGER NOT NULL,
43
- superseded_by TEXT,
44
- usefulness REAL NOT NULL DEFAULT 0.0,
45
- access_count INTEGER NOT NULL DEFAULT 0,
46
- last_accessed INTEGER
47
- )
48
- `);
49
-
50
- // Migrate vec0 -> plain blob table if upgrading from sqlite-vec schema
51
- if (isVec0Table(db, "memories_vec")) {
52
- migrateVec0ToBlob(db, "memories_vec");
53
- } else {
54
- db.exec(`
55
- CREATE TABLE IF NOT EXISTS memories_vec (
56
- id TEXT PRIMARY KEY,
57
- vector BLOB NOT NULL
58
- )
59
- `);
60
- }
61
-
62
- db.exec(`
63
- CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
64
- id UNINDEXED,
65
- content
66
- )
67
- `);
68
-
69
- // -- Conversation History --
70
- db.exec(`
71
- CREATE TABLE IF NOT EXISTS conversation_history (
72
- id TEXT PRIMARY KEY,
73
- content TEXT NOT NULL,
74
- metadata TEXT NOT NULL DEFAULT '{}',
75
- created_at INTEGER NOT NULL,
76
- session_id TEXT NOT NULL,
77
- role TEXT NOT NULL,
78
- message_index_start INTEGER NOT NULL,
79
- message_index_end INTEGER NOT NULL,
80
- project TEXT NOT NULL
81
- )
82
- `);
83
-
84
- // Migrate vec0 -> plain blob table if upgrading from sqlite-vec schema
85
- if (isVec0Table(db, "conversation_history_vec")) {
86
- migrateVec0ToBlob(db, "conversation_history_vec");
87
- } else {
88
- db.exec(`
89
- CREATE TABLE IF NOT EXISTS conversation_history_vec (
90
- id TEXT PRIMARY KEY,
91
- vector BLOB NOT NULL
92
- )
93
- `);
94
- }
95
-
96
- db.exec(`
97
- CREATE VIRTUAL TABLE IF NOT EXISTS conversation_history_fts USING fts5(
98
- id UNINDEXED,
99
- content
100
- )
101
- `);
102
-
103
- // -- Indexes --
104
- db.exec(`CREATE INDEX IF NOT EXISTS idx_conversation_session_id ON conversation_history(session_id)`);
105
- db.exec(`CREATE INDEX IF NOT EXISTS idx_conversation_project ON conversation_history(project)`);
106
- db.exec(`CREATE INDEX IF NOT EXISTS idx_conversation_role ON conversation_history(role)`);
107
- db.exec(`CREATE INDEX IF NOT EXISTS idx_conversation_created_at ON conversation_history(created_at)`);
108
- }
File without changes
File without changes
File without changes
File without changes