@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,231 +0,0 @@
1
- /**
2
- * Conversation Types for Infinite Agent Memory
3
- *
4
- * Production-ready type definitions for storing and retrieving
5
- * conversation history with semantic search and context management.
6
- */
7
- /**
8
- * Role of the message sender
9
- */
10
- export type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
11
- /**
12
- * Problem-solving phase for tracking agent's progress
13
- */
14
- export type ProblemSolvingPhase = 'understanding' | 'analysis' | 'planning' | 'implementation' | 'testing' | 'debugging' | 'refinement' | 'completed';
15
- /**
16
- * Metadata for a conversation message
17
- */
18
- export interface ConversationMessageMetadata {
19
- role: MessageRole;
20
- conversationId: string;
21
- sessionId?: string;
22
- timestamp: number;
23
- problemSolvingPhase?: ProblemSolvingPhase;
24
- confidence?: number;
25
- tokensUsed?: number;
26
- tokensTotal?: number;
27
- artifacts?: string[];
28
- toolsUsed?: string[];
29
- references?: string[];
30
- tags?: string[];
31
- priority?: number;
32
- archived?: boolean;
33
- [key: string]: any;
34
- }
35
- /**
36
- * A conversation message with all metadata
37
- */
38
- export interface ConversationMessage {
39
- id: string;
40
- content: string;
41
- role: MessageRole;
42
- metadata: ConversationMessageMetadata;
43
- embedding?: number[];
44
- createdAt: number;
45
- updatedAt: number;
46
- }
47
- /**
48
- * Conversation thread metadata
49
- */
50
- export interface ConversationThreadMetadata {
51
- conversationId: string;
52
- sessionId?: string;
53
- title?: string;
54
- summary?: string;
55
- startTime: number;
56
- endTime?: number;
57
- messageCount: number;
58
- totalTokens: number;
59
- participants: string[];
60
- tags?: string[];
61
- archived?: boolean;
62
- [key: string]: any;
63
- }
64
- /**
65
- * A conversation thread (collection of messages)
66
- */
67
- export interface ConversationThread {
68
- id: string;
69
- metadata: ConversationThreadMetadata;
70
- messages: ConversationMessage[];
71
- artifacts?: string[];
72
- }
73
- /**
74
- * Options for retrieving relevant context
75
- */
76
- export interface ContextRetrievalOptions {
77
- query?: string;
78
- conversationId?: string;
79
- sessionId?: string;
80
- role?: MessageRole | MessageRole[];
81
- phase?: ProblemSolvingPhase | ProblemSolvingPhase[];
82
- tags?: string[];
83
- minConfidence?: number;
84
- timeRange?: {
85
- start?: number;
86
- end?: number;
87
- };
88
- limit?: number;
89
- maxTokens?: number;
90
- relevanceThreshold?: number;
91
- weights?: {
92
- semantic?: number;
93
- temporal?: number;
94
- graph?: number;
95
- };
96
- includeArtifacts?: boolean;
97
- includeSimilarConversations?: boolean;
98
- deduplicateClusters?: boolean;
99
- }
100
- /**
101
- * Ranked context message with relevance score
102
- */
103
- export interface RankedMessage extends ConversationMessage {
104
- relevanceScore: number;
105
- semanticScore?: number;
106
- temporalScore?: number;
107
- graphScore?: number;
108
- explanation?: string;
109
- }
110
- /**
111
- * Retrieved context result
112
- */
113
- export interface ConversationContext {
114
- messages: RankedMessage[];
115
- artifacts?: Array<{
116
- path: string;
117
- id: string;
118
- content?: string;
119
- summary?: string;
120
- }>;
121
- similarConversations?: Array<{
122
- id: string;
123
- title?: string;
124
- summary?: string;
125
- relevance: number;
126
- messageCount: number;
127
- }>;
128
- totalTokens: number;
129
- metadata: {
130
- queryTime: number;
131
- messagesConsidered: number;
132
- conversationsSearched: number;
133
- };
134
- }
135
- /**
136
- * Options for saving messages
137
- */
138
- export interface SaveMessageOptions {
139
- conversationId?: string;
140
- sessionId?: string;
141
- phase?: ProblemSolvingPhase;
142
- confidence?: number;
143
- artifacts?: string[];
144
- toolsUsed?: string[];
145
- tags?: string[];
146
- linkToPrevious?: string;
147
- metadata?: Record<string, any>;
148
- }
149
- /**
150
- * Options for conversation search
151
- */
152
- export interface ConversationSearchOptions {
153
- query: string;
154
- limit?: number;
155
- role?: MessageRole | MessageRole[];
156
- conversationId?: string;
157
- sessionId?: string;
158
- timeRange?: {
159
- start?: number;
160
- end?: number;
161
- };
162
- includeMetadata?: boolean;
163
- includeContent?: boolean;
164
- }
165
- /**
166
- * Search result for conversations
167
- */
168
- export interface ConversationSearchResult {
169
- message: ConversationMessage;
170
- score: number;
171
- conversationId: string;
172
- snippet?: string;
173
- }
174
- /**
175
- * Theme discovered via clustering
176
- */
177
- export interface ConversationTheme {
178
- id: string;
179
- label: string;
180
- messages: string[];
181
- centroid: number[];
182
- coherence: number;
183
- keywords?: string[];
184
- }
185
- /**
186
- * Options for artifact storage
187
- */
188
- export interface ArtifactOptions {
189
- conversationId: string;
190
- messageId?: string;
191
- type?: 'code' | 'config' | 'data' | 'document' | 'other';
192
- language?: string;
193
- description?: string;
194
- metadata?: Record<string, any>;
195
- }
196
- /**
197
- * Statistics about conversations
198
- */
199
- export interface ConversationStats {
200
- totalConversations: number;
201
- totalMessages: number;
202
- totalTokens: number;
203
- averageMessagesPerConversation: number;
204
- averageTokensPerMessage: number;
205
- oldestMessage: number;
206
- newestMessage: number;
207
- phases: Record<ProblemSolvingPhase, number>;
208
- roles: Record<MessageRole, number>;
209
- }
210
- /**
211
- * Compaction strategy options
212
- */
213
- export interface CompactionOptions {
214
- conversationId: string;
215
- strategy?: 'cluster-based' | 'importance-based' | 'hybrid';
216
- keepRatio?: number;
217
- minImportance?: number;
218
- preservePhases?: ProblemSolvingPhase[];
219
- preserveRecent?: number;
220
- }
221
- /**
222
- * Result of compaction operation
223
- */
224
- export interface CompactionResult {
225
- originalCount: number;
226
- compactedCount: number;
227
- removedCount: number;
228
- tokensFreed: number;
229
- preservedMessageIds: string[];
230
- summaryMessageId?: string;
231
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Conversation Types for Infinite Agent Memory
3
- *
4
- * Production-ready type definitions for storing and retrieving
5
- * conversation history with semantic search and context management.
6
- */
7
- export {};
8
- //# sourceMappingURL=types.js.map
@@ -1,88 +0,0 @@
1
- /**
2
- * MCP Conversation Tools
3
- *
4
- * Exposes ConversationManager functionality through MCP for Claude Code integration.
5
- * Provides 6 tools for infinite agent memory.
6
- *
7
- * REAL IMPLEMENTATION - Uses ConversationManager which uses real Brainy APIs
8
- */
9
- import { MCPResponse, MCPToolExecutionRequest, MCPTool } from '../types/mcpTypes.js';
10
- import { Brainy } from '../brainy.js';
11
- /**
12
- * MCP Conversation Toolset
13
- *
14
- * Provides conversation and context management tools for AI agents
15
- */
16
- export declare class MCPConversationToolset {
17
- private brain;
18
- private conversationManager;
19
- private initialized;
20
- /**
21
- * Create MCP Conversation Toolset
22
- * @param brain Brainy instance
23
- */
24
- constructor(brain: Brainy);
25
- /**
26
- * Initialize the toolset
27
- */
28
- init(): Promise<void>;
29
- /**
30
- * Handle MCP tool execution request
31
- * @param request MCP tool execution request
32
- * @returns MCP response
33
- */
34
- handleRequest(request: MCPToolExecutionRequest): Promise<MCPResponse>;
35
- /**
36
- * Get available conversation tools
37
- * @returns Array of MCP tool definitions
38
- */
39
- getAvailableTools(): Promise<MCPTool[]>;
40
- /**
41
- * Handle save_message tool
42
- * REAL: Uses ConversationManager.saveMessage()
43
- */
44
- private handleSaveMessage;
45
- /**
46
- * Handle get_context tool
47
- * REAL: Uses ConversationManager.getRelevantContext()
48
- */
49
- private handleGetContext;
50
- /**
51
- * Handle search tool
52
- * REAL: Uses ConversationManager.searchMessages()
53
- */
54
- private handleSearch;
55
- /**
56
- * Handle get_thread tool
57
- * REAL: Uses ConversationManager.getConversationThread()
58
- */
59
- private handleGetThread;
60
- /**
61
- * Handle save_artifact tool
62
- * REAL: Uses ConversationManager.saveArtifact()
63
- */
64
- private handleSaveArtifact;
65
- /**
66
- * Handle find_similar tool
67
- * REAL: Uses ConversationManager.findSimilarConversations()
68
- */
69
- private handleFindSimilar;
70
- /**
71
- * Create success response
72
- */
73
- private createSuccessResponse;
74
- /**
75
- * Create error response
76
- */
77
- private createErrorResponse;
78
- /**
79
- * Generate request ID
80
- */
81
- generateRequestId(): string;
82
- }
83
- /**
84
- * Create MCP conversation toolset
85
- * @param brain Brainy instance
86
- * @returns MCPConversationToolset instance
87
- */
88
- export declare function createConversationToolset(brain: Brainy): MCPConversationToolset;