opencode-mem 2.3.0 → 2.3.2
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.
- package/README.md +35 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -0
- package/dist/services/api-handlers.d.ts.map +1 -1
- package/dist/services/api-handlers.js +15 -1
- package/dist/services/sqlite/connection-manager.d.ts +2 -0
- package/dist/services/sqlite/connection-manager.d.ts.map +1 -1
- package/dist/services/sqlite/connection-manager.js +75 -1
- package/dist/web/app.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# OpenCode Memory
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-mem)
|
|
4
|
+
[](https://www.npmjs.com/package/opencode-mem)
|
|
5
|
+
[](https://www.npmjs.com/package/opencode-mem)
|
|
6
|
+
|
|
3
7
|

|
|
4
8
|
|
|
5
9
|
A persistent memory system for AI coding agents that enables long-term context retention across sessions using local vector database technology.
|
|
@@ -37,6 +41,36 @@ Add the plugin to your OpenCode configuration:
|
|
|
37
41
|
|
|
38
42
|
OpenCode will automatically download and install the plugin on next startup.
|
|
39
43
|
|
|
44
|
+
### macOS Users - IMPORTANT
|
|
45
|
+
|
|
46
|
+
macOS ships with Apple's SQLite which **disables extension loading** for security reasons. You must install and configure Homebrew SQLite:
|
|
47
|
+
|
|
48
|
+
**Step 1: Install Homebrew SQLite**
|
|
49
|
+
```bash
|
|
50
|
+
brew install sqlite
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Step 2: Find the library path**
|
|
54
|
+
```bash
|
|
55
|
+
brew --prefix sqlite
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Step 3: Configure the path**
|
|
59
|
+
|
|
60
|
+
Edit `~/.config/opencode/opencode-mem.jsonc` and add:
|
|
61
|
+
|
|
62
|
+
```jsonc
|
|
63
|
+
{
|
|
64
|
+
"customSqlitePath": "/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib"
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Common paths:**
|
|
69
|
+
- **Apple Silicon (M1/M2/M3)**: `/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib`
|
|
70
|
+
- **Intel Mac**: `/usr/local/opt/sqlite/lib/libsqlite3.dylib`
|
|
71
|
+
|
|
72
|
+
The plugin will auto-detect these paths if not configured, but manual configuration is recommended for reliability.
|
|
73
|
+
|
|
40
74
|
### Install from Source
|
|
41
75
|
|
|
42
76
|
```bash
|
|
@@ -83,6 +117,7 @@ Configuration file: `~/.config/opencode/opencode-mem.jsonc`
|
|
|
83
117
|
```jsonc
|
|
84
118
|
{
|
|
85
119
|
"storagePath": "~/.opencode-mem/data",
|
|
120
|
+
"customSqlitePath": "/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib",
|
|
86
121
|
"embeddingModel": "Xenova/nomic-embed-text-v1",
|
|
87
122
|
"webServerEnabled": true,
|
|
88
123
|
"webServerPort": 4747,
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAyXA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;oBA0Bb,aAAa,GACb,kBAAkB,GAClB,WAAW;;;;;;;;;;;;;;;;;;;CAyBhB,CAAC;AAEF,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
package/dist/config.js
CHANGED
|
@@ -101,6 +101,22 @@ const CONFIG_TEMPLATE = `{
|
|
|
101
101
|
// Storage location for vector database
|
|
102
102
|
"storagePath": "~/.opencode-mem/data",
|
|
103
103
|
|
|
104
|
+
// ============================================
|
|
105
|
+
// macOS SQLite Extension Loading (REQUIRED FOR macOS)
|
|
106
|
+
// ============================================
|
|
107
|
+
|
|
108
|
+
// macOS users MUST set this to use Homebrew SQLite instead of Apple's SQLite
|
|
109
|
+
// Apple's SQLite disables extension loading which breaks sqlite-vec
|
|
110
|
+
//
|
|
111
|
+
// Common paths:
|
|
112
|
+
// - Homebrew (Intel): "/usr/local/opt/sqlite/lib/libsqlite3.dylib"
|
|
113
|
+
// - Homebrew (Apple Silicon): "/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib"
|
|
114
|
+
//
|
|
115
|
+
// To install: brew install sqlite
|
|
116
|
+
// To find path: brew --prefix sqlite
|
|
117
|
+
//
|
|
118
|
+
// "customSqlitePath": "/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib",
|
|
119
|
+
|
|
104
120
|
// ============================================
|
|
105
121
|
// Embedding Model (for similarity search)
|
|
106
122
|
// ============================================
|
|
@@ -293,6 +309,9 @@ function getEmbeddingDimensions(model) {
|
|
|
293
309
|
}
|
|
294
310
|
export const CONFIG = {
|
|
295
311
|
storagePath: expandPath(fileConfig.storagePath ?? DEFAULTS.storagePath),
|
|
312
|
+
customSqlitePath: fileConfig.customSqlitePath
|
|
313
|
+
? expandPath(fileConfig.customSqlitePath)
|
|
314
|
+
: undefined,
|
|
296
315
|
embeddingModel: fileConfig.embeddingModel ?? DEFAULTS.embeddingModel,
|
|
297
316
|
embeddingDimensions: fileConfig.embeddingDimensions ??
|
|
298
317
|
getEmbeddingDimensions(fileConfig.embeddingModel ?? DEFAULTS.embeddingModel),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-handlers.d.ts","sourceRoot":"","sources":["../../src/services/api-handlers.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,K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M,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CACH,CASA;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,WAAW,CAAC;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC,CA2BlD;AAED,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,WAAW,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAmB3C;AAED,wBAAsB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CA8CrF;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,MAAU,GAChB,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAuB7B;AAED,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CA4B7F;AAED,wBAAsB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAyBrF"}
|
|
@@ -38,6 +38,19 @@ function extractScopeFromTag(tag) {
|
|
|
38
38
|
}
|
|
39
39
|
return { scope: "project", hash: tag };
|
|
40
40
|
}
|
|
41
|
+
function getProjectPathFromTag(tag) {
|
|
42
|
+
const projectShards = shardManager.getAllShards("project", "");
|
|
43
|
+
for (const shard of projectShards) {
|
|
44
|
+
const db = connectionManager.getConnection(shard.dbPath);
|
|
45
|
+
const tags = vectorSearch.getDistinctTags(db);
|
|
46
|
+
for (const t of tags) {
|
|
47
|
+
if (t.container_tag === tag && t.project_path) {
|
|
48
|
+
return t.project_path;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
41
54
|
export async function handleListTags() {
|
|
42
55
|
try {
|
|
43
56
|
await embeddingService.warmup();
|
|
@@ -120,7 +133,8 @@ export async function handleListMemories(tag, page = 1, pageSize = 20, includePr
|
|
|
120
133
|
});
|
|
121
134
|
let timeline = memoriesWithType;
|
|
122
135
|
if (includePrompts) {
|
|
123
|
-
const
|
|
136
|
+
const projectPath = tag ? getProjectPathFromTag(tag) : undefined;
|
|
137
|
+
const prompts = userPromptManager.getCapturedPrompts(projectPath);
|
|
124
138
|
const promptsWithType = prompts.map((p) => ({
|
|
125
139
|
type: "prompt",
|
|
126
140
|
id: p.id,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Database } from "bun:sqlite";
|
|
2
2
|
export declare class ConnectionManager {
|
|
3
3
|
private connections;
|
|
4
|
+
private sqliteConfigured;
|
|
5
|
+
private configureSqlite;
|
|
4
6
|
private initDatabase;
|
|
5
7
|
getConnection(dbPath: string): Database;
|
|
6
8
|
closeConnection(dbPath: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../../src/services/sqlite/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../../src/services/sqlite/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO,CAAC,eAAe;IAqEvB,OAAO,CAAC,YAAY;IAqBpB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IAmBvC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IASrC,QAAQ,IAAI,IAAI;CAWjB;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
|
@@ -2,20 +2,94 @@ import { Database } from "bun:sqlite";
|
|
|
2
2
|
import * as sqliteVec from "sqlite-vec";
|
|
3
3
|
import { existsSync, mkdirSync } from "node:fs";
|
|
4
4
|
import { log } from "../logger.js";
|
|
5
|
+
import { CONFIG } from "../../config.js";
|
|
5
6
|
export class ConnectionManager {
|
|
6
7
|
connections = new Map();
|
|
8
|
+
sqliteConfigured = false;
|
|
9
|
+
configureSqlite() {
|
|
10
|
+
if (this.sqliteConfigured)
|
|
11
|
+
return;
|
|
12
|
+
if (process.platform === "darwin") {
|
|
13
|
+
const customPath = CONFIG.customSqlitePath;
|
|
14
|
+
if (customPath) {
|
|
15
|
+
if (!existsSync(customPath)) {
|
|
16
|
+
throw new Error(`Custom SQLite library not found at: ${customPath}\n` +
|
|
17
|
+
`Please verify the path or install Homebrew SQLite:\n` +
|
|
18
|
+
` brew install sqlite\n` +
|
|
19
|
+
` brew --prefix sqlite`);
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
Database.setCustomSQLite(customPath);
|
|
23
|
+
log("Using custom SQLite library", { path: customPath });
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
throw new Error(`Failed to load custom SQLite library: ${error}\n` + `Path: ${customPath}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const commonPaths = [
|
|
31
|
+
"/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib",
|
|
32
|
+
"/usr/local/opt/sqlite/lib/libsqlite3.dylib",
|
|
33
|
+
];
|
|
34
|
+
let foundPath = null;
|
|
35
|
+
for (const path of commonPaths) {
|
|
36
|
+
if (existsSync(path)) {
|
|
37
|
+
foundPath = path;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (foundPath) {
|
|
42
|
+
try {
|
|
43
|
+
Database.setCustomSQLite(foundPath);
|
|
44
|
+
log("Auto-detected and using Homebrew SQLite", { path: foundPath });
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw new Error(`Failed to load Homebrew SQLite: ${error}\n` + `Path: ${foundPath}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
throw new Error(`macOS detected but no compatible SQLite library found.\n\n` +
|
|
52
|
+
`Apple's default SQLite does not support extension loading.\n` +
|
|
53
|
+
`Please install Homebrew SQLite and configure the path:\n\n` +
|
|
54
|
+
`1. Install Homebrew SQLite:\n` +
|
|
55
|
+
` brew install sqlite\n\n` +
|
|
56
|
+
`2. Find the library path:\n` +
|
|
57
|
+
` brew --prefix sqlite\n\n` +
|
|
58
|
+
`3. Add to ~/.config/opencode/opencode-mem.jsonc:\n` +
|
|
59
|
+
` {\n` +
|
|
60
|
+
` "customSqlitePath": "/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib"\n` +
|
|
61
|
+
` }\n\n` +
|
|
62
|
+
`Common paths:\n` +
|
|
63
|
+
` - Apple Silicon: /opt/homebrew/opt/sqlite/lib/libsqlite3.dylib\n` +
|
|
64
|
+
` - Intel Mac: /usr/local/opt/sqlite/lib/libsqlite3.dylib`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
this.sqliteConfigured = true;
|
|
69
|
+
}
|
|
7
70
|
initDatabase(db) {
|
|
8
71
|
db.run("PRAGMA journal_mode = WAL");
|
|
9
72
|
db.run("PRAGMA synchronous = NORMAL");
|
|
10
73
|
db.run("PRAGMA cache_size = -64000");
|
|
11
74
|
db.run("PRAGMA temp_store = MEMORY");
|
|
12
75
|
db.run("PRAGMA foreign_keys = ON");
|
|
13
|
-
|
|
76
|
+
try {
|
|
77
|
+
sqliteVec.load(db);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
throw new Error(`Failed to load sqlite-vec extension: ${error}\n\n` +
|
|
81
|
+
`This usually means SQLite extension loading is disabled.\n` +
|
|
82
|
+
`On macOS, you must use Homebrew SQLite instead of Apple's SQLite.\n\n` +
|
|
83
|
+
`Solution:\n` +
|
|
84
|
+
`1. Install: brew install sqlite\n` +
|
|
85
|
+
`2. Configure customSqlitePath in ~/.config/opencode/opencode-mem.jsonc`);
|
|
86
|
+
}
|
|
14
87
|
}
|
|
15
88
|
getConnection(dbPath) {
|
|
16
89
|
if (this.connections.has(dbPath)) {
|
|
17
90
|
return this.connections.get(dbPath);
|
|
18
91
|
}
|
|
92
|
+
this.configureSqlite();
|
|
19
93
|
const dir = dbPath.substring(0, dbPath.lastIndexOf("/"));
|
|
20
94
|
if (!existsSync(dir)) {
|
|
21
95
|
mkdirSync(dir, { recursive: true });
|
package/dist/web/app.js
CHANGED
|
@@ -938,6 +938,10 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
938
938
|
document.getElementById("tag-filter").addEventListener("change", () => {
|
|
939
939
|
state.selectedTag = document.getElementById("tag-filter").value;
|
|
940
940
|
state.currentPage = 1;
|
|
941
|
+
state.isSearching = false;
|
|
942
|
+
state.searchQuery = "";
|
|
943
|
+
document.getElementById("search-input").value = "";
|
|
944
|
+
document.getElementById("clear-search-btn").classList.add("hidden");
|
|
941
945
|
loadMemories();
|
|
942
946
|
});
|
|
943
947
|
|