@soulcraft/cor 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +16 -0
- package/README.md +328 -0
- package/dist/aggregation/NativeAggregationEngine.d.ts +118 -0
- package/dist/aggregation/NativeAggregationEngine.js +186 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +236 -0
- package/dist/graph/GraphAccelerationAdapter.d.ts +153 -0
- package/dist/graph/GraphAccelerationAdapter.js +326 -0
- package/dist/graph/NativeGraphAdjacencyIndex.d.ts +286 -0
- package/dist/graph/NativeGraphAdjacencyIndex.js +944 -0
- package/dist/hnsw/AdaptiveDiskAnnModeSelector.d.ts +187 -0
- package/dist/hnsw/AdaptiveDiskAnnModeSelector.js +313 -0
- package/dist/hnsw/NativeDiskAnnWrapper.d.ts +489 -0
- package/dist/hnsw/NativeDiskAnnWrapper.js +1456 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +29 -0
- package/dist/legacyLayoutGuard.d.ts +93 -0
- package/dist/legacyLayoutGuard.js +237 -0
- package/dist/license/constants.d.ts +30 -0
- package/dist/license/constants.js +30 -0
- package/dist/license/onlineValidator.d.ts +43 -0
- package/dist/license/onlineValidator.js +225 -0
- package/dist/license/types.d.ts +39 -0
- package/dist/license/types.js +5 -0
- package/dist/license.d.ts +64 -0
- package/dist/license.js +165 -0
- package/dist/migration/MigrationCoordinator.d.ts +171 -0
- package/dist/migration/MigrationCoordinator.js +249 -0
- package/dist/migration/indexEpochGuard.d.ts +163 -0
- package/dist/migration/indexEpochGuard.js +202 -0
- package/dist/native/NativeEmbeddingEngine.d.ts +79 -0
- package/dist/native/NativeEmbeddingEngine.js +318 -0
- package/dist/native/NativeRoaringBitmap32.d.ts +114 -0
- package/dist/native/NativeRoaringBitmap32.js +221 -0
- package/dist/native/ffi.d.ts +20 -0
- package/dist/native/ffi.js +48 -0
- package/dist/native/idMapperTestSupport.d.ts +67 -0
- package/dist/native/idMapperTestSupport.js +112 -0
- package/dist/native/index.d.ts +49 -0
- package/dist/native/index.js +87 -0
- package/dist/native/napi.d.ts +21 -0
- package/dist/native/napi.js +88 -0
- package/dist/native/types.d.ts +1298 -0
- package/dist/native/types.js +16 -0
- package/dist/plugin.d.ts +50 -0
- package/dist/plugin.js +388 -0
- package/dist/providerContracts.d.ts +277 -0
- package/dist/providerContracts.js +38 -0
- package/dist/resource/OsMemoryProbe.d.ts +175 -0
- package/dist/resource/OsMemoryProbe.js +206 -0
- package/dist/resource/ResourceManager.d.ts +491 -0
- package/dist/resource/ResourceManager.js +960 -0
- package/dist/utils/ColumnManifest.d.ts +97 -0
- package/dist/utils/ColumnManifest.js +129 -0
- package/dist/utils/NativeColumnStore.d.ts +284 -0
- package/dist/utils/NativeColumnStore.js +685 -0
- package/dist/utils/NativeMetadataIndex.d.ts +882 -0
- package/dist/utils/NativeMetadataIndex.js +2631 -0
- package/dist/utils/NativeUnifiedCache.d.ts +87 -0
- package/dist/utils/NativeUnifiedCache.js +273 -0
- package/dist/utils/binaryIdMapperFactory.d.ts +59 -0
- package/dist/utils/binaryIdMapperFactory.js +94 -0
- package/dist/utils/collation.d.ts +30 -0
- package/dist/utils/collation.js +40 -0
- package/dist/utils/columnStoreTypes.d.ts +161 -0
- package/dist/utils/columnStoreTypes.js +29 -0
- package/dist/utils/nativeBinaryEntityIdMapper.d.ts +211 -0
- package/dist/utils/nativeBinaryEntityIdMapper.js +381 -0
- package/dist/utils/nativeEntityIdMapper.d.ts +111 -0
- package/dist/utils/nativeEntityIdMapper.js +170 -0
- package/docs/ADR-002-diskann-100-percent-rust.md +294 -0
- package/docs/ADR-003-semantic-time-travel.md +100 -0
- package/docs/aggregation.md +251 -0
- package/docs/comparison.md +162 -0
- package/docs/deployment-limits.md +87 -0
- package/docs/diskann.md +184 -0
- package/docs/migration-3.0.md +396 -0
- package/docs/performance-budget.md +274 -0
- package/docs/performance.md +117 -0
- package/docs/scaling.md +439 -0
- package/docs/snapshot-safety.md +246 -0
- package/docs/u64-id-space.md +214 -0
- package/docs/verification-report.md +670 -0
- package/native/brainy-native.node +0 -0
- package/native/index.d.ts +3916 -0
- package/package.json +92 -0
- package/scripts/migrate-cortex-2x-to-3x.mjs +970 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* napi-rs bindings loader
|
|
3
|
+
*
|
|
4
|
+
* Loads the native module via napi-rs .node files.
|
|
5
|
+
* Works with: Node.js, Bun runtime, Bun --compile (all platforms).
|
|
6
|
+
*
|
|
7
|
+
* Resolution order:
|
|
8
|
+
* 1. Bundled platform binary: native/brainy-native.{platform-key}.node (shipped in npm package)
|
|
9
|
+
* 2. Local dev build: native/brainy-native.node (for development, no platform suffix)
|
|
10
|
+
* 3. Clear error with supported platforms list
|
|
11
|
+
*/
|
|
12
|
+
import { join, dirname } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
let cachedBindings = null;
|
|
15
|
+
/** Platform keys matching napi-rs build output */
|
|
16
|
+
const PLATFORM_KEY_MAP = {
|
|
17
|
+
'linux-x64': 'linux-x64-gnu',
|
|
18
|
+
'linux-arm64': 'linux-arm64-gnu',
|
|
19
|
+
'darwin-arm64': 'darwin-arm64',
|
|
20
|
+
'darwin-x64': 'darwin-x64',
|
|
21
|
+
'win32-x64': 'win32-x64-msvc'
|
|
22
|
+
};
|
|
23
|
+
const SUPPORTED_PLATFORMS = Object.keys(PLATFORM_KEY_MAP);
|
|
24
|
+
/**
|
|
25
|
+
* Load the native module via napi-rs.
|
|
26
|
+
*
|
|
27
|
+
* Tries multiple resolution strategies:
|
|
28
|
+
* 1. Bundled platform binary (native/brainy-native.{platform-key}.node)
|
|
29
|
+
* 2. Local dev build (native/brainy-native.node)
|
|
30
|
+
*/
|
|
31
|
+
export function loadViaNapi() {
|
|
32
|
+
if (cachedBindings) {
|
|
33
|
+
return cachedBindings;
|
|
34
|
+
}
|
|
35
|
+
const platform = process.platform;
|
|
36
|
+
const arch = process.arch;
|
|
37
|
+
const key = `${platform}-${arch}`;
|
|
38
|
+
const platformKey = PLATFORM_KEY_MAP[key];
|
|
39
|
+
if (!platformKey) {
|
|
40
|
+
throw new Error(`Unsupported platform: ${key}. ` +
|
|
41
|
+
`Brainy native module supports: ${SUPPORTED_PLATFORMS.join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const { createRequire } = loadModule('node:module');
|
|
44
|
+
const require = createRequire(import.meta.url);
|
|
45
|
+
// Resolve native/ directory relative to package root
|
|
46
|
+
// This file lives at dist/native/napi.js → package root is ../../
|
|
47
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
48
|
+
const nativeDir = join(__dirname, '..', '..', 'native');
|
|
49
|
+
// Strategy 1: Bundled platform binary (shipped in npm package)
|
|
50
|
+
try {
|
|
51
|
+
const binaryPath = join(nativeDir, `brainy-native.${platformKey}.node`);
|
|
52
|
+
const bindings = require(binaryPath);
|
|
53
|
+
cachedBindings = bindings;
|
|
54
|
+
return bindings;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// Fall through to strategy 2
|
|
58
|
+
}
|
|
59
|
+
// Strategy 2: Local dev build (no platform suffix)
|
|
60
|
+
try {
|
|
61
|
+
const devPath = join(nativeDir, 'brainy-native.node');
|
|
62
|
+
const bindings = require(devPath);
|
|
63
|
+
cachedBindings = bindings;
|
|
64
|
+
return bindings;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Fall through to error
|
|
68
|
+
}
|
|
69
|
+
throw new Error(`Failed to load Brainy native module for ${key}.\n` +
|
|
70
|
+
`Looked for:\n` +
|
|
71
|
+
` - native/brainy-native.${platformKey}.node (bundled binary)\n` +
|
|
72
|
+
` - native/brainy-native.node (local dev build)\n` +
|
|
73
|
+
`Build locally: cd native && npm run build`);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Synchronously load a Node.js built-in module.
|
|
77
|
+
* Workaround for ESM dynamic import restrictions.
|
|
78
|
+
*/
|
|
79
|
+
function loadModule(moduleName) {
|
|
80
|
+
if (typeof require === 'function') {
|
|
81
|
+
return require(moduleName);
|
|
82
|
+
}
|
|
83
|
+
if (typeof process !== 'undefined' && process.getBuiltinModule) {
|
|
84
|
+
return process.getBuiltinModule(moduleName);
|
|
85
|
+
}
|
|
86
|
+
throw new Error(`Cannot synchronously load module: ${moduleName}`);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=napi.js.map
|