@soulcraft/brainy 3.21.0 → 3.23.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 (34) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +42 -51
  3. package/dist/augmentations/defaultAugmentations.d.ts +6 -0
  4. package/dist/augmentations/defaultAugmentations.js +12 -0
  5. package/dist/augmentations/intelligentImport/IntelligentImportAugmentation.d.ts +51 -0
  6. package/dist/augmentations/intelligentImport/IntelligentImportAugmentation.js +185 -0
  7. package/dist/augmentations/intelligentImport/handlers/base.d.ts +49 -0
  8. package/dist/augmentations/intelligentImport/handlers/base.js +149 -0
  9. package/dist/augmentations/intelligentImport/handlers/csvHandler.d.ts +34 -0
  10. package/dist/augmentations/intelligentImport/handlers/csvHandler.js +185 -0
  11. package/dist/augmentations/intelligentImport/handlers/excelHandler.d.ts +31 -0
  12. package/dist/augmentations/intelligentImport/handlers/excelHandler.js +148 -0
  13. package/dist/augmentations/intelligentImport/handlers/pdfHandler.d.ts +35 -0
  14. package/dist/augmentations/intelligentImport/handlers/pdfHandler.js +247 -0
  15. package/dist/augmentations/intelligentImport/index.d.ts +9 -0
  16. package/dist/augmentations/intelligentImport/index.js +9 -0
  17. package/dist/augmentations/intelligentImport/types.d.ts +111 -0
  18. package/dist/augmentations/intelligentImport/types.js +6 -0
  19. package/dist/brainy.d.ts +0 -18
  20. package/dist/brainy.js +0 -24
  21. package/dist/cli/index.js +0 -38
  22. package/dist/index.d.ts +0 -3
  23. package/dist/index.js +0 -3
  24. package/package.json +7 -2
  25. package/dist/cli/commands/conversation.d.ts +0 -22
  26. package/dist/cli/commands/conversation.js +0 -538
  27. package/dist/conversation/conversationManager.d.ts +0 -176
  28. package/dist/conversation/conversationManager.js +0 -666
  29. package/dist/conversation/index.d.ts +0 -8
  30. package/dist/conversation/index.js +0 -8
  31. package/dist/conversation/types.d.ts +0 -231
  32. package/dist/conversation/types.js +0 -8
  33. package/dist/mcp/conversationTools.d.ts +0 -88
  34. package/dist/mcp/conversationTools.js +0 -470
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Types for Intelligent Import Augmentation
3
+ * Handles Excel, PDF, and CSV import with intelligent extraction
4
+ */
5
+ export interface FormatHandler {
6
+ /**
7
+ * Format name (e.g., 'csv', 'xlsx', 'pdf')
8
+ */
9
+ readonly format: string;
10
+ /**
11
+ * Process raw data into structured format
12
+ * @param data Raw file data (Buffer or string)
13
+ * @param options Format-specific options
14
+ * @returns Structured data ready for entity extraction
15
+ */
16
+ process(data: Buffer | string, options: FormatHandlerOptions): Promise<ProcessedData>;
17
+ /**
18
+ * Detect if this handler can process the given data
19
+ * @param data Raw data or filename
20
+ * @returns true if handler supports this format
21
+ */
22
+ canHandle(data: Buffer | string | {
23
+ filename?: string;
24
+ ext?: string;
25
+ }): boolean;
26
+ }
27
+ export interface FormatHandlerOptions {
28
+ /** Source filename (for extension detection) */
29
+ filename?: string;
30
+ /** File extension (if known) */
31
+ ext?: string;
32
+ /** Encoding (auto-detected if not specified) */
33
+ encoding?: string;
34
+ /** CSV-specific: delimiter character */
35
+ csvDelimiter?: string;
36
+ /** CSV-specific: whether first row is headers */
37
+ csvHeaders?: boolean;
38
+ /** Excel-specific: sheet names to extract (or 'all') */
39
+ excelSheets?: string[] | 'all';
40
+ /** Excel-specific: whether to evaluate formulas */
41
+ excelEvaluateFormulas?: boolean;
42
+ /** PDF-specific: whether to extract tables */
43
+ pdfExtractTables?: boolean;
44
+ /** PDF-specific: whether to preserve layout */
45
+ pdfPreserveLayout?: boolean;
46
+ /** Maximum rows to process (for large files) */
47
+ maxRows?: number;
48
+ /** Whether to stream large files */
49
+ streaming?: boolean;
50
+ }
51
+ export interface ProcessedData {
52
+ /** Format that was processed */
53
+ format: string;
54
+ /** Structured data (array of objects) */
55
+ data: Array<Record<string, any>>;
56
+ /** Metadata about the processed data */
57
+ metadata: {
58
+ /** Number of rows/entities extracted */
59
+ rowCount: number;
60
+ /** Column/field names */
61
+ fields: string[];
62
+ /** Detected encoding (for text formats) */
63
+ encoding?: string;
64
+ /** Excel: sheet names */
65
+ sheets?: string[];
66
+ /** PDF: page count */
67
+ pageCount?: number;
68
+ /** PDF: extracted text length */
69
+ textLength?: number;
70
+ /** PDF: number of tables detected */
71
+ tableCount?: number;
72
+ /** Processing time in milliseconds */
73
+ processingTime: number;
74
+ /** Any warnings during processing */
75
+ warnings?: string[];
76
+ /** Format-specific metadata */
77
+ [key: string]: any;
78
+ };
79
+ /** Original filename (if available) */
80
+ filename?: string;
81
+ }
82
+ export interface HandlerRegistry {
83
+ /** Registered handlers by format extension */
84
+ handlers: Map<string, () => Promise<FormatHandler>>;
85
+ /** Loaded handler instances (lazy-loaded) */
86
+ loaded: Map<string, FormatHandler>;
87
+ /** Register a new handler */
88
+ register(extensions: string[], loader: () => Promise<FormatHandler>): void;
89
+ /** Get handler for a file/format */
90
+ getHandler(filenameOrExt: string): Promise<FormatHandler | null>;
91
+ }
92
+ export interface IntelligentImportConfig {
93
+ /** Enable CSV handler */
94
+ enableCSV: boolean;
95
+ /** Enable Excel handler */
96
+ enableExcel: boolean;
97
+ /** Enable PDF handler */
98
+ enablePDF: boolean;
99
+ /** Default options for CSV */
100
+ csvDefaults?: Partial<FormatHandlerOptions>;
101
+ /** Default options for Excel */
102
+ excelDefaults?: Partial<FormatHandlerOptions>;
103
+ /** Default options for PDF */
104
+ pdfDefaults?: Partial<FormatHandlerOptions>;
105
+ /** Maximum file size to process (bytes) */
106
+ maxFileSize?: number;
107
+ /** Enable caching of processed data */
108
+ enableCache?: boolean;
109
+ /** Cache TTL in milliseconds */
110
+ cacheTTL?: number;
111
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Types for Intelligent Import Augmentation
3
+ * Handles Excel, PDF, and CSV import with intelligent extraction
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
package/dist/brainy.d.ts CHANGED
@@ -38,7 +38,6 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
38
38
  private _extractor?;
39
39
  private _tripleIntelligence?;
40
40
  private _vfs?;
41
- private _conversation?;
42
41
  private initialized;
43
42
  private dimensions?;
44
43
  constructor(config?: BrainyConfig);
@@ -645,23 +644,6 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
645
644
  * Virtual File System API - Knowledge Operating System
646
645
  */
647
646
  vfs(): VirtualFileSystem;
648
- /**
649
- * Conversation Manager API - Infinite Agent Memory
650
- *
651
- * Provides conversation and context management for AI agents:
652
- * - Save and retrieve conversation messages
653
- * - Semantic search across conversation history
654
- * - Smart context retrieval with relevance ranking
655
- * - Artifact management (code, files, documents)
656
- * - Conversation themes and clustering
657
- *
658
- * @returns ConversationManager instance
659
- * @example
660
- * const conv = brain.conversation
661
- * await conv.saveMessage("How do I implement auth?", "user", { conversationId: "conv_123" })
662
- * const context = await conv.getRelevantContext("authentication implementation")
663
- */
664
- conversation(): any;
665
647
  /**
666
648
  * Data Management API - backup, restore, import, export
667
649
  */
package/dist/brainy.js CHANGED
@@ -1428,30 +1428,6 @@ export class Brainy {
1428
1428
  }
1429
1429
  return this._vfs;
1430
1430
  }
