@lojban/semantic-search-mcp 1.0.2 → 1.0.3

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/storage.ts +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lojban/semantic-search-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Local-first MCP server for semantic search using transformers.js and SQLite",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/storage.ts CHANGED
@@ -63,10 +63,10 @@ export class VectorStorage {
63
63
  const sel = await this.db.prepare('SELECT id FROM lines WHERE file_path = ? AND line_number = ?');
64
64
  const row = sel.get([filePath, lineNumber]) as { id: number } | undefined;
65
65
  if (row == null) throw new Error('Failed to get line id');
66
- const id = Math.trunc(Number(row.id));
66
+ const idInt = BigInt(row.id); // vec0 requires INTEGER primary key; BigInt binds as integer in better-sqlite3
67
67
 
68
- (await this.db.prepare('DELETE FROM vec_lines WHERE line_id = ?')).run([id]);
69
- (await this.db.prepare('INSERT INTO vec_lines (line_id, embedding) VALUES (?, ?)')).run([id, embedding.buffer]);
68
+ (await this.db.prepare('DELETE FROM vec_lines WHERE line_id = ?')).run([idInt]);
69
+ (await this.db.prepare('INSERT INTO vec_lines (line_id, embedding) VALUES (?, ?)')).run([idInt, embedding.buffer]);
70
70
  }
71
71
 
72
72
  /**
@@ -87,9 +87,9 @@ export class VectorStorage {
87
87
  for (const item of lines) {
88
88
  insertLine.run([item.filePath, item.lineNumber, item.content]);
89
89
  const row = selId.get([item.filePath, item.lineNumber]) as { id: number };
90
- const id = Math.trunc(Number(row.id));
91
- deleteVec.run([id]);
92
- insertVec.run([id, item.embedding.buffer]);
90
+ const idInt = BigInt(row.id); // vec0 requires INTEGER primary key; BigInt binds as integer in better-sqlite3
91
+ deleteVec.run([idInt]);
92
+ insertVec.run([idInt, item.embedding.buffer]);
93
93
  }
94
94
  }
95
95