feat: wire plugin system with provider resolution, storage factories, and browser deprecation

- Wire PluginRegistry into Brainy init() with provider resolution for distance,
  metadataIndex, graphIndex, embeddings, roaring, msgpack, and storage adapters
- Add setupStorage() factory that resolves storage:* providers from plugins before
  falling back to built-in createStorage()
- Export internals API (setGlobalCache, UnifiedCache, EntityIdMapper, etc.) for
  cortex plugin consumption
- Add plugin.test.ts verifying registration, activation, and provider resolution
- Deprecate browser support (OPFS, Web Workers, WASM embeddings) with warnings
  in preparation for v8.0 server-only release
- FileSystemStorage: fix setupStorage resolution for mmap-filesystem provider
This commit is contained in:
David Snelling 2026-01-31 12:02:13 -08:00
parent 25912b5728
commit 1513e297ef
11 changed files with 456 additions and 33 deletions

View file

@ -4,6 +4,7 @@
/**
* Check if code is running in a browser environment
* @deprecated Browser support is deprecated and will be removed in v8.0. Use Node.js or Bun instead.
*/
export function isBrowser(): boolean {
return typeof window !== 'undefined' && typeof document !== 'undefined'
@ -39,6 +40,7 @@ export function isWebWorker(): boolean {
/**
* Check if Web Workers are available in the current environment
* @deprecated Browser support is deprecated and will be removed in v8.0. Use Node.js Worker Threads instead.
*/
export function areWebWorkersAvailable(): boolean {
return isBrowser() && typeof Worker !== 'undefined'