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
2026-01-31 12:02:13 -08:00
|
|
|
/**
|
|
|
|
|
* Internal utilities for first-party plugins.
|
|
|
|
|
* NOT part of the public API — may change between minor versions.
|
|
|
|
|
*/
|
|
|
|
|
export { getGlobalCache, setGlobalCache, clearGlobalCache, UnifiedCache } from './utils/unifiedCache.js'
|
|
|
|
|
export type { UnifiedCacheConfig, CacheItem } from './utils/unifiedCache.js'
|
|
|
|
|
export { prodLog, createModuleLogger } from './utils/logger.js'
|
|
|
|
|
export { FieldTypeInference, FieldType } from './utils/fieldTypeInference.js'
|
|
|
|
|
export type { FieldTypeInfo } from './utils/fieldTypeInference.js'
|
feat(8.0): EntityIdMapper U32 ceiling + EntityIdSpaceExceeded error
The JS fallback EntityIdMapper caps at u32::MAX to match the metadata
index's Roaring32 bitmap width. Before this guard, a brain past 4.29 B
entities would silently widen `nextId` into JS's safe-integer range,
truncating ints inside the bitmaps and zeroing query results — the
same silent under-count cortex 3.0's Piece 10 just closed on the
native path. Brainy 8.0 surfaces the overflow loudly instead.
When `nextId` would exceed `U32_ENTITY_ID_MAX`, `getOrAssign` throws
`EntityIdSpaceExceeded` with a message pointing at the cortex 3.0
binary mapper's `idSpace: 'u64'` mode as the migration path (mmap-
backed extendible-hash KV, persists the full u64 range losslessly).
The existing-UUID lookup path bypasses the guard — only fresh
allocations can overflow.
Surfaces via `@soulcraft/brainy/internals`:
- `EntityIdMapper` (already exported, behavior gated)
- `EntityIdSpaceExceeded` (new)
- `U32_ENTITY_ID_MAX` (new constant, = 0xFFFF_FFFF)
This is the lockstep half of cortex 3.0 / Piece 10 / Step 15. Cortex's
`NativeBinaryEntityIdMapperWrapper` ships the U64 binary mapper that
takes over above this ceiling; brainy ships the bright-line failure
that points consumers at it.
New test: tests/unit/utils/entity-id-mapper-u32-ceiling.test.ts (6
assertions covering the constant, the error shape, normal
allocations, the boundary case at exactly u32::MAX, the overflow
throw, and the existing-uuid lookup bypass).
2026-06-02 10:20:01 -07:00
|
|
|
export {
|
|
|
|
|
EntityIdMapper,
|
|
|
|
|
EntityIdSpaceExceeded,
|
|
|
|
|
U32_ENTITY_ID_MAX,
|
|
|
|
|
} from './utils/entityIdMapper.js'
|
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
2026-01-31 12:02:13 -08:00
|
|
|
export type { EntityIdMapperOptions, EntityIdMapperData } from './utils/entityIdMapper.js'
|
2026-02-01 16:23:49 -08:00
|
|
|
export { getRecommendedCacheConfig, formatBytes, checkMemoryPressure } from './utils/memoryDetection.js'
|
|
|
|
|
export type { MemoryInfo, CacheAllocationStrategy } from './utils/memoryDetection.js'
|
2026-04-09 16:28:54 -07:00
|
|
|
// Entity field resolution — single source of truth for reading fields off
|
|
|
|
|
// HNSWNounWithMetadata. First-party plugins (Cortex) use this to stay in
|
|
|
|
|
// lockstep with the entity shape contract.
|
|
|
|
|
export { resolveEntityField, STANDARD_ENTITY_FIELDS } from './coreTypes.js'
|