Files
HaBraid/src/sources/adapter.ts
Contributor 5d5336757d feat: HaBraid v0.1.0 — host-following memory visualization engine for Obsidian
- Hybrid BM25 + HNSW vector search with context enrichment
- Knowledge graph with entities, relations, and community detection
- Host-following LLM route with fallback backends
- 3-tier lint system (static + HNSW dup + contradiction detection)
- Q&A Synthesis (Karpathy LLM Wiki pattern)
- 16 MCP tools for agent-driven workflows
- Incremental wiki generation with checkpointing
- SQLite-backed item store with FTS5 + vector indexes
2026-04-18 15:46:42 +09:00

58 lines
1.6 KiB
TypeScript

/**
* Source adapter interface re-export.
*
* The actual interface is defined in types.ts for central type management.
* This module provides the contract documentation and adapter registry.
*/
import type { SourceAdapter, WikiEngineConfig } from "../types.js";
export type { SourceAdapter };
/**
* Registry of available source adapters.
* New adapters register themselves here.
*/
const adapterRegistry: Map<string, (config: WikiEngineConfig) => SourceAdapter> = new Map();
/**
* Registers a source adapter factory.
*
* @param name Unique adapter name.
* @param factory Factory function that creates the adapter from config.
*/
export function registerAdapter(name: string, factory: (config: WikiEngineConfig) => SourceAdapter): void {
adapterRegistry.set(name, factory);
}
/**
* Returns all registered adapter names.
*
* @returns Adapter name list.
*/
export function getAdapterNames(): string[] {
return [...adapterRegistry.keys()];
}
/**
* Creates an adapter instance by name.
*
* @param name Adapter name.
* @param config Wiki engine configuration.
* @returns Source adapter instance.
*/
export function createAdapter(name: string, config: WikiEngineConfig): SourceAdapter | undefined {
const factory = adapterRegistry.get(name);
return factory ? factory(config) : undefined;
}
/**
* Creates all registered adapters and returns them.
*
* @param config Wiki engine configuration.
* @returns Array of adapter instances.
*/
export function createAllAdapters(config: WikiEngineConfig): SourceAdapter[] {
return [...adapterRegistry.values()].map((factory) => factory(config));
}