opencode-mem 2.9.1 → 2.10.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.
@@ -1 +1 @@
1
- {"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../../src/services/sqlite/connection-manager.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,QAAQ,sCAAgB,CAAC;AAE/B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,WAAW,CAAqD;IAExE,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,aAAa;IAoBrB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,QAAQ,CAAC,SAAS;IAiBxD,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IASrC,QAAQ,IAAI,IAAI;IAYhB,aAAa,IAAI,IAAI;CAStB;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
1
+ {"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../../src/services/sqlite/connection-manager.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,QAAQ,sCAAgB,CAAC;AAE/B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,WAAW,CAAqD;IAExE,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,aAAa;IAoBrB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,QAAQ,CAAC,SAAS;IAiBxD,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IASrC,QAAQ,IAAI,IAAI;IAYhB,aAAa,IAAI,IAAI;CAStB;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { getDatabase } from "./sqlite-bootstrap.js";
2
- import * as sqliteVec from "sqlite-vec";
3
2
  import { existsSync, mkdirSync } from "node:fs";
4
3
  import { dirname } from "node:path";
5
4
  import { log } from "../logger.js";
@@ -15,14 +14,15 @@ export class ConnectionManager {
15
14
  db.run("PRAGMA temp_store = MEMORY");
16
15
  db.run("PRAGMA foreign_keys = ON");
17
16
  try {
18
- sqliteVec.load(db);
17
+ const result = db.prepare("SELECT vec_version()").all();
18
+ if (!result || result.length === 0) {
19
+ throw new Error("vec_version() returned no result");
20
+ }
19
21
  }
20
22
  catch (error) {
21
- throw new Error(`Failed to load sqlite-vec extension: ${error}\n\n` +
22
- `This usually means SQLite extension loading is disabled.\n` +
23
- `On macOS, you must use Homebrew SQLite instead of Apple's SQLite.\n\n` +
24
- `Solution:\n` +
25
- ` brew install sqlite`);
23
+ throw new Error(`sqlite-vec extension not available: ${error}\n\n` +
24
+ `The bundled SQLite dylib should have sqlite-vec built-in.\n` +
25
+ `Try reinstalling opencode-mem or report this issue.`);
26
26
  }
27
27
  this.migrateSchema(db);
28
28
  }
@@ -8,11 +8,13 @@
8
8
  * Issue: https://github.com/tickernelz/opencode-mem/issues/34
9
9
  * Issue: https://github.com/tickernelz/opencode-mem/issues/37
10
10
  *
11
+ * The bundled dylib has sqlite-vec statically linked, so no extension loading needed.
11
12
  * Loading priority:
12
- * 1. Bundled dylib (native/darwin-{arch}/libsqlite3.dylib)
13
+ * 1. Bundled dylib (native/darwin-{arch}/libsqlite3.dylib) - includes sqlite-vec
13
14
  * 2. Homebrew SQLite (auto-detected common paths)
14
15
  */
15
16
  export declare function configureSqlite(): void;
16
17
  export declare function getDatabase(): typeof import("bun:sqlite").Database;
17
18
  export declare function getSqliteSource(): string | null;
19
+ export declare function verifySqliteVec(): void;
18
20
  //# sourceMappingURL=sqlite-bootstrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite-bootstrap.d.ts","sourceRoot":"","sources":["../../../src/services/sqlite/sqlite-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwDH,wBAAgB,eAAe,IAAI,IAAI,CAmDtC;AAED,wBAAgB,WAAW,IAAI,cAAc,YAAY,EAAE,QAAQ,CAGlE;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C"}
1
+ {"version":3,"file":"sqlite-bootstrap.d.ts","sourceRoot":"","sources":["../../../src/services/sqlite/sqlite-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiEH,wBAAgB,eAAe,IAAI,IAAI,CA+CtC;AAED,wBAAgB,WAAW,IAAI,cAAc,YAAY,EAAE,QAAQ,CAGlE;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAYtC"}
@@ -8,8 +8,9 @@
8
8
  * Issue: https://github.com/tickernelz/opencode-mem/issues/34
9
9
  * Issue: https://github.com/tickernelz/opencode-mem/issues/37
10
10
  *
11
+ * The bundled dylib has sqlite-vec statically linked, so no extension loading needed.
11
12
  * Loading priority:
12
- * 1. Bundled dylib (native/darwin-{arch}/libsqlite3.dylib)
13
+ * 1. Bundled dylib (native/darwin-{arch}/libsqlite3.dylib) - includes sqlite-vec
13
14
  * 2. Homebrew SQLite (auto-detected common paths)
14
15
  */
15
16
  import { existsSync } from "node:fs";
@@ -49,6 +50,15 @@ function getHomebrewSqlitePath() {
49
50
  }
50
51
  return null;
51
52
  }
53
+ function checkSqliteVec(db) {
54
+ try {
55
+ const result = db.prepare("SELECT vec_version()").all();
56
+ return result && result.length > 0;
57
+ }
58
+ catch {
59
+ return false;
60
+ }
61
+ }
52
62
  export function configureSqlite() {
53
63
  if (sqliteConfigured)
54
64
  return;
@@ -67,6 +77,7 @@ export function configureSqlite() {
67
77
  catch (error) {
68
78
  const errorStr = String(error);
69
79
  if (errorStr.includes("SQLite already loaded")) {
80
+ sqliteSource = "already-loaded";
70
81
  return true;
71
82
  }
72
83
  return false;
@@ -87,13 +98,8 @@ export function configureSqlite() {
87
98
  }
88
99
  }
89
100
  throw new Error(`macOS detected but no compatible SQLite library found.\n\n` +
90
- `Apple's default SQLite does not support extension loading.\n` +
91
- `Solution:\n\n` +
92
- `Install Homebrew SQLite:\n` +
93
- ` brew install sqlite\n\n` +
94
- `Common Homebrew paths:\n` +
95
- ` - Apple Silicon: /opt/homebrew/opt/sqlite/lib/libsqlite3.dylib\n` +
96
- ` - Intel Mac: /usr/local/opt/sqlite/lib/libsqlite3.dylib`);
101
+ `The bundled SQLite dylib with sqlite-vec is required.\n` +
102
+ `Try reinstalling opencode-mem.`);
97
103
  }
98
104
  export function getDatabase() {
99
105
  configureSqlite();
@@ -102,4 +108,16 @@ export function getDatabase() {
102
108
  export function getSqliteSource() {
103
109
  return sqliteSource;
104
110
  }
111
+ export function verifySqliteVec() {
112
+ const db = new Database(":memory:");
113
+ if (!checkSqliteVec(db)) {
114
+ db.close();
115
+ throw new Error(`sqlite-vec extension not available.\n\n` +
116
+ `This plugin requires SQLite with sqlite-vec built-in.\n` +
117
+ `The bundled dylib should have sqlite-vec statically linked.\n` +
118
+ `Try reinstalling opencode-mem.`);
119
+ }
120
+ db.close();
121
+ }
105
122
  configureSqlite();
123
+ verifySqliteVec();
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-mem",
3
- "version": "2.9.1",
3
+ "version": "2.10.0",
4
4
  "description": "OpenCode plugin that gives coding agents persistent memory using local vector database",
5
5
  "type": "module",
6
6
  "main": "dist/plugin.js",
@@ -36,8 +36,7 @@
36
36
  "@opencode-ai/plugin": "^1.0.162",
37
37
  "@xenova/transformers": "^2.17.2",
38
38
  "franc-min": "^6.2.0",
39
- "iso-639-3": "^3.0.1",
40
- "sqlite-vec": "0.1.7-alpha.2"
39
+ "iso-639-3": "^3.0.1"
41
40
  },
42
41
  "devDependencies": {
43
42
  "@types/bun": "^1.3.8",