@soulcraft/brainy 5.2.0 → 5.2.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/dist/brainy.js +23 -3
- package/package.json +1 -1
package/dist/brainy.js
CHANGED
|
@@ -1868,7 +1868,20 @@ export class Brainy {
|
|
|
1868
1868
|
}
|
|
1869
1869
|
const refManager = this.storage.refManager;
|
|
1870
1870
|
const currentBranch = this.storage.currentBranch || 'main';
|
|
1871
|
-
// Step 1:
|
|
1871
|
+
// Step 1: Ensure initial commit exists (required for fork)
|
|
1872
|
+
const currentRef = await refManager.getRef(currentBranch);
|
|
1873
|
+
if (!currentRef) {
|
|
1874
|
+
// Auto-create initial commit if none exists
|
|
1875
|
+
await this.commit({
|
|
1876
|
+
message: `Initial commit on ${currentBranch}`,
|
|
1877
|
+
author: options?.author || 'Brainy',
|
|
1878
|
+
metadata: { timestamp: Date.now() }
|
|
1879
|
+
});
|
|
1880
|
+
if (!this.config.silent) {
|
|
1881
|
+
console.log(`📝 Auto-created initial commit on ${currentBranch} (required for fork)`);
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
// Step 2: Copy storage ref (COW layer - instant!)
|
|
1872
1885
|
await refManager.copyRef(currentBranch, branchName);
|
|
1873
1886
|
// Step 2: Create new Brainy instance pointing to fork branch
|
|
1874
1887
|
const forkConfig = {
|
|
@@ -3711,12 +3724,19 @@ export class Brainy {
|
|
|
3711
3724
|
const graphIndexSize = await this.graphIndex.size();
|
|
3712
3725
|
const needsRebuild = metadataStats.totalEntries === 0 ||
|
|
3713
3726
|
hnswIndexSize === 0 ||
|
|
3714
|
-
graphIndexSize === 0
|
|
3715
|
-
this.config.disableAutoRebuild === false; // Explicitly enabled
|
|
3727
|
+
graphIndexSize === 0;
|
|
3716
3728
|
if (!needsRebuild) {
|
|
3717
3729
|
// All indexes already populated, no rebuild needed
|
|
3718
3730
|
return;
|
|
3719
3731
|
}
|
|
3732
|
+
// BUG FIX: If disableAutoRebuild is truthy, skip rebuild even if indexes are empty
|
|
3733
|
+
// Indexes will load lazily on first query
|
|
3734
|
+
if (this.config.disableAutoRebuild) {
|
|
3735
|
+
if (!this.config.silent) {
|
|
3736
|
+
console.log('⚡ Indexes empty but auto-rebuild disabled - using lazy loading');
|
|
3737
|
+
}
|
|
3738
|
+
return;
|
|
3739
|
+
}
|
|
3720
3740
|
// Small dataset: Rebuild all indexes for best performance
|
|
3721
3741
|
if (totalCount < AUTO_REBUILD_THRESHOLD || this.config.disableAutoRebuild === false) {
|
|
3722
3742
|
if (!this.config.silent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|