fix(8.0): createIndex resolves the canonical 'vector' provider key — drop diskann/hnsw key lookups + legacy migration APIs

createIndex() still resolved the retired 'diskann' and 'hnsw' provider
keys and never looked up 'vector', so an 8.0-era plugin registering its
vector engine under the canonical 'vector' key silently never engaged
and Brainy always fell back to the built-in JS HNSW index. createIndex()
now resolves only getProvider('vector') (same factory call shape as the
old hnsw path) and falls back to setupIndex().

The brainy-side mode/migration machinery is obsolete in the 8.0 provider
world — the registered engine adapts internally (in-memory / hybrid /
on-disk selection is the provider's job, not Brainy's):

- delete migrateToDiskAnn() / migrateToHnsw() and the ADR-002
  index-engine migration block
- delete diskAnnAutoEngageConditionsMet() / instantiateDiskAnn()
- narrow HNSWConfig.type to 'vector' and drop the diskann tuning block
  (coreTypes.ts)
- well-known provider key lists + diagnostics now report 'vector'
  instead of the never-registered 'hnsw' key
- plugin.ts docs: 'vector' is the only vector-index key consulted; the
  pre-8.0 'hnsw'/'diskann' keys are retired

The schema-migration machinery (migrate(), checkMigrations(),
MigrationRunner, autoMigrate) serves data migrations and is untouched.
This commit is contained in:
David Snelling 2026-06-10 11:29:05 -07:00
parent 2427bb7960
commit 49e49483d1
3 changed files with 22 additions and 290 deletions

View file

@ -62,7 +62,7 @@ export interface BrainyPluginContext {
* - 'graphIndex' GraphAdjacencyIndex replacement
* - 'entityIdMapper' EntityIdMapper replacement
* - 'cache' UnifiedCache replacement
* - 'hnsw' JsHnswVectorIndex replacement
* - 'vector' JsHnswVectorIndex replacement (vector index engine)
* - 'roaring' RoaringBitmap32 replacement
* - 'embeddings' Embedding engine replacement (single text)
* - 'embedBatch' Batch embedding engine (texts[] vectors[])
@ -270,8 +270,9 @@ export interface GraphIndexProvider {
* so they are optional and not part of the required contract (Brainy's own JS
* HNSW index omits `setPersistMode`, for instance).
*
* **Provider key:** registered under `'vector'`. The legacy `'hnsw'` key is
* accepted as a compat shim in 8.0 and retired in a future release.
* **Provider key:** registered under `'vector'` the only key Brainy
* consults for the vector index. The pre-8.0 `'hnsw'` and `'diskann'` keys
* are retired and never looked up.
*/
export interface VectorIndexProvider {
addItem(item: VectorDocument): Promise<string>