feat: migrate embeddings to Candle WASM + remove semantic type inference

Major architectural changes:

1. EMBEDDINGS ENGINE (ONNX → Candle WASM):
   - Replace ONNX Runtime with Rust Candle compiled to WASM
   - Embedded model in WASM binary (no external downloads)
   - Quantized Q8 precision with <50MB memory footprint
   - Zero-download, offline-first operation
   - Same embedding quality (all-MiniLM-L6-v2)

2. REMOVE SEMANTIC TYPE INFERENCE:
   - Delete embeddedKeywordEmbeddings.ts (14MB of pre-computed embeddings)
   - Remove typeAwareQueryPlanner.ts and semanticTypeInference.ts
   - Remove VerbExactMatchSignal (uses keyword embeddings)
   - Update SmartRelationshipExtractor to 3 signals (55%/30%/15% weights)

API CHANGES (requires v7.0.0):
- Removed: inferTypes(), inferNouns(), inferVerbs(), inferIntent()
- Removed: getSemanticTypeInference(), SemanticTypeInference class
- Removed: TypeInference, SemanticTypeInferenceOptions types

Users can still use natural language queries in find() - they just
need to specify type explicitly for type-optimized searches.

PACKAGE SIZE IMPACT:
- Compressed: 90.1 MB → 86.2 MB (-4.3%)
- Uncompressed: 114.4 MB → 100.3 MB (-12%)
- ~448K lines of code removed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
David Snelling 2026-01-06 12:52:34 -08:00
parent 81cd16e41b
commit da7d2ed29d
60 changed files with 3887 additions and 448557 deletions

View file

@ -486,18 +486,6 @@ import { getNounTypes, getVerbTypes, getNounTypeMap, getVerbTypeMap } from './ut
// Export BrainyTypes for complete type management
import { BrainyTypes, TypeSuggestion, suggestType } from './utils/brainyTypes.js'
// Export Semantic Type Inference - THE ONE unified system (nouns + verbs)
import {
inferTypes,
inferNouns,
inferVerbs,
inferIntent,
getSemanticTypeInference,
SemanticTypeInference,
type TypeInference,
type SemanticTypeInferenceOptions
} from './query/semanticTypeInference.js'
export {
NounType,
VerbType,
@ -507,20 +495,11 @@ export {
getVerbTypeMap,
// BrainyTypes - complete type management
BrainyTypes,
suggestType,
// Semantic Type Inference - Unified noun + verb inference
inferTypes, // Main function - returns all types (nouns + verbs)
inferNouns, // Convenience - noun types only
inferVerbs, // Convenience - verb types only
inferIntent, // Best for query understanding - returns {nouns, verbs}
getSemanticTypeInference,
SemanticTypeInference
suggestType
}
export type {
TypeSuggestion,
TypeInference,
SemanticTypeInferenceOptions
TypeSuggestion
}
// Export MCP (Model Control Protocol) components