@elizaos/core 1.0.1 → 1.0.3
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.
- package/dist/chunk-HRFT5KDK.js +11757 -0
- package/dist/index-Cy9ZgQIe.d.ts +1678 -0
- package/dist/index-DVKkCFlY.d.ts +3118 -0
- package/dist/index.d.ts +1161 -14
- package/dist/index.js +91 -9918
- package/dist/specs/v1/index.d.ts +5 -0
- package/dist/specs/v1/index.js +70 -0
- package/dist/specs/v2/index.d.ts +4 -0
- package/dist/specs/v2/index.js +163 -0
- package/dist/{types.d.ts → types-DzoA9aTJ.d.ts} +177 -195
- package/package.json +15 -3
- package/dist/actions.d.ts +0 -22
- package/dist/database.d.ts +0 -461
- package/dist/entities.d.ts +0 -48
- package/dist/instrumentation/index.d.ts +0 -2
- package/dist/instrumentation/service.d.ts +0 -21
- package/dist/instrumentation/types.d.ts +0 -16
- package/dist/logger.d.ts +0 -5
- package/dist/prompts.d.ts +0 -5
- package/dist/roles.d.ts +0 -29
- package/dist/runtime.d.ts +0 -283
- package/dist/search.d.ts +0 -316
- package/dist/sentry/instrument.d.ts +0 -2
- package/dist/services.d.ts +0 -48
- package/dist/settings.d.ts +0 -91
- package/dist/test_resources/constants.d.ts +0 -9
- package/dist/test_resources/testSetup.d.ts +0 -1
- package/dist/test_resources/types.d.ts +0 -22
- package/dist/utils.d.ts +0 -192
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,13 +13,25 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"default": "./dist/index.js"
|
|
15
15
|
}
|
|
16
|
+
},
|
|
17
|
+
"./v1": {
|
|
18
|
+
"import": {
|
|
19
|
+
"types": "./dist/specs/v1/index.d.ts",
|
|
20
|
+
"default": "./dist/specs/v1/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"./v2": {
|
|
24
|
+
"import": {
|
|
25
|
+
"types": "./dist/specs/v2/index.d.ts",
|
|
26
|
+
"default": "./dist/specs/v2/index.js"
|
|
27
|
+
}
|
|
16
28
|
}
|
|
17
29
|
},
|
|
18
30
|
"files": [
|
|
19
31
|
"dist"
|
|
20
32
|
],
|
|
21
33
|
"scripts": {
|
|
22
|
-
"build": "tsup
|
|
34
|
+
"build": "tsup",
|
|
23
35
|
"watch": "tsc --watch",
|
|
24
36
|
"clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
|
|
25
37
|
"dev": "tsup --watch",
|
|
@@ -88,5 +100,5 @@
|
|
|
88
100
|
"publishConfig": {
|
|
89
101
|
"access": "public"
|
|
90
102
|
},
|
|
91
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "f22f2e8e548aa92d01489864d573b633725b1182"
|
|
92
104
|
}
|
package/dist/actions.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Action } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Composes a set of example conversations based on provided actions and a specified count.
|
|
4
|
-
* It randomly selects examples from the provided actions and formats them with generated names.
|
|
5
|
-
*
|
|
6
|
-
* @param actionsData - An array of `Action` objects from which to draw examples.
|
|
7
|
-
* @param count - The number of examples to generate.
|
|
8
|
-
* @returns A string containing formatted examples of conversations.
|
|
9
|
-
*/
|
|
10
|
-
export declare const composeActionExamples: (actionsData: Action[], count: number) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Formats the names of the provided actions into a comma-separated string.
|
|
13
|
-
* @param actions - An array of `Action` objects from which to extract names.
|
|
14
|
-
* @returns A comma-separated string of action names.
|
|
15
|
-
*/
|
|
16
|
-
export declare function formatActionNames(actions: Action[]): string;
|
|
17
|
-
/**
|
|
18
|
-
* Formats the provided actions into a detailed string listing each action's name and description.
|
|
19
|
-
* @param actions - An array of `Action` objects to format.
|
|
20
|
-
* @returns A detailed string of actions, including names and descriptions.
|
|
21
|
-
*/
|
|
22
|
-
export declare function formatActions(actions: Action[]): string;
|
package/dist/database.d.ts
DELETED
|
@@ -1,461 +0,0 @@
|
|
|
1
|
-
import type { Agent, Component, Entity, IDatabaseAdapter, Log, Memory, MemoryMetadata, Participant, Relationship, Room, Task, UUID, World } from './types';
|
|
2
|
-
import { type Pool as PgPool } from 'pg';
|
|
3
|
-
import { PGlite } from '@electric-sql/pglite';
|
|
4
|
-
/**
|
|
5
|
-
* An abstract class representing a database adapter for managing various entities
|
|
6
|
-
* like entities, memories, entities, goals, and rooms.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Database adapter class to be extended by individual database adapters.
|
|
10
|
-
*
|
|
11
|
-
* @template DB - The type of the database instance.
|
|
12
|
-
* @abstract
|
|
13
|
-
* implements IDatabaseAdapter
|
|
14
|
-
*/
|
|
15
|
-
export declare abstract class DatabaseAdapter<DB = unknown> implements IDatabaseAdapter {
|
|
16
|
-
/**
|
|
17
|
-
* The database instance.
|
|
18
|
-
*/
|
|
19
|
-
db: DB;
|
|
20
|
-
/**
|
|
21
|
-
* Initialize the database adapter.
|
|
22
|
-
* @returns A Promise that resolves when initialization is complete.
|
|
23
|
-
*/
|
|
24
|
-
abstract init(): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Optional close method for the database adapter.
|
|
27
|
-
* @returns A Promise that resolves when closing is complete.
|
|
28
|
-
*/
|
|
29
|
-
abstract close(): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Retrieves a connection to the database.
|
|
32
|
-
* @returns A Promise that resolves to the database connection.
|
|
33
|
-
*/
|
|
34
|
-
abstract getConnection(): Promise<PGlite | PgPool>;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves an account by its ID.
|
|
37
|
-
* @param entityIds The UUIDs of the user account to retrieve.
|
|
38
|
-
* @returns A Promise that resolves to the Entity object or null if not found.
|
|
39
|
-
*/
|
|
40
|
-
abstract getEntityByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
41
|
-
abstract getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
42
|
-
/**
|
|
43
|
-
* Creates a new entities in the database.
|
|
44
|
-
* @param entities The entity objects to create.
|
|
45
|
-
* @returns A Promise that resolves when the account creation is complete.
|
|
46
|
-
*/
|
|
47
|
-
abstract createEntities(entities: Entity[]): Promise<boolean>;
|
|
48
|
-
/**
|
|
49
|
-
* Updates an existing entity in the database.
|
|
50
|
-
* @param entity The entity object with updated properties.
|
|
51
|
-
* @returns A Promise that resolves when the account update is complete.
|
|
52
|
-
*/
|
|
53
|
-
abstract updateEntity(entity: Entity): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Retrieves a single component by entity ID and type.
|
|
56
|
-
* @param entityId The UUID of the entity the component belongs to
|
|
57
|
-
* @param type The type identifier for the component
|
|
58
|
-
* @param worldId Optional UUID of the world the component belongs to
|
|
59
|
-
* @param sourceEntityId Optional UUID of the source entity
|
|
60
|
-
* @returns Promise resolving to the Component if found, null otherwise
|
|
61
|
-
*/
|
|
62
|
-
abstract getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves all components for an entity.
|
|
65
|
-
* @param entityId The UUID of the entity to get components for
|
|
66
|
-
* @param worldId Optional UUID of the world to filter components by
|
|
67
|
-
* @param sourceEntityId Optional UUID of the source entity to filter by
|
|
68
|
-
* @returns Promise resolving to array of Component objects
|
|
69
|
-
*/
|
|
70
|
-
abstract getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Creates a new component in the database.
|
|
73
|
-
* @param component The component object to create
|
|
74
|
-
* @returns Promise resolving to true if creation was successful
|
|
75
|
-
*/
|
|
76
|
-
abstract createComponent(component: Component): Promise<boolean>;
|
|
77
|
-
/**
|
|
78
|
-
* Updates an existing component in the database.
|
|
79
|
-
* @param component The component object with updated properties
|
|
80
|
-
* @returns Promise that resolves when the update is complete
|
|
81
|
-
*/
|
|
82
|
-
abstract updateComponent(component: Component): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* Deletes a component from the database.
|
|
85
|
-
* @param componentId The UUID of the component to delete
|
|
86
|
-
* @returns Promise that resolves when the deletion is complete
|
|
87
|
-
*/
|
|
88
|
-
abstract deleteComponent(componentId: UUID): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* Retrieves memories based on the specified parameters.
|
|
91
|
-
* @param params An object containing parameters for the memory retrieval.
|
|
92
|
-
* @returns A Promise that resolves to an array of Memory objects.
|
|
93
|
-
*/
|
|
94
|
-
abstract getMemories(params: {
|
|
95
|
-
entityId?: UUID;
|
|
96
|
-
agentId?: UUID;
|
|
97
|
-
count?: number;
|
|
98
|
-
unique?: boolean;
|
|
99
|
-
tableName: string;
|
|
100
|
-
start?: number;
|
|
101
|
-
end?: number;
|
|
102
|
-
roomId?: UUID;
|
|
103
|
-
worldId?: UUID;
|
|
104
|
-
}): Promise<Memory[]>;
|
|
105
|
-
abstract getMemoriesByRoomIds(params: {
|
|
106
|
-
roomIds: UUID[];
|
|
107
|
-
tableName: string;
|
|
108
|
-
limit?: number;
|
|
109
|
-
}): Promise<Memory[]>;
|
|
110
|
-
abstract getMemoryById(id: UUID): Promise<Memory | null>;
|
|
111
|
-
/**
|
|
112
|
-
* Retrieves multiple memories by their IDs
|
|
113
|
-
* @param memoryIds Array of UUIDs of the memories to retrieve
|
|
114
|
-
* @param tableName Optional table name to filter memories by type
|
|
115
|
-
* @returns Promise resolving to array of Memory objects
|
|
116
|
-
*/
|
|
117
|
-
abstract getMemoriesByIds(memoryIds: UUID[], tableName?: string): Promise<Memory[]>;
|
|
118
|
-
/**
|
|
119
|
-
* Retrieves cached embeddings based on the specified query parameters.
|
|
120
|
-
* @param params An object containing parameters for the embedding retrieval.
|
|
121
|
-
* @returns A Promise that resolves to an array of objects containing embeddings and levenshtein scores.
|
|
122
|
-
*/
|
|
123
|
-
abstract getCachedEmbeddings({ query_table_name, query_threshold, query_input, query_field_name, query_field_sub_name, query_match_count, }: {
|
|
124
|
-
query_table_name: string;
|
|
125
|
-
query_threshold: number;
|
|
126
|
-
query_input: string;
|
|
127
|
-
query_field_name: string;
|
|
128
|
-
query_field_sub_name: string;
|
|
129
|
-
query_match_count: number;
|
|
130
|
-
}): Promise<{
|
|
131
|
-
embedding: number[];
|
|
132
|
-
levenshtein_score: number;
|
|
133
|
-
}[]>;
|
|
134
|
-
/**
|
|
135
|
-
* Logs an event or action with the specified details.
|
|
136
|
-
* @param params An object containing parameters for the log entry.
|
|
137
|
-
* @returns A Promise that resolves when the log entry has been saved.
|
|
138
|
-
*/
|
|
139
|
-
abstract log(params: {
|
|
140
|
-
body: {
|
|
141
|
-
[key: string]: unknown;
|
|
142
|
-
};
|
|
143
|
-
entityId: UUID;
|
|
144
|
-
roomId: UUID;
|
|
145
|
-
type: string;
|
|
146
|
-
}): Promise<void>;
|
|
147
|
-
/**
|
|
148
|
-
* Retrieves logs based on the specified parameters.
|
|
149
|
-
* @param params An object containing parameters for the log retrieval.
|
|
150
|
-
* @returns A Promise that resolves to an array of Log objects.
|
|
151
|
-
*/
|
|
152
|
-
abstract getLogs(params: {
|
|
153
|
-
entityId: UUID;
|
|
154
|
-
roomId?: UUID;
|
|
155
|
-
type?: string;
|
|
156
|
-
count?: number;
|
|
157
|
-
offset?: number;
|
|
158
|
-
}): Promise<Log[]>;
|
|
159
|
-
/**
|
|
160
|
-
* Deletes a log from the database.
|
|
161
|
-
* @param logId The UUID of the log to delete.
|
|
162
|
-
* @returns A Promise that resolves when the log has been deleted.
|
|
163
|
-
*/
|
|
164
|
-
abstract deleteLog(logId: UUID): Promise<void>;
|
|
165
|
-
/**
|
|
166
|
-
* Searches for memories based on embeddings and other specified parameters.
|
|
167
|
-
* @param params An object containing parameters for the memory search.
|
|
168
|
-
* @returns A Promise that resolves to an array of Memory objects.
|
|
169
|
-
*/
|
|
170
|
-
abstract searchMemories(params: {
|
|
171
|
-
tableName: string;
|
|
172
|
-
embedding: number[];
|
|
173
|
-
match_threshold?: number;
|
|
174
|
-
count?: number;
|
|
175
|
-
unique?: boolean;
|
|
176
|
-
query?: string;
|
|
177
|
-
roomId?: UUID;
|
|
178
|
-
worldId?: UUID;
|
|
179
|
-
entityId?: UUID;
|
|
180
|
-
}): Promise<Memory[]>;
|
|
181
|
-
/**
|
|
182
|
-
* Creates a new memory in the database.
|
|
183
|
-
* @param memory The memory object to create.
|
|
184
|
-
* @param tableName The table where the memory should be stored.
|
|
185
|
-
* @param unique Indicates if the memory should be unique.
|
|
186
|
-
* @returns A Promise that resolves when the memory has been created.
|
|
187
|
-
*/
|
|
188
|
-
abstract createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
189
|
-
/**
|
|
190
|
-
* Updates an existing memory in the database.
|
|
191
|
-
* @param memory The memory object with updated content and optional embedding
|
|
192
|
-
* @returns Promise resolving to boolean indicating success
|
|
193
|
-
*/
|
|
194
|
-
abstract updateMemory(memory: Partial<Memory> & {
|
|
195
|
-
id: UUID;
|
|
196
|
-
metadata?: MemoryMetadata;
|
|
197
|
-
}): Promise<boolean>;
|
|
198
|
-
/**
|
|
199
|
-
* Removes a specific memory from the database.
|
|
200
|
-
* @param memoryId The UUID of the memory to remove.
|
|
201
|
-
* @returns A Promise that resolves when the memory has been removed.
|
|
202
|
-
*/
|
|
203
|
-
abstract deleteMemory(memoryId: UUID): Promise<void>;
|
|
204
|
-
/**
|
|
205
|
-
* Removes all memories associated with a specific room.
|
|
206
|
-
* @param roomId The UUID of the room whose memories should be removed.
|
|
207
|
-
* @param tableName The table from which the memories should be removed.
|
|
208
|
-
* @returns A Promise that resolves when all memories have been removed.
|
|
209
|
-
*/
|
|
210
|
-
abstract deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
211
|
-
/**
|
|
212
|
-
* Counts the number of memories in a specific room.
|
|
213
|
-
* @param roomId The UUID of the room for which to count memories.
|
|
214
|
-
* @param unique Specifies whether to count only unique memories.
|
|
215
|
-
* @param tableName Optional table name to count memories from.
|
|
216
|
-
* @returns A Promise that resolves to the number of memories.
|
|
217
|
-
*/
|
|
218
|
-
abstract countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
219
|
-
/**
|
|
220
|
-
* Retrieves a world by its ID.
|
|
221
|
-
* @param id The UUID of the world to retrieve.
|
|
222
|
-
* @returns A Promise that resolves to the World object or null if not found.
|
|
223
|
-
*/
|
|
224
|
-
abstract getWorld(id: UUID): Promise<World | null>;
|
|
225
|
-
/**
|
|
226
|
-
* Retrieves all worlds for an agent.
|
|
227
|
-
* @returns A Promise that resolves to an array of World objects.
|
|
228
|
-
*/
|
|
229
|
-
abstract getAllWorlds(): Promise<World[]>;
|
|
230
|
-
/**
|
|
231
|
-
* Creates a new world in the database.
|
|
232
|
-
* @param world The world object to create.
|
|
233
|
-
* @returns A Promise that resolves to the UUID of the created world.
|
|
234
|
-
*/
|
|
235
|
-
abstract createWorld(world: World): Promise<UUID>;
|
|
236
|
-
/**
|
|
237
|
-
* Updates an existing world in the database.
|
|
238
|
-
* @param world The world object with updated properties.
|
|
239
|
-
* @returns A Promise that resolves when the world has been updated.
|
|
240
|
-
*/
|
|
241
|
-
abstract updateWorld(world: World): Promise<void>;
|
|
242
|
-
/**
|
|
243
|
-
* Removes a specific world from the database.
|
|
244
|
-
* @param id The UUID of the world to remove.
|
|
245
|
-
* @returns A Promise that resolves when the world has been removed.
|
|
246
|
-
*/
|
|
247
|
-
abstract removeWorld(id: UUID): Promise<void>;
|
|
248
|
-
/**
|
|
249
|
-
* Retrieves the room ID for a given room, if it exists.
|
|
250
|
-
* @param roomId The UUID of the room to retrieve.
|
|
251
|
-
* @returns A Promise that resolves to the room ID or null if not found.
|
|
252
|
-
*/
|
|
253
|
-
abstract getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
|
|
254
|
-
/**
|
|
255
|
-
* Retrieves all rooms for a given world.
|
|
256
|
-
* @param worldId The UUID of the world to retrieve rooms for.
|
|
257
|
-
* @returns A Promise that resolves to an array of Room objects.
|
|
258
|
-
*/
|
|
259
|
-
abstract getRoomsByWorld(worldId: UUID): Promise<Room[]>;
|
|
260
|
-
/**
|
|
261
|
-
* Creates a new rooms with an optional specified ID.
|
|
262
|
-
* @param roomId Optional UUID to assign to the new room.
|
|
263
|
-
* @returns A Promise that resolves to the UUID of the created rooms.
|
|
264
|
-
*/
|
|
265
|
-
abstract createRooms(rooms: Room[]): Promise<UUID[]>;
|
|
266
|
-
/**
|
|
267
|
-
* Updates a specific room in the database.
|
|
268
|
-
* @param room The room object with updated properties.
|
|
269
|
-
* @returns A Promise that resolves when the room has been updated.
|
|
270
|
-
*/
|
|
271
|
-
abstract updateRoom(room: Room): Promise<void>;
|
|
272
|
-
/**
|
|
273
|
-
* Removes a specific room from the database.
|
|
274
|
-
* @param roomId The UUID of the room to remove.
|
|
275
|
-
* @returns A Promise that resolves when the room has been removed.
|
|
276
|
-
*/
|
|
277
|
-
abstract deleteRoom(roomId: UUID): Promise<void>;
|
|
278
|
-
/**
|
|
279
|
-
* Retrieves room IDs for which a specific user is a participant.
|
|
280
|
-
* @param entityId The UUID of the user.
|
|
281
|
-
* @returns A Promise that resolves to an array of room IDs.
|
|
282
|
-
*/
|
|
283
|
-
abstract getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
284
|
-
/**
|
|
285
|
-
* Retrieves room IDs for which specific users are participants.
|
|
286
|
-
* @param userIds An array of UUIDs of the users.
|
|
287
|
-
* @returns A Promise that resolves to an array of room IDs.
|
|
288
|
-
*/
|
|
289
|
-
abstract getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
290
|
-
/**
|
|
291
|
-
* Adds users as a participant to a specific room.
|
|
292
|
-
* @param entityIds The UUIDs of the users to add as a participant.
|
|
293
|
-
* @param roomId The UUID of the room to which the user will be added.
|
|
294
|
-
* @returns A Promise that resolves to a boolean indicating success or failure.
|
|
295
|
-
*/
|
|
296
|
-
abstract addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
|
|
297
|
-
/**
|
|
298
|
-
* Removes a user as a participant from a specific room.
|
|
299
|
-
* @param entityId The UUID of the user to remove as a participant.
|
|
300
|
-
* @param roomId The UUID of the room from which the user will be removed.
|
|
301
|
-
* @returns A Promise that resolves to a boolean indicating success or failure.
|
|
302
|
-
*/
|
|
303
|
-
abstract removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
304
|
-
/**
|
|
305
|
-
* Retrieves participants associated with a specific account.
|
|
306
|
-
* @param entityId The UUID of the account.
|
|
307
|
-
* @returns A Promise that resolves to an array of Participant objects.
|
|
308
|
-
*/
|
|
309
|
-
abstract getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
310
|
-
/**
|
|
311
|
-
* Retrieves participants for a specific room.
|
|
312
|
-
* @param roomId The UUID of the room for which to retrieve participants.
|
|
313
|
-
* @returns A Promise that resolves to an array of UUIDs representing the participants.
|
|
314
|
-
*/
|
|
315
|
-
abstract getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
316
|
-
abstract getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
317
|
-
abstract setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
318
|
-
/**
|
|
319
|
-
* Creates a new relationship between two users.
|
|
320
|
-
* @param params Object containing the relationship details including entity IDs, agent ID, optional tags and metadata
|
|
321
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the creation.
|
|
322
|
-
*/
|
|
323
|
-
abstract createRelationship(params: {
|
|
324
|
-
sourceEntityId: UUID;
|
|
325
|
-
targetEntityId: UUID;
|
|
326
|
-
tags?: string[];
|
|
327
|
-
metadata?: Record<string, unknown>;
|
|
328
|
-
}): Promise<boolean>;
|
|
329
|
-
/**
|
|
330
|
-
* Retrieves a relationship between two users if it exists.
|
|
331
|
-
* @param params Object containing the entity IDs and agent ID
|
|
332
|
-
* @returns A Promise that resolves to the Relationship object or null if not found.
|
|
333
|
-
*/
|
|
334
|
-
abstract getRelationship(params: {
|
|
335
|
-
sourceEntityId: UUID;
|
|
336
|
-
targetEntityId: UUID;
|
|
337
|
-
}): Promise<Relationship | null>;
|
|
338
|
-
/**
|
|
339
|
-
* Retrieves all relationships for a specific user.
|
|
340
|
-
* @param params Object containing the user ID, agent ID and optional tags to filter by
|
|
341
|
-
* @returns A Promise that resolves to an array of Relationship objects.
|
|
342
|
-
*/
|
|
343
|
-
abstract getRelationships(params: {
|
|
344
|
-
entityId: UUID;
|
|
345
|
-
tags?: string[];
|
|
346
|
-
}): Promise<Relationship[]>;
|
|
347
|
-
/**
|
|
348
|
-
* Updates an existing relationship between two users.
|
|
349
|
-
* @param params Object containing the relationship details to update including entity IDs, agent ID, optional tags and metadata
|
|
350
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the update.
|
|
351
|
-
*/
|
|
352
|
-
abstract updateRelationship(params: {
|
|
353
|
-
sourceEntityId: UUID;
|
|
354
|
-
targetEntityId: UUID;
|
|
355
|
-
tags?: string[];
|
|
356
|
-
metadata?: Record<string, unknown>;
|
|
357
|
-
}): Promise<void>;
|
|
358
|
-
/**
|
|
359
|
-
* Retrieves an agent by its ID.
|
|
360
|
-
* @param agentId The UUID of the agent to retrieve.
|
|
361
|
-
* @returns A Promise that resolves to the Agent object or null if not found.
|
|
362
|
-
*/
|
|
363
|
-
abstract getAgent(agentId: UUID): Promise<Agent | null>;
|
|
364
|
-
/**
|
|
365
|
-
* Retrieves all agents from the database.
|
|
366
|
-
* @returns A Promise that resolves to an array of Agent objects.
|
|
367
|
-
*/
|
|
368
|
-
abstract getAgents(): Promise<Partial<Agent>[]>;
|
|
369
|
-
/**
|
|
370
|
-
* Creates a new agent in the database.
|
|
371
|
-
* @param agent The agent object to create.
|
|
372
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the creation.
|
|
373
|
-
*/
|
|
374
|
-
abstract createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
375
|
-
/**
|
|
376
|
-
* Updates an existing agent in the database.
|
|
377
|
-
* @param agentId The UUID of the agent to update.
|
|
378
|
-
* @param agent The agent object with updated properties.
|
|
379
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the update.
|
|
380
|
-
*/
|
|
381
|
-
abstract updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
382
|
-
/**
|
|
383
|
-
* Deletes an agent from the database.
|
|
384
|
-
* @param agentId The UUID of the agent to delete.
|
|
385
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the deletion.
|
|
386
|
-
*/
|
|
387
|
-
abstract deleteAgent(agentId: UUID): Promise<boolean>;
|
|
388
|
-
/**
|
|
389
|
-
* Ensures an embedding dimension exists in the database.
|
|
390
|
-
* @param dimension The dimension to ensure exists.
|
|
391
|
-
* @returns A Promise that resolves when the embedding dimension has been ensured to exist.
|
|
392
|
-
*/
|
|
393
|
-
abstract ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
394
|
-
/**
|
|
395
|
-
* Retrieves a cached value by key from the database.
|
|
396
|
-
* @param key The key to look up in the cache
|
|
397
|
-
* @returns Promise resolving to the cached string value
|
|
398
|
-
*/
|
|
399
|
-
abstract getCache<T>(key: string): Promise<T | undefined>;
|
|
400
|
-
/**
|
|
401
|
-
* Sets a value in the cache with the given key.
|
|
402
|
-
* @param params Object containing the cache key and value
|
|
403
|
-
* @param key The key to store the value under
|
|
404
|
-
* @param value The string value to cache
|
|
405
|
-
* @returns Promise resolving to true if the cache was set successfully
|
|
406
|
-
*/
|
|
407
|
-
abstract setCache<T>(key: string, value: T): Promise<boolean>;
|
|
408
|
-
/**
|
|
409
|
-
* Deletes a value from the cache by key.
|
|
410
|
-
* @param key The key to delete from the cache
|
|
411
|
-
* @returns Promise resolving to true if the value was successfully deleted
|
|
412
|
-
*/
|
|
413
|
-
abstract deleteCache(key: string): Promise<boolean>;
|
|
414
|
-
/**
|
|
415
|
-
* Creates a new task instance in the database.
|
|
416
|
-
* @param task The task object to create
|
|
417
|
-
* @returns Promise resolving to the UUID of the created task
|
|
418
|
-
*/
|
|
419
|
-
abstract createTask(task: Task): Promise<UUID>;
|
|
420
|
-
/**
|
|
421
|
-
* Retrieves tasks based on specified parameters.
|
|
422
|
-
* @param params Object containing optional roomId and tags to filter tasks
|
|
423
|
-
* @returns Promise resolving to an array of Task objects
|
|
424
|
-
*/
|
|
425
|
-
abstract getTasks(params: {
|
|
426
|
-
roomId?: UUID;
|
|
427
|
-
tags?: string[];
|
|
428
|
-
entityId?: UUID;
|
|
429
|
-
}): Promise<Task[]>;
|
|
430
|
-
/**
|
|
431
|
-
* Retrieves a specific task by its ID.
|
|
432
|
-
* @param id The UUID of the task to retrieve
|
|
433
|
-
* @returns Promise resolving to the Task object if found, null otherwise
|
|
434
|
-
*/
|
|
435
|
-
abstract getTask(id: UUID): Promise<Task | null>;
|
|
436
|
-
/**
|
|
437
|
-
* Retrieves a specific task by its name.
|
|
438
|
-
* @param name The name of the task to retrieve
|
|
439
|
-
* @returns Promise resolving to the Task object if found, null otherwise
|
|
440
|
-
*/
|
|
441
|
-
abstract getTasksByName(name: string): Promise<Task[]>;
|
|
442
|
-
/**
|
|
443
|
-
* Updates an existing task in the database.
|
|
444
|
-
* @param id The UUID of the task to update
|
|
445
|
-
* @param task Partial Task object containing the fields to update
|
|
446
|
-
* @returns Promise resolving when the update is complete
|
|
447
|
-
*/
|
|
448
|
-
abstract updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
449
|
-
/**
|
|
450
|
-
* Deletes a task from the database.
|
|
451
|
-
* @param id The UUID of the task to delete
|
|
452
|
-
* @returns Promise resolving when the deletion is complete
|
|
453
|
-
*/
|
|
454
|
-
abstract deleteTask(id: UUID): Promise<void>;
|
|
455
|
-
abstract getMemoriesByWorldId(params: {
|
|
456
|
-
worldId: UUID;
|
|
457
|
-
count?: number;
|
|
458
|
-
tableName?: string;
|
|
459
|
-
}): Promise<Memory[]>;
|
|
460
|
-
abstract deleteRoomsByWorldId(worldId: UUID): Promise<void>;
|
|
461
|
-
}
|
package/dist/entities.d.ts
DELETED
|
@@ -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;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Meter, Tracer } from '@opentelemetry/api';
|
|
2
|
-
import { IAgentRuntime, Service } from '../types';
|
|
3
|
-
import { IInstrumentationService, InstrumentationConfig } from './types';
|
|
4
|
-
export declare class InstrumentationService extends Service implements IInstrumentationService {
|
|
5
|
-
static serviceType: "instrumentation";
|
|
6
|
-
readonly name = "INSTRUMENTATION";
|
|
7
|
-
readonly capabilityDescription = "Provides OpenTelemetry tracing and metrics capabilities.";
|
|
8
|
-
instrumentationConfig: InstrumentationConfig;
|
|
9
|
-
private resource;
|
|
10
|
-
private tracerProvider;
|
|
11
|
-
private meterProvider;
|
|
12
|
-
private isShutdown;
|
|
13
|
-
constructor(config?: InstrumentationConfig);
|
|
14
|
-
private initializeProviders;
|
|
15
|
-
isEnabled(): boolean;
|
|
16
|
-
getTracer(name?: string, version?: string): Tracer | null;
|
|
17
|
-
getMeter(name?: string, version?: string): Meter | null;
|
|
18
|
-
flush(): Promise<void>;
|
|
19
|
-
stop(): Promise<void>;
|
|
20
|
-
static start(runtime: IAgentRuntime, config?: InstrumentationConfig): Promise<InstrumentationService>;
|
|
21
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Tracer, Meter } from '@opentelemetry/api';
|
|
2
|
-
export interface InstrumentationConfig {
|
|
3
|
-
serviceName?: string;
|
|
4
|
-
otlpEndpoint?: string;
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface IInstrumentationService {
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly capabilityDescription: string;
|
|
10
|
-
instrumentationConfig: InstrumentationConfig;
|
|
11
|
-
isEnabled(): boolean;
|
|
12
|
-
getTracer(name?: string, version?: string): Tracer | null;
|
|
13
|
-
getMeter(name?: string, version?: string): Meter | null;
|
|
14
|
-
flush(): Promise<void>;
|
|
15
|
-
stop(): Promise<void>;
|
|
16
|
-
}
|
package/dist/logger.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare let logger: import("pino").Logger<string, boolean>;
|
|
2
|
-
declare const createLogger: (bindings?: {}) => import("pino").Logger<never, boolean>;
|
|
3
|
-
export { createLogger, logger };
|
|
4
|
-
export declare const elizaLogger: import("pino").Logger<string, boolean>;
|
|
5
|
-
export default logger;
|
package/dist/prompts.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const shouldRespondTemplate = "<task>Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.</task>\n\n<providers>\n{{providers}}\n</providers>\n\n<instructions>Decide if {{agentName}} should respond to or interact with the conversation.\nIf the message is directed at or relevant to {{agentName}}, respond with RESPOND action.\nIf a user asks {{agentName}} to be quiet, respond with STOP action.\nIf {{agentName}} should ignore the message, respond with IGNORE action.</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <name>{{agentName}}</name>\n <reasoning>Your reasoning here</reasoning>\n <action>RESPOND | IGNORE | STOP</action>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
2
|
-
export declare const messageHandlerTemplate = "<task>Generate dialog and actions for the character {{agentName}}.</task>\n\n<providers>\n{{providers}}\n</providers>\n\nThese are the available valid actions:\n<actionNames>\n{{actionNames}}\n</actionNames>\n\n<instructions>\nWrite a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.\n\nIMPORTANT PROVIDER SELECTION RULES:\n- If the message mentions images, photos, pictures, attachments, or visual content, OR if you see \"(Attachments:\" in the conversation, you MUST include \"ATTACHMENTS\" in your providers list\n- If the message asks about or references specific people, include \"ENTITIES\" in your providers list \n- If the message asks about relationships or connections between people, include \"RELATIONSHIPS\" in your providers list\n- If the message asks about facts or specific information, include \"FACTS\" in your providers list\n- If the message asks about the environment or world context, include \"WORLD\" in your providers list\n- If you need external knowledge, information, or context beyond the current conversation to provide a helpful response, include \"KNOWLEDGE\" in your providers list\n\nFirst, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.\n</instructions>\n\n<keys>\n\"thought\" should be a short description of what the agent is thinking about and planning.\n\"actions\" should be a comma-separated list of the actions {{agentName}} plans to take based on the thought (if none, use IGNORE, if simply responding with text, use REPLY)\n\"providers\" should be a comma-separated list of the providers that {{agentName}} will use to have the right context for responding and acting (NEVER use \"IGNORE\" as a provider - use specific provider names like ATTACHMENTS, ENTITIES, FACTS, KNOWLEDGE, etc.)\n\"evaluators\" should be an optional comma-separated list of the evaluators that {{agentName}} will use to evaluate the conversation after responding\n\"text\" should be the text of the next message for {{agentName}} which they will send to the conversation.\n</keys>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <thought>Your thought here</thought>\n <actions>ACTION1,ACTION2</actions>\n <providers>PROVIDER1,PROVIDER2</providers>\n <text>Your response text here</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
3
|
-
export declare const postCreationTemplate = "# Task: Create a post in the voice and style and perspective of {{agentName}} @{{twitterUserName}}.\n\nExample task outputs:\n1. A post about the importance of AI in our lives\n<response>\n <thought>I am thinking about writing a post about the importance of AI in our lives</thought>\n <post>AI is changing the world and it is important to understand how it works</post>\n <imagePrompt>A futuristic cityscape with flying cars and people using AI to do things</imagePrompt>\n</response>\n\n2. A post about dogs\n<response>\n <thought>I am thinking about writing a post about dogs</thought>\n <post>Dogs are man's best friend and they are loyal and loving</post>\n <imagePrompt>A dog playing with a ball in a park</imagePrompt>\n</response>\n\n3. A post about finding a new job\n<response>\n <thought>Getting a job is hard, I bet there's a good tweet in that</thought>\n <post>Just keep going!</post>\n <imagePrompt>A person looking at a computer screen with a job search website</imagePrompt>\n</response>\n\n{{providers}}\n\nWrite a post that is {{adjective}} about {{topic}} (without mentioning {{topic}} directly), from the perspective of {{agentName}}. Do not add commentary or acknowledge this request, just write the post.\nYour response should be 1, 2, or 3 sentences (choose the length at random).\nYour response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.\n\nYour output should be formatted in XML like this:\n<response>\n <thought>Your thought here</thought>\n <post>Your post text here</post>\n <imagePrompt>Optional image prompt here</imagePrompt>\n</response>\n\nThe \"post\" field should be the post you want to send. Do not including any thinking or internal reflection in the \"post\" field.\nThe \"imagePrompt\" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.\nThe \"thought\" field should be a short description of what the agent is thinking about before responding, inlcuding a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.\n\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.";
|
|
4
|
-
export declare const booleanFooter = "Respond with only a YES or a NO.";
|
|
5
|
-
export declare const imageDescriptionTemplate = "<task>Analyze the provided image and generate a comprehensive description with multiple levels of detail.</task>\n\n<instructions>\nCarefully examine the image and provide:\n1. A concise, descriptive title that captures the main subject or scene\n2. A brief summary description (1-2 sentences) highlighting the key elements\n3. An extensive, detailed description that covers all visible elements, composition, lighting, colors, mood, and any other relevant details\n\nBe objective and descriptive. Focus on what you can actually see in the image rather than making assumptions about context or meaning.\n</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <title>A concise, descriptive title for the image</title>\n <description>A brief 1-2 sentence summary of the key elements in the image</description>\n <text>An extensive, detailed description covering all visible elements, composition, lighting, colors, mood, setting, objects, people, activities, and any other relevant details you can observe in the image</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|