1431
- /**
1432
- * Conversation Manager API - Infinite Agent Memory
1433
- *
1434
- * Provides conversation and context management for AI agents:
1435
- * - Save and retrieve conversation messages
1436
- * - Semantic search across conversation history
1437
- * - Smart context retrieval with relevance ranking
1438
- * - Artifact management (code, files, documents)
1439
- * - Conversation themes and clustering
1440
- *
1441
- * @returns ConversationManager instance
1442
- * @example
1443
- * const conv = brain.conversation
1444
- * await conv.saveMessage("How do I implement auth?", "user", { conversationId: "conv_123" })
1445
- * const context = await conv.getRelevantContext("authentication implementation")
1446
- */
1447
- conversation() {
1448
- if (!this._conversation) {
1449
- // Lazy-load ConversationManager to avoid circular dependencies
1450
- const { ConversationManager } = require('./conversation/conversationManager.js');
1451
- this._conversation = new ConversationManager(this);
1452
- }
1453
- return this._conversation;
1454
- }
1455
1431
  /**
1456
1432
  * Data Management API - backup, restore, import, export
1457
1433
  */
package/dist/cli/index.js CHANGED
@@ -11,7 +11,6 @@ import { coreCommands } from './commands/core.js';
11
11
  import { utilityCommands } from './commands/utility.js';
