@soulcraft/brainy 3.22.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.
@@ -1,176 +0,0 @@
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;