@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.
- package/package.json +2 -2
- package/dist/actions/choice.d.ts +0 -13
- package/dist/actions/followRoom.d.ts +0 -20
- package/dist/actions/ignore.d.ts +0 -13
- package/dist/actions/muteRoom.d.ts +0 -22
- package/dist/actions/none.d.ts +0 -9
- package/dist/actions/reply.d.ts +0 -15
- package/dist/actions/roles.d.ts +0 -13
- package/dist/actions/sendMessage.d.ts +0 -14
- package/dist/actions/settings.d.ts +0 -21
- package/dist/actions/unfollowRoom.d.ts +0 -12
- package/dist/actions/unmuteRoom.d.ts +0 -18
- package/dist/actions/updateEntity.d.ts +0 -42
- package/dist/actions.d.ts +0 -28
- package/dist/bootstrap.d.ts +0 -3
- package/dist/database.d.ts +0 -419
- package/dist/entities.d.ts +0 -48
- package/dist/environment.d.ts +0 -403
- package/dist/evaluators/reflection.d.ts +0 -2
- package/dist/import.d.ts +0 -9
- package/dist/index.d.ts +0 -13
- package/dist/logger.d.ts +0 -3
- package/dist/memory.d.ts +0 -114
- package/dist/prompts.d.ts +0 -200
- package/dist/providers/actions.d.ts +0 -14
- package/dist/providers/anxiety.d.ts +0 -9
- package/dist/providers/attachments.d.ts +0 -8
- package/dist/providers/capabilities.d.ts +0 -13
- package/dist/providers/character.d.ts +0 -9
- package/dist/providers/choice.d.ts +0 -10
- package/dist/providers/entities.d.ts +0 -2
- package/dist/providers/evaluators.d.ts +0 -26
- package/dist/providers/facts.d.ts +0 -10
- package/dist/providers/knowledge.d.ts +0 -13
- package/dist/providers/providers.d.ts +0 -6
- package/dist/providers/recentMessages.d.ts +0 -13
- package/dist/providers/relationships.d.ts +0 -14
- package/dist/providers/roles.d.ts +0 -14
- package/dist/providers/settings.d.ts +0 -6
- package/dist/providers/shouldRespond.d.ts +0 -6
- package/dist/providers/time.d.ts +0 -11
- package/dist/roles.d.ts +0 -25
- package/dist/runtime.d.ts +0 -290
- package/dist/services/scenario.d.ts +0 -106
- package/dist/services/task.d.ts +0 -72
- package/dist/settings.d.ts +0 -13
- 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/types.d.ts +0 -1294
- package/dist/uuid.d.ts +0 -18
package/dist/types.d.ts
DELETED
|
@@ -1,1294 +0,0 @@
|
|
|
1
|
-
import type { Readable } from "node:stream";
|
|
2
|
-
/**
|
|
3
|
-
* Represents a UUID string in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Type definition for a Universally Unique Identifier (UUID) using a specific format.
|
|
7
|
-
* @typedef {`${string}-${string}-${string}-${string}-${string}`} UUID
|
|
8
|
-
*/
|
|
9
|
-
export type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
10
|
-
/**
|
|
11
|
-
* Represents the content of a message or communication
|
|
12
|
-
*/
|
|
13
|
-
export interface Content {
|
|
14
|
-
thought?: string;
|
|
15
|
-
/** The agent's plan for the next message */
|
|
16
|
-
plan?: string;
|
|
17
|
-
/** The main text content */
|
|
18
|
-
text?: string;
|
|
19
|
-
/** Optional action associated with the message */
|
|
20
|
-
actions?: string[];
|
|
21
|
-
/** Optional providers associated with the message */
|
|
22
|
-
providers?: string[];
|
|
23
|
-
/** Optional source/origin of the content */
|
|
24
|
-
source?: string;
|
|
25
|
-
/** URL of the original message/post (e.g. tweet URL, Discord message link) */
|
|
26
|
-
url?: string;
|
|
27
|
-
/** UUID of parent message if this is a reply/thread */
|
|
28
|
-
inReplyTo?: UUID;
|
|
29
|
-
/** Array of media attachments */
|
|
30
|
-
attachments?: Media[];
|
|
31
|
-
/** Additional dynamic properties */
|
|
32
|
-
[key: string]: unknown;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Example content with associated user for demonstration purposes
|
|
36
|
-
*/
|
|
37
|
-
export interface ActionExample {
|
|
38
|
-
/** User associated with the example */
|
|
39
|
-
name: string;
|
|
40
|
-
/** Content of the example */
|
|
41
|
-
content: Content;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Example conversation content with user ID
|
|
45
|
-
*/
|
|
46
|
-
export interface ConversationExample {
|
|
47
|
-
/** UUID of user in conversation */
|
|
48
|
-
entityId: UUID;
|
|
49
|
-
/** Content of the conversation */
|
|
50
|
-
content: Content;
|
|
51
|
-
}
|
|
52
|
-
export type ModelType = (typeof ModelTypes)[keyof typeof ModelTypes] | string;
|
|
53
|
-
/**
|
|
54
|
-
* Model size/type classification
|
|
55
|
-
*/
|
|
56
|
-
export declare const ModelTypes: {
|
|
57
|
-
readonly SMALL: "TEXT_SMALL";
|
|
58
|
-
readonly MEDIUM: "TEXT_LARGE";
|
|
59
|
-
readonly LARGE: "TEXT_LARGE";
|
|
60
|
-
readonly TEXT_SMALL: "TEXT_SMALL";
|
|
61
|
-
readonly TEXT_LARGE: "TEXT_LARGE";
|
|
62
|
-
readonly TEXT_EMBEDDING: "TEXT_EMBEDDING";
|
|
63
|
-
readonly TEXT_TOKENIZER_ENCODE: "TEXT_TOKENIZER_ENCODE";
|
|
64
|
-
readonly TEXT_TOKENIZER_DECODE: "TEXT_TOKENIZER_DECODE";
|
|
65
|
-
readonly TEXT_REASONING_SMALL: "REASONING_SMALL";
|
|
66
|
-
readonly TEXT_REASONING_LARGE: "REASONING_LARGE";
|
|
67
|
-
readonly TEXT_COMPLETION: "TEXT_COMPLETION";
|
|
68
|
-
readonly IMAGE: "IMAGE";
|
|
69
|
-
readonly IMAGE_DESCRIPTION: "IMAGE_DESCRIPTION";
|
|
70
|
-
readonly TRANSCRIPTION: "TRANSCRIPTION";
|
|
71
|
-
readonly TEXT_TO_SPEECH: "TEXT_TO_SPEECH";
|
|
72
|
-
readonly AUDIO: "AUDIO";
|
|
73
|
-
readonly VIDEO: "VIDEO";
|
|
74
|
-
readonly OBJECT_SMALL: "OBJECT_SMALL";
|
|
75
|
-
readonly OBJECT_LARGE: "OBJECT_LARGE";
|
|
76
|
-
};
|
|
77
|
-
export type ServiceType = (typeof ServiceTypes)[keyof typeof ServiceTypes];
|
|
78
|
-
export declare const ServiceTypes: {
|
|
79
|
-
readonly TRANSCRIPTION: "transcription";
|
|
80
|
-
readonly VIDEO: "video";
|
|
81
|
-
readonly BROWSER: "browser";
|
|
82
|
-
readonly PDF: "pdf";
|
|
83
|
-
readonly REMOTE_FILES: "aws_s3";
|
|
84
|
-
readonly WEB_SEARCH: "web_search";
|
|
85
|
-
readonly EMAIL: "email";
|
|
86
|
-
readonly TEE: "tee";
|
|
87
|
-
readonly TASK: "task";
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Represents the current state/context of a conversation
|
|
91
|
-
*/
|
|
92
|
-
export interface State {
|
|
93
|
-
/** Additional dynamic properties */
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
values: {
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
};
|
|
98
|
-
data: {
|
|
99
|
-
[key: string]: any;
|
|
100
|
-
};
|
|
101
|
-
text: string;
|
|
102
|
-
}
|
|
103
|
-
export type MemoryTypeAlias = string;
|
|
104
|
-
export declare enum MemoryType {
|
|
105
|
-
DOCUMENT = "document",
|
|
106
|
-
FRAGMENT = "fragment",
|
|
107
|
-
MESSAGE = "message",
|
|
108
|
-
DESCRIPTION = "description",
|
|
109
|
-
CUSTOM = "custom"
|
|
110
|
-
}
|
|
111
|
-
export interface BaseMetadata {
|
|
112
|
-
type: MemoryTypeAlias;
|
|
113
|
-
source?: string;
|
|
114
|
-
sourceId?: UUID;
|
|
115
|
-
scope?: string;
|
|
116
|
-
timestamp?: number;
|
|
117
|
-
tags?: string[];
|
|
118
|
-
}
|
|
119
|
-
export interface DocumentMetadata extends BaseMetadata {
|
|
120
|
-
type: MemoryType.DOCUMENT;
|
|
121
|
-
}
|
|
122
|
-
export interface FragmentMetadata extends BaseMetadata {
|
|
123
|
-
type: MemoryType.FRAGMENT;
|
|
124
|
-
documentId: UUID;
|
|
125
|
-
position: number;
|
|
126
|
-
}
|
|
127
|
-
export interface MessageMetadata extends BaseMetadata {
|
|
128
|
-
type: MemoryType.MESSAGE;
|
|
129
|
-
}
|
|
130
|
-
export interface DescriptionMetadata extends BaseMetadata {
|
|
131
|
-
type: MemoryType.DESCRIPTION;
|
|
132
|
-
}
|
|
133
|
-
export interface CustomMetadata extends BaseMetadata {
|
|
134
|
-
type: MemoryTypeAlias;
|
|
135
|
-
[key: string]: unknown;
|
|
136
|
-
}
|
|
137
|
-
export type MemoryMetadata = DocumentMetadata | FragmentMetadata | MessageMetadata | DescriptionMetadata | CustomMetadata | any;
|
|
138
|
-
/**
|
|
139
|
-
* Represents a stored memory/message
|
|
140
|
-
*/
|
|
141
|
-
export interface Memory {
|
|
142
|
-
/** Optional unique identifier */
|
|
143
|
-
id?: UUID;
|
|
144
|
-
/** Associated user ID */
|
|
145
|
-
entityId: UUID;
|
|
146
|
-
/** Associated agent ID */
|
|
147
|
-
agentId?: UUID;
|
|
148
|
-
/** Optional creation timestamp */
|
|
149
|
-
createdAt?: number;
|
|
150
|
-
/** Memory content */
|
|
151
|
-
content: Content;
|
|
152
|
-
/** Optional embedding vector */
|
|
153
|
-
embedding?: number[];
|
|
154
|
-
/** Associated room ID */
|
|
155
|
-
roomId: UUID;
|
|
156
|
-
/** Whether memory is unique */
|
|
157
|
-
unique?: boolean;
|
|
158
|
-
/** Embedding similarity score */
|
|
159
|
-
similarity?: number;
|
|
160
|
-
/** Metadata for the knowledge */
|
|
161
|
-
metadata?: MemoryMetadata;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Example message for demonstration
|
|
165
|
-
*/
|
|
166
|
-
export interface MessageExample {
|
|
167
|
-
/** Associated user */
|
|
168
|
-
name: string;
|
|
169
|
-
/** Message content */
|
|
170
|
-
content: Content;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Handler function type for processing messages
|
|
174
|
-
*/
|
|
175
|
-
export type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
|
|
176
|
-
[key: string]: unknown;
|
|
177
|
-
}, callback?: HandlerCallback, responses?: Memory[]) => Promise<unknown>;
|
|
178
|
-
/**
|
|
179
|
-
* Callback function type for handlers
|
|
180
|
-
*/
|
|
181
|
-
export type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
|
|
182
|
-
/**
|
|
183
|
-
* Validator function type for actions/evaluators
|
|
184
|
-
*/
|
|
185
|
-
export type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
|
|
186
|
-
/**
|
|
187
|
-
* Represents an action the agent can perform
|
|
188
|
-
*/
|
|
189
|
-
export interface Action {
|
|
190
|
-
/** Similar action descriptions */
|
|
191
|
-
similes?: string[];
|
|
192
|
-
/** Detailed description */
|
|
193
|
-
description: string;
|
|
194
|
-
/** Example usages */
|
|
195
|
-
examples?: ActionExample[][];
|
|
196
|
-
/** Handler function */
|
|
197
|
-
handler: Handler;
|
|
198
|
-
/** Action name */
|
|
199
|
-
name: string;
|
|
200
|
-
/** Validation function */
|
|
201
|
-
validate: Validator;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Example for evaluating agent behavior
|
|
205
|
-
*/
|
|
206
|
-
export interface EvaluationExample {
|
|
207
|
-
/** Evaluation context */
|
|
208
|
-
prompt: string;
|
|
209
|
-
/** Example messages */
|
|
210
|
-
messages: Array<ActionExample>;
|
|
211
|
-
/** Expected outcome */
|
|
212
|
-
outcome: string;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Evaluator for assessing agent responses
|
|
216
|
-
*/
|
|
217
|
-
export interface Evaluator {
|
|
218
|
-
/** Whether to always run */
|
|
219
|
-
alwaysRun?: boolean;
|
|
220
|
-
/** Detailed description */
|
|
221
|
-
description: string;
|
|
222
|
-
/** Similar evaluator descriptions */
|
|
223
|
-
similes?: string[];
|
|
224
|
-
/** Example evaluations */
|
|
225
|
-
examples: EvaluationExample[];
|
|
226
|
-
/** Handler function */
|
|
227
|
-
handler: Handler;
|
|
228
|
-
/** Evaluator name */
|
|
229
|
-
name: string;
|
|
230
|
-
/** Validation function */
|
|
231
|
-
validate: Validator;
|
|
232
|
-
}
|
|
233
|
-
export interface ProviderResult {
|
|
234
|
-
values?: {
|
|
235
|
-
[key: string]: any;
|
|
236
|
-
};
|
|
237
|
-
data?: {
|
|
238
|
-
[key: string]: any;
|
|
239
|
-
};
|
|
240
|
-
text?: string;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Provider for external data/services
|
|
244
|
-
*/
|
|
245
|
-
export interface Provider {
|
|
246
|
-
/** Provider name */
|
|
247
|
-
name: string;
|
|
248
|
-
/** Description of the provider */
|
|
249
|
-
description?: string;
|
|
250
|
-
/** Whether the provider is dynamic */
|
|
251
|
-
dynamic?: boolean;
|
|
252
|
-
/** Position of the provider in the provider list, positive or negative */
|
|
253
|
-
position?: number;
|
|
254
|
-
/**
|
|
255
|
-
* Whether the provider is private
|
|
256
|
-
*
|
|
257
|
-
* Private providers are not displayed in the regular provider list, they have to be called explicitly
|
|
258
|
-
*/
|
|
259
|
-
private?: boolean;
|
|
260
|
-
/** Data retrieval function */
|
|
261
|
-
get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Represents a relationship between users
|
|
265
|
-
*/
|
|
266
|
-
export interface Relationship {
|
|
267
|
-
/** Unique identifier */
|
|
268
|
-
id: UUID;
|
|
269
|
-
/** First user ID */
|
|
270
|
-
sourceEntityId: UUID;
|
|
271
|
-
/** Second user ID */
|
|
272
|
-
targetEntityId: UUID;
|
|
273
|
-
/** Agent ID */
|
|
274
|
-
agentId: UUID;
|
|
275
|
-
/** Tags for filtering/categorizing relationships */
|
|
276
|
-
tags: string[];
|
|
277
|
-
/** Additional metadata about the relationship */
|
|
278
|
-
metadata: {
|
|
279
|
-
[key: string]: any;
|
|
280
|
-
};
|
|
281
|
-
/** Optional creation timestamp */
|
|
282
|
-
createdAt?: string;
|
|
283
|
-
}
|
|
284
|
-
export interface Component {
|
|
285
|
-
id: UUID;
|
|
286
|
-
entityId: UUID;
|
|
287
|
-
agentId: UUID;
|
|
288
|
-
roomId: UUID;
|
|
289
|
-
worldId: UUID;
|
|
290
|
-
sourceEntityId: UUID;
|
|
291
|
-
type: string;
|
|
292
|
-
data: {
|
|
293
|
-
[key: string]: any;
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Represents a user account
|
|
298
|
-
*/
|
|
299
|
-
export interface Entity {
|
|
300
|
-
/** Unique identifier, optional on creation */
|
|
301
|
-
id?: UUID;
|
|
302
|
-
/** Names of the entity */
|
|
303
|
-
names: string[];
|
|
304
|
-
/** Optional additional metadata */
|
|
305
|
-
metadata?: {
|
|
306
|
-
[key: string]: any;
|
|
307
|
-
};
|
|
308
|
-
/** Agent ID this account is related to, for agents should be themselves */
|
|
309
|
-
agentId: UUID;
|
|
310
|
-
/** Optional array of components */
|
|
311
|
-
components?: Component[];
|
|
312
|
-
}
|
|
313
|
-
export type World = {
|
|
314
|
-
id: UUID;
|
|
315
|
-
name?: string;
|
|
316
|
-
agentId: UUID;
|
|
317
|
-
serverId: string;
|
|
318
|
-
metadata?: {
|
|
319
|
-
ownership?: {
|
|
320
|
-
ownerId: string;
|
|
321
|
-
};
|
|
322
|
-
roles?: {
|
|
323
|
-
[entityId: UUID]: Role;
|
|
324
|
-
};
|
|
325
|
-
[key: string]: unknown;
|
|
326
|
-
};
|
|
327
|
-
};
|
|
328
|
-
export type Room = {
|
|
329
|
-
id: UUID;
|
|
330
|
-
name?: string;
|
|
331
|
-
agentId?: UUID;
|
|
332
|
-
source: string;
|
|
333
|
-
type: ChannelType;
|
|
334
|
-
channelId?: string;
|
|
335
|
-
serverId?: string;
|
|
336
|
-
worldId?: UUID;
|
|
337
|
-
metadata?: Record<string, unknown>;
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* Room participant with account details
|
|
341
|
-
*/
|
|
342
|
-
export interface Participant {
|
|
343
|
-
/** Unique identifier */
|
|
344
|
-
id: UUID;
|
|
345
|
-
/** Associated account */
|
|
346
|
-
entity: Entity;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Represents a media attachment
|
|
350
|
-
*/
|
|
351
|
-
export type Media = {
|
|
352
|
-
/** Unique identifier */
|
|
353
|
-
id: string;
|
|
354
|
-
/** Media URL */
|
|
355
|
-
url: string;
|
|
356
|
-
/** Media title */
|
|
357
|
-
title: string;
|
|
358
|
-
/** Media source */
|
|
359
|
-
source: string;
|
|
360
|
-
/** Media description */
|
|
361
|
-
description: string;
|
|
362
|
-
/** Text content */
|
|
363
|
-
text: string;
|
|
364
|
-
/** Content type */
|
|
365
|
-
contentType?: string;
|
|
366
|
-
};
|
|
367
|
-
export declare enum ChannelType {
|
|
368
|
-
SELF = "SELF",
|
|
369
|
-
DM = "DM",
|
|
370
|
-
GROUP = "GROUP",
|
|
371
|
-
VOICE_DM = "VOICE_DM",
|
|
372
|
-
VOICE_GROUP = "VOICE_GROUP",
|
|
373
|
-
FEED = "FEED",
|
|
374
|
-
THREAD = "THREAD",
|
|
375
|
-
WORLD = "WORLD",
|
|
376
|
-
API = "API",
|
|
377
|
-
FORUM = "FORUM"
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Client instance
|
|
381
|
-
*/
|
|
382
|
-
export declare abstract class Service {
|
|
383
|
-
/** Runtime instance */
|
|
384
|
-
protected runtime: IAgentRuntime;
|
|
385
|
-
constructor(runtime?: IAgentRuntime);
|
|
386
|
-
abstract stop(): Promise<void>;
|
|
387
|
-
/** Service type */
|
|
388
|
-
static serviceType: string;
|
|
389
|
-
/** Service name */
|
|
390
|
-
abstract capabilityDescription: string;
|
|
391
|
-
/** Service configuration */
|
|
392
|
-
config?: {
|
|
393
|
-
[key: string]: any;
|
|
394
|
-
};
|
|
395
|
-
/** Start service connection */
|
|
396
|
-
static start(_runtime: IAgentRuntime): Promise<Service>;
|
|
397
|
-
/** Stop service connection */
|
|
398
|
-
static stop(_runtime: IAgentRuntime): Promise<unknown>;
|
|
399
|
-
}
|
|
400
|
-
export type Route = {
|
|
401
|
-
type: "GET" | "POST" | "PUT" | "DELETE" | "STATIC";
|
|
402
|
-
path: string;
|
|
403
|
-
filePath?: string;
|
|
404
|
-
handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
|
|
405
|
-
};
|
|
406
|
-
/**
|
|
407
|
-
* Plugin for extending agent functionality
|
|
408
|
-
*/
|
|
409
|
-
export interface Plugin {
|
|
410
|
-
name: string;
|
|
411
|
-
description: string;
|
|
412
|
-
init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
|
|
413
|
-
config?: {
|
|
414
|
-
[key: string]: any;
|
|
415
|
-
};
|
|
416
|
-
memoryManagers?: IMemoryManager[];
|
|
417
|
-
services?: (typeof Service)[];
|
|
418
|
-
componentTypes?: {
|
|
419
|
-
name: string;
|
|
420
|
-
schema: Record<string, unknown>;
|
|
421
|
-
validator?: (data: any) => boolean;
|
|
422
|
-
}[];
|
|
423
|
-
actions?: Action[];
|
|
424
|
-
providers?: Provider[];
|
|
425
|
-
evaluators?: Evaluator[];
|
|
426
|
-
adapter?: IDatabaseAdapter;
|
|
427
|
-
models?: {
|
|
428
|
-
[key: string]: (...args: any[]) => Promise<any>;
|
|
429
|
-
};
|
|
430
|
-
events?: {
|
|
431
|
-
[K in keyof EventPayloadMap]?: EventHandler<K>[];
|
|
432
|
-
} & {
|
|
433
|
-
[key: string]: ((params: EventPayload) => Promise<any>)[];
|
|
434
|
-
};
|
|
435
|
-
routes?: Route[];
|
|
436
|
-
tests?: TestSuite[];
|
|
437
|
-
}
|
|
438
|
-
export interface ProjectAgent {
|
|
439
|
-
character: Character;
|
|
440
|
-
init?: (runtime: IAgentRuntime) => Promise<void>;
|
|
441
|
-
plugins?: Plugin[];
|
|
442
|
-
tests?: TestSuite | TestSuite[];
|
|
443
|
-
}
|
|
444
|
-
export interface Project {
|
|
445
|
-
agents: ProjectAgent[];
|
|
446
|
-
}
|
|
447
|
-
export interface ModelConfiguration {
|
|
448
|
-
temperature?: number;
|
|
449
|
-
maxOutputTokens?: number;
|
|
450
|
-
frequency_penalty?: number;
|
|
451
|
-
presence_penalty?: number;
|
|
452
|
-
maxInputTokens?: number;
|
|
453
|
-
}
|
|
454
|
-
export type TemplateType = string | ((options: {
|
|
455
|
-
state: State | {
|
|
456
|
-
[key: string]: string;
|
|
457
|
-
};
|
|
458
|
-
}) => string);
|
|
459
|
-
/**
|
|
460
|
-
* Configuration for an agent character
|
|
461
|
-
*/
|
|
462
|
-
export interface Character {
|
|
463
|
-
/** Optional unique identifier */
|
|
464
|
-
id?: UUID;
|
|
465
|
-
/** Character name */
|
|
466
|
-
name: string;
|
|
467
|
-
/** Optional username */
|
|
468
|
-
username?: string;
|
|
469
|
-
/** Optional system prompt */
|
|
470
|
-
system?: string;
|
|
471
|
-
/** Optional prompt templates */
|
|
472
|
-
templates?: {
|
|
473
|
-
[key: string]: TemplateType;
|
|
474
|
-
};
|
|
475
|
-
/** Character biography */
|
|
476
|
-
bio: string | string[];
|
|
477
|
-
/** Example messages */
|
|
478
|
-
messageExamples?: MessageExample[][];
|
|
479
|
-
/** Example posts */
|
|
480
|
-
postExamples?: string[];
|
|
481
|
-
/** Known topics */
|
|
482
|
-
topics?: string[];
|
|
483
|
-
/** Character traits */
|
|
484
|
-
adjectives?: string[];
|
|
485
|
-
/** Optional knowledge base */
|
|
486
|
-
knowledge?: (string | {
|
|
487
|
-
path: string;
|
|
488
|
-
shared?: boolean;
|
|
489
|
-
})[];
|
|
490
|
-
/** Available plugins */
|
|
491
|
-
plugins?: string[];
|
|
492
|
-
/** Optional configuration */
|
|
493
|
-
settings?: {
|
|
494
|
-
[key: string]: any | string | boolean | number;
|
|
495
|
-
};
|
|
496
|
-
/** Optional secrets */
|
|
497
|
-
secrets?: {
|
|
498
|
-
[key: string]: string | boolean | number;
|
|
499
|
-
};
|
|
500
|
-
/** Writing style guides */
|
|
501
|
-
style?: {
|
|
502
|
-
all?: string[];
|
|
503
|
-
chat?: string[];
|
|
504
|
-
post?: string[];
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
export interface Agent extends Character {
|
|
508
|
-
createdAt: number;
|
|
509
|
-
updatedAt: number;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Interface for database operations
|
|
513
|
-
*/
|
|
514
|
-
export interface IDatabaseAdapter {
|
|
515
|
-
/** Database instance */
|
|
516
|
-
db: any;
|
|
517
|
-
/** Initialize database connection */
|
|
518
|
-
init(): Promise<void>;
|
|
519
|
-
/** Close database connection */
|
|
520
|
-
close(): Promise<void>;
|
|
521
|
-
getAgent(agentId: UUID): Promise<Agent | null>;
|
|
522
|
-
/** Get all agents */
|
|
523
|
-
getAgents(): Promise<Agent[]>;
|
|
524
|
-
createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
525
|
-
updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
526
|
-
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
527
|
-
ensureAgentExists(agent: Partial<Agent>): Promise<void>;
|
|
528
|
-
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
529
|
-
/** Get entity by ID */
|
|
530
|
-
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
531
|
-
/** Get entities for room */
|
|
532
|
-
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
533
|
-
/** Create new entity */
|
|
534
|
-
createEntity(entity: Entity): Promise<boolean>;
|
|
535
|
-
/** Update entity */
|
|
536
|
-
updateEntity(entity: Entity): Promise<void>;
|
|
537
|
-
/** Get component by ID */
|
|
538
|
-
getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
539
|
-
/** Get all components for an entity */
|
|
540
|
-
getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
541
|
-
/** Create component */
|
|
542
|
-
createComponent(component: Component): Promise<boolean>;
|
|
543
|
-
/** Update component */
|
|
544
|
-
updateComponent(component: Component): Promise<void>;
|
|
545
|
-
/** Delete component */
|
|
546
|
-
deleteComponent(componentId: UUID): Promise<void>;
|
|
547
|
-
/** Get memories matching criteria */
|
|
548
|
-
getMemories(params: {
|
|
549
|
-
roomId: UUID;
|
|
550
|
-
count?: number;
|
|
551
|
-
unique?: boolean;
|
|
552
|
-
tableName: string;
|
|
553
|
-
start?: number;
|
|
554
|
-
end?: number;
|
|
555
|
-
}): Promise<Memory[]>;
|
|
556
|
-
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
557
|
-
getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
|
|
558
|
-
getMemoriesByRoomIds(params: {
|
|
559
|
-
tableName: string;
|
|
560
|
-
roomIds: UUID[];
|
|
561
|
-
limit?: number;
|
|
562
|
-
}): Promise<Memory[]>;
|
|
563
|
-
getCachedEmbeddings(params: {
|
|
564
|
-
query_table_name: string;
|
|
565
|
-
query_threshold: number;
|
|
566
|
-
query_input: string;
|
|
567
|
-
query_field_name: string;
|
|
568
|
-
query_field_sub_name: string;
|
|
569
|
-
query_match_count: number;
|
|
570
|
-
}): Promise<{
|
|
571
|
-
embedding: number[];
|
|
572
|
-
levenshtein_score: number;
|
|
573
|
-
}[]>;
|
|
574
|
-
log(params: {
|
|
575
|
-
body: {
|
|
576
|
-
[key: string]: unknown;
|
|
577
|
-
};
|
|
578
|
-
entityId: UUID;
|
|
579
|
-
roomId: UUID;
|
|
580
|
-
type: string;
|
|
581
|
-
}): Promise<void>;
|
|
582
|
-
searchMemories(params: {
|
|
583
|
-
embedding: number[];
|
|
584
|
-
match_threshold?: number;
|
|
585
|
-
count?: number;
|
|
586
|
-
roomId?: UUID;
|
|
587
|
-
unique?: boolean;
|
|
588
|
-
tableName: string;
|
|
589
|
-
}): Promise<Memory[]>;
|
|
590
|
-
createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
591
|
-
removeMemory(memoryId: UUID, tableName: string): Promise<void>;
|
|
592
|
-
removeAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
593
|
-
countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
594
|
-
createWorld(world: World): Promise<UUID>;
|
|
595
|
-
getWorld(id: UUID): Promise<World | null>;
|
|
596
|
-
getAllWorlds(): Promise<World[]>;
|
|
597
|
-
updateWorld(world: World): Promise<void>;
|
|
598
|
-
getRoom(roomId: UUID): Promise<Room | null>;
|
|
599
|
-
createRoom({ id, name, source, type, channelId, serverId, worldId, }: Room): Promise<UUID>;
|
|
600
|
-
deleteRoom(roomId: UUID): Promise<void>;
|
|
601
|
-
updateRoom(room: Room): Promise<void>;
|
|
602
|
-
getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
603
|
-
getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
604
|
-
getRooms(worldId: UUID): Promise<Room[]>;
|
|
605
|
-
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
606
|
-
removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
607
|
-
getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
608
|
-
getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
609
|
-
getParticipantUserState(roomId: UUID, entityId: UUID): Promise<"FOLLOWED" | "MUTED" | null>;
|
|
610
|
-
setParticipantUserState(roomId: UUID, entityId: UUID, state: "FOLLOWED" | "MUTED" | null): Promise<void>;
|
|
611
|
-
/**
|
|
612
|
-
* Creates a new relationship between two entities.
|
|
613
|
-
* @param params Object containing the relationship details
|
|
614
|
-
* @returns Promise resolving to boolean indicating success
|
|
615
|
-
*/
|
|
616
|
-
createRelationship(params: {
|
|
617
|
-
sourceEntityId: UUID;
|
|
618
|
-
targetEntityId: UUID;
|
|
619
|
-
tags?: string[];
|
|
620
|
-
metadata?: {
|
|
621
|
-
[key: string]: any;
|
|
622
|
-
};
|
|
623
|
-
}): Promise<boolean>;
|
|
624
|
-
/**
|
|
625
|
-
* Updates an existing relationship between two entities.
|
|
626
|
-
* @param relationship The relationship object with updated data
|
|
627
|
-
* @returns Promise resolving to void
|
|
628
|
-
*/
|
|
629
|
-
updateRelationship(relationship: Relationship): Promise<void>;
|
|
630
|
-
/**
|
|
631
|
-
* Retrieves a relationship between two entities if it exists.
|
|
632
|
-
* @param params Object containing the entity IDs and agent ID
|
|
633
|
-
* @returns Promise resolving to the Relationship object or null if not found
|
|
634
|
-
*/
|
|
635
|
-
getRelationship(params: {
|
|
636
|
-
sourceEntityId: UUID;
|
|
637
|
-
targetEntityId: UUID;
|
|
638
|
-
}): Promise<Relationship | null>;
|
|
639
|
-
/**
|
|
640
|
-
* Retrieves all relationships for a specific entity.
|
|
641
|
-
* @param params Object containing the user ID, agent ID and optional tags to filter by
|
|
642
|
-
* @returns Promise resolving to an array of Relationship objects
|
|
643
|
-
*/
|
|
644
|
-
getRelationships(params: {
|
|
645
|
-
entityId: UUID;
|
|
646
|
-
tags?: string[];
|
|
647
|
-
}): Promise<Relationship[]>;
|
|
648
|
-
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
649
|
-
getCache<T>(key: string): Promise<T | undefined>;
|
|
650
|
-
setCache<T>(key: string, value: T): Promise<boolean>;
|
|
651
|
-
deleteCache(key: string): Promise<boolean>;
|
|
652
|
-
createTask(task: Task): Promise<UUID>;
|
|
653
|
-
getTasks(params: {
|
|
654
|
-
roomId?: UUID;
|
|
655
|
-
tags?: string[];
|
|
656
|
-
}): Promise<Task[]>;
|
|
657
|
-
getTask(id: UUID): Promise<Task | null>;
|
|
658
|
-
getTasksByName(name: string): Promise<Task[]>;
|
|
659
|
-
updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
660
|
-
deleteTask(id: UUID): Promise<void>;
|
|
661
|
-
}
|
|
662
|
-
export interface IMemoryManager {
|
|
663
|
-
runtime: IAgentRuntime;
|
|
664
|
-
tableName: string;
|
|
665
|
-
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
666
|
-
getMemories(opts: {
|
|
667
|
-
roomId: UUID;
|
|
668
|
-
count?: number;
|
|
669
|
-
unique?: boolean;
|
|
670
|
-
start?: number;
|
|
671
|
-
end?: number;
|
|
672
|
-
}): Promise<Memory[]>;
|
|
673
|
-
searchMemories(params: {
|
|
674
|
-
embedding: number[];
|
|
675
|
-
match_threshold?: number;
|
|
676
|
-
count?: number;
|
|
677
|
-
roomId?: UUID;
|
|
678
|
-
unique?: boolean;
|
|
679
|
-
metadata?: MemoryMetadata;
|
|
680
|
-
}): Promise<Memory[]>;
|
|
681
|
-
getCachedEmbeddings(content: string): Promise<{
|
|
682
|
-
embedding: number[];
|
|
683
|
-
levenshtein_score: number;
|
|
684
|
-
}[]>;
|
|
685
|
-
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
686
|
-
getMemoriesByRoomIds(params: {
|
|
687
|
-
roomIds: UUID[];
|
|
688
|
-
limit?: number;
|
|
689
|
-
}): Promise<Memory[]>;
|
|
690
|
-
createMemory(memory: Memory, unique?: boolean): Promise<UUID>;
|
|
691
|
-
removeMemory(memoryId: UUID): Promise<void>;
|
|
692
|
-
removeAllMemories(roomId: UUID): Promise<void>;
|
|
693
|
-
countMemories(roomId: UUID, unique?: boolean): Promise<number>;
|
|
694
|
-
}
|
|
695
|
-
export type CacheOptions = {
|
|
696
|
-
expires?: number;
|
|
697
|
-
};
|
|
698
|
-
export interface IAgentRuntime extends IDatabaseAdapter {
|
|
699
|
-
agentId: UUID;
|
|
700
|
-
databaseAdapter: IDatabaseAdapter;
|
|
701
|
-
character: Character;
|
|
702
|
-
providers: Provider[];
|
|
703
|
-
actions: Action[];
|
|
704
|
-
evaluators: Evaluator[];
|
|
705
|
-
plugins: Plugin[];
|
|
706
|
-
services: Map<ServiceType, Service>;
|
|
707
|
-
events: Map<string, ((params: any) => Promise<void>)[]>;
|
|
708
|
-
fetch?: typeof fetch | null;
|
|
709
|
-
routes: Route[];
|
|
710
|
-
registerPlugin(plugin: Plugin): Promise<void>;
|
|
711
|
-
initialize(): Promise<void>;
|
|
712
|
-
getKnowledge(message: Memory): Promise<KnowledgeItem[]>;
|
|
713
|
-
addKnowledge(item: KnowledgeItem, options: {
|
|
714
|
-
targetTokens: number;
|
|
715
|
-
overlap: number;
|
|
716
|
-
modelContextSize: number;
|
|
717
|
-
}): Promise<void>;
|
|
718
|
-
getMemoryManager(tableName: string): IMemoryManager | null;
|
|
719
|
-
getService<T extends Service>(service: ServiceType | string): T | null;
|
|
720
|
-
getAllServices(): Map<ServiceType, Service>;
|
|
721
|
-
registerService(service: typeof Service): void;
|
|
722
|
-
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
723
|
-
setSetting(key: string, value: string | boolean | null | any, secret: boolean): void;
|
|
724
|
-
getSetting(key: string): string | boolean | null | any;
|
|
725
|
-
getConversationLength(): number;
|
|
726
|
-
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
|
|
727
|
-
evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
|
|
728
|
-
registerProvider(provider: Provider): void;
|
|
729
|
-
registerAction(action: Action): void;
|
|
730
|
-
registerEvaluator(evaluator: Evaluator): void;
|
|
731
|
-
ensureConnection({ entityId, roomId, userName, name, source, channelId, serverId, type, worldId, }: {
|
|
732
|
-
entityId: UUID;
|
|
733
|
-
roomId: UUID;
|
|
734
|
-
userName?: string;
|
|
735
|
-
name?: string;
|
|
736
|
-
source?: string;
|
|
737
|
-
channelId?: string;
|
|
738
|
-
serverId?: string;
|
|
739
|
-
type: ChannelType;
|
|
740
|
-
worldId?: UUID;
|
|
741
|
-
}): Promise<void>;
|
|
742
|
-
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
743
|
-
ensureWorldExists(world: World): Promise<void>;
|
|
744
|
-
ensureRoomExists(room: Room): Promise<void>;
|
|
745
|
-
composeState(message: Memory, filterList?: string[], includeList?: string[]): Promise<State>;
|
|
746
|
-
/**
|
|
747
|
-
* Use a model with strongly typed parameters and return values based on model type
|
|
748
|
-
* @template T - The model type to use
|
|
749
|
-
* @template R - The expected return type, defaults to the type defined in ModelResultMap[T]
|
|
750
|
-
* @param {T} modelType - The type of model to use
|
|
751
|
-
* @param {ModelParamsMap[T] | any} params - The parameters for the model, typed based on model type
|
|
752
|
-
* @returns {Promise<R>} - The model result, typed based on the provided generic type parameter
|
|
753
|
-
*/
|
|
754
|
-
useModel<T extends ModelType, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], "runtime"> | any): Promise<R>;
|
|
755
|
-
registerModel(modelType: ModelType | string, handler: (params: any) => Promise<any>): void;
|
|
756
|
-
getModel(modelType: ModelType | string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
|
|
757
|
-
registerEvent(event: string, handler: (params: any) => Promise<void>): void;
|
|
758
|
-
getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
|
|
759
|
-
emitEvent(event: string | string[], params: any): Promise<void>;
|
|
760
|
-
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
761
|
-
getTaskWorker(name: string): TaskWorker | undefined;
|
|
762
|
-
stop(): Promise<void>;
|
|
763
|
-
}
|
|
764
|
-
export type KnowledgeItem = {
|
|
765
|
-
id: UUID;
|
|
766
|
-
content: Content;
|
|
767
|
-
};
|
|
768
|
-
export declare enum KnowledgeScope {
|
|
769
|
-
SHARED = "shared",
|
|
770
|
-
PRIVATE = "private"
|
|
771
|
-
}
|
|
772
|
-
export declare enum CacheKeyPrefix {
|
|
773
|
-
KNOWLEDGE = "knowledge"
|
|
774
|
-
}
|
|
775
|
-
export interface DirectoryItem {
|
|
776
|
-
directory: string;
|
|
777
|
-
shared?: boolean;
|
|
778
|
-
}
|
|
779
|
-
export interface ChunkRow {
|
|
780
|
-
id: string;
|
|
781
|
-
}
|
|
782
|
-
export type GenerateTextParams = {
|
|
783
|
-
runtime: IAgentRuntime;
|
|
784
|
-
prompt: string;
|
|
785
|
-
modelType: ModelType;
|
|
786
|
-
maxTokens?: number;
|
|
787
|
-
temperature?: number;
|
|
788
|
-
frequencyPenalty?: number;
|
|
789
|
-
presencePenalty?: number;
|
|
790
|
-
stopSequences?: string[];
|
|
791
|
-
};
|
|
792
|
-
export interface TokenizeTextParams {
|
|
793
|
-
prompt: string;
|
|
794
|
-
modelType: ModelType;
|
|
795
|
-
}
|
|
796
|
-
export interface DetokenizeTextParams {
|
|
797
|
-
tokens: number[];
|
|
798
|
-
modelType: ModelType;
|
|
799
|
-
}
|
|
800
|
-
export interface IVideoService extends Service {
|
|
801
|
-
isVideoUrl(url: string): boolean;
|
|
802
|
-
fetchVideoInfo(url: string): Promise<Media>;
|
|
803
|
-
downloadVideo(videoInfo: Media): Promise<string>;
|
|
804
|
-
processVideo(url: string, runtime: IAgentRuntime): Promise<Media>;
|
|
805
|
-
}
|
|
806
|
-
export interface IBrowserService extends Service {
|
|
807
|
-
getPageContent(url: string, runtime: IAgentRuntime): Promise<{
|
|
808
|
-
title: string;
|
|
809
|
-
description: string;
|
|
810
|
-
bodyContent: string;
|
|
811
|
-
}>;
|
|
812
|
-
}
|
|
813
|
-
export interface IPdfService extends Service {
|
|
814
|
-
convertPdfToText(pdfBuffer: Buffer): Promise<string>;
|
|
815
|
-
}
|
|
816
|
-
export interface IFileService extends Service {
|
|
817
|
-
uploadFile(imagePath: string, subDirectory: string, useSignedUrl: boolean, expiresIn: number): Promise<{
|
|
818
|
-
success: boolean;
|
|
819
|
-
url?: string;
|
|
820
|
-
error?: string;
|
|
821
|
-
}>;
|
|
822
|
-
generateSignedUrl(fileName: string, expiresIn: number): Promise<string>;
|
|
823
|
-
}
|
|
824
|
-
export interface ITeeLogService extends Service {
|
|
825
|
-
log(agentId: string, roomId: string, entityId: string, type: string, content: string): Promise<boolean>;
|
|
826
|
-
generateAttestation<T>(reportData: string, hashAlgorithm?: T | any): Promise<string>;
|
|
827
|
-
getAllAgents(): Promise<TeeAgent[]>;
|
|
828
|
-
getAgent(agentId: string): Promise<TeeAgent | null>;
|
|
829
|
-
getLogs(query: TeeLogQuery, page: number, pageSize: number): Promise<TeePageQuery<TeeLog[]>>;
|
|
830
|
-
}
|
|
831
|
-
export interface TestCase {
|
|
832
|
-
name: string;
|
|
833
|
-
fn: (runtime: IAgentRuntime) => Promise<void> | void;
|
|
834
|
-
}
|
|
835
|
-
export interface TestSuite {
|
|
836
|
-
name: string;
|
|
837
|
-
tests: TestCase[];
|
|
838
|
-
}
|
|
839
|
-
export interface TeeLog {
|
|
840
|
-
id: string;
|
|
841
|
-
agentId: string;
|
|
842
|
-
roomId: string;
|
|
843
|
-
entityId: string;
|
|
844
|
-
type: string;
|
|
845
|
-
content: string;
|
|
846
|
-
timestamp: number;
|
|
847
|
-
signature: string;
|
|
848
|
-
}
|
|
849
|
-
export interface TeeLogQuery {
|
|
850
|
-
agentId?: string;
|
|
851
|
-
roomId?: string;
|
|
852
|
-
entityId?: string;
|
|
853
|
-
type?: string;
|
|
854
|
-
containsContent?: string;
|
|
855
|
-
startTimestamp?: number;
|
|
856
|
-
endTimestamp?: number;
|
|
857
|
-
}
|
|
858
|
-
export interface TeeAgent {
|
|
859
|
-
id: string;
|
|
860
|
-
agentId: string;
|
|
861
|
-
agentName: string;
|
|
862
|
-
createdAt: number;
|
|
863
|
-
publicKey: string;
|
|
864
|
-
attestation: string;
|
|
865
|
-
}
|
|
866
|
-
export interface TeePageQuery<Result = any> {
|
|
867
|
-
page: number;
|
|
868
|
-
pageSize: number;
|
|
869
|
-
total?: number;
|
|
870
|
-
data?: Result;
|
|
871
|
-
}
|
|
872
|
-
export declare abstract class TeeLogDAO<DB = any> {
|
|
873
|
-
db: DB;
|
|
874
|
-
abstract initialize(): Promise<void>;
|
|
875
|
-
abstract addLog(log: TeeLog): Promise<boolean>;
|
|
876
|
-
abstract getPagedLogs(query: TeeLogQuery, page: number, pageSize: number): Promise<TeePageQuery<TeeLog[]>>;
|
|
877
|
-
abstract addAgent(agent: TeeAgent): Promise<boolean>;
|
|
878
|
-
abstract getAgent(agentId: string): Promise<TeeAgent>;
|
|
879
|
-
abstract getAllAgents(): Promise<TeeAgent[]>;
|
|
880
|
-
}
|
|
881
|
-
export declare enum TEEMode {
|
|
882
|
-
OFF = "OFF",
|
|
883
|
-
LOCAL = "LOCAL",// For local development with simulator
|
|
884
|
-
DOCKER = "DOCKER",// For docker development with simulator
|
|
885
|
-
PRODUCTION = "PRODUCTION"
|
|
886
|
-
}
|
|
887
|
-
export interface RemoteAttestationQuote {
|
|
888
|
-
quote: string;
|
|
889
|
-
timestamp: number;
|
|
890
|
-
}
|
|
891
|
-
export interface DeriveKeyAttestationData {
|
|
892
|
-
agentId: string;
|
|
893
|
-
publicKey: string;
|
|
894
|
-
subject?: string;
|
|
895
|
-
}
|
|
896
|
-
export interface RemoteAttestationMessage {
|
|
897
|
-
agentId: string;
|
|
898
|
-
timestamp: number;
|
|
899
|
-
message: {
|
|
900
|
-
entityId: string;
|
|
901
|
-
roomId: string;
|
|
902
|
-
content: string;
|
|
903
|
-
};
|
|
904
|
-
}
|
|
905
|
-
export interface SgxAttestation {
|
|
906
|
-
quote: string;
|
|
907
|
-
timestamp: number;
|
|
908
|
-
}
|
|
909
|
-
export declare enum TeeType {
|
|
910
|
-
SGX_GRAMINE = "sgx_gramine",
|
|
911
|
-
TDX_DSTACK = "tdx_dstack"
|
|
912
|
-
}
|
|
913
|
-
export interface TeeVendorConfig {
|
|
914
|
-
[key: string]: unknown;
|
|
915
|
-
}
|
|
916
|
-
export interface TeePluginConfig {
|
|
917
|
-
vendor?: string;
|
|
918
|
-
vendorConfig?: TeeVendorConfig;
|
|
919
|
-
}
|
|
920
|
-
export interface TaskWorker {
|
|
921
|
-
name: string;
|
|
922
|
-
execute: (runtime: IAgentRuntime, options: {
|
|
923
|
-
[key: string]: unknown;
|
|
924
|
-
}, task: Task) => Promise<void>;
|
|
925
|
-
validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
|
|
926
|
-
}
|
|
927
|
-
export interface Task {
|
|
928
|
-
id?: UUID;
|
|
929
|
-
name: string;
|
|
930
|
-
updatedAt?: number;
|
|
931
|
-
metadata?: {
|
|
932
|
-
updateInterval?: number;
|
|
933
|
-
options?: {
|
|
934
|
-
name: string;
|
|
935
|
-
description: string;
|
|
936
|
-
}[];
|
|
937
|
-
[key: string]: unknown;
|
|
938
|
-
};
|
|
939
|
-
description: string;
|
|
940
|
-
roomId?: UUID;
|
|
941
|
-
worldId?: UUID;
|
|
942
|
-
tags: string[];
|
|
943
|
-
}
|
|
944
|
-
export declare enum Role {
|
|
945
|
-
OWNER = "OWNER",
|
|
946
|
-
ADMIN = "ADMIN",
|
|
947
|
-
NONE = "NONE"
|
|
948
|
-
}
|
|
949
|
-
export interface Setting {
|
|
950
|
-
name: string;
|
|
951
|
-
description: string;
|
|
952
|
-
usageDescription: string;
|
|
953
|
-
value: string | boolean | null;
|
|
954
|
-
required: boolean;
|
|
955
|
-
public?: boolean;
|
|
956
|
-
secret?: boolean;
|
|
957
|
-
validation?: (value: any) => boolean;
|
|
958
|
-
dependsOn?: string[];
|
|
959
|
-
onSetAction?: (value: any) => string;
|
|
960
|
-
visibleIf?: (settings: {
|
|
961
|
-
[key: string]: Setting;
|
|
962
|
-
}) => boolean;
|
|
963
|
-
}
|
|
964
|
-
export interface WorldSettings {
|
|
965
|
-
[key: string]: Setting;
|
|
966
|
-
}
|
|
967
|
-
export interface OnboardingConfig {
|
|
968
|
-
settings: {
|
|
969
|
-
[key: string]: Omit<Setting, "value">;
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
/**
|
|
973
|
-
* Base parameters common to all model types
|
|
974
|
-
*/
|
|
975
|
-
export interface BaseModelParams {
|
|
976
|
-
/** The agent runtime for accessing services and utilities */
|
|
977
|
-
runtime: IAgentRuntime;
|
|
978
|
-
}
|
|
979
|
-
/**
|
|
980
|
-
* Parameters for text generation models
|
|
981
|
-
*/
|
|
982
|
-
export interface TextGenerationParams extends BaseModelParams {
|
|
983
|
-
/** The prompt to generate text from */
|
|
984
|
-
prompt: string;
|
|
985
|
-
/** Model temperature (0.0 to 1.0, lower is more deterministic) */
|
|
986
|
-
temperature?: number;
|
|
987
|
-
/** Maximum number of tokens to generate */
|
|
988
|
-
maxTokens?: number;
|
|
989
|
-
/** Sequences that should stop generation when encountered */
|
|
990
|
-
stopSequences?: string[];
|
|
991
|
-
/** Frequency penalty to apply */
|
|
992
|
-
frequencyPenalty?: number;
|
|
993
|
-
/** Presence penalty to apply */
|
|
994
|
-
presencePenalty?: number;
|
|
995
|
-
}
|
|
996
|
-
/**
|
|
997
|
-
* Parameters for text embedding models
|
|
998
|
-
*/
|
|
999
|
-
export interface TextEmbeddingParams extends BaseModelParams {
|
|
1000
|
-
/** The text to create embeddings for */
|
|
1001
|
-
text: string;
|
|
1002
|
-
}
|
|
1003
|
-
/**
|
|
1004
|
-
* Parameters for text tokenization models
|
|
1005
|
-
*/
|
|
1006
|
-
export interface TokenizeTextParams extends BaseModelParams {
|
|
1007
|
-
/** The text to tokenize */
|
|
1008
|
-
prompt: string;
|
|
1009
|
-
/** The model type to use for tokenization */
|
|
1010
|
-
modelType: ModelType;
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Parameters for text detokenization models
|
|
1014
|
-
*/
|
|
1015
|
-
export interface DetokenizeTextParams extends BaseModelParams {
|
|
1016
|
-
/** The tokens to convert back to text */
|
|
1017
|
-
tokens: number[];
|
|
1018
|
-
/** The model type to use for detokenization */
|
|
1019
|
-
modelType: ModelType;
|
|
1020
|
-
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Parameters for image generation models
|
|
1023
|
-
*/
|
|
1024
|
-
export interface ImageGenerationParams extends BaseModelParams {
|
|
1025
|
-
/** The prompt describing the image to generate */
|
|
1026
|
-
prompt: string;
|
|
1027
|
-
/** The dimensions of the image to generate */
|
|
1028
|
-
size?: string;
|
|
1029
|
-
/** Number of images to generate */
|
|
1030
|
-
count?: number;
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Parameters for image description models
|
|
1034
|
-
*/
|
|
1035
|
-
export interface ImageDescriptionParams extends BaseModelParams {
|
|
1036
|
-
/** The URL or path of the image to describe */
|
|
1037
|
-
imageUrl: string;
|
|
1038
|
-
/** Optional prompt to guide the description */
|
|
1039
|
-
prompt?: string;
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* Parameters for transcription models
|
|
1043
|
-
*/
|
|
1044
|
-
export interface TranscriptionParams extends BaseModelParams {
|
|
1045
|
-
/** The URL or path of the audio file to transcribe */
|
|
1046
|
-
audioUrl: string;
|
|
1047
|
-
/** Optional prompt to guide transcription */
|
|
1048
|
-
prompt?: string;
|
|
1049
|
-
}
|
|
1050
|
-
/**
|
|
1051
|
-
* Parameters for text-to-speech models
|
|
1052
|
-
*/
|
|
1053
|
-
export interface TextToSpeechParams extends BaseModelParams {
|
|
1054
|
-
/** The text to convert to speech */
|
|
1055
|
-
text: string;
|
|
1056
|
-
/** The voice to use */
|
|
1057
|
-
voice?: string;
|
|
1058
|
-
/** The speaking speed */
|
|
1059
|
-
speed?: number;
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* Parameters for audio processing models
|
|
1063
|
-
*/
|
|
1064
|
-
export interface AudioProcessingParams extends BaseModelParams {
|
|
1065
|
-
/** The URL or path of the audio file to process */
|
|
1066
|
-
audioUrl: string;
|
|
1067
|
-
/** The type of audio processing to perform */
|
|
1068
|
-
processingType: string;
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Parameters for video processing models
|
|
1072
|
-
*/
|
|
1073
|
-
export interface VideoProcessingParams extends BaseModelParams {
|
|
1074
|
-
/** The URL or path of the video file to process */
|
|
1075
|
-
videoUrl: string;
|
|
1076
|
-
/** The type of video processing to perform */
|
|
1077
|
-
processingType: string;
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Optional JSON schema for validating generated objects
|
|
1081
|
-
*/
|
|
1082
|
-
export type JSONSchema = {
|
|
1083
|
-
type: string;
|
|
1084
|
-
properties?: Record<string, any>;
|
|
1085
|
-
required?: string[];
|
|
1086
|
-
items?: JSONSchema;
|
|
1087
|
-
[key: string]: any;
|
|
1088
|
-
};
|
|
1089
|
-
/**
|
|
1090
|
-
* Parameters for object generation models
|
|
1091
|
-
* @template T - The expected return type, inferred from schema if provided
|
|
1092
|
-
*/
|
|
1093
|
-
export interface ObjectGenerationParams<T = any> extends BaseModelParams {
|
|
1094
|
-
/** The prompt describing the object to generate */
|
|
1095
|
-
prompt: string;
|
|
1096
|
-
/** Optional JSON schema for validation */
|
|
1097
|
-
schema?: JSONSchema;
|
|
1098
|
-
/** Type of object to generate */
|
|
1099
|
-
output?: "object" | "array" | "enum";
|
|
1100
|
-
/** For enum type, the allowed values */
|
|
1101
|
-
enumValues?: string[];
|
|
1102
|
-
/** Model type to use */
|
|
1103
|
-
modelType?: ModelType;
|
|
1104
|
-
/** Model temperature (0.0 to 1.0) */
|
|
1105
|
-
temperature?: number;
|
|
1106
|
-
/** Sequences that should stop generation */
|
|
1107
|
-
stopSequences?: string[];
|
|
1108
|
-
}
|
|
1109
|
-
/**
|
|
1110
|
-
* Map of model types to their parameter types
|
|
1111
|
-
*/
|
|
1112
|
-
export interface ModelParamsMap {
|
|
1113
|
-
[ModelTypes.TEXT_SMALL]: TextGenerationParams;
|
|
1114
|
-
[ModelTypes.TEXT_LARGE]: TextGenerationParams;
|
|
1115
|
-
[ModelTypes.TEXT_EMBEDDING]: TextEmbeddingParams | string | null;
|
|
1116
|
-
[ModelTypes.TEXT_TOKENIZER_ENCODE]: TokenizeTextParams;
|
|
1117
|
-
[ModelTypes.TEXT_TOKENIZER_DECODE]: DetokenizeTextParams;
|
|
1118
|
-
[ModelTypes.TEXT_REASONING_SMALL]: TextGenerationParams;
|
|
1119
|
-
[ModelTypes.TEXT_REASONING_LARGE]: TextGenerationParams;
|
|
1120
|
-
[ModelTypes.IMAGE]: ImageGenerationParams;
|
|
1121
|
-
[ModelTypes.IMAGE_DESCRIPTION]: ImageDescriptionParams | string;
|
|
1122
|
-
[ModelTypes.TRANSCRIPTION]: TranscriptionParams | Buffer | string;
|
|
1123
|
-
[ModelTypes.TEXT_TO_SPEECH]: TextToSpeechParams | string;
|
|
1124
|
-
[ModelTypes.AUDIO]: AudioProcessingParams;
|
|
1125
|
-
[ModelTypes.VIDEO]: VideoProcessingParams;
|
|
1126
|
-
[ModelTypes.OBJECT_SMALL]: ObjectGenerationParams<any>;
|
|
1127
|
-
[ModelTypes.OBJECT_LARGE]: ObjectGenerationParams<any>;
|
|
1128
|
-
[key: string]: BaseModelParams | any;
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Map of model types to their return value types
|
|
1132
|
-
*/
|
|
1133
|
-
export interface ModelResultMap {
|
|
1134
|
-
[ModelTypes.TEXT_SMALL]: string;
|
|
1135
|
-
[ModelTypes.TEXT_LARGE]: string;
|
|
1136
|
-
[ModelTypes.TEXT_EMBEDDING]: number[];
|
|
1137
|
-
[ModelTypes.TEXT_TOKENIZER_ENCODE]: number[];
|
|
1138
|
-
[ModelTypes.TEXT_TOKENIZER_DECODE]: string;
|
|
1139
|
-
[ModelTypes.TEXT_REASONING_SMALL]: string;
|
|
1140
|
-
[ModelTypes.TEXT_REASONING_LARGE]: string;
|
|
1141
|
-
[ModelTypes.IMAGE]: {
|
|
1142
|
-
url: string;
|
|
1143
|
-
}[];
|
|
1144
|
-
[ModelTypes.IMAGE_DESCRIPTION]: {
|
|
1145
|
-
title: string;
|
|
1146
|
-
description: string;
|
|
1147
|
-
};
|
|
1148
|
-
[ModelTypes.TRANSCRIPTION]: string;
|
|
1149
|
-
[ModelTypes.TEXT_TO_SPEECH]: Readable | Buffer;
|
|
1150
|
-
[ModelTypes.AUDIO]: any;
|
|
1151
|
-
[ModelTypes.VIDEO]: any;
|
|
1152
|
-
[ModelTypes.OBJECT_SMALL]: any;
|
|
1153
|
-
[ModelTypes.OBJECT_LARGE]: any;
|
|
1154
|
-
[key: string]: any;
|
|
1155
|
-
}
|
|
1156
|
-
/**
|
|
1157
|
-
* Standard event types across all platforms
|
|
1158
|
-
*/
|
|
1159
|
-
export declare enum EventTypes {
|
|
1160
|
-
WORLD_JOINED = "WORLD_JOINED",
|
|
1161
|
-
WORLD_CONNECTED = "WORLD_CONNECTED",
|
|
1162
|
-
WORLD_LEFT = "WORLD_LEFT",
|
|
1163
|
-
ENTITY_JOINED = "ENTITY_JOINED",
|
|
1164
|
-
ENTITY_LEFT = "ENTITY_LEFT",
|
|
1165
|
-
ENTITY_UPDATED = "ENTITY_UPDATED",
|
|
1166
|
-
ROOM_JOINED = "ROOM_JOINED",
|
|
1167
|
-
ROOM_LEFT = "ROOM_LEFT",
|
|
1168
|
-
MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
|
|
1169
|
-
MESSAGE_SENT = "MESSAGE_SENT",
|
|
1170
|
-
VOICE_MESSAGE_RECEIVED = "VOICE_MESSAGE_RECEIVED",
|
|
1171
|
-
VOICE_MESSAGE_SENT = "VOICE_MESSAGE_SENT",
|
|
1172
|
-
REACTION_RECEIVED = "REACTION_RECEIVED",
|
|
1173
|
-
POST_GENERATED = "POST_GENERATED",
|
|
1174
|
-
INTERACTION_RECEIVED = "INTERACTION_RECEIVED",
|
|
1175
|
-
RUN_STARTED = "RUN_STARTED",
|
|
1176
|
-
RUN_ENDED = "RUN_ENDED",
|
|
1177
|
-
RUN_TIMEOUT = "RUN_TIMEOUT",
|
|
1178
|
-
ACTION_STARTED = "ACTION_STARTED",
|
|
1179
|
-
ACTION_COMPLETED = "ACTION_COMPLETED",
|
|
1180
|
-
EVALUATOR_STARTED = "EVALUATOR_STARTED",
|
|
1181
|
-
EVALUATOR_COMPLETED = "EVALUATOR_COMPLETED"
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Platform-specific event type prefix
|
|
1185
|
-
*/
|
|
1186
|
-
export declare enum PlatformPrefix {
|
|
1187
|
-
DISCORD = "DISCORD",
|
|
1188
|
-
TELEGRAM = "TELEGRAM",
|
|
1189
|
-
TWITTER = "TWITTER"
|
|
1190
|
-
}
|
|
1191
|
-
/**
|
|
1192
|
-
* Base payload interface for all events
|
|
1193
|
-
*/
|
|
1194
|
-
export interface EventPayload {
|
|
1195
|
-
runtime: IAgentRuntime;
|
|
1196
|
-
source: string;
|
|
1197
|
-
}
|
|
1198
|
-
/**
|
|
1199
|
-
* Payload for world-related events
|
|
1200
|
-
*/
|
|
1201
|
-
export interface WorldPayload extends EventPayload {
|
|
1202
|
-
world: World;
|
|
1203
|
-
rooms: Room[];
|
|
1204
|
-
entities: Entity[];
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
* Payload for entity-related events
|
|
1208
|
-
*/
|
|
1209
|
-
export interface EntityPayload extends EventPayload {
|
|
1210
|
-
entityId: UUID;
|
|
1211
|
-
worldId?: UUID;
|
|
1212
|
-
roomId?: UUID;
|
|
1213
|
-
metadata?: {
|
|
1214
|
-
orginalId: string;
|
|
1215
|
-
username: string;
|
|
1216
|
-
displayName?: string;
|
|
1217
|
-
[key: string]: any;
|
|
1218
|
-
};
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Payload for reaction-related events
|
|
1222
|
-
*/
|
|
1223
|
-
export interface MessagePayload extends EventPayload {
|
|
1224
|
-
message: Memory;
|
|
1225
|
-
callback?: HandlerCallback;
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
* Run event payload type
|
|
1229
|
-
*/
|
|
1230
|
-
export interface RunEventPayload extends EventPayload {
|
|
1231
|
-
runId: UUID;
|
|
1232
|
-
messageId: UUID;
|
|
1233
|
-
roomId: UUID;
|
|
1234
|
-
entityId: UUID;
|
|
1235
|
-
startTime: number;
|
|
1236
|
-
status: "started" | "completed" | "timeout";
|
|
1237
|
-
endTime?: number;
|
|
1238
|
-
duration?: number;
|
|
1239
|
-
error?: string;
|
|
1240
|
-
}
|
|
1241
|
-
/**
|
|
1242
|
-
* Action event payload type
|
|
1243
|
-
*/
|
|
1244
|
-
export interface ActionEventPayload extends EventPayload {
|
|
1245
|
-
actionId: UUID;
|
|
1246
|
-
actionName: string;
|
|
1247
|
-
startTime?: number;
|
|
1248
|
-
completed?: boolean;
|
|
1249
|
-
error?: Error;
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Evaluator event payload type
|
|
1253
|
-
*/
|
|
1254
|
-
export interface EvaluatorEventPayload extends EventPayload {
|
|
1255
|
-
evaluatorId: UUID;
|
|
1256
|
-
evaluatorName: string;
|
|
1257
|
-
startTime?: number;
|
|
1258
|
-
completed?: boolean;
|
|
1259
|
-
error?: Error;
|
|
1260
|
-
}
|
|
1261
|
-
/**
|
|
1262
|
-
* Maps event types to their corresponding payload types
|
|
1263
|
-
*/
|
|
1264
|
-
export interface EventPayloadMap {
|
|
1265
|
-
[EventTypes.WORLD_JOINED]: WorldPayload;
|
|
1266
|
-
[EventTypes.WORLD_CONNECTED]: WorldPayload;
|
|
1267
|
-
[EventTypes.WORLD_LEFT]: WorldPayload;
|
|
1268
|
-
[EventTypes.ENTITY_JOINED]: EntityPayload;
|
|
1269
|
-
[EventTypes.ENTITY_LEFT]: EntityPayload;
|
|
1270
|
-
[EventTypes.ENTITY_UPDATED]: EntityPayload;
|
|
1271
|
-
[EventTypes.MESSAGE_RECEIVED]: MessagePayload;
|
|
1272
|
-
[EventTypes.MESSAGE_SENT]: MessagePayload;
|
|
1273
|
-
[EventTypes.REACTION_RECEIVED]: MessagePayload;
|
|
1274
|
-
[EventTypes.POST_GENERATED]: MessagePayload;
|
|
1275
|
-
[EventTypes.INTERACTION_RECEIVED]: MessagePayload;
|
|
1276
|
-
[EventTypes.RUN_STARTED]: RunEventPayload;
|
|
1277
|
-
[EventTypes.RUN_ENDED]: RunEventPayload;
|
|
1278
|
-
[EventTypes.RUN_TIMEOUT]: RunEventPayload;
|
|
1279
|
-
[EventTypes.ACTION_STARTED]: ActionEventPayload;
|
|
1280
|
-
[EventTypes.ACTION_COMPLETED]: ActionEventPayload;
|
|
1281
|
-
[EventTypes.EVALUATOR_STARTED]: EvaluatorEventPayload;
|
|
1282
|
-
[EventTypes.EVALUATOR_COMPLETED]: EvaluatorEventPayload;
|
|
1283
|
-
}
|
|
1284
|
-
/**
|
|
1285
|
-
* Event handler function type
|
|
1286
|
-
*/
|
|
1287
|
-
export type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
|
|
1288
|
-
/**
|
|
1289
|
-
* Update the Plugin interface with typed events
|
|
1290
|
-
*/
|
|
1291
|
-
export declare enum SOCKET_MESSAGE_TYPE {
|
|
1292
|
-
ROOM_JOINING = 1,
|
|
1293
|
-
SEND_MESSAGE = 2
|
|
1294
|
-
}
|