@tekmidian/pai 0.16.0 → 0.17.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.
- package/README.md +11 -3
- package/dist/auto-route-DkIRampF.mjs +86 -0
- package/dist/auto-route-DkIRampF.mjs.map +1 -0
- package/dist/checkpoint-block-Bl0HD3U2.mjs.map +1 -1
- package/dist/checkpoint-block-C05sK_HK.mjs +1056 -0
- package/dist/checkpoint-block-C05sK_HK.mjs.map +1 -0
- package/dist/checkpoint-block-CUCG10Uh.mjs +1022 -0
- package/dist/checkpoint-block-CUCG10Uh.mjs.map +1 -0
- package/dist/checkpoint-block-D5IyLLTr.mjs +1062 -0
- package/dist/checkpoint-block-D5IyLLTr.mjs.map +1 -0
- package/dist/cli/index.mjs +6 -6
- package/dist/cli/program.mjs +7 -7
- package/dist/cli/program.mjs.map +1 -1
- package/dist/daemon/index.mjs +9 -9
- package/dist/daemon-9AL6Pwh-.mjs +1581 -0
- package/dist/daemon-9AL6Pwh-.mjs.map +1 -0
- package/dist/daemon-Bbk-_rV6.mjs +1581 -0
- package/dist/daemon-Bbk-_rV6.mjs.map +1 -0
- package/dist/daemon-BvcaMk4g.mjs +1581 -0
- package/dist/daemon-BvcaMk4g.mjs.map +1 -0
- package/dist/daemon-CTDEfwcq.mjs +1576 -0
- package/dist/daemon-CTDEfwcq.mjs.map +1 -0
- package/dist/daemon-ClbfaF60.mjs +1576 -0
- package/dist/daemon-ClbfaF60.mjs.map +1 -0
- package/dist/daemon-DDQNDgYF.mjs +1576 -0
- package/dist/daemon-DDQNDgYF.mjs.map +1 -0
- package/dist/daemon-DU8yDWlQ.mjs +1576 -0
- package/dist/daemon-DU8yDWlQ.mjs.map +1 -0
- package/dist/daemon-NJr4iSW3.mjs +1576 -0
- package/dist/daemon-NJr4iSW3.mjs.map +1 -0
- package/dist/detector-Bwzm3E_x.mjs +74 -0
- package/dist/detector-Bwzm3E_x.mjs.map +1 -0
- package/dist/embeddings-Bn86ssxR.mjs +119 -0
- package/dist/embeddings-Bn86ssxR.mjs.map +1 -0
- package/dist/factory-0-57Ac-7.mjs +72 -0
- package/dist/factory-0-57Ac-7.mjs.map +1 -0
- package/dist/factory-PDXQdkLO.mjs +72 -0
- package/dist/factory-PDXQdkLO.mjs.map +1 -0
- package/dist/hooks/context-compression-hook.mjs +36 -4
- package/dist/hooks/context-compression-hook.mjs.map +3 -3
- package/dist/hooks/load-project-context.mjs +188 -6
- package/dist/hooks/load-project-context.mjs.map +4 -4
- package/dist/hooks/stop-hook.mjs +36 -4
- package/dist/hooks/stop-hook.mjs.map +3 -3
- package/dist/index.mjs +3 -3
- package/dist/indexer-backend-BmaS2VcD.mjs +299 -0
- package/dist/indexer-backend-BmaS2VcD.mjs.map +1 -0
- package/dist/indexer-backend-COrJ5rjS.mjs +299 -0
- package/dist/indexer-backend-COrJ5rjS.mjs.map +1 -0
- package/dist/indexer-backend-NwD7TBGh.mjs +301 -0
- package/dist/indexer-backend-NwD7TBGh.mjs.map +1 -0
- package/dist/latent-ideas-BwM3WdBp.mjs +191 -0
- package/dist/latent-ideas-BwM3WdBp.mjs.map +1 -0
- package/dist/neighborhood-DZY0wkpE.mjs +135 -0
- package/dist/neighborhood-DZY0wkpE.mjs.map +1 -0
- package/dist/pick-B0q5cy79.mjs +11785 -0
- package/dist/pick-B0q5cy79.mjs.map +1 -0
- package/dist/pick-BHE9_iA0.mjs +11947 -0
- package/dist/pick-BHE9_iA0.mjs.map +1 -0
- package/dist/pick-BaTjoNqM.mjs +11544 -0
- package/dist/pick-BaTjoNqM.mjs.map +1 -0
- package/dist/pick-C6JbZfN4.mjs +11893 -0
- package/dist/pick-C6JbZfN4.mjs.map +1 -0
- package/dist/pick-CK-bJyjp.mjs +11883 -0
- package/dist/pick-CK-bJyjp.mjs.map +1 -0
- package/dist/pick-CLBkGHyI.mjs +11826 -0
- package/dist/pick-CLBkGHyI.mjs.map +1 -0
- package/dist/pick-CTOif21h.mjs +11544 -0
- package/dist/pick-CTOif21h.mjs.map +1 -0
- package/dist/pick-Ck2cdQgD.mjs +11893 -0
- package/dist/pick-Ck2cdQgD.mjs.map +1 -0
- package/dist/pick-Cr4nJzHA.mjs +11914 -0
- package/dist/pick-Cr4nJzHA.mjs.map +1 -0
- package/dist/pick-D4dFfKAu.mjs +11893 -0
- package/dist/pick-D4dFfKAu.mjs.map +1 -0
- package/dist/pick-D7-lYiGX.mjs +11543 -0
- package/dist/pick-D7-lYiGX.mjs.map +1 -0
- package/dist/pick-DMjCY0np.mjs +11875 -0
- package/dist/pick-DMjCY0np.mjs.map +1 -0
- package/dist/pick-DbX4OrCP.mjs +11543 -0
- package/dist/pick-DbX4OrCP.mjs.map +1 -0
- package/dist/pick-iCiPjlnC.mjs +11893 -0
- package/dist/pick-iCiPjlnC.mjs.map +1 -0
- package/dist/pick-sF9GnQUS.mjs +11893 -0
- package/dist/pick-sF9GnQUS.mjs.map +1 -0
- package/dist/pick-yHKUrnfG.mjs +11793 -0
- package/dist/pick-yHKUrnfG.mjs.map +1 -0
- package/dist/postgres-BJxiqtqg.mjs +891 -0
- package/dist/postgres-BJxiqtqg.mjs.map +1 -0
- package/dist/search-CpTv1I24.mjs +298 -0
- package/dist/search-CpTv1I24.mjs.map +1 -0
- package/dist/skills/Pause/SKILL.md +11 -4
- package/dist/sqlite-CZ0LFili.mjs +271 -0
- package/dist/sqlite-CZ0LFili.mjs.map +1 -0
- package/dist/sqlite-Nw8ZW5Rj.mjs +271 -0
- package/dist/sqlite-Nw8ZW5Rj.mjs.map +1 -0
- package/dist/sync--BoxBBok.mjs +310 -0
- package/dist/sync--BoxBBok.mjs.map +1 -0
- package/dist/themes-BBOlGXAg.mjs +148 -0
- package/dist/themes-BBOlGXAg.mjs.map +1 -0
- package/dist/tools-B6BmaAvz.mjs +1939 -0
- package/dist/tools-B6BmaAvz.mjs.map +1 -0
- package/dist/tools-CAIY8TAb.mjs +1939 -0
- package/dist/tools-CAIY8TAb.mjs.map +1 -0
- package/dist/work-queue-worker-BoHIH70K.mjs +1856 -0
- package/dist/work-queue-worker-BoHIH70K.mjs.map +1 -0
- package/dist/work-queue-worker-CZGcQoLw.mjs +1856 -0
- package/dist/work-queue-worker-CZGcQoLw.mjs.map +1 -0
- package/dist/work-queue-worker-D05Ze9e9.mjs +1856 -0
- package/dist/work-queue-worker-D05Ze9e9.mjs.map +1 -0
- package/dist/work-queue-worker-DdXFINfH.mjs +1856 -0
- package/dist/work-queue-worker-DdXFINfH.mjs.map +1 -0
- package/dist/zettelkasten-D0N_A_OE.mjs +1063 -0
- package/dist/zettelkasten-D0N_A_OE.mjs.map +1 -0
- package/docs/commands/README.md +2 -1
- package/docs/commands/pause.md +1 -1
- package/docs/commands/session.md +27 -3
- package/package.json +1 -1
- package/plugins/context-preservation/hooks/hooks.json +12 -1
- package/scripts/build-hooks.mjs +1 -0
- package/src/hooks/session-autosave.sh +69 -0
- package/src/hooks/session-stop.sh +32 -1
- package/src/hooks/ts/session-start/load-project-context.ts +44 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import "./embeddings-Bn86ssxR.mjs";
|
|
2
|
+
import { a as searchMemorySemantic, r as searchMemory } from "./search-CpTv1I24.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/sqlite.ts
|
|
5
|
+
var SQLiteBackend = class {
|
|
6
|
+
backendType = "sqlite";
|
|
7
|
+
db;
|
|
8
|
+
constructor(db) {
|
|
9
|
+
this.db = db;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Expose the raw better-sqlite3 Database handle.
|
|
13
|
+
* Used by the daemon to pass to indexAll() which still uses the synchronous API directly.
|
|
14
|
+
*/
|
|
15
|
+
getRawDb() {
|
|
16
|
+
return this.db;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Alias for getRawDb() — used by the dispatcher for operations that require
|
|
20
|
+
* direct SQLite access (e.g. memory_feedback, touchChunksLastAccessed).
|
|
21
|
+
*/
|
|
22
|
+
getSqliteDb() {
|
|
23
|
+
return this.db;
|
|
24
|
+
}
|
|
25
|
+
async close() {
|
|
26
|
+
try {
|
|
27
|
+
this.db.close();
|
|
28
|
+
} catch {}
|
|
29
|
+
}
|
|
30
|
+
async getStats() {
|
|
31
|
+
return {
|
|
32
|
+
files: this.db.prepare("SELECT COUNT(*) AS n FROM memory_files").get().n,
|
|
33
|
+
chunks: this.db.prepare("SELECT COUNT(*) AS n FROM memory_chunks").get().n
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async getFileHash(projectId, path) {
|
|
37
|
+
return this.db.prepare("SELECT hash FROM memory_files WHERE project_id = ? AND path = ?").get(projectId, path)?.hash;
|
|
38
|
+
}
|
|
39
|
+
async upsertFile(file) {
|
|
40
|
+
this.db.prepare(`INSERT INTO memory_files (project_id, path, source, tier, hash, mtime, size)
|
|
41
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
42
|
+
ON CONFLICT(project_id, path) DO UPDATE SET
|
|
43
|
+
source = excluded.source,
|
|
44
|
+
tier = excluded.tier,
|
|
45
|
+
hash = excluded.hash,
|
|
46
|
+
mtime = excluded.mtime,
|
|
47
|
+
size = excluded.size`).run(file.projectId, file.path, file.source, file.tier, file.hash, file.mtime, file.size);
|
|
48
|
+
}
|
|
49
|
+
async getChunkIds(projectId, path) {
|
|
50
|
+
return this.db.prepare("SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?").all(projectId, path).map((r) => r.id);
|
|
51
|
+
}
|
|
52
|
+
async deleteChunksForFile(projectId, path) {
|
|
53
|
+
const ids = await this.getChunkIds(projectId, path);
|
|
54
|
+
const deleteFts = this.db.prepare("DELETE FROM memory_fts WHERE id = ?");
|
|
55
|
+
const deleteChunks = this.db.prepare("DELETE FROM memory_chunks WHERE project_id = ? AND path = ?");
|
|
56
|
+
this.db.transaction(() => {
|
|
57
|
+
for (const id of ids) deleteFts.run(id);
|
|
58
|
+
deleteChunks.run(projectId, path);
|
|
59
|
+
})();
|
|
60
|
+
}
|
|
61
|
+
async insertChunks(chunks) {
|
|
62
|
+
if (chunks.length === 0) return;
|
|
63
|
+
const insertChunk = this.db.prepare(`INSERT INTO memory_chunks (id, project_id, source, tier, path, start_line, end_line, hash, text, updated_at)
|
|
64
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
65
|
+
const insertFts = this.db.prepare(`INSERT INTO memory_fts (text, id, project_id, path, source, tier, start_line, end_line)
|
|
66
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
67
|
+
this.db.transaction(() => {
|
|
68
|
+
for (const c of chunks) {
|
|
69
|
+
insertChunk.run(c.id, c.projectId, c.source, c.tier, c.path, c.startLine, c.endLine, c.hash, c.text, c.updatedAt);
|
|
70
|
+
insertFts.run(c.text, c.id, c.projectId, c.path, c.source, c.tier, c.startLine, c.endLine);
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
}
|
|
74
|
+
async getDistinctChunkPaths(projectId) {
|
|
75
|
+
return this.db.prepare("SELECT DISTINCT path FROM memory_chunks WHERE project_id = ?").all(projectId).map((r) => r.path);
|
|
76
|
+
}
|
|
77
|
+
async deletePaths(projectId, paths) {
|
|
78
|
+
if (paths.length === 0) return;
|
|
79
|
+
const deleteFts = this.db.prepare("DELETE FROM memory_fts WHERE id = ?");
|
|
80
|
+
const deleteChunks = this.db.prepare("DELETE FROM memory_chunks WHERE project_id = ? AND path = ?");
|
|
81
|
+
const deleteFile = this.db.prepare("DELETE FROM memory_files WHERE project_id = ? AND path = ?");
|
|
82
|
+
this.db.transaction(() => {
|
|
83
|
+
for (const path of paths) {
|
|
84
|
+
const ids = this.db.prepare("SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?").all(projectId, path);
|
|
85
|
+
for (const { id } of ids) deleteFts.run(id);
|
|
86
|
+
deleteChunks.run(projectId, path);
|
|
87
|
+
deleteFile.run(projectId, path);
|
|
88
|
+
}
|
|
89
|
+
})();
|
|
90
|
+
}
|
|
91
|
+
async getUnembeddedChunkIds(projectId, limit) {
|
|
92
|
+
const conditions = ["embedding IS NULL"];
|
|
93
|
+
const params = [];
|
|
94
|
+
if (projectId !== void 0) {
|
|
95
|
+
conditions.push("project_id = ?");
|
|
96
|
+
params.push(projectId);
|
|
97
|
+
}
|
|
98
|
+
const where = "WHERE " + conditions.join(" AND ");
|
|
99
|
+
return this.db.prepare(`SELECT id, text, project_id, path FROM memory_chunks ${where}
|
|
100
|
+
ORDER BY CASE
|
|
101
|
+
WHEN path LIKE '🧠 Ideaverse/%' THEN 0
|
|
102
|
+
WHEN path LIKE 'Z - Zettelkasten/%' THEN 0
|
|
103
|
+
WHEN path LIKE '💼 Business/%' THEN 0
|
|
104
|
+
WHEN path LIKE '📆 Meetings/%' THEN 1
|
|
105
|
+
WHEN path LIKE '💡 Insights/%' THEN 1
|
|
106
|
+
WHEN path LIKE '👨💻 People/%' THEN 1
|
|
107
|
+
WHEN path LIKE 'University/%' THEN 1
|
|
108
|
+
WHEN path LIKE 'Copilot/%' THEN 1
|
|
109
|
+
WHEN path LIKE '🗓️ Daily Notes/%' THEN 2
|
|
110
|
+
WHEN path LIKE 'PAI/%' THEN 3
|
|
111
|
+
WHEN path LIKE '09-job-search/%' THEN 4
|
|
112
|
+
WHEN path LIKE 'seriousletter/%' THEN 4
|
|
113
|
+
WHEN path LIKE 'Attachments/%' THEN 5
|
|
114
|
+
ELSE 2
|
|
115
|
+
END, id${limit !== void 0 ? " LIMIT ?" : ""}`).all(...params, ...limit !== void 0 ? [limit] : []);
|
|
116
|
+
}
|
|
117
|
+
async updateEmbedding(chunkId, embedding) {
|
|
118
|
+
this.db.prepare("UPDATE memory_chunks SET embedding = ? WHERE id = ?").run(embedding, chunkId);
|
|
119
|
+
}
|
|
120
|
+
async searchKeyword(query, opts) {
|
|
121
|
+
return searchMemory(this.db, query, opts);
|
|
122
|
+
}
|
|
123
|
+
async searchSemantic(queryEmbedding, opts) {
|
|
124
|
+
return searchMemorySemantic(this.db, queryEmbedding, opts);
|
|
125
|
+
}
|
|
126
|
+
vaultNotSupported() {
|
|
127
|
+
throw new Error("Vault operations require the Postgres backend");
|
|
128
|
+
}
|
|
129
|
+
async upsertVaultFile() {
|
|
130
|
+
this.vaultNotSupported();
|
|
131
|
+
}
|
|
132
|
+
async deleteVaultFile() {
|
|
133
|
+
this.vaultNotSupported();
|
|
134
|
+
}
|
|
135
|
+
async getVaultFile() {
|
|
136
|
+
this.vaultNotSupported();
|
|
137
|
+
}
|
|
138
|
+
async getVaultFileByInode() {
|
|
139
|
+
this.vaultNotSupported();
|
|
140
|
+
}
|
|
141
|
+
async getAllVaultFiles() {
|
|
142
|
+
this.vaultNotSupported();
|
|
143
|
+
}
|
|
144
|
+
async getRecentVaultFiles() {
|
|
145
|
+
this.vaultNotSupported();
|
|
146
|
+
}
|
|
147
|
+
async countVaultFiles() {
|
|
148
|
+
this.vaultNotSupported();
|
|
149
|
+
}
|
|
150
|
+
async upsertVaultAliases() {
|
|
151
|
+
this.vaultNotSupported();
|
|
152
|
+
}
|
|
153
|
+
async deleteVaultAliases() {
|
|
154
|
+
this.vaultNotSupported();
|
|
155
|
+
}
|
|
156
|
+
async replaceLinksForSources() {
|
|
157
|
+
this.vaultNotSupported();
|
|
158
|
+
}
|
|
159
|
+
async getLinksFromSource() {
|
|
160
|
+
this.vaultNotSupported();
|
|
161
|
+
}
|
|
162
|
+
async getLinksToTarget() {
|
|
163
|
+
this.vaultNotSupported();
|
|
164
|
+
}
|
|
165
|
+
async getVaultLinkGraph() {
|
|
166
|
+
this.vaultNotSupported();
|
|
167
|
+
}
|
|
168
|
+
async upsertVaultHealth() {
|
|
169
|
+
this.vaultNotSupported();
|
|
170
|
+
}
|
|
171
|
+
async getVaultHealth() {
|
|
172
|
+
this.vaultNotSupported();
|
|
173
|
+
}
|
|
174
|
+
async getOrphans() {
|
|
175
|
+
this.vaultNotSupported();
|
|
176
|
+
}
|
|
177
|
+
async getDeadLinks() {
|
|
178
|
+
this.vaultNotSupported();
|
|
179
|
+
}
|
|
180
|
+
async upsertNameIndex() {
|
|
181
|
+
this.vaultNotSupported();
|
|
182
|
+
}
|
|
183
|
+
async replaceNameIndex() {
|
|
184
|
+
this.vaultNotSupported();
|
|
185
|
+
}
|
|
186
|
+
async resolveVaultName() {
|
|
187
|
+
this.vaultNotSupported();
|
|
188
|
+
}
|
|
189
|
+
async searchVaultNameIndex() {
|
|
190
|
+
this.vaultNotSupported();
|
|
191
|
+
}
|
|
192
|
+
async getVaultFilesByPaths() {
|
|
193
|
+
this.vaultNotSupported();
|
|
194
|
+
}
|
|
195
|
+
async getVaultFilesByPathsAfter() {
|
|
196
|
+
this.vaultNotSupported();
|
|
197
|
+
}
|
|
198
|
+
async getVaultLinksFromPaths() {
|
|
199
|
+
this.vaultNotSupported();
|
|
200
|
+
}
|
|
201
|
+
async getChunksWithEmbeddings() {
|
|
202
|
+
this.vaultNotSupported();
|
|
203
|
+
}
|
|
204
|
+
async getChunksForPath() {
|
|
205
|
+
this.vaultNotSupported();
|
|
206
|
+
}
|
|
207
|
+
async searchChunksByText() {
|
|
208
|
+
this.vaultNotSupported();
|
|
209
|
+
}
|
|
210
|
+
async countVaultFilesWithPrefix() {
|
|
211
|
+
this.vaultNotSupported();
|
|
212
|
+
}
|
|
213
|
+
async countVaultFilesAfter() {
|
|
214
|
+
this.vaultNotSupported();
|
|
215
|
+
}
|
|
216
|
+
async countVaultLinksWithPrefix() {
|
|
217
|
+
this.vaultNotSupported();
|
|
218
|
+
}
|
|
219
|
+
async countVaultLinksAfter() {
|
|
220
|
+
this.vaultNotSupported();
|
|
221
|
+
}
|
|
222
|
+
async getDeadLinksWithLineNumbers() {
|
|
223
|
+
this.vaultNotSupported();
|
|
224
|
+
}
|
|
225
|
+
async getDeadLinksWithPrefix() {
|
|
226
|
+
this.vaultNotSupported();
|
|
227
|
+
}
|
|
228
|
+
async getDeadLinksAfter() {
|
|
229
|
+
this.vaultNotSupported();
|
|
230
|
+
}
|
|
231
|
+
async getOrphansWithPrefix() {
|
|
232
|
+
this.vaultNotSupported();
|
|
233
|
+
}
|
|
234
|
+
async getOrphansAfter() {
|
|
235
|
+
this.vaultNotSupported();
|
|
236
|
+
}
|
|
237
|
+
async getLowConnectivity() {
|
|
238
|
+
this.vaultNotSupported();
|
|
239
|
+
}
|
|
240
|
+
async getLowConnectivityWithPrefix() {
|
|
241
|
+
this.vaultNotSupported();
|
|
242
|
+
}
|
|
243
|
+
async getLowConnectivityAfter() {
|
|
244
|
+
this.vaultNotSupported();
|
|
245
|
+
}
|
|
246
|
+
async getAllVaultFilePaths() {
|
|
247
|
+
this.vaultNotSupported();
|
|
248
|
+
}
|
|
249
|
+
async getVaultFilePathsWithPrefix() {
|
|
250
|
+
this.vaultNotSupported();
|
|
251
|
+
}
|
|
252
|
+
async getVaultFilePathsAfter() {
|
|
253
|
+
this.vaultNotSupported();
|
|
254
|
+
}
|
|
255
|
+
async getVaultLinkEdges() {
|
|
256
|
+
this.vaultNotSupported();
|
|
257
|
+
}
|
|
258
|
+
async getVaultLinkEdgesWithPrefix() {
|
|
259
|
+
this.vaultNotSupported();
|
|
260
|
+
}
|
|
261
|
+
async getVaultLinkEdgesAfter() {
|
|
262
|
+
this.vaultNotSupported();
|
|
263
|
+
}
|
|
264
|
+
async getVaultAlias() {
|
|
265
|
+
this.vaultNotSupported();
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
export { SQLiteBackend };
|
|
271
|
+
//# sourceMappingURL=sqlite-CZ0LFili.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-CZ0LFili.mjs","names":[],"sources":["../src/storage/sqlite.ts"],"sourcesContent":["/**\n * SQLiteBackend — wraps the existing better-sqlite3 federation.db\n * behind the StorageBackend interface.\n *\n * This is a thin adapter. The heavy lifting is all in the existing\n * memory/indexer.ts and memory/search.ts code; we just provide a\n * backend-agnostic surface so the daemon and tools can call either\n * SQLite or Postgres transparently.\n */\n\nimport type { Database } from \"better-sqlite3\";\nimport type { StorageBackend, ChunkRow, FileRow, FederationStats } from \"./interface.js\";\nimport type { SearchResult, SearchOptions } from \"../memory/search.js\";\nimport { searchMemory, searchMemorySemantic } from \"../memory/search.js\";\n\nexport class SQLiteBackend implements StorageBackend {\n readonly backendType = \"sqlite\" as const;\n\n private db: Database;\n\n constructor(db: Database) {\n this.db = db;\n }\n\n /**\n * Expose the raw better-sqlite3 Database handle.\n * Used by the daemon to pass to indexAll() which still uses the synchronous API directly.\n */\n getRawDb(): Database {\n return this.db;\n }\n\n /**\n * Alias for getRawDb() — used by the dispatcher for operations that require\n * direct SQLite access (e.g. memory_feedback, touchChunksLastAccessed).\n */\n getSqliteDb(): Database {\n return this.db;\n }\n\n // -------------------------------------------------------------------------\n // Lifecycle\n // -------------------------------------------------------------------------\n\n async close(): Promise<void> {\n try {\n this.db.close();\n } catch {\n // ignore\n }\n }\n\n async getStats(): Promise<FederationStats> {\n const files = (\n this.db.prepare(\"SELECT COUNT(*) AS n FROM memory_files\").get() as { n: number }\n ).n;\n const chunks = (\n this.db.prepare(\"SELECT COUNT(*) AS n FROM memory_chunks\").get() as { n: number }\n ).n;\n return { files, chunks };\n }\n\n // -------------------------------------------------------------------------\n // File tracking\n // -------------------------------------------------------------------------\n\n async getFileHash(projectId: number, path: string): Promise<string | undefined> {\n const row = this.db\n .prepare(\"SELECT hash FROM memory_files WHERE project_id = ? AND path = ?\")\n .get(projectId, path) as { hash: string } | undefined;\n return row?.hash;\n }\n\n async upsertFile(file: FileRow): Promise<void> {\n this.db\n .prepare(\n `INSERT INTO memory_files (project_id, path, source, tier, hash, mtime, size)\n VALUES (?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT(project_id, path) DO UPDATE SET\n source = excluded.source,\n tier = excluded.tier,\n hash = excluded.hash,\n mtime = excluded.mtime,\n size = excluded.size`\n )\n .run(file.projectId, file.path, file.source, file.tier, file.hash, file.mtime, file.size);\n }\n\n // -------------------------------------------------------------------------\n // Chunk management\n // -------------------------------------------------------------------------\n\n async getChunkIds(projectId: number, path: string): Promise<string[]> {\n const rows = this.db\n .prepare(\"SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?\")\n .all(projectId, path) as Array<{ id: string }>;\n return rows.map((r) => r.id);\n }\n\n async deleteChunksForFile(projectId: number, path: string): Promise<void> {\n const ids = await this.getChunkIds(projectId, path);\n const deleteFts = this.db.prepare(\"DELETE FROM memory_fts WHERE id = ?\");\n const deleteChunks = this.db.prepare(\n \"DELETE FROM memory_chunks WHERE project_id = ? AND path = ?\"\n );\n this.db.transaction(() => {\n for (const id of ids) {\n deleteFts.run(id);\n }\n deleteChunks.run(projectId, path);\n })();\n }\n\n async insertChunks(chunks: ChunkRow[]): Promise<void> {\n if (chunks.length === 0) return;\n\n const insertChunk = this.db.prepare(\n `INSERT INTO memory_chunks (id, project_id, source, tier, path, start_line, end_line, hash, text, updated_at)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`\n );\n const insertFts = this.db.prepare(\n `INSERT INTO memory_fts (text, id, project_id, path, source, tier, start_line, end_line)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?)`\n );\n\n this.db.transaction(() => {\n for (const c of chunks) {\n insertChunk.run(\n c.id,\n c.projectId,\n c.source,\n c.tier,\n c.path,\n c.startLine,\n c.endLine,\n c.hash,\n c.text,\n c.updatedAt\n );\n insertFts.run(\n c.text,\n c.id,\n c.projectId,\n c.path,\n c.source,\n c.tier,\n c.startLine,\n c.endLine\n );\n }\n })();\n }\n\n async getDistinctChunkPaths(projectId: number): Promise<string[]> {\n const rows = this.db\n .prepare(\"SELECT DISTINCT path FROM memory_chunks WHERE project_id = ?\")\n .all(projectId) as Array<{ path: string }>;\n return rows.map((r) => r.path);\n }\n\n async deletePaths(projectId: number, paths: string[]): Promise<void> {\n if (paths.length === 0) return;\n const deleteFts = this.db.prepare(\"DELETE FROM memory_fts WHERE id = ?\");\n const deleteChunks = this.db.prepare(\n \"DELETE FROM memory_chunks WHERE project_id = ? AND path = ?\"\n );\n const deleteFile = this.db.prepare(\n \"DELETE FROM memory_files WHERE project_id = ? AND path = ?\"\n );\n this.db.transaction(() => {\n for (const path of paths) {\n const ids = this.db\n .prepare(\"SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?\")\n .all(projectId, path) as Array<{ id: string }>;\n for (const { id } of ids) {\n deleteFts.run(id);\n }\n deleteChunks.run(projectId, path);\n deleteFile.run(projectId, path);\n }\n })();\n }\n\n async getUnembeddedChunkIds(projectId?: number, limit?: number): Promise<Array<{ id: string; text: string; project_id: number; path: string }>> {\n const conditions = [\"embedding IS NULL\"];\n const params: (string | number)[] = [];\n\n if (projectId !== undefined) {\n conditions.push(\"project_id = ?\");\n params.push(projectId);\n }\n\n const where = \"WHERE \" + conditions.join(\" AND \");\n // Prioritize real knowledge notes over PAI session/job-search noise.\n // CASE expression assigns lower priority numbers to knowledge paths.\n const rows = this.db\n .prepare(`SELECT id, text, project_id, path FROM memory_chunks ${where}\n ORDER BY CASE\n WHEN path LIKE '🧠 Ideaverse/%' THEN 0\n WHEN path LIKE 'Z - Zettelkasten/%' THEN 0\n WHEN path LIKE '💼 Business/%' THEN 0\n WHEN path LIKE '📆 Meetings/%' THEN 1\n WHEN path LIKE '💡 Insights/%' THEN 1\n WHEN path LIKE '👨💻 People/%' THEN 1\n WHEN path LIKE 'University/%' THEN 1\n WHEN path LIKE 'Copilot/%' THEN 1\n WHEN path LIKE '🗓️ Daily Notes/%' THEN 2\n WHEN path LIKE 'PAI/%' THEN 3\n WHEN path LIKE '09-job-search/%' THEN 4\n WHEN path LIKE 'seriousletter/%' THEN 4\n WHEN path LIKE 'Attachments/%' THEN 5\n ELSE 2\n END, id${limit !== undefined ? \" LIMIT ?\" : \"\"}`)\n .all(...params, ...(limit !== undefined ? [limit] : [])) as Array<{ id: string; text: string; project_id: number; path: string }>;\n return rows;\n }\n\n async updateEmbedding(chunkId: string, embedding: Buffer): Promise<void> {\n this.db\n .prepare(\"UPDATE memory_chunks SET embedding = ? WHERE id = ?\")\n .run(embedding, chunkId);\n }\n\n // -------------------------------------------------------------------------\n // Search\n // -------------------------------------------------------------------------\n\n async searchKeyword(query: string, opts?: SearchOptions): Promise<SearchResult[]> {\n return searchMemory(this.db, query, opts);\n }\n\n async searchSemantic(queryEmbedding: Float32Array, opts?: SearchOptions): Promise<SearchResult[]> {\n return searchMemorySemantic(this.db, queryEmbedding, opts);\n }\n\n // -------------------------------------------------------------------------\n // Vault operations — not supported on SQLite backend (use Postgres)\n // -------------------------------------------------------------------------\n\n private vaultNotSupported(): never {\n throw new Error(\"Vault operations require the Postgres backend\");\n }\n\n async upsertVaultFile(): Promise<void> { this.vaultNotSupported(); }\n async deleteVaultFile(): Promise<void> { this.vaultNotSupported(); }\n async getVaultFile(): Promise<null> { this.vaultNotSupported(); }\n async getVaultFileByInode(): Promise<null> { this.vaultNotSupported(); }\n async getAllVaultFiles(): Promise<never[]> { this.vaultNotSupported(); }\n async getRecentVaultFiles(): Promise<never[]> { this.vaultNotSupported(); }\n async countVaultFiles(): Promise<number> { this.vaultNotSupported(); }\n async upsertVaultAliases(): Promise<void> { this.vaultNotSupported(); }\n async deleteVaultAliases(): Promise<void> { this.vaultNotSupported(); }\n async replaceLinksForSources(): Promise<void> { this.vaultNotSupported(); }\n async getLinksFromSource(): Promise<never[]> { this.vaultNotSupported(); }\n async getLinksToTarget(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkGraph(): Promise<never[]> { this.vaultNotSupported(); }\n async upsertVaultHealth(): Promise<void> { this.vaultNotSupported(); }\n async getVaultHealth(): Promise<null> { this.vaultNotSupported(); }\n async getOrphans(): Promise<never[]> { this.vaultNotSupported(); }\n async getDeadLinks(): Promise<never[]> { this.vaultNotSupported(); }\n async upsertNameIndex(): Promise<void> { this.vaultNotSupported(); }\n async replaceNameIndex(): Promise<void> { this.vaultNotSupported(); }\n async resolveVaultName(): Promise<never[]> { this.vaultNotSupported(); }\n async searchVaultNameIndex(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilesByPaths(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilesByPathsAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinksFromPaths(): Promise<never[]> { this.vaultNotSupported(); }\n async getChunksWithEmbeddings(): Promise<never[]> { this.vaultNotSupported(); }\n async getChunksForPath(): Promise<never[]> { this.vaultNotSupported(); }\n async searchChunksByText(): Promise<never[]> { this.vaultNotSupported(); }\n async countVaultFilesWithPrefix(): Promise<number> { this.vaultNotSupported(); }\n async countVaultFilesAfter(): Promise<number> { this.vaultNotSupported(); }\n async countVaultLinksWithPrefix(): Promise<number> { this.vaultNotSupported(); }\n async countVaultLinksAfter(): Promise<number> { this.vaultNotSupported(); }\n async getDeadLinksWithLineNumbers(): Promise<never[]> { this.vaultNotSupported(); }\n async getDeadLinksWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getDeadLinksAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getOrphansWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getOrphansAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getLowConnectivity(): Promise<never[]> { this.vaultNotSupported(); }\n async getLowConnectivityWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getLowConnectivityAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getAllVaultFilePaths(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilePathsWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilePathsAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkEdges(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkEdgesWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkEdgesAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultAlias(): Promise<null> { this.vaultNotSupported(); }\n}\n"],"mappings":";;;;AAeA,IAAa,gBAAb,MAAqD;CACn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8C;AAAE,OAAK,mBAAmB;;CAC9E,MAAM,yBAA2C;AAAE,OAAK,mBAAmB;;CAC3E,MAAM,0BAA4C;AAAE,OAAK,mBAAmB;;CAC5E,MAAM,mBAAqC;AAAE,OAAK,mBAAmB;;CACrE,MAAM,qBAAuC;AAAE,OAAK,mBAAmB;;CACvE,MAAM,4BAA6C;AAAE,OAAK,mBAAmB;;CAC7E,MAAM,uBAAwC;AAAE,OAAK,mBAAmB;;CACxE,MAAM,4BAA6C;AAAE,OAAK,mBAAmB;;CAC7E,MAAM,uBAAwC;AAAE,OAAK,mBAAmB;;CACxE,MAAM,8BAAgD;AAAE,OAAK,mBAAmB;;CAChF,MAAM,yBAA2C;AAAE,OAAK,mBAAmB;;CAC3E,MAAM,oBAAsC;AAAE,OAAK,mBAAmB;;CACtE,MAAM,uBAAyC;AAAE,OAAK,mBAAmB;;CACzE,MAAM,kBAAoC;AAAE,OAAK,mBAAmB;;CACpE,MAAM,qBAAuC;AAAE,OAAK,mBAAmB;;CACvE,MAAM,+BAAiD;AAAE,OAAK,mBAAmB;;CACjF,MAAM,0BAA4C;AAAE,OAAK,mBAAmB;;CAC5E,MAAM,uBAAyC;AAAE,OAAK,mBAAmB;;CACzE,MAAM,8BAAgD;AAAE,OAAK,mBAAmB;;CAChF,MAAM,yBAA2C;AAAE,OAAK,mBAAmB;;CAC3E,MAAM,oBAAsC;AAAE,OAAK,mBAAmB;;CACtE,MAAM,8BAAgD;AAAE,OAAK,mBAAmB;;CAChF,MAAM,yBAA2C;AAAE,OAAK,mBAAmB;;CAC3E,MAAM,gBAA+B;AAAE,OAAK,mBAAmB"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import "./embeddings-DGRAPAYb.mjs";
|
|
2
|
+
import { a as searchMemorySemantic, r as searchMemory } from "./search-i2nlQ-JM.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/sqlite.ts
|
|
5
|
+
var SQLiteBackend = class {
|
|
6
|
+
backendType = "sqlite";
|
|
7
|
+
db;
|
|
8
|
+
constructor(db) {
|
|
9
|
+
this.db = db;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Expose the raw better-sqlite3 Database handle.
|
|
13
|
+
* Used by the daemon to pass to indexAll() which still uses the synchronous API directly.
|
|
14
|
+
*/
|
|
15
|
+
getRawDb() {
|
|
16
|
+
return this.db;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Alias for getRawDb() — used by the dispatcher for operations that require
|
|
20
|
+
* direct SQLite access (e.g. memory_feedback, touchChunksLastAccessed).
|
|
21
|
+
*/
|
|
22
|
+
getSqliteDb() {
|
|
23
|
+
return this.db;
|
|
24
|
+
}
|
|
25
|
+
async close() {
|
|
26
|
+
try {
|
|
27
|
+
this.db.close();
|
|
28
|
+
} catch {}
|
|
29
|
+
}
|
|
30
|
+
async getStats() {
|
|
31
|
+
return {
|
|
32
|
+
files: this.db.prepare("SELECT COUNT(*) AS n FROM memory_files").get().n,
|
|
33
|
+
chunks: this.db.prepare("SELECT COUNT(*) AS n FROM memory_chunks").get().n
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async getFileHash(projectId, path) {
|
|
37
|
+
return this.db.prepare("SELECT hash FROM memory_files WHERE project_id = ? AND path = ?").get(projectId, path)?.hash;
|
|
38
|
+
}
|
|
39
|
+
async upsertFile(file) {
|
|
40
|
+
this.db.prepare(`INSERT INTO memory_files (project_id, path, source, tier, hash, mtime, size)
|
|
41
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
42
|
+
ON CONFLICT(project_id, path) DO UPDATE SET
|
|
43
|
+
source = excluded.source,
|
|
44
|
+
tier = excluded.tier,
|
|
45
|
+
hash = excluded.hash,
|
|
46
|
+
mtime = excluded.mtime,
|
|
47
|
+
size = excluded.size`).run(file.projectId, file.path, file.source, file.tier, file.hash, file.mtime, file.size);
|
|
48
|
+
}
|
|
49
|
+
async getChunkIds(projectId, path) {
|
|
50
|
+
return this.db.prepare("SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?").all(projectId, path).map((r) => r.id);
|
|
51
|
+
}
|
|
52
|
+
async deleteChunksForFile(projectId, path) {
|
|
53
|
+
const ids = await this.getChunkIds(projectId, path);
|
|
54
|
+
const deleteFts = this.db.prepare("DELETE FROM memory_fts WHERE id = ?");
|
|
55
|
+
const deleteChunks = this.db.prepare("DELETE FROM memory_chunks WHERE project_id = ? AND path = ?");
|
|
56
|
+
this.db.transaction(() => {
|
|
57
|
+
for (const id of ids) deleteFts.run(id);
|
|
58
|
+
deleteChunks.run(projectId, path);
|
|
59
|
+
})();
|
|
60
|
+
}
|
|
61
|
+
async insertChunks(chunks) {
|
|
62
|
+
if (chunks.length === 0) return;
|
|
63
|
+
const insertChunk = this.db.prepare(`INSERT INTO memory_chunks (id, project_id, source, tier, path, start_line, end_line, hash, text, updated_at)
|
|
64
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
65
|
+
const insertFts = this.db.prepare(`INSERT INTO memory_fts (text, id, project_id, path, source, tier, start_line, end_line)
|
|
66
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
67
|
+
this.db.transaction(() => {
|
|
68
|
+
for (const c of chunks) {
|
|
69
|
+
insertChunk.run(c.id, c.projectId, c.source, c.tier, c.path, c.startLine, c.endLine, c.hash, c.text, c.updatedAt);
|
|
70
|
+
insertFts.run(c.text, c.id, c.projectId, c.path, c.source, c.tier, c.startLine, c.endLine);
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
}
|
|
74
|
+
async getDistinctChunkPaths(projectId) {
|
|
75
|
+
return this.db.prepare("SELECT DISTINCT path FROM memory_chunks WHERE project_id = ?").all(projectId).map((r) => r.path);
|
|
76
|
+
}
|
|
77
|
+
async deletePaths(projectId, paths) {
|
|
78
|
+
if (paths.length === 0) return;
|
|
79
|
+
const deleteFts = this.db.prepare("DELETE FROM memory_fts WHERE id = ?");
|
|
80
|
+
const deleteChunks = this.db.prepare("DELETE FROM memory_chunks WHERE project_id = ? AND path = ?");
|
|
81
|
+
const deleteFile = this.db.prepare("DELETE FROM memory_files WHERE project_id = ? AND path = ?");
|
|
82
|
+
this.db.transaction(() => {
|
|
83
|
+
for (const path of paths) {
|
|
84
|
+
const ids = this.db.prepare("SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?").all(projectId, path);
|
|
85
|
+
for (const { id } of ids) deleteFts.run(id);
|
|
86
|
+
deleteChunks.run(projectId, path);
|
|
87
|
+
deleteFile.run(projectId, path);
|
|
88
|
+
}
|
|
89
|
+
})();
|
|
90
|
+
}
|
|
91
|
+
async getUnembeddedChunkIds(projectId, limit) {
|
|
92
|
+
const conditions = ["embedding IS NULL"];
|
|
93
|
+
const params = [];
|
|
94
|
+
if (projectId !== void 0) {
|
|
95
|
+
conditions.push("project_id = ?");
|
|
96
|
+
params.push(projectId);
|
|
97
|
+
}
|
|
98
|
+
const where = "WHERE " + conditions.join(" AND ");
|
|
99
|
+
return this.db.prepare(`SELECT id, text, project_id, path FROM memory_chunks ${where}
|
|
100
|
+
ORDER BY CASE
|
|
101
|
+
WHEN path LIKE '🧠 Ideaverse/%' THEN 0
|
|
102
|
+
WHEN path LIKE 'Z - Zettelkasten/%' THEN 0
|
|
103
|
+
WHEN path LIKE '💼 Business/%' THEN 0
|
|
104
|
+
WHEN path LIKE '📆 Meetings/%' THEN 1
|
|
105
|
+
WHEN path LIKE '💡 Insights/%' THEN 1
|
|
106
|
+
WHEN path LIKE '👨💻 People/%' THEN 1
|
|
107
|
+
WHEN path LIKE 'University/%' THEN 1
|
|
108
|
+
WHEN path LIKE 'Copilot/%' THEN 1
|
|
109
|
+
WHEN path LIKE '🗓️ Daily Notes/%' THEN 2
|
|
110
|
+
WHEN path LIKE 'PAI/%' THEN 3
|
|
111
|
+
WHEN path LIKE '09-job-search/%' THEN 4
|
|
112
|
+
WHEN path LIKE 'seriousletter/%' THEN 4
|
|
113
|
+
WHEN path LIKE 'Attachments/%' THEN 5
|
|
114
|
+
ELSE 2
|
|
115
|
+
END, id${limit !== void 0 ? " LIMIT ?" : ""}`).all(...params, ...limit !== void 0 ? [limit] : []);
|
|
116
|
+
}
|
|
117
|
+
async updateEmbedding(chunkId, embedding) {
|
|
118
|
+
this.db.prepare("UPDATE memory_chunks SET embedding = ? WHERE id = ?").run(embedding, chunkId);
|
|
119
|
+
}
|
|
120
|
+
async searchKeyword(query, opts) {
|
|
121
|
+
return searchMemory(this.db, query, opts);
|
|
122
|
+
}
|
|
123
|
+
async searchSemantic(queryEmbedding, opts) {
|
|
124
|
+
return searchMemorySemantic(this.db, queryEmbedding, opts);
|
|
125
|
+
}
|
|
126
|
+
vaultNotSupported() {
|
|
127
|
+
throw new Error("Vault operations require the Postgres backend");
|
|
128
|
+
}
|
|
129
|
+
async upsertVaultFile() {
|
|
130
|
+
this.vaultNotSupported();
|
|
131
|
+
}
|
|
132
|
+
async deleteVaultFile() {
|
|
133
|
+
this.vaultNotSupported();
|
|
134
|
+
}
|
|
135
|
+
async getVaultFile() {
|
|
136
|
+
this.vaultNotSupported();
|
|
137
|
+
}
|
|
138
|
+
async getVaultFileByInode() {
|
|
139
|
+
this.vaultNotSupported();
|
|
140
|
+
}
|
|
141
|
+
async getAllVaultFiles() {
|
|
142
|
+
this.vaultNotSupported();
|
|
143
|
+
}
|
|
144
|
+
async getRecentVaultFiles() {
|
|
145
|
+
this.vaultNotSupported();
|
|
146
|
+
}
|
|
147
|
+
async countVaultFiles() {
|
|
148
|
+
this.vaultNotSupported();
|
|
149
|
+
}
|
|
150
|
+
async upsertVaultAliases() {
|
|
151
|
+
this.vaultNotSupported();
|
|
152
|
+
}
|
|
153
|
+
async deleteVaultAliases() {
|
|
154
|
+
this.vaultNotSupported();
|
|
155
|
+
}
|
|
156
|
+
async replaceLinksForSources() {
|
|
157
|
+
this.vaultNotSupported();
|
|
158
|
+
}
|
|
159
|
+
async getLinksFromSource() {
|
|
160
|
+
this.vaultNotSupported();
|
|
161
|
+
}
|
|
162
|
+
async getLinksToTarget() {
|
|
163
|
+
this.vaultNotSupported();
|
|
164
|
+
}
|
|
165
|
+
async getVaultLinkGraph() {
|
|
166
|
+
this.vaultNotSupported();
|
|
167
|
+
}
|
|
168
|
+
async upsertVaultHealth() {
|
|
169
|
+
this.vaultNotSupported();
|
|
170
|
+
}
|
|
171
|
+
async getVaultHealth() {
|
|
172
|
+
this.vaultNotSupported();
|
|
173
|
+
}
|
|
174
|
+
async getOrphans() {
|
|
175
|
+
this.vaultNotSupported();
|
|
176
|
+
}
|
|
177
|
+
async getDeadLinks() {
|
|
178
|
+
this.vaultNotSupported();
|
|
179
|
+
}
|
|
180
|
+
async upsertNameIndex() {
|
|
181
|
+
this.vaultNotSupported();
|
|
182
|
+
}
|
|
183
|
+
async replaceNameIndex() {
|
|
184
|
+
this.vaultNotSupported();
|
|
185
|
+
}
|
|
186
|
+
async resolveVaultName() {
|
|
187
|
+
this.vaultNotSupported();
|
|
188
|
+
}
|
|
189
|
+
async searchVaultNameIndex() {
|
|
190
|
+
this.vaultNotSupported();
|
|
191
|
+
}
|
|
192
|
+
async getVaultFilesByPaths() {
|
|
193
|
+
this.vaultNotSupported();
|
|
194
|
+
}
|
|
195
|
+
async getVaultFilesByPathsAfter() {
|
|
196
|
+
this.vaultNotSupported();
|
|
197
|
+
}
|
|
198
|
+
async getVaultLinksFromPaths() {
|
|
199
|
+
this.vaultNotSupported();
|
|
200
|
+
}
|
|
201
|
+
async getChunksWithEmbeddings() {
|
|
202
|
+
this.vaultNotSupported();
|
|
203
|
+
}
|
|
204
|
+
async getChunksForPath() {
|
|
205
|
+
this.vaultNotSupported();
|
|
206
|
+
}
|
|
207
|
+
async searchChunksByText() {
|
|
208
|
+
this.vaultNotSupported();
|
|
209
|
+
}
|
|
210
|
+
async countVaultFilesWithPrefix() {
|
|
211
|
+
this.vaultNotSupported();
|
|
212
|
+
}
|
|
213
|
+
async countVaultFilesAfter() {
|
|
214
|
+
this.vaultNotSupported();
|
|
215
|
+
}
|
|
216
|
+
async countVaultLinksWithPrefix() {
|
|
217
|
+
this.vaultNotSupported();
|
|
218
|
+
}
|
|
219
|
+
async countVaultLinksAfter() {
|
|
220
|
+
this.vaultNotSupported();
|
|
221
|
+
}
|
|
222
|
+
async getDeadLinksWithLineNumbers() {
|
|
223
|
+
this.vaultNotSupported();
|
|
224
|
+
}
|
|
225
|
+
async getDeadLinksWithPrefix() {
|
|
226
|
+
this.vaultNotSupported();
|
|
227
|
+
}
|
|
228
|
+
async getDeadLinksAfter() {
|
|
229
|
+
this.vaultNotSupported();
|
|
230
|
+
}
|
|
231
|
+
async getOrphansWithPrefix() {
|
|
232
|
+
this.vaultNotSupported();
|
|
233
|
+
}
|
|
234
|
+
async getOrphansAfter() {
|
|
235
|
+
this.vaultNotSupported();
|
|
236
|
+
}
|
|
237
|
+
async getLowConnectivity() {
|
|
238
|
+
this.vaultNotSupported();
|
|
239
|
+
}
|
|
240
|
+
async getLowConnectivityWithPrefix() {
|
|
241
|
+
this.vaultNotSupported();
|
|
242
|
+
}
|
|
243
|
+
async getLowConnectivityAfter() {
|
|
244
|
+
this.vaultNotSupported();
|
|
245
|
+
}
|
|
246
|
+
async getAllVaultFilePaths() {
|
|
247
|
+
this.vaultNotSupported();
|
|
248
|
+
}
|
|
249
|
+
async getVaultFilePathsWithPrefix() {
|
|
250
|
+
this.vaultNotSupported();
|
|
251
|
+
}
|
|
252
|
+
async getVaultFilePathsAfter() {
|
|
253
|
+
this.vaultNotSupported();
|
|
254
|
+
}
|
|
255
|
+
async getVaultLinkEdges() {
|
|
256
|
+
this.vaultNotSupported();
|
|
257
|
+
}
|
|
258
|
+
async getVaultLinkEdgesWithPrefix() {
|
|
259
|
+
this.vaultNotSupported();
|
|
260
|
+
}
|
|
261
|
+
async getVaultLinkEdgesAfter() {
|
|
262
|
+
this.vaultNotSupported();
|
|
263
|
+
}
|
|
264
|
+
async getVaultAlias() {
|
|
265
|
+
this.vaultNotSupported();
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
export { SQLiteBackend };
|
|
271
|
+
//# sourceMappingURL=sqlite-Nw8ZW5Rj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-Nw8ZW5Rj.mjs","names":[],"sources":["../src/storage/sqlite.ts"],"sourcesContent":["/**\n * SQLiteBackend — wraps the existing better-sqlite3 federation.db\n * behind the StorageBackend interface.\n *\n * This is a thin adapter. The heavy lifting is all in the existing\n * memory/indexer.ts and memory/search.ts code; we just provide a\n * backend-agnostic surface so the daemon and tools can call either\n * SQLite or Postgres transparently.\n */\n\nimport type { Database } from \"better-sqlite3\";\nimport type { StorageBackend, ChunkRow, FileRow, FederationStats } from \"./interface.js\";\nimport type { SearchResult, SearchOptions } from \"../memory/search.js\";\nimport { searchMemory, searchMemorySemantic } from \"../memory/search.js\";\n\nexport class SQLiteBackend implements StorageBackend {\n readonly backendType = \"sqlite\" as const;\n\n private db: Database;\n\n constructor(db: Database) {\n this.db = db;\n }\n\n /**\n * Expose the raw better-sqlite3 Database handle.\n * Used by the daemon to pass to indexAll() which still uses the synchronous API directly.\n */\n getRawDb(): Database {\n return this.db;\n }\n\n /**\n * Alias for getRawDb() — used by the dispatcher for operations that require\n * direct SQLite access (e.g. memory_feedback, touchChunksLastAccessed).\n */\n getSqliteDb(): Database {\n return this.db;\n }\n\n // -------------------------------------------------------------------------\n // Lifecycle\n // -------------------------------------------------------------------------\n\n async close(): Promise<void> {\n try {\n this.db.close();\n } catch {\n // ignore\n }\n }\n\n async getStats(): Promise<FederationStats> {\n const files = (\n this.db.prepare(\"SELECT COUNT(*) AS n FROM memory_files\").get() as { n: number }\n ).n;\n const chunks = (\n this.db.prepare(\"SELECT COUNT(*) AS n FROM memory_chunks\").get() as { n: number }\n ).n;\n return { files, chunks };\n }\n\n // -------------------------------------------------------------------------\n // File tracking\n // -------------------------------------------------------------------------\n\n async getFileHash(projectId: number, path: string): Promise<string | undefined> {\n const row = this.db\n .prepare(\"SELECT hash FROM memory_files WHERE project_id = ? AND path = ?\")\n .get(projectId, path) as { hash: string } | undefined;\n return row?.hash;\n }\n\n async upsertFile(file: FileRow): Promise<void> {\n this.db\n .prepare(\n `INSERT INTO memory_files (project_id, path, source, tier, hash, mtime, size)\n VALUES (?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT(project_id, path) DO UPDATE SET\n source = excluded.source,\n tier = excluded.tier,\n hash = excluded.hash,\n mtime = excluded.mtime,\n size = excluded.size`\n )\n .run(file.projectId, file.path, file.source, file.tier, file.hash, file.mtime, file.size);\n }\n\n // -------------------------------------------------------------------------\n // Chunk management\n // -------------------------------------------------------------------------\n\n async getChunkIds(projectId: number, path: string): Promise<string[]> {\n const rows = this.db\n .prepare(\"SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?\")\n .all(projectId, path) as Array<{ id: string }>;\n return rows.map((r) => r.id);\n }\n\n async deleteChunksForFile(projectId: number, path: string): Promise<void> {\n const ids = await this.getChunkIds(projectId, path);\n const deleteFts = this.db.prepare(\"DELETE FROM memory_fts WHERE id = ?\");\n const deleteChunks = this.db.prepare(\n \"DELETE FROM memory_chunks WHERE project_id = ? AND path = ?\"\n );\n this.db.transaction(() => {\n for (const id of ids) {\n deleteFts.run(id);\n }\n deleteChunks.run(projectId, path);\n })();\n }\n\n async insertChunks(chunks: ChunkRow[]): Promise<void> {\n if (chunks.length === 0) return;\n\n const insertChunk = this.db.prepare(\n `INSERT INTO memory_chunks (id, project_id, source, tier, path, start_line, end_line, hash, text, updated_at)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`\n );\n const insertFts = this.db.prepare(\n `INSERT INTO memory_fts (text, id, project_id, path, source, tier, start_line, end_line)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?)`\n );\n\n this.db.transaction(() => {\n for (const c of chunks) {\n insertChunk.run(\n c.id,\n c.projectId,\n c.source,\n c.tier,\n c.path,\n c.startLine,\n c.endLine,\n c.hash,\n c.text,\n c.updatedAt\n );\n insertFts.run(\n c.text,\n c.id,\n c.projectId,\n c.path,\n c.source,\n c.tier,\n c.startLine,\n c.endLine\n );\n }\n })();\n }\n\n async getDistinctChunkPaths(projectId: number): Promise<string[]> {\n const rows = this.db\n .prepare(\"SELECT DISTINCT path FROM memory_chunks WHERE project_id = ?\")\n .all(projectId) as Array<{ path: string }>;\n return rows.map((r) => r.path);\n }\n\n async deletePaths(projectId: number, paths: string[]): Promise<void> {\n if (paths.length === 0) return;\n const deleteFts = this.db.prepare(\"DELETE FROM memory_fts WHERE id = ?\");\n const deleteChunks = this.db.prepare(\n \"DELETE FROM memory_chunks WHERE project_id = ? AND path = ?\"\n );\n const deleteFile = this.db.prepare(\n \"DELETE FROM memory_files WHERE project_id = ? AND path = ?\"\n );\n this.db.transaction(() => {\n for (const path of paths) {\n const ids = this.db\n .prepare(\"SELECT id FROM memory_chunks WHERE project_id = ? AND path = ?\")\n .all(projectId, path) as Array<{ id: string }>;\n for (const { id } of ids) {\n deleteFts.run(id);\n }\n deleteChunks.run(projectId, path);\n deleteFile.run(projectId, path);\n }\n })();\n }\n\n async getUnembeddedChunkIds(projectId?: number, limit?: number): Promise<Array<{ id: string; text: string; project_id: number; path: string }>> {\n const conditions = [\"embedding IS NULL\"];\n const params: (string | number)[] = [];\n\n if (projectId !== undefined) {\n conditions.push(\"project_id = ?\");\n params.push(projectId);\n }\n\n const where = \"WHERE \" + conditions.join(\" AND \");\n // Prioritize real knowledge notes over PAI session/job-search noise.\n // CASE expression assigns lower priority numbers to knowledge paths.\n const rows = this.db\n .prepare(`SELECT id, text, project_id, path FROM memory_chunks ${where}\n ORDER BY CASE\n WHEN path LIKE '🧠 Ideaverse/%' THEN 0\n WHEN path LIKE 'Z - Zettelkasten/%' THEN 0\n WHEN path LIKE '💼 Business/%' THEN 0\n WHEN path LIKE '📆 Meetings/%' THEN 1\n WHEN path LIKE '💡 Insights/%' THEN 1\n WHEN path LIKE '👨💻 People/%' THEN 1\n WHEN path LIKE 'University/%' THEN 1\n WHEN path LIKE 'Copilot/%' THEN 1\n WHEN path LIKE '🗓️ Daily Notes/%' THEN 2\n WHEN path LIKE 'PAI/%' THEN 3\n WHEN path LIKE '09-job-search/%' THEN 4\n WHEN path LIKE 'seriousletter/%' THEN 4\n WHEN path LIKE 'Attachments/%' THEN 5\n ELSE 2\n END, id${limit !== undefined ? \" LIMIT ?\" : \"\"}`)\n .all(...params, ...(limit !== undefined ? [limit] : [])) as Array<{ id: string; text: string; project_id: number; path: string }>;\n return rows;\n }\n\n async updateEmbedding(chunkId: string, embedding: Buffer): Promise<void> {\n this.db\n .prepare(\"UPDATE memory_chunks SET embedding = ? WHERE id = ?\")\n .run(embedding, chunkId);\n }\n\n // -------------------------------------------------------------------------\n // Search\n // -------------------------------------------------------------------------\n\n async searchKeyword(query: string, opts?: SearchOptions): Promise<SearchResult[]> {\n return searchMemory(this.db, query, opts);\n }\n\n async searchSemantic(queryEmbedding: Float32Array, opts?: SearchOptions): Promise<SearchResult[]> {\n return searchMemorySemantic(this.db, queryEmbedding, opts);\n }\n\n // -------------------------------------------------------------------------\n // Vault operations — not supported on SQLite backend (use Postgres)\n // -------------------------------------------------------------------------\n\n private vaultNotSupported(): never {\n throw new Error(\"Vault operations require the Postgres backend\");\n }\n\n async upsertVaultFile(): Promise<void> { this.vaultNotSupported(); }\n async deleteVaultFile(): Promise<void> { this.vaultNotSupported(); }\n async getVaultFile(): Promise<null> { this.vaultNotSupported(); }\n async getVaultFileByInode(): Promise<null> { this.vaultNotSupported(); }\n async getAllVaultFiles(): Promise<never[]> { this.vaultNotSupported(); }\n async getRecentVaultFiles(): Promise<never[]> { this.vaultNotSupported(); }\n async countVaultFiles(): Promise<number> { this.vaultNotSupported(); }\n async upsertVaultAliases(): Promise<void> { this.vaultNotSupported(); }\n async deleteVaultAliases(): Promise<void> { this.vaultNotSupported(); }\n async replaceLinksForSources(): Promise<void> { this.vaultNotSupported(); }\n async getLinksFromSource(): Promise<never[]> { this.vaultNotSupported(); }\n async getLinksToTarget(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkGraph(): Promise<never[]> { this.vaultNotSupported(); }\n async upsertVaultHealth(): Promise<void> { this.vaultNotSupported(); }\n async getVaultHealth(): Promise<null> { this.vaultNotSupported(); }\n async getOrphans(): Promise<never[]> { this.vaultNotSupported(); }\n async getDeadLinks(): Promise<never[]> { this.vaultNotSupported(); }\n async upsertNameIndex(): Promise<void> { this.vaultNotSupported(); }\n async replaceNameIndex(): Promise<void> { this.vaultNotSupported(); }\n async resolveVaultName(): Promise<never[]> { this.vaultNotSupported(); }\n async searchVaultNameIndex(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilesByPaths(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilesByPathsAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinksFromPaths(): Promise<never[]> { this.vaultNotSupported(); }\n async getChunksWithEmbeddings(): Promise<never[]> { this.vaultNotSupported(); }\n async getChunksForPath(): Promise<never[]> { this.vaultNotSupported(); }\n async searchChunksByText(): Promise<never[]> { this.vaultNotSupported(); }\n async countVaultFilesWithPrefix(): Promise<number> { this.vaultNotSupported(); }\n async countVaultFilesAfter(): Promise<number> { this.vaultNotSupported(); }\n async countVaultLinksWithPrefix(): Promise<number> { this.vaultNotSupported(); }\n async countVaultLinksAfter(): Promise<number> { this.vaultNotSupported(); }\n async getDeadLinksWithLineNumbers(): Promise<never[]> { this.vaultNotSupported(); }\n async getDeadLinksWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getDeadLinksAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getOrphansWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getOrphansAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getLowConnectivity(): Promise<never[]> { this.vaultNotSupported(); }\n async getLowConnectivityWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getLowConnectivityAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getAllVaultFilePaths(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilePathsWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultFilePathsAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkEdges(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkEdgesWithPrefix(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultLinkEdgesAfter(): Promise<never[]> { this.vaultNotSupported(); }\n async getVaultAlias(): Promise<null> { this.vaultNotSupported(); }\n}\n"],"mappings":";;;;AAeA,IAAa,gBAAb,MAAqD;CACnD,AAAS,cAAc;CAEvB,AAAQ;CAER,YAAY,IAAc;AACxB,OAAK,KAAK;;;;;;CAOZ,WAAqB;AACnB,SAAO,KAAK;;;;;;CAOd,cAAwB;AACtB,SAAO,KAAK;;CAOd,MAAM,QAAuB;AAC3B,MAAI;AACF,QAAK,GAAG,OAAO;UACT;;CAKV,MAAM,WAAqC;AAOzC,SAAO;GAAE,OALP,KAAK,GAAG,QAAQ,yCAAyC,CAAC,KAAK,CAC/D;GAIc,QAFd,KAAK,GAAG,QAAQ,0CAA0C,CAAC,KAAK,CAChE;GACsB;;CAO1B,MAAM,YAAY,WAAmB,MAA2C;AAI9E,SAHY,KAAK,GACd,QAAQ,kEAAkE,CAC1E,IAAI,WAAW,KAAK,EACX;;CAGd,MAAM,WAAW,MAA8B;AAC7C,OAAK,GACF,QACC;;;;;;;mCAQD,CACA,IAAI,KAAK,WAAW,KAAK,MAAM,KAAK,QAAQ,KAAK,MAAM,KAAK,MAAM,KAAK,OAAO,KAAK,KAAK;;CAO7F,MAAM,YAAY,WAAmB,MAAiC;AAIpE,SAHa,KAAK,GACf,QAAQ,iEAAiE,CACzE,IAAI,WAAW,KAAK,CACX,KAAK,MAAM,EAAE,GAAG;;CAG9B,MAAM,oBAAoB,WAAmB,MAA6B;EACxE,MAAM,MAAM,MAAM,KAAK,YAAY,WAAW,KAAK;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