@memrosetta/core 0.2.4 → 0.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 (2) hide show
  1. package/dist/index.js +16 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -133,6 +133,16 @@ function ensureSchema(db, options) {
133
133
  db.prepare("UPDATE schema_version SET version = ?").run(4);
134
134
  }
135
135
  if (options?.vectorEnabled) {
136
+ const hasVecTable = db.prepare(
137
+ "SELECT name FROM sqlite_master WHERE type='table' AND name='vec_memories'"
138
+ ).get();
139
+ if (!hasVecTable) {
140
+ try {
141
+ db.exec(schemaV2(dim));
142
+ } catch {
143
+ process.stderr.write("[memrosetta] sqlite-vec not available, vector search disabled\n");
144
+ }
145
+ }
136
146
  const hasDimCol = db.prepare("PRAGMA table_info(schema_version)").all().some((col) => col.name === "embedding_dimension");
137
147
  if (!hasDimCol) {
138
148
  db.exec("ALTER TABLE schema_version ADD COLUMN embedding_dimension INTEGER DEFAULT 384");
@@ -147,8 +157,12 @@ function ensureSchema(db, options) {
147
157
  db.exec("DROP TABLE IF EXISTS vec_memories");
148
158
  } catch {
149
159
  }
150
- db.exec(schemaV2(dim));
151
- db.prepare("UPDATE schema_version SET embedding_dimension = ?").run(dim);
160
+ try {
161
+ db.exec(schemaV2(dim));
162
+ db.prepare("UPDATE schema_version SET embedding_dimension = ?").run(dim);
163
+ } catch {
164
+ process.stderr.write("[memrosetta] sqlite-vec not available, vector search disabled\n");
165
+ }
152
166
  }
153
167
  }
154
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memrosetta/core",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,10 +20,10 @@
20
20
  "better-sqlite3": "^11.0.0",
21
21
  "nanoid": "^5.0.0",
22
22
  "sqlite-vec": "^0.1.7",
23
- "@memrosetta/types": "0.2.4"
23
+ "@memrosetta/types": "0.2.6"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@memrosetta/embeddings": "0.2.4"
26
+ "@memrosetta/embeddings": "0.2.6"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/better-sqlite3": "^7.6.0",