@soulcraft/brainy 1.5.0 → 2.0.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 (141) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/LICENSE +2 -2
  3. package/README.md +201 -596
  4. package/bin/brainy-interactive.js +564 -0
  5. package/bin/brainy-ts.js +18 -0
  6. package/bin/brainy.js +672 -81
  7. package/dist/augmentationPipeline.d.ts +48 -220
  8. package/dist/augmentationPipeline.js +60 -508
  9. package/dist/augmentationRegistry.d.ts +22 -31
  10. package/dist/augmentationRegistry.js +28 -79
  11. package/dist/augmentations/apiServerAugmentation.d.ts +108 -0
  12. package/dist/augmentations/apiServerAugmentation.js +502 -0
  13. package/dist/augmentations/batchProcessingAugmentation.d.ts +95 -0
  14. package/dist/augmentations/batchProcessingAugmentation.js +567 -0
  15. package/dist/augmentations/brainyAugmentation.d.ts +153 -0
  16. package/dist/augmentations/brainyAugmentation.js +145 -0
  17. package/dist/augmentations/cacheAugmentation.d.ts +105 -0
  18. package/dist/augmentations/cacheAugmentation.js +238 -0
  19. package/dist/augmentations/conduitAugmentations.d.ts +54 -156
  20. package/dist/augmentations/conduitAugmentations.js +156 -1082
  21. package/dist/augmentations/connectionPoolAugmentation.d.ts +62 -0
  22. package/dist/augmentations/connectionPoolAugmentation.js +316 -0
  23. package/dist/augmentations/defaultAugmentations.d.ts +53 -0
  24. package/dist/augmentations/defaultAugmentations.js +88 -0
  25. package/dist/augmentations/entityRegistryAugmentation.d.ts +126 -0
  26. package/dist/augmentations/entityRegistryAugmentation.js +386 -0
  27. package/dist/augmentations/indexAugmentation.d.ts +117 -0
  28. package/dist/augmentations/indexAugmentation.js +284 -0
  29. package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +152 -0
  30. package/dist/augmentations/intelligentVerbScoringAugmentation.js +554 -0
  31. package/dist/augmentations/metricsAugmentation.d.ts +202 -0
  32. package/dist/augmentations/metricsAugmentation.js +291 -0
  33. package/dist/augmentations/monitoringAugmentation.d.ts +94 -0
  34. package/dist/augmentations/monitoringAugmentation.js +227 -0
  35. package/dist/augmentations/neuralImport.d.ts +50 -117
  36. package/dist/augmentations/neuralImport.js +255 -629
  37. package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +52 -0
  38. package/dist/augmentations/requestDeduplicatorAugmentation.js +162 -0
  39. package/dist/augmentations/serverSearchAugmentations.d.ts +43 -22
  40. package/dist/augmentations/serverSearchAugmentations.js +125 -72
  41. package/dist/augmentations/storageAugmentation.d.ts +54 -0
  42. package/dist/augmentations/storageAugmentation.js +93 -0
  43. package/dist/augmentations/storageAugmentations.d.ts +96 -0
  44. package/dist/augmentations/storageAugmentations.js +182 -0
  45. package/dist/augmentations/synapseAugmentation.d.ts +156 -0
  46. package/dist/augmentations/synapseAugmentation.js +312 -0
  47. package/dist/augmentations/walAugmentation.d.ts +108 -0
  48. package/dist/augmentations/walAugmentation.js +515 -0
  49. package/dist/brainyData.d.ts +404 -130
  50. package/dist/brainyData.js +1331 -853
  51. package/dist/chat/BrainyChat.d.ts +16 -8
  52. package/dist/chat/BrainyChat.js +60 -32
  53. package/dist/chat/ChatCLI.d.ts +1 -1
  54. package/dist/chat/ChatCLI.js +6 -6
  55. package/dist/cli/catalog.d.ts +3 -3
  56. package/dist/cli/catalog.js +116 -70
  57. package/dist/cli/commands/core.d.ts +61 -0
  58. package/dist/cli/commands/core.js +348 -0
  59. package/dist/cli/commands/neural.d.ts +25 -0
  60. package/dist/cli/commands/neural.js +508 -0
  61. package/dist/cli/commands/utility.d.ts +37 -0
  62. package/dist/cli/commands/utility.js +276 -0
  63. package/dist/cli/index.d.ts +7 -0
  64. package/dist/cli/index.js +167 -0
  65. package/dist/cli/interactive.d.ts +164 -0
  66. package/dist/cli/interactive.js +542 -0
  67. package/dist/cortex/neuralImport.js +5 -5
  68. package/dist/critical/model-guardian.js +11 -4
  69. package/dist/embeddings/lightweight-embedder.d.ts +23 -0
  70. package/dist/embeddings/lightweight-embedder.js +136 -0
  71. package/dist/embeddings/universal-memory-manager.d.ts +38 -0
  72. package/dist/embeddings/universal-memory-manager.js +206 -0
  73. package/dist/embeddings/worker-embedding.d.ts +7 -0
  74. package/dist/embeddings/worker-embedding.js +77 -0
  75. package/dist/embeddings/worker-manager.d.ts +28 -0
  76. package/dist/embeddings/worker-manager.js +162 -0
  77. package/dist/examples/basicUsage.js +7 -7
  78. package/dist/graph/pathfinding.d.ts +78 -0
  79. package/dist/graph/pathfinding.js +393 -0
  80. package/dist/hnsw/hnswIndex.d.ts +13 -0
  81. package/dist/hnsw/hnswIndex.js +35 -0
  82. package/dist/hnsw/hnswIndexOptimized.d.ts +1 -0
  83. package/dist/hnsw/hnswIndexOptimized.js +3 -0
  84. package/dist/index.d.ts +9 -11
  85. package/dist/index.js +21 -11
  86. package/dist/indices/fieldIndex.d.ts +76 -0
  87. package/dist/indices/fieldIndex.js +357 -0
  88. package/dist/mcp/brainyMCPAdapter.js +3 -2
  89. package/dist/mcp/mcpAugmentationToolset.js +11 -17
  90. package/dist/neural/embeddedPatterns.d.ts +41 -0
  91. package/dist/neural/embeddedPatterns.js +4044 -0
  92. package/dist/neural/naturalLanguageProcessor.d.ts +94 -0
  93. package/dist/neural/naturalLanguageProcessor.js +317 -0
  94. package/dist/neural/naturalLanguageProcessorStatic.d.ts +64 -0
  95. package/dist/neural/naturalLanguageProcessorStatic.js +151 -0
  96. package/dist/neural/neuralAPI.d.ts +255 -0
  97. package/dist/neural/neuralAPI.js +612 -0
  98. package/dist/neural/patternLibrary.d.ts +101 -0
  99. package/dist/neural/patternLibrary.js +313 -0
  100. package/dist/neural/patterns.d.ts +27 -0
  101. package/dist/neural/patterns.js +68 -0
  102. package/dist/neural/staticPatternMatcher.d.ts +35 -0
  103. package/dist/neural/staticPatternMatcher.js +153 -0
  104. package/dist/scripts/precomputePatternEmbeddings.d.ts +19 -0
  105. package/dist/scripts/precomputePatternEmbeddings.js +100 -0
  106. package/dist/storage/adapters/fileSystemStorage.d.ts +5 -0
  107. package/dist/storage/adapters/fileSystemStorage.js +20 -0
  108. package/dist/storage/adapters/s3CompatibleStorage.d.ts +5 -0
  109. package/dist/storage/adapters/s3CompatibleStorage.js +16 -0
  110. package/dist/storage/enhancedClearOperations.d.ts +83 -0
  111. package/dist/storage/enhancedClearOperations.js +345 -0
  112. package/dist/storage/storageFactory.js +31 -27
  113. package/dist/triple/TripleIntelligence.d.ts +134 -0
  114. package/dist/triple/TripleIntelligence.js +548 -0
  115. package/dist/types/augmentations.d.ts +45 -344
  116. package/dist/types/augmentations.js +5 -2
  117. package/dist/types/brainyDataInterface.d.ts +20 -10
  118. package/dist/types/graphTypes.d.ts +46 -0
  119. package/dist/types/graphTypes.js +16 -2
  120. package/dist/utils/BoundedRegistry.d.ts +29 -0
  121. package/dist/utils/BoundedRegistry.js +54 -0
  122. package/dist/utils/embedding.js +20 -3
  123. package/dist/utils/hybridModelManager.js +10 -5
  124. package/dist/utils/metadataFilter.d.ts +33 -19
  125. package/dist/utils/metadataFilter.js +58 -23
  126. package/dist/utils/metadataIndex.d.ts +37 -6
  127. package/dist/utils/metadataIndex.js +427 -64
  128. package/dist/utils/requestDeduplicator.d.ts +10 -0
  129. package/dist/utils/requestDeduplicator.js +24 -0
  130. package/dist/utils/unifiedCache.d.ts +103 -0
  131. package/dist/utils/unifiedCache.js +311 -0
  132. package/package.json +43 -128
  133. package/scripts/ensure-models.js +108 -0
  134. package/scripts/prepare-models.js +387 -0
  135. package/OFFLINE_MODELS.md +0 -56
  136. package/dist/intelligence/neuralEngine.d.ts +0 -207
  137. package/dist/intelligence/neuralEngine.js +0 -706
  138. package/dist/utils/modelLoader.d.ts +0 -32
  139. package/dist/utils/modelLoader.js +0 -219
  140. package/dist/utils/modelManager.d.ts +0 -77
  141. package/dist/utils/modelManager.js +0 -219
