@soulcraft/brainy 4.8.5 → 4.8.6

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 CHANGED
@@ -2,6 +2,11 @@
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
+ ### [4.8.6](https://github.com/soulcraftlabs/brainy/compare/v4.8.5...v4.8.6) (2025-10-28)
6
+
7
+ - fix: per-sheet column detection in Excel importer (401443a)
8
+
9
+
5
10
  ### [4.7.4](https://github.com/soulcraftlabs/brainy/compare/v4.7.3...v4.7.4) (2025-10-27)
6
11
 
7
12
  **CRITICAL SYSTEMIC VFS BUG FIX - Workshop Team Unblocked!**
package/dist/brainy.js CHANGED
@@ -464,13 +464,6 @@ 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
- });
474
467
  // v4.8.0: Clean structure with standard fields at top-level
475
468
  const entity = {
476
469
  id: noun.id,
@@ -487,12 +480,6 @@ export class Brainy {
487
480
  // ONLY custom user fields in metadata (v4.8.0: already separated by storage adapter)
488
481
  metadata: noun.metadata
489
482
  };
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
- });
496
483
  return entity;
497
484
  }
498
485
  /**
@@ -102,8 +102,24 @@ export class SmartExcelImporter {
102
102
  if (rows.length === 0) {
103
103
  return this.emptyResult(startTime);
104
104
  }
105
- // Detect column names
106
- const columns = this.detectColumns(rows[0], opts);
105
+ // CRITICAL FIX (v4.8.6): Detect columns per-sheet, not globally
106
+ // Different sheets may have different column structures (Term vs Name, etc.)
107
+ // Group rows by sheet and detect columns for each sheet separately
108
+ const rowsBySheet = new Map();
109
+ for (const row of rows) {
110
+ const sheet = row._sheet || 'default';
111
+ if (!rowsBySheet.has(sheet)) {
112
+ rowsBySheet.set(sheet, []);
113
+ }
114
+ rowsBySheet.get(sheet).push(row);
115
+ }
116
+ // Detect columns for each sheet
117
+ const columnsBySheet = new Map();
118
+ for (const [sheet, sheetRows] of rowsBySheet) {
119
+ if (sheetRows.length > 0) {
120
+ columnsBySheet.set(sheet, this.detectColumns(sheetRows[0], opts));
121
+ }
122
+ }
107
123
  // Process each row with BATCHED PARALLEL PROCESSING (v3.38.0)
108
124
  const extractedRows = [];
109
125
  const entityMap = new Map();
@@ -121,6 +137,9 @@ export class SmartExcelImporter {
121
137
  // Process chunk in parallel for massive speedup
122
138
  const chunkResults = await Promise.all(chunk.map(async (row, chunkIndex) => {
123
139
  const i = chunkStart + chunkIndex;
140
+ // CRITICAL FIX (v4.8.6): Use sheet-specific column mapping
141
+ const sheet = row._sheet || 'default';
142
+ const columns = columnsBySheet.get(sheet) || this.detectColumns(row, opts);
124
143
  // Extract data from row
125
144
  const term = this.getColumnValue(row, columns.term) || `Entity_${i}`;
126
145
  const definition = this.getColumnValue(row, columns.definition) || '';
@@ -162,29 +162,16 @@ 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`);
166
165
  const validChildren = [];
167
166
  const childNames = new Set();
168
167
  // Fetch all child entities via relationships
169
168
  for (const relation of relations) {
170
169
  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
- });
179
170
  if (entity && entity.metadata?.vfsType && entity.metadata?.name) {
180
171
  validChildren.push(entity);
181
172
  childNames.add(entity.metadata.name);
182
173
  }
183
- else {
184
- console.log(`[DEBUG PathResolver] ❌ FILTERED OUT entity ${relation.to} - missing vfsType or name`);
185
- }
186
174
  }
187
- console.log(`[DEBUG PathResolver] Returning ${validChildren.length} valid children (filtered from ${relations.length})`);
188
175
  // Update cache
189
176
  this.parentCache.set(dirId, childNames);
190
177
  return validChildren;
@@ -683,19 +683,6 @@ 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
- }
699
686
  // Apply filters
700
687
  if (options?.filter) {
701
688
  children = this.filterDirectoryEntries(children, options.filter);
@@ -715,17 +702,12 @@ export class VirtualFileSystem {
715
702
  await this.updateAccessTime(entityId);
716
703
  // Return appropriate format
717
704
  if (options?.withFileTypes) {
718
- const result = children.map(child => ({
705
+ return children.map(child => ({
719
706
  name: child.metadata.name,
720
707
  path: child.metadata.path,
721
708
  type: child.metadata.vfsType,
722
709
  entityId: child.id
723
710
  }));
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;
729
711
  }
730
712
  return children.map(child => child.metadata.name);
731
713
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "4.8.5",
3
+ "version": "4.8.6",
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",