@elizaos/core 1.0.0-beta.37 → 1.0.0-beta.38
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/index.d.ts +2861 -14
- package/dist/index.js +37 -9110
- package/package.json +5 -14
- package/dist/actions.d.ts +0 -28
- package/dist/audioUtils.d.ts +0 -23
- package/dist/database.d.ts +0 -449
- 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 -4
- package/dist/prompts.d.ts +0 -202
- package/dist/roles.d.ts +0 -29
- package/dist/runtime.d.ts +0 -355
- package/dist/settings.d.ts +0 -92
- 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 -1537
- package/dist/utils.d.ts +0 -1
- package/dist/uuid.d.ts +0 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,2861 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import * as pino from 'pino';
|
|
2
|
+
import { Tracer, Meter, Span, Context } from '@opentelemetry/api';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { Buffer as Buffer$1 } from 'buffer';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Type definition for a Universally Unique Identifier (UUID) using a specific format.
|
|
8
|
+
* @typedef {`${string}-${string}-${string}-${string}-${string}`} UUID
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Defines a custom type UUID representing a universally unique identifier
|
|
12
|
+
*/
|
|
13
|
+
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
14
|
+
/**
|
|
15
|
+
* Helper function to safely cast a string to strongly typed UUID
|
|
16
|
+
* @param id The string UUID to validate and cast
|
|
17
|
+
* @returns The same UUID with branded type information
|
|
18
|
+
*/
|
|
19
|
+
declare function asUUID(id: string): UUID;
|
|
20
|
+
/**
|
|
21
|
+
* Represents the content of a memory, message, or other information
|
|
22
|
+
*/
|
|
23
|
+
interface Content {
|
|
24
|
+
/** The agent's internal thought process */
|
|
25
|
+
thought?: string;
|
|
26
|
+
/** The main text content visible to users */
|
|
27
|
+
text?: string;
|
|
28
|
+
/** Optional actions to be performed */
|
|
29
|
+
actions?: string[];
|
|
30
|
+
/** Optional providers to use for context generation */
|
|
31
|
+
providers?: string[];
|
|
32
|
+
/** Optional source/origin of the content */
|
|
33
|
+
source?: string;
|
|
34
|
+
/** URL of the original message/post (e.g. tweet URL, Discord message link) */
|
|
35
|
+
url?: string;
|
|
36
|
+
/** UUID of parent message if this is a reply/thread */
|
|
37
|
+
inReplyTo?: UUID;
|
|
38
|
+
/** Array of media attachments */
|
|
39
|
+
attachments?: Media[];
|
|
40
|
+
/**
|
|
41
|
+
* Additional dynamic properties
|
|
42
|
+
* Use specific properties above instead of this when possible
|
|
43
|
+
*/
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Example content with associated user for demonstration purposes
|
|
48
|
+
*/
|
|
49
|
+
interface ActionExample {
|
|
50
|
+
/** User associated with the example */
|
|
51
|
+
name: string;
|
|
52
|
+
/** Content of the example */
|
|
53
|
+
content: Content;
|
|
54
|
+
}
|
|
55
|
+
type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
|
|
56
|
+
/**
|
|
57
|
+
* Model size/type classification
|
|
58
|
+
*/
|
|
59
|
+
declare const ModelType: {
|
|
60
|
+
readonly SMALL: "TEXT_SMALL";
|
|
61
|
+
readonly MEDIUM: "TEXT_LARGE";
|
|
62
|
+
readonly LARGE: "TEXT_LARGE";
|
|
63
|
+
readonly TEXT_SMALL: "TEXT_SMALL";
|
|
64
|
+
readonly TEXT_LARGE: "TEXT_LARGE";
|
|
65
|
+
readonly TEXT_EMBEDDING: "TEXT_EMBEDDING";
|
|
66
|
+
readonly TEXT_TOKENIZER_ENCODE: "TEXT_TOKENIZER_ENCODE";
|
|
67
|
+
readonly TEXT_TOKENIZER_DECODE: "TEXT_TOKENIZER_DECODE";
|
|
68
|
+
readonly TEXT_REASONING_SMALL: "REASONING_SMALL";
|
|
69
|
+
readonly TEXT_REASONING_LARGE: "REASONING_LARGE";
|
|
70
|
+
readonly TEXT_COMPLETION: "TEXT_COMPLETION";
|
|
71
|
+
readonly IMAGE: "IMAGE";
|
|
72
|
+
readonly IMAGE_DESCRIPTION: "IMAGE_DESCRIPTION";
|
|
73
|
+
readonly TRANSCRIPTION: "TRANSCRIPTION";
|
|
74
|
+
readonly TEXT_TO_SPEECH: "TEXT_TO_SPEECH";
|
|
75
|
+
readonly AUDIO: "AUDIO";
|
|
76
|
+
readonly VIDEO: "VIDEO";
|
|
77
|
+
readonly OBJECT_SMALL: "OBJECT_SMALL";
|
|
78
|
+
readonly OBJECT_LARGE: "OBJECT_LARGE";
|
|
79
|
+
};
|
|
80
|
+
type ServiceTypeName = (typeof ServiceType)[keyof typeof ServiceType];
|
|
81
|
+
declare const ServiceType: {
|
|
82
|
+
readonly TRANSCRIPTION: "transcription";
|
|
83
|
+
readonly VIDEO: "video";
|
|
84
|
+
readonly BROWSER: "browser";
|
|
85
|
+
readonly PDF: "pdf";
|
|
86
|
+
readonly REMOTE_FILES: "aws_s3";
|
|
87
|
+
readonly WEB_SEARCH: "web_search";
|
|
88
|
+
readonly EMAIL: "email";
|
|
89
|
+
readonly TEE: "tee";
|
|
90
|
+
readonly TASK: "task";
|
|
91
|
+
readonly INSTRUMENTATION: "instrumentation";
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Represents the current state/context of a conversation
|
|
95
|
+
*/
|
|
96
|
+
interface State {
|
|
97
|
+
/** Additional dynamic properties */
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
values: {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
};
|
|
102
|
+
data: {
|
|
103
|
+
[key: string]: any;
|
|
104
|
+
};
|
|
105
|
+
text: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Memory type enumeration for built-in memory types
|
|
109
|
+
*/
|
|
110
|
+
type MemoryTypeAlias = string;
|
|
111
|
+
declare enum MemoryType {
|
|
112
|
+
DOCUMENT = "document",
|
|
113
|
+
FRAGMENT = "fragment",
|
|
114
|
+
MESSAGE = "message",
|
|
115
|
+
DESCRIPTION = "description",
|
|
116
|
+
CUSTOM = "custom"
|
|
117
|
+
}
|
|
118
|
+
type MemoryScope = 'shared' | 'private' | 'room';
|
|
119
|
+
/**
|
|
120
|
+
* Base interface for all memory metadata types
|
|
121
|
+
*/
|
|
122
|
+
interface BaseMetadata {
|
|
123
|
+
type: MemoryTypeAlias;
|
|
124
|
+
source?: string;
|
|
125
|
+
sourceId?: UUID;
|
|
126
|
+
scope?: MemoryScope;
|
|
127
|
+
timestamp?: number;
|
|
128
|
+
tags?: string[];
|
|
129
|
+
}
|
|
130
|
+
interface DocumentMetadata extends BaseMetadata {
|
|
131
|
+
type: MemoryType.DOCUMENT;
|
|
132
|
+
}
|
|
133
|
+
interface FragmentMetadata extends BaseMetadata {
|
|
134
|
+
type: MemoryType.FRAGMENT;
|
|
135
|
+
documentId: UUID;
|
|
136
|
+
position: number;
|
|
137
|
+
}
|
|
138
|
+
interface MessageMetadata extends BaseMetadata {
|
|
139
|
+
type: MemoryType.MESSAGE;
|
|
140
|
+
}
|
|
141
|
+
interface DescriptionMetadata extends BaseMetadata {
|
|
142
|
+
type: MemoryType.DESCRIPTION;
|
|
143
|
+
}
|
|
144
|
+
interface CustomMetadata extends BaseMetadata {
|
|
145
|
+
[key: string]: unknown;
|
|
146
|
+
}
|
|
147
|
+
type MemoryMetadata = DocumentMetadata | FragmentMetadata | MessageMetadata | DescriptionMetadata | CustomMetadata;
|
|
148
|
+
/**
|
|
149
|
+
* Represents a stored memory/message
|
|
150
|
+
*/
|
|
151
|
+
interface Memory {
|
|
152
|
+
/** Optional unique identifier */
|
|
153
|
+
id?: UUID;
|
|
154
|
+
/** Associated user ID */
|
|
155
|
+
entityId: UUID;
|
|
156
|
+
/** Associated agent ID */
|
|
157
|
+
agentId?: UUID;
|
|
158
|
+
/** Optional creation timestamp in milliseconds since epoch */
|
|
159
|
+
createdAt?: number;
|
|
160
|
+
/** Memory content */
|
|
161
|
+
content: Content;
|
|
162
|
+
/** Optional embedding vector for semantic search */
|
|
163
|
+
embedding?: number[];
|
|
164
|
+
/** Associated room ID */
|
|
165
|
+
roomId: UUID;
|
|
166
|
+
/** Whether memory is unique (used to prevent duplicates) */
|
|
167
|
+
unique?: boolean;
|
|
168
|
+
/** Embedding similarity score (set when retrieved via search) */
|
|
169
|
+
similarity?: number;
|
|
170
|
+
/** Metadata for the memory */
|
|
171
|
+
metadata?: MemoryMetadata;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Represents a log entry
|
|
175
|
+
*/
|
|
176
|
+
interface Log {
|
|
177
|
+
/** Optional unique identifier */
|
|
178
|
+
id?: UUID;
|
|
179
|
+
/** Associated entity ID */
|
|
180
|
+
entityId: UUID;
|
|
181
|
+
/** Associated room ID */
|
|
182
|
+
roomId?: UUID;
|
|
183
|
+
/** Log body */
|
|
184
|
+
body: {
|
|
185
|
+
[key: string]: unknown;
|
|
186
|
+
};
|
|
187
|
+
/** Log type */
|
|
188
|
+
type: string;
|
|
189
|
+
/** Log creation timestamp */
|
|
190
|
+
createdAt: Date;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Example message for demonstration
|
|
194
|
+
*/
|
|
195
|
+
interface MessageExample {
|
|
196
|
+
/** Associated user */
|
|
197
|
+
name: string;
|
|
198
|
+
/** Message content */
|
|
199
|
+
content: Content;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Handler function type for processing messages
|
|
203
|
+
*/
|
|
204
|
+
type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
|
|
205
|
+
[key: string]: unknown;
|
|
206
|
+
}, callback?: HandlerCallback, responses?: Memory[]) => Promise<unknown>;
|
|
207
|
+
/**
|
|
208
|
+
* Callback function type for handlers
|
|
209
|
+
*/
|
|
210
|
+
type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
|
|
211
|
+
/**
|
|
212
|
+
* Validator function type for actions/evaluators
|
|
213
|
+
*/
|
|
214
|
+
type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
|
|
215
|
+
/**
|
|
216
|
+
* Represents an action the agent can perform
|
|
217
|
+
*/
|
|
218
|
+
interface Action {
|
|
219
|
+
/** Similar action descriptions */
|
|
220
|
+
similes?: string[];
|
|
221
|
+
/** Detailed description */
|
|
222
|
+
description: string;
|
|
223
|
+
/** Example usages */
|
|
224
|
+
examples?: ActionExample[][];
|
|
225
|
+
/** Handler function */
|
|
226
|
+
handler: Handler;
|
|
227
|
+
/** Action name */
|
|
228
|
+
name: string;
|
|
229
|
+
/** Validation function */
|
|
230
|
+
validate: Validator;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Example for evaluating agent behavior
|
|
234
|
+
*/
|
|
235
|
+
interface EvaluationExample {
|
|
236
|
+
/** Evaluation context */
|
|
237
|
+
prompt: string;
|
|
238
|
+
/** Example messages */
|
|
239
|
+
messages: Array<ActionExample>;
|
|
240
|
+
/** Expected outcome */
|
|
241
|
+
outcome: string;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Evaluator for assessing agent responses
|
|
245
|
+
*/
|
|
246
|
+
interface Evaluator {
|
|
247
|
+
/** Whether to always run */
|
|
248
|
+
alwaysRun?: boolean;
|
|
249
|
+
/** Detailed description */
|
|
250
|
+
description: string;
|
|
251
|
+
/** Similar evaluator descriptions */
|
|
252
|
+
similes?: string[];
|
|
253
|
+
/** Example evaluations */
|
|
254
|
+
examples: EvaluationExample[];
|
|
255
|
+
/** Handler function */
|
|
256
|
+
handler: Handler;
|
|
257
|
+
/** Evaluator name */
|
|
258
|
+
name: string;
|
|
259
|
+
/** Validation function */
|
|
260
|
+
validate: Validator;
|
|
261
|
+
}
|
|
262
|
+
interface ProviderResult {
|
|
263
|
+
values?: {
|
|
264
|
+
[key: string]: any;
|
|
265
|
+
};
|
|
266
|
+
data?: {
|
|
267
|
+
[key: string]: any;
|
|
268
|
+
};
|
|
269
|
+
text?: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Provider for external data/services
|
|
273
|
+
*/
|
|
274
|
+
interface Provider {
|
|
275
|
+
/** Provider name */
|
|
276
|
+
name: string;
|
|
277
|
+
/** Description of the provider */
|
|
278
|
+
description?: string;
|
|
279
|
+
/** Whether the provider is dynamic */
|
|
280
|
+
dynamic?: boolean;
|
|
281
|
+
/** Position of the provider in the provider list, positive or negative */
|
|
282
|
+
position?: number;
|
|
283
|
+
/**
|
|
284
|
+
* Whether the provider is private
|
|
285
|
+
*
|
|
286
|
+
* Private providers are not displayed in the regular provider list, they have to be called explicitly
|
|
287
|
+
*/
|
|
288
|
+
private?: boolean;
|
|
289
|
+
/** Data retrieval function */
|
|
290
|
+
get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Represents a relationship between users
|
|
294
|
+
*/
|
|
295
|
+
interface Relationship {
|
|
296
|
+
/** Unique identifier */
|
|
297
|
+
id: UUID;
|
|
298
|
+
/** First user ID */
|
|
299
|
+
sourceEntityId: UUID;
|
|
300
|
+
/** Second user ID */
|
|
301
|
+
targetEntityId: UUID;
|
|
302
|
+
/** Agent ID */
|
|
303
|
+
agentId: UUID;
|
|
304
|
+
/** Tags for filtering/categorizing relationships */
|
|
305
|
+
tags: string[];
|
|
306
|
+
/** Additional metadata about the relationship */
|
|
307
|
+
metadata: {
|
|
308
|
+
[key: string]: any;
|
|
309
|
+
};
|
|
310
|
+
/** Optional creation timestamp */
|
|
311
|
+
createdAt?: string;
|
|
312
|
+
}
|
|
313
|
+
interface Component {
|
|
314
|
+
id: UUID;
|
|
315
|
+
entityId: UUID;
|
|
316
|
+
agentId: UUID;
|
|
317
|
+
roomId: UUID;
|
|
318
|
+
worldId: UUID;
|
|
319
|
+
sourceEntityId: UUID;
|
|
320
|
+
type: string;
|
|
321
|
+
data: {
|
|
322
|
+
[key: string]: any;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Represents a user account
|
|
327
|
+
*/
|
|
328
|
+
interface Entity {
|
|
329
|
+
/** Unique identifier, optional on creation */
|
|
330
|
+
id?: UUID;
|
|
331
|
+
/** Names of the entity */
|
|
332
|
+
names: string[];
|
|
333
|
+
/** Optional additional metadata */
|
|
334
|
+
metadata?: {
|
|
335
|
+
[key: string]: any;
|
|
336
|
+
};
|
|
337
|
+
/** Agent ID this account is related to, for agents should be themselves */
|
|
338
|
+
agentId: UUID;
|
|
339
|
+
/** Optional array of components */
|
|
340
|
+
components?: Component[];
|
|
341
|
+
}
|
|
342
|
+
type World = {
|
|
343
|
+
id: UUID;
|
|
344
|
+
name?: string;
|
|
345
|
+
agentId: UUID;
|
|
346
|
+
serverId: string;
|
|
347
|
+
metadata?: {
|
|
348
|
+
ownership?: {
|
|
349
|
+
ownerId: string;
|
|
350
|
+
};
|
|
351
|
+
roles?: {
|
|
352
|
+
[entityId: UUID]: Role;
|
|
353
|
+
};
|
|
354
|
+
[key: string]: unknown;
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
type Room = {
|
|
358
|
+
id: UUID;
|
|
359
|
+
name?: string;
|
|
360
|
+
agentId?: UUID;
|
|
361
|
+
source: string;
|
|
362
|
+
type: ChannelType;
|
|
363
|
+
channelId?: string;
|
|
364
|
+
serverId?: string;
|
|
365
|
+
worldId?: UUID;
|
|
366
|
+
metadata?: Record<string, unknown>;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Room participant with account details
|
|
370
|
+
*/
|
|
371
|
+
interface Participant {
|
|
372
|
+
/** Unique identifier */
|
|
373
|
+
id: UUID;
|
|
374
|
+
/** Associated account */
|
|
375
|
+
entity: Entity;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Represents a media attachment
|
|
379
|
+
*/
|
|
380
|
+
type Media = {
|
|
381
|
+
/** Unique identifier */
|
|
382
|
+
id: string;
|
|
383
|
+
/** Media URL */
|
|
384
|
+
url: string;
|
|
385
|
+
/** Media title */
|
|
386
|
+
title: string;
|
|
387
|
+
/** Media source */
|
|
388
|
+
source: string;
|
|
389
|
+
/** Media description */
|
|
390
|
+
description: string;
|
|
391
|
+
/** Text content */
|
|
392
|
+
text: string;
|
|
393
|
+
/** Content type */
|
|
394
|
+
contentType?: string;
|
|
395
|
+
};
|
|
396
|
+
declare enum ChannelType {
|
|
397
|
+
SELF = "SELF",// Messages to self
|
|
398
|
+
DM = "dm",// Direct messages between two participants
|
|
399
|
+
GROUP = "group",// Group messages with multiple participants
|
|
400
|
+
VOICE_DM = "VOICE_DM",// Voice direct messages
|
|
401
|
+
VOICE_GROUP = "VOICE_GROUP",// Voice channels with multiple participants
|
|
402
|
+
FEED = "FEED",// Social media feed
|
|
403
|
+
THREAD = "THREAD",// Threaded conversation
|
|
404
|
+
WORLD = "WORLD",// World channel
|
|
405
|
+
FORUM = "FORUM",// Forum discussion
|
|
406
|
+
API = "API"
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Client instance
|
|
410
|
+
*/
|
|
411
|
+
declare abstract class Service {
|
|
412
|
+
/** Runtime instance */
|
|
413
|
+
protected runtime: IAgentRuntime;
|
|
414
|
+
constructor(runtime?: IAgentRuntime);
|
|
415
|
+
abstract stop(): Promise<void>;
|
|
416
|
+
/** Service type */
|
|
417
|
+
static serviceType: string;
|
|
418
|
+
/** Service name */
|
|
419
|
+
abstract capabilityDescription: string;
|
|
420
|
+
/** Service configuration */
|
|
421
|
+
config?: {
|
|
422
|
+
[key: string]: any;
|
|
423
|
+
};
|
|
424
|
+
/** Start service connection */
|
|
425
|
+
static start(_runtime: IAgentRuntime): Promise<Service>;
|
|
426
|
+
/** Stop service connection */
|
|
427
|
+
static stop(_runtime: IAgentRuntime): Promise<unknown>;
|
|
428
|
+
}
|
|
429
|
+
type Route = {
|
|
430
|
+
type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
|
|
431
|
+
path: string;
|
|
432
|
+
filePath?: string;
|
|
433
|
+
handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* Plugin for extending agent functionality
|
|
437
|
+
*/
|
|
438
|
+
interface Plugin {
|
|
439
|
+
name: string;
|
|
440
|
+
description: string;
|
|
441
|
+
init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
|
|
442
|
+
config?: {
|
|
443
|
+
[key: string]: any;
|
|
444
|
+
};
|
|
445
|
+
services?: (typeof Service)[];
|
|
446
|
+
componentTypes?: {
|
|
447
|
+
name: string;
|
|
448
|
+
schema: Record<string, unknown>;
|
|
449
|
+
validator?: (data: any) => boolean;
|
|
450
|
+
}[];
|
|
451
|
+
actions?: Action[];
|
|
452
|
+
providers?: Provider[];
|
|
453
|
+
evaluators?: Evaluator[];
|
|
454
|
+
adapter?: IDatabaseAdapter;
|
|
455
|
+
models?: {
|
|
456
|
+
[key: string]: (...args: any[]) => Promise<any>;
|
|
457
|
+
};
|
|
458
|
+
events?: {
|
|
459
|
+
[K in keyof EventPayloadMap]?: EventHandler<K>[];
|
|
460
|
+
} & {
|
|
461
|
+
[key: string]: ((params: EventPayload) => Promise<any>)[];
|
|
462
|
+
};
|
|
463
|
+
routes?: Route[];
|
|
464
|
+
tests?: TestSuite[];
|
|
465
|
+
}
|
|
466
|
+
interface ProjectAgent {
|
|
467
|
+
character: Character;
|
|
468
|
+
init?: (runtime: IAgentRuntime) => Promise<void>;
|
|
469
|
+
plugins?: Plugin[];
|
|
470
|
+
tests?: TestSuite | TestSuite[];
|
|
471
|
+
}
|
|
472
|
+
interface Project {
|
|
473
|
+
agents: ProjectAgent[];
|
|
474
|
+
}
|
|
475
|
+
type TemplateType = string | ((options: {
|
|
476
|
+
state: State | {
|
|
477
|
+
[key: string]: string;
|
|
478
|
+
};
|
|
479
|
+
}) => string);
|
|
480
|
+
/**
|
|
481
|
+
* Configuration for an agent character
|
|
482
|
+
*/
|
|
483
|
+
interface Character {
|
|
484
|
+
/** Optional unique identifier */
|
|
485
|
+
id?: UUID;
|
|
486
|
+
/** Character name */
|
|
487
|
+
name: string;
|
|
488
|
+
/** Optional username */
|
|
489
|
+
username?: string;
|
|
490
|
+
/** Optional system prompt */
|
|
491
|
+
system?: string;
|
|
492
|
+
/** Optional prompt templates */
|
|
493
|
+
templates?: {
|
|
494
|
+
[key: string]: TemplateType;
|
|
495
|
+
};
|
|
496
|
+
/** Character biography */
|
|
497
|
+
bio: string | string[];
|
|
498
|
+
/** Example messages */
|
|
499
|
+
messageExamples?: MessageExample[][];
|
|
500
|
+
/** Example posts */
|
|
501
|
+
postExamples?: string[];
|
|
502
|
+
/** Known topics */
|
|
503
|
+
topics?: string[];
|
|
504
|
+
/** Character traits */
|
|
505
|
+
adjectives?: string[];
|
|
506
|
+
/** Optional knowledge base */
|
|
507
|
+
knowledge?: (string | {
|
|
508
|
+
path: string;
|
|
509
|
+
shared?: boolean;
|
|
510
|
+
} | {
|
|
511
|
+
directory: string;
|
|
512
|
+
shared?: boolean;
|
|
513
|
+
})[];
|
|
514
|
+
/** Available plugins */
|
|
515
|
+
plugins?: string[];
|
|
516
|
+
/** Optional configuration */
|
|
517
|
+
settings?: {
|
|
518
|
+
[key: string]: any | string | boolean | number;
|
|
519
|
+
};
|
|
520
|
+
/** Optional secrets */
|
|
521
|
+
secrets?: {
|
|
522
|
+
[key: string]: string | boolean | number;
|
|
523
|
+
};
|
|
524
|
+
/** Writing style guides */
|
|
525
|
+
style?: {
|
|
526
|
+
all?: string[];
|
|
527
|
+
chat?: string[];
|
|
528
|
+
post?: string[];
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
declare enum AgentStatus {
|
|
532
|
+
ACTIVE = "active",
|
|
533
|
+
INACTIVE = "inactive"
|
|
534
|
+
}
|
|
535
|
+
interface Agent extends Character {
|
|
536
|
+
enabled?: boolean;
|
|
537
|
+
status?: AgentStatus;
|
|
538
|
+
createdAt: number;
|
|
539
|
+
updatedAt: number;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Interface for database operations
|
|
543
|
+
*/
|
|
544
|
+
interface IDatabaseAdapter {
|
|
545
|
+
/** Database instance */
|
|
546
|
+
db: any;
|
|
547
|
+
/** Initialize database connection */
|
|
548
|
+
init(): Promise<void>;
|
|
549
|
+
/** Close database connection */
|
|
550
|
+
close(): Promise<void>;
|
|
551
|
+
getAgent(agentId: UUID): Promise<Agent | null>;
|
|
552
|
+
/** Get all agents */
|
|
553
|
+
getAgents(): Promise<Agent[]>;
|
|
554
|
+
createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
555
|
+
updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
556
|
+
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
557
|
+
ensureAgentExists(agent: Partial<Agent>): Promise<Agent>;
|
|
558
|
+
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
559
|
+
/** Get entity by ID */
|
|
560
|
+
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
561
|
+
/** Get entities for room */
|
|
562
|
+
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
563
|
+
/** Create new entity */
|
|
564
|
+
createEntity(entity: Entity): Promise<boolean>;
|
|
565
|
+
/** Update entity */
|
|
566
|
+
updateEntity(entity: Entity): Promise<void>;
|
|
567
|
+
/** Get component by ID */
|
|
568
|
+
getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
569
|
+
/** Get all components for an entity */
|
|
570
|
+
getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
571
|
+
/** Create component */
|
|
572
|
+
createComponent(component: Component): Promise<boolean>;
|
|
573
|
+
/** Update component */
|
|
574
|
+
updateComponent(component: Component): Promise<void>;
|
|
575
|
+
/** Delete component */
|
|
576
|
+
deleteComponent(componentId: UUID): Promise<void>;
|
|
577
|
+
/** Get memories matching criteria */
|
|
578
|
+
getMemories(params: {
|
|
579
|
+
entityId?: UUID;
|
|
580
|
+
agentId?: UUID;
|
|
581
|
+
roomId?: UUID;
|
|
582
|
+
count?: number;
|
|
583
|
+
unique?: boolean;
|
|
584
|
+
tableName: string;
|
|
585
|
+
start?: number;
|
|
586
|
+
end?: number;
|
|
587
|
+
}): Promise<Memory[]>;
|
|
588
|
+
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
589
|
+
getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
|
|
590
|
+
getMemoriesByRoomIds(params: {
|
|
591
|
+
tableName: string;
|
|
592
|
+
roomIds: UUID[];
|
|
593
|
+
limit?: number;
|
|
594
|
+
}): Promise<Memory[]>;
|
|
595
|
+
getCachedEmbeddings(params: {
|
|
596
|
+
query_table_name: string;
|
|
597
|
+
query_threshold: number;
|
|
598
|
+
query_input: string;
|
|
599
|
+
query_field_name: string;
|
|
600
|
+
query_field_sub_name: string;
|
|
601
|
+
query_match_count: number;
|
|
602
|
+
}): Promise<{
|
|
603
|
+
embedding: number[];
|
|
604
|
+
levenshtein_score: number;
|
|
605
|
+
}[]>;
|
|
606
|
+
log(params: {
|
|
607
|
+
body: {
|
|
608
|
+
[key: string]: unknown;
|
|
609
|
+
};
|
|
610
|
+
entityId: UUID;
|
|
611
|
+
roomId: UUID;
|
|
612
|
+
type: string;
|
|
613
|
+
}): Promise<void>;
|
|
614
|
+
getLogs(params: {
|
|
615
|
+
entityId: UUID;
|
|
616
|
+
roomId?: UUID;
|
|
617
|
+
type?: string;
|
|
618
|
+
count?: number;
|
|
619
|
+
offset?: number;
|
|
620
|
+
}): Promise<Log[]>;
|
|
621
|
+
deleteLog(logId: UUID): Promise<void>;
|
|
622
|
+
searchMemories(params: {
|
|
623
|
+
embedding: number[];
|
|
624
|
+
match_threshold?: number;
|
|
625
|
+
count?: number;
|
|
626
|
+
roomId?: UUID;
|
|
627
|
+
unique?: boolean;
|
|
628
|
+
tableName: string;
|
|
629
|
+
}): Promise<Memory[]>;
|
|
630
|
+
createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
631
|
+
updateMemory(memory: Partial<Memory> & {
|
|
632
|
+
id: UUID;
|
|
633
|
+
metadata?: MemoryMetadata;
|
|
634
|
+
}): Promise<boolean>;
|
|
635
|
+
deleteMemory(memoryId: UUID): Promise<void>;
|
|
636
|
+
deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
637
|
+
countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
638
|
+
createWorld(world: World): Promise<UUID>;
|
|
639
|
+
getWorld(id: UUID): Promise<World | null>;
|
|
640
|
+
getAllWorlds(): Promise<World[]>;
|
|
641
|
+
updateWorld(world: World): Promise<void>;
|
|
642
|
+
getRoom(roomId: UUID): Promise<Room | null>;
|
|
643
|
+
createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
|
|
644
|
+
deleteRoom(roomId: UUID): Promise<void>;
|
|
645
|
+
updateRoom(room: Room): Promise<void>;
|
|
646
|
+
getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
647
|
+
getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
648
|
+
getRooms(worldId: UUID): Promise<Room[]>;
|
|
649
|
+
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
650
|
+
removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
651
|
+
getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
652
|
+
getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
653
|
+
getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
654
|
+
setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* Creates a new relationship between two entities.
|
|
657
|
+
* @param params Object containing the relationship details
|
|
658
|
+
* @returns Promise resolving to boolean indicating success
|
|
659
|
+
*/
|
|
660
|
+
createRelationship(params: {
|
|
661
|
+
sourceEntityId: UUID;
|
|
662
|
+
targetEntityId: UUID;
|
|
663
|
+
tags?: string[];
|
|
664
|
+
metadata?: {
|
|
665
|
+
[key: string]: any;
|
|
666
|
+
};
|
|
667
|
+
}): Promise<boolean>;
|
|
668
|
+
/**
|
|
669
|
+
* Updates an existing relationship between two entities.
|
|
670
|
+
* @param relationship The relationship object with updated data
|
|
671
|
+
* @returns Promise resolving to void
|
|
672
|
+
*/
|
|
673
|
+
updateRelationship(relationship: Relationship): Promise<void>;
|
|
674
|
+
/**
|
|
675
|
+
* Retrieves a relationship between two entities if it exists.
|
|
676
|
+
* @param params Object containing the entity IDs and agent ID
|
|
677
|
+
* @returns Promise resolving to the Relationship object or null if not found
|
|
678
|
+
*/
|
|
679
|
+
getRelationship(params: {
|
|
680
|
+
sourceEntityId: UUID;
|
|
681
|
+
targetEntityId: UUID;
|
|
682
|
+
}): Promise<Relationship | null>;
|
|
683
|
+
/**
|
|
684
|
+
* Retrieves all relationships for a specific entity.
|
|
685
|
+
* @param params Object containing the user ID, agent ID and optional tags to filter by
|
|
686
|
+
* @returns Promise resolving to an array of Relationship objects
|
|
687
|
+
*/
|
|
688
|
+
getRelationships(params: {
|
|
689
|
+
entityId: UUID;
|
|
690
|
+
tags?: string[];
|
|
691
|
+
}): Promise<Relationship[]>;
|
|
692
|
+
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
693
|
+
getCache<T>(key: string): Promise<T | undefined>;
|
|
694
|
+
setCache<T>(key: string, value: T): Promise<boolean>;
|
|
695
|
+
deleteCache(key: string): Promise<boolean>;
|
|
696
|
+
createTask(task: Task): Promise<UUID>;
|
|
697
|
+
getTasks(params: {
|
|
698
|
+
roomId?: UUID;
|
|
699
|
+
tags?: string[];
|
|
700
|
+
}): Promise<Task[]>;
|
|
701
|
+
getTask(id: UUID): Promise<Task | null>;
|
|
702
|
+
getTasksByName(name: string): Promise<Task[]>;
|
|
703
|
+
updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
704
|
+
deleteTask(id: UUID): Promise<void>;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Result interface for embedding similarity searches
|
|
708
|
+
*/
|
|
709
|
+
interface EmbeddingSearchResult {
|
|
710
|
+
embedding: number[];
|
|
711
|
+
levenshtein_score: number;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Options for memory retrieval operations
|
|
715
|
+
*/
|
|
716
|
+
interface MemoryRetrievalOptions {
|
|
717
|
+
roomId: UUID;
|
|
718
|
+
count?: number;
|
|
719
|
+
unique?: boolean;
|
|
720
|
+
start?: number;
|
|
721
|
+
end?: number;
|
|
722
|
+
agentId?: UUID;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Options for memory search operations
|
|
726
|
+
*/
|
|
727
|
+
interface MemorySearchOptions {
|
|
728
|
+
embedding: number[];
|
|
729
|
+
match_threshold?: number;
|
|
730
|
+
count?: number;
|
|
731
|
+
roomId: UUID;
|
|
732
|
+
agentId?: UUID;
|
|
733
|
+
unique?: boolean;
|
|
734
|
+
metadata?: Partial<MemoryMetadata>;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Options for multi-room memory retrieval
|
|
738
|
+
*/
|
|
739
|
+
interface MultiRoomMemoryOptions {
|
|
740
|
+
roomIds: UUID[];
|
|
741
|
+
limit?: number;
|
|
742
|
+
agentId?: UUID;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Unified options pattern for memory operations
|
|
746
|
+
* Provides a simpler, more consistent interface
|
|
747
|
+
*/
|
|
748
|
+
interface UnifiedMemoryOptions {
|
|
749
|
+
roomId: UUID;
|
|
750
|
+
limit?: number;
|
|
751
|
+
agentId?: UUID;
|
|
752
|
+
unique?: boolean;
|
|
753
|
+
start?: number;
|
|
754
|
+
end?: number;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Specialized memory search options
|
|
758
|
+
*/
|
|
759
|
+
interface UnifiedSearchOptions extends UnifiedMemoryOptions {
|
|
760
|
+
embedding: number[];
|
|
761
|
+
similarity?: number;
|
|
762
|
+
}
|
|
763
|
+
interface IAgentRuntime extends IDatabaseAdapter {
|
|
764
|
+
agentId: UUID;
|
|
765
|
+
character: Character;
|
|
766
|
+
providers: Provider[];
|
|
767
|
+
actions: Action[];
|
|
768
|
+
evaluators: Evaluator[];
|
|
769
|
+
plugins: Plugin[];
|
|
770
|
+
services: Map<ServiceTypeName, Service>;
|
|
771
|
+
events: Map<string, ((params: any) => Promise<void>)[]>;
|
|
772
|
+
fetch?: typeof fetch | null;
|
|
773
|
+
routes: Route[];
|
|
774
|
+
registerPlugin(plugin: Plugin): Promise<void>;
|
|
775
|
+
initialize(): Promise<void>;
|
|
776
|
+
getKnowledge(message: Memory): Promise<KnowledgeItem[]>;
|
|
777
|
+
addKnowledge(item: KnowledgeItem, options: {
|
|
778
|
+
targetTokens: number;
|
|
779
|
+
overlap: number;
|
|
780
|
+
modelContextSize: number;
|
|
781
|
+
}): Promise<void>;
|
|
782
|
+
getService<T extends Service>(service: ServiceTypeName | string): T | null;
|
|
783
|
+
getAllServices(): Map<ServiceTypeName, Service>;
|
|
784
|
+
registerService(service: typeof Service): Promise<void>;
|
|
785
|
+
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
786
|
+
setSetting(key: string, value: string | boolean | null | any, secret: boolean): void;
|
|
787
|
+
getSetting(key: string): string | boolean | null | any;
|
|
788
|
+
getConversationLength(): number;
|
|
789
|
+
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
|
|
790
|
+
evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
|
|
791
|
+
registerProvider(provider: Provider): void;
|
|
792
|
+
registerAction(action: Action): void;
|
|
793
|
+
registerEvaluator(evaluator: Evaluator): void;
|
|
794
|
+
ensureConnection({ entityId, roomId, userName, name, source, channelId, serverId, type, worldId, userId, }: {
|
|
795
|
+
entityId: UUID;
|
|
796
|
+
roomId: UUID;
|
|
797
|
+
userName?: string;
|
|
798
|
+
name?: string;
|
|
799
|
+
source?: string;
|
|
800
|
+
channelId?: string;
|
|
801
|
+
serverId?: string;
|
|
802
|
+
type: ChannelType;
|
|
803
|
+
worldId?: UUID;
|
|
804
|
+
userId?: UUID;
|
|
805
|
+
}): Promise<void>;
|
|
806
|
+
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
807
|
+
ensureWorldExists(world: World): Promise<void>;
|
|
808
|
+
ensureRoomExists(room: Room): Promise<void>;
|
|
809
|
+
composeState(message: Memory, filterList?: string[], includeList?: string[]): Promise<State>;
|
|
810
|
+
/**
|
|
811
|
+
* Use a model with strongly typed parameters and return values based on model type
|
|
812
|
+
* @template T - The model type to use
|
|
813
|
+
* @template R - The expected return type, defaults to the type defined in ModelResultMap[T]
|
|
814
|
+
* @param {T} modelType - The type of model to use
|
|
815
|
+
* @param {ModelParamsMap[T] | any} params - The parameters for the model, typed based on model type
|
|
816
|
+
* @returns {Promise<R>} - The model result, typed based on the provided generic type parameter
|
|
817
|
+
*/
|
|
818
|
+
useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any): Promise<R>;
|
|
819
|
+
registerModel(modelType: ModelTypeName | string, handler: (params: any) => Promise<any>): void;
|
|
820
|
+
getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
|
|
821
|
+
registerEvent(event: string, handler: (params: any) => Promise<void>): void;
|
|
822
|
+
getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
|
|
823
|
+
emitEvent(event: string | string[], params: any): Promise<void>;
|
|
824
|
+
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
825
|
+
getTaskWorker(name: string): TaskWorker | undefined;
|
|
826
|
+
stop(): Promise<void>;
|
|
827
|
+
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Interface for settings object with key-value pairs.
|
|
831
|
+
*/
|
|
832
|
+
/**
|
|
833
|
+
* Interface representing settings with string key-value pairs.
|
|
834
|
+
*/
|
|
835
|
+
interface RuntimeSettings {
|
|
836
|
+
[key: string]: string | undefined;
|
|
837
|
+
}
|
|
838
|
+
type KnowledgeItem = {
|
|
839
|
+
id: UUID;
|
|
840
|
+
content: Content;
|
|
841
|
+
metadata?: MemoryMetadata;
|
|
842
|
+
};
|
|
843
|
+
declare enum KnowledgeScope {
|
|
844
|
+
SHARED = "shared",
|
|
845
|
+
PRIVATE = "private"
|
|
846
|
+
}
|
|
847
|
+
declare enum CacheKeyPrefix {
|
|
848
|
+
KNOWLEDGE = "knowledge"
|
|
849
|
+
}
|
|
850
|
+
interface DirectoryItem {
|
|
851
|
+
directory: string;
|
|
852
|
+
shared?: boolean;
|
|
853
|
+
}
|
|
854
|
+
interface ChunkRow {
|
|
855
|
+
id: string;
|
|
856
|
+
}
|
|
857
|
+
type GenerateTextParams = {
|
|
858
|
+
runtime: IAgentRuntime;
|
|
859
|
+
prompt: string;
|
|
860
|
+
modelType: ModelTypeName;
|
|
861
|
+
maxTokens?: number;
|
|
862
|
+
temperature?: number;
|
|
863
|
+
frequencyPenalty?: number;
|
|
864
|
+
presencePenalty?: number;
|
|
865
|
+
stopSequences?: string[];
|
|
866
|
+
};
|
|
867
|
+
interface IVideoService extends Service {
|
|
868
|
+
isVideoUrl(url: string): boolean;
|
|
869
|
+
fetchVideoInfo(url: string): Promise<Media>;
|
|
870
|
+
downloadVideo(videoInfo: Media): Promise<string>;
|
|
871
|
+
processVideo(url: string, runtime: IAgentRuntime): Promise<Media>;
|
|
872
|
+
}
|
|
873
|
+
interface IBrowserService extends Service {
|
|
874
|
+
getPageContent(url: string, runtime: IAgentRuntime): Promise<{
|
|
875
|
+
title: string;
|
|
876
|
+
description: string;
|
|
877
|
+
bodyContent: string;
|
|
878
|
+
}>;
|
|
879
|
+
}
|
|
880
|
+
interface IPdfService extends Service {
|
|
881
|
+
convertPdfToText(pdfBuffer: Buffer): Promise<string>;
|
|
882
|
+
}
|
|
883
|
+
interface IFileService extends Service {
|
|
884
|
+
uploadFile(imagePath: string, subDirectory: string, useSignedUrl: boolean, expiresIn: number): Promise<{
|
|
885
|
+
success: boolean;
|
|
886
|
+
url?: string;
|
|
887
|
+
error?: string;
|
|
888
|
+
}>;
|
|
889
|
+
generateSignedUrl(fileName: string, expiresIn: number): Promise<string>;
|
|
890
|
+
}
|
|
891
|
+
interface TestCase {
|
|
892
|
+
name: string;
|
|
893
|
+
fn: (runtime: IAgentRuntime) => Promise<void> | void;
|
|
894
|
+
}
|
|
895
|
+
interface TestSuite {
|
|
896
|
+
name: string;
|
|
897
|
+
tests: TestCase[];
|
|
898
|
+
}
|
|
899
|
+
interface TeeAgent {
|
|
900
|
+
id: string;
|
|
901
|
+
agentId: string;
|
|
902
|
+
agentName: string;
|
|
903
|
+
createdAt: number;
|
|
904
|
+
publicKey: string;
|
|
905
|
+
attestation: string;
|
|
906
|
+
}
|
|
907
|
+
declare enum TEEMode {
|
|
908
|
+
OFF = "OFF",
|
|
909
|
+
LOCAL = "LOCAL",// For local development with simulator
|
|
910
|
+
DOCKER = "DOCKER",// For docker development with simulator
|
|
911
|
+
PRODUCTION = "PRODUCTION"
|
|
912
|
+
}
|
|
913
|
+
interface RemoteAttestationQuote {
|
|
914
|
+
quote: string;
|
|
915
|
+
timestamp: number;
|
|
916
|
+
}
|
|
917
|
+
interface DeriveKeyAttestationData {
|
|
918
|
+
agentId: string;
|
|
919
|
+
publicKey: string;
|
|
920
|
+
subject?: string;
|
|
921
|
+
}
|
|
922
|
+
interface RemoteAttestationMessage {
|
|
923
|
+
agentId: string;
|
|
924
|
+
timestamp: number;
|
|
925
|
+
message: {
|
|
926
|
+
entityId: string;
|
|
927
|
+
roomId: string;
|
|
928
|
+
content: string;
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
declare enum TeeType {
|
|
932
|
+
TDX_DSTACK = "tdx_dstack"
|
|
933
|
+
}
|
|
934
|
+
interface TeeVendorConfig {
|
|
935
|
+
[key: string]: unknown;
|
|
936
|
+
}
|
|
937
|
+
interface TeePluginConfig {
|
|
938
|
+
vendor?: string;
|
|
939
|
+
vendorConfig?: TeeVendorConfig;
|
|
940
|
+
}
|
|
941
|
+
interface TaskWorker {
|
|
942
|
+
name: string;
|
|
943
|
+
execute: (runtime: IAgentRuntime, options: {
|
|
944
|
+
[key: string]: unknown;
|
|
945
|
+
}, task: Task) => Promise<void>;
|
|
946
|
+
validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
|
|
947
|
+
}
|
|
948
|
+
interface Task {
|
|
949
|
+
id?: UUID;
|
|
950
|
+
name: string;
|
|
951
|
+
updatedAt?: number;
|
|
952
|
+
metadata?: {
|
|
953
|
+
updateInterval?: number;
|
|
954
|
+
options?: {
|
|
955
|
+
name: string;
|
|
956
|
+
description: string;
|
|
957
|
+
}[];
|
|
958
|
+
[key: string]: unknown;
|
|
959
|
+
};
|
|
960
|
+
description: string;
|
|
961
|
+
roomId?: UUID;
|
|
962
|
+
worldId?: UUID;
|
|
963
|
+
tags: string[];
|
|
964
|
+
}
|
|
965
|
+
declare enum Role {
|
|
966
|
+
OWNER = "OWNER",
|
|
967
|
+
ADMIN = "ADMIN",
|
|
968
|
+
NONE = "NONE"
|
|
969
|
+
}
|
|
970
|
+
interface Setting {
|
|
971
|
+
name: string;
|
|
972
|
+
description: string;
|
|
973
|
+
usageDescription: string;
|
|
974
|
+
value: string | boolean | null;
|
|
975
|
+
required: boolean;
|
|
976
|
+
public?: boolean;
|
|
977
|
+
secret?: boolean;
|
|
978
|
+
validation?: (value: any) => boolean;
|
|
979
|
+
dependsOn?: string[];
|
|
980
|
+
onSetAction?: (value: any) => string;
|
|
981
|
+
visibleIf?: (settings: {
|
|
982
|
+
[key: string]: Setting;
|
|
983
|
+
}) => boolean;
|
|
984
|
+
}
|
|
985
|
+
interface WorldSettings {
|
|
986
|
+
[key: string]: Setting;
|
|
987
|
+
}
|
|
988
|
+
interface OnboardingConfig {
|
|
989
|
+
settings: {
|
|
990
|
+
[key: string]: Omit<Setting, 'value'>;
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Base parameters common to all model types
|
|
995
|
+
*/
|
|
996
|
+
interface BaseModelParams {
|
|
997
|
+
/** The agent runtime for accessing services and utilities */
|
|
998
|
+
runtime: IAgentRuntime;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Parameters for text generation models
|
|
1002
|
+
*/
|
|
1003
|
+
interface TextGenerationParams extends BaseModelParams {
|
|
1004
|
+
/** The prompt to generate text from */
|
|
1005
|
+
prompt: string;
|
|
1006
|
+
/** Model temperature (0.0 to 1.0, lower is more deterministic) */
|
|
1007
|
+
temperature?: number;
|
|
1008
|
+
/** Maximum number of tokens to generate */
|
|
1009
|
+
maxTokens?: number;
|
|
1010
|
+
/** Sequences that should stop generation when encountered */
|
|
1011
|
+
stopSequences?: string[];
|
|
1012
|
+
/** Frequency penalty to apply */
|
|
1013
|
+
frequencyPenalty?: number;
|
|
1014
|
+
/** Presence penalty to apply */
|
|
1015
|
+
presencePenalty?: number;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Parameters for text embedding models
|
|
1019
|
+
*/
|
|
1020
|
+
interface TextEmbeddingParams extends BaseModelParams {
|
|
1021
|
+
/** The text to create embeddings for */
|
|
1022
|
+
text: string;
|
|
1023
|
+
}
|
|
1024
|
+
interface TokenizeTextParams {
|
|
1025
|
+
prompt: string;
|
|
1026
|
+
modelType: ModelTypeName;
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Parameters for text tokenization models
|
|
1030
|
+
*/
|
|
1031
|
+
interface TokenizeTextParams extends BaseModelParams {
|
|
1032
|
+
/** The text to tokenize */
|
|
1033
|
+
prompt: string;
|
|
1034
|
+
/** The model type to use for tokenization */
|
|
1035
|
+
modelType: ModelTypeName;
|
|
1036
|
+
}
|
|
1037
|
+
interface DetokenizeTextParams {
|
|
1038
|
+
tokens: number[];
|
|
1039
|
+
modelType: ModelTypeName;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Parameters for text detokenization models
|
|
1043
|
+
*/
|
|
1044
|
+
interface DetokenizeTextParams extends BaseModelParams {
|
|
1045
|
+
/** The tokens to convert back to text */
|
|
1046
|
+
tokens: number[];
|
|
1047
|
+
/** The model type to use for detokenization */
|
|
1048
|
+
modelType: ModelTypeName;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Parameters for image generation models
|
|
1052
|
+
*/
|
|
1053
|
+
interface ImageGenerationParams extends BaseModelParams {
|
|
1054
|
+
/** The prompt describing the image to generate */
|
|
1055
|
+
prompt: string;
|
|
1056
|
+
/** The dimensions of the image to generate */
|
|
1057
|
+
size?: string;
|
|
1058
|
+
/** Number of images to generate */
|
|
1059
|
+
count?: number;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Parameters for image description models
|
|
1063
|
+
*/
|
|
1064
|
+
interface ImageDescriptionParams extends BaseModelParams {
|
|
1065
|
+
/** The URL or path of the image to describe */
|
|
1066
|
+
imageUrl: string;
|
|
1067
|
+
/** Optional prompt to guide the description */
|
|
1068
|
+
prompt?: string;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Parameters for transcription models
|
|
1072
|
+
*/
|
|
1073
|
+
interface TranscriptionParams extends BaseModelParams {
|
|
1074
|
+
/** The URL or path of the audio file to transcribe */
|
|
1075
|
+
audioUrl: string;
|
|
1076
|
+
/** Optional prompt to guide transcription */
|
|
1077
|
+
prompt?: string;
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Parameters for text-to-speech models
|
|
1081
|
+
*/
|
|
1082
|
+
interface TextToSpeechParams extends BaseModelParams {
|
|
1083
|
+
/** The text to convert to speech */
|
|
1084
|
+
text: string;
|
|
1085
|
+
/** The voice to use */
|
|
1086
|
+
voice?: string;
|
|
1087
|
+
/** The speaking speed */
|
|
1088
|
+
speed?: number;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Parameters for audio processing models
|
|
1092
|
+
*/
|
|
1093
|
+
interface AudioProcessingParams extends BaseModelParams {
|
|
1094
|
+
/** The URL or path of the audio file to process */
|
|
1095
|
+
audioUrl: string;
|
|
1096
|
+
/** The type of audio processing to perform */
|
|
1097
|
+
processingType: string;
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Parameters for video processing models
|
|
1101
|
+
*/
|
|
1102
|
+
interface VideoProcessingParams extends BaseModelParams {
|
|
1103
|
+
/** The URL or path of the video file to process */
|
|
1104
|
+
videoUrl: string;
|
|
1105
|
+
/** The type of video processing to perform */
|
|
1106
|
+
processingType: string;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Optional JSON schema for validating generated objects
|
|
1110
|
+
*/
|
|
1111
|
+
type JSONSchema = {
|
|
1112
|
+
type: string;
|
|
1113
|
+
properties?: Record<string, any>;
|
|
1114
|
+
required?: string[];
|
|
1115
|
+
items?: JSONSchema;
|
|
1116
|
+
[key: string]: any;
|
|
1117
|
+
};
|
|
1118
|
+
/**
|
|
1119
|
+
* Parameters for object generation models
|
|
1120
|
+
* @template T - The expected return type, inferred from schema if provided
|
|
1121
|
+
*/
|
|
1122
|
+
interface ObjectGenerationParams<T = any> extends BaseModelParams {
|
|
1123
|
+
/** The prompt describing the object to generate */
|
|
1124
|
+
prompt: string;
|
|
1125
|
+
/** Optional JSON schema for validation */
|
|
1126
|
+
schema?: JSONSchema;
|
|
1127
|
+
/** Type of object to generate */
|
|
1128
|
+
output?: 'object' | 'array' | 'enum';
|
|
1129
|
+
/** For enum type, the allowed values */
|
|
1130
|
+
enumValues?: string[];
|
|
1131
|
+
/** Model type to use */
|
|
1132
|
+
modelType?: ModelTypeName;
|
|
1133
|
+
/** Model temperature (0.0 to 1.0) */
|
|
1134
|
+
temperature?: number;
|
|
1135
|
+
/** Sequences that should stop generation */
|
|
1136
|
+
stopSequences?: string[];
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Map of model types to their parameter types
|
|
1140
|
+
*/
|
|
1141
|
+
interface ModelParamsMap {
|
|
1142
|
+
[ModelType.TEXT_SMALL]: TextGenerationParams;
|
|
1143
|
+
[ModelType.TEXT_LARGE]: TextGenerationParams;
|
|
1144
|
+
[ModelType.TEXT_EMBEDDING]: TextEmbeddingParams | string | null;
|
|
1145
|
+
[ModelType.TEXT_TOKENIZER_ENCODE]: TokenizeTextParams;
|
|
1146
|
+
[ModelType.TEXT_TOKENIZER_DECODE]: DetokenizeTextParams;
|
|
1147
|
+
[ModelType.TEXT_REASONING_SMALL]: TextGenerationParams;
|
|
1148
|
+
[ModelType.TEXT_REASONING_LARGE]: TextGenerationParams;
|
|
1149
|
+
[ModelType.IMAGE]: ImageGenerationParams;
|
|
1150
|
+
[ModelType.IMAGE_DESCRIPTION]: ImageDescriptionParams | string;
|
|
1151
|
+
[ModelType.TRANSCRIPTION]: TranscriptionParams | Buffer | string;
|
|
1152
|
+
[ModelType.TEXT_TO_SPEECH]: TextToSpeechParams | string;
|
|
1153
|
+
[ModelType.AUDIO]: AudioProcessingParams;
|
|
1154
|
+
[ModelType.VIDEO]: VideoProcessingParams;
|
|
1155
|
+
[ModelType.OBJECT_SMALL]: ObjectGenerationParams<any>;
|
|
1156
|
+
[ModelType.OBJECT_LARGE]: ObjectGenerationParams<any>;
|
|
1157
|
+
[key: string]: BaseModelParams | any;
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Map of model types to their return value types
|
|
1161
|
+
*/
|
|
1162
|
+
interface ModelResultMap {
|
|
1163
|
+
[ModelType.TEXT_SMALL]: string;
|
|
1164
|
+
[ModelType.TEXT_LARGE]: string;
|
|
1165
|
+
[ModelType.TEXT_EMBEDDING]: number[];
|
|
1166
|
+
[ModelType.TEXT_TOKENIZER_ENCODE]: number[];
|
|
1167
|
+
[ModelType.TEXT_TOKENIZER_DECODE]: string;
|
|
1168
|
+
[ModelType.TEXT_REASONING_SMALL]: string;
|
|
1169
|
+
[ModelType.TEXT_REASONING_LARGE]: string;
|
|
1170
|
+
[ModelType.IMAGE]: {
|
|
1171
|
+
url: string;
|
|
1172
|
+
}[];
|
|
1173
|
+
[ModelType.IMAGE_DESCRIPTION]: {
|
|
1174
|
+
title: string;
|
|
1175
|
+
description: string;
|
|
1176
|
+
};
|
|
1177
|
+
[ModelType.TRANSCRIPTION]: string;
|
|
1178
|
+
[ModelType.TEXT_TO_SPEECH]: any | Buffer;
|
|
1179
|
+
[ModelType.AUDIO]: any;
|
|
1180
|
+
[ModelType.VIDEO]: any;
|
|
1181
|
+
[ModelType.OBJECT_SMALL]: any;
|
|
1182
|
+
[ModelType.OBJECT_LARGE]: any;
|
|
1183
|
+
[key: string]: any;
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Standard event types across all platforms
|
|
1187
|
+
*/
|
|
1188
|
+
declare enum EventType {
|
|
1189
|
+
WORLD_JOINED = "WORLD_JOINED",
|
|
1190
|
+
WORLD_CONNECTED = "WORLD_CONNECTED",
|
|
1191
|
+
WORLD_LEFT = "WORLD_LEFT",
|
|
1192
|
+
ENTITY_JOINED = "ENTITY_JOINED",
|
|
1193
|
+
ENTITY_LEFT = "ENTITY_LEFT",
|
|
1194
|
+
ENTITY_UPDATED = "ENTITY_UPDATED",
|
|
1195
|
+
ROOM_JOINED = "ROOM_JOINED",
|
|
1196
|
+
ROOM_LEFT = "ROOM_LEFT",
|
|
1197
|
+
MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
|
|
1198
|
+
MESSAGE_SENT = "MESSAGE_SENT",
|
|
1199
|
+
VOICE_MESSAGE_RECEIVED = "VOICE_MESSAGE_RECEIVED",
|
|
1200
|
+
VOICE_MESSAGE_SENT = "VOICE_MESSAGE_SENT",
|
|
1201
|
+
REACTION_RECEIVED = "REACTION_RECEIVED",
|
|
1202
|
+
POST_GENERATED = "POST_GENERATED",
|
|
1203
|
+
INTERACTION_RECEIVED = "INTERACTION_RECEIVED",
|
|
1204
|
+
RUN_STARTED = "RUN_STARTED",
|
|
1205
|
+
RUN_ENDED = "RUN_ENDED",
|
|
1206
|
+
RUN_TIMEOUT = "RUN_TIMEOUT",
|
|
1207
|
+
ACTION_STARTED = "ACTION_STARTED",
|
|
1208
|
+
ACTION_COMPLETED = "ACTION_COMPLETED",
|
|
1209
|
+
EVALUATOR_STARTED = "EVALUATOR_STARTED",
|
|
1210
|
+
EVALUATOR_COMPLETED = "EVALUATOR_COMPLETED",
|
|
1211
|
+
MODEL_USED = "MODEL_USED"
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Platform-specific event type prefix
|
|
1215
|
+
*/
|
|
1216
|
+
declare enum PlatformPrefix {
|
|
1217
|
+
DISCORD = "DISCORD",
|
|
1218
|
+
TELEGRAM = "TELEGRAM",
|
|
1219
|
+
TWITTER = "TWITTER"
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Base payload interface for all events
|
|
1223
|
+
*/
|
|
1224
|
+
interface EventPayload {
|
|
1225
|
+
runtime: IAgentRuntime;
|
|
1226
|
+
source: string;
|
|
1227
|
+
onComplete?: () => void;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Payload for world-related events
|
|
1231
|
+
*/
|
|
1232
|
+
interface WorldPayload extends EventPayload {
|
|
1233
|
+
world: World;
|
|
1234
|
+
rooms: Room[];
|
|
1235
|
+
entities: Entity[];
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Payload for entity-related events
|
|
1239
|
+
*/
|
|
1240
|
+
interface EntityPayload extends EventPayload {
|
|
1241
|
+
entityId: UUID;
|
|
1242
|
+
worldId?: UUID;
|
|
1243
|
+
roomId?: UUID;
|
|
1244
|
+
metadata?: {
|
|
1245
|
+
orginalId: string;
|
|
1246
|
+
username: string;
|
|
1247
|
+
displayName?: string;
|
|
1248
|
+
[key: string]: any;
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Payload for reaction-related events
|
|
1253
|
+
*/
|
|
1254
|
+
interface MessagePayload extends EventPayload {
|
|
1255
|
+
message: Memory;
|
|
1256
|
+
callback?: HandlerCallback;
|
|
1257
|
+
onComplete?: () => void;
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Payload for events that are invoked without a message
|
|
1261
|
+
*/
|
|
1262
|
+
interface InvokePayload extends EventPayload {
|
|
1263
|
+
worldId: UUID;
|
|
1264
|
+
userId: string;
|
|
1265
|
+
roomId: UUID;
|
|
1266
|
+
callback?: HandlerCallback;
|
|
1267
|
+
source: string;
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Run event payload type
|
|
1271
|
+
*/
|
|
1272
|
+
interface RunEventPayload extends EventPayload {
|
|
1273
|
+
runId: UUID;
|
|
1274
|
+
messageId: UUID;
|
|
1275
|
+
roomId: UUID;
|
|
1276
|
+
entityId: UUID;
|
|
1277
|
+
startTime: number;
|
|
1278
|
+
status: 'started' | 'completed' | 'timeout';
|
|
1279
|
+
endTime?: number;
|
|
1280
|
+
duration?: number;
|
|
1281
|
+
error?: string;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Action event payload type
|
|
1285
|
+
*/
|
|
1286
|
+
interface ActionEventPayload extends EventPayload {
|
|
1287
|
+
actionId: UUID;
|
|
1288
|
+
actionName: string;
|
|
1289
|
+
startTime?: number;
|
|
1290
|
+
completed?: boolean;
|
|
1291
|
+
error?: Error;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Evaluator event payload type
|
|
1295
|
+
*/
|
|
1296
|
+
interface EvaluatorEventPayload extends EventPayload {
|
|
1297
|
+
evaluatorId: UUID;
|
|
1298
|
+
evaluatorName: string;
|
|
1299
|
+
startTime?: number;
|
|
1300
|
+
completed?: boolean;
|
|
1301
|
+
error?: Error;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Model event payload type
|
|
1305
|
+
*/
|
|
1306
|
+
interface ModelEventPayload extends EventPayload {
|
|
1307
|
+
provider: string;
|
|
1308
|
+
type: ModelTypeName;
|
|
1309
|
+
prompt: string;
|
|
1310
|
+
tokens?: {
|
|
1311
|
+
prompt: number;
|
|
1312
|
+
completion: number;
|
|
1313
|
+
total: number;
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Represents the parameters for a message received handler.
|
|
1318
|
+
* @typedef {Object} MessageReceivedHandlerParams
|
|
1319
|
+
* @property {IAgentRuntime} runtime - The agent runtime associated with the message.
|
|
1320
|
+
* @property {Memory} message - The message received.
|
|
1321
|
+
* @property {HandlerCallback} callback - The callback function to be executed after handling the message.
|
|
1322
|
+
*/
|
|
1323
|
+
type MessageReceivedHandlerParams = {
|
|
1324
|
+
runtime: IAgentRuntime;
|
|
1325
|
+
message: Memory;
|
|
1326
|
+
callback: HandlerCallback;
|
|
1327
|
+
onComplete?: () => void;
|
|
1328
|
+
};
|
|
1329
|
+
/**
|
|
1330
|
+
* Maps event types to their corresponding payload types
|
|
1331
|
+
*/
|
|
1332
|
+
interface EventPayloadMap {
|
|
1333
|
+
[EventType.WORLD_JOINED]: WorldPayload;
|
|
1334
|
+
[EventType.WORLD_CONNECTED]: WorldPayload;
|
|
1335
|
+
[EventType.WORLD_LEFT]: WorldPayload;
|
|
1336
|
+
[EventType.ENTITY_JOINED]: EntityPayload;
|
|
1337
|
+
[EventType.ENTITY_LEFT]: EntityPayload;
|
|
1338
|
+
[EventType.ENTITY_UPDATED]: EntityPayload;
|
|
1339
|
+
[EventType.MESSAGE_RECEIVED]: MessagePayload;
|
|
1340
|
+
[EventType.MESSAGE_SENT]: MessagePayload;
|
|
1341
|
+
[EventType.REACTION_RECEIVED]: MessagePayload;
|
|
1342
|
+
[EventType.POST_GENERATED]: InvokePayload;
|
|
1343
|
+
[EventType.INTERACTION_RECEIVED]: MessagePayload;
|
|
1344
|
+
[EventType.RUN_STARTED]: RunEventPayload;
|
|
1345
|
+
[EventType.RUN_ENDED]: RunEventPayload;
|
|
1346
|
+
[EventType.RUN_TIMEOUT]: RunEventPayload;
|
|
1347
|
+
[EventType.ACTION_STARTED]: ActionEventPayload;
|
|
1348
|
+
[EventType.ACTION_COMPLETED]: ActionEventPayload;
|
|
1349
|
+
[EventType.EVALUATOR_STARTED]: EvaluatorEventPayload;
|
|
1350
|
+
[EventType.EVALUATOR_COMPLETED]: EvaluatorEventPayload;
|
|
1351
|
+
[EventType.MODEL_USED]: ModelEventPayload;
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Event handler function type
|
|
1355
|
+
*/
|
|
1356
|
+
type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
|
|
1357
|
+
/**
|
|
1358
|
+
* Update the Plugin interface with typed events
|
|
1359
|
+
*/
|
|
1360
|
+
declare enum SOCKET_MESSAGE_TYPE {
|
|
1361
|
+
ROOM_JOINING = 1,
|
|
1362
|
+
SEND_MESSAGE = 2,
|
|
1363
|
+
MESSAGE = 3,
|
|
1364
|
+
ACK = 4,
|
|
1365
|
+
THINKING = 5,
|
|
1366
|
+
CONTROL = 6
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Specialized memory type for messages with enhanced type checking
|
|
1370
|
+
*/
|
|
1371
|
+
interface MessageMemory extends Memory {
|
|
1372
|
+
metadata: MessageMetadata;
|
|
1373
|
+
content: Content & {
|
|
1374
|
+
text: string;
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Factory function to create a new message memory with proper defaults
|
|
1379
|
+
*/
|
|
1380
|
+
declare function createMessageMemory(params: {
|
|
1381
|
+
id?: UUID;
|
|
1382
|
+
entityId: UUID;
|
|
1383
|
+
agentId?: UUID;
|
|
1384
|
+
roomId: UUID;
|
|
1385
|
+
content: Content & {
|
|
1386
|
+
text: string;
|
|
1387
|
+
};
|
|
1388
|
+
embedding?: number[];
|
|
1389
|
+
}): MessageMemory;
|
|
1390
|
+
/**
|
|
1391
|
+
* Generic service interface that provides better type checking for services
|
|
1392
|
+
* @template ConfigType The configuration type for this service
|
|
1393
|
+
* @template ResultType The result type returned by the service operations
|
|
1394
|
+
*/
|
|
1395
|
+
interface TypedService<ConfigType = unknown, ResultType = unknown> extends Service {
|
|
1396
|
+
/**
|
|
1397
|
+
* The configuration for this service instance
|
|
1398
|
+
*/
|
|
1399
|
+
config: ConfigType;
|
|
1400
|
+
/**
|
|
1401
|
+
* Process an input with this service
|
|
1402
|
+
* @param input The input to process
|
|
1403
|
+
* @returns A promise resolving to the result
|
|
1404
|
+
*/
|
|
1405
|
+
process(input: unknown): Promise<ResultType>;
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Generic factory function to create a typed service instance
|
|
1409
|
+
* @param runtime The agent runtime
|
|
1410
|
+
* @param serviceType The type of service to get
|
|
1411
|
+
* @returns The service instance or null if not available
|
|
1412
|
+
*/
|
|
1413
|
+
declare function getTypedService<T extends TypedService<any, any>>(runtime: IAgentRuntime, serviceType: ServiceTypeName): T | null;
|
|
1414
|
+
/**
|
|
1415
|
+
* Type guard to check if a memory metadata is a DocumentMetadata
|
|
1416
|
+
* @param metadata The metadata to check
|
|
1417
|
+
* @returns True if the metadata is a DocumentMetadata
|
|
1418
|
+
*/
|
|
1419
|
+
declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
|
|
1420
|
+
/**
|
|
1421
|
+
* Type guard to check if a memory metadata is a FragmentMetadata
|
|
1422
|
+
* @param metadata The metadata to check
|
|
1423
|
+
* @returns True if the metadata is a FragmentMetadata
|
|
1424
|
+
*/
|
|
1425
|
+
declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
|
|
1426
|
+
/**
|
|
1427
|
+
* Type guard to check if a memory metadata is a MessageMetadata
|
|
1428
|
+
* @param metadata The metadata to check
|
|
1429
|
+
* @returns True if the metadata is a MessageMetadata
|
|
1430
|
+
*/
|
|
1431
|
+
declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
|
|
1432
|
+
/**
|
|
1433
|
+
* Type guard to check if a memory metadata is a DescriptionMetadata
|
|
1434
|
+
* @param metadata The metadata to check
|
|
1435
|
+
* @returns True if the metadata is a DescriptionMetadata
|
|
1436
|
+
*/
|
|
1437
|
+
declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
|
|
1438
|
+
/**
|
|
1439
|
+
* Type guard to check if a memory metadata is a CustomMetadata
|
|
1440
|
+
* @param metadata The metadata to check
|
|
1441
|
+
* @returns True if the metadata is a CustomMetadata
|
|
1442
|
+
*/
|
|
1443
|
+
declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
|
|
1444
|
+
/**
|
|
1445
|
+
* Standardized service error type for consistent error handling
|
|
1446
|
+
*/
|
|
1447
|
+
interface ServiceError {
|
|
1448
|
+
code: string;
|
|
1449
|
+
message: string;
|
|
1450
|
+
details?: unknown;
|
|
1451
|
+
cause?: Error;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Type-safe helper for accessing the video service
|
|
1455
|
+
*/
|
|
1456
|
+
declare function getVideoService(runtime: IAgentRuntime): IVideoService | null;
|
|
1457
|
+
/**
|
|
1458
|
+
* Type-safe helper for accessing the browser service
|
|
1459
|
+
*/
|
|
1460
|
+
declare function getBrowserService(runtime: IAgentRuntime): IBrowserService | null;
|
|
1461
|
+
/**
|
|
1462
|
+
* Type-safe helper for accessing the PDF service
|
|
1463
|
+
*/
|
|
1464
|
+
declare function getPdfService(runtime: IAgentRuntime): IPdfService | null;
|
|
1465
|
+
/**
|
|
1466
|
+
* Type-safe helper for accessing the file service
|
|
1467
|
+
*/
|
|
1468
|
+
declare function getFileService(runtime: IAgentRuntime): IFileService | null;
|
|
1469
|
+
/**
|
|
1470
|
+
* Memory type guard for document memories
|
|
1471
|
+
*/
|
|
1472
|
+
declare function isDocumentMemory(memory: Memory): memory is Memory & {
|
|
1473
|
+
metadata: DocumentMetadata;
|
|
1474
|
+
};
|
|
1475
|
+
/**
|
|
1476
|
+
* Memory type guard for fragment memories
|
|
1477
|
+
*/
|
|
1478
|
+
declare function isFragmentMemory(memory: Memory): memory is Memory & {
|
|
1479
|
+
metadata: FragmentMetadata;
|
|
1480
|
+
};
|
|
1481
|
+
/**
|
|
1482
|
+
* Safely access the text content of a memory
|
|
1483
|
+
* @param memory The memory to extract text from
|
|
1484
|
+
* @param defaultValue Optional default value if no text is found
|
|
1485
|
+
* @returns The text content or default value
|
|
1486
|
+
*/
|
|
1487
|
+
declare function getMemoryText(memory: Memory, defaultValue?: string): string;
|
|
1488
|
+
/**
|
|
1489
|
+
* Safely create a ServiceError from any caught error
|
|
1490
|
+
*/
|
|
1491
|
+
declare function createServiceError(error: unknown, code?: string): ServiceError;
|
|
1492
|
+
/**
|
|
1493
|
+
* Replace 'any' types with more specific types
|
|
1494
|
+
*/
|
|
1495
|
+
type StateValue = string | number | boolean | null | StateObject | StateArray;
|
|
1496
|
+
interface StateObject {
|
|
1497
|
+
[key: string]: StateValue;
|
|
1498
|
+
}
|
|
1499
|
+
type StateArray = StateValue[];
|
|
1500
|
+
/**
|
|
1501
|
+
* Enhanced State interface with more specific types
|
|
1502
|
+
*/
|
|
1503
|
+
interface EnhancedState {
|
|
1504
|
+
values: StateObject;
|
|
1505
|
+
data: StateObject;
|
|
1506
|
+
text: string;
|
|
1507
|
+
[key: string]: StateValue;
|
|
1508
|
+
}
|
|
1509
|
+
type ComponentData = Record<string, unknown>;
|
|
1510
|
+
type EventDataObject = Record<string, unknown>;
|
|
1511
|
+
type TypedEventHandler = (data: EventDataObject) => Promise<void> | void;
|
|
1512
|
+
type DbConnection = unknown;
|
|
1513
|
+
type MetadataObject = Record<string, unknown>;
|
|
1514
|
+
type ModelHandler = (runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>;
|
|
1515
|
+
type ServiceConfig = Record<string, unknown>;
|
|
1516
|
+
declare const VECTOR_DIMS: {
|
|
1517
|
+
readonly SMALL: 384;
|
|
1518
|
+
readonly MEDIUM: 512;
|
|
1519
|
+
readonly LARGE: 768;
|
|
1520
|
+
readonly XL: 1024;
|
|
1521
|
+
readonly XXL: 1536;
|
|
1522
|
+
readonly XXXL: 3072;
|
|
1523
|
+
};
|
|
1524
|
+
/**
|
|
1525
|
+
* Interface for control messages sent from the backend to the frontend
|
|
1526
|
+
* to manage UI state and interaction capabilities
|
|
1527
|
+
*/
|
|
1528
|
+
interface ControlMessage {
|
|
1529
|
+
/** Message type identifier */
|
|
1530
|
+
type: 'control';
|
|
1531
|
+
/** Control message payload */
|
|
1532
|
+
payload: {
|
|
1533
|
+
/** Action to perform */
|
|
1534
|
+
action: 'disable_input' | 'enable_input';
|
|
1535
|
+
/** Optional target element identifier */
|
|
1536
|
+
target?: string;
|
|
1537
|
+
/** Additional optional parameters */
|
|
1538
|
+
[key: string]: unknown;
|
|
1539
|
+
};
|
|
1540
|
+
/** Room ID to ensure signal is directed to the correct chat window */
|
|
1541
|
+
roomId: UUID;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Composes a set of example conversations based on provided actions and a specified count.
|
|
1546
|
+
* It randomly selects examples from the provided actions and formats them with generated names.
|
|
1547
|
+
* @param actionsData - An array of `Action` objects from which to draw examples.
|
|
1548
|
+
* @param count - The number of examples to generate.
|
|
1549
|
+
* @returns A string containing formatted examples of conversations.
|
|
1550
|
+
*/
|
|
1551
|
+
/**
|
|
1552
|
+
* Compose a specified number of random action examples from the given actionsData.
|
|
1553
|
+
*
|
|
1554
|
+
* @param {Action[]} actionsData - The list of actions to generate examples from.
|
|
1555
|
+
* @param {number} count - The number of examples to compose.
|
|
1556
|
+
* @returns {string} The formatted action examples.
|
|
1557
|
+
*/
|
|
1558
|
+
declare const composeActionExamples: (actionsData: Action[], count: number) => string;
|
|
1559
|
+
/**
|
|
1560
|
+
* Formats the names of the provided actions into a comma-separated string.
|
|
1561
|
+
* @param actions - An array of `Action` objects from which to extract names.
|
|
1562
|
+
* @returns A comma-separated string of action names.
|
|
1563
|
+
*/
|
|
1564
|
+
declare function formatActionNames(actions: Action[]): string;
|
|
1565
|
+
/**
|
|
1566
|
+
* Formats the provided actions into a detailed string listing each action's name and description, separated by commas and newlines.
|
|
1567
|
+
* @param actions - An array of `Action` objects to format.
|
|
1568
|
+
* @returns A detailed string of actions, including names and descriptions.
|
|
1569
|
+
*/
|
|
1570
|
+
declare function formatActions(actions: Action[]): string;
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* An abstract class representing a database adapter for managing various entities
|
|
1574
|
+
* like entities, memories, entities, goals, and rooms.
|
|
1575
|
+
*/
|
|
1576
|
+
/**
|
|
1577
|
+
* Database adapter class to be extended by individual database adapters.
|
|
1578
|
+
*
|
|
1579
|
+
* @template DB - The type of the database instance.
|
|
1580
|
+
* @abstract
|
|
1581
|
+
* @implements {IDatabaseAdapter}
|
|
1582
|
+
*/
|
|
1583
|
+
declare abstract class DatabaseAdapter<DB = unknown> implements IDatabaseAdapter {
|
|
1584
|
+
/**
|
|
1585
|
+
* The database instance.
|
|
1586
|
+
*/
|
|
1587
|
+
db: DB;
|
|
1588
|
+
/**
|
|
1589
|
+
* Initialize the database adapter.
|
|
1590
|
+
* @returns A Promise that resolves when initialization is complete.
|
|
1591
|
+
*/
|
|
1592
|
+
abstract init(): Promise<void>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Optional close method for the database adapter.
|
|
1595
|
+
* @returns A Promise that resolves when closing is complete.
|
|
1596
|
+
*/
|
|
1597
|
+
abstract close(): Promise<void>;
|
|
1598
|
+
/**
|
|
1599
|
+
* Retrieves an account by its ID.
|
|
1600
|
+
* @param entityId The UUID of the user account to retrieve.
|
|
1601
|
+
* @returns A Promise that resolves to the Entity object or null if not found.
|
|
1602
|
+
*/
|
|
1603
|
+
abstract getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
1604
|
+
abstract getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
1605
|
+
/**
|
|
1606
|
+
* Creates a new entity in the database.
|
|
1607
|
+
* @param entity The entity object to create.
|
|
1608
|
+
* @returns A Promise that resolves when the account creation is complete.
|
|
1609
|
+
*/
|
|
1610
|
+
abstract createEntity(entity: Entity): Promise<boolean>;
|
|
1611
|
+
/**
|
|
1612
|
+
* Updates an existing entity in the database.
|
|
1613
|
+
* @param entity The entity object with updated properties.
|
|
1614
|
+
* @returns A Promise that resolves when the account update is complete.
|
|
1615
|
+
*/
|
|
1616
|
+
abstract updateEntity(entity: Entity): Promise<void>;
|
|
1617
|
+
/**
|
|
1618
|
+
* Retrieves a single component by entity ID and type.
|
|
1619
|
+
* @param entityId The UUID of the entity the component belongs to
|
|
1620
|
+
* @param type The type identifier for the component
|
|
1621
|
+
* @param worldId Optional UUID of the world the component belongs to
|
|
1622
|
+
* @param sourceEntityId Optional UUID of the source entity
|
|
1623
|
+
* @returns Promise resolving to the Component if found, null otherwise
|
|
1624
|
+
*/
|
|
1625
|
+
abstract getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Retrieves all components for an entity.
|
|
1628
|
+
* @param entityId The UUID of the entity to get components for
|
|
1629
|
+
* @param worldId Optional UUID of the world to filter components by
|
|
1630
|
+
* @param sourceEntityId Optional UUID of the source entity to filter by
|
|
1631
|
+
* @returns Promise resolving to array of Component objects
|
|
1632
|
+
*/
|
|
1633
|
+
abstract getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
1634
|
+
/**
|
|
1635
|
+
* Creates a new component in the database.
|
|
1636
|
+
* @param component The component object to create
|
|
1637
|
+
* @returns Promise resolving to true if creation was successful
|
|
1638
|
+
*/
|
|
1639
|
+
abstract createComponent(component: Component): Promise<boolean>;
|
|
1640
|
+
/**
|
|
1641
|
+
* Updates an existing component in the database.
|
|
1642
|
+
* @param component The component object with updated properties
|
|
1643
|
+
* @returns Promise that resolves when the update is complete
|
|
1644
|
+
*/
|
|
1645
|
+
abstract updateComponent(component: Component): Promise<void>;
|
|
1646
|
+
/**
|
|
1647
|
+
* Deletes a component from the database.
|
|
1648
|
+
* @param componentId The UUID of the component to delete
|
|
1649
|
+
* @returns Promise that resolves when the deletion is complete
|
|
1650
|
+
*/
|
|
1651
|
+
abstract deleteComponent(componentId: UUID): Promise<void>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Retrieves memories based on the specified parameters.
|
|
1654
|
+
* @param params An object containing parameters for the memory retrieval.
|
|
1655
|
+
* @returns A Promise that resolves to an array of Memory objects.
|
|
1656
|
+
*/
|
|
1657
|
+
abstract getMemories(params: {
|
|
1658
|
+
entityId?: UUID;
|
|
1659
|
+
agentId?: UUID;
|
|
1660
|
+
roomId?: UUID;
|
|
1661
|
+
count?: number;
|
|
1662
|
+
unique?: boolean;
|
|
1663
|
+
tableName: string;
|
|
1664
|
+
start?: number;
|
|
1665
|
+
end?: number;
|
|
1666
|
+
}): Promise<Memory[]>;
|
|
1667
|
+
abstract getMemoriesByRoomIds(params: {
|
|
1668
|
+
roomIds: UUID[];
|
|
1669
|
+
tableName: string;
|
|
1670
|
+
limit?: number;
|
|
1671
|
+
}): Promise<Memory[]>;
|
|
1672
|
+
abstract getMemoryById(id: UUID): Promise<Memory | null>;
|
|
1673
|
+
/**
|
|
1674
|
+
* Retrieves multiple memories by their IDs
|
|
1675
|
+
* @param memoryIds Array of UUIDs of the memories to retrieve
|
|
1676
|
+
* @param tableName Optional table name to filter memories by type
|
|
1677
|
+
* @returns Promise resolving to array of Memory objects
|
|
1678
|
+
*/
|
|
1679
|
+
abstract getMemoriesByIds(memoryIds: UUID[], tableName?: string): Promise<Memory[]>;
|
|
1680
|
+
/**
|
|
1681
|
+
* Retrieves cached embeddings based on the specified query parameters.
|
|
1682
|
+
* @param params An object containing parameters for the embedding retrieval.
|
|
1683
|
+
* @returns A Promise that resolves to an array of objects containing embeddings and levenshtein scores.
|
|
1684
|
+
*/
|
|
1685
|
+
abstract getCachedEmbeddings({ query_table_name, query_threshold, query_input, query_field_name, query_field_sub_name, query_match_count, }: {
|
|
1686
|
+
query_table_name: string;
|
|
1687
|
+
query_threshold: number;
|
|
1688
|
+
query_input: string;
|
|
1689
|
+
query_field_name: string;
|
|
1690
|
+
query_field_sub_name: string;
|
|
1691
|
+
query_match_count: number;
|
|
1692
|
+
}): Promise<{
|
|
1693
|
+
embedding: number[];
|
|
1694
|
+
levenshtein_score: number;
|
|
1695
|
+
}[]>;
|
|
1696
|
+
/**
|
|
1697
|
+
* Logs an event or action with the specified details.
|
|
1698
|
+
* @param params An object containing parameters for the log entry.
|
|
1699
|
+
* @returns A Promise that resolves when the log entry has been saved.
|
|
1700
|
+
*/
|
|
1701
|
+
abstract log(params: {
|
|
1702
|
+
body: {
|
|
1703
|
+
[key: string]: unknown;
|
|
1704
|
+
};
|
|
1705
|
+
entityId: UUID;
|
|
1706
|
+
roomId: UUID;
|
|
1707
|
+
type: string;
|
|
1708
|
+
}): Promise<void>;
|
|
1709
|
+
/**
|
|
1710
|
+
* Retrieves logs based on the specified parameters.
|
|
1711
|
+
* @param params An object containing parameters for the log retrieval.
|
|
1712
|
+
* @returns A Promise that resolves to an array of Log objects.
|
|
1713
|
+
*/
|
|
1714
|
+
abstract getLogs(params: {
|
|
1715
|
+
entityId: UUID;
|
|
1716
|
+
roomId?: UUID;
|
|
1717
|
+
type?: string;
|
|
1718
|
+
count?: number;
|
|
1719
|
+
offset?: number;
|
|
1720
|
+
}): Promise<Log[]>;
|
|
1721
|
+
/**
|
|
1722
|
+
* Deletes a log from the database.
|
|
1723
|
+
* @param logId The UUID of the log to delete.
|
|
1724
|
+
* @returns A Promise that resolves when the log has been deleted.
|
|
1725
|
+
*/
|
|
1726
|
+
abstract deleteLog(logId: UUID): Promise<void>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Searches for memories based on embeddings and other specified parameters.
|
|
1729
|
+
* @param params An object containing parameters for the memory search.
|
|
1730
|
+
* @returns A Promise that resolves to an array of Memory objects.
|
|
1731
|
+
*/
|
|
1732
|
+
abstract searchMemories(params: {
|
|
1733
|
+
tableName: string;
|
|
1734
|
+
roomId: UUID;
|
|
1735
|
+
embedding: number[];
|
|
1736
|
+
match_threshold: number;
|
|
1737
|
+
count: number;
|
|
1738
|
+
unique: boolean;
|
|
1739
|
+
}): Promise<Memory[]>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Creates a new memory in the database.
|
|
1742
|
+
* @param memory The memory object to create.
|
|
1743
|
+
* @param tableName The table where the memory should be stored.
|
|
1744
|
+
* @param unique Indicates if the memory should be unique.
|
|
1745
|
+
* @returns A Promise that resolves when the memory has been created.
|
|
1746
|
+
*/
|
|
1747
|
+
abstract createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
1748
|
+
/**
|
|
1749
|
+
* Updates an existing memory in the database.
|
|
1750
|
+
* @param memory The memory object with updated content and optional embedding
|
|
1751
|
+
* @returns Promise resolving to boolean indicating success
|
|
1752
|
+
*/
|
|
1753
|
+
abstract updateMemory(memory: Partial<Memory> & {
|
|
1754
|
+
id: UUID;
|
|
1755
|
+
metadata?: MemoryMetadata;
|
|
1756
|
+
}): Promise<boolean>;
|
|
1757
|
+
/**
|
|
1758
|
+
* Removes a specific memory from the database.
|
|
1759
|
+
* @param memoryId The UUID of the memory to remove.
|
|
1760
|
+
* @returns A Promise that resolves when the memory has been removed.
|
|
1761
|
+
*/
|
|
1762
|
+
abstract deleteMemory(memoryId: UUID): Promise<void>;
|
|
1763
|
+
/**
|
|
1764
|
+
* Removes all memories associated with a specific room.
|
|
1765
|
+
* @param roomId The UUID of the room whose memories should be removed.
|
|
1766
|
+
* @param tableName The table from which the memories should be removed.
|
|
1767
|
+
* @returns A Promise that resolves when all memories have been removed.
|
|
1768
|
+
*/
|
|
1769
|
+
abstract deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
1770
|
+
/**
|
|
1771
|
+
* Counts the number of memories in a specific room.
|
|
1772
|
+
* @param roomId The UUID of the room for which to count memories.
|
|
1773
|
+
* @param unique Specifies whether to count only unique memories.
|
|
1774
|
+
* @param tableName Optional table name to count memories from.
|
|
1775
|
+
* @returns A Promise that resolves to the number of memories.
|
|
1776
|
+
*/
|
|
1777
|
+
abstract countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
1778
|
+
/**
|
|
1779
|
+
* Retrieves a world by its ID.
|
|
1780
|
+
* @param id The UUID of the world to retrieve.
|
|
1781
|
+
* @returns A Promise that resolves to the World object or null if not found.
|
|
1782
|
+
*/
|
|
1783
|
+
abstract getWorld(id: UUID): Promise<World | null>;
|
|
1784
|
+
/**
|
|
1785
|
+
* Retrieves all worlds for an agent.
|
|
1786
|
+
* @returns A Promise that resolves to an array of World objects.
|
|
1787
|
+
*/
|
|
1788
|
+
abstract getAllWorlds(): Promise<World[]>;
|
|
1789
|
+
/**
|
|
1790
|
+
* Creates a new world in the database.
|
|
1791
|
+
* @param world The world object to create.
|
|
1792
|
+
* @returns A Promise that resolves to the UUID of the created world.
|
|
1793
|
+
*/
|
|
1794
|
+
abstract createWorld(world: World): Promise<UUID>;
|
|
1795
|
+
/**
|
|
1796
|
+
* Updates an existing world in the database.
|
|
1797
|
+
* @param world The world object with updated properties.
|
|
1798
|
+
* @returns A Promise that resolves when the world has been updated.
|
|
1799
|
+
*/
|
|
1800
|
+
abstract updateWorld(world: World): Promise<void>;
|
|
1801
|
+
/**
|
|
1802
|
+
* Removes a specific world from the database.
|
|
1803
|
+
* @param id The UUID of the world to remove.
|
|
1804
|
+
* @returns A Promise that resolves when the world has been removed.
|
|
1805
|
+
*/
|
|
1806
|
+
abstract removeWorld(id: UUID): Promise<void>;
|
|
1807
|
+
/**
|
|
1808
|
+
* Retrieves the room ID for a given room, if it exists.
|
|
1809
|
+
* @param roomId The UUID of the room to retrieve.
|
|
1810
|
+
* @returns A Promise that resolves to the room ID or null if not found.
|
|
1811
|
+
*/
|
|
1812
|
+
abstract getRoom(roomId: UUID): Promise<Room | null>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Retrieves all rooms for a given world.
|
|
1815
|
+
* @param worldId The UUID of the world to retrieve rooms for.
|
|
1816
|
+
* @returns A Promise that resolves to an array of Room objects.
|
|
1817
|
+
*/
|
|
1818
|
+
abstract getRooms(worldId: UUID): Promise<Room[]>;
|
|
1819
|
+
/**
|
|
1820
|
+
* Creates a new room with an optional specified ID.
|
|
1821
|
+
* @param roomId Optional UUID to assign to the new room.
|
|
1822
|
+
* @returns A Promise that resolves to the UUID of the created room.
|
|
1823
|
+
*/
|
|
1824
|
+
abstract createRoom({ id, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
|
|
1825
|
+
/**
|
|
1826
|
+
* Updates a specific room in the database.
|
|
1827
|
+
* @param room The room object with updated properties.
|
|
1828
|
+
* @returns A Promise that resolves when the room has been updated.
|
|
1829
|
+
*/
|
|
1830
|
+
abstract updateRoom(room: Room): Promise<void>;
|
|
1831
|
+
/**
|
|
1832
|
+
* Removes a specific room from the database.
|
|
1833
|
+
* @param roomId The UUID of the room to remove.
|
|
1834
|
+
* @returns A Promise that resolves when the room has been removed.
|
|
1835
|
+
*/
|
|
1836
|
+
abstract deleteRoom(roomId: UUID): Promise<void>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Retrieves room IDs for which a specific user is a participant.
|
|
1839
|
+
* @param entityId The UUID of the user.
|
|
1840
|
+
* @returns A Promise that resolves to an array of room IDs.
|
|
1841
|
+
*/
|
|
1842
|
+
abstract getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
1843
|
+
/**
|
|
1844
|
+
* Retrieves room IDs for which specific users are participants.
|
|
1845
|
+
* @param userIds An array of UUIDs of the users.
|
|
1846
|
+
* @returns A Promise that resolves to an array of room IDs.
|
|
1847
|
+
*/
|
|
1848
|
+
abstract getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
1849
|
+
/**
|
|
1850
|
+
* Adds a user as a participant to a specific room.
|
|
1851
|
+
* @param entityId The UUID of the user to add as a participant.
|
|
1852
|
+
* @param roomId The UUID of the room to which the user will be added.
|
|
1853
|
+
* @returns A Promise that resolves to a boolean indicating success or failure.
|
|
1854
|
+
*/
|
|
1855
|
+
abstract addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Removes a user as a participant from a specific room.
|
|
1858
|
+
* @param entityId The UUID of the user to remove as a participant.
|
|
1859
|
+
* @param roomId The UUID of the room from which the user will be removed.
|
|
1860
|
+
* @returns A Promise that resolves to a boolean indicating success or failure.
|
|
1861
|
+
*/
|
|
1862
|
+
abstract removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
1863
|
+
/**
|
|
1864
|
+
* Retrieves participants associated with a specific account.
|
|
1865
|
+
* @param entityId The UUID of the account.
|
|
1866
|
+
* @returns A Promise that resolves to an array of Participant objects.
|
|
1867
|
+
*/
|
|
1868
|
+
abstract getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
1869
|
+
/**
|
|
1870
|
+
* Retrieves participants for a specific room.
|
|
1871
|
+
* @param roomId The UUID of the room for which to retrieve participants.
|
|
1872
|
+
* @returns A Promise that resolves to an array of UUIDs representing the participants.
|
|
1873
|
+
*/
|
|
1874
|
+
abstract getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
1875
|
+
abstract getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
1876
|
+
abstract setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
1877
|
+
/**
|
|
1878
|
+
* Creates a new relationship between two users.
|
|
1879
|
+
* @param params Object containing the relationship details including entity IDs, agent ID, optional tags and metadata
|
|
1880
|
+
* @returns A Promise that resolves to a boolean indicating success or failure of the creation.
|
|
1881
|
+
*/
|
|
1882
|
+
abstract createRelationship(params: {
|
|
1883
|
+
sourceEntityId: UUID;
|
|
1884
|
+
targetEntityId: UUID;
|
|
1885
|
+
tags?: string[];
|
|
1886
|
+
metadata?: Record<string, unknown>;
|
|
1887
|
+
}): Promise<boolean>;
|
|
1888
|
+
/**
|
|
1889
|
+
* Retrieves a relationship between two users if it exists.
|
|
1890
|
+
* @param params Object containing the entity IDs and agent ID
|
|
1891
|
+
* @returns A Promise that resolves to the Relationship object or null if not found.
|
|
1892
|
+
*/
|
|
1893
|
+
abstract getRelationship(params: {
|
|
1894
|
+
sourceEntityId: UUID;
|
|
1895
|
+
targetEntityId: UUID;
|
|
1896
|
+
}): Promise<Relationship | null>;
|
|
1897
|
+
/**
|
|
1898
|
+
* Retrieves all relationships for a specific user.
|
|
1899
|
+
* @param params Object containing the user ID, agent ID and optional tags to filter by
|
|
1900
|
+
* @returns A Promise that resolves to an array of Relationship objects.
|
|
1901
|
+
*/
|
|
1902
|
+
abstract getRelationships(params: {
|
|
1903
|
+
entityId: UUID;
|
|
1904
|
+
tags?: string[];
|
|
1905
|
+
}): Promise<Relationship[]>;
|
|
1906
|
+
/**
|
|
1907
|
+
* Updates an existing relationship between two users.
|
|
1908
|
+
* @param params Object containing the relationship details to update including entity IDs, agent ID, optional tags and metadata
|
|
1909
|
+
* @returns A Promise that resolves to a boolean indicating success or failure of the update.
|
|
1910
|
+
*/
|
|
1911
|
+
abstract updateRelationship(params: {
|
|
1912
|
+
sourceEntityId: UUID;
|
|
1913
|
+
targetEntityId: UUID;
|
|
1914
|
+
tags?: string[];
|
|
1915
|
+
metadata?: Record<string, unknown>;
|
|
1916
|
+
}): Promise<void>;
|
|
1917
|
+
/**
|
|
1918
|
+
* Retrieves an agent by its ID.
|
|
1919
|
+
* @param agentId The UUID of the agent to retrieve.
|
|
1920
|
+
* @returns A Promise that resolves to the Agent object or null if not found.
|
|
1921
|
+
*/
|
|
1922
|
+
abstract getAgent(agentId: UUID): Promise<Agent | null>;
|
|
1923
|
+
/**
|
|
1924
|
+
* Retrieves all agents from the database.
|
|
1925
|
+
* @returns A Promise that resolves to an array of Agent objects.
|
|
1926
|
+
*/
|
|
1927
|
+
abstract getAgents(): Promise<Agent[]>;
|
|
1928
|
+
/**
|
|
1929
|
+
* Creates a new agent in the database.
|
|
1930
|
+
* @param agent The agent object to create.
|
|
1931
|
+
* @returns A Promise that resolves to a boolean indicating success or failure of the creation.
|
|
1932
|
+
*/
|
|
1933
|
+
abstract createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
1934
|
+
/**
|
|
1935
|
+
* Updates an existing agent in the database.
|
|
1936
|
+
* @param agentId The UUID of the agent to update.
|
|
1937
|
+
* @param agent The agent object with updated properties.
|
|
1938
|
+
* @returns A Promise that resolves to a boolean indicating success or failure of the update.
|
|
1939
|
+
*/
|
|
1940
|
+
abstract updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
1941
|
+
/**
|
|
1942
|
+
* Deletes an agent from the database.
|
|
1943
|
+
* @param agentId The UUID of the agent to delete.
|
|
1944
|
+
* @returns A Promise that resolves to a boolean indicating success or failure of the deletion.
|
|
1945
|
+
*/
|
|
1946
|
+
abstract deleteAgent(agentId: UUID): Promise<boolean>;
|
|
1947
|
+
/**
|
|
1948
|
+
* Ensures an agent exists in the database.
|
|
1949
|
+
* @param agent The agent object to ensure exists.
|
|
1950
|
+
* @returns A Promise that resolves when the agent has been ensured to exist.
|
|
1951
|
+
*/
|
|
1952
|
+
abstract ensureAgentExists(agent: Partial<Agent>): Promise<Agent>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Ensures an embedding dimension exists in the database.
|
|
1955
|
+
* @param dimension The dimension to ensure exists.
|
|
1956
|
+
* @returns A Promise that resolves when the embedding dimension has been ensured to exist.
|
|
1957
|
+
*/
|
|
1958
|
+
abstract ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
1959
|
+
/**
|
|
1960
|
+
* Retrieves a cached value by key from the database.
|
|
1961
|
+
* @param key The key to look up in the cache
|
|
1962
|
+
* @returns Promise resolving to the cached string value
|
|
1963
|
+
*/
|
|
1964
|
+
abstract getCache<T>(key: string): Promise<T | undefined>;
|
|
1965
|
+
/**
|
|
1966
|
+
* Sets a value in the cache with the given key.
|
|
1967
|
+
* @param params Object containing the cache key and value
|
|
1968
|
+
* @param key The key to store the value under
|
|
1969
|
+
* @param value The string value to cache
|
|
1970
|
+
* @returns Promise resolving to true if the cache was set successfully
|
|
1971
|
+
*/
|
|
1972
|
+
abstract setCache<T>(key: string, value: T): Promise<boolean>;
|
|
1973
|
+
/**
|
|
1974
|
+
* Deletes a value from the cache by key.
|
|
1975
|
+
* @param key The key to delete from the cache
|
|
1976
|
+
* @returns Promise resolving to true if the value was successfully deleted
|
|
1977
|
+
*/
|
|
1978
|
+
abstract deleteCache(key: string): Promise<boolean>;
|
|
1979
|
+
/**
|
|
1980
|
+
* Creates a new task instance in the database.
|
|
1981
|
+
* @param task The task object to create
|
|
1982
|
+
* @returns Promise resolving to the UUID of the created task
|
|
1983
|
+
*/
|
|
1984
|
+
abstract createTask(task: Task): Promise<UUID>;
|
|
1985
|
+
/**
|
|
1986
|
+
* Retrieves tasks based on specified parameters.
|
|
1987
|
+
* @param params Object containing optional roomId and tags to filter tasks
|
|
1988
|
+
* @returns Promise resolving to an array of Task objects
|
|
1989
|
+
*/
|
|
1990
|
+
abstract getTasks(params: {
|
|
1991
|
+
roomId?: UUID;
|
|
1992
|
+
tags?: string[];
|
|
1993
|
+
}): Promise<Task[]>;
|
|
1994
|
+
/**
|
|
1995
|
+
* Retrieves a specific task by its ID.
|
|
1996
|
+
* @param id The UUID of the task to retrieve
|
|
1997
|
+
* @returns Promise resolving to the Task object if found, null otherwise
|
|
1998
|
+
*/
|
|
1999
|
+
abstract getTask(id: UUID): Promise<Task | null>;
|
|
2000
|
+
/**
|
|
2001
|
+
* Retrieves a specific task by its name.
|
|
2002
|
+
* @param name The name of the task to retrieve
|
|
2003
|
+
* @returns Promise resolving to the Task object if found, null otherwise
|
|
2004
|
+
*/
|
|
2005
|
+
abstract getTasksByName(name: string): Promise<Task[]>;
|
|
2006
|
+
/**
|
|
2007
|
+
* Updates an existing task in the database.
|
|
2008
|
+
* @param id The UUID of the task to update
|
|
2009
|
+
* @param task Partial Task object containing the fields to update
|
|
2010
|
+
* @returns Promise resolving when the update is complete
|
|
2011
|
+
*/
|
|
2012
|
+
abstract updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
2013
|
+
/**
|
|
2014
|
+
* Deletes a task from the database.
|
|
2015
|
+
* @param id The UUID of the task to delete
|
|
2016
|
+
* @returns Promise resolving when the deletion is complete
|
|
2017
|
+
*/
|
|
2018
|
+
abstract deleteTask(id: UUID): Promise<void>;
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
/**
|
|
2022
|
+
* Finds an entity by name in the given runtime environment.
|
|
2023
|
+
*
|
|
2024
|
+
* @param {IAgentRuntime} runtime - The agent runtime environment.
|
|
2025
|
+
* @param {Memory} message - The memory message containing relevant information.
|
|
2026
|
+
* @param {State} state - The current state of the system.
|
|
2027
|
+
* @returns {Promise<Entity | null>} A promise that resolves to the found entity or null if not found.
|
|
2028
|
+
*/
|
|
2029
|
+
declare function findEntityByName(runtime: IAgentRuntime, message: Memory, state: State): Promise<Entity | null>;
|
|
2030
|
+
/**
|
|
2031
|
+
* Function to create a unique UUID based on the runtime and base user ID.
|
|
2032
|
+
*
|
|
2033
|
+
* @param {RuntimeContext} runtime - The runtime context object.
|
|
2034
|
+
* @param {UUID|string} baseUserId - The base user ID to use in generating the UUID.
|
|
2035
|
+
* @returns {UUID} - The unique UUID generated based on the runtime and base user ID.
|
|
2036
|
+
*/
|
|
2037
|
+
declare const createUniqueUuid: (runtime: any, baseUserId: UUID | string) => UUID;
|
|
2038
|
+
/**
|
|
2039
|
+
* Get details for a list of entities.
|
|
2040
|
+
*/
|
|
2041
|
+
/**
|
|
2042
|
+
* Retrieves entity details for a specific room from the database.
|
|
2043
|
+
*
|
|
2044
|
+
* @param {Object} params - The input parameters
|
|
2045
|
+
* @param {IAgentRuntime} params.runtime - The Agent Runtime instance
|
|
2046
|
+
* @param {UUID} params.roomId - The ID of the room to retrieve entity details for
|
|
2047
|
+
* @returns {Promise<Array>} - A promise that resolves to an array of unique entity details
|
|
2048
|
+
*/
|
|
2049
|
+
declare function getEntityDetails({ runtime, roomId, }: {
|
|
2050
|
+
runtime: IAgentRuntime;
|
|
2051
|
+
roomId: UUID;
|
|
2052
|
+
}): Promise<any[]>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Format entities into a string
|
|
2055
|
+
* @param entities - list of entities
|
|
2056
|
+
* @returns string
|
|
2057
|
+
*/
|
|
2058
|
+
/**
|
|
2059
|
+
* Format the given entities into a string representation.
|
|
2060
|
+
*
|
|
2061
|
+
* @param {Object} options - The options object.
|
|
2062
|
+
* @param {Entity[]} options.entities - The list of entities to format.
|
|
2063
|
+
* @returns {string} A formatted string representing the entities.
|
|
2064
|
+
*/
|
|
2065
|
+
declare function formatEntities({ entities }: {
|
|
2066
|
+
entities: Entity[];
|
|
2067
|
+
}): string;
|
|
2068
|
+
|
|
2069
|
+
declare let logger: pino.Logger<string, boolean>;
|
|
2070
|
+
|
|
2071
|
+
declare const elizaLogger: pino.Logger<string, boolean>;
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* Convert all double-brace bindings ({{var}}) in a Handlebars template
|
|
2075
|
+
* to triple-brace bindings ({{{var}}}), so the output is NOT HTML-escaped.
|
|
2076
|
+
*
|
|
2077
|
+
* - Ignores block/partial/comment tags that start with # / ! >.
|
|
2078
|
+
* - Ignores the {{else}} keyword.
|
|
2079
|
+
* - Ignores bindings that are already triple-braced.
|
|
2080
|
+
*
|
|
2081
|
+
* @param {string} tpl Handlebars template source
|
|
2082
|
+
* @return {string} Transformed template
|
|
2083
|
+
*/
|
|
2084
|
+
declare function upgradeDoubleToTriple(tpl: any): any;
|
|
2085
|
+
/**
|
|
2086
|
+
* Composes a context string by replacing placeholders in a template with corresponding values from the state.
|
|
2087
|
+
*
|
|
2088
|
+
* This function takes a template string with placeholders in the format `{{placeholder}}` and a state object.
|
|
2089
|
+
* It replaces each placeholder with the value from the state object that matches the placeholder's name.
|
|
2090
|
+
* If a matching key is not found in the state object for a given placeholder, the placeholder is replaced with an empty string.
|
|
2091
|
+
*
|
|
2092
|
+
* @param {Object} params - The parameters for composing the context.
|
|
2093
|
+
* @param {State} params.state - The state object containing values to replace the placeholders in the template.
|
|
2094
|
+
* @param {TemplateType} params.template - The template string or function containing placeholders to be replaced with state values.
|
|
2095
|
+
* @returns {string} The composed context string with placeholders replaced by corresponding state values.
|
|
2096
|
+
*
|
|
2097
|
+
* @example
|
|
2098
|
+
* // Given a state object and a template
|
|
2099
|
+
* const state = { userName: "Alice", userAge: 30 };
|
|
2100
|
+
* const template = "Hello, {{userName}}! You are {{userAge}} years old";
|
|
2101
|
+
*
|
|
2102
|
+
* // Composing the context with simple string replacement will result in:
|
|
2103
|
+
* // "Hello, Alice! You are 30 years old."
|
|
2104
|
+
* const contextSimple = composePromptFromState({ state, template });
|
|
2105
|
+
*
|
|
2106
|
+
* // Using composePromptFromState with a template function for dynamic template
|
|
2107
|
+
* const template = ({ state }) => {
|
|
2108
|
+
* const tone = Math.random() > 0.5 ? "kind" : "rude";
|
|
2109
|
+
* return `Hello, {{userName}}! You are {{userAge}} years old. Be ${tone}`;
|
|
2110
|
+
* };
|
|
2111
|
+
* const contextSimple = composePromptFromState({ state, template });
|
|
2112
|
+
*/
|
|
2113
|
+
/**
|
|
2114
|
+
* Function to compose a prompt using a provided template and state.
|
|
2115
|
+
*
|
|
2116
|
+
* @param {Object} options - Object containing state and template information.
|
|
2117
|
+
* @param {State} options.state - The state object containing values to fill the template.
|
|
2118
|
+
* @param {TemplateType} options.template - The template to be used for composing the prompt.
|
|
2119
|
+
* @returns {string} The composed prompt output.
|
|
2120
|
+
*/
|
|
2121
|
+
declare const composePrompt: ({ state, template, }: {
|
|
2122
|
+
state: {
|
|
2123
|
+
[key: string]: string;
|
|
2124
|
+
};
|
|
2125
|
+
template: TemplateType;
|
|
2126
|
+
}) => string;
|
|
2127
|
+
/**
|
|
2128
|
+
* Function to compose a prompt using a provided template and state.
|
|
2129
|
+
*
|
|
2130
|
+
* @param {Object} options - Object containing state and template information.
|
|
2131
|
+
* @param {State} options.state - The state object containing values to fill the template.
|
|
2132
|
+
* @param {TemplateType} options.template - The template to be used for composing the prompt.
|
|
2133
|
+
* @returns {string} The composed prompt output.
|
|
2134
|
+
*/
|
|
2135
|
+
declare const composePromptFromState: ({ state, template, }: {
|
|
2136
|
+
state: State;
|
|
2137
|
+
template: TemplateType;
|
|
2138
|
+
}) => string;
|
|
2139
|
+
/**
|
|
2140
|
+
* Adds a header to a body of text.
|
|
2141
|
+
*
|
|
2142
|
+
* This function takes a header string and a body string and returns a new string with the header prepended to the body.
|
|
2143
|
+
* If the body string is empty, the header is returned as is.
|
|
2144
|
+
*
|
|
2145
|
+
* @param {string} header - The header to add to the body.
|
|
2146
|
+
* @param {string} body - The body to which to add the header.
|
|
2147
|
+
* @returns {string} The body with the header prepended.
|
|
2148
|
+
*
|
|
2149
|
+
* @example
|
|
2150
|
+
* // Given a header and a body
|
|
2151
|
+
* const header = "Header";
|
|
2152
|
+
* const body = "Body";
|
|
2153
|
+
*
|
|
2154
|
+
* // Adding the header to the body will result in:
|
|
2155
|
+
* // "Header\nBody"
|
|
2156
|
+
* const text = addHeader(header, body);
|
|
2157
|
+
*/
|
|
2158
|
+
declare const addHeader: (header: string, body: string) => string;
|
|
2159
|
+
/**
|
|
2160
|
+
* Generates a string with random user names populated in a template.
|
|
2161
|
+
*
|
|
2162
|
+
* This function generates random user names and populates placeholders
|
|
2163
|
+
* in the provided template with these names. Placeholders in the template should follow the format `{{userX}}`
|
|
2164
|
+
* where `X` is the position of the user (e.g., `{{name1}}`, `{{name2}}`).
|
|
2165
|
+
*
|
|
2166
|
+
* @param {string} template - The template string containing placeholders for random user names.
|
|
2167
|
+
* @param {number} length - The number of random user names to generate.
|
|
2168
|
+
* @returns {string} The template string with placeholders replaced by random user names.
|
|
2169
|
+
*
|
|
2170
|
+
* @example
|
|
2171
|
+
* // Given a template and a length
|
|
2172
|
+
* const template = "Hello, {{name1}}! Meet {{name2}} and {{name3}}.";
|
|
2173
|
+
* const length = 3;
|
|
2174
|
+
*
|
|
2175
|
+
* // Composing the random user string will result in:
|
|
2176
|
+
* // "Hello, John! Meet Alice and Bob."
|
|
2177
|
+
* const result = composeRandomUser(template, length);
|
|
2178
|
+
*/
|
|
2179
|
+
declare const composeRandomUser: (template: string, length: number) => string;
|
|
2180
|
+
declare const formatPosts: ({ messages, entities, conversationHeader, }: {
|
|
2181
|
+
messages: Memory[];
|
|
2182
|
+
entities: Entity[];
|
|
2183
|
+
conversationHeader?: boolean;
|
|
2184
|
+
}) => string;
|
|
2185
|
+
/**
|
|
2186
|
+
* Format messages into a string
|
|
2187
|
+
* @param {Object} params - The formatting parameters
|
|
2188
|
+
* @param {Memory[]} params.messages - List of messages to format
|
|
2189
|
+
* @param {Entity[]} params.entities - List of entities for name resolution
|
|
2190
|
+
* @returns {string} Formatted message string with timestamps and user information
|
|
2191
|
+
*/
|
|
2192
|
+
declare const formatMessages: ({ messages, entities, }: {
|
|
2193
|
+
messages: Memory[];
|
|
2194
|
+
entities: Entity[];
|
|
2195
|
+
}) => string;
|
|
2196
|
+
declare const formatTimestamp: (messageDate: number) => string;
|
|
2197
|
+
declare const shouldRespondTemplate = "# Task: Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.\n{{providers}}\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.\nIf responding with the RESPOND action, include a list of optional providers that could be relevant to the response.\nResponse format should be formatted in a valid JSON block like this:\n```json\n{\n \"name\": \"{{agentName}}\",\n\t\"reasoning\": \"<string>\",\n \"action\": \"RESPOND\" | \"IGNORE\" | \"STOP\",\n \"providers\": [\"<string>\", \"<string>\", ...]\n}\n```\nYour response should include the valid JSON block and nothing else.";
|
|
2198
|
+
declare const providersTemplate = "# Task: Determine which providers would be most relevant for {{agentName}} to use in responding to this message.\n{{providers}}\n# Instructions: Based on the context and message, select the providers that would give {{agentName}} the most relevant information for crafting a response.\nConsider the following when selecting providers:\n- What information would help {{agentName}} understand the context better?\n- What data would help {{agentName}} provide a more informed response?\n- What providers might have relevant historical or contextual information?\n\nResponse format should be formatted in a valid JSON block like this:\n```json\n{\n \"providers\": [\"<string>\", \"<string>\", ...]\n}\n```\nYour response should include the valid JSON block and nothing else.";
|
|
2199
|
+
declare const messageHandlerTemplate = "# Task: Generate dialog and actions for the character {{agentName}}.\n{{providers}}\n# Instructions: Write 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.\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\"thought\" should be a short description of what the agent is thinking about and planning.\n\"actions\" should be an array 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 an optional array of the providers that {{agentName}} will use to have the right context for responding and acting\n\"evaluators\" should be an optional array of the evaluators that {{agentName}} will use to evaluate the conversation after responding\n\"message\" should be the next message for {{agentName}} which they will send to the conversation.\nThese are the available valid actions: {{actionNames}}\n\nResponse format should be formatted in a valid JSON block like this:\n```json\n{\n \"thought\": \"<string>\",\n \"actions\": [\"<string>\", \"<string>\", ...],\n \"providers\": [\"<string>\", \"<string>\", ...],\n \"message\": \"<string>\"\n}\n```\n\nYour response should include the valid JSON block and nothing else.";
|
|
2200
|
+
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```json\n{ \"thought\": \"I am thinking about writing a post about the importance of AI in our lives\", \"post\": \"AI is changing the world and it is important to understand how it works\", \"imagePrompt\": \"A futuristic cityscape with flying cars and people using AI to do things\" }\n```\n\n2. A post about dogs\n```json\n{ \"thought\": \"I am thinking about writing a post about dogs\", \"post\": \"Dogs are man's best friend and they are loyal and loving\", \"imagePrompt\": \"A dog playing with a ball in a park\" }\n```\n\n3. A post about finding a new job\n```json\n{ \"thought\": \"Getting a job is hard, I bet there's a good tweet in that\", \"post\": \"Just keep going!\", \"imagePrompt\": \"A person looking at a computer screen with a job search website\" }\n```\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 a valid JSON block like this:\n```json\n{ \"thought\": \"<string>\", \"post\": \"<string>\", \"imagePrompt\": \"<string>\" }\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.\nYour reponse should ONLY contain a valid JSON block and nothing else.";
|
|
2201
|
+
declare const booleanFooter = "Respond with only a YES or a NO.";
|
|
2202
|
+
/**
|
|
2203
|
+
* Parses a string to determine its boolean equivalent.
|
|
2204
|
+
*
|
|
2205
|
+
* Recognized affirmative values: "YES", "Y", "TRUE", "T", "1", "ON", "ENABLE"
|
|
2206
|
+
* Recognized negative values: "NO", "N", "FALSE", "F", "0", "OFF", "DISABLE"
|
|
2207
|
+
*
|
|
2208
|
+
* @param {string | undefined | null} value - The input text to parse
|
|
2209
|
+
* @returns {boolean} - Returns `true` for affirmative inputs, `false` for negative or unrecognized inputs
|
|
2210
|
+
*/
|
|
2211
|
+
declare function parseBooleanFromText(value: string | undefined | null): boolean;
|
|
2212
|
+
declare const stringArrayFooter = "Respond with a JSON array containing the values in a valid JSON block formatted for markdown with this structure:\n```json\n[\n 'value',\n 'value'\n]\n```\n\nYour response must include the valid JSON block.";
|
|
2213
|
+
/**
|
|
2214
|
+
* Parses a JSON array from a given text. The function looks for a JSON block wrapped in triple backticks
|
|
2215
|
+
* with `json` language identifier, and if not found, it searches for an array pattern within the text.
|
|
2216
|
+
* It then attempts to parse the JSON string into a JavaScript object. If parsing is successful and the result
|
|
2217
|
+
* is an array, it returns the array; otherwise, it returns null.
|
|
2218
|
+
*
|
|
2219
|
+
* @param text - The input text from which to extract and parse the JSON array.
|
|
2220
|
+
* @returns An array parsed from the JSON string if successful; otherwise, null.
|
|
2221
|
+
*/
|
|
2222
|
+
declare function parseJsonArrayFromText(text: string): any[];
|
|
2223
|
+
/**
|
|
2224
|
+
* Parses a JSON object from a given text. The function looks for a JSON block wrapped in triple backticks
|
|
2225
|
+
* with `json` language identifier, and if not found, it searches for an object pattern within the text.
|
|
2226
|
+
* It then attempts to parse the JSON string into a JavaScript object. If parsing is successful and the result
|
|
2227
|
+
* is an object (but not an array), it returns the object; otherwise, it tries to parse an array if the result
|
|
2228
|
+
* is an array, or returns null if parsing is unsuccessful or the result is neither an object nor an array.
|
|
2229
|
+
*
|
|
2230
|
+
* @param text - The input text from which to extract and parse the JSON object.
|
|
2231
|
+
* @returns An object parsed from the JSON string if successful; otherwise, null or the result of parsing an array.
|
|
2232
|
+
*/
|
|
2233
|
+
declare function parseJSONObjectFromText(text: string): Record<string, any> | null;
|
|
2234
|
+
/**
|
|
2235
|
+
* Extracts specific attributes (e.g., user, text, action) from a JSON-like string using regex.
|
|
2236
|
+
* @param response - The cleaned string response to extract attributes from.
|
|
2237
|
+
* @param attributesToExtract - An array of attribute names to extract.
|
|
2238
|
+
* @returns An object containing the extracted attributes.
|
|
2239
|
+
*/
|
|
2240
|
+
declare function extractAttributes(response: string, attributesToExtract?: string[]): {
|
|
2241
|
+
[key: string]: string | undefined;
|
|
2242
|
+
};
|
|
2243
|
+
/**
|
|
2244
|
+
* Normalizes a JSON-like string by correcting formatting issues:
|
|
2245
|
+
* - Removes extra spaces after '{' and before '}'.
|
|
2246
|
+
* - Wraps unquoted values in double quotes.
|
|
2247
|
+
* - Converts single-quoted values to double-quoted.
|
|
2248
|
+
* - Ensures consistency in key-value formatting.
|
|
2249
|
+
* - Normalizes mixed adjacent quote pairs.
|
|
2250
|
+
*
|
|
2251
|
+
* This is useful for cleaning up improperly formatted JSON strings
|
|
2252
|
+
* before parsing them into valid JSON.
|
|
2253
|
+
*
|
|
2254
|
+
* @param str - The JSON-like string to normalize.
|
|
2255
|
+
* @returns A properly formatted JSON string.
|
|
2256
|
+
*/
|
|
2257
|
+
declare const normalizeJsonString: (str: string) => string;
|
|
2258
|
+
/**
|
|
2259
|
+
* Cleans a JSON-like response string by removing unnecessary markers, line breaks, and extra whitespace.
|
|
2260
|
+
* This is useful for handling improperly formatted JSON responses from external sources.
|
|
2261
|
+
*
|
|
2262
|
+
* @param response - The raw JSON-like string response to clean.
|
|
2263
|
+
* @returns The cleaned string, ready for parsing or further processing.
|
|
2264
|
+
*/
|
|
2265
|
+
declare function cleanJsonResponse(response: string): string;
|
|
2266
|
+
declare const postActionResponseFooter = "Choose any combination of [LIKE], [RETWEET], [QUOTE], and [REPLY] that are appropriate. Each action must be on its own line. Your response must only include the chosen actions.";
|
|
2267
|
+
type ActionResponse = {
|
|
2268
|
+
like: boolean;
|
|
2269
|
+
retweet: boolean;
|
|
2270
|
+
quote?: boolean;
|
|
2271
|
+
reply?: boolean;
|
|
2272
|
+
};
|
|
2273
|
+
declare const parseActionResponseFromText: (text: string) => {
|
|
2274
|
+
actions: ActionResponse;
|
|
2275
|
+
};
|
|
2276
|
+
/**
|
|
2277
|
+
* Truncate text to fit within the character limit, ensuring it ends at a complete sentence.
|
|
2278
|
+
*/
|
|
2279
|
+
declare function truncateToCompleteSentence(text: string, maxLength: number): string;
|
|
2280
|
+
declare function splitChunks(content: string, chunkSize?: number, bleed?: number): Promise<string[]>;
|
|
2281
|
+
/**
|
|
2282
|
+
* Trims the provided text prompt to a specified token limit using a tokenizer model and type.
|
|
2283
|
+
*/
|
|
2284
|
+
declare function trimTokens(prompt: string, maxTokens: number, runtime: IAgentRuntime): Promise<string>;
|
|
2285
|
+
|
|
2286
|
+
/**
|
|
2287
|
+
* Represents the state of server ownership, including a mapping of server IDs to their respective World objects.
|
|
2288
|
+
*/
|
|
2289
|
+
/**
|
|
2290
|
+
* Interface representing the ownership state of servers.
|
|
2291
|
+
* @property {Object.<string, World>} servers - The servers and their corresponding worlds, where the key is the server ID and the value is the World object.
|
|
2292
|
+
*/
|
|
2293
|
+
interface ServerOwnershipState {
|
|
2294
|
+
servers: {
|
|
2295
|
+
[serverId: string]: World;
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
/**
|
|
2299
|
+
* Gets a user's role from world metadata
|
|
2300
|
+
*/
|
|
2301
|
+
/**
|
|
2302
|
+
* Retrieve the server role of a specified user entity within a given server.
|
|
2303
|
+
*
|
|
2304
|
+
* @param {IAgentRuntime} runtime - The runtime object containing necessary configurations and services.
|
|
2305
|
+
* @param {string} entityId - The unique identifier of the user entity.
|
|
2306
|
+
* @param {string} serverId - The unique identifier of the server.
|
|
2307
|
+
* @returns {Promise<Role>} The role of the user entity within the server, resolved as a Promise.
|
|
2308
|
+
*/
|
|
2309
|
+
declare function getUserServerRole(runtime: IAgentRuntime, entityId: string, serverId: string): Promise<Role>;
|
|
2310
|
+
/**
|
|
2311
|
+
* Finds a server where the given user is the owner
|
|
2312
|
+
*/
|
|
2313
|
+
declare function findWorldsForOwner(runtime: IAgentRuntime, entityId: string): Promise<World[] | null>;
|
|
2314
|
+
|
|
2315
|
+
interface InstrumentationConfig {
|
|
2316
|
+
serviceName?: string;
|
|
2317
|
+
otlpEndpoint?: string;
|
|
2318
|
+
enabled?: boolean;
|
|
2319
|
+
}
|
|
2320
|
+
interface IInstrumentationService {
|
|
2321
|
+
readonly name: string;
|
|
2322
|
+
readonly capabilityDescription: string;
|
|
2323
|
+
instrumentationConfig: InstrumentationConfig;
|
|
2324
|
+
isEnabled(): boolean;
|
|
2325
|
+
getTracer(name?: string, version?: string): Tracer | null;
|
|
2326
|
+
getMeter(name?: string, version?: string): Meter | null;
|
|
2327
|
+
flush(): Promise<void>;
|
|
2328
|
+
stop(): Promise<void>;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
declare class InstrumentationService extends Service implements IInstrumentationService {
|
|
2332
|
+
readonly name = "INSTRUMENTATION";
|
|
2333
|
+
readonly capabilityDescription = "Provides OpenTelemetry tracing and metrics capabilities.";
|
|
2334
|
+
instrumentationConfig: InstrumentationConfig;
|
|
2335
|
+
private resource;
|
|
2336
|
+
private tracerProvider;
|
|
2337
|
+
private meterProvider;
|
|
2338
|
+
private postgresSpanProcessor;
|
|
2339
|
+
private isShutdown;
|
|
2340
|
+
constructor(config?: InstrumentationConfig);
|
|
2341
|
+
private initializeProviders;
|
|
2342
|
+
isEnabled(): boolean;
|
|
2343
|
+
getTracer(name?: string, version?: string): Tracer | null;
|
|
2344
|
+
getMeter(name?: string, version?: string): Meter | null;
|
|
2345
|
+
flush(): Promise<void>;
|
|
2346
|
+
stop(): Promise<void>;
|
|
2347
|
+
static start(runtime: IAgentRuntime, config?: InstrumentationConfig): Promise<InstrumentationService>;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
declare class Semaphore {
|
|
2351
|
+
private permits;
|
|
2352
|
+
private waiting;
|
|
2353
|
+
constructor(count: number);
|
|
2354
|
+
acquire(): Promise<void>;
|
|
2355
|
+
release(): void;
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Represents the runtime environment for an agent, handling message processing,
|
|
2359
|
+
* action registration, and interaction with external services like OpenAI and Supabase.
|
|
2360
|
+
*/
|
|
2361
|
+
/**
|
|
2362
|
+
* Represents the runtime environment for an agent.
|
|
2363
|
+
* @class
|
|
2364
|
+
* @implements { IAgentRuntime }
|
|
2365
|
+
* @property { number } #conversationLength - The maximum length of a conversation.
|
|
2366
|
+
* @property { UUID } agentId - The unique identifier for the agent.
|
|
2367
|
+
* @property { Character } character - The character associated with the agent.
|
|
2368
|
+
* @property { IDatabaseAdapter } adapter - The adapter for interacting with the database.
|
|
2369
|
+
* @property {Action[]} actions - The list of actions available to the agent.
|
|
2370
|
+
* @property {Evaluator[]} evaluators - The list of evaluators for decision making.
|
|
2371
|
+
* @property {Provider[]} providers - The list of providers for external services.
|
|
2372
|
+
* @property {Plugin[]} plugins - The list of plugins to extend functionality.
|
|
2373
|
+
*/
|
|
2374
|
+
declare class AgentRuntime implements IAgentRuntime {
|
|
2375
|
+
#private;
|
|
2376
|
+
readonly agentId: UUID;
|
|
2377
|
+
readonly character: Character;
|
|
2378
|
+
adapter: IDatabaseAdapter;
|
|
2379
|
+
readonly actions: Action[];
|
|
2380
|
+
readonly evaluators: Evaluator[];
|
|
2381
|
+
readonly providers: Provider[];
|
|
2382
|
+
readonly plugins: Plugin[];
|
|
2383
|
+
private isInitialized;
|
|
2384
|
+
events: Map<string, ((params: any) => Promise<void>)[]>;
|
|
2385
|
+
stateCache: Map<`${string}-${string}-${string}-${string}-${string}`, {
|
|
2386
|
+
values: {
|
|
2387
|
+
[key: string]: any;
|
|
2388
|
+
};
|
|
2389
|
+
data: {
|
|
2390
|
+
[key: string]: any;
|
|
2391
|
+
};
|
|
2392
|
+
text: string;
|
|
2393
|
+
}>;
|
|
2394
|
+
readonly fetch: typeof fetch;
|
|
2395
|
+
services: Map<ServiceTypeName, Service>;
|
|
2396
|
+
models: Map<string, ((runtime: IAgentRuntime, params: any) => Promise<any>)[]>;
|
|
2397
|
+
routes: Route[];
|
|
2398
|
+
private taskWorkers;
|
|
2399
|
+
private eventHandlers;
|
|
2400
|
+
private runtimeLogger;
|
|
2401
|
+
private knowledgeProcessingSemaphore;
|
|
2402
|
+
private settings;
|
|
2403
|
+
private servicesInitQueue;
|
|
2404
|
+
instrumentationService: InstrumentationService;
|
|
2405
|
+
tracer: any;
|
|
2406
|
+
constructor(opts: {
|
|
2407
|
+
conversationLength?: number;
|
|
2408
|
+
agentId?: UUID;
|
|
2409
|
+
character?: Character;
|
|
2410
|
+
plugins?: Plugin[];
|
|
2411
|
+
fetch?: typeof fetch;
|
|
2412
|
+
adapter?: IDatabaseAdapter;
|
|
2413
|
+
settings?: RuntimeSettings;
|
|
2414
|
+
events?: {
|
|
2415
|
+
[key: string]: ((params: any) => void)[];
|
|
2416
|
+
};
|
|
2417
|
+
});
|
|
2418
|
+
/**
|
|
2419
|
+
* Starts a span for the given operation and executes the provided function with the span.
|
|
2420
|
+
* @param name The name of the span to create
|
|
2421
|
+
* @param fn The function to execute with the span
|
|
2422
|
+
* @param parentContext Optional parent context for the span
|
|
2423
|
+
* @returns The result of the provided function
|
|
2424
|
+
*/
|
|
2425
|
+
startSpan<T>(name: string, fn: (span: Span) => Promise<T>, parentContext?: Context): Promise<T>;
|
|
2426
|
+
/**
|
|
2427
|
+
* Ends a span with the provided name in the given context
|
|
2428
|
+
* @param ctx Context containing the span to end
|
|
2429
|
+
* @param name Name to record in the end event
|
|
2430
|
+
*/
|
|
2431
|
+
endSpan(ctx: Context | undefined, name: string): void;
|
|
2432
|
+
/**
|
|
2433
|
+
* Start an active span that can be used as a parent for other spans
|
|
2434
|
+
* @param name Name of the span
|
|
2435
|
+
* @param options Span options
|
|
2436
|
+
*/
|
|
2437
|
+
startActiveSpan(name: string, options?: any): Span;
|
|
2438
|
+
/**
|
|
2439
|
+
* Registers a plugin with the runtime and initializes its components
|
|
2440
|
+
* @param plugin The plugin to register
|
|
2441
|
+
*/
|
|
2442
|
+
registerPlugin(plugin: Plugin): Promise<void>;
|
|
2443
|
+
getAllServices(): Map<ServiceTypeName, Service>;
|
|
2444
|
+
stop(): Promise<void>;
|
|
2445
|
+
initialize(): Promise<void>;
|
|
2446
|
+
private handleProcessingError;
|
|
2447
|
+
private checkExistingKnowledge;
|
|
2448
|
+
getKnowledge(message: Memory): Promise<KnowledgeItem[]>;
|
|
2449
|
+
addKnowledge(item: KnowledgeItem, options?: {
|
|
2450
|
+
targetTokens: number;
|
|
2451
|
+
overlap: number;
|
|
2452
|
+
modelContextSize: number;
|
|
2453
|
+
}): Promise<void>;
|
|
2454
|
+
processCharacterKnowledge(items: string[]): Promise<void>;
|
|
2455
|
+
setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
|
|
2456
|
+
getSetting(key: string): string | boolean | null | any;
|
|
2457
|
+
/**
|
|
2458
|
+
* Get the number of messages that are kept in the conversation buffer.
|
|
2459
|
+
* @returns The number of recent messages to be kept in memory.
|
|
2460
|
+
*/
|
|
2461
|
+
getConversationLength(): number;
|
|
2462
|
+
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
2463
|
+
/**
|
|
2464
|
+
* Register a provider for the agent to use.
|
|
2465
|
+
* @param provider The provider to register.
|
|
2466
|
+
*/
|
|
2467
|
+
registerProvider(provider: Provider): void;
|
|
2468
|
+
/**
|
|
2469
|
+
* Register an action for the agent to perform.
|
|
2470
|
+
* @param action The action to register.
|
|
2471
|
+
*/
|
|
2472
|
+
registerAction(action: Action): void;
|
|
2473
|
+
/**
|
|
2474
|
+
* Register an evaluator to assess and guide the agent's responses.
|
|
2475
|
+
* @param evaluator The evaluator to register.
|
|
2476
|
+
*/
|
|
2477
|
+
registerEvaluator(evaluator: Evaluator): void;
|
|
2478
|
+
/**
|
|
2479
|
+
* Register a context provider to provide context for message generation.
|
|
2480
|
+
* @param provider The context provider to register.
|
|
2481
|
+
*/
|
|
2482
|
+
registerContextProvider(provider: Provider): void;
|
|
2483
|
+
/**
|
|
2484
|
+
* Process the actions of a message.
|
|
2485
|
+
* @param message The message to process.
|
|
2486
|
+
* @param responses The array of response memories to process actions from.
|
|
2487
|
+
* @param state Optional state object for the action processing.
|
|
2488
|
+
* @param callback Optional callback handler for action results.
|
|
2489
|
+
*/
|
|
2490
|
+
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
|
|
2491
|
+
/**
|
|
2492
|
+
* Evaluate the message and state using the registered evaluators.
|
|
2493
|
+
* @param message The message to evaluate.
|
|
2494
|
+
* @param state The state of the agent.
|
|
2495
|
+
* @param didRespond Whether the agent responded to the message.~
|
|
2496
|
+
* @param callback The handler callback
|
|
2497
|
+
* @returns The results of the evaluation.
|
|
2498
|
+
*/
|
|
2499
|
+
evaluate(message: Memory, state: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[]>;
|
|
2500
|
+
ensureConnection({ entityId, roomId, userName, name, source, type, channelId, serverId, worldId, userId, }: {
|
|
2501
|
+
entityId: UUID;
|
|
2502
|
+
roomId: UUID;
|
|
2503
|
+
userName?: string;
|
|
2504
|
+
name?: string;
|
|
2505
|
+
source?: string;
|
|
2506
|
+
type?: ChannelType;
|
|
2507
|
+
channelId?: string;
|
|
2508
|
+
serverId?: string;
|
|
2509
|
+
worldId?: UUID;
|
|
2510
|
+
userId?: UUID;
|
|
2511
|
+
}): Promise<void>;
|
|
2512
|
+
/**
|
|
2513
|
+
* Ensures a participant is added to a room, checking that the entity exists first
|
|
2514
|
+
*/
|
|
2515
|
+
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
2516
|
+
removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
2517
|
+
getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
2518
|
+
getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
2519
|
+
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
2520
|
+
/**
|
|
2521
|
+
* Ensure the existence of a world.
|
|
2522
|
+
*/
|
|
2523
|
+
ensureWorldExists({ id, name, serverId, metadata }: World): Promise<void>;
|
|
2524
|
+
/**
|
|
2525
|
+
* Ensure the existence of a room between the agent and a user. If no room exists, a new room is created and the user
|
|
2526
|
+
* and agent are added as participants. The room ID is returned.
|
|
2527
|
+
* @param entityId - The user ID to create a room with.
|
|
2528
|
+
* @returns The room ID of the room between the agent and the user.
|
|
2529
|
+
* @throws An error if the room cannot be created.
|
|
2530
|
+
*/
|
|
2531
|
+
ensureRoomExists({ id, name, source, type, channelId, serverId, worldId, metadata }: Room): Promise<void>;
|
|
2532
|
+
/**
|
|
2533
|
+
* Composes the agent's state by gathering data from enabled providers.
|
|
2534
|
+
* @param message - The message to use as context for state composition
|
|
2535
|
+
* @param filterList - Optional list of provider names to include, filtering out all others
|
|
2536
|
+
* @param includeList - Optional list of private provider names to include that would otherwise be filtered out
|
|
2537
|
+
* @returns A State object containing provider data, values, and text
|
|
2538
|
+
*/
|
|
2539
|
+
composeState(message: Memory, filterList?: string[] | null, // only get providers that are in the filterList
|
|
2540
|
+
includeList?: string[] | null): Promise<State>;
|
|
2541
|
+
getService<T extends Service>(service: ServiceTypeName): T | null;
|
|
2542
|
+
registerService(service: typeof Service): Promise<void>;
|
|
2543
|
+
registerModel(modelType: ModelTypeName, handler: (params: any) => Promise<any>): void;
|
|
2544
|
+
getModel(modelType: ModelTypeName): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
|
|
2545
|
+
/**
|
|
2546
|
+
* Use a model with strongly typed parameters and return values based on model type
|
|
2547
|
+
* @template T - The model type to use
|
|
2548
|
+
* @template R - The expected return type, defaults to the type defined in ModelResultMap[T]
|
|
2549
|
+
* @param {T} modelType - The type of model to use
|
|
2550
|
+
* @param {ModelParamsMap[T] | any} params - The parameters for the model, typed based on model type
|
|
2551
|
+
* @returns {Promise<R>} - The model result, typed based on the provided generic type parameter
|
|
2552
|
+
*/
|
|
2553
|
+
useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any): Promise<R>;
|
|
2554
|
+
registerEvent(event: string, handler: (params: any) => Promise<void>): void;
|
|
2555
|
+
getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
|
|
2556
|
+
emitEvent(event: string | string[], params: any): Promise<void>;
|
|
2557
|
+
ensureEmbeddingDimension(): Promise<void>;
|
|
2558
|
+
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
2559
|
+
/**
|
|
2560
|
+
* Get a task worker by name
|
|
2561
|
+
*/
|
|
2562
|
+
getTaskWorker(name: string): TaskWorker | undefined;
|
|
2563
|
+
get db(): any;
|
|
2564
|
+
init(): Promise<void>;
|
|
2565
|
+
close(): Promise<void>;
|
|
2566
|
+
getAgent(agentId: UUID): Promise<Agent | null>;
|
|
2567
|
+
getAgents(): Promise<Agent[]>;
|
|
2568
|
+
createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
2569
|
+
updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
2570
|
+
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
2571
|
+
ensureAgentExists(agent: Partial<Agent>): Promise<Agent>;
|
|
2572
|
+
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
2573
|
+
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
2574
|
+
createEntity(entity: Entity): Promise<boolean>;
|
|
2575
|
+
updateEntity(entity: Entity): Promise<void>;
|
|
2576
|
+
getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
2577
|
+
getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
2578
|
+
createComponent(component: Component): Promise<boolean>;
|
|
2579
|
+
updateComponent(component: Component): Promise<void>;
|
|
2580
|
+
deleteComponent(componentId: UUID): Promise<void>;
|
|
2581
|
+
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
2582
|
+
getMemories(params: {
|
|
2583
|
+
entityId?: UUID;
|
|
2584
|
+
agentId?: UUID;
|
|
2585
|
+
roomId?: UUID;
|
|
2586
|
+
count?: number;
|
|
2587
|
+
unique?: boolean;
|
|
2588
|
+
tableName: string;
|
|
2589
|
+
start?: number;
|
|
2590
|
+
end?: number;
|
|
2591
|
+
}): Promise<Memory[]>;
|
|
2592
|
+
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
2593
|
+
getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
|
|
2594
|
+
getMemoriesByRoomIds(params: {
|
|
2595
|
+
tableName: string;
|
|
2596
|
+
roomIds: UUID[];
|
|
2597
|
+
limit?: number;
|
|
2598
|
+
}): Promise<Memory[]>;
|
|
2599
|
+
getCachedEmbeddings(params: {
|
|
2600
|
+
query_table_name: string;
|
|
2601
|
+
query_threshold: number;
|
|
2602
|
+
query_input: string;
|
|
2603
|
+
query_field_name: string;
|
|
2604
|
+
query_field_sub_name: string;
|
|
2605
|
+
query_match_count: number;
|
|
2606
|
+
}): Promise<{
|
|
2607
|
+
embedding: number[];
|
|
2608
|
+
levenshtein_score: number;
|
|
2609
|
+
}[]>;
|
|
2610
|
+
log(params: {
|
|
2611
|
+
body: {
|
|
2612
|
+
[key: string]: unknown;
|
|
2613
|
+
};
|
|
2614
|
+
entityId: UUID;
|
|
2615
|
+
roomId: UUID;
|
|
2616
|
+
type: string;
|
|
2617
|
+
}): Promise<void>;
|
|
2618
|
+
searchMemories(params: {
|
|
2619
|
+
embedding: number[];
|
|
2620
|
+
match_threshold?: number;
|
|
2621
|
+
count?: number;
|
|
2622
|
+
roomId?: UUID;
|
|
2623
|
+
unique?: boolean;
|
|
2624
|
+
tableName: string;
|
|
2625
|
+
}): Promise<Memory[]>;
|
|
2626
|
+
createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
2627
|
+
updateMemory(memory: Partial<Memory> & {
|
|
2628
|
+
id: UUID;
|
|
2629
|
+
metadata?: MemoryMetadata;
|
|
2630
|
+
}): Promise<boolean>;
|
|
2631
|
+
deleteMemory(memoryId: UUID): Promise<void>;
|
|
2632
|
+
deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
2633
|
+
countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
2634
|
+
getLogs(params: {
|
|
2635
|
+
entityId: UUID;
|
|
2636
|
+
roomId?: UUID;
|
|
2637
|
+
type?: string;
|
|
2638
|
+
count?: number;
|
|
2639
|
+
offset?: number;
|
|
2640
|
+
}): Promise<Log[]>;
|
|
2641
|
+
deleteLog(logId: UUID): Promise<void>;
|
|
2642
|
+
createWorld(world: World): Promise<UUID>;
|
|
2643
|
+
getWorld(id: UUID): Promise<World | null>;
|
|
2644
|
+
getAllWorlds(): Promise<World[]>;
|
|
2645
|
+
updateWorld(world: World): Promise<void>;
|
|
2646
|
+
getRoom(roomId: UUID): Promise<Room | null>;
|
|
2647
|
+
createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
|
|
2648
|
+
deleteRoom(roomId: UUID): Promise<void>;
|
|
2649
|
+
updateRoom(room: Room): Promise<void>;
|
|
2650
|
+
getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
2651
|
+
getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
2652
|
+
getRooms(worldId: UUID): Promise<Room[]>;
|
|
2653
|
+
getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
2654
|
+
setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
2655
|
+
createRelationship(params: {
|
|
2656
|
+
sourceEntityId: UUID;
|
|
2657
|
+
targetEntityId: UUID;
|
|
2658
|
+
tags?: string[];
|
|
2659
|
+
metadata?: {
|
|
2660
|
+
[key: string]: any;
|
|
2661
|
+
};
|
|
2662
|
+
}): Promise<boolean>;
|
|
2663
|
+
updateRelationship(relationship: Relationship): Promise<void>;
|
|
2664
|
+
getRelationship(params: {
|
|
2665
|
+
sourceEntityId: UUID;
|
|
2666
|
+
targetEntityId: UUID;
|
|
2667
|
+
}): Promise<Relationship | null>;
|
|
2668
|
+
getRelationships(params: {
|
|
2669
|
+
entityId: UUID;
|
|
2670
|
+
tags?: string[];
|
|
2671
|
+
}): Promise<Relationship[]>;
|
|
2672
|
+
getCache<T>(key: string): Promise<T | undefined>;
|
|
2673
|
+
setCache<T>(key: string, value: T): Promise<boolean>;
|
|
2674
|
+
deleteCache(key: string): Promise<boolean>;
|
|
2675
|
+
createTask(task: Task): Promise<UUID>;
|
|
2676
|
+
getTasks(params: {
|
|
2677
|
+
roomId?: UUID;
|
|
2678
|
+
tags?: string[];
|
|
2679
|
+
}): Promise<Task[]>;
|
|
2680
|
+
getTask(id: UUID): Promise<Task | null>;
|
|
2681
|
+
getTasksByName(name: string): Promise<Task[]>;
|
|
2682
|
+
updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
2683
|
+
deleteTask(id: UUID): Promise<void>;
|
|
2684
|
+
on(event: string, callback: (data: any) => void): void;
|
|
2685
|
+
off(event: string, callback: (data: any) => void): void;
|
|
2686
|
+
emit(event: string, data: any): void;
|
|
2687
|
+
/**
|
|
2688
|
+
* Sends a control message to the frontend to enable or disable input
|
|
2689
|
+
* @param {Object} params - Parameters for the control message
|
|
2690
|
+
* @param {UUID} params.roomId - The ID of the room to send the control message to
|
|
2691
|
+
* @param {'enable_input' | 'disable_input'} params.action - The action to perform
|
|
2692
|
+
* @param {string} [params.target] - Optional target element identifier
|
|
2693
|
+
* @returns {Promise<void>}
|
|
2694
|
+
*/
|
|
2695
|
+
sendControlMessage(params: {
|
|
2696
|
+
roomId: UUID;
|
|
2697
|
+
action: 'enable_input' | 'disable_input';
|
|
2698
|
+
target?: string;
|
|
2699
|
+
}): Promise<void>;
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
/**
|
|
2703
|
+
* Creates a new Setting object based on provided config settings.
|
|
2704
|
+
* @param {Omit<Setting, "value">} configSetting - The configuration settings for the new Setting object.
|
|
2705
|
+
* @returns {Setting} - The newly created Setting object.
|
|
2706
|
+
*/
|
|
2707
|
+
/**
|
|
2708
|
+
* Creates a Setting object from a configSetting object by omitting the 'value' property.
|
|
2709
|
+
*
|
|
2710
|
+
* @param {Omit<Setting, 'value'>} configSetting - The configSetting object to create the Setting from.
|
|
2711
|
+
* @returns {Setting} A new Setting object created from the provided configSetting object.
|
|
2712
|
+
*/
|
|
2713
|
+
declare function createSettingFromConfig(configSetting: Omit<Setting, 'value'>): Setting;
|
|
2714
|
+
/**
|
|
2715
|
+
* Retrieves the salt based on env variable SECRET_SALT
|
|
2716
|
+
*
|
|
2717
|
+
* @returns {string} The salt for the agent.
|
|
2718
|
+
*/
|
|
2719
|
+
declare function getSalt(): string;
|
|
2720
|
+
/**
|
|
2721
|
+
* Common encryption function for string values
|
|
2722
|
+
* @param {string} value - The string value to encrypt
|
|
2723
|
+
* @param {string} salt - The salt to use for encryption
|
|
2724
|
+
* @returns {string} - The encrypted value in 'iv:encrypted' format
|
|
2725
|
+
*/
|
|
2726
|
+
declare function encryptStringValue(value: string, salt: string): string;
|
|
2727
|
+
/**
|
|
2728
|
+
* Common decryption function for string values
|
|
2729
|
+
* @param {string} value - The encrypted value in 'iv:encrypted' format
|
|
2730
|
+
* @param {string} salt - The salt to use for decryption
|
|
2731
|
+
* @returns {string} - The decrypted string value
|
|
2732
|
+
*/
|
|
2733
|
+
declare function decryptStringValue(value: string, salt: string): string;
|
|
2734
|
+
/**
|
|
2735
|
+
* Applies salt to the value of a setting
|
|
2736
|
+
* Only applies to secret settings with string values
|
|
2737
|
+
*/
|
|
2738
|
+
declare function saltSettingValue(setting: Setting, salt: string): Setting;
|
|
2739
|
+
/**
|
|
2740
|
+
* Removes salt from the value of a setting
|
|
2741
|
+
* Only applies to secret settings with string values
|
|
2742
|
+
*/
|
|
2743
|
+
declare function unsaltSettingValue(setting: Setting, salt: string): Setting;
|
|
2744
|
+
/**
|
|
2745
|
+
* Applies salt to all settings in a WorldSettings object
|
|
2746
|
+
*/
|
|
2747
|
+
declare function saltWorldSettings(worldSettings: WorldSettings, salt: string): WorldSettings;
|
|
2748
|
+
/**
|
|
2749
|
+
* Removes salt from all settings in a WorldSettings object
|
|
2750
|
+
*/
|
|
2751
|
+
declare function unsaltWorldSettings(worldSettings: WorldSettings, salt: string): WorldSettings;
|
|
2752
|
+
/**
|
|
2753
|
+
* Updates settings state in world metadata
|
|
2754
|
+
*/
|
|
2755
|
+
declare function updateWorldSettings(runtime: IAgentRuntime, serverId: string, worldSettings: WorldSettings): Promise<boolean>;
|
|
2756
|
+
/**
|
|
2757
|
+
* Gets settings state from world metadata
|
|
2758
|
+
*/
|
|
2759
|
+
declare function getWorldSettings(runtime: IAgentRuntime, serverId: string): Promise<WorldSettings | null>;
|
|
2760
|
+
/**
|
|
2761
|
+
* Initializes settings configuration for a server
|
|
2762
|
+
*/
|
|
2763
|
+
declare function initializeOnboarding(runtime: IAgentRuntime, world: World, config: OnboardingConfig): Promise<WorldSettings | null>;
|
|
2764
|
+
/**
|
|
2765
|
+
* Encrypts sensitive data in a Character object
|
|
2766
|
+
* @param {Character} character - The character object to encrypt secrets for
|
|
2767
|
+
* @param {IAgentRuntime} runtime - The runtime information needed for salt generation
|
|
2768
|
+
* @returns {Character} - A copy of the character with encrypted secrets
|
|
2769
|
+
*/
|
|
2770
|
+
declare function encryptedCharacter(character: Character): Character;
|
|
2771
|
+
/**
|
|
2772
|
+
* Decrypts sensitive data in a Character object
|
|
2773
|
+
* @param {Character} character - The character object with encrypted secrets
|
|
2774
|
+
* @param {IAgentRuntime} runtime - The runtime information needed for salt generation
|
|
2775
|
+
* @returns {Character} - A copy of the character with decrypted secrets
|
|
2776
|
+
*/
|
|
2777
|
+
declare function decryptedCharacter(character: Character, runtime: IAgentRuntime): Character;
|
|
2778
|
+
/**
|
|
2779
|
+
* Helper function to encrypt all string values in an object
|
|
2780
|
+
* @param {Record<string, any>} obj - Object with values to encrypt
|
|
2781
|
+
* @param {string} salt - The salt to use for encryption
|
|
2782
|
+
* @returns {Record<string, any>} - Object with encrypted values
|
|
2783
|
+
*/
|
|
2784
|
+
declare function encryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any>;
|
|
2785
|
+
/**
|
|
2786
|
+
* Helper function to decrypt all string values in an object
|
|
2787
|
+
* @param {Record<string, any>} obj - Object with encrypted values
|
|
2788
|
+
* @param {string} salt - The salt to use for decryption
|
|
2789
|
+
* @returns {Record<string, any>} - Object with decrypted values
|
|
2790
|
+
*/
|
|
2791
|
+
declare function decryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any>;
|
|
2792
|
+
|
|
2793
|
+
declare const uuidSchema: z.ZodType<UUID>;
|
|
2794
|
+
/**
|
|
2795
|
+
* Validates a UUID value.
|
|
2796
|
+
*
|
|
2797
|
+
* @param {unknown} value - The value to validate.
|
|
2798
|
+
* @returns {UUID | null} Returns the validated UUID value or null if validation fails.
|
|
2799
|
+
*/
|
|
2800
|
+
/**
|
|
2801
|
+
* Validate if the given value is a valid UUID.
|
|
2802
|
+
*
|
|
2803
|
+
* @param {unknown} value - The value to be validated.
|
|
2804
|
+
* @returns {UUID | null} The validated UUID value or null if validation fails.
|
|
2805
|
+
*/
|
|
2806
|
+
declare function validateUuid(value: unknown): UUID | null;
|
|
2807
|
+
/**
|
|
2808
|
+
* Converts a string or number to a UUID.
|
|
2809
|
+
*
|
|
2810
|
+
* @param {string | number} target - The string or number to convert to a UUID.
|
|
2811
|
+
* @returns {UUID} The UUID generated from the input target.
|
|
2812
|
+
* @throws {TypeError} Throws an error if the input target is not a string.
|
|
2813
|
+
*/
|
|
2814
|
+
declare function stringToUuid(target: string | number): UUID;
|
|
2815
|
+
|
|
2816
|
+
declare const Readable: any;
|
|
2817
|
+
|
|
2818
|
+
/**
|
|
2819
|
+
* Generates a WAV file header based on the provided audio parameters.
|
|
2820
|
+
* @param {number} audioLength - The length of the audio data in bytes.
|
|
2821
|
+
* @param {number} sampleRate - The sample rate of the audio.
|
|
2822
|
+
* @param {number} [channelCount=1] - The number of channels (default is 1).
|
|
2823
|
+
* @param {number} [bitsPerSample=16] - The number of bits per sample (default is 16).
|
|
2824
|
+
* @returns {Buffer} The WAV file header as a Buffer object.
|
|
2825
|
+
*/
|
|
2826
|
+
declare function getWavHeader(audioLength: number, sampleRate: number, channelCount?: number, bitsPerSample?: number): Buffer$1;
|
|
2827
|
+
/**
|
|
2828
|
+
* Prepends a WAV header to a readable stream of audio data.
|
|
2829
|
+
*
|
|
2830
|
+
* @param {Readable} readable - The readable stream containing the audio data.
|
|
2831
|
+
* @param {number} audioLength - The length of the audio data in seconds.
|
|
2832
|
+
* @param {number} sampleRate - The sample rate of the audio data.
|
|
2833
|
+
* @param {number} [channelCount=1] - The number of channels in the audio data (default is 1).
|
|
2834
|
+
* @param {number} [bitsPerSample=16] - The number of bits per sample in the audio data (default is 16).
|
|
2835
|
+
* @returns {Readable} A new readable stream with the WAV header prepended to the audio data.
|
|
2836
|
+
*/
|
|
2837
|
+
declare function prependWavHeader(readable: typeof Readable, audioLength: number, sampleRate: number, channelCount?: number, bitsPerSample?: number): typeof Readable;
|
|
2838
|
+
|
|
2839
|
+
declare function safeReplacer(): (key: string, value: any) => any;
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* Returns the Cloudflare Gateway base URL for a given model provider if the gateway is enabled and properly configured.
|
|
2843
|
+
*
|
|
2844
|
+
* If Cloudflare Gateway is not enabled or required configuration values are missing, returns `undefined`.
|
|
2845
|
+
*
|
|
2846
|
+
* @param provider - The name of the model provider.
|
|
2847
|
+
* @returns The Cloudflare Gateway base URL for the provider, or `undefined` if the gateway is not enabled or not configured.
|
|
2848
|
+
*/
|
|
2849
|
+
declare function getCloudflareGatewayBaseURL(runtime: IAgentRuntime, provider: string): string | undefined;
|
|
2850
|
+
/**
|
|
2851
|
+
* Returns the base URL for a model provider, preferring the Cloudflare Gateway if enabled and properly configured.
|
|
2852
|
+
*
|
|
2853
|
+
* If the Cloudflare Gateway is not enabled or required configuration is missing, returns the provided default base URL.
|
|
2854
|
+
*
|
|
2855
|
+
* @param provider - The name of the model provider.
|
|
2856
|
+
* @param defaultBaseURL - The fallback base URL if Cloudflare Gateway is unavailable.
|
|
2857
|
+
* @returns The base URL to use for the provider.
|
|
2858
|
+
*/
|
|
2859
|
+
declare function getProviderBaseURL(runtime: IAgentRuntime, provider: string, defaultBaseURL: string): string;
|
|
2860
|
+
|
|
2861
|
+
export { type Action, type ActionEventPayload, type ActionExample, type Agent, AgentRuntime, AgentStatus, type AudioProcessingParams, type BaseMetadata, type BaseModelParams, CacheKeyPrefix, ChannelType, type Character, type ChunkRow, type Component, type ComponentData, type Content, type ControlMessage, type CustomMetadata, DatabaseAdapter, type DbConnection, type DeriveKeyAttestationData, type DescriptionMetadata, type DetokenizeTextParams, type DirectoryItem, type DocumentMetadata, type EmbeddingSearchResult, type EnhancedState, type Entity, type EntityPayload, type EvaluationExample, type Evaluator, type EvaluatorEventPayload, type EventDataObject, type EventHandler, type EventPayload, type EventPayloadMap, EventType, type FragmentMetadata, type GenerateTextParams, type Handler, type HandlerCallback, type IAgentRuntime, type IBrowserService, type IDatabaseAdapter, type IFileService, type IInstrumentationService, type IPdfService, type IVideoService, type ImageDescriptionParams, type ImageGenerationParams, type InstrumentationConfig, InstrumentationService, type InvokePayload, type JSONSchema, type KnowledgeItem, KnowledgeScope, type Log, type Media, type Memory, type MemoryMetadata, type MemoryRetrievalOptions, type MemoryScope, type MemorySearchOptions, MemoryType, type MemoryTypeAlias, type MessageExample, type MessageMemory, type MessageMetadata, type MessagePayload, type MessageReceivedHandlerParams, type MetadataObject, type ModelEventPayload, type ModelHandler, type ModelParamsMap, type ModelResultMap, ModelType, type ModelTypeName, type MultiRoomMemoryOptions, type ObjectGenerationParams, type OnboardingConfig, type Participant, PlatformPrefix, type Plugin, type Project, type ProjectAgent, type Provider, type ProviderResult, type Relationship, type RemoteAttestationMessage, type RemoteAttestationQuote, Role, type Room, type Route, type RunEventPayload, type RuntimeSettings, SOCKET_MESSAGE_TYPE, Semaphore, type ServerOwnershipState, Service, type ServiceConfig, type ServiceError, ServiceType, type ServiceTypeName, type Setting, type State, type StateArray, type StateObject, type StateValue, TEEMode, type Task, type TaskWorker, type TeeAgent, type TeePluginConfig, TeeType, type TeeVendorConfig, type TemplateType, type TestCase, type TestSuite, type TextEmbeddingParams, type TextGenerationParams, type TextToSpeechParams, type TokenizeTextParams, type TranscriptionParams, type TypedEventHandler, type TypedService, type UUID, type UnifiedMemoryOptions, type UnifiedSearchOptions, VECTOR_DIMS, type Validator, type VideoProcessingParams, type World, type WorldPayload, type WorldSettings, addHeader, asUUID, booleanFooter, cleanJsonResponse, composeActionExamples, composePrompt, composePromptFromState, composeRandomUser, createMessageMemory, createServiceError, createSettingFromConfig, createUniqueUuid, decryptObjectValues, decryptStringValue as decryptSecret, decryptStringValue, decryptedCharacter, elizaLogger, encryptObjectValues, encryptStringValue, encryptedCharacter, extractAttributes, findEntityByName, findWorldsForOwner, formatActionNames, formatActions, formatEntities, formatMessages, formatPosts, formatTimestamp, getBrowserService, getCloudflareGatewayBaseURL, getEntityDetails, getFileService, getMemoryText, getPdfService, getProviderBaseURL, getSalt, getTypedService, getUserServerRole, getVideoService, getWavHeader, getWorldSettings, initializeOnboarding, isCustomMetadata, isDescriptionMetadata, isDocumentMemory, isDocumentMetadata, isFragmentMemory, isFragmentMetadata, isMessageMetadata, logger, messageHandlerTemplate, normalizeJsonString, parseActionResponseFromText, parseBooleanFromText, parseJSONObjectFromText, parseJsonArrayFromText, postActionResponseFooter, postCreationTemplate, prependWavHeader, providersTemplate, safeReplacer, saltSettingValue, saltWorldSettings, shouldRespondTemplate, splitChunks, stringArrayFooter, stringToUuid, trimTokens, truncateToCompleteSentence, unsaltSettingValue, unsaltWorldSettings, updateWorldSettings, upgradeDoubleToTriple, uuidSchema, validateUuid };
|