@soulcraft/brainy 4.11.2 → 5.1.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +271 -0
  2. package/README.md +38 -1
  3. package/dist/augmentations/brainyAugmentation.d.ts +76 -0
  4. package/dist/augmentations/brainyAugmentation.js +126 -0
  5. package/dist/augmentations/cacheAugmentation.js +9 -4
  6. package/dist/brainy.d.ts +248 -15
  7. package/dist/brainy.js +707 -17
  8. package/dist/cli/commands/cow.d.ts +60 -0
  9. package/dist/cli/commands/cow.js +444 -0
  10. package/dist/cli/commands/import.js +1 -1
  11. package/dist/cli/commands/vfs.js +24 -40
  12. package/dist/cli/index.js +50 -0
  13. package/dist/hnsw/hnswIndex.d.ts +41 -0
  14. package/dist/hnsw/hnswIndex.js +96 -1
  15. package/dist/hnsw/typeAwareHNSWIndex.d.ts +9 -0
  16. package/dist/hnsw/typeAwareHNSWIndex.js +22 -0
  17. package/dist/import/ImportHistory.js +3 -3
  18. package/dist/importers/VFSStructureGenerator.d.ts +1 -1
  19. package/dist/importers/VFSStructureGenerator.js +3 -3
  20. package/dist/index.d.ts +6 -0
  21. package/dist/index.js +10 -0
  22. package/dist/storage/adapters/memoryStorage.d.ts +6 -0
  23. package/dist/storage/adapters/memoryStorage.js +39 -14
  24. package/dist/storage/adapters/typeAwareStorageAdapter.d.ts +31 -1
  25. package/dist/storage/adapters/typeAwareStorageAdapter.js +272 -43
  26. package/dist/storage/baseStorage.d.ts +64 -0
  27. package/dist/storage/baseStorage.js +252 -12
  28. package/dist/storage/cow/BlobStorage.d.ts +232 -0
  29. package/dist/storage/cow/BlobStorage.js +437 -0
  30. package/dist/storage/cow/CommitLog.d.ts +199 -0
  31. package/dist/storage/cow/CommitLog.js +363 -0
  32. package/dist/storage/cow/CommitObject.d.ts +276 -0
  33. package/dist/storage/cow/CommitObject.js +431 -0
  34. package/dist/storage/cow/RefManager.d.ts +213 -0
  35. package/dist/storage/cow/RefManager.js +409 -0
  36. package/dist/storage/cow/TreeObject.d.ts +177 -0
  37. package/dist/storage/cow/TreeObject.js +293 -0
  38. package/dist/storage/storageFactory.d.ts +6 -0
  39. package/dist/storage/storageFactory.js +92 -74
  40. package/dist/types/brainy.types.d.ts +1 -0
  41. package/dist/vfs/FSCompat.d.ts +1 -1
  42. package/dist/vfs/FSCompat.js +1 -1
  43. package/dist/vfs/VirtualFileSystem.js +5 -6
  44. package/package.json +1 -1
@@ -24,6 +24,31 @@ function getFileSystemPath(options) {
24
24
  './brainy-data' // Zero-config fallback
25
25
  );
26
26
  }
