@elizaos/core 1.0.0-alpha.48 → 1.0.0-alpha.49

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 (51) hide show
  1. package/package.json +2 -2
  2. package/dist/actions/choice.d.ts +0 -13
  3. package/dist/actions/followRoom.d.ts +0 -20
  4. package/dist/actions/ignore.d.ts +0 -13
  5. package/dist/actions/muteRoom.d.ts +0 -22
  6. package/dist/actions/none.d.ts +0 -9
  7. package/dist/actions/reply.d.ts +0 -15
  8. package/dist/actions/roles.d.ts +0 -13
  9. package/dist/actions/sendMessage.d.ts +0 -14
  10. package/dist/actions/settings.d.ts +0 -21
  11. package/dist/actions/unfollowRoom.d.ts +0 -12
  12. package/dist/actions/unmuteRoom.d.ts +0 -18
  13. package/dist/actions/updateEntity.d.ts +0 -42
  14. package/dist/actions.d.ts +0 -28
  15. package/dist/bootstrap.d.ts +0 -3
  16. package/dist/database.d.ts +0 -419
  17. package/dist/entities.d.ts +0 -48
  18. package/dist/environment.d.ts +0 -403
  19. package/dist/evaluators/reflection.d.ts +0 -2
  20. package/dist/import.d.ts +0 -9
  21. package/dist/index.d.ts +0 -13
  22. package/dist/logger.d.ts +0 -3
  23. package/dist/memory.d.ts +0 -114
  24. package/dist/prompts.d.ts +0 -200
  25. package/dist/providers/actions.d.ts +0 -14
  26. package/dist/providers/anxiety.d.ts +0 -9
  27. package/dist/providers/attachments.d.ts +0 -8
  28. package/dist/providers/capabilities.d.ts +0 -13
  29. package/dist/providers/character.d.ts +0 -9
  30. package/dist/providers/choice.d.ts +0 -10
  31. package/dist/providers/entities.d.ts +0 -2
  32. package/dist/providers/evaluators.d.ts +0 -26
  33. package/dist/providers/facts.d.ts +0 -10
  34. package/dist/providers/knowledge.d.ts +0 -13
  35. package/dist/providers/providers.d.ts +0 -6
  36. package/dist/providers/recentMessages.d.ts +0 -13
  37. package/dist/providers/relationships.d.ts +0 -14
  38. package/dist/providers/roles.d.ts +0 -14
  39. package/dist/providers/settings.d.ts +0 -6
  40. package/dist/providers/shouldRespond.d.ts +0 -6
  41. package/dist/providers/time.d.ts +0 -11
  42. package/dist/roles.d.ts +0 -25
  43. package/dist/runtime.d.ts +0 -290
  44. package/dist/services/scenario.d.ts +0 -106
  45. package/dist/services/task.d.ts +0 -72
  46. package/dist/settings.d.ts +0 -13
  47. package/dist/test_resources/constants.d.ts +0 -9
  48. package/dist/test_resources/testSetup.d.ts +0 -1
  49. package/dist/test_resources/types.d.ts +0 -22
  50. package/dist/types.d.ts +0 -1294
  51. package/dist/uuid.d.ts +0 -18