@@ -8,7 +8,7 @@
8
8
  * - Uses standard NounType.Message for all chat messages
9
9
  * - Employs VerbType.Communicates and VerbType.Precedes for conversation flow
10
10
  * - Auto-discovery of previous sessions using Brainy's search capabilities
11
- * - Hybrid architecture: basic chat (open source) + premium memory sync
11
+ * - Full-featured chat with memory and context management
12
12
  */
13
13
  import { BrainyData } from '../brainyData.js';
14
14
  export interface ChatMessage {
@@ -37,13 +37,12 @@ export interface ChatSession {
37
37
  tags?: string[];
38
38
  summary?: string;
39
39
  archived?: boolean;
40
- premium?: boolean;
41
40
  };
42
41
  }
43
42
  /**
44
- * Enhanced BrainyChat with automatic context loading and intelligent memory
43
+ * BrainyChat with automatic context loading and intelligent memory
45
44
  *
46
- * This extends basic chat functionality with premium features when available
45
+ * Full-featured chat functionality with conversation persistence
47
46
  */
48
47
  export declare class BrainyChat {
49
48
  private brainy;
@@ -65,6 +64,15 @@ export declare class BrainyChat {
65
64
  * Stores using standard NounType.Message and creates conversation flow relationships
66
65
  */
67
66
  addMessage(content: string, speaker?: string, metadata?: ChatMessage['metadata']): Promise<ChatMessage>;
67
+ /**
68
+ * Ask a question and get a template-based response
69
+ * This provides basic functionality without requiring an LLM
70
+ */
71
+ ask(question: string, options?: {
72
+ includeSources?: boolean;
73
+ maxSources?: number;
74
+ sessionId?: string;
75
+ }): Promise<string>;
68
76
  /**
69
77
  * Get conversation history for current session
70
78
  * Uses Brainy's graph traversal to get messages in chronological order
@@ -91,13 +99,14 @@ export declare class BrainyChat {
91
99
  */
92
100
  switchToSession(sessionId: string): Promise<ChatSession | null>;
93
101
  /**
94
- * Archive a session (premium feature)
102
+ * Archive a session
95
103
  * Maintains full searchability while organizing conversations
96
104
  */
97
105
  archiveSession(sessionId: string): Promise<boolean>;
98
106
  /**
99
- * Generate session summary using AI (premium feature)
100
- * Intelligently summarizes long conversations
107
+ * Generate session summary
108
+ * Creates a simple summary of the conversation
109
+ * For AI summaries, users can integrate their own LLM
101
110
  */
102
111
  generateSessionSummary(sessionId: string): Promise<string | null>;
103
112
  private createMessageRelationships;
@@ -107,7 +116,6 @@ export declare class BrainyChat {
107
116
  private nounToChatMessage;
108
117
  private nounToChatSession;
109
118
  private toTimestamp;
110
- private isPremiumEnabled;
111
119
  getCurrentSessionId(): string | null;
112
120
  getCurrentSession(): ChatSession | null;
113
121
  }
@@ -8,13 +8,13 @@
8
8
  * - Uses standard NounType.Message for all chat messages
9
9
  * - Employs VerbType.Communicates and VerbType.Precedes for conversation flow
10
10
  * - Auto-discovery of previous sessions using Brainy's search capabilities
11
- * - Hybrid architecture: basic chat (open source) + premium memory sync
11
+ * - Full-featured chat with memory and context management
12
12
  */
13
13
  import { NounType, VerbType } from '../types/graphTypes.js';
14
14
  /**
15
- * Enhanced BrainyChat with automatic context loading and intelligent memory
15
+ * BrainyChat with automatic context loading and intelligent memory
16
16
  *
17
- * This extends basic chat functionality with premium features when available
17
+ * Full-featured chat functionality with conversation persistence
18
18
  */
19
19
  export class BrainyChat {
20
20
  constructor(brainy) {
@@ -29,7 +29,8 @@ export class BrainyChat {
29
29
  async initialize() {
30
30
  try {
31
31
  // Search for the most recent chat message using Brainy's search
32
- const recentMessages = await this.brainy.search('recent chat conversation', 1, {
32
+ const recentMessages = await this.brainy.search('recent chat conversation', {
33
+ limit: 1,
33
34
  nounTypes: [NounType.Message],
34
35
  metadata: {
35
36
  messageType: 'chat'
@@ -63,8 +64,7 @@ export class BrainyChat {
63
64
  messageCount: 0,
64
65
  participants,
65
66
  metadata: {
66
- tags: ['active'],
67
- premium: await this.isPremiumEnabled()
67
+ tags: ['active']
68
68
  }
69
69
  };
70
70
  // Store session using BrainyData add() method
@@ -123,6 +123,44 @@ export class BrainyChat {
123
123
  await this.updateSessionMetadata();
124
124
  return message;
125
125
  }
126
+ /**
127
+ * Ask a question and get a template-based response
128
+ * This provides basic functionality without requiring an LLM
129
+ */
130
+ async ask(question, options) {
131
+ // Add the user's question to the chat
132
+ await this.addMessage(question, 'user');
133
+ // Search for relevant content using Brainy's search
134
+ const searchResults = await this.brainy.search(question, {
135
+ limit: options?.maxSources || 5
136
+ });
137
+ // Generate a template-based response
138
+ let response = '';
139
+ if (searchResults.length === 0) {
140
+ response = "I don't have enough information to answer that question based on the current data.";
141
+ }
142
+ else {
143
+ // Check if this is a count question
144
+ if (question.toLowerCase().includes('how many') || question.toLowerCase().includes('count')) {
145
+ response = `Based on the search results, I found ${searchResults.length} relevant items.`;
146
+ }
147
+ // Check if this is a list question
148
+ else if (question.toLowerCase().includes('list') || question.toLowerCase().includes('show me')) {
149
+ response = `Here are the relevant items I found:\n${searchResults.map((r, i) => `${i + 1}. ${r.metadata?.title || r.metadata?.content || r.id}`).join('\n')}`;
150
+ }
151
+ // General question
152
+ else {
153
+ response = `Based on the available data, I found information related to your question. The most relevant content includes: ${searchResults[0].metadata?.title || searchResults[0].metadata?.content || searchResults[0].id}`;
154
+ }
155
+ // Add sources if requested
156
+ if (options?.includeSources && searchResults.length > 0) {
157
+ response += '\n\nSources: ' + searchResults.map(r => r.id).join(', ');
158
+ }
159
+ }
160
+ // Add the assistant's response to the chat
161
+ await this.addMessage(response, 'assistant');
162
+ return response;
163
+ }
126
164
  /**
127
165
  * Get conversation history for current session
128
166
  * Uses Brainy's graph traversal to get messages in chronological order
@@ -133,7 +171,8 @@ export class BrainyChat {
133
171
  try {
134
172
  // Search for messages in this session using Brainy's search
135
173
  const messageNouns = await this.brainy.search('', // Empty query to get all messages
136
- limit, {
174
+ {
175
+ limit: limit,
137
176
  nounTypes: [NounType.Message],
138
177
  metadata: {
139
178
  sessionId: this.currentSessionId,
@@ -162,7 +201,8 @@ export class BrainyChat {
162
201
  metadata.speaker = options.speaker;
163
202
  }
164
203
  try {
165
- const results = await this.brainy.search(options?.semanticSearch !== false ? query : '', options?.limit || 20, {
204
+ const results = await this.brainy.search(options?.semanticSearch !== false ? query : '', {
205
+ limit: options?.limit || 20,
166
206
  nounTypes: [NounType.Message],
167
207
  metadata
168
208
  });
@@ -179,7 +219,8 @@ export class BrainyChat {
179
219
  */
180
220
  async getSessions(limit = 20) {
181
221
  try {
182
- const sessionNouns = await this.brainy.search('', limit, {
222
+ const sessionNouns = await this.brainy.search('', {
223
+ limit: limit,
183
224
  nounTypes: [NounType.Concept],
184
225
  metadata: {
185
226
  sessionType: 'chat'
@@ -211,13 +252,10 @@ export class BrainyChat {
211
252
  }
212
253
  }
213
254
  /**
214
- * Archive a session (premium feature)
255
+ * Archive a session
215
256
  * Maintains full searchability while organizing conversations
216
257
  */
217
258
  async archiveSession(sessionId) {
218
- if (!await this.isPremiumEnabled()) {
219
- throw new Error('Session archiving requires premium Brain Cloud subscription');
220
- }
221
259
  try {
222
260
  // Since BrainyData doesn't have update, add an archive marker
223
261
  await this.brainy.add({
@@ -237,13 +275,11 @@ export class BrainyChat {
237
275
  return false;
238
276
  }
239
277
  /**
240
- * Generate session summary using AI (premium feature)
241
- * Intelligently summarizes long conversations
278
+ * Generate session summary
279
+ * Creates a simple summary of the conversation
280
+ * For AI summaries, users can integrate their own LLM
242
281
  */
243
282
  async generateSessionSummary(sessionId) {
244
- if (!await this.isPremiumEnabled()) {
245
- throw new Error('AI session summaries require premium Brain Cloud subscription');
246
- }
247
283
  try {
248
284
  const messages = await this.getHistoryForSession(sessionId, 100);
249
285
  const content = messages
@@ -265,7 +301,8 @@ export class BrainyChat {
265
301
  relationship: 'message-in-session'
266
302
  });
267
303
  // Find previous message to create conversation flow using VerbType.Precedes
268
- const previousMessages = await this.brainy.search('', 1, {
304
+ const previousMessages = await this.brainy.search('', {
305
+ limit: 1,
269
306
  nounTypes: [NounType.Message],
270
307
  metadata: {
271
308
  sessionId: this.currentSessionId,
@@ -280,7 +317,8 @@ export class BrainyChat {
280
317
  }
281
318
  async loadSession(sessionId) {
282
319
  try {
283
- const sessionNouns = await this.brainy.search('', 1, {
320
+ const sessionNouns = await this.brainy.search('', {
321
+ limit: 1,
284
322
  nounTypes: [NounType.Concept],
285
323
  metadata: {
286
324
  sessionType: 'chat'
@@ -299,7 +337,8 @@ export class BrainyChat {
299
337
  }
300
338
  async getHistoryForSession(sessionId, limit = 50) {
301
339
  try {
302
- const messageNouns = await this.brainy.search('', limit, {
340
+ const messageNouns = await this.brainy.search('', {
341
+ limit: limit,
303
342
  nounTypes: [NounType.Message],
304
343
  metadata: {
305
344
  sessionId: sessionId,
@@ -346,17 +385,6 @@ export class BrainyChat {
346
385
  const nanoseconds = (date.getTime() % 1000) * 1000000;
347
386
  return { seconds, nanoseconds };
348
387
  }
349
- async isPremiumEnabled() {
350
- // Check if premium augmentations are available
351
- // This would integrate with the license validation system
352
- try {
353
- const augmentations = await this.brainy.listAugmentations();
354
- return augmentations.some((aug) => aug.premium === true && aug.enabled === true);
355
- }
356
- catch {
357
- return false;
358
- }
359
- }
360
388
  // Public API methods for CLI integration
361
389
  getCurrentSessionId() {
362
390
  return this.currentSessionId;
@@ -5,7 +5,7 @@
5
5
  * - Auto-discovery of previous sessions
6
6
  * - Intelligent context loading
7
7
  * - Multi-agent coordination support
8
- * - Premium memory sync integration
8
+ * - Full conversation history and context
9
9
  */
10
10
  import { type ChatMessage } from './BrainyChat.js';
11
11
  import { BrainyData } from '../brainyData.js';
@@ -5,7 +5,7 @@
5
5
  * - Auto-discovery of previous sessions
6
6
  * - Intelligent context loading
7
7
  * - Multi-agent coordination support
8
- * - Premium memory sync integration
8
+ * - Full conversation history and context
9
9
  */
10
10
  import { BrainyChat } from './BrainyChat.js';
11
11
  // Simple color utility without external dependencies
@@ -204,13 +204,13 @@ export class ChatCLI {
204
204
  console.log(' 🔍 Semantic search using vector similarity');
205
205
  console.log(' 📊 Standard noun/verb graph relationships');
206
206
  console.log();
207
- console.log(colors.green('Want More? Premium Features:'));
207
+ console.log(colors.green('Additional Features:'));
208
208
  console.log(' 🤝 Multi-agent coordination');
209
- console.log(' ☁️ Cross-device memory sync');
210
- console.log(' 🎨 Rich web coordination UI');
211
- console.log(' 🔄 Real-time team collaboration');
209
+ console.log(' ☁️ Cross-device sync via augmentations');
210
+ console.log(' 🎨 Web UI integration possible');
211
+ console.log(' 🔄 Real-time collaboration via WebSocket');
212
212
  console.log();
213
- console.log(colors.blue('Get premium: brainy cloud auth'));
213
+ console.log(colors.blue('All features included - MIT Licensed'));
214
214
  console.log();
215
215
  }
216
216
  // Private methods
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Brain Cloud Catalog Integration for CLI
2
+ * Augmentation Catalog for CLI
3
3
  *
4
- * Fetches and displays augmentation catalog
5
- * Falls back to local cache if API is unavailable
4
+ * Displays available augmentations catalog
5
+ * Local catalog with caching support
6
6
  */
7
7
  interface Augmentation {
8
8
  id: string;
@@ -1,14 +1,14 @@
1
1
  /**
2
- * Brain Cloud Catalog Integration for CLI
2
+ * Augmentation Catalog for CLI
3
3
  *
4
- * Fetches and displays augmentation catalog
5
- * Falls back to local cache if API is unavailable
4
+ * Displays available augmentations catalog
5
+ * Local catalog with caching support
6
6
  */
7
7
  import chalk from 'chalk';
8
8
  import { readFileSync, writeFileSync, existsSync } from 'fs';
9
9
  import { join } from 'path';
10
10
  import { homedir } from 'os';
11
- const CATALOG_API = process.env.BRAIN_CLOUD_CATALOG_URL || 'https://catalog.brain-cloud.soulcraft.com';
11
+ const CATALOG_API = process.env.BRAINY_CATALOG_URL || null;
12
12
  const CACHE_PATH = join(homedir(), '.brainy', 'catalog-cache.json');
13
13
  const CACHE_TTL = 24 * 60 * 60 * 1000; // 24 hours
14
14
  /**
@@ -20,20 +20,24 @@ export async function fetchCatalog() {
20
20
  const cached = loadCache();
21
21
  if (cached)
22
22
  return cached;
23
- // Fetch from API
24
- const response = await fetch(`${CATALOG_API}/api/catalog/cli`);
25
- if (!response.ok)
26
- throw new Error('API unavailable');
27
- const catalog = await response.json();
28
- // Save to cache
29
- saveCache(catalog);
30
- return catalog;
23
+ // If external catalog API is configured, try to fetch
24
+ if (CATALOG_API) {
25
+ const response = await fetch(`${CATALOG_API}/api/catalog/cli`);
26
+ if (!response.ok)
27
+ throw new Error('API unavailable');
28
+ const catalog = await response.json();
29
+ // Save to cache
30
+ saveCache(catalog);
31
+ return catalog;
32
+ }
33
+ // Fall back to local catalog
34
+ return getDefaultCatalog();
31
35
  }
32
36
  catch (error) {
33
37
  // Try loading from cache even if expired
34
38
  const cached = loadCache(true);
35
39
  if (cached) {
36
- console.log(chalk.yellow('📡 Using cached catalog (API unavailable)'));
40
+ console.log(chalk.yellow('📡 Using cached catalog'));
37
41
  return cached;
38
42
  }
39
43
  // Fall back to hardcoded catalog
@@ -49,7 +53,7 @@ export async function showCatalog(options) {
49
53
  console.log(chalk.red('❌ Could not load augmentation catalog'));
50
54
  return;
51
55
  }
52
- console.log(chalk.cyan.bold('🧠 Brain Cloud Augmentation Catalog'));
56
+ console.log(chalk.cyan.bold('🧠 Brainy Augmentation Catalog'));
53
57
  console.log(chalk.gray(`Version ${catalog.version}`));
54
58
  console.log('');
55
59
  // Filter augmentations
@@ -88,7 +92,7 @@ export async function showCatalog(options) {
88
92
  console.log(chalk.green(`✅ ${available} available`) + chalk.gray(` • `) +
89
93
  chalk.yellow(`🔜 ${coming} coming soon`));
90
94
  console.log('');
91
- console.log(chalk.dim('Sign up at app.soulcraft.com to activate'));
95
+ console.log(chalk.dim('Configure augmentations with "brainy augment"'));
92
96
  console.log(chalk.dim('Run "brainy augment info <name>" for details'));
93
97
  }
94
98
  /**
@@ -110,8 +114,10 @@ export async function showAugmentationInfo(id) {
110
114
  });
111
115
  return;
112
116
  }
113
- // Fetch full details from API
117
+ // Fetch full details from API if available
114
118
  try {
119
+ if (!CATALOG_API)
120
+ throw new Error('No external catalog configured');
115
121
  const response = await fetch(`${CATALOG_API}/api/catalog/augmentation/${id}`);
116
122
  const details = await response.json();
117
123
  console.log(chalk.cyan.bold(`📦 ${details.name}`));
@@ -155,57 +161,61 @@ export async function showAugmentationInfo(id) {
155
161
  console.log(chalk.cyan.bold(`📦 ${aug.name}`));
156
162
  console.log(aug.description);
157
163
  console.log('');
158
- console.log(chalk.dim('Full details unavailable (API offline)'));
164
+ console.log(chalk.dim('Full details unavailable (no external catalog configured)'));
159
165
  }
160
166
  }
161
167
  /**
162
168
  * Show user's available augmentations
163
169
  */
164
170
  export async function showAvailable(licenseKey) {
165
- const key = licenseKey || process.env.BRAINY_LICENSE_KEY || readLicenseFile();
166
- if (!key) {
167
- console.log(chalk.yellow('⚠️ No license key found'));
168
- console.log('');
169
- console.log('To see your available augmentations:');
170
- console.log(' 1. Sign up at app.soulcraft.com');
171
- console.log(' 2. Run: brainy augment activate');
171
+ // Show local catalog as default
172
+ const catalog = await fetchCatalog();
173
+ if (!catalog) {
174
+ console.log(chalk.red('❌ Could not load augmentation catalog'));
172
175
  return;
173
176
  }
174
- try {
175
- const response = await fetch(`${CATALOG_API}/api/catalog/available`, {
176
- headers: { 'x-license-key': key }
177
+ console.log(chalk.cyan.bold('🧠 Available Augmentations'));
178
+ console.log('');
179
+ const available = catalog.augmentations.filter(a => a.status === 'available');
180
+ const grouped = groupByCategory(available, catalog.categories);
181
+ for (const [category, augs] of Object.entries(grouped)) {
182
+ if (augs.length === 0)
183
+ continue;
184
+ const cat = catalog.categories.find(c => c.id === category);
185
+ console.log(chalk.bold(`${cat?.icon || '📦'} ${cat?.name || category}`));
186
+ augs.forEach(aug => {
187
+ console.log(` ✅ ${aug.name}`);
188
+ console.log(chalk.gray(` ${aug.description}`));
177
189
  });
178
- if (!response.ok) {
179
- throw new Error('Invalid license');
180
- }
181
- const data = await response.json();
182
- console.log(chalk.cyan.bold('🧠 Your Available Augmentations'));
183
- console.log(chalk.gray(`Plan: ${data.plan}`));
184
190
  console.log('');
185
- const grouped = groupByCategory(data.augmentations, []);
186
- for (const [category, augs] of Object.entries(grouped)) {
187
- console.log(chalk.bold(category));
188
- augs.forEach(aug => {
189
- console.log(` ✅ ${aug.name}`);
191
+ }
192
+ console.log(chalk.green(`✅ ${available.length} augmentations available`));
193
+ // If external API is configured and license key provided, try to fetch personalized data
194
+ if (CATALOG_API && licenseKey) {
195
+ try {
196
+ const response = await fetch(`${CATALOG_API}/api/catalog/available`, {
197
+ headers: { 'x-license-key': licenseKey }
190
198
  });
191
- console.log('');
192
- }
193
- if (data.operations) {
194
- const used = data.operations.used || 0;
195
- const limit = data.operations.limit;
196
- const percent = limit === 'unlimited' ? 0 : Math.round((used / limit) * 100);
197
- console.log(chalk.bold('Usage:'));
198
- if (limit === 'unlimited') {
199
- console.log(` Unlimited operations`);
200
- }
201
- else {
202
- console.log(` ${used.toLocaleString()} / ${limit.toLocaleString()} operations (${percent}%)`);
199
+ if (response.ok) {
200
+ const data = await response.json();
201
+ console.log(chalk.gray(`Plan: ${data.plan || 'Standard'}`));
202
+ if (data.operations) {
203
+ const used = data.operations.used || 0;
204
+ const limit = data.operations.limit;
205
+ const percent = limit === 'unlimited' ? 0 : Math.round((used / limit) * 100);
206
+ console.log(chalk.bold('Usage:'));
207
+ if (limit === 'unlimited') {
208
+ console.log(` Unlimited operations`);
209
+ }
210
+ else {
211
+ console.log(` ${used.toLocaleString()} / ${limit.toLocaleString()} operations (${percent}%)`);
212
+ }
213
+ }
203
214
  }
204
215
  }
205
- }
206
- catch (error) {
207
- console.log(chalk.red('❌ Could not fetch available augmentations'));
208
- console.log(chalk.gray(error.message));
216
+ catch (error) {
217
+ // Ignore external API errors - local catalog is sufficient
218
+ }
209
219
  }
210
220
  }
211
221
  // Helper functions
@@ -287,36 +297,72 @@ function readLicenseFile() {
287
297
  return null;
288
298
  }
289
299
  function getDefaultCatalog() {
290
- // Hardcoded fallback catalog
300
+ // Local catalog with current features
291
301
  return {
292
- version: '1.0.0',
302
+ version: '1.5.0',
293
303
  categories: [
294
- { id: 'memory', name: 'Memory', icon: '🧠', description: 'AI memory and persistence' },
295
- { id: 'coordination', name: 'Coordination', icon: '🤝', description: 'Multi-agent orchestration' },
296
- { id: 'enterprise', name: 'Enterprise', icon: '🏢', description: 'Business integrations' }
304
+ { id: 'core', name: 'Core Features', icon: '🧠', description: 'Essential brainy functionality' },
305
+ { id: 'neural', name: 'Neural API', icon: '🔗', description: 'Semantic similarity and clustering' },
306
+ { id: 'enterprise', name: 'Enterprise', icon: '🏢', description: 'Business integrations' },
307
+ { id: 'storage', name: 'Storage', icon: '💾', description: 'Data persistence and caching' }
297
308
  ],
298
309
  augmentations: [
299
310
  {
300
- id: 'ai-memory',
301
- name: 'AI Memory',
302
- category: 'memory',
303
- description: 'Persistent memory across all AI sessions',
311
+ id: 'vector-search',
312
+ name: 'Vector Search',
313
+ category: 'core',
314
+ description: 'High-performance semantic search with HNSW indexing',
304
315
  status: 'available',
305
316
  popular: true
306
317
  },
307
318
  {
308
- id: 'agent-coordinator',
309
- name: 'Agent Coordinator',
310
- category: 'coordination',
311
- description: 'Multi-agent handoffs and orchestration',
319
+ id: 'neural-similarity',
320
+ name: 'Neural Similarity API',
321
+ category: 'neural',
322
+ description: 'Advanced semantic similarity, clustering, and hierarchy detection',
312
323
  status: 'available',
313
324
  popular: true
314
325
  },
315
326
  {
316
- id: 'notion-sync',
317
- name: 'Notion Sync',
327
+ id: 'intelligent-verb-scoring',
328
+ name: 'Intelligent Verb Scoring',
329
+ category: 'neural',
330
+ description: 'Smart relationship scoring with taxonomy understanding',
331
+ status: 'available'
332
+ },
333
+ {
334
+ id: 'wal-augmentation',
335
+ name: 'WAL-based Augmentation',
318
336
  category: 'enterprise',
319
- description: 'Bidirectional Notion database sync',
337
+ description: 'Write-ahead log for reliable augmentation processing',
338
+ status: 'available'
339
+ },
340
+ {
341
+ id: 'connection-pooling',
342
+ name: 'Connection Pooling',
343
+ category: 'enterprise',
344
+ description: 'Efficient database connection management',
345
+ status: 'available'
346
+ },
347
+ {
348
+ id: 'batch-processing',
349
+ name: 'Batch Processing',
350
+ category: 'enterprise',
351
+ description: 'High-throughput batch operations with deduplication',
352
+ status: 'available'
353
+ },
354
+ {
355
+ id: 's3-storage',
356
+ name: 'S3 Compatible Storage',
357
+ category: 'storage',
358
+ description: 'Cloud storage with optimized batch operations',
359
+ status: 'available'
360
+ },
361
+ {
362
+ id: 'opfs-storage',
363
+ name: 'OPFS Storage',
364
+ category: 'storage',
365
+ description: 'Browser-based persistent storage',
320
366
  status: 'available'
321
367
  }
322
368
  ]
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Core CLI Commands - TypeScript Implementation
3
+ *
4
+ * Essential database operations: add, search, get, relate, import, export
5
+ */
6
+ interface CoreOptions {
7
+ verbose?: boolean;
8
+ json?: boolean;
9
+ pretty?: boolean;
10
+ }
11
+ interface AddOptions extends CoreOptions {
12
+ id?: string;
13
+ metadata?: string;
14
+ type?: string;
15
+ }
16
+ interface SearchOptions extends CoreOptions {
17
+ limit?: string;
18
+ threshold?: string;
19
+ metadata?: string;
20
+ }
21
+ interface GetOptions extends CoreOptions {
22
+ withConnections?: boolean;
23
+ }
24
+ interface RelateOptions extends CoreOptions {
25
+ weight?: string;
26
+ metadata?: string;
27
+ }
28
+ interface ImportOptions extends CoreOptions {
29
+ format?: 'json' | 'csv' | 'jsonl';
30
+ batchSize?: string;
31
+ }
32
+ interface ExportOptions extends CoreOptions {
33
+ format?: 'json' | 'csv' | 'jsonl';
34
+ }
35
+ export declare const coreCommands: {
36
+ /**
37
+ * Add data to the neural database
38
+ */
39
+ add(text: string, options: AddOptions): Promise<void>;
40
+ /**
41
+ * Search the neural database
42
+ */
43
+ search(query: string, options: SearchOptions): Promise<void>;
44
+ /**
45
+ * Get item by ID
46
+ */
47
+ get(id: string, options: GetOptions): Promise<void>;
48
+ /**
49
+ * Create relationship between items
50
+ */
51
+ relate(source: string, verb: string, target: string, options: RelateOptions): Promise<void>;
52
+ /**
53
+ * Import data from file
54
+ */
55
+ import(file: string, options: ImportOptions): Promise<void>;
56
+ /**
57
+ * Export database
58
+ */
59
+ export(file: string | undefined, options: ExportOptions): Promise<void>;
60
+ };
61
+ export {};