27
+ /**
28
+ * Wrap any storage adapter with TypeAwareStorageAdapter
29
+ * v5.0.0: TypeAware is now the standard interface for ALL storage adapters
30
+ * This provides type-first organization, fixed-size type counts, and efficient type queries
31
+ *
32
+ * @param underlying - The base storage adapter (memory, filesystem, S3, etc.)
33
+ * @param options - Storage options (for COW configuration)
34
+ * @param verbose - Optional verbose logging
35
+ * @returns TypeAwareStorageAdapter wrapping the underlying storage
36
+ */
37
+ async function wrapWithTypeAware(underlying, options, verbose = false) {
38
+ const wrapped = new TypeAwareStorageAdapter({
39
+ underlyingStorage: underlying,
40
+ verbose
41
+ });
42
+ // v5.0.1: COW will be initialized AFTER storage.init() in Brainy
43
+ // Store COW options for later initialization
44
+ if (typeof wrapped.initializeCOW === 'function') {
45
+ wrapped._cowOptions = {
46
+ branch: options?.branch || 'main',
47
+ enableCompression: options?.enableCompression !== false
48
+ };
49
+ }
50
+ return wrapped;
51
+ }
27
52
  /**
28
53
  * Create a storage adapter based on the environment and configuration
29
54
  * @param options Options for creating the storage adapter
@@ -32,70 +57,70 @@ function getFileSystemPath(options) {
32
57
  export async function createStorage(options = {}) {
33
58
  // If memory storage is forced, use it regardless of other options
34
59
  if (options.forceMemoryStorage) {
35
- console.log('Using memory storage (forced)');
36
- return new MemoryStorage();
60
+ console.log('Using memory storage (forced) + TypeAware wrapper');
61
+ return await wrapWithTypeAware(new MemoryStorage(), options);
37
62
  }
38
63
  // If file system storage is forced, use it regardless of other options
39
64
  if (options.forceFileSystemStorage) {
40
65
  if (isBrowser()) {
41
66
  console.warn('FileSystemStorage is not available in browser environments, falling back to memory storage');
42
- return new MemoryStorage();
67
+ return await wrapWithTypeAware(new MemoryStorage(), options);
43
68
  }
44
69
  const fsPath = getFileSystemPath(options);
45
- console.log(`Using file system storage (forced): ${fsPath}`);
70
+ console.log(`Using file system storage (forced): ${fsPath} + TypeAware wrapper`);
46
71
  try {
47
72
  const { FileSystemStorage } = await import('./adapters/fileSystemStorage.js');
48
- return new FileSystemStorage(fsPath);
73
+ return await wrapWithTypeAware(new FileSystemStorage(fsPath), options);
49
74
  }
50
75
  catch (error) {
51
76
  console.warn('Failed to load FileSystemStorage, falling back to memory storage:', error);
52
- return new MemoryStorage();
77
+ return await wrapWithTypeAware(new MemoryStorage(), options);
53
78
  }
54
79
  }
55
80
  // If a specific storage type is specified, use it
56
81
  if (options.type && options.type !== 'auto') {
57
82
  switch (options.type) {
58
83
  case 'memory':
59
- console.log('Using memory storage');
60
- return new MemoryStorage();
84
+ console.log('Using memory storage + TypeAware wrapper');
85
+ return await wrapWithTypeAware(new MemoryStorage(), options);
61
86
  case 'opfs': {
62
87
  // Check if OPFS is available
63
88
  const opfsStorage = new OPFSStorage();
64
89
  if (opfsStorage.isOPFSAvailable()) {
65
- console.log('Using OPFS storage');
90
+ console.log('Using OPFS storage + TypeAware wrapper');
66
91
  await opfsStorage.init();
67
92
  // Request persistent storage if specified
68
93
  if (options.requestPersistentStorage) {
69
94
  const isPersistent = await opfsStorage.requestPersistentStorage();
70
95
  console.log(`Persistent storage ${isPersistent ? 'granted' : 'denied'}`);
71
96
  }
72
- return opfsStorage;
97
+ return await wrapWithTypeAware(opfsStorage, options);
73
98
  }
74
99
  else {
75
100
  console.warn('OPFS storage is not available, falling back to memory storage');
76
- return new MemoryStorage();
101
+ return await wrapWithTypeAware(new MemoryStorage(), options);
77
102
  }
78
103
  }
79
104
  case 'filesystem': {
80
105
  if (isBrowser()) {
81
106
  console.warn('FileSystemStorage is not available in browser environments, falling back to memory storage');
82
- return new MemoryStorage();
107
+ return await wrapWithTypeAware(new MemoryStorage(), options);
83
108
  }
84
109
  const fsPath = getFileSystemPath(options);
85
- console.log(`Using file system storage: ${fsPath}`);
110
+ console.log(`Using file system storage: ${fsPath} + TypeAware wrapper`);
86
111
  try {
87
112
  const { FileSystemStorage } = await import('./adapters/fileSystemStorage.js');
88
- return new FileSystemStorage(fsPath);
113
+ return await wrapWithTypeAware(new FileSystemStorage(fsPath));
89
114
  }
90
115
  catch (error) {
91
116
  console.warn('Failed to load FileSystemStorage, falling back to memory storage:', error);
92
- return new MemoryStorage();
117
+ return await wrapWithTypeAware(new MemoryStorage(), options);
93
118
  }
94
119
  }
95
120
  case 's3':
96
121
  if (options.s3Storage) {
97
- console.log('Using Amazon S3 storage');
98
- return new S3CompatibleStorage({
122
+ console.log('Using Amazon S3 storage + TypeAware wrapper');
123
+ return await wrapWithTypeAware(new S3CompatibleStorage({
99
124
  bucketName: options.s3Storage.bucketName,
100
125
  region: options.s3Storage.region,
101
126
  accessKeyId: options.s3Storage.accessKeyId,
@@ -104,26 +129,26 @@ export async function createStorage(options = {}) {
104
129
  serviceType: 's3',
105
130
  operationConfig: options.operationConfig,
106
131
  cacheConfig: options.cacheConfig
107
- });
132
+ }));
108
133
  }
109
134
  else {
110
135
  console.warn('S3 storage configuration is missing, falling back to memory storage');
111
- return new MemoryStorage();
136
+ return await wrapWithTypeAware(new MemoryStorage(), options);
112
137
  }
113
138
  case 'r2':
114
139
  if (options.r2Storage) {
115
- console.log('Using Cloudflare R2 storage (dedicated adapter)');
116
- return new R2Storage({
140
+ console.log('Using Cloudflare R2 storage (dedicated adapter) + TypeAware wrapper');
141
+ return await wrapWithTypeAware(new R2Storage({
117
142
  bucketName: options.r2Storage.bucketName,
118
143
  accountId: options.r2Storage.accountId,
119
144
  accessKeyId: options.r2Storage.accessKeyId,
120
145
  secretAccessKey: options.r2Storage.secretAccessKey,
121
146
  cacheConfig: options.cacheConfig
122
- });
147
+ }));
123
148
  }
124
149
  else {
125
150
  console.warn('R2 storage configuration is missing, falling back to memory storage');
126
- return new MemoryStorage();
151
+ return await wrapWithTypeAware(new MemoryStorage(), options);
127
152
  }
128
153
  case 'gcs-native':
129
154
  // DEPRECATED: gcs-native is deprecated in favor of just 'gcs'
@@ -136,14 +161,14 @@ export async function createStorage(options = {}) {
136
161
  const gcsLegacy = options.gcsStorage;
137
162
  if (!gcsNative && !gcsLegacy) {
138
163
  console.warn('GCS storage configuration is missing, falling back to memory storage');
139
- return new MemoryStorage();
164
+ return await wrapWithTypeAware(new MemoryStorage(), options);
140
165
  }
141
166
  // If using legacy gcsStorage with HMAC keys, use S3-compatible adapter
142
167
  if (gcsLegacy && gcsLegacy.accessKeyId && gcsLegacy.secretAccessKey) {
143
168
  console.warn('⚠️ GCS with HMAC keys detected. Consider using gcsNativeStorage with ADC instead.');
144
169
  console.warn(' Native GCS with Application Default Credentials is recommended for better performance and security.');
145
170
  // Use S3-compatible storage for HMAC keys
146
- return new S3CompatibleStorage({
171
+ return await wrapWithTypeAware(new S3CompatibleStorage({
147
172
  bucketName: gcsLegacy.bucketName,
148
173
  region: gcsLegacy.region,
149
174
  endpoint: gcsLegacy.endpoint || 'https://storage.googleapis.com',
@@ -151,12 +176,12 @@ export async function createStorage(options = {}) {
151
176
  secretAccessKey: gcsLegacy.secretAccessKey,
152
177
  serviceType: 'gcs',
153
178
  cacheConfig: options.cacheConfig
154
- });
179
+ }));
155
180
  }
156
181
  // Use native GCS SDK (the correct default!)
157
182
  const config = gcsNative || gcsLegacy;
158
- console.log('Using Google Cloud Storage (native SDK)');
159
- return new GcsStorage({
183
+ console.log('Using Google Cloud Storage (native SDK) + TypeAware wrapper');
184
+ return await wrapWithTypeAware(new GcsStorage({
160
185
  bucketName: config.bucketName,
161
186
  keyFilename: gcsNative?.keyFilename,
162
187
  credentials: gcsNative?.credentials,
@@ -165,50 +190,43 @@ export async function createStorage(options = {}) {
165
190
  skipInitialScan: gcsNative?.skipInitialScan,
166
191
  skipCountsFile: gcsNative?.skipCountsFile,
167
192
  cacheConfig: options.cacheConfig
168
- });
193
+ }));
169
194
  }
170
195
  case 'azure':
171
196
  if (options.azureStorage) {
172
- console.log('Using Azure Blob Storage (native SDK)');
173
- return new AzureBlobStorage({
197
+ console.log('Using Azure Blob Storage (native SDK) + TypeAware wrapper');
198
+ return await wrapWithTypeAware(new AzureBlobStorage({
174
199
  containerName: options.azureStorage.containerName,
175
200
  accountName: options.azureStorage.accountName,
176
201
  accountKey: options.azureStorage.accountKey,
177
202
  connectionString: options.azureStorage.connectionString,
178
203
  sasToken: options.azureStorage.sasToken,
179
204
  cacheConfig: options.cacheConfig
180
- });
205
+ }));
181
206
  }
182
207
  else {
183
208
  console.warn('Azure storage configuration is missing, falling back to memory storage');
184
- return new MemoryStorage();
209
+ return await wrapWithTypeAware(new MemoryStorage(), options);
185
210
  }
186
- case 'type-aware': {
187
- console.log('Using Type-Aware Storage (type-first architecture)');
188
- // Create underlying storage adapter
189
- const underlyingType = options.typeAwareStorage?.underlyingType || 'auto';
190
- const underlyingOptions = options.typeAwareStorage?.underlyingOptions || {};
191
- // Recursively create the underlying storage
192
- const underlying = await createStorage({
193
- ...underlyingOptions,
194
- type: underlyingType
195
- });
196
- // Wrap with TypeAwareStorageAdapter
197
- // Cast to BaseStorage since all concrete storage adapters extend BaseStorage
198
- return new TypeAwareStorageAdapter({
199
- underlyingStorage: underlying,
200
- verbose: options.typeAwareStorage?.verbose || false
211
+ case 'type-aware':
212
+ // v5.0.0: TypeAware is now the default for ALL adapters
213
+ // Redirect to the underlying type instead
214
+ console.warn('⚠️ type-aware is deprecated in v5.0.0 - TypeAware is now always enabled.');
215
+ console.warn(' Just use the underlying storage type (e.g., "filesystem", "s3", etc.)');
216
+ // Recursively create storage with underlying type
217
+ return await createStorage({
218
+ ...options,
219
+ type: options.typeAwareStorage?.underlyingType || 'auto'
201
220
  });
202
- }
203
221
  default:
204
222
  console.warn(`Unknown storage type: ${options.type}, falling back to memory storage`);
205
- return new MemoryStorage();
223
+ return await wrapWithTypeAware(new MemoryStorage(), options);
206
224
  }
207
225
  }
208
226
  // If custom S3-compatible storage is specified, use it
209
227
  if (options.customS3Storage) {
210
- console.log(`Using custom S3-compatible storage: ${options.customS3Storage.serviceType || 'custom'}`);
211
- return new S3CompatibleStorage({
228
+ console.log(`Using custom S3-compatible storage: ${options.customS3Storage.serviceType || 'custom'} + TypeAware wrapper`);
229
+ return await wrapWithTypeAware(new S3CompatibleStorage({
212
230
  bucketName: options.customS3Storage.bucketName,
213
231
  region: options.customS3Storage.region,
214
232
  endpoint: options.customS3Storage.endpoint,
@@ -216,23 +234,23 @@ export async function createStorage(options = {}) {
216
234
  secretAccessKey: options.customS3Storage.secretAccessKey,
217
235
  serviceType: options.customS3Storage.serviceType || 'custom',
218
236
  cacheConfig: options.cacheConfig
219
- });
237
+ }));
220
238
  }
221
239
  // If R2 storage is specified, use it
222
240
  if (options.r2Storage) {
223
- console.log('Using Cloudflare R2 storage (dedicated adapter)');
224
- return new R2Storage({
241
+ console.log('Using Cloudflare R2 storage (dedicated adapter) + TypeAware wrapper');
242
+ return await wrapWithTypeAware(new R2Storage({
225
243
  bucketName: options.r2Storage.bucketName,
226
244
  accountId: options.r2Storage.accountId,
227
245
  accessKeyId: options.r2Storage.accessKeyId,
228
246
  secretAccessKey: options.r2Storage.secretAccessKey,
229
247
  cacheConfig: options.cacheConfig
230
- });
248
+ }));
231
249
  }
232
250
  // If S3 storage is specified, use it
233
251
  if (options.s3Storage) {
234
- console.log('Using Amazon S3 storage');
235
- return new S3CompatibleStorage({
252
+ console.log('Using Amazon S3 storage + TypeAware wrapper');
253
+ return await wrapWithTypeAware(new S3CompatibleStorage({
236
254
  bucketName: options.s3Storage.bucketName,
237
255
  region: options.s3Storage.region,
238
256
  accessKeyId: options.s3Storage.accessKeyId,
@@ -240,7 +258,7 @@ export async function createStorage(options = {}) {
240
258
  sessionToken: options.s3Storage.sessionToken,
241
259
  serviceType: 's3',
242
260
  cacheConfig: options.cacheConfig
243
- });
261
+ }));
244
262
  }
245
263
  // If GCS storage is specified (native or legacy S3-compatible)
246
264
  // Prefer gcsNativeStorage, but also accept gcsStorage for backward compatibility
@@ -252,8 +270,8 @@ export async function createStorage(options = {}) {
252
270
  console.warn('⚠️ GCS with HMAC keys detected. Consider using gcsNativeStorage with ADC instead.');
253
271
  console.warn(' Native GCS with Application Default Credentials is recommended for better performance and security.');
254
272
  // Use S3-compatible storage for HMAC keys
255
- console.log('Using Google Cloud Storage (S3-compatible with HMAC - auto-detected)');
256
- return new S3CompatibleStorage({
273
+ console.log('Using Google Cloud Storage (S3-compatible with HMAC - auto-detected) + TypeAware wrapper');
274
+ return await wrapWithTypeAware(new S3CompatibleStorage({
257
275
  bucketName: gcsLegacy.bucketName,
258
276
  region: gcsLegacy.region,
259
277
  endpoint: gcsLegacy.endpoint || 'https://storage.googleapis.com',
@@ -261,12 +279,12 @@ export async function createStorage(options = {}) {
261
279
  secretAccessKey: gcsLegacy.secretAccessKey,
262
280
  serviceType: 'gcs',
263
281
  cacheConfig: options.cacheConfig
264
- });
282
+ }));
265
283
  }
266
284
  // Use native GCS SDK (the correct default!)
267
285
  const config = gcsNative || gcsLegacy;
268
- console.log('Using Google Cloud Storage (native SDK - auto-detected)');
269
- return new GcsStorage({
286
+ console.log('Using Google Cloud Storage (native SDK - auto-detected) + TypeAware wrapper');
287
+ return await wrapWithTypeAware(new GcsStorage({
270
288
  bucketName: config.bucketName,
271
289
  keyFilename: gcsNative?.keyFilename,
272
290
  credentials: gcsNative?.credentials,
@@ -275,19 +293,19 @@ export async function createStorage(options = {}) {
275
293
  skipInitialScan: gcsNative?.skipInitialScan,
276
294
  skipCountsFile: gcsNative?.skipCountsFile,
277
295
  cacheConfig: options.cacheConfig
278
- });
296
+ }));
279
297
  }
280
298
  // If Azure storage is specified, use it
281
299
  if (options.azureStorage) {
282
- console.log('Using Azure Blob Storage (native SDK)');
283
- return new AzureBlobStorage({
300
+ console.log('Using Azure Blob Storage (native SDK) + TypeAware wrapper');
301
+ return await wrapWithTypeAware(new AzureBlobStorage({
284
302
  containerName: options.azureStorage.containerName,
285
303
  accountName: options.azureStorage.accountName,
286
304
  accountKey: options.azureStorage.accountKey,
287
305
  connectionString: options.azureStorage.connectionString,
288
306
  sasToken: options.azureStorage.sasToken,
289
307
  cacheConfig: options.cacheConfig
290
- });
308
+ }));
291
309
  }
292
310
  // Auto-detect the best storage adapter based on the environment
293
311
  // First, check if we're in Node.js (prioritize for test environments)
@@ -298,10 +316,10 @@ export async function createStorage(options = {}) {
298
316
  process.versions &&
299
317
  process.versions.node) {
300
318
  const fsPath = getFileSystemPath(options);
301
- console.log(`Using file system storage (auto-detected): ${fsPath}`);
319
+ console.log(`Using file system storage (auto-detected): ${fsPath} + TypeAware wrapper`);
302
320
  try {
303
321
  const { FileSystemStorage } = await import('./adapters/fileSystemStorage.js');
304
- return new FileSystemStorage(fsPath);
322
+ return await wrapWithTypeAware(new FileSystemStorage(fsPath));
305
323
  }
306
324
  catch (fsError) {
307
325
  console.warn('Failed to load FileSystemStorage, falling back to memory storage:', fsError);
@@ -317,19 +335,19 @@ export async function createStorage(options = {}) {
317
335
  if (isBrowser()) {
318
336
  const opfsStorage = new OPFSStorage();
319
337
  if (opfsStorage.isOPFSAvailable()) {
320
- console.log('Using OPFS storage (auto-detected)');
338
+ console.log('Using OPFS storage (auto-detected) + TypeAware wrapper');
321
339
  await opfsStorage.init();
322
340
  // Request persistent storage if specified
323
341
  if (options.requestPersistentStorage) {
324
342
  const isPersistent = await opfsStorage.requestPersistentStorage();
325
343
  console.log(`Persistent storage ${isPersistent ? 'granted' : 'denied'}`);
326
344
  }
327
- return opfsStorage;
345
+ return await wrapWithTypeAware(opfsStorage, options);
328
346
  }
329
347
  }
330
348
  // Finally, fall back to memory storage
331
- console.log('Using memory storage (auto-detected)');
332
- return new MemoryStorage();
349
+ console.log('Using memory storage (auto-detected) + TypeAware wrapper');
350
+ return await wrapWithTypeAware(new MemoryStorage(), options);
333
351
  }
334
352
  /**
335
353
  * Export storage adapters
@@ -458,6 +458,7 @@ export interface BrainyConfig {
458
458
  storage?: {
459
459
  type: 'auto' | 'memory' | 'filesystem' | 's3' | 'r2' | 'opfs' | 'gcs';
460
460
  options?: any;
461
+ branch?: string;
461
462
  };
462
463
  model?: {
463
464
  type: 'fast' | 'accurate' | 'balanced' | 'custom';
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Usage:
8
8
  * import { FSCompat } from '@soulcraft/brainy/vfs'
9
- * const fs = new FSCompat(brain.vfs())
9
+ * const fs = new FSCompat(brain.vfs)
10
10
  *
11
11
  * // Now use like Node's fs
12
12
  * await fs.promises.readFile('/path')
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Usage:
8
8
  * import { FSCompat } from '@soulcraft/brainy/vfs'
9
- * const fs = new FSCompat(brain.vfs())
9
+ * const fs = new FSCompat(brain.vfs)
10
10
  *
11
11
  * // Now use like Node's fs
12
12
  * await fs.promises.readFile('/path')
@@ -42,10 +42,9 @@ export class VirtualFileSystem {
42
42
  return;
43
43
  // Merge config with defaults
44
44
  this.config = { ...this.getDefaultConfig(), ...config };
45
- // Initialize Brainy if needed
46
- if (!this.brain.isInitialized) {
47
- await this.brain.init();
48
- }
45
+ // v5.0.1: VFS is now auto-initialized during brain.init()
46
+ // Brain is guaranteed to be initialized when this is called
47
+ // Removed brain.init() check to prevent infinite recursion
49
48
  // Create or find root entity
50
49
  this.rootEntityId = await this.initializeRoot();
51
50
  // Initialize projection registry with auto-discovery of built-in projections
@@ -847,11 +846,11 @@ export class VirtualFileSystem {
847
846
  throw new VFSError(VFSErrorCode.EINVAL, 'VFS not initialized. Call await vfs.init() before using VFS operations.\n\n' +
848
847
  '✅ After brain.import():\n' +
849
848
  ' await brain.import(file, { vfsPath: "/imports/data" })\n' +
850
- ' const vfs = brain.vfs()\n' +
849
+ ' const vfs = brain.vfs\n' +
851
850
  ' await vfs.init() // ← Required! Safe to call multiple times\n' +
852
851
  ' const files = await vfs.readdir("/imports/data")\n\n' +
853
852
  '✅ Direct VFS usage:\n' +
854
- ' const vfs = brain.vfs()\n' +
853
+ ' const vfs = brain.vfs\n' +
855
854
  ' await vfs.init() // ← Always required before first use\n' +
856
855
  ' await vfs.writeFile("/docs/readme.md", "Hello")\n\n' +
857
856
  '📖 Docs: https://github.com/soulcraftlabs/brainy/blob/main/docs/vfs/QUICK_START.md', '<unknown>', 'VFS');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "4.11.2",
3
+ "version": "5.1.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",