@elizaos/core 1.5.0 → 1.5.2

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 (90) hide show
  1. package/dist/browser/index.browser.js +102 -102
  2. package/dist/browser/index.browser.js.map +5 -5
  3. package/dist/browser/index.d.ts +3 -1
  4. package/dist/index.d.ts +2 -3
  5. package/dist/index.js +1 -5
  6. package/dist/node/index.d.ts +3 -1
  7. package/dist/node/index.node.js +91 -12
  8. package/dist/node/index.node.js.map +10 -10
  9. package/package.json +10 -4
  10. package/src/__tests__/action-chaining-simple.test.ts +203 -0
  11. package/src/__tests__/actions.test.ts +218 -0
  12. package/src/__tests__/buffer.test.ts +337 -0
  13. package/src/__tests__/character-validation.test.ts +309 -0
  14. package/src/__tests__/database.test.ts +750 -0
  15. package/src/__tests__/entities.test.ts +727 -0
  16. package/src/__tests__/env.test.ts +23 -0
  17. package/src/__tests__/environment.test.ts +285 -0
  18. package/src/__tests__/logger-browser-node.test.ts +716 -0
  19. package/src/__tests__/logger.test.ts +403 -0
  20. package/src/__tests__/messages.test.ts +196 -0
  21. package/src/__tests__/mockCharacter.ts +544 -0
  22. package/src/__tests__/parsing.test.ts +58 -0
  23. package/src/__tests__/prompts.test.ts +159 -0
  24. package/src/__tests__/roles.test.ts +331 -0
  25. package/src/__tests__/runtime-embedding.test.ts +343 -0
  26. package/src/__tests__/runtime.test.ts +978 -0
  27. package/src/__tests__/search.test.ts +15 -0
  28. package/src/__tests__/services-by-type.test.ts +204 -0
  29. package/src/__tests__/services.test.ts +136 -0
  30. package/src/__tests__/settings.test.ts +810 -0
  31. package/src/__tests__/utils.test.ts +1105 -0
  32. package/src/__tests__/uuid.test.ts +94 -0
  33. package/src/actions.ts +122 -0
  34. package/src/database.ts +579 -0
  35. package/src/entities.ts +406 -0
  36. package/src/index.browser.ts +48 -0
  37. package/src/index.node.ts +39 -0
  38. package/src/index.ts +50 -0
  39. package/src/logger.ts +527 -0
  40. package/src/prompts.ts +243 -0
  41. package/src/roles.ts +85 -0
  42. package/src/runtime.ts +2514 -0
  43. package/src/schemas/character.ts +149 -0
  44. package/src/search.ts +1543 -0
  45. package/src/sentry/instrument.browser.ts +65 -0
  46. package/src/sentry/instrument.node.ts +57 -0
  47. package/src/sentry/instrument.ts +82 -0
  48. package/src/services.ts +105 -0
  49. package/src/settings.ts +409 -0
  50. package/src/test_resources/constants.ts +12 -0
  51. package/src/test_resources/testSetup.ts +21 -0
  52. package/src/test_resources/types.ts +22 -0
  53. package/src/types/agent.ts +112 -0
  54. package/src/types/browser.ts +145 -0
  55. package/src/types/components.ts +184 -0
  56. package/src/types/database.ts +348 -0
  57. package/src/types/email.ts +162 -0
  58. package/src/types/environment.ts +129 -0
  59. package/src/types/events.ts +249 -0
  60. package/src/types/index.ts +29 -0
  61. package/src/types/knowledge.ts +65 -0
  62. package/src/types/lp.ts +124 -0
  63. package/src/types/memory.ts +228 -0
  64. package/src/types/message.ts +233 -0
  65. package/src/types/messaging.ts +57 -0
  66. package/src/types/model.ts +359 -0
  67. package/src/types/pdf.ts +77 -0
  68. package/src/types/plugin.ts +78 -0
  69. package/src/types/post.ts +271 -0
  70. package/src/types/primitives.ts +97 -0
  71. package/src/types/runtime.ts +190 -0
  72. package/src/types/service.ts +198 -0
  73. package/src/types/settings.ts +30 -0
  74. package/src/types/state.ts +60 -0
  75. package/src/types/task.ts +72 -0
  76. package/src/types/tee.ts +107 -0
  77. package/src/types/testing.ts +30 -0
  78. package/src/types/token.ts +96 -0
  79. package/src/types/transcription.ts +133 -0
  80. package/src/types/video.ts +108 -0
  81. package/src/types/wallet.ts +56 -0
  82. package/src/types/web-search.ts +146 -0
  83. package/src/utils/__tests__/buffer.test.ts +80 -0
  84. package/src/utils/__tests__/environment.test.ts +58 -0
  85. package/src/utils/__tests__/stringToUuid.test.ts +88 -0
  86. package/src/utils/buffer.ts +312 -0
  87. package/src/utils/environment.ts +316 -0
  88. package/src/utils/server-health.ts +117 -0
  89. package/src/utils.ts +1076 -0
  90. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -0,0 +1,145 @@
