@soulcraft/brainy 5.3.4 → 5.3.5
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/CHANGELOG.md +7 -0
- package/dist/brainy.js +10 -5
- package/dist/storage/adapters/fileSystemStorage.js +16 -2
- package/dist/storage/baseStorage.js +12 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [5.3.5](https://github.com/soulcraftlabs/brainy/compare/v5.3.4...v5.3.5) (2025-11-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes
|
|
9
|
+
|
|
10
|
+
* resolve fork + checkout workflow with COW file listing and branch persistence ([189b1b0](https://github.com/soulcraftlabs/brainy/commit/189b1b05dec4daad28a9ce7e0840ffaaf675ecfa))
|
|
11
|
+
|
|
5
12
|
### [5.3.0](https://github.com/soulcraftlabs/brainy/compare/v5.2.1...v5.3.0) (2025-11-04)
|
|
6
13
|
|
|
7
14
|
- feat: add entity versioning system with critical bug fixes (v5.3.0) (c488fa8)
|
package/dist/brainy.js
CHANGED
|
@@ -1993,14 +1993,19 @@ export class Brainy {
|
|
|
1993
1993
|
}
|
|
1994
1994
|
// Update storage currentBranch
|
|
1995
1995
|
this.storage.currentBranch = branch;
|
|
1996
|
-
// Reload from new branch
|
|
1997
|
-
//
|
|
1996
|
+
// v5.3.5 fix: Reload indexes from new branch WITHOUT recreating storage
|
|
1997
|
+
// Previous implementation called init() which recreated storage, losing currentBranch
|
|
1998
1998
|
this.index = this.setupIndex();
|
|
1999
1999
|
this.metadataIndex = new MetadataIndexManager(this.storage);
|
|
2000
|
+
await this.metadataIndex.init();
|
|
2000
2001
|
this.graphIndex = new GraphAdjacencyIndex(this.storage);
|
|
2001
|
-
//
|
|
2002
|
-
this.
|
|
2003
|
-
|
|
2002
|
+
// Rebuild indexes from new branch data
|
|
2003
|
+
await this.rebuildIndexesIfNeeded();
|
|
2004
|
+
// Re-initialize VFS for new branch
|
|
2005
|
+
if (this._vfs) {
|
|
2006
|
+
this._vfs = new VirtualFileSystem(this);
|
|
2007
|
+
await this._vfs.init();
|
|
2008
|
+
}
|
|
2004
2009
|
});
|
|
2005
2010
|
}
|
|
2006
2011
|
/**
|
|
@@ -736,7 +736,10 @@ export class FileSystemStorage extends BaseStorage {
|
|
|
736
736
|
const entries = await fs.promises.readdir(fullPath, { withFileTypes: true });
|
|
737
737
|
for (const entry of entries) {
|
|
738
738
|
if (entry.isFile()) {
|
|
739
|
-
// Handle
|
|
739
|
+
// v5.3.5: Handle multiple compression formats for broad compatibility
|
|
740
|
+
// - .json.gz: Standard entity/metadata files (JSON compressed)
|
|
741
|
+
// - .gz: COW files (refs, blobs, commits - raw compressed)
|
|
742
|
+
// - .json: Uncompressed JSON files
|
|
740
743
|
if (entry.name.endsWith('.json.gz')) {
|
|
741
744
|
// Strip .gz extension and add the .json path
|
|
742
745
|
const normalizedName = entry.name.slice(0, -3); // Remove .gz
|
|
@@ -746,6 +749,16 @@ export class FileSystemStorage extends BaseStorage {
|
|
|
746
749
|
seen.add(normalizedPath);
|
|
747
750
|
}
|
|
748
751
|
}
|
|
752
|
+
else if (entry.name.endsWith('.gz')) {
|
|
753
|
+
// v5.3.5 fix: COW files stored as .gz (not .json.gz)
|
|
754
|
+
// Strip .gz extension and return path
|
|
755
|
+
const normalizedName = entry.name.slice(0, -3); // Remove .gz
|
|
756
|
+
const normalizedPath = path.join(prefix, normalizedName);
|
|
757
|
+
if (!seen.has(normalizedPath)) {
|
|
758
|
+
paths.push(normalizedPath);
|
|
759
|
+
seen.add(normalizedPath);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
749
762
|
else if (entry.name.endsWith('.json')) {
|
|
750
763
|
const filePath = path.join(prefix, entry.name);
|
|
751
764
|
if (!seen.has(filePath)) {
|
|
@@ -755,7 +768,8 @@ export class FileSystemStorage extends BaseStorage {
|
|
|
755
768
|
}
|
|
756
769
|
}
|
|
757
770
|
else if (entry.isDirectory()) {
|
|
758
|
-
const
|
|
771
|
+
const subpath = path.join(prefix, entry.name);
|
|
772
|
+
const subdirPaths = await this.listObjectsUnderPath(subpath);
|
|
759
773
|
paths.push(...subdirPaths);
|
|
760
774
|
}
|
|
761
775
|
}
|
|
@@ -201,11 +201,21 @@ export class BaseStorage extends BaseStorageAdapter {
|
|
|
201
201
|
},
|
|
202
202
|
list: async (prefix) => {
|
|
203
203
|
try {
|
|
204
|
-
|
|
204
|
+
// v5.3.5 fix: Handle file prefixes, not just directory paths
|
|
205
|
+
// Refs are stored as files like: _cow/ref:refs/heads/main
|
|
206
|
+
// So list('ref:') should find all files starting with '_cow/ref:'
|
|
207
|
+
// List the _cow directory and filter by prefix
|
|
208
|
+
const allPaths = await this.listObjectsUnderPath('_cow/');
|
|
209
|
+
const filteredPaths = allPaths.filter(p => {
|
|
210
|
+
// Remove _cow/ prefix to get the key
|
|
211
|
+
const key = p.replace(/^_cow\//, '');
|
|
212
|
+
return key.startsWith(prefix);
|
|
213
|
+
});
|
|
205
214
|
// Remove _cow/ prefix and return relative keys
|
|
206
|
-
return
|
|
215
|
+
return filteredPaths.map(p => p.replace(/^_cow\//, ''));
|
|
207
216
|
}
|
|
208
217
|
catch (error) {
|
|
218
|
+
// If _cow directory doesn't exist yet, return empty array
|
|
209
219
|
return [];
|
|
210
220
|
}
|
|
211
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.5",
|
|
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",
|