@remnic/core 9.3.604 → 9.3.605
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/dist/access-cli.js +7 -7
- package/dist/{chunk-JTDRJQ3K.js → chunk-6JGNHWCI.js} +2 -2
- package/dist/{chunk-M6I5Z4SR.js → chunk-6ZZP4EJF.js} +2 -2
- package/dist/{chunk-I4UNL747.js → chunk-GMAG2HS4.js} +7 -3
- package/dist/chunk-GMAG2HS4.js.map +1 -0
- package/dist/{chunk-RUYYYLDT.js → chunk-IOTENEVL.js} +3 -3
- package/dist/{chunk-M46RYSMW.js → chunk-JHMFYY7L.js} +5 -2
- package/dist/chunk-JHMFYY7L.js.map +1 -0
- package/dist/{chunk-2ESBDLT5.js → chunk-VJXSUAO7.js} +2 -2
- package/dist/{chunk-Z5AAYHUC.js → chunk-VOUOLGIP.js} +13 -2
- package/dist/chunk-VOUOLGIP.js.map +1 -0
- package/dist/{chunk-OB6353F7.js → chunk-XPSVGJYA.js} +4 -4
- package/dist/{chunk-OEIRQ7DB.js → chunk-YJ6QCQNE.js} +5 -5
- package/dist/{chunk-6PTSXBPE.js → chunk-ZDTVJXIP.js} +5 -2
- package/dist/chunk-ZDTVJXIP.js.map +1 -0
- package/dist/cli.js +8 -8
- package/dist/{first-start-migration-CKTCTCQI.js → first-start-migration-GYJWIH36.js} +2 -2
- package/dist/index.js +10 -10
- package/dist/namespaces/migrate.js +6 -6
- package/dist/namespaces/search.js +5 -5
- package/dist/operator-toolkit.js +7 -7
- package/dist/orchestrator.js +7 -7
- package/dist/schemas.d.ts +22 -22
- package/dist/search/factory.js +4 -4
- package/dist/search/index.js +4 -4
- package/dist/search/lancedb-backend.d.ts +1 -0
- package/dist/search/lancedb-backend.js +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -0
- package/dist/search/meilisearch-backend.js +1 -1
- package/dist/search/orama-backend.d.ts +1 -0
- package/dist/search/orama-backend.js +1 -1
- package/dist/search/port.d.ts +1 -0
- package/dist/tier-migration.d.ts +1 -0
- package/dist/tier-migration.js +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/package.json +1 -1
- package/src/search/lancedb-backend.ts +5 -1
- package/src/search/meilisearch-backend.ts +7 -2
- package/src/search/orama-backend.ts +5 -1
- package/src/search/port.ts +1 -0
- package/src/tier-migration.ts +13 -2
- package/dist/chunk-6PTSXBPE.js.map +0 -1
- package/dist/chunk-I4UNL747.js.map +0 -1
- package/dist/chunk-M46RYSMW.js.map +0 -1
- package/dist/chunk-Z5AAYHUC.js.map +0 -1
- /package/dist/{chunk-JTDRJQ3K.js.map → chunk-6JGNHWCI.js.map} +0 -0
- /package/dist/{chunk-M6I5Z4SR.js.map → chunk-6ZZP4EJF.js.map} +0 -0
- /package/dist/{chunk-RUYYYLDT.js.map → chunk-IOTENEVL.js.map} +0 -0
- /package/dist/{chunk-2ESBDLT5.js.map → chunk-VJXSUAO7.js.map} +0 -0
- /package/dist/{chunk-OB6353F7.js.map → chunk-XPSVGJYA.js.map} +0 -0
- /package/dist/{chunk-OEIRQ7DB.js.map → chunk-YJ6QCQNE.js.map} +0 -0
- /package/dist/{first-start-migration-CKTCTCQI.js.map → first-start-migration-GYJWIH36.js.map} +0 -0
package/dist/access-cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Orchestrator
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YJ6QCQNE.js";
|
|
4
4
|
import "./chunk-5RIRL3XL.js";
|
|
5
5
|
import "./chunk-KVEVLBKC.js";
|
|
6
6
|
import "./chunk-BFBF3XEF.js";
|
|
@@ -23,7 +23,7 @@ import "./chunk-UHGBNIOS.js";
|
|
|
23
23
|
import "./chunk-VWT3F4IV.js";
|
|
24
24
|
import "./chunk-K5O2QY6T.js";
|
|
25
25
|
import "./chunk-MDYG7VI7.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-VOUOLGIP.js";
|
|
27
27
|
import "./chunk-S75M5ZRK.js";
|
|
28
28
|
import "./chunk-46GJIW5M.js";
|
|
29
29
|
import "./chunk-XJNBEDFE.js";
|
|
@@ -82,14 +82,14 @@ import "./chunk-ZRWB5D4H.js";
|
|
|
82
82
|
import "./chunk-A6D7A2FW.js";
|
|
83
83
|
import "./chunk-FF4KLI5W.js";
|
|
84
84
|
import "./chunk-SFQ6QNL7.js";
|
|
85
|
-
import "./chunk-
|
|
86
|
-
import "./chunk-
|
|
85
|
+
import "./chunk-6ZZP4EJF.js";
|
|
86
|
+
import "./chunk-XPSVGJYA.js";
|
|
87
87
|
import "./chunk-JNANKJLN.js";
|
|
88
88
|
import "./chunk-EWLQPEO6.js";
|
|
89
|
-
import "./chunk-
|
|
90
|
-
import "./chunk-
|
|
89
|
+
import "./chunk-ZDTVJXIP.js";
|
|
90
|
+
import "./chunk-GMAG2HS4.js";
|
|
91
91
|
import "./chunk-2I5JGH3M.js";
|
|
92
|
-
import "./chunk-
|
|
92
|
+
import "./chunk-JHMFYY7L.js";
|
|
93
93
|
import "./chunk-CINZGPSJ.js";
|
|
94
94
|
import "./chunk-Q4CAQGKQ.js";
|
|
95
95
|
import "./chunk-IK7DCC5H.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
namespaceCollectionName
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6ZZP4EJF.js";
|
|
4
4
|
import {
|
|
5
5
|
ALL_CATEGORY_DIRS,
|
|
6
6
|
NamespaceStorageRouter
|
|
@@ -202,4 +202,4 @@ export {
|
|
|
202
202
|
verifyNamespaces,
|
|
203
203
|
runNamespaceMigration
|
|
204
204
|
};
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-6JGNHWCI.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSearchBackend
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XPSVGJYA.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceIdentityToken,
|
|
6
6
|
normalizeNamespaceIdentity
|
|
@@ -179,4 +179,4 @@ export {
|
|
|
179
179
|
namespaceCollectionName,
|
|
180
180
|
NamespaceSearchRouter
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-6ZZP4EJF.js.map
|
|
@@ -96,13 +96,17 @@ var MeilisearchBackend = class {
|
|
|
96
96
|
await this.updateCollection(this.collection, execution);
|
|
97
97
|
}
|
|
98
98
|
async updateCollection(collection, execution) {
|
|
99
|
-
if (!this.
|
|
99
|
+
if (!this.memoryDir) return;
|
|
100
|
+
await this.updateCollectionFromDir(collection, this.memoryDir, execution);
|
|
101
|
+
}
|
|
102
|
+
async updateCollectionFromDir(collection, memoryDir, execution) {
|
|
103
|
+
if (!this.autoIndex) return;
|
|
100
104
|
if (!this.available) return;
|
|
101
105
|
if (isSearchAborted(execution)) return;
|
|
102
106
|
try {
|
|
103
107
|
const client = await this.ensureClient();
|
|
104
108
|
if (isSearchAborted(execution)) return;
|
|
105
|
-
const docs = await scanMemoryDir(
|
|
109
|
+
const docs = await scanMemoryDir(memoryDir);
|
|
106
110
|
if (isSearchAborted(execution)) return;
|
|
107
111
|
const index = client.index(collection);
|
|
108
112
|
const meilDocs = docs.map((d) => ({
|
|
@@ -204,4 +208,4 @@ var MeilisearchBackend = class {
|
|
|
204
208
|
export {
|
|
205
209
|
MeilisearchBackend
|
|
206
210
|
};
|
|
207
|
-
//# sourceMappingURL=chunk-
|
|
211
|
+
//# sourceMappingURL=chunk-GMAG2HS4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/search/meilisearch-backend.ts"],"sourcesContent":["import { log } from \"../logger.js\";\nimport type { SearchBackend, SearchExecutionOptions, SearchQueryOptions, SearchResult } from \"./port.js\";\nimport { scanMemoryDir } from \"./document-scanner.js\";\nimport { isSearchAborted, throwIfSearchAborted } from \"./abort.js\";\n\nexport interface MeilisearchBackendOptions {\n host: string;\n apiKey?: string;\n collection: string;\n timeoutMs?: number;\n autoIndex?: boolean;\n memoryDir?: string;\n}\n\n/**\n * Meilisearch search backend — server-based SDK client.\n *\n * Requires a running Meilisearch instance. Uses the official `meilisearch` SDK.\n * When `autoIndex` is true, update() pushes docs from the local memory directory.\n */\nexport class MeilisearchBackend implements SearchBackend {\n private readonly host: string;\n private readonly apiKey?: string;\n private readonly collection: string;\n private readonly timeoutMs: number;\n private readonly autoIndex: boolean;\n private readonly memoryDir?: string;\n private available = false;\n private client: any = null;\n private meiliModule: any = null;\n\n constructor(opts: MeilisearchBackendOptions) {\n this.host = opts.host;\n this.apiKey = opts.apiKey;\n this.collection = opts.collection;\n this.timeoutMs = opts.timeoutMs ?? 30_000;\n this.autoIndex = opts.autoIndex ?? false;\n this.memoryDir = opts.memoryDir;\n }\n\n async probe(): Promise<boolean> {\n try {\n const client = await this.ensureClient();\n await client.health();\n this.available = true;\n return true;\n } catch (err) {\n log.debug(`MeilisearchBackend probe failed: ${err}`);\n this.available = false;\n return false;\n }\n }\n\n isAvailable(): boolean {\n return this.available;\n }\n\n debugStatus(): string {\n return `backend=meilisearch available=${this.available} host=${this.host}`;\n }\n\n async search(\n query: string,\n collection?: string,\n maxResults?: number,\n _options?: SearchQueryOptions,\n execution?: SearchExecutionOptions,\n ): Promise<SearchResult[]> {\n if (isSearchAborted(execution)) return [];\n // Try hybrid first; fall back to plain FTS only if hybrid throws (e.g. no embedder configured)\n try {\n return await this.doSearch(query, maxResults ?? 10, { hybrid: { semanticRatio: 0.5, embedder: \"default\" } }, collection, true, execution);\n } catch {\n if (isSearchAborted(execution)) return [];\n return this.bm25Search(query, collection, maxResults, execution);\n }\n }\n\n async searchGlobal(query: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n const limit = maxResults ?? 10;\n if (!this.available) return [];\n\n try {\n throwIfSearchAborted(execution, \"MeilisearchBackend global search aborted\");\n const client = await this.ensureClient();\n const indexes = await client.getIndexes();\n throwIfSearchAborted(execution, \"MeilisearchBackend global search aborted\");\n const queries = (indexes.results ?? []).map((idx: any) => ({\n indexUid: idx.uid,\n q: query,\n limit,\n showRankingScore: true,\n }));\n if (queries.length === 0) return [];\n\n const multiResult = await client.multiSearch({ queries });\n throwIfSearchAborted(execution, \"MeilisearchBackend global search aborted\");\n const allResults: SearchResult[] = [];\n for (const result of multiResult.results ?? []) {\n allResults.push(...this.mapHits(result.hits ?? []));\n }\n allResults.sort((a, b) => b.score - a.score);\n return allResults.slice(0, limit);\n } catch (err) {\n log.debug(`MeilisearchBackend searchGlobal failed: ${err}`);\n return [];\n }\n }\n\n async bm25Search(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n return this.doSearch(query, maxResults ?? 10, undefined, collection, false, execution);\n }\n\n async vectorSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n return this.doSearch(query, maxResults ?? 10, { hybrid: { semanticRatio: 1.0, embedder: \"default\" } }, collection, false, execution);\n }\n\n async hybridSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n return this.doSearch(query, maxResults ?? 10, { hybrid: { semanticRatio: 0.5, embedder: \"default\" } }, collection, false, execution);\n }\n\n async update(execution?: SearchExecutionOptions): Promise<void> {\n await this.updateCollection(this.collection, execution);\n }\n\n async updateCollection(collection: string, execution?: SearchExecutionOptions): Promise<void> {\n if (!this.memoryDir) return;\n await this.updateCollectionFromDir(collection, this.memoryDir, execution);\n }\n\n async updateCollectionFromDir(collection: string, memoryDir: string, execution?: SearchExecutionOptions): Promise<void> {\n if (!this.autoIndex) return;\n if (!this.available) return;\n if (isSearchAborted(execution)) return;\n\n try {\n const client = await this.ensureClient();\n if (isSearchAborted(execution)) return;\n const docs = await scanMemoryDir(memoryDir);\n if (isSearchAborted(execution)) return;\n const index = client.index(collection);\n\n const meilDocs = docs.map((d) => ({\n id: d.docid,\n path: d.path,\n content: d.content,\n snippet: d.snippet,\n }));\n\n // Upsert current docs and wait for the task to complete\n if (isSearchAborted(execution)) return;\n const addTask = await index.addDocuments(meilDocs, { primaryKey: \"id\" });\n await client.waitForTask(addTask.taskUid, { timeOutMs: this.timeoutMs });\n if (isSearchAborted(execution)) return;\n\n // Remove docs that no longer exist on disk (paginated to handle large indexes)\n const currentIds = new Set(docs.map((d) => d.docid));\n try {\n const PAGE_SIZE = 1000;\n let offset = 0;\n let staleIds: string[] = [];\n let hasMore = true;\n while (hasMore) {\n if (isSearchAborted(execution)) return;\n const page = await index.getDocuments({ limit: PAGE_SIZE, offset, fields: [\"id\"] });\n const results = page.results ?? [];\n for (const doc of results) {\n const id = doc.id as string;\n if (!currentIds.has(id)) staleIds.push(id);\n }\n offset += results.length;\n hasMore = results.length === PAGE_SIZE;\n }\n if (staleIds.length > 0) {\n if (isSearchAborted(execution)) return;\n const delTask = await index.deleteDocuments(staleIds);\n await client.waitForTask(delTask.taskUid, { timeOutMs: this.timeoutMs });\n }\n } catch {\n // Deletion cleanup is best-effort\n }\n } catch (err) {\n log.debug(`MeilisearchBackend update failed: ${err}`);\n }\n }\n\n async embed(): Promise<void> {\n // Meilisearch handles its own embedding when configured with an embedder\n }\n\n async embedCollection(collection: string): Promise<void> {\n // Meilisearch handles its own embedding when configured with an embedder\n // The collection parameter is accepted for interface compliance but Meilisearch\n // manages embeddings server-side per index (collection).\n }\n\n async ensureCollection(\n _memoryDir: string,\n _execution?: SearchExecutionOptions,\n ): Promise<\"present\" | \"missing\" | \"unknown\" | \"skipped\"> {\n if (!this.available) return \"skipped\";\n try {\n const client = await this.ensureClient();\n try {\n await client.getIndex(this.collection);\n return \"present\";\n } catch {\n // Index doesn't exist — create it\n await client.createIndex(this.collection, { primaryKey: \"id\" });\n return \"present\";\n }\n } catch {\n return \"skipped\";\n }\n }\n\n private async ensureClient(): Promise<any> {\n if (this.client) return this.client;\n if (!this.meiliModule) {\n this.meiliModule = await import(\"meilisearch\");\n }\n const MeiliSearch = this.meiliModule.MeiliSearch ?? this.meiliModule.default?.MeiliSearch;\n this.client = new MeiliSearch({\n host: this.host,\n apiKey: this.apiKey,\n timeout: this.timeoutMs,\n });\n return this.client;\n }\n\n private async doSearch(\n query: string,\n limit: number,\n extra?: Record<string, unknown>,\n collection?: string,\n rethrow = false,\n execution?: SearchExecutionOptions,\n ): Promise<SearchResult[]> {\n if (!this.available) return [];\n if (isSearchAborted(execution)) return [];\n try {\n const client = await this.ensureClient();\n throwIfSearchAborted(execution, \"MeilisearchBackend search aborted\");\n const index = client.index(collection ?? this.collection);\n const result = await index.search(query, { limit, showRankingScore: true, ...extra });\n throwIfSearchAborted(execution, \"MeilisearchBackend search aborted\");\n return this.mapHits(result.hits ?? []);\n } catch (err) {\n log.debug(`MeilisearchBackend search failed: ${err}`);\n if (rethrow) throw err;\n return [];\n }\n }\n\n private mapHits(hits: any[]): SearchResult[] {\n return hits.map((hit) => ({\n docid: hit.id ?? \"\",\n path: hit.path ?? \"\",\n snippet: hit._formatted?.content ?? hit.snippet ?? hit.content?.slice(0, 200) ?? \"\",\n score: hit._rankingScore ?? 0.5,\n }));\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBO,IAAM,qBAAN,MAAkD;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACT,YAAY;AAAA,EACZ,SAAc;AAAA,EACd,cAAmB;AAAA,EAE3B,YAAY,MAAiC;AAC3C,SAAK,OAAO,KAAK;AACjB,SAAK,SAAS,KAAK;AACnB,SAAK,aAAa,KAAK;AACvB,SAAK,YAAY,KAAK,aAAa;AACnC,SAAK,YAAY,KAAK,aAAa;AACnC,SAAK,YAAY,KAAK;AAAA,EACxB;AAAA,EAEA,MAAM,QAA0B;AAC9B,QAAI;AACF,YAAM,SAAS,MAAM,KAAK,aAAa;AACvC,YAAM,OAAO,OAAO;AACpB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,CAAC,CAAC;AAAA,IACvC,SAAS,KAAK;AACZ,UAAI,MAAM,qCAAqC,GAAG,EAAE;AACpD,UAAI,QAAS,OAAM;AACnB,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EAEQ,QAAQ,MAA6B;AAC3C,WAAO,KAAK,IAAI,CAAC,SAAS;AAAA,MACxB,OAAO,IAAI,MAAM;AAAA,MACjB,MAAM,IAAI,QAAQ;AAAA,MAClB,SAAS,IAAI,YAAY,WAAW,IAAI,WAAW,IAAI,SAAS,MAAM,GAAG,GAAG,KAAK;AAAA,MACjF,OAAO,IAAI,iBAAiB;AAAA,IAC9B,EAAE;AAAA,EACJ;AACF;","names":[]}
|
|
@@ -89,12 +89,12 @@ import {
|
|
|
89
89
|
runOperatorInventory,
|
|
90
90
|
runOperatorRepair,
|
|
91
91
|
runOperatorSetup
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-VJXSUAO7.js";
|
|
93
93
|
import {
|
|
94
94
|
listNamespaces,
|
|
95
95
|
runNamespaceMigration,
|
|
96
96
|
verifyNamespaces
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-6JGNHWCI.js";
|
|
98
98
|
import {
|
|
99
99
|
collectPatternMemories,
|
|
100
100
|
explainPatternMemory,
|
|
@@ -6616,4 +6616,4 @@ export {
|
|
|
6616
6616
|
resolveMemoryDirForNamespace,
|
|
6617
6617
|
registerCli
|
|
6618
6618
|
};
|
|
6619
|
-
//# sourceMappingURL=chunk-
|
|
6619
|
+
//# sourceMappingURL=chunk-IOTENEVL.js.map
|
|
@@ -117,12 +117,15 @@ var OramaBackend = class {
|
|
|
117
117
|
await this.updateCollection(this.collection, execution);
|
|
118
118
|
}
|
|
119
119
|
async updateCollection(collection, execution) {
|
|
120
|
+
await this.updateCollectionFromDir(collection, this.memoryDir, execution);
|
|
121
|
+
}
|
|
122
|
+
async updateCollectionFromDir(collection, memoryDir, execution) {
|
|
120
123
|
if (isSearchAborted(execution)) return;
|
|
121
124
|
const db = await this.ensureDbForCollection(collection);
|
|
122
125
|
if (isSearchAborted(execution)) return;
|
|
123
126
|
if (!db) return;
|
|
124
127
|
const { search: oramaSearch, insert, remove, count, getByID } = this.oramaModule;
|
|
125
|
-
const docs = await scanMemoryDir(
|
|
128
|
+
const docs = await scanMemoryDir(memoryDir);
|
|
126
129
|
if (isSearchAborted(execution)) return;
|
|
127
130
|
const docMap = new Map(docs.map((d) => [d.docid, d]));
|
|
128
131
|
const { update: oramaUpdate } = this.oramaModule;
|
|
@@ -594,4 +597,4 @@ export {
|
|
|
594
597
|
resolveOramaCollectionDbFilePath,
|
|
595
598
|
OramaBackend
|
|
596
599
|
};
|
|
597
|
-
//# sourceMappingURL=chunk-
|
|
600
|
+
//# sourceMappingURL=chunk-JHMFYY7L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/search/orama-backend.ts"],"sourcesContent":["import path from \"node:path\";\nimport { mkdir, readdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { log } from \"../logger.js\";\nimport type { SearchBackend, SearchExecutionOptions, SearchQueryOptions, SearchResult } from \"./port.js\";\nimport type { EmbedHelper, EmbedProviderIdentity, EmbedWithProviderResult } from \"./embed-helper.js\";\nimport { scanMemoryDir } from \"./document-scanner.js\";\nimport { isSearchAborted, throwIfSearchAborted } from \"./abort.js\";\n\nexport interface OramaBackendOptions {\n dbPath: string;\n collection: string;\n embedHelper: EmbedHelper;\n memoryDir: string;\n embeddingDimension: number;\n}\n\nconst ORAMA_COLLECTION_FILENAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\n\nfunction pathIsInside(parent: string, child: string): boolean {\n const relative = path.relative(parent, child);\n return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nexport function resolveOramaCollectionDbFilePath(dbPath: string, collection: string): string {\n if (!ORAMA_COLLECTION_FILENAME_PATTERN.test(collection)) {\n throw new Error(\n `Invalid Orama collection name ${JSON.stringify(collection)}. ` +\n \"Collection names must match [A-Za-z0-9][A-Za-z0-9._-]*.\",\n );\n }\n const resolvedDbPath = path.resolve(dbPath);\n const filePath = path.resolve(resolvedDbPath, `${collection}.msp`);\n if (!pathIsInside(resolvedDbPath, filePath)) {\n throw new Error(\n `Invalid Orama collection path for ${JSON.stringify(collection)}: resolved outside dbPath.`,\n );\n }\n return filePath;\n}\n\n/**\n * Orama search backend — embedded hybrid FTS+vector, pure JS.\n *\n * Uses @orama/orama for full-text search with optional vector support.\n * Persists data to JSON files via @orama/plugin-data-persistence.\n */\nexport class OramaBackend implements SearchBackend {\n private readonly dbPath: string;\n private readonly collection: string;\n private readonly embedHelper: EmbedHelper;\n private readonly memoryDir: string;\n private readonly embeddingDimension: number;\n private available = false;\n private db: any = null;\n private oramaModule: any = null;\n private persistModule: any = null;\n private readonly vectorProviderCompatibility = new WeakMap<\n object,\n { providerIdentity: EmbedProviderIdentity; compatible: boolean }\n >();\n\n constructor(opts: OramaBackendOptions) {\n this.dbPath = opts.dbPath;\n this.collection = opts.collection;\n this.embedHelper = opts.embedHelper;\n this.memoryDir = opts.memoryDir;\n this.embeddingDimension = opts.embeddingDimension;\n }\n\n async probe(): Promise<boolean> {\n try {\n await this.ensureModules();\n await this.ensureDb();\n this.available = true;\n return true;\n } catch (err) {\n log.debug(`OramaBackend probe failed: ${err}`);\n this.available = false;\n return false;\n }\n }\n\n isAvailable(): boolean {\n return this.available;\n }\n\n debugStatus(): string {\n return `backend=orama available=${this.available} dbPath=${this.dbPath}`;\n }\n\n async search(\n query: string,\n _collection?: string,\n maxResults?: number,\n _options?: SearchQueryOptions,\n execution?: SearchExecutionOptions,\n ): Promise<SearchResult[]> {\n return this.hybridSearch(query, _collection, maxResults, execution);\n }\n\n async searchGlobal(query: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n const limit = maxResults ?? 10;\n if (!this.available) return [];\n try {\n throwIfSearchAborted(execution, \"OramaBackend global search aborted\");\n const files = await this.listDbFiles();\n const allResults: SearchResult[] = [];\n for (const file of files) {\n throwIfSearchAborted(execution, \"OramaBackend global search aborted\");\n const db = await this.loadDbFromFile(file);\n if (!db) continue;\n const results = await this.searchDb(db, query, \"hybrid\", limit, execution);\n allResults.push(...results);\n }\n allResults.sort((a, b) => b.score - a.score);\n return allResults.slice(0, limit);\n } catch (err) {\n log.debug(`OramaBackend searchGlobal failed: ${err}`);\n return [];\n }\n }\n\n async bm25Search(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n if (isSearchAborted(execution)) return [];\n const db = await this.ensureDbForCollection(collection ?? this.collection);\n if (isSearchAborted(execution)) return [];\n if (!db) return [];\n return this.searchDb(db, query, \"fulltext\", maxResults ?? 10, execution);\n }\n\n async vectorSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n if (isSearchAborted(execution)) return [];\n const db = await this.ensureDbForCollection(collection ?? this.collection);\n if (isSearchAborted(execution)) return [];\n if (!db) return [];\n return this.searchDb(db, query, \"vector\", maxResults ?? 10, execution);\n }\n\n async hybridSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n if (isSearchAborted(execution)) return [];\n const db = await this.ensureDbForCollection(collection ?? this.collection);\n if (isSearchAborted(execution)) return [];\n if (!db) return [];\n return this.searchDb(db, query, \"hybrid\", maxResults ?? 10, execution);\n }\n\n async update(execution?: SearchExecutionOptions): Promise<void> {\n await this.updateCollection(this.collection, execution);\n }\n\n async updateCollection(collection: string, execution?: SearchExecutionOptions): Promise<void> {\n await this.updateCollectionFromDir(collection, this.memoryDir, execution);\n }\n\n async updateCollectionFromDir(collection: string, memoryDir: string, execution?: SearchExecutionOptions): Promise<void> {\n if (isSearchAborted(execution)) return;\n const db = await this.ensureDbForCollection(collection);\n if (isSearchAborted(execution)) return;\n if (!db) return;\n const { search: oramaSearch, insert, remove, count, getByID } = this.oramaModule;\n\n const docs = await scanMemoryDir(memoryDir);\n if (isSearchAborted(execution)) return;\n const docMap = new Map(docs.map((d) => [d.docid, d]));\n const { update: oramaUpdate } = this.oramaModule;\n\n const embeddingProviderIdentity = this.embedHelper.getProviderIdentity();\n let allRowsCompatible = !!embeddingProviderIdentity && docs.length > 0;\n // Get existing docs to diff — map user doc ID → { internalId, vector }\n const existingDocs = new Map<string, {\n internalId: string;\n vector?: number[];\n vectorProvider?: string;\n }>();\n const existingCount = await count(db);\n if (existingCount > 0) {\n const allHits = await oramaSearch(db, {\n term: \"\",\n limit: existingCount + 100,\n });\n for (const hit of allHits.hits) {\n if (isSearchAborted(execution)) return;\n const storedDocument =\n typeof getByID === \"function\"\n ? await getByID(db, hit.id)\n : hit.document;\n const document = storedDocument ?? hit.document ?? {};\n if (!docMap.has(document.id)) {\n await remove(db, hit.id);\n } else {\n existingDocs.set(document.id, {\n internalId: hit.id,\n vector: this.normalizeStoredVector(document.vector) ?? undefined,\n vectorProvider:\n typeof document.vectorProvider === \"string\"\n ? document.vectorProvider\n : undefined,\n });\n }\n }\n }\n\n // Insert new docs, update existing ones (preserving vectors since update is remove+insert)\n for (const doc of docs) {\n if (isSearchAborted(execution)) return;\n const existing = existingDocs.get(doc.docid);\n if (existing) {\n const payload: Record<string, unknown> = {\n id: doc.docid,\n path: doc.path,\n content: doc.content,\n snippet: doc.snippet,\n };\n const preservesCompatibleProvider =\n !!embeddingProviderIdentity &&\n existing.vectorProvider === embeddingProviderIdentity;\n if (preservesCompatibleProvider) {\n if (this.isCompatibleStoredVector(existing.vector)) {\n payload.vector = existing.vector;\n payload.vectorProvider = existing.vectorProvider ?? \"\";\n } else {\n payload.vector = this.zeroVector();\n payload.vectorProvider = \"\";\n allRowsCompatible = false;\n }\n } else if (!embeddingProviderIdentity && this.isCompatibleStoredVector(existing.vector)) {\n payload.vector = existing.vector;\n payload.vectorProvider = existing.vectorProvider ?? \"\";\n allRowsCompatible = false;\n } else {\n payload.vector = this.zeroVector();\n payload.vectorProvider = \"\";\n allRowsCompatible = false;\n }\n try {\n await oramaUpdate(db, existing.internalId, payload);\n } catch {\n allRowsCompatible = false;\n // Update failed — skip and continue with remaining docs\n }\n } else {\n allRowsCompatible = false;\n try {\n await insert(db, {\n id: doc.docid,\n path: doc.path,\n content: doc.content,\n snippet: doc.snippet,\n vector: this.zeroVector(),\n vectorProvider: \"\",\n });\n } catch {\n allRowsCompatible = false;\n // Duplicate id edge case — skip\n }\n }\n }\n\n if (isSearchAborted(execution)) return;\n await this.persistDbForCollection(db, collection);\n this.rememberVectorProviderCompatibility(\n db,\n embeddingProviderIdentity,\n allRowsCompatible,\n );\n }\n\n async embed(): Promise<void> {\n await this.embedCollection(this.collection);\n }\n\n async embedCollection(collection: string): Promise<void> {\n if (!this.embedHelper.isAvailable()) return;\n\n const db = await this.ensureDbForCollection(collection);\n if (!db) return;\n const { search: oramaSearch, update: oramaUpdate, count } = this.oramaModule;\n\n const existingCount = await count(db);\n if (existingCount === 0) return;\n\n const embeddingProviderIdentity = this.embedHelper.getProviderIdentity();\n // Find docs without vectors or with vectors from a different provider.\n const allHits = await oramaSearch(db, { term: \"\", limit: existingCount + 100 });\n const needsEmbed = allHits.hits.filter((h: any) => {\n const vector = this.normalizeStoredVector(h.document?.vector);\n return (\n (embeddingProviderIdentity &&\n h.document?.vectorProvider !== embeddingProviderIdentity) ||\n !this.isCompatibleStoredVector(vector)\n );\n });\n\n if (needsEmbed.length === 0) {\n this.rememberVectorProviderCompatibility(db, embeddingProviderIdentity, true);\n return;\n }\n\n let rowsToEmbed = needsEmbed;\n let embedResult = await this.embedHelper.embedBatchWithProvider(\n rowsToEmbed.map((h: any) => h.document.content as string),\n );\n if (!embedResult) return;\n if (\n embeddingProviderIdentity &&\n embedResult.providerIdentity !== embeddingProviderIdentity\n ) {\n const effectiveProviderIdentity = embedResult.providerIdentity;\n const originalIds = new Set(rowsToEmbed.map((h: any) => h.id));\n const effectiveNeedsEmbed = allHits.hits.filter((h: any) => {\n const vector = this.normalizeStoredVector(h.document?.vector);\n return (\n h.document?.vectorProvider !== effectiveProviderIdentity ||\n !this.isCompatibleStoredVector(vector)\n );\n });\n const sameRows =\n effectiveNeedsEmbed.length === rowsToEmbed.length &&\n effectiveNeedsEmbed.every((h: any) => originalIds.has(h.id));\n if (!sameRows) {\n const effectiveTexts = effectiveNeedsEmbed.map((h: any) => h.document.content as string);\n const effectiveEmbedResult = await this.embedHelper.embedBatchWithProvider(effectiveTexts);\n if (effectiveEmbedResult) {\n rowsToEmbed = effectiveNeedsEmbed;\n embedResult = effectiveEmbedResult;\n }\n }\n }\n const { vectors, providerIdentity } = embedResult;\n\n let allEmbedded = true;\n for (let i = 0; i < rowsToEmbed.length; i++) {\n const vec = vectors[i];\n if (!this.isExpectedDimensionVector(vec)) {\n allEmbedded = false;\n continue;\n }\n // Orama update is remove+insert — must include all fields to avoid data loss\n const doc = rowsToEmbed[i].document;\n await oramaUpdate(db, rowsToEmbed[i].id, {\n id: doc.id,\n path: doc.path,\n content: doc.content,\n snippet: doc.snippet,\n vector: vec,\n vectorProvider: providerIdentity,\n });\n }\n\n await this.persistDbForCollection(db, collection);\n if (allEmbedded) {\n this.rememberVectorProviderCompatibility(db, providerIdentity, true);\n } else {\n this.rememberVectorProviderCompatibility(db, providerIdentity, false);\n }\n }\n\n async ensureCollection(\n _memoryDir: string,\n _execution?: SearchExecutionOptions,\n ): Promise<\"present\" | \"missing\" | \"unknown\" | \"skipped\"> {\n try {\n await this.ensureModules();\n await this.ensureDb();\n return \"present\";\n } catch {\n return \"missing\";\n }\n }\n\n private async ensureModules(): Promise<void> {\n if (this.oramaModule && this.persistModule) return;\n this.oramaModule = await import(\"@orama/orama\");\n this.persistModule = await import(\"@orama/plugin-data-persistence\");\n }\n\n private async ensureDb(): Promise<any> {\n if (this.db) return this.db;\n await this.ensureModules();\n\n await mkdir(this.dbPath, { recursive: true });\n const filePath = this.dbFilePath(this.collection);\n\n let raw: string;\n try {\n raw = await readFile(filePath, \"utf-8\");\n } catch {\n // No existing DB — create fresh\n this.db = await this.createDb();\n return this.db;\n }\n\n this.db = await this.migrateLegacyVectorProviderSchema(\n await this.persistModule.restore(\"json\", raw),\n this.collection,\n );\n return this.db;\n }\n\n private async ensureDbForCollection(collection: string): Promise<any> {\n // For the default collection, use the cached instance\n if (collection === this.collection) return this.ensureDb();\n\n await this.ensureModules();\n await mkdir(this.dbPath, { recursive: true });\n const filePath = this.dbFilePath(collection);\n\n let raw: string;\n try {\n raw = await readFile(filePath, \"utf-8\");\n } catch {\n // No existing DB — create fresh\n return await this.createDb();\n }\n\n return await this.migrateLegacyVectorProviderSchema(\n await this.persistModule.restore(\"json\", raw),\n collection,\n );\n }\n\n private async createDb(): Promise<any> {\n const { create } = this.oramaModule;\n const schema: Record<string, string> = {\n id: \"string\",\n path: \"string\",\n content: \"string\",\n snippet: \"string\",\n vectorProvider: \"string\",\n vector: `vector[${this.embeddingDimension}]`,\n };\n return await create({ schema });\n }\n\n private async migrateLegacyVectorProviderSchema(db: any, collection: string): Promise<any> {\n const { search: oramaSearch, count, insert } = this.oramaModule;\n const existingCount = await count(db);\n if (existingCount === 0) {\n const migrated = await this.createDb();\n await this.persistDbForCollection(migrated, collection);\n return migrated;\n }\n\n const allHits = await oramaSearch(db, { term: \"\", limit: existingCount + 100 });\n const hits = allHits.hits ?? [];\n const needsMigration = hits.some((hit: any) =>\n typeof hit.document?.vectorProvider !== \"string\"\n );\n if (!needsMigration) return db;\n\n const migrated = await this.createDb();\n for (const hit of hits) {\n const doc = this.getStoredDocument(db, hit);\n const vector = this.getStoredVector(db, hit, doc);\n const payload: Record<string, unknown> = {\n id: typeof doc.id === \"string\" && doc.id.length > 0 ? doc.id : String(hit.id),\n path: typeof doc.path === \"string\" ? doc.path : \"\",\n content: typeof doc.content === \"string\" ? doc.content : \"\",\n snippet:\n typeof doc.snippet === \"string\"\n ? doc.snippet\n : typeof doc.content === \"string\"\n ? doc.content.slice(0, 200)\n : \"\",\n vectorProvider:\n typeof doc.vectorProvider === \"string\" ? doc.vectorProvider : \"\",\n };\n if (vector) {\n payload.vector = vector;\n } else {\n payload.vector = this.zeroVector();\n }\n await insert(migrated, payload);\n }\n await this.persistDbForCollection(migrated, collection);\n return migrated;\n }\n\n private async persistDbForCollection(db: any, collection: string): Promise<void> {\n const data = await this.persistModule.persist(db, \"json\");\n const filePath = this.dbFilePath(collection);\n await mkdir(path.dirname(filePath), { recursive: true });\n const tempPath = path.join(\n path.dirname(filePath),\n `.${path.basename(filePath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`,\n );\n try {\n await writeFile(tempPath, data, \"utf-8\");\n await rename(tempPath, filePath);\n } catch (err) {\n await rm(tempPath, { force: true }).catch(() => undefined);\n throw err;\n }\n }\n\n private dbFilePath(collection: string): string {\n return resolveOramaCollectionDbFilePath(this.dbPath, collection);\n }\n\n private async listDbFiles(): Promise<string[]> {\n try {\n const entries = await readdir(this.dbPath);\n return entries\n .filter((e) => e.endsWith(\".msp\"))\n .map((e) => path.join(this.dbPath, e));\n } catch {\n return [];\n }\n }\n\n private async loadDbFromFile(filePath: string): Promise<any> {\n try {\n await this.ensureModules();\n const raw = await readFile(filePath, \"utf-8\");\n const collection = path.basename(filePath, \".msp\");\n return await this.migrateLegacyVectorProviderSchema(\n await this.persistModule.restore(\"json\", raw),\n collection,\n );\n } catch (err) {\n log.debug(`OramaBackend failed to load ${filePath}: ${err}`);\n return null;\n }\n }\n\n private async searchDb(\n db: any,\n query: string,\n mode: \"fulltext\" | \"vector\" | \"hybrid\",\n limit: number,\n execution?: SearchExecutionOptions,\n ): Promise<SearchResult[]> {\n const { search: oramaSearch } = this.oramaModule;\n\n try {\n throwIfSearchAborted(execution, `OramaBackend ${mode} search aborted`);\n let searchParams: any;\n\n if (mode === \"fulltext\") {\n searchParams = { term: query, limit };\n } else if (mode === \"vector\") {\n const embedResult = await this.resolveCompatibleQueryEmbedding(db, query, execution);\n throwIfSearchAborted(execution, `OramaBackend ${mode} search aborted`);\n if (!embedResult) {\n // Fall back to fulltext if no embeddings available\n searchParams = { term: query, limit };\n } else {\n searchParams = { mode: \"vector\", vector: { value: embedResult.vector, property: \"vector\" }, limit };\n }\n } else {\n // hybrid\n const embedResult = await this.resolveCompatibleQueryEmbedding(db, query, execution);\n throwIfSearchAborted(execution, `OramaBackend ${mode} search aborted`);\n if (!embedResult) {\n searchParams = { term: query, limit };\n } else {\n searchParams = { mode: \"hybrid\", term: query, vector: { value: embedResult.vector, property: \"vector\" }, limit };\n }\n }\n\n throwIfSearchAborted(execution, `OramaBackend ${mode} search aborted`);\n const result = await oramaSearch(db, searchParams);\n throwIfSearchAborted(execution, `OramaBackend ${mode} search aborted`);\n return (result.hits ?? []).map((hit: any) => ({\n docid: hit.document?.id ?? \"\",\n path: hit.document?.path ?? \"\",\n snippet: hit.document?.snippet ?? hit.document?.content?.slice(0, 200) ?? \"\",\n score: hit.score ?? 0,\n }));\n } catch (err) {\n log.debug(`OramaBackend search (${mode}) failed: ${err}`);\n return [];\n }\n }\n\n private async resolveCompatibleQueryEmbedding(\n db: any,\n query: string,\n execution?: SearchExecutionOptions,\n ): Promise<EmbedWithProviderResult | null> {\n const embedResult = await this.embedHelper.embedWithProvider(query, { signal: execution?.signal });\n throwIfSearchAborted(execution, \"OramaBackend query embedding aborted\");\n if (!embedResult || !this.isExpectedDimensionVector(embedResult.vector)) return null;\n\n const storedProviderIdentity = await this.findCompatibleStoredVectorProvider(db, execution);\n if (!storedProviderIdentity) {\n this.rememberVectorProviderCompatibility(db, embedResult.providerIdentity, false);\n return null;\n }\n if (storedProviderIdentity === embedResult.providerIdentity) return embedResult;\n\n const fallbackEmbed = await this.embedQueryWithStoredFallbackProvider(query, storedProviderIdentity, execution);\n throwIfSearchAborted(execution, \"OramaBackend fallback query embedding aborted\");\n if (\n fallbackEmbed &&\n fallbackEmbed.providerIdentity === storedProviderIdentity &&\n this.isExpectedDimensionVector(fallbackEmbed.vector)\n ) {\n return fallbackEmbed;\n }\n\n this.rememberVectorProviderCompatibility(db, embedResult.providerIdentity, false);\n return null;\n }\n\n private async embedQueryWithStoredFallbackProvider(\n query: string,\n providerIdentity: EmbedProviderIdentity,\n execution?: SearchExecutionOptions,\n ): Promise<EmbedWithProviderResult | null> {\n const embedWithIdentity = (this.embedHelper as unknown as {\n embedWithFallbackProviderIdentity?: (\n text: string,\n identity: EmbedProviderIdentity,\n options?: { signal?: AbortSignal },\n ) => Promise<EmbedWithProviderResult | null>;\n }).embedWithFallbackProviderIdentity;\n if (typeof embedWithIdentity !== \"function\") return null;\n return embedWithIdentity.call(this.embedHelper, query, providerIdentity, { signal: execution?.signal });\n }\n\n private async findCompatibleStoredVectorProvider(\n db: any,\n execution?: SearchExecutionOptions,\n ): Promise<EmbedProviderIdentity | null> {\n const { search: oramaSearch, count } = this.oramaModule;\n try {\n const cached = this.vectorProviderCompatibility.get(db);\n if (cached?.compatible) return cached.providerIdentity;\n const existingCount = await count(db);\n if (existingCount === 0) return null;\n const allHits = await oramaSearch(db, {\n term: \"\",\n limit: existingCount + 100,\n properties: [\"vectorProvider\"],\n });\n let providerIdentity: EmbedProviderIdentity | null = null;\n let compatible = (allHits.hits ?? []).length > 0;\n for (const hit of allHits.hits ?? []) {\n throwIfSearchAborted(execution, \"OramaBackend vector provider check aborted\");\n const doc = this.getStoredDocument(db, hit);\n if (\n typeof doc.vectorProvider !== \"string\" ||\n doc.vectorProvider.length === 0 ||\n !this.isCompatibleStoredVector(this.getStoredVector(db, hit, doc))\n ) {\n compatible = false;\n break;\n }\n if (providerIdentity && doc.vectorProvider !== providerIdentity) {\n compatible = false;\n break;\n }\n providerIdentity = doc.vectorProvider as EmbedProviderIdentity;\n }\n if (compatible && providerIdentity) {\n this.vectorProviderCompatibility.set(db, {\n providerIdentity,\n compatible: true,\n });\n return providerIdentity;\n }\n return null;\n } catch (err) {\n if (isSearchAborted(execution)) throw err;\n log.debug(`OramaBackend stored vector provider check failed: ${err}`);\n return null;\n }\n }\n\n private async dbHasCompatibleVectors(\n db: any,\n providerIdentity: EmbedProviderIdentity,\n execution?: SearchExecutionOptions,\n ): Promise<boolean> {\n const { search: oramaSearch, count } = this.oramaModule;\n try {\n const cached = this.vectorProviderCompatibility.get(db);\n if (cached?.providerIdentity === providerIdentity) return cached.compatible;\n const existingCount = await count(db);\n if (existingCount === 0) return false;\n const allHits = await oramaSearch(db, {\n term: \"\",\n limit: existingCount + 100,\n properties: [\"vectorProvider\"],\n });\n let compatible = (allHits.hits ?? []).length > 0;\n for (const hit of allHits.hits ?? []) {\n throwIfSearchAborted(execution, \"OramaBackend vector provider check aborted\");\n const doc = this.getStoredDocument(db, hit);\n if (\n doc.vectorProvider !== providerIdentity ||\n !this.isCompatibleStoredVector(this.getStoredVector(db, hit, doc))\n ) {\n compatible = false;\n break;\n }\n }\n this.vectorProviderCompatibility.set(db, { providerIdentity, compatible });\n return compatible;\n } catch (err) {\n if (isSearchAborted(execution)) throw err;\n log.debug(`OramaBackend vector provider check failed: ${err}`);\n return false;\n }\n }\n\n private rememberVectorProviderCompatibility(\n db: unknown,\n providerIdentity: EmbedProviderIdentity | null,\n compatible: boolean,\n ): void {\n if (!db || typeof db !== \"object\") return;\n if (!providerIdentity) {\n this.vectorProviderCompatibility.delete(db);\n return;\n }\n this.vectorProviderCompatibility.set(db, { providerIdentity, compatible });\n }\n\n private getStoredDocument(db: any, hit: any): Record<string, unknown> {\n const internalId = this.getInternalDocumentId(db, hit);\n const internalDoc =\n internalId !== undefined && internalId !== null\n ? db?.data?.docs?.docs?.[String(internalId)]\n : undefined;\n if (internalDoc && typeof internalDoc === \"object\") {\n return internalDoc as Record<string, unknown>;\n }\n return hit?.document && typeof hit.document === \"object\"\n ? hit.document as Record<string, unknown>\n : {};\n }\n\n private getStoredVector(db: any, hit: any, doc: Record<string, unknown>): number[] | null {\n const documentVector = this.normalizeStoredVector(doc.vector);\n if (documentVector) return documentVector;\n const internalId = this.getInternalDocumentId(db, hit);\n if (internalId === undefined || internalId === null) return null;\n const vectorEntry = db?.data?.index?.vectorIndexes?.vector?.node?.vectors?.get?.(internalId);\n const vector = Array.isArray(vectorEntry) ? vectorEntry[1] : vectorEntry;\n return this.normalizeStoredVector(vector);\n }\n\n private getInternalDocumentId(db: any, hit: any): unknown {\n const publicId =\n typeof hit?.id === \"string\"\n ? hit.id\n : typeof hit?.document?.id === \"string\"\n ? hit.document.id\n : undefined;\n return publicId && typeof db?.internalDocumentIDStore?.idToInternalId?.get === \"function\"\n ? db.internalDocumentIDStore.idToInternalId.get(publicId)\n : undefined;\n }\n\n private isExpectedDimensionVector(vector: number[] | null | undefined): vector is number[] {\n return Array.isArray(vector) && vector.length === this.embeddingDimension;\n }\n\n private isCompatibleStoredVector(vector: unknown): vector is number[] {\n if (!vector || typeof vector !== \"object\") return false;\n const arr = Array.from(vector as ArrayLike<number>);\n return (\n arr.length === this.embeddingDimension &&\n arr.every((value) => Number.isFinite(value)) &&\n arr.some((value) => value !== 0)\n );\n }\n\n private zeroVector(): number[] {\n return Array.from({ length: this.embeddingDimension }, () => 0);\n }\n\n private normalizeStoredVector(vector: unknown): number[] | null {\n const values =\n Array.isArray(vector)\n ? vector\n : ArrayBuffer.isView(vector) && !(vector instanceof DataView)\n ? Array.from(vector as unknown as ArrayLike<unknown>)\n : null;\n if (!values || values.length !== this.embeddingDimension) return null;\n const normalized = values.map((value) => Number(value));\n return normalized.every((value) => Number.isFinite(value)) ? normalized : null;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,OAAO,SAAS,UAAU,QAAQ,IAAI,iBAAiB;AAehE,IAAM,oCAAoC;AAE1C,SAAS,aAAa,QAAgB,OAAwB;AAC5D,QAAM,WAAW,KAAK,SAAS,QAAQ,KAAK;AAC5C,SAAO,aAAa,MAAO,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,KAAK,WAAW,QAAQ;AACpF;AAEO,SAAS,iCAAiC,QAAgB,YAA4B;AAC3F,MAAI,CAAC,kCAAkC,KAAK,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,yBAAyB,QAAqC;AACpE,QAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAClD,UAAM,MAAM,MAAM,KAAK,MAA2B;AAClD,WACE,IAAI,WAAW,KAAK,sBACpB,IAAI,MAAM,CAAC,UAAU,OAAO,SAAS,KAAK,CAAC,KAC3C,IAAI,KAAK,CAAC,UAAU,UAAU,CAAC;AAAA,EAEnC;AAAA,EAEQ,aAAuB;AAC7B,WAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,mBAAmB,GAAG,MAAM,CAAC;AAAA,EAChE;AAAA,EAEQ,sBAAsB,QAAkC;AAC9D,UAAM,SACJ,MAAM,QAAQ,MAAM,IAChB,SACA,YAAY,OAAO,MAAM,KAAK,EAAE,kBAAkB,YAChD,MAAM,KAAK,MAAuC,IAClD;AACR,QAAI,CAAC,UAAU,OAAO,WAAW,KAAK,mBAAoB,QAAO;AACjE,UAAM,aAAa,OAAO,IAAI,CAAC,UAAU,OAAO,KAAK,CAAC;AACtD,WAAO,WAAW,MAAM,CAAC,UAAU,OAAO,SAAS,KAAK,CAAC,IAAI,aAAa;AAAA,EAC5E;AACF;","names":["migrated"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listNamespaces
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6JGNHWCI.js";
|
|
4
4
|
import {
|
|
5
5
|
runConsolidationProvenanceCheck
|
|
6
6
|
} from "./chunk-LZ3VEOU5.js";
|
|
@@ -1333,4 +1333,4 @@ export {
|
|
|
1333
1333
|
runBenchmarkRecall,
|
|
1334
1334
|
runOperatorRepair
|
|
1335
1335
|
};
|
|
1336
|
-
//# sourceMappingURL=chunk-
|
|
1336
|
+
//# sourceMappingURL=chunk-VJXSUAO7.js.map
|
|
@@ -44,7 +44,10 @@ var TierMigrationExecutor = class {
|
|
|
44
44
|
if (result.changed) {
|
|
45
45
|
const destinationCollection = this.collectionForTier(toTier);
|
|
46
46
|
const sourceCollection = this.collectionForTier(fromTier);
|
|
47
|
-
await this.
|
|
47
|
+
await this.updateCollectionFromTierRoot(destinationCollection, toTier);
|
|
48
|
+
if (sourceCollection !== destinationCollection && this.qmd.updatesAllCollections?.() !== true) {
|
|
49
|
+
await this.updateCollectionFromTierRoot(sourceCollection, fromTier);
|
|
50
|
+
}
|
|
48
51
|
if (this.autoEmbed) {
|
|
49
52
|
await this.qmd.embedCollection(destinationCollection);
|
|
50
53
|
if (sourceCollection !== destinationCollection) {
|
|
@@ -57,6 +60,14 @@ var TierMigrationExecutor = class {
|
|
|
57
60
|
collectionForTier(tier) {
|
|
58
61
|
return tier === "cold" ? this.coldCollection : this.hotCollection;
|
|
59
62
|
}
|
|
63
|
+
async updateCollectionFromTierRoot(collection, tier) {
|
|
64
|
+
const memoryDir = tier === "cold" ? path.join(this.storage.dir, "cold") : this.storage.dir;
|
|
65
|
+
if (this.qmd.updatesAllCollections?.() !== true && this.qmd.updateCollectionFromDir) {
|
|
66
|
+
await this.qmd.updateCollectionFromDir(collection, memoryDir);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
await this.qmd.updateCollection(collection);
|
|
70
|
+
}
|
|
60
71
|
async appendJournal(result) {
|
|
61
72
|
const entry = {
|
|
62
73
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -76,4 +87,4 @@ var TierMigrationExecutor = class {
|
|
|
76
87
|
export {
|
|
77
88
|
TierMigrationExecutor
|
|
78
89
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-VOUOLGIP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tier-migration.ts"],"sourcesContent":["import { appendFile, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { MemoryFile } from \"./types.js\";\nimport { StorageManager } from \"./storage.js\";\nimport type { MemoryTier } from \"./tier-routing.js\";\nimport type { SearchBackend } from \"./search/port.js\";\n\nexport type { MemoryTier } from \"./tier-routing.js\";\n\nexport interface TierMigrationRequest {\n memory: MemoryFile;\n fromTier: MemoryTier;\n toTier: MemoryTier;\n reason: string;\n}\n\nexport interface TierMigrationResult {\n memoryId: string;\n fromTier: MemoryTier;\n toTier: MemoryTier;\n changed: boolean;\n reason: string;\n targetPath: string;\n}\n\nexport interface TierMigrationExecutorOptions {\n storage: StorageManager;\n qmd: SearchBackend;\n hotCollection: string;\n coldCollection: string;\n autoEmbed?: boolean;\n journalPath?: string;\n}\n\ntype TierMigrationJournalEntry = {\n ts: string;\n memoryId: string;\n fromTier: MemoryTier;\n toTier: MemoryTier;\n changed: boolean;\n reason: string;\n targetPath: string;\n};\n\nexport class TierMigrationExecutor {\n private readonly storage: StorageManager;\n private readonly qmd: SearchBackend;\n private readonly hotCollection: string;\n private readonly coldCollection: string;\n private readonly autoEmbed: boolean;\n private readonly journalPath: string;\n\n constructor(options: TierMigrationExecutorOptions) {\n this.storage = options.storage;\n this.qmd = options.qmd;\n this.hotCollection = options.hotCollection;\n this.coldCollection = options.coldCollection;\n this.autoEmbed = options.autoEmbed === true;\n this.journalPath = options.journalPath ?? path.join(this.storage.dir, \"state\", \"tier-migration-journal.jsonl\");\n }\n\n async migrateMemory(request: TierMigrationRequest): Promise<TierMigrationResult> {\n const { memory, fromTier, toTier, reason } = request;\n const targetPath = this.storage.buildTierMemoryPath(memory, toTier);\n\n if (fromTier === toTier) {\n const noChange: TierMigrationResult = {\n memoryId: memory.frontmatter.id,\n fromTier,\n toTier,\n changed: false,\n reason,\n targetPath,\n };\n await this.appendJournal(noChange);\n return noChange;\n }\n\n const moved = await this.storage.migrateMemoryToTier(memory, toTier);\n const result: TierMigrationResult = {\n memoryId: memory.frontmatter.id,\n fromTier,\n toTier,\n changed: moved.changed,\n reason,\n targetPath: moved.targetPath,\n };\n\n await this.appendJournal(result);\n\n if (result.changed) {\n const destinationCollection = this.collectionForTier(toTier);\n const sourceCollection = this.collectionForTier(fromTier);\n await this.updateCollectionFromTierRoot(destinationCollection, toTier);\n if (sourceCollection !== destinationCollection && this.qmd.updatesAllCollections?.() !== true) {\n await this.updateCollectionFromTierRoot(sourceCollection, fromTier);\n }\n if (this.autoEmbed) {\n await this.qmd.embedCollection(destinationCollection);\n if (sourceCollection !== destinationCollection) {\n await this.qmd.embedCollection(sourceCollection);\n }\n }\n }\n\n return result;\n }\n\n private collectionForTier(tier: MemoryTier): string {\n return tier === \"cold\" ? this.coldCollection : this.hotCollection;\n }\n\n private async updateCollectionFromTierRoot(collection: string, tier: MemoryTier): Promise<void> {\n const memoryDir = tier === \"cold\" ? path.join(this.storage.dir, \"cold\") : this.storage.dir;\n if (this.qmd.updatesAllCollections?.() !== true && this.qmd.updateCollectionFromDir) {\n await this.qmd.updateCollectionFromDir(collection, memoryDir);\n return;\n }\n await this.qmd.updateCollection(collection);\n }\n\n private async appendJournal(result: TierMigrationResult): Promise<void> {\n const entry: TierMigrationJournalEntry = {\n ts: new Date().toISOString(),\n memoryId: result.memoryId,\n fromTier: result.fromTier,\n toTier: result.toTier,\n changed: result.changed,\n reason: result.reason,\n targetPath: result.targetPath,\n };\n await mkdir(path.dirname(this.journalPath), { recursive: true });\n await appendFile(this.journalPath, `${JSON.stringify(entry)}\\n`, \"utf-8\");\n }\n}\n"],"mappings":";AAAA,SAAS,YAAY,aAAa;AAClC,OAAO,UAAU;AA2CV,IAAM,wBAAN,MAA4B;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,SAAuC;AACjD,SAAK,UAAU,QAAQ;AACvB,SAAK,MAAM,QAAQ;AACnB,SAAK,gBAAgB,QAAQ;AAC7B,SAAK,iBAAiB,QAAQ;AAC9B,SAAK,YAAY,QAAQ,cAAc;AACvC,SAAK,cAAc,QAAQ,eAAe,KAAK,KAAK,KAAK,QAAQ,KAAK,SAAS,8BAA8B;AAAA,EAC/G;AAAA,EAEA,MAAM,cAAc,SAA6D;AAC/E,UAAM,EA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AM,QAAQ,KAAK,IAAI,yBAAyB;AACnF,YAAM,KAAK,IAAI,wBAAwB,YAAY,SAAS;AAC5D;AAAA,IACF;AACA,UAAM,KAAK,IAAI,iBAAiB,UAAU;AAAA,EAC5C;AAAA,EAEA,MAAc,cAAc,QAA4C;AACtE,UAAM,QAAmC;AAAA,MACvC,KAAI,oBAAI,KAAK,GAAE,YAAY;AAAA,MAC3B,UAAU,OAAO;AAAA,MACjB,UAAU,OAAO;AAAA,MACjB,QAAQ,OAAO;AAAA,MACf,SAAS,OAAO;AAAA,MAChB,QAAQ,OAAO;AAAA,MACf,YAAY,OAAO;AAAA,IACrB;AACA,UAAM,MAAM,KAAK,QAAQ,KAAK,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC;AAC/D,UAAM,WAAW,KAAK,aAAa,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,GAAM,OAAO;AAAA,EAC1E;AACF;","names":[]}
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
} from "./chunk-EWLQPEO6.js";
|
|
7
7
|
import {
|
|
8
8
|
LanceDbBackend
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZDTVJXIP.js";
|
|
10
10
|
import {
|
|
11
11
|
MeilisearchBackend
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GMAG2HS4.js";
|
|
13
13
|
import {
|
|
14
14
|
NoopSearchBackend
|
|
15
15
|
} from "./chunk-2I5JGH3M.js";
|
|
16
16
|
import {
|
|
17
17
|
OramaBackend
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JHMFYY7L.js";
|
|
19
19
|
import {
|
|
20
20
|
createConversationIndexBackend
|
|
21
21
|
} from "./chunk-KIB7SDIJ.js";
|
|
@@ -167,4 +167,4 @@ export {
|
|
|
167
167
|
createConversationSearchBackend,
|
|
168
168
|
createConversationIndexRuntime
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-XPSVGJYA.js.map
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "./chunk-MDYG7VI7.js";
|
|
52
52
|
import {
|
|
53
53
|
TierMigrationExecutor
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-VOUOLGIP.js";
|
|
55
55
|
import {
|
|
56
56
|
decideTierTransition
|
|
57
57
|
} from "./chunk-S75M5ZRK.js";
|
|
@@ -227,11 +227,11 @@ import {
|
|
|
227
227
|
} from "./chunk-A6D7A2FW.js";
|
|
228
228
|
import {
|
|
229
229
|
NamespaceSearchRouter
|
|
230
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-6ZZP4EJF.js";
|
|
231
231
|
import {
|
|
232
232
|
createConversationIndexRuntime,
|
|
233
233
|
createSearchBackend
|
|
234
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-XPSVGJYA.js";
|
|
235
235
|
import {
|
|
236
236
|
NoopSearchBackend
|
|
237
237
|
} from "./chunk-2I5JGH3M.js";
|
|
@@ -2565,7 +2565,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
2565
2565
|
if (signal.aborted) return;
|
|
2566
2566
|
if (this.config.lifecyclePolicyEnabled && this.config.qmdTierMigrationEnabled) {
|
|
2567
2567
|
try {
|
|
2568
|
-
const { runFirstStartMigration } = await import("./first-start-migration-
|
|
2568
|
+
const { runFirstStartMigration } = await import("./first-start-migration-GYJWIH36.js");
|
|
2569
2569
|
const result = await runFirstStartMigration({
|
|
2570
2570
|
storage: this.storage,
|
|
2571
2571
|
config: this.config,
|
|
@@ -12441,4 +12441,4 @@ export {
|
|
|
12441
12441
|
resolvePersistedMemoryRelativePath,
|
|
12442
12442
|
Orchestrator
|
|
12443
12443
|
};
|
|
12444
|
-
//# sourceMappingURL=chunk-
|
|
12444
|
+
//# sourceMappingURL=chunk-YJ6QCQNE.js.map
|
|
@@ -96,11 +96,14 @@ var LanceDbBackend = class {
|
|
|
96
96
|
await this.updateCollection(this.collection, execution);
|
|
97
97
|
}
|
|
98
98
|
async updateCollection(collection, execution) {
|
|
99
|
+
await this.updateCollectionFromDir(collection, this.memoryDir, execution);
|
|
100
|
+
}
|
|
101
|
+
async updateCollectionFromDir(collection, memoryDir, execution) {
|
|
99
102
|
if (isSearchAborted(execution)) return;
|
|
100
103
|
let table = await this.ensureTableForCollection(collection);
|
|
101
104
|
if (isSearchAborted(execution)) return;
|
|
102
105
|
if (!table) return;
|
|
103
|
-
const docs = await scanMemoryDir(
|
|
106
|
+
const docs = await scanMemoryDir(memoryDir);
|
|
104
107
|
if (isSearchAborted(execution)) return;
|
|
105
108
|
if (docs.length === 0) {
|
|
106
109
|
try {
|
|
@@ -480,4 +483,4 @@ function isMissingVectorProviderColumnError(err) {
|
|
|
480
483
|
export {
|
|
481
484
|
LanceDbBackend
|
|
482
485
|
};
|
|
483
|
-
//# sourceMappingURL=chunk-
|
|
486
|
+
//# sourceMappingURL=chunk-ZDTVJXIP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/search/lancedb-backend.ts"],"sourcesContent":["import { log } from \"../logger.js\";\nimport type { SearchBackend, SearchExecutionOptions, SearchQueryOptions, SearchResult } from \"./port.js\";\nimport type { EmbedHelper, EmbedProviderIdentity, EmbedWithProviderResult } from \"./embed-helper.js\";\nimport { scanMemoryDir } from \"./document-scanner.js\";\nimport { isSearchAborted, throwIfSearchAborted } from \"./abort.js\";\n\nexport interface LanceDbBackendOptions {\n dbPath: string;\n collection: string;\n embedHelper: EmbedHelper;\n memoryDir: string;\n embeddingDimension: number;\n}\n\n/**\n * LanceDB search backend — embedded hybrid FTS+vector with RRF reranking.\n *\n * Uses @lancedb/lancedb for native Arrow-backed storage.\n * One table per collection. Supports full-text, vector, and hybrid search.\n */\nexport class LanceDbBackend implements SearchBackend {\n private readonly dbPath: string;\n private readonly collection: string;\n private readonly embedHelper: EmbedHelper;\n private readonly memoryDir: string;\n private readonly embeddingDimension: number;\n private available = false;\n private db: any = null;\n private lanceModule: any = null;\n private readonly vectorProviderCompatibility = new WeakMap<\n object,\n { providerIdentity: EmbedProviderIdentity; compatible: boolean }\n >();\n\n constructor(opts: LanceDbBackendOptions) {\n this.dbPath = opts.dbPath;\n this.collection = opts.collection;\n this.embedHelper = opts.embedHelper;\n this.memoryDir = opts.memoryDir;\n this.embeddingDimension = opts.embeddingDimension;\n }\n\n async probe(): Promise<boolean> {\n try {\n await this.ensureDb();\n this.available = true;\n return true;\n } catch (err) {\n log.debug(`LanceDbBackend probe failed: ${err}`);\n this.available = false;\n return false;\n }\n }\n\n isAvailable(): boolean {\n return this.available;\n }\n\n debugStatus(): string {\n return `backend=lancedb available=${this.available} dbPath=${this.dbPath}`;\n }\n\n async search(\n query: string,\n _collection?: string,\n maxResults?: number,\n _options?: SearchQueryOptions,\n execution?: SearchExecutionOptions,\n ): Promise<SearchResult[]> {\n return this.hybridSearch(query, _collection, maxResults, execution);\n }\n\n async searchGlobal(query: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n const limit = maxResults ?? 10;\n if (!this.available) return [];\n\n try {\n throwIfSearchAborted(execution, \"LanceDbBackend global search aborted\");\n const db = await this.ensureDb();\n const tableNames = await db.tableNames();\n const allResults: SearchResult[] = [];\n\n for (const name of tableNames) {\n throwIfSearchAborted(execution, \"LanceDbBackend global search aborted\");\n try {\n const table = await db.openTable(name);\n const results = await this.searchTable(table, query, \"hybrid\", limit, execution);\n allResults.push(...results);\n } catch {\n // Skip tables that fail\n }\n }\n\n allResults.sort((a, b) => b.score - a.score);\n return allResults.slice(0, limit);\n } catch (err) {\n log.debug(`LanceDbBackend searchGlobal failed: ${err}`);\n return [];\n }\n }\n\n async bm25Search(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n if (isSearchAborted(execution)) return [];\n const table = await this.ensureTableForCollection(collection ?? this.collection);\n if (isSearchAborted(execution)) return [];\n if (!table) return [];\n return this.searchTable(table, query, \"fts\", maxResults ?? 10, execution);\n }\n\n async vectorSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n if (isSearchAborted(execution)) return [];\n const table = await this.ensureTableForCollection(collection ?? this.collection);\n if (isSearchAborted(execution)) return [];\n if (!table) return [];\n return this.searchTable(table, query, \"vector\", maxResults ?? 10, execution);\n }\n\n async hybridSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]> {\n if (isSearchAborted(execution)) return [];\n const table = await this.ensureTableForCollection(collection ?? this.collection);\n if (isSearchAborted(execution)) return [];\n if (!table) return [];\n return this.searchTable(table, query, \"hybrid\", maxResults ?? 10, execution);\n }\n\n async update(execution?: SearchExecutionOptions): Promise<void> {\n await this.updateCollection(this.collection, execution);\n }\n\n async updateCollection(collection: string, execution?: SearchExecutionOptions): Promise<void> {\n await this.updateCollectionFromDir(collection, this.memoryDir, execution);\n }\n\n async updateCollectionFromDir(collection: string, memoryDir: string, execution?: SearchExecutionOptions): Promise<void> {\n if (isSearchAborted(execution)) return;\n let table = await this.ensureTableForCollection(collection);\n if (isSearchAborted(execution)) return;\n if (!table) return;\n\n const docs = await scanMemoryDir(memoryDir);\n if (isSearchAborted(execution)) return;\n if (docs.length === 0) {\n // Clear stale data when no docs remain\n try {\n const db = await this.ensureDb();\n await db.dropTable(collection).catch(() => {});\n if (collection === this.collection) this.table = null;\n } catch {\n // Best-effort cleanup\n }\n return;\n }\n\n const embeddingProviderIdentity = this.embedHelper.getProviderIdentity();\n const existingVectors = new Map<string, {\n vector: number[];\n providerIdentity?: string;\n }>();\n const vectorProviderColumnState = await this.tableVectorProviderColumnState(table);\n if (vectorProviderColumnState === \"missing\") {\n table = await this.recreateTableForCollection(collection);\n if (isSearchAborted(execution)) return;\n if (!table) return;\n } else if (vectorProviderColumnState === \"present\") {\n try {\n const existingRows = await table.query().select([\"docid\", \"vector\", \"vectorProvider\"]).toArray();\n for (const row of existingRows ?? []) {\n if (isSearchAborted(execution)) return;\n const docid = row.docid;\n if (typeof docid !== \"string\") continue;\n const vector = row.vector;\n if (!vector || typeof vector !== \"object\") continue;\n existingVectors.set(docid, {\n vector: Array.from(vector as ArrayLike<number>),\n providerIdentity: typeof row.vectorProvider === \"string\" ? row.vectorProvider : undefined,\n });\n }\n } catch {\n log.debug(\"LanceDbBackend skipped refresh after vector preservation failed\");\n return;\n }\n } else {\n log.debug(\"LanceDbBackend skipped vector preservation after vectorProvider probe failed\");\n return;\n }\n\n const rows = docs.map((d) => {\n const existing = existingVectors.get(d.docid);\n const canPreserveVector =\n existing &&\n this.isCompatibleStoredVector(existing.vector) &&\n (!embeddingProviderIdentity ||\n existing.providerIdentity === embeddingProviderIdentity);\n return {\n docid: d.docid,\n path: d.path,\n content: d.content,\n snippet: d.snippet,\n vector: canPreserveVector\n ? existing.vector\n : new Array(this.embeddingDimension).fill(0),\n vectorProvider: canPreserveVector\n ? existing.providerIdentity ?? \"\"\n : \"\",\n };\n });\n\n try {\n if (isSearchAborted(execution)) return;\n await table.add(rows, { mode: \"overwrite\" });\n this.rememberVectorProviderCompatibility(\n table,\n embeddingProviderIdentity,\n rows.length > 0 && rows.every((row) => row.vectorProvider === embeddingProviderIdentity),\n );\n if (isSearchAborted(execution)) return;\n // Create FTS index on content column\n try {\n await table.createIndex(\"content\", { config: this.lanceIndex.fts() });\n } catch {\n // FTS index creation may fail on some platforms — degrade gracefully\n }\n if (collection === this.collection) this.table = table;\n } catch (err) {\n log.debug(`LanceDbBackend update failed: ${err}`);\n }\n }\n\n async embed(): Promise<void> {\n await this.embedCollection(this.collection);\n }\n\n async embedCollection(collection: string): Promise<void> {\n if (!this.embedHelper.isAvailable()) return;\n\n const table = await this.ensureTableForCollection(collection);\n if (!table) return;\n\n try {\n const embeddingProviderIdentity = this.embedHelper.getProviderIdentity();\n const allRows = await table.query().select([\"docid\", \"content\", \"vector\", \"vectorProvider\"]).toArray();\n const needsEmbed = allRows.filter((row: any) => {\n if (embeddingProviderIdentity && row.vectorProvider !== embeddingProviderIdentity) {\n return true;\n }\n return !this.isCompatibleStoredVector(row.vector);\n });\n\n if (needsEmbed.length === 0) {\n this.rememberVectorProviderCompatibility(table, embeddingProviderIdentity, true);\n return;\n }\n\n let rowsToEmbed = needsEmbed;\n let embedResult = await this.embedHelper.embedBatchWithProvider(\n rowsToEmbed.map((row: any) => row.content as string),\n );\n if (!embedResult) return;\n if (\n embeddingProviderIdentity &&\n embedResult.providerIdentity !== embeddingProviderIdentity\n ) {\n const effectiveProviderIdentity = embedResult.providerIdentity;\n const originalDocids = new Set(rowsToEmbed.map((row: any) => row.docid));\n const effectiveNeedsEmbed = allRows.filter((row: any) => (\n row.vectorProvider !== effectiveProviderIdentity ||\n !this.isCompatibleStoredVector(row.vector)\n ));\n const sameRows =\n effectiveNeedsEmbed.length === rowsToEmbed.length &&\n effectiveNeedsEmbed.every((row: any) => originalDocids.has(row.docid));\n if (!sameRows) {\n const effectiveTexts = effectiveNeedsEmbed.map((row: any) => row.content as string);\n const effectiveEmbedResult = await this.embedHelper.embedBatchWithProvider(effectiveTexts);\n if (effectiveEmbedResult) {\n rowsToEmbed = effectiveNeedsEmbed;\n embedResult = effectiveEmbedResult;\n }\n }\n }\n const { vectors, providerIdentity } = embedResult;\n\n let allEmbedded = true;\n for (let i = 0; i < rowsToEmbed.length; i++) {\n const vec = vectors[i];\n if (!this.isExpectedDimensionVector(vec)) {\n allEmbedded = false;\n continue;\n }\n const docid = rowsToEmbed[i].docid;\n await table.update({\n where: `docid = '${docid.replace(/'/g, \"''\")}'`,\n values: { vector: vec, vectorProvider: providerIdentity },\n });\n }\n if (allEmbedded) {\n this.rememberVectorProviderCompatibility(table, providerIdentity, true);\n } else {\n this.rememberVectorProviderCompatibility(table, providerIdentity, false);\n }\n } catch (err) {\n log.debug(`LanceDbBackend embed failed: ${err}`);\n }\n }\n\n async ensureCollection(\n _memoryDir: string,\n _execution?: SearchExecutionOptions,\n ): Promise<\"present\" | \"missing\" | \"unknown\" | \"skipped\"> {\n try {\n await this.ensureTable();\n return \"present\";\n } catch {\n return \"missing\";\n }\n }\n\n private table: any = null;\n\n private get lanceIndex(): any {\n return this.lanceModule.Index ?? this.lanceModule.default?.Index;\n }\n\n private async ensureDb(): Promise<any> {\n if (this.db) return this.db;\n if (!this.lanceModule) {\n this.lanceModule = await import(\"@lancedb/lancedb\");\n }\n const connect = this.lanceModule.connect ?? this.lanceModule.default?.connect;\n this.db = await connect(this.dbPath);\n return this.db;\n }\n\n private async ensureTableForCollection(collection: string): Promise<any> {\n // For the default collection, use the cached instance\n if (collection === this.collection) return this.ensureTable();\n\n const db = await this.ensureDb();\n const tables = await db.tableNames();\n\n if (tables.includes(collection)) {\n return await db.openTable(collection);\n }\n\n // Create empty table with schema\n const emptyRow = {\n docid: \"__placeholder__\",\n path: \"\",\n content: \"\",\n snippet: \"\",\n vector: new Array(this.embeddingDimension).fill(0),\n vectorProvider: \"\",\n };\n const newTable = await db.createTable(collection, [emptyRow]);\n try {\n await newTable.createIndex(\"content\", { config: this.lanceIndex.fts() });\n } catch {\n // FTS index creation may fail — degrade gracefully\n }\n try {\n await newTable.delete(\"docid = '__placeholder__'\");\n } catch {\n // May fail if delete isn't supported on empty-ish tables\n }\n return newTable;\n }\n\n private async recreateTableForCollection(collection: string): Promise<any> {\n const db = await this.ensureDb();\n try {\n await db.dropTable(collection).catch(() => {});\n } catch {\n // Best-effort legacy schema migration; table creation below may still recover.\n }\n if (collection === this.collection) this.table = null;\n return this.ensureTableForCollection(collection);\n }\n\n private async tableVectorProviderColumnState(table: any): Promise<\"present\" | \"missing\" | \"unknown\"> {\n try {\n await table.query().select([\"vectorProvider\"]).toArray();\n return \"present\";\n } catch (err) {\n if (isMissingVectorProviderColumnError(err)) {\n return \"missing\";\n }\n log.debug(`LanceDbBackend vectorProvider column probe failed: ${err}`);\n return \"unknown\";\n }\n }\n\n private async ensureTable(): Promise<any> {\n if (this.table) return this.table;\n\n const db = await this.ensureDb();\n const tables = await db.tableNames();\n\n if (tables.includes(this.collection)) {\n this.table = await db.openTable(this.collection);\n return this.table;\n }\n\n // Create empty table with schema\n const emptyRow = {\n docid: \"__placeholder__\",\n path: \"\",\n content: \"\",\n snippet: \"\",\n vector: new Array(this.embeddingDimension).fill(0),\n vectorProvider: \"\",\n };\n this.table = await db.createTable(this.collection, [emptyRow]);\n // Create FTS index on content column\n try {\n await this.table.createIndex(\"content\", { config: this.lanceIndex.fts() });\n } catch {\n // FTS index creation may fail — degrade gracefully\n }\n // Remove placeholder row\n try {\n await this.table.delete(\"docid = '__placeholder__'\");\n } catch {\n // May fail if delete isn't supported on empty-ish tables\n }\n return this.table;\n }\n\n private async searchTable(\n table: any,\n query: string,\n mode: \"fts\" | \"vector\" | \"hybrid\",\n limit: number,\n execution?: SearchExecutionOptions,\n ): Promise<SearchResult[]> {\n try {\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n if (mode === \"fts\") {\n const results = await table.search(query, \"fts\").limit(limit).toArray();\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n return this.mapRows(results);\n }\n\n if (mode === \"vector\") {\n const embedResult = await this.resolveCompatibleQueryEmbedding(table, query, execution);\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n if (!embedResult) {\n // Fall back to FTS\n const results = await table.search(query, \"fts\").limit(limit).toArray();\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n return this.mapRows(results);\n }\n const results = await table.search(embedResult.vector).limit(limit).toArray();\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n return this.mapRows(results);\n }\n\n // hybrid — try FTS+vector with RRF reranking\n const embedResult = await this.resolveCompatibleQueryEmbedding(table, query, execution);\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n if (!embedResult) {\n const results = await table.search(query, \"fts\").limit(limit).toArray();\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n return this.mapRows(results);\n }\n\n try {\n const results = await table\n .search(query, \"hybrid\")\n .vector(embedResult.vector)\n .limit(limit)\n .toArray();\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n return this.mapRows(results);\n } catch {\n // Hybrid may not be supported in all LanceDB versions — fall back to vector\n const results = await table.search(embedResult.vector).limit(limit).toArray();\n throwIfSearchAborted(execution, `LanceDbBackend ${mode} search aborted`);\n return this.mapRows(results);\n }\n } catch (err) {\n log.debug(`LanceDbBackend search (${mode}) failed: ${err}`);\n return [];\n }\n }\n\n private async resolveCompatibleQueryEmbedding(\n table: any,\n query: string,\n execution?: SearchExecutionOptions,\n ): Promise<EmbedWithProviderResult | null> {\n const embedResult = await this.embedHelper.embedWithProvider(query, { signal: execution?.signal });\n throwIfSearchAborted(execution, \"LanceDbBackend query embedding aborted\");\n if (!embedResult || !this.isExpectedDimensionVector(embedResult.vector)) return null;\n\n const storedProviderIdentity = await this.findCompatibleStoredVectorProvider(table, execution);\n if (!storedProviderIdentity) {\n this.rememberVectorProviderCompatibility(table, embedResult.providerIdentity, false);\n return null;\n }\n if (storedProviderIdentity === embedResult.providerIdentity) return embedResult;\n\n const fallbackEmbed = await this.embedQueryWithStoredFallbackProvider(query, storedProviderIdentity, execution);\n throwIfSearchAborted(execution, \"LanceDbBackend fallback query embedding aborted\");\n if (\n fallbackEmbed &&\n fallbackEmbed.providerIdentity === storedProviderIdentity &&\n this.isExpectedDimensionVector(fallbackEmbed.vector)\n ) {\n return fallbackEmbed;\n }\n\n this.rememberVectorProviderCompatibility(table, embedResult.providerIdentity, false);\n return null;\n }\n\n private async embedQueryWithStoredFallbackProvider(\n query: string,\n providerIdentity: EmbedProviderIdentity,\n execution?: SearchExecutionOptions,\n ): Promise<EmbedWithProviderResult | null> {\n const embedWithIdentity = (this.embedHelper as unknown as {\n embedWithFallbackProviderIdentity?: (\n text: string,\n identity: EmbedProviderIdentity,\n options?: { signal?: AbortSignal },\n ) => Promise<EmbedWithProviderResult | null>;\n }).embedWithFallbackProviderIdentity;\n if (typeof embedWithIdentity !== \"function\") return null;\n return embedWithIdentity.call(this.embedHelper, query, providerIdentity, { signal: execution?.signal });\n }\n\n private async findCompatibleStoredVectorProvider(\n table: any,\n execution?: SearchExecutionOptions,\n ): Promise<EmbedProviderIdentity | null> {\n try {\n const cached = this.vectorProviderCompatibility.get(table);\n if (cached?.compatible) return cached.providerIdentity;\n const rows = await table.query().select([\"vector\", \"vectorProvider\"]).toArray();\n let providerIdentity: EmbedProviderIdentity | null = null;\n let compatible = rows.length > 0;\n for (const row of rows ?? []) {\n throwIfSearchAborted(execution, \"LanceDbBackend vector provider check aborted\");\n if (\n typeof row.vectorProvider !== \"string\" ||\n row.vectorProvider.length === 0 ||\n !this.isCompatibleStoredVector(row.vector)\n ) {\n compatible = false;\n break;\n }\n if (providerIdentity && row.vectorProvider !== providerIdentity) {\n compatible = false;\n break;\n }\n providerIdentity = row.vectorProvider as EmbedProviderIdentity;\n }\n if (compatible && providerIdentity) {\n this.vectorProviderCompatibility.set(table, {\n providerIdentity,\n compatible: true,\n });\n return providerIdentity;\n }\n return null;\n } catch (err) {\n if (isSearchAborted(execution)) throw err;\n log.debug(`LanceDbBackend stored vector provider check failed: ${err}`);\n return null;\n }\n }\n\n private mapRows(rows: any[]): SearchResult[] {\n return (rows ?? [])\n .filter((row) => row.docid && row.docid !== \"__placeholder__\")\n .map((row) => ({\n docid: row.docid ?? \"\",\n path: row.path ?? \"\",\n snippet: row.snippet ?? row.content?.slice(0, 200) ?? \"\",\n score: row._relevance_score ?? (row._distance != null ? 1 / (1 + (row._distance ?? 0)) : 0.5),\n }));\n }\n\n private async tableHasCompatibleVectors(\n table: any,\n providerIdentity: EmbedProviderIdentity,\n execution?: SearchExecutionOptions,\n ): Promise<boolean> {\n try {\n const cached = this.vectorProviderCompatibility.get(table);\n if (cached?.providerIdentity === providerIdentity) return cached.compatible;\n const rows = await table.query().select([\"vector\", \"vectorProvider\"]).toArray();\n let compatible = rows.length > 0;\n for (const row of rows ?? []) {\n throwIfSearchAborted(execution, \"LanceDbBackend vector provider check aborted\");\n if (\n row.vectorProvider !== providerIdentity ||\n !this.isCompatibleStoredVector(row.vector)\n ) {\n compatible = false;\n break;\n }\n }\n this.vectorProviderCompatibility.set(table, { providerIdentity, compatible });\n return compatible;\n } catch (err) {\n if (isSearchAborted(execution)) throw err;\n log.debug(`LanceDbBackend vector provider check failed: ${err}`);\n return false;\n }\n }\n\n private rememberVectorProviderCompatibility(\n table: unknown,\n providerIdentity: EmbedProviderIdentity | null,\n compatible: boolean,\n ): void {\n if (!table || typeof table !== \"object\") return;\n if (!providerIdentity) {\n this.vectorProviderCompatibility.delete(table);\n return;\n }\n this.vectorProviderCompatibility.set(table, { providerIdentity, compatible });\n }\n\n private isExpectedDimensionVector(vector: number[] | null | undefined): vector is number[] {\n return Array.isArray(vector) && vector.length === this.embeddingDimension;\n }\n\n private isCompatibleStoredVector(vector: unknown): boolean {\n if (!vector || typeof vector !== \"object\") return false;\n const arr = Array.from(vector as ArrayLike<number>);\n return (\n arr.length === this.embeddingDimension &&\n arr.every((value) => Number.isFinite(value)) &&\n arr.some((value) => value !== 0)\n );\n }\n}\n\nfunction isMissingVectorProviderColumnError(err: unknown): boolean {\n const message = err instanceof Error ? err.message : String(err);\n return /\\bvectorProvider\\b/i.test(message) &&\n /\\b(column|field|schema|missing|not found|not exist|does not exist|unknown)\\b/i.test(message);\n}\n"],"mappings":";;;;;;;;;;;;AAoBO,IAAM,iBAAN,MAA8C;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACT,YAAY;AAAA,EACZ,KAAU;AAAA,EACV,cAAmB;AAAA,EACV,8BAA8B,oBAAI,QAGjD;AAAA,EAEF,YAAY,MAA6B;AACvC,SAAK,SAAS,KAAK;AACnB,SAAK,aAAa,KAAK;AACvB,SAAK,cAAc,KAAK;AACxB,SAAK,YAAY,KAAK;AACtB,SAAK,qBAAqB,KAAK;AAAA,EACjC;AAAA,EAEA,MAAM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yD;AACzF,WAAO,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,KAAK;AAAA,EACzD;AAAA,EAEQ,yBAAyB,QAA0B;AACzD,QAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAClD,UAAM,MAAM,MAAM,KAAK,MAA2B;AAClD,WACE,IAAI,WAAW,KAAK,sBACpB,IAAI,MAAM,CAAC,UAAU,OAAO,SAAS,KAAK,CAAC,KAC3C,IAAI,KAAK,CAAC,UAAU,UAAU,CAAC;AAAA,EAEnC;AACF;AAEA,SAAS,mCAAmC,KAAuB;AACjE,QAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,SAAO,sBAAsB,KAAK,OAAO,KACvC,gFAAgF,KAAK,OAAO;AAChG;","names":["embedResult","results"]}
|
package/dist/cli.js
CHANGED
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
runWorkProductStatusCliCommand,
|
|
90
90
|
runWorkProjectCliCommand,
|
|
91
91
|
runWorkTaskCliCommand
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-IOTENEVL.js";
|
|
93
93
|
import "./chunk-LQHDIS7L.js";
|
|
94
94
|
import "./chunk-7F7Z6MOS.js";
|
|
95
95
|
import "./chunk-4RR6ROTB.js";
|
|
@@ -121,8 +121,8 @@ import "./chunk-IK34DVAC.js";
|
|
|
121
121
|
import "./chunk-NSKYFGDL.js";
|
|
122
122
|
import "./chunk-TGQ2NTWH.js";
|
|
123
123
|
import "./chunk-CF3ZF2YU.js";
|
|
124
|
-
import "./chunk-
|
|
125
|
-
import "./chunk-
|
|
124
|
+
import "./chunk-VJXSUAO7.js";
|
|
125
|
+
import "./chunk-6JGNHWCI.js";
|
|
126
126
|
import "./chunk-AJA46VX5.js";
|
|
127
127
|
import "./chunk-HL4DB7TO.js";
|
|
128
128
|
import "./chunk-YNDLCWXS.js";
|
|
@@ -142,14 +142,14 @@ import "./chunk-ZRWB5D4H.js";
|
|
|
142
142
|
import "./chunk-A6D7A2FW.js";
|
|
143
143
|
import "./chunk-FF4KLI5W.js";
|
|
144
144
|
import "./chunk-SFQ6QNL7.js";
|
|
145
|
-
import "./chunk-
|
|
146
|
-
import "./chunk-
|
|
145
|
+
import "./chunk-6ZZP4EJF.js";
|
|
146
|
+
import "./chunk-XPSVGJYA.js";
|
|
147
147
|
import "./chunk-JNANKJLN.js";
|
|
148
148
|
import "./chunk-EWLQPEO6.js";
|
|
149
|
-
import "./chunk-
|
|
150
|
-
import "./chunk-
|
|
149
|
+
import "./chunk-ZDTVJXIP.js";
|
|
150
|
+
import "./chunk-GMAG2HS4.js";
|
|
151
151
|
import "./chunk-2I5JGH3M.js";
|
|
152
|
-
import "./chunk-
|
|
152
|
+
import "./chunk-JHMFYY7L.js";
|
|
153
153
|
import "./chunk-CINZGPSJ.js";
|
|
154
154
|
import "./chunk-Q4CAQGKQ.js";
|
|
155
155
|
import "./chunk-IK7DCC5H.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-W7L6HXUC.js";
|
|
5
5
|
import {
|
|
6
6
|
TierMigrationExecutor
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VOUOLGIP.js";
|
|
8
8
|
import {
|
|
9
9
|
decideTierTransition
|
|
10
10
|
} from "./chunk-S75M5ZRK.js";
|
|
@@ -260,4 +260,4 @@ export {
|
|
|
260
260
|
LIFECYCLE_INIT_DONE_MARKER,
|
|
261
261
|
runFirstStartMigration
|
|
262
262
|
};
|
|
263
|
-
//# sourceMappingURL=first-start-migration-
|
|
263
|
+
//# sourceMappingURL=first-start-migration-GYJWIH36.js.map
|