hebbrix 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.
@@ -0,0 +1,430 @@
1
+ /**
2
+ * Type definitions for AI Memory SDK
3
+ */
4
+ interface ClientConfig {
5
+ apiKey?: string;
6
+ baseUrl?: string;
7
+ timeout?: number;
8
+ }
9
+ interface AuthResponse {
10
+ access_token: string;
11
+ token_type: string;
12
+ user_id: string;
13
+ }
14
+ interface User {
15
+ id: string;
16
+ email: string;
17
+ full_name: string;
18
+ is_active: boolean;
19
+ is_verified: boolean;
20
+ tier: 'free' | 'starter' | 'pro' | 'enterprise';
21
+ }
22
+ interface Collection {
23
+ id: string;
24
+ name: string;
25
+ description?: string;
26
+ is_active: boolean;
27
+ memory_count: number;
28
+ metadata: Record<string, any>;
29
+ created_at: string;
30
+ updated_at: string;
31
+ }
32
+ interface Memory {
33
+ id: string;
34
+ collection_id: string;
35
+ content: string;
36
+ importance: number;
37
+ source_type: string;
38
+ source_reference?: string;
39
+ access_count: number;
40
+ last_accessed_at?: string;
41
+ created_at: string;
42
+ updated_at: string;
43
+ }
44
+ interface MemoryWithMetadata extends Memory {
45
+ metadata: Record<string, any>;
46
+ }
47
+ interface SearchResult {
48
+ memory_id: string;
49
+ content: string;
50
+ score: number;
51
+ metadata: Record<string, any>;
52
+ created_at: string;
53
+ }
54
+ interface SearchResponse {
55
+ query: string;
56
+ results: SearchResult[];
57
+ total: number;
58
+ search_type: string;
59
+ processing_time_ms: number;
60
+ }
61
+ interface ReasoningSource {
62
+ memory_id: string;
63
+ content: string;
64
+ score: number;
65
+ }
66
+ interface ReasoningResponse {
67
+ answer: string;
68
+ sources: ReasoningSource[];
69
+ metadata: Record<string, any>;
70
+ reasoning_context?: Record<string, any>;
71
+ }
72
+ interface CreateCollectionParams {
73
+ name: string;
74
+ description?: string;
75
+ metadata?: Record<string, any>;
76
+ }
77
+ interface UpdateCollectionParams {
78
+ name?: string;
79
+ description?: string;
80
+ metadata?: Record<string, any>;
81
+ }
82
+ interface CreateMemoryParams {
83
+ collection_id: string;
84
+ content: string;
85
+ importance?: number;
86
+ source_type?: string;
87
+ source_reference?: string;
88
+ metadata?: Record<string, any>;
89
+ }
90
+ interface UpdateMemoryParams {
91
+ content?: string;
92
+ importance?: number;
93
+ metadata?: Record<string, any>;
94
+ }
95
+ interface SearchParams {
96
+ query: string;
97
+ collection_id?: string;
98
+ limit?: number;
99
+ search_type?: 'hybrid' | 'vector' | 'bm25' | 'graph';
100
+ filters?: Record<string, any>;
101
+ }
102
+ interface ReasonParams {
103
+ query: string;
104
+ collection_id?: string;
105
+ provider?: 'gemini' | 'openai' | 'anthropic';
106
+ include_steps?: boolean;
107
+ }
108
+ interface ListParams {
109
+ skip?: number;
110
+ limit?: number;
111
+ }
112
+ interface APIKeyResponse {
113
+ id: string;
114
+ name: string;
115
+ key: string;
116
+ prefix: string;
117
+ created_at: string;
118
+ }
119
+
120
+ /**
121
+ * API Resource classes
122
+ */
123
+
124
+ declare class BaseResource {
125
+ protected client: MemoryClient;
126
+ constructor(client: MemoryClient);
127
+ }
128
+ declare class AuthResource extends BaseResource {
129
+ /**
130
+ * Register a new user
131
+ */
132
+ register(email: string, password: string, fullName: string): Promise<AuthResponse>;
133
+ /**
134
+ * Login with email and password
135
+ */
136
+ login(email: string, password: string): Promise<AuthResponse>;
137
+ /**
138
+ * Create a new API key
139
+ */
140
+ createApiKey(name: string): Promise<APIKeyResponse>;
141
+ /**
142
+ * Get current user information
143
+ */
144
+ getMe(): Promise<User>;
145
+ }
146
+ declare class CollectionsResource extends BaseResource {
147
+ /**
148
+ * Create a new collection
149
+ */
150
+ create(params: CreateCollectionParams): Promise<Collection>;
151
+ /**
152
+ * List all collections
153
+ */
154
+ list(params?: ListParams): Promise<Collection[]>;
155
+ /**
156
+ * Get a specific collection
157
+ */
158
+ get(collectionId: string): Promise<Collection>;
159
+ /**
160
+ * Update a collection
161
+ */
162
+ update(collectionId: string, params: UpdateCollectionParams): Promise<Collection>;
163
+ /**
164
+ * Delete a collection
165
+ */
166
+ delete(collectionId: string): Promise<void>;
167
+ }
168
+ declare class MemoriesResource extends BaseResource {
169
+ /**
170
+ * Create a new memory
171
+ */
172
+ create(params: CreateMemoryParams): Promise<Memory>;
173
+ /**
174
+ * List memories
175
+ */
176
+ list(params?: ListParams & {
177
+ collection_id?: string;
178
+ }): Promise<Memory[]>;
179
+ /**
180
+ * Get a specific memory
181
+ */
182
+ get(memoryId: string): Promise<MemoryWithMetadata>;
183
+ /**
184
+ * Update a memory
185
+ */
186
+ update(memoryId: string, params: UpdateMemoryParams): Promise<Memory>;
187
+ /**
188
+ * Delete a memory
189
+ */
190
+ delete(memoryId: string): Promise<void>;
191
+ }
192
+ declare class SearchResource extends BaseResource {
193
+ /**
194
+ * Search memories
195
+ */
196
+ search(params: SearchParams): Promise<SearchResult[]>;
197
+ /**
198
+ * Find similar memories
199
+ */
200
+ similar(memoryId: string, limit?: number): Promise<SearchResult[]>;
201
+ /**
202
+ * Perform reasoning over memories
203
+ */
204
+ reason(params: ReasonParams): Promise<ReasoningResponse>;
205
+ }
206
+ declare class RLResource extends BaseResource {
207
+ /**
208
+ * Train the Memory Manager agent using RL
209
+ */
210
+ trainMemoryManager(params: {
211
+ collection_id?: string;
212
+ num_episodes?: number;
213
+ [key: string]: any;
214
+ }): Promise<any>;
215
+ /**
216
+ * Train the Answer Agent using RL
217
+ */
218
+ trainAnswerAgent(params: {
219
+ collection_id?: string;
220
+ num_episodes?: number;
221
+ [key: string]: any;
222
+ }): Promise<any>;
223
+ /**
224
+ * Get RL training metrics
225
+ */
226
+ getMetrics(): Promise<any>;
227
+ /**
228
+ * Evaluate a trained RL agent
229
+ */
230
+ evaluate(agentType: string, collectionId?: string): Promise<any>;
231
+ }
232
+ declare class ProceduralResource extends BaseResource {
233
+ /**
234
+ * Create a new procedure
235
+ */
236
+ create(params: {
237
+ name: string;
238
+ description: string;
239
+ trigger_condition: string;
240
+ action_sequence: string[];
241
+ collection_id?: string;
242
+ category?: string;
243
+ metadata?: Record<string, any>;
244
+ }): Promise<any>;
245
+ /**
246
+ * List procedures
247
+ */
248
+ list(params?: {
249
+ collection_id?: string;
250
+ category?: string;
251
+ skip?: number;
252
+ limit?: number;
253
+ }): Promise<any[]>;
254
+ /**
255
+ * Get a specific procedure
256
+ */
257
+ get(procedureId: string): Promise<any>;
258
+ /**
259
+ * Execute a procedure
260
+ */
261
+ execute(procedureId: string, context?: Record<string, any>): Promise<any>;
262
+ /**
263
+ * Update a procedure
264
+ */
265
+ update(procedureId: string, params: {
266
+ name?: string;
267
+ description?: string;
268
+ trigger_condition?: string;
269
+ action_sequence?: string[];
270
+ metadata?: Record<string, any>;
271
+ }): Promise<any>;
272
+ /**
273
+ * Delete a procedure
274
+ */
275
+ delete(procedureId: string): Promise<void>;
276
+ }
277
+ declare class TemporalResource extends BaseResource {
278
+ /**
279
+ * Add a temporal fact to the knowledge graph
280
+ */
281
+ addFact(params: {
282
+ subject: string;
283
+ predicate: string;
284
+ object: string;
285
+ valid_from?: string;
286
+ valid_until?: string;
287
+ confidence?: number;
288
+ source_memory_id?: string;
289
+ metadata?: Record<string, any>;
290
+ }): Promise<any>;
291
+ /**
292
+ * Query temporal facts
293
+ */
294
+ queryFacts(params?: {
295
+ subject?: string;
296
+ predicate?: string;
297
+ object?: string;
298
+ at_time?: string;
299
+ }): Promise<any[]>;
300
+ /**
301
+ * Query knowledge state at a specific point in time
302
+ */
303
+ pointInTime(timestamp: string, entity?: string): Promise<any>;
304
+ }
305
+ declare class WorkingMemoryResource extends BaseResource {
306
+ /**
307
+ * Add item to working memory buffer
308
+ */
309
+ add(params: {
310
+ role: string;
311
+ content: string;
312
+ metadata?: Record<string, any>;
313
+ }): Promise<any>;
314
+ /**
315
+ * Get current working memory context
316
+ */
317
+ getContext(): Promise<any>;
318
+ /**
319
+ * Compress working memory buffer
320
+ */
321
+ compress(): Promise<any>;
322
+ /**
323
+ * Clear working memory buffer
324
+ */
325
+ clear(): Promise<any>;
326
+ }
327
+ declare class ConsolidationResource extends BaseResource {
328
+ /**
329
+ * Trigger memory consolidation
330
+ */
331
+ consolidate(collectionId: string, threshold?: number): Promise<any>;
332
+ /**
333
+ * Get consolidation statistics
334
+ */
335
+ getStats(collectionId: string): Promise<any>;
336
+ /**
337
+ * Archive old memories
338
+ */
339
+ archive(collectionId: string, beforeDate?: string): Promise<any>;
340
+ }
341
+ declare class MemoryToolsResource extends BaseResource {
342
+ /**
343
+ * Replace memory content
344
+ */
345
+ replace(params: {
346
+ memory_id: string;
347
+ new_content: string;
348
+ reason?: string;
349
+ }): Promise<any>;
350
+ /**
351
+ * Insert new memory at position
352
+ */
353
+ insert(params: {
354
+ collection_id: string;
355
+ content: string;
356
+ position: number;
357
+ reason?: string;
358
+ }): Promise<any>;
359
+ /**
360
+ * Re-evaluate memory in light of new information
361
+ */
362
+ rethink(memoryId: string, query: string): Promise<any>;
363
+ }
364
+ declare class WorldModelResource extends BaseResource {
365
+ /**
366
+ * Simulate retrieval without actually retrieving
367
+ */
368
+ imagineRetrieval(query: string, collectionId?: string): Promise<any>;
369
+ /**
370
+ * Plan memory operations to achieve goal
371
+ */
372
+ plan(goal: string, collectionId?: string): Promise<any>;
373
+ }
374
+
375
+ /**
376
+ * Main Hebbrix client
377
+ */
378
+
379
+ declare class MemoryClient {
380
+ private apiKey?;
381
+ private baseUrl;
382
+ private timeout;
383
+ auth: AuthResource;
384
+ collections: CollectionsResource;
385
+ memories: MemoriesResource;
386
+ private searchResource;
387
+ rl: RLResource;
388
+ procedural: ProceduralResource;
389
+ temporal: TemporalResource;
390
+ workingMemory: WorkingMemoryResource;
391
+ consolidation: ConsolidationResource;
392
+ memoryTools: MemoryToolsResource;
393
+ worldModel: WorldModelResource;
394
+ constructor(config?: ClientConfig);
395
+ private getHeaders;
396
+ private handleError;
397
+ request<T = any>(method: string, path: string, options?: RequestInit): Promise<T>;
398
+ get<T = any>(path: string, params?: Record<string, any>): Promise<T>;
399
+ post<T = any>(path: string, body?: any): Promise<T>;
400
+ patch<T = any>(path: string, body?: any): Promise<T>;
401
+ delete<T = any>(path: string): Promise<T>;
402
+ search(params: SearchParams): Promise<SearchResult[]>;
403
+ reason(params: ReasonParams): Promise<ReasoningResponse>;
404
+ }
405
+
406
+ /**
407
+ * Error classes for AI Memory SDK
408
+ */
409
+ declare class HebbrixError extends Error {
410
+ statusCode?: number;
411
+ constructor(message: string, statusCode?: number);
412
+ }
413
+ declare class AuthenticationError extends HebbrixError {
414
+ constructor(message?: string);
415
+ }
416
+ declare class ValidationError extends HebbrixError {
417
+ errors?: any[];
418
+ constructor(message: string, errors?: any[]);
419
+ }
420
+ declare class NotFoundError extends HebbrixError {
421
+ constructor(message?: string);
422
+ }
423
+ declare class RateLimitError extends HebbrixError {
424
+ constructor(message?: string);
425
+ }
426
+ declare class ServerError extends HebbrixError {
427
+ constructor(message?: string);
428
+ }
429
+
430
+ export { type APIKeyResponse, AuthResource, type AuthResponse, AuthenticationError, type ClientConfig, type Collection, CollectionsResource, ConsolidationResource, type CreateCollectionParams, type CreateMemoryParams, HebbrixError, type ListParams, MemoriesResource, type Memory, MemoryClient, MemoryToolsResource, type MemoryWithMetadata, NotFoundError, ProceduralResource, RLResource, RateLimitError, type ReasonParams, type ReasoningResponse, type ReasoningSource, type SearchParams, SearchResource, type SearchResponse, type SearchResult, ServerError, TemporalResource, type UpdateCollectionParams, type UpdateMemoryParams, type User, ValidationError, WorkingMemoryResource, WorldModelResource };