@soulcraft/brainy 3.14.2 → 3.15.0

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.
@@ -247,6 +247,20 @@ export class VirtualFileSystem {
247
247
  data: entityData,
248
248
  metadata
249
249
  });
250
+ // Ensure Contains relationship exists (fix for missing relationships)
251
+ const existingRelations = await this.brain.getRelations({
252
+ from: parentId,
253
+ to: existingId,
254
+ type: VerbType.Contains
255
+ });
256
+ // Create relationship if it doesn't exist
257
+ if (existingRelations.length === 0) {
258
+ await this.brain.relate({
259
+ from: parentId,
260
+ to: existingId,
261
+ type: VerbType.Contains
262
+ });
263
+ }
250
264
  }
251
265
  else {
252
266
  // Create new file entity
@@ -736,9 +750,13 @@ export class VirtualFileSystem {
736
750
  return entityId;
737
751
  }
738
752
  catch (err) {
739
- // Directory doesn't exist, create it recursively
740
- await this.mkdir(path, { recursive: true });
741
- return await this.pathResolver.resolve(path);
753
+ // Only create directory if it doesn't exist (ENOENT error)
754
+ if (err instanceof VFSError && err.code === VFSErrorCode.ENOENT) {
755
+ await this.mkdir(path, { recursive: true });
756
+ return await this.pathResolver.resolve(path);
757
+ }
758
+ // Re-throw other errors (like ENOTDIR)
759
+ throw err;
742
760
  }
743
761
  }
744
762
  async getEntityById(id) {
@@ -2016,7 +2034,13 @@ export class VirtualFileSystem {
2016
2034
  path = `${from}/${path}`;
2017
2035
  }
2018
2036
  // Normalize path
2019
- return path.replace(/\/+/g, '/').replace(/\/$/, '') || '/';
2037
+ const normalizedPath = path.replace(/\/+/g, '/').replace(/\/$/, '') || '/';
2038
+ // Special case for root
2039
+ if (normalizedPath === '/') {
2040
+ return this.rootEntityId;
2041
+ }
2042
+ // Resolve the path to an entity ID
2043
+ return await this.pathResolver.resolve(normalizedPath);
2020
2044
  }
2021
2045
  }
2022
2046
  //# sourceMappingURL=VirtualFileSystem.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "3.14.2",
3
+ "version": "3.15.0",
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",