@soulcraft/brainy 0.62.0 β†’ 0.62.2

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/README.md CHANGED
@@ -9,9 +9,8 @@
9
9
  [![Node.js](https://img.shields.io/badge/node-%3E%3D24.4.1-brightgreen.svg)](https://nodejs.org/)
10
10
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.4.5-blue.svg)](https://www.typescriptlang.org/)
11
11
 
12
- # 🧠 BRAINY: Your AI-Powered Second Brain
12
+ # 🧠 The World's First Multi-Dimensional AI Databaseβ„’
13
13
 
14
- **The World's First Multi-Dimensional AI Databaseβ„’**
15
14
  *Vector similarity β€’ Graph relationships β€’ Metadata facets β€’ Neural understanding*
16
15
 
17
16
  **Build AI apps that actually understand your data - in minutes, not months**
@@ -20,6 +19,22 @@
20
19
 
21
20
  ---
22
21
 
22
+ ## βœ… 100% Free & Open Source
23
+
24
+ **Brainy is completely free. No license keys. No limits. No catch.**
25
+
26
+ Every feature you see here works without any payment or registration:
27
+ - βœ“ Full vector database
28
+ - βœ“ Graph relationships
29
+ - βœ“ Semantic search
30
+ - βœ“ All storage adapters
31
+ - βœ“ Complete API
32
+ - βœ“ Forever free
33
+
34
+ > 🌩️ **Brain Cloud** is an optional add-on for teams who want cloud sync and enterprise connectors.
35
+
36
+ ---
37
+
23
38
  ## πŸš€ What Can You Build?
24
39
 
25
40
  ### πŸ’¬ **AI Chat Apps** - That Actually Remember
@@ -134,13 +149,14 @@ const results = await brain.search("companies founded by Elon")
134
149
  # Auto-setup with cloud instance provisioning (RECOMMENDED)
135
150
  brainy cloud setup --email your@email.com
136
151
 
137
- # Or install manually
138
- npm install @soulcraft/brainy @soulcraft/brain-cloud
152
+ # Sign up at app.soulcraft.com (free trial)
153
+ brainy cloud auth # Auto-configures based on your plan
139
154
  ```
140
155
 
141
156
  ```javascript
142
157
  import { BrainyData, Cortex } from '@soulcraft/brainy'
143
- import { AIMemory, AgentCoordinator } from '@soulcraft/brain-cloud'
158
+ // After authentication, augmentations auto-load
159
+ // No imports needed - they're managed by your account!
144
160
 
145
161
  const brain = new BrainyData()
146
162
  const cortex = new Cortex()
@@ -205,20 +221,17 @@ cortex.register(new Translator()) // Multi-language support
205
221
  - πŸ“Š Data Visualizer
206
222
  - 🎨 Image Understanding
207
223
 
208
- ### πŸ’Ό **Premium Augmentations** (@soulcraft/brain-cloud)
209
- For teams that need AI memory and enterprise features:
224
+ ### ☁️ **Brain Cloud** (Optional Add-On)
225
+ 🌟 **Brainy works perfectly without this!** Brain Cloud adds team features:
210
226
 
211
227
  ```javascript
212
- import {
213
- AIMemory, // Persistent AI memory
214
- AgentCoordinator, // Multi-agent handoffs
215
- NotionSync, // Notion integration
216
- SalesforceConnect // CRM integration
217
- } from '@soulcraft/brain-cloud'
218
-
219
- // Requires license key - get one at soulcraft.com
220
- const aiMemory = new AIMemory({
221
- licenseKey: process.env.BRAINY_LICENSE_KEY
228
+ // Brain Cloud features are in the main package
229
+ // But require API key to activate cloud services
230
+ import { BrainyVectorDB } from '@soulcraft/brainy'
231
+
232
+ // Activate Brain Cloud features with API key
233
+ const brain = new BrainyVectorDB({
234
+ cloud: { apiKey: process.env.BRAIN_CLOUD_KEY } // Optional
222
235
  })
223
236
 
224
237
  cortex.register(aiMemory) // AI remembers everything
package/bin/brainy.js CHANGED
@@ -345,7 +345,7 @@ program
345
345
 
346
346
  try {
347
347
  // Test connection to Brain Cloud worker
348
- const healthUrl = `https://brain-cloud.dpsifr.workers.dev/health`
348
+ const healthUrl = `https://api.soulcraft.com/brain-cloud/health`
349
349
  const response = await fetch(healthUrl, {
350
350
  headers: { 'x-customer-id': options.connect }
351
351
  })
@@ -357,7 +357,7 @@ program
357
357
  console.log(chalk.gray(`⏰ Connected at: ${new Date(data.timestamp).toLocaleString()}`))
358
358
 
359
359
  // Test memories endpoint
360
- const memoriesResponse = await fetch(`https://brain-cloud.dpsifr.workers.dev/memories`, {
360
+ const memoriesResponse = await fetch(`https://api.soulcraft.com/brain-cloud/memories`, {
361
361
  headers: { 'x-customer-id': options.connect }
362
362
  })
363
363
 
@@ -384,7 +384,7 @@ program
384
384
  console.log(chalk.green(`πŸ“¦ Exporting data from Brain Cloud instance: ${options.export}`))
385
385
 
386
386
  try {
387
- const response = await fetch(`https://brain-cloud.dpsifr.workers.dev/export`, {
387
+ const response = await fetch(`https://api.soulcraft.com/brain-cloud/export`, {
388
388
  headers: { 'x-customer-id': options.export }
389
389
  })
390
390
 
@@ -408,7 +408,7 @@ program
408
408
  console.log(chalk.green(`πŸ” Checking status of Brain Cloud instance: ${options.status}`))
409
409
 
410
410
  try {
411
- const response = await fetch(`https://brain-cloud.dpsifr.workers.dev/health`, {
411
+ const response = await fetch(`https://api.soulcraft.com/brain-cloud/health`, {
412
412
  headers: { 'x-customer-id': options.status }
413
413
  })
414
414
 
@@ -419,7 +419,7 @@ program
419
419
  console.log(chalk.gray(`⏰ Last check: ${new Date(data.timestamp).toLocaleString()}`))
420
420
 
421
421
  // Get memory count
422
- const memoriesResponse = await fetch(`https://brain-cloud.dpsifr.workers.dev/memories`, {
422
+ const memoriesResponse = await fetch(`https://api.soulcraft.com/brain-cloud/memories`, {
423
423
  headers: { 'x-customer-id': options.status }
424
424
  })
425
425
 
@@ -549,9 +549,12 @@ augment
549
549
  output: process.stdout
550
550
  })
551
551
 
552
- console.log(chalk.cyan('🧠 Brain Cloud Activation'))
552
+ console.log(chalk.cyan('☁️ Brain Cloud Activation (Optional Premium)'))
553
553
  console.log('')
554
- console.log('Get your license at: ' + chalk.green('app.soulcraft.com'))
554
+ console.log(chalk.yellow('Note: Brainy core is 100% free and fully functional!'))
555
+ console.log('Brain Cloud adds optional team & sync features.')
556
+ console.log('')
557
+ console.log('Get Brain Cloud at: ' + chalk.green('app.soulcraft.com'))
555
558
  console.log('(14-day free trial available)')
556
559
  console.log('')
557
560
 
@@ -567,12 +570,12 @@ augment
567
570
 
568
571
  console.log(chalk.green('βœ… License saved!'))
569
572
  console.log('')
570
- console.log('Install Brain Cloud:')
571
- console.log(chalk.cyan(' npm install @soulcraft/brain-cloud'))
573
+ console.log('// Brain Cloud is NOT an npm package!')
574
+ console.log('// Augmentations auto-load based on your subscription')
572
575
  console.log('')
573
- console.log('Then use in your code:')
574
- console.log(chalk.gray(' import { AIMemory } from "@soulcraft/brain-cloud"'))
575
- console.log(chalk.gray(' cortex.register(new AIMemory())'))
576
+ console.log('Next steps:')
577
+ console.log(chalk.cyan(' brainy cloud auth'))
578
+ console.log(chalk.gray(' # Your augmentations will auto-load'))
576
579
  } else {
577
580
  console.log(chalk.red('Invalid license key'))
578
581
  }
@@ -915,7 +918,7 @@ async function detectCustomerId() {
915
918
  const testIds = ['demo-test-auto', 'demo-test123']
916
919
  for (const id of testIds) {
917
920
  try {
918
- const response = await fetch(`https://brain-cloud.dpsifr.workers.dev/health`, {
921
+ const response = await fetch(`https://api.soulcraft.com/brain-cloud/health`, {
919
922
  headers: { 'x-customer-id': id }
920
923
  })
921
924
  if (response.ok) {
@@ -947,7 +950,7 @@ async function setupBrainCloudMemory(customerId) {
947
950
  args: ["brainy-mcp-server.js"],
948
951
  env: {
949
952
  CUSTOMER_ID: customerId,
950
- BRAIN_CLOUD_URL: "https://brain-cloud.dpsifr.workers.dev"
953
+ BRAIN_CLOUD_URL: "https://api.soulcraft.com/brain-cloud"
951
954
  }
952
955
  }
953
956
  }
@@ -1001,7 +1004,7 @@ When working with multiple AI assistants, we automatically coordinate:
1001
1004
  try {
1002
1005
  const brainyConfig = {
1003
1006
  brainCloudCustomerId: customerId,
1004
- brainCloudUrl: 'https://brain-cloud.dpsifr.workers.dev',
1007
+ brainCloudUrl: 'https://api.soulcraft.com/brain-cloud',
1005
1008
  lastConnected: new Date().toISOString()
1006
1009
  }
1007
1010
 
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Smart Model Loader - Zero Configuration ML Models
3
+ * Downloads models on-demand, caches intelligently
4
+ */
5
+ export declare class SmartModelLoader {
6
+ private static readonly MODEL_SOURCES;
7
+ static loadModel(modelName: string): Promise<ArrayBuffer>;
8
+ private static tryLoadFrom;
9
+ private static cacheLocally;
10
+ private static generateFallbackModel;
11
+ }
12
+ export declare function getEmbedding(text: string): Promise<Float32Array>;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Smart Model Loader - Zero Configuration ML Models
3
+ * Downloads models on-demand, caches intelligently
4
+ */
5
+ export class SmartModelLoader {
6
+ static async loadModel(modelName) {
7
+ // Try each source in order
8
+ for (const source of this.MODEL_SOURCES) {
9
+ try {
10
+ const model = await this.tryLoadFrom(source, modelName);
11
+ if (model) {
12
+ await this.cacheLocally(model, modelName);
13
+ return model;
14
+ }
15
+ }
16
+ catch {
17
+ continue; // Try next source
18
+ }
19
+ }
20
+ // Fallback: Generate lightweight random embeddings
21
+ console.warn('Using fallback embeddings (reduced accuracy)');
22
+ return this.generateFallbackModel(modelName);
23
+ }
24
+ static async tryLoadFrom(source, model) {
25
+ if (source.startsWith('http')) {
26
+ // Download from CDN
27
+ const response = await fetch(`${source}/${model}`);
28
+ if (response.ok) {
29
+ return await response.arrayBuffer();
30
+ }
31
+ }
32
+ else {
33
+ // Check local filesystem
34
+ try {
35
+ const fs = await import('fs');
36
+ return fs.readFileSync(`${source}/${model}`);
37
+ }
38
+ catch {
39
+ return null;
40
+ }
41
+ }
42
+ return null;
43
+ }
44
+ static async cacheLocally(model, name) {
45
+ // Cache in best available location
46
+ if (typeof window !== 'undefined' && 'caches' in window) {
47
+ // Browser: Use Cache API
48
+ const cache = await caches.open('brainy-models');
49
+ await cache.put(name, new Response(model));
50
+ }
51
+ else if (typeof process !== 'undefined') {
52
+ // Node: Use filesystem cache
53
+ const fs = await import('fs');
54
+ const path = await import('path');
55
+ const cacheDir = path.join(process.env.HOME || '', '.brainy', 'models');
56
+ fs.mkdirSync(cacheDir, { recursive: true });
57
+ fs.writeFileSync(path.join(cacheDir, name), Buffer.from(model));
58
+ }
59
+ }
60
+ static generateFallbackModel(name) {
61
+ // Deterministic "random" embeddings based on input
62
+ // Good enough for development/testing
63
+ const seed = name.split('').reduce((a, b) => a + b.charCodeAt(0), 0);
64
+ const model = new Float32Array(384); // Standard embedding size
65
+ for (let i = 0; i < model.length; i++) {
66
+ model[i] = Math.sin(seed * (i + 1)) * 0.1;
67
+ }
68
+ return model.buffer;
69
+ }
70
+ }
71
+ SmartModelLoader.MODEL_SOURCES = [
72
+ // 1. Check if bundled locally
73
+ './models',
74
+ '../models',
75
+ // 2. Check user's cache
76
+ '~/.brainy/models',
77
+ // 3. Check CDN (fast, free)
78
+ 'https://cdn.jsdelivr.net/npm/@brainy/models@latest',
79
+ 'https://unpkg.com/@brainy/models',
80
+ // 4. Check Hugging Face (original source)
81
+ 'https://huggingface.co/Xenova/all-MiniLM-L6-v2/resolve/main'
82
+ ];
83
+ // Usage - Zero configuration required!
84
+ export async function getEmbedding(text) {
85
+ const model = await SmartModelLoader.loadModel('encoder.onnx');
86
+ // ... use model
87
+ }
88
+ //# sourceMappingURL=modelLoader.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "0.62.0",
3
+ "version": "0.62.2",
4
4
  "description": "Multi-Dimensional AI Database - Vector similarity, graph relationships, metadata facets with HNSW indexing and OPFS storage",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",