12
12
  import { vfsCommands } from './commands/vfs.js';
13
13
  import { dataCommands } from './commands/data.js';
14
- import conversationCommand from './commands/conversation.js';
15
14
  import { readFileSync } from 'fs';
16
15
  import { fileURLToPath } from 'url';
17
16
  import { dirname, join } from 'path';
@@ -144,43 +143,6 @@ program
144
143
  .option('--dimensions <number>', '2D or 3D', '2')
145
144
  .option('-o, --output <file>', 'Output file')
146
145
  .action(neuralCommands.visualize);
147
- // ===== Conversation Commands (Infinite Memory) =====
148
- program
149
- .command('conversation')
150
- .alias('conv')
151
- .description('💬 Infinite agent memory and context management')
152
- .addCommand(new Command('setup')
153
- .description('Set up MCP server for Claude Code integration')
154
- .action(async () => {
155
- await conversationCommand.handler({ action: 'setup', _: [] });
156
- }))
157
- .addCommand(new Command('search')
158
- .description('Search messages across conversations')
159
- .requiredOption('-q, --query <query>', 'Search query')
160
- .option('-c, --conversation-id <id>', 'Filter by conversation')
161
- .option('-r, --role <role>', 'Filter by role')
162
- .option('-l, --limit <number>', 'Maximum results', '10')
163
- .action(async (options) => {
164
- await conversationCommand.handler({ action: 'search', ...options, _: [] });
165
- }))
166
- .addCommand(new Command('context')
167
- .description('Get relevant context for a query')
168
- .requiredOption('-q, --query <query>', 'Context query')
169
- .option('-l, --limit <number>', 'Maximum messages', '10')
170
- .action(async (options) => {
171
- await conversationCommand.handler({ action: 'context', ...options, _: [] });
172
- }))
173
- .addCommand(new Command('thread')
174
- .description('Get full conversation thread')
175
- .requiredOption('-c, --conversation-id <id>', 'Conversation ID')
176
- .action(async (options) => {
177
- await conversationCommand.handler({ action: 'thread', ...options, _: [] });
178
- }))
179
- .addCommand(new Command('stats')
180
- .description('Show conversation statistics')
181
- .action(async () => {
182
- await conversationCommand.handler({ action: 'stats', _: [] });
183
- }));
184
146
  // ===== VFS Commands (Subcommand Group) =====
