feat: harden plugin system wiring and add developer diagnostics
Fix critical wiring bugs that prevented plugin-provided implementations from being used at runtime. All CRUD operations, fork/checkout/clear, batch embedding, neural APIs, and VFS path resolution now properly dispatch through the plugin registry. Changes: - Wire graphIndex to storage for getVerbsBySource() fast path - Replace instanceof checks with duck-typing (indexIsTypeAware flag) so plugin HNSW indexes work in add/update/delete/search - Add createIndex() shared helper for plugin HNSW factory - Fix fork/checkout/clear to use plugin factories for metadataIndex, graphIndex, and HNSW instead of hardcoding JS constructors - Add three-tier embedBatch priority: embedBatch > embeddings > WASM - Skip WASM warmup/eagerEmbeddings when plugin provides embeddings - Fix PathResolver metadataIndex access (was looking on storage) - Use global UnifiedCache in SemanticPathResolver - Wire plugin distance function through neural APIs - Add diagnostics() method and CLI command for provider inspection - Add requireProviders() for production fail-fast assertions - Add init-time provider summary log - Add plugin developer documentation (docs/PLUGINS.md) - Export DiagnosticsResult type
This commit is contained in:
parent
3a21bf62b7
commit
401e300ff2
12 changed files with 705 additions and 77 deletions
|
|
@ -64,6 +64,7 @@ interface HistoricalEntry {
|
|||
*/
|
||||
export class VerbEmbeddingSignal {
|
||||
private brain: Brainy
|
||||
private distanceFn: (a: Vector, b: Vector) => number
|
||||
private options: Required<VerbEmbeddingSignalOptions>
|
||||
|
||||
// Pre-computed verb type embeddings (loaded once at startup)
|
||||
|
|
@ -88,6 +89,7 @@ export class VerbEmbeddingSignal {
|
|||
|
||||
constructor(brain: Brainy, options?: VerbEmbeddingSignalOptions) {
|
||||
this.brain = brain
|
||||
this.distanceFn = (brain as any).distance || cosineDistance
|
||||
this.options = {
|
||||
minConfidence: options?.minConfidence ?? 0.60,
|
||||
minSimilarity: options?.minSimilarity ?? 0.55,
|
||||
|
|
@ -142,7 +144,7 @@ export class VerbEmbeddingSignal {
|
|||
const similarities: Array<{ type: VerbType; similarity: number }> = []
|
||||
|
||||
for (const [verbType, typeEmbedding] of this.verbTypeEmbeddings) {
|
||||
const distance = cosineDistance(embedding, typeEmbedding)
|
||||
const distance = this.distanceFn(embedding, typeEmbedding)
|
||||
const similarity = 1 - distance // Convert distance to similarity
|
||||
similarities.push({ type: verbType, similarity })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue