@elizaos/core 1.0.0-beta.67 → 1.0.0-beta.69

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.
@@ -34,17 +34,17 @@ export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabase
34
34
  abstract getConnection(): Promise<PGlite | PgPool>;
35
35
  /**
36
36
  * Retrieves an account by its ID.
37
- * @param entityId The UUID of the user account to retrieve.
37
+ * @param entityIds The UUIDs of the user account to retrieve.
38
38
  * @returns A Promise that resolves to the Entity object or null if not found.
39
39
  */
40
- abstract getEntityById(entityId: UUID): Promise<Entity | null>;
40
+ abstract getEntityByIds(entityIds: UUID[]): Promise<Entity[] | null>;
41
41
  abstract getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
42
42
  /**
43
- * Creates a new entity in the database.
44
- * @param entity The entity object to create.
43
+ * Creates a new entities in the database.
44
+ * @param entities The entity objects to create.
45
45
  * @returns A Promise that resolves when the account creation is complete.
46
46
  */
47
- abstract createEntity(entity: Entity): Promise<boolean>;
47
+ abstract createEntities(entities: Entity[]): Promise<boolean>;
48
48
  /**
49
49
  * Updates an existing entity in the database.
50
50
  * @param entity The entity object with updated properties.
@@ -115,6 +115,20 @@ export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabase
115
115
  * @returns Promise resolving to array of Memory objects
116
116
  */
117
117
  abstract getMemoriesByIds(memoryIds: UUID[], tableName?: string): Promise<Memory[]>;
118
+ /**
119
+ * Retrieves group chat memories from all rooms under a given server.
120
+ * It fetches all room IDs associated with the `serverId`, then retrieves memories
121
+ * from those rooms in descending order (latest to oldest), with an optional count limit.
122
+ *
123
+ * @param params - An object containing:
124
+ * - serverId: The server ID to fetch memories for.
125
+ * - count: (Optional) The maximum number of memories to retrieve.
126
+ * @returns A promise that resolves to an array of Memory objects.
127
+ */
128
+ abstract getMemoriesByServerId(params: {
129
+ serverId: UUID;
130
+ count?: number;
131
+ }): Promise<Memory[]>;
118
132
  /**
119
133
  * Retrieves cached embeddings based on the specified query parameters.
120
134
  * @param params An object containing parameters for the embedding retrieval.
@@ -250,19 +264,19 @@ export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabase
250
264
  * @param roomId The UUID of the room to retrieve.
251
265
  * @returns A Promise that resolves to the room ID or null if not found.
252
266
  */
253
- abstract getRoom(roomId: UUID): Promise<Room | null>;
267
+ abstract getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
254
268
  /**
255
269
  * Retrieves all rooms for a given world.
256
270
  * @param worldId The UUID of the world to retrieve rooms for.
257
271
  * @returns A Promise that resolves to an array of Room objects.
258
272
  */
259
- abstract getRooms(worldId: UUID): Promise<Room[]>;
273
+ abstract getRoomsByWorld(worldId: UUID): Promise<Room[]>;
260
274
  /**
261
- * Creates a new room with an optional specified ID.
275
+ * Creates a new rooms with an optional specified ID.
262
276
  * @param roomId Optional UUID to assign to the new room.
263
- * @returns A Promise that resolves to the UUID of the created room.
277
+ * @returns A Promise that resolves to the UUID of the created rooms.
264
278
  */
265
- abstract createRoom({ id, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
279
+ abstract createRooms(rooms: Room[]): Promise<UUID[]>;
266
280
  /**
267
281
  * Updates a specific room in the database.
268
282
  * @param room The room object with updated properties.
@@ -275,12 +289,6 @@ export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabase
275
289
  * @returns A Promise that resolves when the room has been removed.
276
290
  */
277
291
  abstract deleteRoom(roomId: UUID): Promise<void>;
278
- /**
279
- * Deletes all rooms associated with a specific server ID.
280
- * @param serverId The ID of the server whose rooms should be deleted.
281
- * @returns A Promise that resolves when all rooms have been deleted.
282
- */
283
- abstract deleteRoomsByServerId(serverId: UUID): Promise<void>;
284
292
  /**
285
293
  * Retrieves room IDs for which a specific user is a participant.
286
294
  * @param entityId The UUID of the user.
@@ -294,12 +302,12 @@ export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabase
294
302
  */
295
303
  abstract getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
296
304
  /**
297
- * Adds a user as a participant to a specific room.
298
- * @param entityId The UUID of the user to add as a participant.
305
+ * Adds users as a participant to a specific room.
306
+ * @param entityIds The UUIDs of the users to add as a participant.
299
307
  * @param roomId The UUID of the room to which the user will be added.
300
308
  * @returns A Promise that resolves to a boolean indicating success or failure.
301
309
  */
302
- abstract addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
310
+ abstract addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
303
311
  /**
304
312
  * Removes a user as a participant from a specific room.
305
313
  * @param entityId The UUID of the user to remove as a participant.
@@ -464,4 +472,10 @@ export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabase
464
472
  * @returns Promise resolving when the deletion is complete
465
473
  */
466
474
  abstract deleteTask(id: UUID): Promise<void>;
475
+ abstract getMemoriesByWorldId(params: {
476
+ worldId: UUID;
477
+ count?: number;
478
+ tableName?: string;
479
+ }): Promise<Memory[]>;
480
+ abstract deleteRoomsByWorldId(worldId: UUID): Promise<void>;
467
481
  }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './runtime';
9
9
  export * from './search';
10
10
  export * from './settings';
11
11
  export * from './utils';
12
+ export * from './services';
12
13
  export * from './instrumentation/types';
13
14
  export * from './instrumentation/service';
14
15
  export * from './sentry/instrument';