@soulcraft/brainy 4.8.4 → 4.8.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/dist/brainy.js CHANGED
@@ -464,6 +464,13 @@ export class Brainy {
464
464
  async convertNounToEntity(noun) {
465
465
  // v4.8.0: Storage adapters ALREADY extract standard fields to top-level!
466
466
  // Just read from top-level fields of HNSWNounWithMetadata
467
+ console.log(`[DEBUG convertNounToEntity] Converting noun ${noun.id}:`, {
468
+ nounMetadataKeys: noun.metadata ? Object.keys(noun.metadata) : [],
469
+ nounType: noun.type,
470
+ hasName: !!noun.metadata?.name,
471
+ hasPath: !!noun.metadata?.path,
472
+ hasVfsType: !!noun.metadata?.vfsType
473
+ });
467
474
  // v4.8.0: Clean structure with standard fields at top-level
468
475
  const entity = {
469
476
  id: noun.id,
@@ -480,6 +487,12 @@ export class Brainy {
480
487
  // ONLY custom user fields in metadata (v4.8.0: already separated by storage adapter)
481
488
  metadata: noun.metadata
482
489
  };
490
+ console.log(`[DEBUG convertNounToEntity] Converted entity metadata:`, {
491
+ entityMetadataKeys: entity.metadata ? Object.keys(entity.metadata) : [],
492
+ metadata_name: entity.metadata?.name,
493
+ metadata_path: entity.metadata?.path,
494
+ metadata_vfsType: entity.metadata?.vfsType
495
+ });
483
496
  return entity;
484
497
  }
485
498
  /**
@@ -162,16 +162,29 @@ export class PathResolver {
162
162
  from: dirId,
163
163
  type: VerbType.Contains
164
164
  });
165
+ console.log(`[DEBUG PathResolver] getChildren(${dirId}): Found ${relations.length} Contains relations`);
165
166
  const validChildren = [];
166
167
  const childNames = new Set();
167
168
  // Fetch all child entities via relationships
168
169
  for (const relation of relations) {
169
170
  const entity = await this.brain.get(relation.to);
171
+ console.log(`[DEBUG PathResolver] Retrieved entity ${relation.to}:`, {
172
+ exists: !!entity,
173
+ type: entity?.type,
174
+ hasMetadata: !!entity?.metadata,
175
+ metadataKeys: entity?.metadata ? Object.keys(entity.metadata) : [],
176
+ metadata_vfsType: entity?.metadata?.vfsType,
177
+ metadata_name: entity?.metadata?.name
178
+ });
170
179
  if (entity && entity.metadata?.vfsType && entity.metadata?.name) {
171
180
  validChildren.push(entity);
172
181
  childNames.add(entity.metadata.name);
173
182
  }
183
+ else {
184
+ console.log(`[DEBUG PathResolver] ❌ FILTERED OUT entity ${relation.to} - missing vfsType or name`);
185
+ }
174
186
  }
187
+ console.log(`[DEBUG PathResolver] Returning ${validChildren.length} valid children (filtered from ${relations.length})`);
175
188
  // Update cache
176
189
  this.parentCache.set(dirId, childNames);
177
190
  return validChildren;
@@ -683,6 +683,19 @@ export class VirtualFileSystem {
683
683
  }
684
684
  // Get children
685
685
  let children = await this.pathResolver.getChildren(entityId);
686
+ console.log(`[DEBUG VFS] readdir(${path}): Found ${children.length} children`);
687
+ // Debug first child
688
+ if (children.length > 0) {
689
+ const firstChild = children[0];
690
+ console.log(`[DEBUG VFS] First child structure:`, {
691
+ id: firstChild.id,
692
+ type: firstChild.type,
693
+ metadataKeys: Object.keys(firstChild.metadata || {}),
694
+ metadata_name: firstChild.metadata?.name,
695
+ metadata_path: firstChild.metadata?.path,
696
+ metadata_vfsType: firstChild.metadata?.vfsType
697
+ });
698
+ }
686
699
  // Apply filters
687
700
  if (options?.filter) {
688
701
  children = this.filterDirectoryEntries(children, options.filter);
@@ -702,12 +715,17 @@ export class VirtualFileSystem {
702
715
  await this.updateAccessTime(entityId);
703
716
  // Return appropriate format
704
717
  if (options?.withFileTypes) {
705
- return children.map(child => ({
718
+ const result = children.map(child => ({
706
719
  name: child.metadata.name,
707
720
  path: child.metadata.path,
708
721
  type: child.metadata.vfsType,
709
722
  entityId: child.id
710
723
  }));
724
+ console.log(`[DEBUG VFS] Returning ${result.length} VFSDirent items`);
725
+ if (result.length > 0) {
726
+ console.log(`[DEBUG VFS] First VFSDirent:`, result[0]);
727
+ }
728
+ return result;
711
729
  }
712
730
  return children.map(child => child.metadata.name);
713
731
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "4.8.4",
3
+ "version": "4.8.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",