185
147
  program
186
148
  .command('vfs')
package/dist/index.d.ts CHANGED
@@ -56,6 +56,3 @@ import { BrainyMCPAdapter, MCPAugmentationToolset, BrainyMCPService } from './mc
56
56
  import { MCPRequest, MCPResponse, MCPDataAccessRequest, MCPToolExecutionRequest, MCPSystemInfoRequest, MCPAuthenticationRequest, MCPRequestType, MCPServiceOptions, MCPTool, MCP_VERSION } from './types/mcpTypes.js';
57
57
  export { BrainyMCPAdapter, MCPAugmentationToolset, BrainyMCPService, MCPRequestType, MCP_VERSION };
58
58
  export type { MCPRequest, MCPResponse, MCPDataAccessRequest, MCPToolExecutionRequest, MCPSystemInfoRequest, MCPAuthenticationRequest, MCPServiceOptions, MCPTool };
59
- export { ConversationManager, createConversationManager } from './conversation/index.js';
60
- export { MCPConversationToolset, createConversationToolset } from './mcp/conversationTools.js';
61
- export type { MessageRole, ProblemSolvingPhase, ConversationMessage, ConversationMessageMetadata, ConversationThread, ConversationThreadMetadata, ConversationContext, RankedMessage, SaveMessageOptions, ContextRetrievalOptions, ConversationSearchOptions, ConversationSearchResult, ConversationTheme, ArtifactOptions, ConversationStats, CompactionOptions, CompactionResult } from './conversation/types.js';
package/dist/index.js CHANGED
@@ -118,7 +118,4 @@ export {
118
118
  BrainyMCPAdapter, MCPAugmentationToolset, BrainyMCPService,
119
119
  // MCP types
120
120
  MCPRequestType, MCP_VERSION };
121
- // Export Conversation API (Infinite Agent Memory)
122
- export { ConversationManager, createConversationManager } from './conversation/index.js';
123
- export { MCPConversationToolset, createConversationToolset } from './mcp/conversationTools.js';
124
121
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "3.21.0",
3
+ "version": "3.23.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",
@@ -147,6 +147,7 @@
147
147
  "@typescript-eslint/eslint-plugin": "^8.0.0",
148
148
  "@typescript-eslint/parser": "^8.0.0",
149
149
  "@vitest/coverage-v8": "^3.2.4",
150
+ "jspdf": "^3.0.3",
150
151
  "minio": "^8.0.5",
151
152
  "standard-version": "^9.5.0",
152
153
  "testcontainers": "^11.5.1",
@@ -159,13 +160,17 @@
159
160
  "@huggingface/transformers": "^3.7.2",
160
161
  "boxen": "^8.0.1",
161
162
  "chalk": "^5.3.0",
163
+ "chardet": "^2.0.0",
162
164
  "cli-table3": "^0.6.5",
163
165
  "commander": "^11.1.0",
166
+ "csv-parse": "^6.1.0",
164
167
  "inquirer": "^12.9.3",
165
168
  "ora": "^8.2.0",
169
+ "pdfjs-dist": "^4.0.379",
166
170
  "prompts": "^2.4.2",
167
171
  "uuid": "^9.0.1",
168
- "ws": "^8.18.3"
172
+ "ws": "^8.18.3",
173
+ "xlsx": "^0.18.5"
169
174
  },
170
175
  "prettier": {
171
176
  "arrowParens": "always",
@@ -1,22 +0,0 @@
1
- /**
2
- * 💬 Conversation CLI Commands
3
- *
4
- * CLI interface for infinite agent memory and conversation management
5
- */
6
- interface CommandArguments {
7
- action?: string;
8
- conversationId?: string;
9
- query?: string;
10
- role?: string;
11
- limit?: number;
12
- format?: string;
13
- output?: string;
14
- _: string[];
15
- }
16
- export declare const conversationCommand: {
17
- command: string;
18
- describe: string;
19
- builder: (yargs: any) => any;
20
- handler: (argv: CommandArguments) => Promise<void>;
21
- };
22
- export default conversationCommand;