@soulcraft/brainy 3.17.0 → 3.19.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.
- package/CHANGELOG.md +2 -0
- package/README.md +58 -10
- package/dist/augmentations/defaultAugmentations.d.ts +0 -1
- package/dist/augmentations/defaultAugmentations.js +0 -5
- package/dist/brainy.d.ts +64 -0
- package/dist/brainy.js +77 -0
- package/dist/conversation/conversationManager.d.ts +176 -0
- package/dist/conversation/conversationManager.js +666 -0
- package/dist/conversation/index.d.ts +8 -0
- package/dist/conversation/index.js +8 -0
- package/dist/conversation/types.d.ts +231 -0
- package/dist/conversation/types.js +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp/conversationTools.d.ts +88 -0
- package/dist/mcp/conversationTools.js +470 -0
- package/dist/neural/embeddedPatterns.d.ts +1 -1
- package/dist/neural/embeddedPatterns.js +1 -1
- package/dist/neural/naturalLanguageProcessor.js +0 -1
- package/dist/setup.js +0 -1
- package/dist/types/mcpTypes.d.ts +7 -1
- package/dist/unified.js +0 -1
- package/dist/vfs/VirtualFileSystem.d.ts +6 -4
- package/dist/vfs/VirtualFileSystem.js +44 -21
- package/dist/vfs/index.d.ts +0 -5
- package/dist/vfs/index.js +0 -6
- package/dist/vfs/semantic/ProjectionRegistry.d.ts +84 -0
- package/dist/vfs/semantic/ProjectionRegistry.js +118 -0
- package/dist/vfs/semantic/ProjectionStrategy.d.ts +69 -0
- package/dist/vfs/semantic/ProjectionStrategy.js +40 -0
- package/dist/vfs/semantic/SemanticPathParser.d.ts +73 -0
- package/dist/vfs/semantic/SemanticPathParser.js +285 -0
- package/dist/vfs/semantic/SemanticPathResolver.d.ts +99 -0
- package/dist/vfs/semantic/SemanticPathResolver.js +242 -0
- package/dist/vfs/semantic/index.d.ts +17 -0
- package/dist/vfs/semantic/index.js +18 -0
- package/dist/vfs/semantic/projections/AuthorProjection.d.ts +35 -0
- package/dist/vfs/semantic/projections/AuthorProjection.js +74 -0
- package/dist/vfs/semantic/projections/ConceptProjection.d.ts +42 -0
- package/dist/vfs/semantic/projections/ConceptProjection.js +87 -0
- package/dist/vfs/semantic/projections/RelationshipProjection.d.ts +41 -0
- package/dist/vfs/semantic/projections/RelationshipProjection.js +101 -0
- package/dist/vfs/semantic/projections/SimilarityProjection.d.ts +36 -0
- package/dist/vfs/semantic/projections/SimilarityProjection.js +77 -0
- package/dist/vfs/semantic/projections/TagProjection.d.ts +34 -0
- package/dist/vfs/semantic/projections/TagProjection.js +73 -0
- package/dist/vfs/semantic/projections/TemporalProjection.d.ts +35 -0
- package/dist/vfs/semantic/projections/TemporalProjection.js +89 -0
- package/dist/vfs/types.d.ts +1 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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
|
+
## [3.19.0](https://github.com/soulcraftlabs/brainy/compare/v3.18.0...v3.19.0) (2025-09-29)
|
|
6
|
+
|
|
5
7
|
## [3.17.0](https://github.com/soulcraftlabs/brainy/compare/v3.16.0...v3.17.0) (2025-09-27)
|
|
6
8
|
|
|
7
9
|
## [3.15.0](https://github.com/soulcraftlabs/brainy/compare/v3.14.2...v3.15.0) (2025-09-26)
|
package/README.md
CHANGED
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
|
|
20
20
|
## 🎉 Key Features
|
|
21
21
|
|
|
22
|
+
### 💬 **Infinite Agent Memory** (NEW!)
|
|
23
|
+
|
|
24
|
+
- **Never Lose Context**: Conversations preserved with semantic search
|
|
25
|
+
- **Smart Context Retrieval**: Triple Intelligence finds relevant past work
|
|
26
|
+
- **Claude Code Integration**: One command (`brainy conversation setup`) enables infinite memory
|
|
27
|
+
- **Automatic Artifact Linking**: Code and files connected to conversations
|
|
28
|
+
- **Scales to Millions**: Messages indexed and searchable in <100ms
|
|
29
|
+
|
|
22
30
|
### 🧠 **Triple Intelligence™ Engine**
|
|
23
31
|
|
|
24
32
|
- **Vector Search**: HNSW-powered semantic similarity
|
|
@@ -44,6 +52,42 @@
|
|
|
44
52
|
|
|
45
53
|
```bash
|
|
46
54
|
npm install @soulcraft/brainy
|
|
55
|
+
|
|
56
|
+
# For Claude Code infinite memory (optional):
|
|
57
|
+
brainy conversation setup
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 💬 **Infinite Memory for Claude Code**
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
// One-time setup:
|
|
64
|
+
// $ brainy conversation setup
|
|
65
|
+
|
|
66
|
+
// Claude Code now automatically:
|
|
67
|
+
// - Saves every conversation with embeddings
|
|
68
|
+
// - Retrieves relevant past context
|
|
69
|
+
// - Links code artifacts to conversations
|
|
70
|
+
// - Never loses context or momentum
|
|
71
|
+
|
|
72
|
+
// Use programmatically:
|
|
73
|
+
import { Brainy } from '@soulcraft/brainy'
|
|
74
|
+
|
|
75
|
+
const brain = new Brainy()
|
|
76
|
+
await brain.init()
|
|
77
|
+
|
|
78
|
+
// Save conversations
|
|
79
|
+
await brain.conversation.saveMessage(
|
|
80
|
+
"How do I implement JWT authentication?",
|
|
81
|
+
"user",
|
|
82
|
+
{ conversationId: "conv_123" }
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
// Get relevant context (semantic + temporal + graph)
|
|
86
|
+
const context = await brain.conversation.getRelevantContext(
|
|
87
|
+
"JWT token validation",
|
|
88
|
+
{ limit: 10, includeArtifacts: true }
|
|
89
|
+
)
|
|
90
|
+
// Returns: Ranked messages, linked code, similar conversations
|
|
47
91
|
```
|
|
48
92
|
|
|
49
93
|
### 🎯 **True Zero Configuration**
|
|
@@ -762,18 +806,22 @@ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
|
762
806
|
|
|
763
807
|
## 📖 Documentation
|
|
764
808
|
|
|
809
|
+
### Infinite Agent Memory 💬
|
|
810
|
+
- [Conversation API Overview](docs/conversation/README.md) - **NEW!** Complete conversation management guide
|
|
811
|
+
- [MCP Integration for Claude Code](docs/conversation/MCP_INTEGRATION.md) - **NEW!** One-command setup
|
|
812
|
+
- [API Reference](docs/conversation/API_REFERENCE.md) - **NEW!** Full API documentation
|
|
813
|
+
|
|
765
814
|
### Framework Integration
|
|
766
|
-
- [Framework Integration Guide](docs/guides/framework-integration.md) -
|
|
767
|
-
- [Next.js Integration](docs/guides/nextjs-integration.md) -
|
|
768
|
-
- [Vue.js Integration](docs/guides/vue-integration.md) -
|
|
769
|
-
|
|
770
|
-
### Virtual Filesystem
|
|
771
|
-
- [VFS Core Documentation](docs/vfs/VFS_CORE.md) -
|
|
772
|
-
- [VFS
|
|
773
|
-
- [
|
|
815
|
+
- [Framework Integration Guide](docs/guides/framework-integration.md) - Complete framework setup guide
|
|
816
|
+
- [Next.js Integration](docs/guides/nextjs-integration.md) - React and Next.js examples
|
|
817
|
+
- [Vue.js Integration](docs/guides/vue-integration.md) - Vue and Nuxt examples
|
|
818
|
+
|
|
819
|
+
### Virtual Filesystem (Semantic VFS) 🧠📁
|
|
820
|
+
- [VFS Core Documentation](docs/vfs/VFS_CORE.md) - Complete filesystem architecture and API
|
|
821
|
+
- [Semantic VFS Guide](docs/vfs/SEMANTIC_VFS.md) - Multi-dimensional file access (6 semantic dimensions)
|
|
822
|
+
- [Neural Extraction API](docs/vfs/NEURAL_EXTRACTION.md) - AI-powered concept and entity extraction
|
|
823
|
+
- [Examples & Scenarios](docs/vfs/VFS_EXAMPLES_SCENARIOS.md) - Real-world use cases and code
|
|
774
824
|
- [VFS API Guide](docs/vfs/VFS_API_GUIDE.md) - Complete API reference
|
|
775
|
-
- [Knowledge Layer API](docs/vfs/KNOWLEDGE_LAYER_API.md) - Advanced knowledge features
|
|
776
|
-
- [Knowledge Layer Overview](docs/KNOWLEDGE_LAYER_OVERVIEW.md) - Non-technical guide
|
|
777
825
|
|
|
778
826
|
### Core Documentation
|
|
779
827
|
- [Getting Started Guide](docs/guides/getting-started.md)
|
|
@@ -25,7 +25,6 @@ export declare function createDefaultAugmentations(config?: {
|
|
|
25
25
|
metrics?: boolean | Record<string, any>;
|
|
26
26
|
monitoring?: boolean | Record<string, any>;
|
|
27
27
|
display?: boolean | Record<string, any>;
|
|
28
|
-
knowledge?: boolean | Record<string, any>;
|
|
29
28
|
}): BaseAugmentation[];
|
|
30
29
|
/**
|
|
31
30
|
* Get augmentation by name with type safety
|
|
@@ -11,7 +11,6 @@ import { CacheAugmentation } from './cacheAugmentation.js';
|
|
|
11
11
|
import { MetricsAugmentation } from './metricsAugmentation.js';
|
|
12
12
|
import { MonitoringAugmentation } from './monitoringAugmentation.js';
|
|
13
13
|
import { UniversalDisplayAugmentation } from './universalDisplayAugmentation.js';
|
|
14
|
-
import { KnowledgeAugmentation } from './KnowledgeAugmentation.js';
|
|
15
14
|
/**
|
|
16
15
|
* Create default augmentations for zero-config operation
|
|
17
16
|
* Returns an array of augmentations to be registered
|
|
@@ -45,10 +44,6 @@ export function createDefaultAugmentations(config = {}) {
|
|
|
45
44
|
const monitoringConfig = typeof config.monitoring === 'object' ? config.monitoring : {};
|
|
46
45
|
augmentations.push(new MonitoringAugmentation(monitoringConfig));
|
|
47
46
|
}
|
|
48
|
-
// Knowledge Layer augmentation for VFS intelligence
|
|
49
|
-
if (config.knowledge !== false) {
|
|
50
|
-
augmentations.push(new KnowledgeAugmentation());
|
|
51
|
-
}
|
|
52
47
|
return augmentations;
|
|
53
48
|
}
|
|
54
49
|
/**
|
package/dist/brainy.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { Vector } from './coreTypes.js';
|
|
8
8
|
import { ImprovedNeuralAPI } from './neural/improvedNeuralAPI.js';
|
|
9
9
|
import { NaturalLanguageProcessor } from './neural/naturalLanguageProcessor.js';
|
|
10
|
+
import { ExtractedEntity } from './neural/entityExtractor.js';
|
|
10
11
|
import { TripleIntelligenceSystem } from './triple/TripleIntelligenceSystem.js';
|
|
11
12
|
import { VirtualFileSystem } from './vfs/VirtualFileSystem.js';
|
|
12
13
|
import { Entity, Relation, Result, AddParams, UpdateParams, RelateParams, FindParams, SimilarParams, GetRelationsParams, AddManyParams, DeleteManyParams, RelateManyParams, BatchResult, BrainyConfig } from './types/brainy.types.js';
|
|
@@ -34,8 +35,10 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
|
|
|
34
35
|
private originalConsole?;
|
|
35
36
|
private _neural?;
|
|
36
37
|
private _nlp?;
|
|
38
|
+
private _extractor?;
|
|
37
39
|
private _tripleIntelligence?;
|
|
38
40
|
private _vfs?;
|
|
41
|
+
private _conversation?;
|
|
39
42
|
private initialized;
|
|
40
43
|
private dimensions?;
|
|
41
44
|
constructor(config?: BrainyConfig);
|
|
@@ -594,10 +597,71 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
|
|
|
594
597
|
* Natural Language Processing API
|
|
595
598
|
*/
|
|
596
599
|
nlp(): NaturalLanguageProcessor;
|
|
600
|
+
/**
|
|
601
|
+
* Entity Extraction API - Neural extraction with NounType taxonomy
|
|
602
|
+
*
|
|
603
|
+
* Extracts entities from text using:
|
|
604
|
+
* - Pattern-based candidate detection
|
|
605
|
+
* - Embedding-based type classification
|
|
606
|
+
* - Context-aware confidence scoring
|
|
607
|
+
*
|
|
608
|
+
* @param text - Text to extract entities from
|
|
609
|
+
* @param options - Extraction options
|
|
610
|
+
* @returns Array of extracted entities with types and confidence
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* const entities = await brain.extract('John Smith founded Acme Corp in New York')
|
|
614
|
+
* // [
|
|
615
|
+
* // { text: 'John Smith', type: NounType.Person, confidence: 0.95 },
|
|
616
|
+
* // { text: 'Acme Corp', type: NounType.Organization, confidence: 0.92 },
|
|
617
|
+
* // { text: 'New York', type: NounType.Location, confidence: 0.88 }
|
|
618
|
+
* // ]
|
|
619
|
+
*/
|
|
620
|
+
extract(text: string, options?: {
|
|
621
|
+
types?: NounType[];
|
|
622
|
+
confidence?: number;
|
|
623
|
+
includeVectors?: boolean;
|
|
624
|
+
neuralMatching?: boolean;
|
|
625
|
+
}): Promise<ExtractedEntity[]>;
|
|
626
|
+
/**
|
|
627
|
+
* Extract concepts from text
|
|
628
|
+
*
|
|
629
|
+
* Simplified interface for concept/topic extraction
|
|
630
|
+
* Returns only concept names as strings for easy metadata population
|
|
631
|
+
*
|
|
632
|
+
* @param text - Text to extract concepts from
|
|
633
|
+
* @param options - Extraction options
|
|
634
|
+
* @returns Array of concept names
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* const concepts = await brain.extractConcepts('Using OAuth for authentication')
|
|
638
|
+
* // ['oauth', 'authentication']
|
|
639
|
+
*/
|
|
640
|
+
extractConcepts(text: string, options?: {
|
|
641
|
+
confidence?: number;
|
|
642
|
+
limit?: number;
|
|
643
|
+
}): Promise<string[]>;
|
|
597
644
|
/**
|
|
598
645
|
* Virtual File System API - Knowledge Operating System
|
|
599
646
|
*/
|
|
600
647
|
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;
|
|
601
665
|
/**
|
|
602
666
|
* Data Management API - backup, restore, import, export
|
|
603
667
|
*/
|
package/dist/brainy.js
CHANGED
|
@@ -13,6 +13,7 @@ import { AugmentationRegistry } from './augmentations/brainyAugmentation.js';
|
|
|
13
13
|
import { createDefaultAugmentations } from './augmentations/defaultAugmentations.js';
|
|
14
14
|
import { ImprovedNeuralAPI } from './neural/improvedNeuralAPI.js';
|
|
15
15
|
import { NaturalLanguageProcessor } from './neural/naturalLanguageProcessor.js';
|
|
16
|
+
import { NeuralEntityExtractor } from './neural/entityExtractor.js';
|
|
16
17
|
import { TripleIntelligenceSystem } from './triple/TripleIntelligenceSystem.js';
|
|
17
18
|
import { VirtualFileSystem } from './vfs/VirtualFileSystem.js';
|
|
18
19
|
import { MetadataIndexManager } from './utils/metadataIndex.js';
|
|
@@ -1357,6 +1358,58 @@ export class Brainy {
|
|
|
1357
1358
|
}
|
|
1358
1359
|
return this._nlp;
|
|
1359
1360
|
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Entity Extraction API - Neural extraction with NounType taxonomy
|
|
1363
|
+
*
|
|
1364
|
+
* Extracts entities from text using:
|
|
1365
|
+
* - Pattern-based candidate detection
|
|
1366
|
+
* - Embedding-based type classification
|
|
1367
|
+
* - Context-aware confidence scoring
|
|
1368
|
+
*
|
|
1369
|
+
* @param text - Text to extract entities from
|
|
1370
|
+
* @param options - Extraction options
|
|
1371
|
+
* @returns Array of extracted entities with types and confidence
|
|
1372
|
+
*
|
|
1373
|
+
* @example
|
|
1374
|
+
* const entities = await brain.extract('John Smith founded Acme Corp in New York')
|
|
1375
|
+
* // [
|
|
1376
|
+
* // { text: 'John Smith', type: NounType.Person, confidence: 0.95 },
|
|
1377
|
+
* // { text: 'Acme Corp', type: NounType.Organization, confidence: 0.92 },
|
|
1378
|
+
* // { text: 'New York', type: NounType.Location, confidence: 0.88 }
|
|
1379
|
+
* // ]
|
|
1380
|
+
*/
|
|
1381
|
+
async extract(text, options) {
|
|
1382
|
+
if (!this._extractor) {
|
|
1383
|
+
this._extractor = new NeuralEntityExtractor(this);
|
|
1384
|
+
}
|
|
1385
|
+
return await this._extractor.extract(text, options);
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Extract concepts from text
|
|
1389
|
+
*
|
|
1390
|
+
* Simplified interface for concept/topic extraction
|
|
1391
|
+
* Returns only concept names as strings for easy metadata population
|
|
1392
|
+
*
|
|
1393
|
+
* @param text - Text to extract concepts from
|
|
1394
|
+
* @param options - Extraction options
|
|
1395
|
+
* @returns Array of concept names
|
|
1396
|
+
*
|
|
1397
|
+
* @example
|
|
1398
|
+
* const concepts = await brain.extractConcepts('Using OAuth for authentication')
|
|
1399
|
+
* // ['oauth', 'authentication']
|
|
1400
|
+
*/
|
|
1401
|
+
async extractConcepts(text, options) {
|
|
1402
|
+
const entities = await this.extract(text, {
|
|
1403
|
+
types: [NounType.Concept, NounType.Topic],
|
|
1404
|
+
confidence: options?.confidence || 0.7,
|
|
1405
|
+
neuralMatching: true
|
|
1406
|
+
});
|
|
1407
|
+
// Deduplicate and normalize
|
|
1408
|
+
const conceptSet = new Set(entities.map(e => e.text.toLowerCase()));
|
|
1409
|
+
const concepts = Array.from(conceptSet);
|
|
1410
|
+
// Apply limit if specified
|
|
1411
|
+
return options?.limit ? concepts.slice(0, options.limit) : concepts;
|
|
1412
|
+
}
|
|
1360
1413
|
/**
|
|
1361
1414
|
* Virtual File System API - Knowledge Operating System
|
|
1362
1415
|
*/
|
|
@@ -1366,6 +1419,30 @@ export class Brainy {
|
|
|
1366
1419
|
}
|
|
1367
1420
|
return this._vfs;
|
|
1368
1421
|
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Conversation Manager API - Infinite Agent Memory
|
|
1424
|
+
*
|
|
1425
|
+
* Provides conversation and context management for AI agents:
|
|
1426
|
+
* - Save and retrieve conversation messages
|
|
1427
|
+
* - Semantic search across conversation history
|
|
1428
|
+
* - Smart context retrieval with relevance ranking
|
|
1429
|
+
* - Artifact management (code, files, documents)
|
|
1430
|
+
* - Conversation themes and clustering
|
|
1431
|
+
*
|
|
1432
|
+
* @returns ConversationManager instance
|
|
1433
|
+
* @example
|
|
1434
|
+
* const conv = brain.conversation
|
|
1435
|
+
* await conv.saveMessage("How do I implement auth?", "user", { conversationId: "conv_123" })
|
|
1436
|
+
* const context = await conv.getRelevantContext("authentication implementation")
|
|
1437
|
+
*/
|
|
1438
|
+
conversation() {
|
|
1439
|
+
if (!this._conversation) {
|
|
1440
|
+
// Lazy-load ConversationManager to avoid circular dependencies
|
|
1441
|
+
const { ConversationManager } = require('./conversation/conversationManager.js');
|
|
1442
|
+
this._conversation = new ConversationManager(this);
|
|
1443
|
+
}
|
|
1444
|
+
return this._conversation;
|
|
1445
|
+
}
|
|
1369
1446
|
/**
|
|
1370
1447
|
* Data Management API - backup, restore, import, export
|
|
1371
1448
|
*/
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConversationManager - Infinite Agent Memory
|
|
3
|
+
*
|
|
4
|
+
* Production-ready conversation and context management for AI agents.
|
|
5
|
+
* Built on Brainy's existing infrastructure: Triple Intelligence, Neural API, VFS.
|
|
6
|
+
*
|
|
7
|
+
* REAL IMPLEMENTATION - No stubs, no mocks, no TODOs
|
|
8
|
+
*/
|
|
9
|
+
import { Brainy } from '../brainy.js';
|
|
10
|
+
import { MessageRole, ConversationThread, ConversationContext, SaveMessageOptions, ContextRetrievalOptions, ConversationSearchOptions, ConversationSearchResult, ConversationTheme, ArtifactOptions, ConversationStats } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* ConversationManager - High-level API for conversation operations
|
|
13
|
+
*
|
|
14
|
+
* Uses existing Brainy infrastructure:
|
|
15
|
+
* - brain.add() for messages
|
|
16
|
+
* - brain.relate() for threading
|
|
17
|
+
* - brain.find() with Triple Intelligence for context
|
|
18
|
+
* - brain.neural for clustering and similarity
|
|
19
|
+
* - brain.vfs() for artifacts
|
|
20
|
+
*/
|
|
21
|
+
export declare class ConversationManager {
|
|
22
|
+
private brain;
|
|
23
|
+
private initialized;
|
|
24
|
+
private _vfs;
|
|
25
|
+
/**
|
|
26
|
+
* Create a ConversationManager instance
|
|
27
|
+
* @param brain Brainy instance to use
|
|
28
|
+
*/
|
|
29
|
+
constructor(brain: Brainy);
|
|
30
|
+
/**
|
|
31
|
+
* Initialize the conversation manager
|
|
32
|
+
* Lazy initialization pattern - only called when first used
|
|
33
|
+
*/
|
|
34
|
+
init(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Save a message to the conversation history
|
|
37
|
+
*
|
|
38
|
+
* Uses: brain.add() with NounType.Message
|
|
39
|
+
* Real implementation - stores message with embedding
|
|
40
|
+
*
|
|
41
|
+
* @param content Message content
|
|
42
|
+
* @param role Message role (user, assistant, system, tool)
|
|
43
|
+
* @param options Save options (conversationId, metadata, etc.)
|
|
44
|
+
* @returns Message ID
|
|
45
|
+
*/
|
|
46
|
+
saveMessage(content: string, role: MessageRole, options?: SaveMessageOptions): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Link two messages in temporal sequence
|
|
49
|
+
*
|
|
50
|
+
* Uses: brain.relate() with VerbType.Precedes
|
|
51
|
+
* Real implementation - creates graph relationship
|
|
52
|
+
*
|
|
53
|
+
* @param prevMessageId ID of previous message
|
|
54
|
+
* @param nextMessageId ID of next message
|
|
55
|
+
* @returns Relationship ID
|
|
56
|
+
*/
|
|
57
|
+
linkMessages(prevMessageId: string, nextMessageId: string): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Get a full conversation thread
|
|
60
|
+
*
|
|
61
|
+
* Uses: brain.getNoun() and brain.getConnections()
|
|
62
|
+
* Real implementation - traverses graph relationships
|
|
63
|
+
*
|
|
64
|
+
* @param conversationId Conversation ID
|
|
65
|
+
* @param options Options (includeArtifacts, etc.)
|
|
66
|
+
* @returns Complete conversation thread
|
|
67
|
+
*/
|
|
68
|
+
getConversationThread(conversationId: string, options?: {
|
|
69
|
+
includeArtifacts?: boolean;
|
|
70
|
+
}): Promise<ConversationThread>;
|
|
71
|
+
/**
|
|
72
|
+
* Get relevant context for a query
|
|
73
|
+
*
|
|
74
|
+
* Uses: brain.find() with Triple Intelligence
|
|
75
|
+
* Real implementation - semantic + temporal + graph ranking
|
|
76
|
+
*
|
|
77
|
+
* @param query Query string or context options
|
|
78
|
+
* @param options Retrieval options
|
|
79
|
+
* @returns Ranked context messages with artifacts
|
|
80
|
+
*/
|
|
81
|
+
getRelevantContext(query: string | ContextRetrievalOptions, options?: ContextRetrievalOptions): Promise<ConversationContext>;
|
|
82
|
+
/**
|
|
83
|
+
* Search messages semantically
|
|
84
|
+
*
|
|
85
|
+
* Uses: brain.find() with semantic search
|
|
86
|
+
* Real implementation - vector similarity search
|
|
87
|
+
*
|
|
88
|
+
* @param options Search options
|
|
89
|
+
* @returns Search results with scores
|
|
90
|
+
*/
|
|
91
|
+
searchMessages(options: ConversationSearchOptions): Promise<ConversationSearchResult[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Find similar conversations using Neural API
|
|
94
|
+
*
|
|
95
|
+
* Uses: brain.neural.neighbors()
|
|
96
|
+
* Real implementation - semantic similarity with embeddings
|
|
97
|
+
*
|
|
98
|
+
* @param conversationId Conversation ID to find similar to
|
|
99
|
+
* @param limit Maximum number of similar conversations
|
|
100
|
+
* @param threshold Minimum similarity threshold
|
|
101
|
+
* @returns Similar conversations with relevance scores
|
|
102
|
+
*/
|
|
103
|
+
findSimilarConversations(conversationId: string, limit?: number, threshold?: number): Promise<Array<{
|
|
104
|
+
id: string;
|
|
105
|
+
relevance: number;
|
|
106
|
+
metadata?: any;
|
|
107
|
+
}>>;
|
|
108
|
+
/**
|
|
109
|
+
* Get conversation themes via clustering
|
|
110
|
+
*
|
|
111
|
+
* Uses: brain.neural.clusters()
|
|
112
|
+
* Real implementation - semantic clustering
|
|
113
|
+
*
|
|
114
|
+
* @param conversationId Conversation ID
|
|
115
|
+
* @returns Discovered themes
|
|
116
|
+
*/
|
|
117
|
+
getConversationThemes(conversationId: string): Promise<ConversationTheme[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Save an artifact (code, file, etc.) to VFS
|
|
120
|
+
*
|
|
121
|
+
* Uses: brain.vfs()
|
|
122
|
+
* Real implementation - stores in virtual filesystem
|
|
123
|
+
*
|
|
124
|
+
* @param path VFS path
|
|
125
|
+
* @param content File content
|
|
126
|
+
* @param options Artifact options
|
|
127
|
+
* @returns Artifact entity ID
|
|
128
|
+
*/
|
|
129
|
+
saveArtifact(path: string, content: string | Buffer, options: ArtifactOptions): Promise<string>;
|
|
130
|
+
/**
|
|
131
|
+
* Get conversation statistics
|
|
132
|
+
*
|
|
133
|
+
* Uses: brain.find() with aggregations
|
|
134
|
+
* Real implementation - queries and aggregates data
|
|
135
|
+
*
|
|
136
|
+
* @param conversationId Optional conversation ID to filter
|
|
137
|
+
* @returns Conversation statistics
|
|
138
|
+
*/
|
|
139
|
+
getConversationStats(conversationId?: string): Promise<ConversationStats>;
|
|
140
|
+
/**
|
|
141
|
+
* Delete a message
|
|
142
|
+
*
|
|
143
|
+
* Uses: brain.deleteNoun()
|
|
144
|
+
* Real implementation - removes from graph
|
|
145
|
+
*
|
|
146
|
+
* @param messageId Message ID to delete
|
|
147
|
+
*/
|
|
148
|
+
deleteMessage(messageId: string): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Export conversation to JSON
|
|
151
|
+
*
|
|
152
|
+
* Uses: getConversationThread()
|
|
153
|
+
* Real implementation - serializes conversation
|
|
154
|
+
*
|
|
155
|
+
* @param conversationId Conversation ID
|
|
156
|
+
* @returns JSON-serializable conversation object
|
|
157
|
+
*/
|
|
158
|
+
exportConversation(conversationId: string): Promise<any>;
|
|
159
|
+
/**
|
|
160
|
+
* Import conversation from JSON
|
|
161
|
+
*
|
|
162
|
+
* Uses: saveMessage() and linkMessages()
|
|
163
|
+
* Real implementation - recreates conversation
|
|
164
|
+
*
|
|
165
|
+
* @param data Exported conversation data
|
|
166
|
+
* @returns New conversation ID
|
|
167
|
+
*/
|
|
168
|
+
importConversation(data: any): Promise<string>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Create a ConversationManager instance
|
|
172
|
+
*
|
|
173
|
+
* @param brain Brainy instance
|
|
174
|
+
* @returns ConversationManager instance
|
|
175
|
+
*/
|
|
176
|
+
export declare function createConversationManager(brain: Brainy): ConversationManager;
|