@@ -1,419 +0,0 @@
1
- import type { Agent, Component, Entity, IDatabaseAdapter, Memory, Participant, Relationship, Room, Task, UUID, World } from "./types";
2
- /**
3
- * An abstract class representing a database adapter for managing various entities
4
- * like entities, memories, entities, goals, and rooms.
5
- */
6
- /**
7
- * Database adapter class to be extended by individual database adapters.
8
- *
9
- * @template DB - The type of the database instance.
10
- * @abstract
11
- * @implements {IDatabaseAdapter}
12
- */
13
- export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabaseAdapter {
14
- /**
15
- * The database instance.
16
- */
17
- db: DB;
18
- /**
19
- * Initialize the database adapter.
20
- * @returns A Promise that resolves when initialization is complete.
21
- */
22
- abstract init(): Promise<void>;
23
- /**
24
- * Optional close method for the database adapter.
25
- * @returns A Promise that resolves when closing is complete.
26
- */
27
- abstract close(): Promise<void>;
28
- /**
29
- * Retrieves an account by its ID.
30
- * @param entityId The UUID of the user account to retrieve.
31
- * @returns A Promise that resolves to the Entity object or null if not found.
32
- */
33
- abstract getEntityById(entityId: UUID): Promise<Entity | null>;
34
- abstract getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
35
- /**
36
- * Creates a new entity in the database.
37
- * @param entity The entity object to create.
38
- * @returns A Promise that resolves when the account creation is complete.
39
- */
40
- abstract createEntity(entity: Entity): Promise<boolean>;
41
- /**
42
- * Updates an existing entity in the database.
43
- * @param entity The entity object with updated properties.
44
- * @returns A Promise that resolves when the account update is complete.
45
- */
46
- abstract updateEntity(entity: Entity): Promise<void>;
47
- /**
48
- * Retrieves a single component by entity ID and type.
49
- * @param entityId The UUID of the entity the component belongs to
50
- * @param type The type identifier for the component
51
- * @param worldId Optional UUID of the world the component belongs to
52
- * @param sourceEntityId Optional UUID of the source entity
53
- * @returns Promise resolving to the Component if found, null otherwise
54
- */
55
- abstract getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
56
- /**
57
- * Retrieves all components for an entity.
58
- * @param entityId The UUID of the entity to get components for
59
- * @param worldId Optional UUID of the world to filter components by
60
- * @param sourceEntityId Optional UUID of the source entity to filter by
61
- * @returns Promise resolving to array of Component objects
62
- */
63
- abstract getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
64
- /**
65
- * Creates a new component in the database.
66
- * @param component The component object to create
67
- * @returns Promise resolving to true if creation was successful
68
- */
69
- abstract createComponent(component: Component): Promise<boolean>;
70
- /**
71
- * Updates an existing component in the database.
72
- * @param component The component object with updated properties
73
- * @returns Promise that resolves when the update is complete
74
- */
75
- abstract updateComponent(component: Component): Promise<void>;
76
- /**
77
- * Deletes a component from the database.
78
- * @param componentId The UUID of the component to delete
79
- * @returns Promise that resolves when the deletion is complete
80
- */
81
- abstract deleteComponent(componentId: UUID): Promise<void>;
82
- /**
83
- * Retrieves memories based on the specified parameters.
84
- * @param params An object containing parameters for the memory retrieval.
85
- * @returns A Promise that resolves to an array of Memory objects.
86
- */
87
- abstract getMemories(params: {
88
- roomId: UUID;
89
- count?: number;
90
- unique?: boolean;
91
- tableName: string;
92
- }): Promise<Memory[]>;
93
- abstract getMemoriesByRoomIds(params: {
94
- roomIds: UUID[];
95
- tableName: string;
96
- limit?: number;
97
- }): Promise<Memory[]>;
98
- abstract getMemoryById(id: UUID): Promise<Memory | null>;
99
- /**
100
- * Retrieves multiple memories by their IDs
101
- * @param memoryIds Array of UUIDs of the memories to retrieve
102
- * @param tableName Optional table name to filter memories by type
103
- * @returns Promise resolving to array of Memory objects
104
- */
105
- abstract getMemoriesByIds(memoryIds: UUID[], tableName?: string): Promise<Memory[]>;
106
- /**
107
- * Retrieves cached embeddings based on the specified query parameters.
108
- * @param params An object containing parameters for the embedding retrieval.
109
- * @returns A Promise that resolves to an array of objects containing embeddings and levenshtein scores.
110
- */
111
- abstract getCachedEmbeddings({ query_table_name, query_threshold, query_input, query_field_name, query_field_sub_name, query_match_count, }: {
112
- query_table_name: string;
113
- query_threshold: number;
114
- query_input: string;
115
- query_field_name: string;
116
- query_field_sub_name: string;
117
- query_match_count: number;
118
- }): Promise<{
119
- embedding: number[];
120
- levenshtein_score: number;
121
- }[]>;
122
- /**
123
- * Logs an event or action with the specified details.
124
- * @param params An object containing parameters for the log entry.
125
- * @returns A Promise that resolves when the log entry has been saved.
126
- */
127
- abstract log(params: {
128
- body: {
129
- [key: string]: unknown;
130
- };
131
- entityId: UUID;
132
- roomId: UUID;
133
- type: string;
134
- }): Promise<void>;
135
- /**
136
- * Searches for memories based on embeddings and other specified parameters.
137
- * @param params An object containing parameters for the memory search.
138
- * @returns A Promise that resolves to an array of Memory objects.
139
- */
140
- abstract searchMemories(params: {
141
- tableName: string;
142
- roomId: UUID;
143
- embedding: number[];
144
- match_threshold: number;
145
- count: number;
146
- unique: boolean;
147
- }): Promise<Memory[]>;
148
- /**
149
- * Creates a new memory in the database.
150
- * @param memory The memory object to create.
151
- * @param tableName The table where the memory should be stored.
152
- * @param unique Indicates if the memory should be unique.
153
- * @returns A Promise that resolves when the memory has been created.
154
- */
155
- abstract createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
156
- /**
157
- * Removes a specific memory from the database.
158
- * @param memoryId The UUID of the memory to remove.
159
- * @param tableName The table from which the memory should be removed.
160
- * @returns A Promise that resolves when the memory has been removed.
161
- */
162
- abstract removeMemory(memoryId: UUID, tableName: string): Promise<void>;
163
- /**
164
- * Removes all memories associated with a specific room.
165
- * @param roomId The UUID of the room whose memories should be removed.
166
- * @param tableName The table from which the memories should be removed.
167
- * @returns A Promise that resolves when all memories have been removed.
168
- */
169
- abstract removeAllMemories(roomId: UUID, tableName: string): Promise<void>;
170
- /**
171
- * Counts the number of memories in a specific room.
172
- * @param roomId The UUID of the room for which to count memories.
173
- * @param unique Specifies whether to count only unique memories.
174
- * @param tableName Optional table name to count memories from.
175
- * @returns A Promise that resolves to the number of memories.
176
- */
177
- abstract countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
178
- /**
179
- * Retrieves a world by its ID.
180
- * @param id The UUID of the world to retrieve.
181
- * @returns A Promise that resolves to the World object or null if not found.
182
- */
183
- abstract getWorld(id: UUID): Promise<World | null>;
184
- /**
185
- * Retrieves all worlds for an agent.
186
- * @returns A Promise that resolves to an array of World objects.
187
- */
188
- abstract getAllWorlds(): Promise<World[]>;
189
- /**
190
- * Creates a new world in the database.
191
- * @param world The world object to create.
192
- * @returns A Promise that resolves to the UUID of the created world.
193
- */
194
- abstract createWorld(world: World): Promise<UUID>;
195
- /**
196
- * Updates an existing world in the database.
197
- * @param world The world object with updated properties.
198
- * @returns A Promise that resolves when the world has been updated.
199
- */
200
- abstract updateWorld(world: World): Promise<void>;
201
- /**
202
- * Removes a specific world from the database.
203
- * @param id The UUID of the world to remove.
204
- * @returns A Promise that resolves when the world has been removed.
205
- */
206
- abstract removeWorld(id: UUID): Promise<void>;
207
- /**
208
- * Retrieves the room ID for a given room, if it exists.
209
- * @param roomId The UUID of the room to retrieve.
210
- * @returns A Promise that resolves to the room ID or null if not found.
211
- */
212
- abstract getRoom(roomId: UUID): Promise<Room | null>;
213
- /**
214
- * Retrieves all rooms for a given world.
215
- * @param worldId The UUID of the world to retrieve rooms for.
216
- * @returns A Promise that resolves to an array of Room objects.
217
- */
218
- abstract getRooms(worldId: UUID): Promise<Room[]>;
219
- /**
220
- * Creates a new room with an optional specified ID.
221
- * @param roomId Optional UUID to assign to the new room.
222
- * @returns A Promise that resolves to the UUID of the created room.
223
- */
224
- abstract createRoom({ id, source, type, channelId, serverId, worldId, }: Room): Promise<UUID>;
225
- /**
226
- * Updates a specific room in the database.
227
- * @param room The room object with updated properties.
228
- * @returns A Promise that resolves when the room has been updated.
229
- */
230
- abstract updateRoom(room: Room): Promise<void>;
231
- /**
232
- * Removes a specific room from the database.
233
- * @param roomId The UUID of the room to remove.
234
- * @returns A Promise that resolves when the room has been removed.
235
- */
236
- abstract deleteRoom(roomId: UUID): Promise<void>;
237
- /**
238
- * Retrieves room IDs for which a specific user is a participant.
239
- * @param entityId The UUID of the user.
240
- * @returns A Promise that resolves to an array of room IDs.
241
- */
242
- abstract getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
243
- /**
244
- * Retrieves room IDs for which specific users are participants.
245
- * @param userIds An array of UUIDs of the users.
246
- * @returns A Promise that resolves to an array of room IDs.
247
- */
248
- abstract getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
249
- /**
250
- * Adds a user as a participant to a specific room.
251
- * @param entityId The UUID of the user to add as a participant.
252
- * @param roomId The UUID of the room to which the user will be added.
253
- * @returns A Promise that resolves to a boolean indicating success or failure.
254
- */
255
- abstract addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
256
- /**
257
- * Removes a user as a participant from a specific room.
258
- * @param entityId The UUID of the user to remove as a participant.
259
- * @param roomId The UUID of the room from which the user will be removed.
260
- * @returns A Promise that resolves to a boolean indicating success or failure.
261
- */
262
- abstract removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
263
- /**
264
- * Retrieves participants associated with a specific account.
265
- * @param entityId The UUID of the account.
266
- * @returns A Promise that resolves to an array of Participant objects.
267
- */
268
- abstract getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
269
- /**
270
- * Retrieves participants for a specific room.
271
- * @param roomId The UUID of the room for which to retrieve participants.
272
- * @returns A Promise that resolves to an array of UUIDs representing the participants.
273
- */
274
- abstract getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
275
- abstract getParticipantUserState(roomId: UUID, entityId: UUID): Promise<"FOLLOWED" | "MUTED" | null>;
276
- abstract setParticipantUserState(roomId: UUID, entityId: UUID, state: "FOLLOWED" | "MUTED" | null): Promise<void>;
277
- /**
278
- * Creates a new relationship between two users.
279
- * @param params Object containing the relationship details including entity IDs, agent ID, optional tags and metadata
280
- * @returns A Promise that resolves to a boolean indicating success or failure of the creation.
281
- */
282
- abstract createRelationship(params: {
283
- sourceEntityId: UUID;
284
- targetEntityId: UUID;
285
- tags?: string[];
286
- metadata?: Record<string, unknown>;
287
- }): Promise<boolean>;
288
- /**
289
- * Retrieves a relationship between two users if it exists.
290
- * @param params Object containing the entity IDs and agent ID
291
- * @returns A Promise that resolves to the Relationship object or null if not found.
292
- */
293
- abstract getRelationship(params: {
294
- sourceEntityId: UUID;
295
- targetEntityId: UUID;
296
- }): Promise<Relationship | null>;
297
- /**
298
- * Retrieves all relationships for a specific user.
299
- * @param params Object containing the user ID, agent ID and optional tags to filter by
300
- * @returns A Promise that resolves to an array of Relationship objects.
301
- */
302
- abstract getRelationships(params: {
303
- entityId: UUID;
304
- tags?: string[];
305
- }): Promise<Relationship[]>;
306
- /**
307
- * Updates an existing relationship between two users.
308
- * @param params Object containing the relationship details to update including entity IDs, agent ID, optional tags and metadata
309
- * @returns A Promise that resolves to a boolean indicating success or failure of the update.
310
- */
311
- abstract updateRelationship(params: {
312
- sourceEntityId: UUID;
313
- targetEntityId: UUID;
314
- tags?: string[];
315
- metadata?: Record<string, unknown>;
316
- }): Promise<void>;
317
- /**
318
- * Retrieves an agent by its ID.
319
- * @param agentId The UUID of the agent to retrieve.
320
- * @returns A Promise that resolves to the Agent object or null if not found.
321
- */
322
- abstract getAgent(agentId: UUID): Promise<Agent | null>;
323
- /**
324
- * Retrieves all agents from the database.
325
- * @returns A Promise that resolves to an array of Agent objects.
326
- */
327
- abstract getAgents(): Promise<Agent[]>;
328
- /**
329
- * Creates a new agent in the database.
330
- * @param agent The agent object to create.
331
- * @returns A Promise that resolves to a boolean indicating success or failure of the creation.
332
- */
333
- abstract createAgent(agent: Partial<Agent>): Promise<boolean>;
334
- /**
335
- * Updates an existing agent in the database.
336
- * @param agentId The UUID of the agent to update.
337
- * @param agent The agent object with updated properties.
338
- * @returns A Promise that resolves to a boolean indicating success or failure of the update.
339
- */
340
- abstract updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
341
- /**
342
- * Deletes an agent from the database.
343
- * @param agentId The UUID of the agent to delete.
344
- * @returns A Promise that resolves to a boolean indicating success or failure of the deletion.
345
- */
346
- abstract deleteAgent(agentId: UUID): Promise<boolean>;
347
- /**
348
- * Ensures an agent exists in the database.
349
- * @param agent The agent object to ensure exists.
350
- * @returns A Promise that resolves when the agent has been ensured to exist.
351
- */
352
- abstract ensureAgentExists(agent: Partial<Agent>): Promise<void>;
353
- /**
354
- * Ensures an embedding dimension exists in the database.
355
- * @param dimension The dimension to ensure exists.
356
- * @returns A Promise that resolves when the embedding dimension has been ensured to exist.
357
- */
358
- abstract ensureEmbeddingDimension(dimension: number): Promise<void>;
359
- /**
360
- * Retrieves a cached value by key from the database.
361
- * @param key The key to look up in the cache
362
- * @returns Promise resolving to the cached string value
363
- */
364
- abstract getCache<T>(key: string): Promise<T | undefined>;
365
- /**
366
- * Sets a value in the cache with the given key.
367
- * @param params Object containing the cache key and value
368
- * @param key The key to store the value under
369
- * @param value The string value to cache
370
- * @returns Promise resolving to true if the cache was set successfully
371
- */
372
- abstract setCache<T>(key: string, value: T): Promise<boolean>;
373
- /**
374
- * Deletes a value from the cache by key.
375
- * @param key The key to delete from the cache
376
- * @returns Promise resolving to true if the value was successfully deleted
377
- */
378
- abstract deleteCache(key: string): Promise<boolean>;
379
- /**
380
- * Creates a new task instance in the database.
381
- * @param task The task object to create
382
- * @returns Promise resolving to the UUID of the created task
383
- */
384
- abstract createTask(task: Task): Promise<UUID>;
385
- /**
386
- * Retrieves tasks based on specified parameters.
387
- * @param params Object containing optional roomId and tags to filter tasks
388
- * @returns Promise resolving to an array of Task objects
389
- */
390
- abstract getTasks(params: {
391
- roomId?: UUID;
392
- tags?: string[];
393
- }): Promise<Task[]>;
394
- /**
395
- * Retrieves a specific task by its ID.
396
- * @param id The UUID of the task to retrieve
397
- * @returns Promise resolving to the Task object if found, null otherwise
398
- */
399
- abstract getTask(id: UUID): Promise<Task | null>;
400
- /**
401
- * Retrieves a specific task by its name.
402
- * @param name The name of the task to retrieve
403
- * @returns Promise resolving to the Task object if found, null otherwise
404
- */
405
- abstract getTasksByName(name: string): Promise<Task[]>;
406
- /**
407
- * Updates an existing task in the database.
408
- * @param id The UUID of the task to update
409
- * @param task Partial Task object containing the fields to update
410
- * @returns Promise resolving when the update is complete
411
- */
412
- abstract updateTask(id: UUID, task: Partial<Task>): Promise<void>;
413
- /**
414
- * Deletes a task from the database.
415
- * @param id The UUID of the task to delete
416
- * @returns Promise resolving when the deletion is complete
417
- */
418
- abstract deleteTask(id: UUID): Promise<void>;
419
- }
@@ -1,48 +0,0 @@
1
- import { type Entity, type IAgentRuntime, type Memory, type State, type UUID } from "./types";
2
- /**
3
- * Finds an entity by name in the given runtime environment.
4
- *
5
- * @param {IAgentRuntime} runtime - The agent runtime environment.
6
- * @param {Memory} message - The memory message containing relevant information.
7
- * @param {State} state - The current state of the system.
8
- * @returns {Promise<Entity | null>} A promise that resolves to the found entity or null if not found.
9
- */
10
- export declare function findEntityByName(runtime: IAgentRuntime, message: Memory, state: State): Promise<Entity | null>;
11
- /**
12
- * Function to create a unique UUID based on the runtime and base user ID.
13
- *
14
- * @param {RuntimeContext} runtime - The runtime context object.
15
- * @param {UUID|string} baseUserId - The base user ID to use in generating the UUID.
16
- * @returns {UUID} - The unique UUID generated based on the runtime and base user ID.
17
- */
18
- export declare const createUniqueUuid: (runtime: any, baseUserId: UUID | string) => UUID;
19
- /**
20
- * Get details for a list of entities.
21
- */
22
- /**
23
- * Retrieves entity details for a specific room from the database.
24
- *
25
- * @param {Object} params - The input parameters
26
- * @param {IAgentRuntime} params.runtime - The Agent Runtime instance
27
- * @param {UUID} params.roomId - The ID of the room to retrieve entity details for
28
- * @returns {Promise<Array>} - A promise that resolves to an array of unique entity details
29
- */
30
- export declare function getEntityDetails({ runtime, roomId, }: {
31
- runtime: IAgentRuntime;
32
- roomId: UUID;
33
- }): Promise<any[]>;
34
- /**
35
- * Format entities into a string
36
- * @param entities - list of entities
37
- * @returns string
38
- */
39
- /**
40
- * Format the given entities into a string representation.
41
- *
42
- * @param {Object} options - The options object.
43
- * @param {Entity[]} options.entities - The list of entities to format.
44
- * @returns {string} A formatted string representing the entities.
45
- */
46
- export declare function formatEntities({ entities }: {
47
- entities: Entity[];
48
- }): string;