1
+ import { Service, ServiceType } from './service';
2
+
3
+ export interface BrowserNavigationOptions {
4
+ timeout?: number;
5
+ waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
6
+ viewport?: {
7
+ width: number;
8
+ height: number;
9
+ };
10
+ userAgent?: string;
11
+ headers?: Record<string, string>;
12
+ }
13
+
14
+ export interface ScreenshotOptions {
15
+ fullPage?: boolean;
16
+ clip?: {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ };
22
+ format?: 'png' | 'jpeg' | 'webp';
23
+ quality?: number;
24
+ omitBackground?: boolean;
25
+ }
26
+
27
+ export interface ElementSelector {
28
+ selector: string;
29
+ text?: string;
30
+ timeout?: number;
31
+ }
32
+
33
+ export interface ExtractedContent {
34
+ text: string;
35
+ html: string;
36
+ links: Array<{
37
+ url: string;
38
+ text: string;
39
+ }>;
40
+ images: Array<{
41
+ src: string;
42
+ alt?: string;
43
+ }>;
44
+ title?: string;
45
+ metadata?: Record<string, string>;
46
+ }
47
+
48
+ export interface ClickOptions {
49
+ timeout?: number;
50
+ force?: boolean;
51
+ waitForNavigation?: boolean;
52
+ }
53
+
54
+ export interface TypeOptions {
55
+ delay?: number;
56
+ timeout?: number;
57
+ clear?: boolean;
58
+ }
59
+
60
+ /**
61
+ * Interface for browser automation services
62
+ */
63
+ export abstract class IBrowserService extends Service {
64
+ static override readonly serviceType = ServiceType.BROWSER;
65
+
66
+ public readonly capabilityDescription = 'Web browser automation and scraping capabilities';
67
+
68
+ /**
69
+ * Navigate to a URL
70
+ * @param url - URL to navigate to
71
+ * @param options - Navigation options
72
+ * @returns Promise resolving when navigation completes
73
+ */
74
+ abstract navigate(url: string, options?: BrowserNavigationOptions): Promise<void>;
75
+
76
+ /**
77
+ * Take a screenshot of the current page
78
+ * @param options - Screenshot options
79
+ * @returns Promise resolving to screenshot buffer
80
+ */
81
+ abstract screenshot(options?: ScreenshotOptions): Promise<Buffer>;
82
+
83
+ /**
84
+ * Extract text and content from the current page
85
+ * @param selector - Optional CSS selector to extract from specific element
86
+ * @returns Promise resolving to extracted content
87
+ */
88
+ abstract extractContent(selector?: string): Promise<ExtractedContent>;
89
+
90
+ /**
91
+ * Click on an element
92
+ * @param selector - CSS selector or element selector
93
+ * @param options - Click options
94
+ * @returns Promise resolving when click completes
95
+ */
96
+ abstract click(selector: string | ElementSelector, options?: ClickOptions): Promise<void>;
97
+
98
+ /**
99
+ * Type text into an input field
100
+ * @param selector - CSS selector for input field
101
+ * @param text - Text to type
102
+ * @param options - Typing options
103
+ * @returns Promise resolving when typing completes
104
+ */
105
+ abstract type(selector: string, text: string, options?: TypeOptions): Promise<void>;
106
+
107
+ /**
108
+ * Wait for an element to appear
109
+ * @param selector - CSS selector or element selector
110
+ * @returns Promise resolving when element is found
111
+ */
112
+ abstract waitForElement(selector: string | ElementSelector): Promise<void>;
113
+
114
+ /**
115
+ * Evaluate JavaScript in the browser context
116
+ * @param script - JavaScript code to evaluate
117
+ * @param args - Arguments to pass to the script
118
+ * @returns Promise resolving to evaluation result
119
+ */
120
+ abstract evaluate<T = any>(script: string, ...args: any[]): Promise<T>;
121
+
122
+ /**
123
+ * Get the current page URL
124
+ * @returns Promise resolving to current URL
125
+ */
126
+ abstract getCurrentUrl(): Promise<string>;
127
+
128
+ /**
129
+ * Go back in browser history
130
+ * @returns Promise resolving when navigation completes
131
+ */
132
+ abstract goBack(): Promise<void>;
133
+
134
+ /**
135
+ * Go forward in browser history
136
+ * @returns Promise resolving when navigation completes
137
+ */
138
+ abstract goForward(): Promise<void>;
139
+
140
+ /**
141
+ * Refresh the current page
142
+ * @returns Promise resolving when refresh completes
143
+ */
144
+ abstract refresh(): Promise<void>;
145
+ }
@@ -0,0 +1,184 @@
1
+ import type { Memory } from './memory';
2
+ import type { Content } from './primitives';
3
+ import type { IAgentRuntime } from './runtime';
4
+ import type { State } from './state';
5
+
6
+ /**
7
+ * Example content with associated user for demonstration purposes
8
+ */
9
+ export interface ActionExample {
10
+ /** User associated with the example */
11
+ name: string;
12
+
13
+ /** Content of the example */
14
+ content: Content;
15
+ }
16
+
17
+ /**
18
+ * Callback function type for handlers
19
+ */
20
+ export type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
21
+
22
+ /**
23
+ * Handler function type for processing messages
24
+ */
25
+ export type Handler = (
26
+ runtime: IAgentRuntime,
27
+ message: Memory,
28
+ state?: State,
29
+ options?: { [key: string]: unknown },
30
+ callback?: HandlerCallback,
31
+ responses?: Memory[]
32
+ ) => Promise<ActionResult | void | undefined>;
33
+
34
+ /**
35
+ * Validator function type for actions/evaluators
36
+ */
37
+ export type Validator = (
38
+ runtime: IAgentRuntime,
39
+ message: Memory,
40
+ state?: State
41
+ ) => Promise<boolean>;
42
+
43
+ /**
44
+ * Represents an action the agent can perform
45
+ */
46
+ export interface Action {
47
+ /** Similar action descriptions */
48
+ similes?: string[];
49
+
50
+ /** Detailed description */
51
+ description: string;
52
+
53
+ /** Example usages */
54
+ examples?: ActionExample[][];
55
+
56
+ /** Handler function */
57
+ handler: Handler;
58
+
59
+ /** Action name */
60
+ name: string;
61
+
62
+ /** Validation function */
63
+ validate: Validator;
64
+ }
65
+
66
+ /**
67
+ * Example for evaluating agent behavior
68
+ */
69
+ export interface EvaluationExample {
70
+ /** Evaluation context */
71
+ prompt: string;
72
+
73
+ /** Example messages */
74
+ messages: Array<ActionExample>;
75
+
76
+ /** Expected outcome */
77
+ outcome: string;
78
+ }
79
+
80
+ /**
81
+ * Evaluator for assessing agent responses
82
+ */
83
+ export interface Evaluator {
84
+ /** Whether to always run */
85
+ alwaysRun?: boolean;
86
+
87
+ /** Detailed description */
88
+ description: string;
89
+
90
+ /** Similar evaluator descriptions */
91
+ similes?: string[];
92
+
93
+ /** Example evaluations */
94
+ examples: EvaluationExample[];
95
+
96
+ /** Handler function */
97
+ handler: Handler;
98
+
99
+ /** Evaluator name */
100
+ name: string;
101
+
102
+ /** Validation function */
103
+ validate: Validator;
104
+ }
105
+
106
+ export interface ProviderResult {
107
+ values?: {
108
+ [key: string]: any;
109
+ };
110
+ data?: {
111
+ [key: string]: any;
112
+ };
113
+ text?: string;
114
+ }
115
+
116
+ /**
117
+ * Provider for external data/services
118
+ */
119
+ export interface Provider {
120
+ /** Provider name */
121
+ name: string;
122
+
123
+ /** Description of the provider */
124
+ description?: string;
125
+
126
+ /** Whether the provider is dynamic */
127
+ dynamic?: boolean;
128
+
129
+ /** Position of the provider in the provider list, positive or negative */
130
+ position?: number;
131
+
132
+ /**
133
+ * Whether the provider is private
134
+ *
135
+ * Private providers are not displayed in the regular provider list, they have to be called explicitly
136
+ */
137
+ private?: boolean;
138
+
139
+ /** Data retrieval function */
140
+ get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
141
+ }
142
+
143
+ /**
144
+ * Result returned by an action after execution
145
+ * Used for action chaining and state management
146
+ */
147
+ export interface ActionResult {
148
+ /** Optional text description of the result */
149
+ text?: string;
150
+
151
+ /** Values to merge into the state */
152
+ values?: Record<string, any>;
153
+
154
+ /** Data payload containing action-specific results */
155
+ data?: Record<string, any>;
156
+
157
+ /** Whether the action succeeded - defaults to true */
158
+ success: boolean;
159
+
160
+ /** Error information if the action failed */
161
+ error?: string | Error;
162
+ }
163
+
164
+ /**
165
+ * Context provided to actions during execution
166
+ * Allows actions to access previous results and update state
167
+ */
168
+ export interface ActionContext {
169
+ /** Results from previously executed actions in this run */
170
+ previousResults: ActionResult[];
171
+
172
+ /** Get a specific previous result by action name */
173
+ getPreviousResult?: (actionName: string) => ActionResult | undefined;
174
+ }
175
+
176
+ /**
177
+ * Helper function to create ActionResult with proper defaults
178
+ */
179
+ export function createActionResult(partial: Partial<ActionResult> = {}): ActionResult {
180
+ return {
181
+ success: true, // Default to success
182
+ ...partial,
183
+ };
184
+ }
@@ -0,0 +1,348 @@
1
+ import type { Agent } from './agent';
2
+ import type { Component, Entity, Participant, Relationship, Room, World } from './environment';
3
+ import type { Memory, MemoryMetadata } from './memory';
4
+ import type { Metadata, UUID } from './primitives';
5
+ import type { Task } from './task';
6
+
7
+ /**
8
+ * Represents a log entry
9
+ */
10
+ export interface Log {
11
+ /** Optional unique identifier */
12
+ id?: UUID;
13
+
14
+ /** Associated entity ID */
15
+ entityId: UUID;
16
+
17
+ /** Associated room ID */
18
+ roomId?: UUID;
19
+
20
+ /** Log body */
21
+ body: { [key: string]: unknown };
22
+
23
+ /** Log type */
24
+ type: string;
25
+
26
+ /** Log creation timestamp */
27
+ createdAt: Date;
28
+ }
29
+
30
+ /**
31
+ * Interface for database operations
32
+ */
33
+ export interface IDatabaseAdapter {
34
+ /** Database instance */
35
+ db: any;
36
+
37
+ /** Initialize database connection */
38
+ initialize(config?: any): Promise<void>;
39
+
40
+ /** Initialize database connection */
41
+ init(): Promise<void>;
42
+
43
+ /** Run database migrations */
44
+ runMigrations(schema?: any, pluginName?: string): Promise<void>;
45
+
46
+ /** Check if the database connection is ready */
47
+ isReady(): Promise<boolean>;
48
+
49
+ /** Close database connection */
50
+ close(): Promise<void>;
51
+
52
+ getConnection(): Promise<any>;
53
+
54
+ getAgent(agentId: UUID): Promise<Agent | null>;
55
+
56
+ /** Get all agents */
57
+ getAgents(): Promise<Partial<Agent>[]>;
58
+
59
+ createAgent(agent: Partial<Agent>): Promise<boolean>;
60
+
61
+ updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
62
+
63
+ deleteAgent(agentId: UUID): Promise<boolean>;
64
+
65
+ ensureEmbeddingDimension(dimension: number): Promise<void>;
66
+
67
+ /** Get entity by IDs */
68
+ getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
69
+
70
+ /** Get entities for room */
71
+ getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
72
+
73
+ /** Create new entities */
74
+ createEntities(entities: Entity[]): Promise<boolean>;
75
+
76
+ /** Update entity */
77
+ updateEntity(entity: Entity): Promise<void>;
78
+
79
+ /** Get component by ID */
80
+ getComponent(
81
+ entityId: UUID,
82
+ type: string,
83
+ worldId?: UUID,
84
+ sourceEntityId?: UUID
85
+ ): Promise<Component | null>;
86
+
87
+ /** Get all components for an entity */
88
+ getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
89
+
90
+ /** Create component */
91
+ createComponent(component: Component): Promise<boolean>;
92
+
93
+ /** Update component */
94
+ updateComponent(component: Component): Promise<void>;
95
+
96
+ /** Delete component */
97
+ deleteComponent(componentId: UUID): Promise<void>;
98
+
99
+ /** Get memories matching criteria */
100
+ getMemories(params: {
101
+ entityId?: UUID;
102
+ agentId?: UUID;
103
+ count?: number;
104
+ unique?: boolean;
105
+ tableName: string;
106
+ start?: number;
107
+ end?: number;
108
+ roomId?: UUID;
109
+ worldId?: UUID;
110
+ }): Promise<Memory[]>;
111
+
112
+ getMemoryById(id: UUID): Promise<Memory | null>;
113
+
114
+ getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
115
+
116
+ getMemoriesByRoomIds(params: {
117
+ tableName: string;
118
+ roomIds: UUID[];
119
+ limit?: number;
120
+ }): Promise<Memory[]>;
121
+
122
+ getCachedEmbeddings(params: {
123
+ query_table_name: string;
124
+ query_threshold: number;
125
+ query_input: string;
126
+ query_field_name: string;
127
+ query_field_sub_name: string;
128
+ query_match_count: number;
129
+ }): Promise<{ embedding: number[]; levenshtein_score: number }[]>;
130
+
131
+ log(params: {
132
+ body: { [key: string]: unknown };
133
+ entityId: UUID;
134
+ roomId: UUID;
135
+ type: string;
136
+ }): Promise<void>;
137
+
138
+ getLogs(params: {
139
+ entityId: UUID;
140
+ roomId?: UUID;
141
+ type?: string;
142
+ count?: number;
143
+ offset?: number;
144
+ }): Promise<Log[]>;
145
+
146
+ deleteLog(logId: UUID): Promise<void>;
147
+
148
+ searchMemories(params: {
149
+ embedding: number[];
150
+ match_threshold?: number;
151
+ count?: number;
152
+ unique?: boolean;
153
+ tableName: string;
154
+ query?: string;
155
+ roomId?: UUID;
156
+ worldId?: UUID;
157
+ entityId?: UUID;
158
+ }): Promise<Memory[]>;
159
+
160
+ createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
161
+
162
+ updateMemory(memory: Partial<Memory> & { id: UUID; metadata?: MemoryMetadata }): Promise<boolean>;
163
+
164
+ deleteMemory(memoryId: UUID): Promise<void>;
165
+
166
+ deleteManyMemories(memoryIds: UUID[]): Promise<void>;
167
+
168
+ deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
169
+
170
+ countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
171
+
172
+ createWorld(world: World): Promise<UUID>;
173
+
174
+ getWorld(id: UUID): Promise<World | null>;
175
+
176
+ removeWorld(id: UUID): Promise<void>;
177
+
178
+ getAllWorlds(): Promise<World[]>;
179
+
180
+ updateWorld(world: World): Promise<void>;
181
+
182
+ getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
183
+
184
+ createRooms(rooms: Room[]): Promise<UUID[]>;
185
+
186
+ deleteRoom(roomId: UUID): Promise<void>;
187
+
188
+ deleteRoomsByWorldId(worldId: UUID): Promise<void>;
189
+
190
+ updateRoom(room: Room): Promise<void>;
191
+
192
+ getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
193
+
194
+ getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
195
+
196
+ getRoomsByWorld(worldId: UUID): Promise<Room[]>;
197
+
198
+ removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
199
+
200
+ getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
201
+
202
+ getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
203
+
204
+ addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
205
+
206
+ getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
207
+
208
+ setParticipantUserState(
209
+ roomId: UUID,
210
+ entityId: UUID,
211
+ state: 'FOLLOWED' | 'MUTED' | null
212
+ ): Promise<void>;
213
+
214
+ /**
215
+ * Creates a new relationship between two entities.
216
+ * @param params Object containing the relationship details
217
+ * @returns Promise resolving to boolean indicating success
218
+ */
219
+ createRelationship(params: {
220
+ sourceEntityId: UUID;
221
+ targetEntityId: UUID;
222
+ tags?: string[];
223
+ metadata?: Metadata;
224
+ }): Promise<boolean>;
225
+
226
+ /**
227
+ * Updates an existing relationship between two entities.
228
+ * @param relationship The relationship object with updated data
229
+ * @returns Promise resolving to void
230
+ */
231
+ updateRelationship(relationship: Relationship): Promise<void>;
232
+
233
+ /**
234
+ * Retrieves a relationship between two entities if it exists.
235
+ * @param params Object containing the entity IDs and agent ID
236
+ * @returns Promise resolving to the Relationship object or null if not found
237
+ */
238
+ getRelationship(params: {
239
+ sourceEntityId: UUID;
240
+ targetEntityId: UUID;
241
+ }): Promise<Relationship | null>;
242
+
243
+ /**
244
+ * Retrieves all relationships for a specific entity.
245
+ * @param params Object containing the user ID, agent ID and optional tags to filter by
246
+ * @returns Promise resolving to an array of Relationship objects
247
+ */
248
+ getRelationships(params: { entityId: UUID; tags?: string[] }): Promise<Relationship[]>;
249
+
250
+ getCache<T>(key: string): Promise<T | undefined>;
251
+ setCache<T>(key: string, value: T): Promise<boolean>;
252
+ deleteCache(key: string): Promise<boolean>;
253
+
254
+ // Only task instance methods - definitions are in-memory
255
+ createTask(task: Task): Promise<UUID>;
256
+ getTasks(params: { roomId?: UUID; tags?: string[]; entityId?: UUID }): Promise<Task[]>;
257
+ getTask(id: UUID): Promise<Task | null>;
258
+ getTasksByName(name: string): Promise<Task[]>;
259
+ updateTask(id: UUID, task: Partial<Task>): Promise<void>;
260
+ deleteTask(id: UUID): Promise<void>;
261
+
262
+ getMemoriesByWorldId(params: {
263
+ worldId: UUID;
264
+ count?: number;
265
+ tableName?: string;
266
+ }): Promise<Memory[]>;
267
+ }
268
+
269
+ /**
270
+ * Result interface for embedding similarity searches
271
+ */
272
+ export interface EmbeddingSearchResult {
273
+ embedding: number[];
274
+ levenshtein_score: number;
275
+ }
276
+
277
+ /**
278
+ * Options for memory retrieval operations
279
+ */
280
+ export interface MemoryRetrievalOptions {
281
+ roomId: UUID;
282
+ count?: number;
283
+ unique?: boolean;
284
+ start?: number;
285
+ end?: number;
286
+ agentId?: UUID;
287
+ }
288
+
289
+ /**
290
+ * Options for memory search operations
291
+ */
292
+ export interface MemorySearchOptions {
293
+ embedding: number[];
294
+ match_threshold?: number;
295
+ count?: number;
296
+ roomId: UUID;
297
+ agentId?: UUID;
298
+ unique?: boolean;
299
+ metadata?: Partial<MemoryMetadata>;
300
+ }
301
+
302
+ /**
303
+ * Options for multi-room memory retrieval
304
+ */
305
+ export interface MultiRoomMemoryOptions {
306
+ roomIds: UUID[];
307
+ limit?: number;
308
+ agentId?: UUID;
309
+ }
310
+
311
+ /**
312
+ * Unified options pattern for memory operations
313
+ * Provides a simpler, more consistent interface
314
+ */
315
+ export interface UnifiedMemoryOptions {
316
+ roomId: UUID;
317
+ limit?: number; // Unified naming (replacing 'count')
318
+ agentId?: UUID; // Common optional parameter
319
+ unique?: boolean; // Common flag for duplication control
320
+ start?: number; // Pagination start
321
+ end?: number; // Pagination end
322
+ }
323
+
324
+ /**
325
+ * Specialized memory search options
326
+ */
327
+ export interface UnifiedSearchOptions extends UnifiedMemoryOptions {
328
+ embedding: number[];
329
+ similarity?: number; // Clearer name than 'match_threshold'
330
+ }
331
+
332
+ /**
333
+ * Represents a generic database connection object.
334
+ * The actual type of this connection will depend on the specific database adapter implementation
335
+ * (e.g., a connection pool object for PostgreSQL, a client instance for a NoSQL database).
336
+ * This `unknown` type serves as a placeholder in the abstract `IDatabaseAdapter`.
337
+ */
338
+ export type DbConnection = unknown;
339
+
340
+ // Allowable vector dimensions
341
+ export const VECTOR_DIMS = {
342
+ SMALL: 384,
343
+ MEDIUM: 512,
344
+ LARGE: 768,
345
+ XL: 1024,
346
+ XXL: 1536,
347
+ XXXL: 3072,
348
+ } as const;