@elizaos/core 1.3.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,21 +1,1887 @@
1
- import { M as Metadata, S as Service, U as UUID, T as TemplateType, a as State, b as Memory, E as Entity, I as IAgentRuntime, C as ContentType, c as Character, A as Action, d as IDatabaseAdapter, e as Component, L as Log, f as MemoryMetadata, W as World, R as Room, P as Participant, g as Relationship, h as Agent, i as Task, j as Role, k as Evaluator, l as Provider, m as Plugin, n as ServiceTypeName, o as ModelHandler, p as Route, q as RuntimeSettings, H as HandlerCallback, r as ChannelType, s as ModelTypeName, t as ModelResultMap, u as ModelParamsMap, v as TaskWorker, w as SendHandlerFunction, x as TargetInfo, y as Content, z as Setting, B as WorldSettings, O as OnboardingConfig, D as v2 } from './index-D-EzHFvJ.js';
2
- export { ar as ActionContext, be as ActionEventPayload, al as ActionExample, aq as ActionResult, ak as AgentStatus, aV as AudioProcessingParams, Z as BaseMetadata, aN as BaseModelParams, af as CacheKeyPrefix, bb as ChannelClearedPayload, ah as ChunkRow, bn as ControlMessage, a2 as CustomMetadata, b3 as DbConnection, a1 as DescriptionMetadata, aM as DetokenizeTextParams, ag as DirectoryItem, _ as DocumentMetadata, aZ as EmbeddingSearchResult, Q as EnhancedState, b9 as EntityPayload, ao as EvaluationExample, bf as EvaluatorEventPayload, bj as EventHandler, b7 as EventPayload, bi as EventPayloadMap, b5 as EventType, $ as FragmentMetadata, aL as GenerateTextParams, am as Handler, aS as ImageDescriptionParams, aR as ImageGenerationParams, bc as InvokePayload, ay as IsValidServiceType, aX as JSONSchema, ad as KnowledgeItem, ae as KnowledgeScope, aJ as MODEL_SETTINGS, G as Media, a_ as MemoryRetrievalOptions, Y as MemoryScope, a$ as MemorySearchOptions, X as MemoryType, V as MemoryTypeAlias, aj as MessageExample, a3 as MessageMemory, a0 as MessageMetadata, ba as MessagePayload, bh as MessageReceivedHandlerParams, bg as ModelEventPayload, aI as ModelType, b0 as MultiRoomMemoryOptions, aY as ObjectGenerationParams, b6 as PlatformPrefix, at as PluginEvents, av as Project, au as ProjectAgent, ap as ProviderResult, ai as RoomMetadata, bd as RunEventPayload, bm as SOCKET_MESSAGE_TYPE, bq as ServiceBuilder, aA as ServiceClassMap, bs as ServiceDefinition, aG as ServiceError, aB as ServiceInstance, aC as ServiceRegistry, aD as ServiceType, aw as ServiceTypeRegistry, ax as ServiceTypeValue, N as StateArray, K as StateObject, J as StateValue, bl as TaskMetadata, bo as TestCase, bp as TestSuite, aP as TextEmbeddingParams, aO as TextGenerationParams, aU as TextToSpeechParams, aQ as TokenizeTextParams, aT as TranscriptionParams, bk as TypedEventHandler, aE as TypedService, az as TypedServiceClass, b1 as UnifiedMemoryOptions, b2 as UnifiedSearchOptions, b4 as VECTOR_DIMS, an as Validator, aW as VideoProcessingParams, b8 as WorldPayload, F as asUUID, as as createActionResult, a4 as createMessageMemory, br as createService, aH as createServiceError, bt as defineService, ac as getMemoryText, aK as getModelSpecificSettingKey, aF as getTypedService, a9 as isCustomMetadata, a8 as isDescriptionMetadata, aa as isDocumentMemory, a5 as isDocumentMetadata, ab as isFragmentMemory, a6 as isFragmentMetadata, a7 as isMessageMetadata } from './index-D-EzHFvJ.js';
3
1
  import { z } from 'zod';
4
- import * as pino from 'pino';
2
+ import pino from 'pino';
5
3
  import * as browser from '@sentry/browser';
6
4
  export { browser as Sentry };
7
- export { i as v1 } from './index-BHW44X0A.js';
8
- import './types-DIUaglro.js';
9
- import './specs/v1/messages.js';
10
- import './specs/v1/types.js';
11
- import 'stream';
12
- import './specs/v1/posts.js';
13
- import './specs/v1/runtime.js';
14
- import './specs/v1/state.js';
15
- import './specs/v1/uuid.js';
16
- import './specs/v1/actionExample.js';
17
- import './specs/v1/provider.js';
18
- import './specs/v1/templates.js';
5
+
6
+ /**
7
+ * Defines a custom type UUID representing a universally unique identifier
8
+ */
9
+ type UUID = `${string}-${string}-${string}-${string}-${string}`;
10
+ /**
11
+ * Helper function to safely cast a string to strongly typed UUID
12
+ * @param id The string UUID to validate and cast
13
+ * @returns The same UUID with branded type information
14
+ */
15
+ declare function asUUID(id: string): UUID;
16
+ /**
17
+ * Represents the content of a memory, message, or other information
18
+ */
19
+ interface Content {
20
+ /** The agent's internal thought process */
21
+ thought?: string;
22
+ /** The main text content visible to users */
23
+ text?: string;
24
+ /** Optional actions to be performed */
25
+ actions?: string[];
26
+ /** Optional providers to use for context generation */
27
+ providers?: string[];
28
+ /** Optional source/origin of the content */
29
+ source?: string;
30
+ /** Optional target/destination for responses */
31
+ target?: string;
32
+ /** URL of the original message/post (e.g. tweet URL, Discord message link) */
33
+ url?: string;
34
+ /** UUID of parent message if this is a reply/thread */
35
+ inReplyTo?: UUID;
36
+ /** Array of media attachments */
37
+ attachments?: Media[];
38
+ /** room type */
39
+ channelType?: string;
40
+ /**
41
+ * Additional dynamic properties
42
+ * Use specific properties above instead of this when possible
43
+ */
44
+ [key: string]: unknown;
45
+ }
46
+ /**
47
+ * Represents a media attachment
48
+ */
49
+ type Media = {
50
+ /** Unique identifier */
51
+ id: string;
52
+ /** Media URL */
53
+ url: string;
54
+ /** Media title */
55
+ title?: string;
56
+ /** Media source */
57
+ source?: string;
58
+ /** Media description */
59
+ description?: string;
60
+ /** Text content */
61
+ text?: string;
62
+ /** Content type */
63
+ contentType?: ContentType;
64
+ };
65
+ declare enum ContentType {
66
+ IMAGE = "image",
67
+ VIDEO = "video",
68
+ AUDIO = "audio",
69
+ DOCUMENT = "document",
70
+ LINK = "link"
71
+ }
72
+ /**
73
+ * A generic type for metadata objects, allowing for arbitrary key-value pairs.
74
+ * This encourages consumers to perform type checking or casting.
75
+ */
76
+ type Metadata = Record<string, unknown>;
77
+
78
+ /**
79
+ * Represents the current state or context of a conversation or agent interaction.
80
+ * This interface is a flexible container for various pieces of information that define the agent's
81
+ * understanding at a point in time. It includes:
82
+ * - `values`: A key-value store for general state variables, often populated by providers.
83
+ * - `data`: Another key-value store, potentially for more structured or internal data.
84
+ * - `text`: A string representation of the current context, often a summary or concatenated history.
85
+ * The `[key: string]: any;` allows for dynamic properties, though `EnhancedState` offers better typing.
86
+ * This state object is passed to handlers for actions, evaluators, and providers.
87
+ */
88
+ interface State {
89
+ /** Additional dynamic properties */
90
+ [key: string]: any;
91
+ values: {
92
+ [key: string]: any;
93
+ };
94
+ data: {
95
+ [key: string]: any;
96
+ };
97
+ text: string;
98
+ }
99
+ /**
100
+ * Defines the possible primitive types or structured types for a value within the agent's state.
101
+ * This type is used to provide more specific typing for properties within `StateObject` and `StateArray`,
102
+ * moving away from a generic 'any' type for better type safety and clarity in state management.
103
+ */
104
+ type StateValue = string | number | boolean | null | StateObject | StateArray;
105
+ /**
106
+ * Represents a generic object structure within the agent's state, where keys are strings
107
+ * and values can be any `StateValue`. This allows for nested objects within the state.
108
+ * It's a fundamental part of the `EnhancedState` interface.
109
+ */
110
+ interface StateObject {
111
+ [key: string]: StateValue;
112
+ }
113
+ /**
114
+ * Represents an array of `StateValue` types within the agent's state.
115
+ * This allows for lists of mixed or uniform types to be stored in the state,
116
+ * contributing to the structured definition of `EnhancedState`.
117
+ */
118
+ type StateArray = StateValue[];
119
+ /**
120
+ * Enhanced State interface with more specific types for its core properties.
121
+ * This interface provides a more structured representation of an agent's conversational state,
122
+ * building upon the base `State` by typing `values` and `data` as `StateObject`.
123
+ * The `text` property typically holds a textual summary or context derived from the state.
124
+ * Additional dynamic properties are still allowed via the index signature `[key: string]: StateValue;`.
125
+ */
126
+ interface EnhancedState {
127
+ /** Holds directly accessible state values, often used for template rendering or quick lookups. */
128
+ values: StateObject;
129
+ /** Stores more complex or structured data, potentially namespaced by providers or internal systems. */
130
+ data: StateObject;
131
+ /** A textual representation or summary of the current state, often used as context for models. */
132
+ text: string;
133
+ /** Allows for additional dynamic properties to be added to the state object. */
134
+ [key: string]: StateValue;
135
+ }
136
+
137
+ /**
138
+ * Memory type enumeration for built-in memory types
139
+ */
140
+ type MemoryTypeAlias = string;
141
+ /**
142
+ * Enumerates the built-in types of memories that can be stored and retrieved.
143
+ * - `DOCUMENT`: Represents a whole document or a large piece of text.
144
+ * - `FRAGMENT`: A chunk or segment of a `DOCUMENT`, often created for embedding and search.
145
+ * - `MESSAGE`: A conversational message, typically from a user or the agent.
146
+ * - `DESCRIPTION`: A descriptive piece of information, perhaps about an entity or concept.
147
+ * - `CUSTOM`: For any other type of memory not covered by the built-in types.
148
+ * This enum is used in `MemoryMetadata` to categorize memories and influences how they are processed or queried.
149
+ */
150
+ declare enum MemoryType {
151
+ DOCUMENT = "document",
152
+ FRAGMENT = "fragment",
153
+ MESSAGE = "message",
154
+ DESCRIPTION = "description",
155
+ CUSTOM = "custom"
156
+ }
157
+ /**
158
+ * Defines the scope of a memory, indicating its visibility and accessibility.
159
+ * - `shared`: The memory is accessible to multiple entities or across different contexts (e.g., a public fact).
160
+ * - `private`: The memory is specific to a single entity or a private context (e.g., a user's personal preference).
161
+ * - `room`: The memory is scoped to a specific room or channel.
162
+ * This is used in `MemoryMetadata` to control how memories are stored and retrieved based on context.
163
+ */
164
+ type MemoryScope = 'shared' | 'private' | 'room';
165
+ /**
166
+ * Base interface for all memory metadata types.
167
+ * It includes common properties for all memories, such as:
168
+ * - `type`: The kind of memory (e.g., `MemoryType.MESSAGE`, `MemoryType.DOCUMENT`).
169
+ * - `source`: An optional string indicating the origin of the memory (e.g., 'discord', 'user_input').
170
+ * - `sourceId`: An optional UUID linking to a source entity or object.
171
+ * - `scope`: The visibility scope of the memory (`shared`, `private`, or `room`).
172
+ * - `timestamp`: An optional numerical timestamp (e.g., milliseconds since epoch) of when the memory was created or relevant.
173
+ * - `tags`: Optional array of strings for categorizing or filtering memories.
174
+ * Specific metadata types like `DocumentMetadata` or `MessageMetadata` extend this base.
175
+ */
176
+ interface BaseMetadata {
177
+ type: MemoryTypeAlias;
178
+ source?: string;
179
+ sourceId?: UUID;
180
+ scope?: MemoryScope;
181
+ timestamp?: number;
182
+ tags?: string[];
183
+ }
184
+ interface DocumentMetadata extends BaseMetadata {
185
+ type: MemoryType.DOCUMENT;
186
+ }
187
+ interface FragmentMetadata extends BaseMetadata {
188
+ type: MemoryType.FRAGMENT;
189
+ documentId: UUID;
190
+ position: number;
191
+ }
192
+ interface MessageMetadata extends BaseMetadata {
193
+ type: MemoryType.MESSAGE;
194
+ }
195
+ interface DescriptionMetadata extends BaseMetadata {
196
+ type: MemoryType.DESCRIPTION;
197
+ }
198
+ interface CustomMetadata extends BaseMetadata {
199
+ [key: string]: unknown;
200
+ }
201
+ type MemoryMetadata = DocumentMetadata | FragmentMetadata | MessageMetadata | DescriptionMetadata | CustomMetadata;
202
+ /**
203
+ * Represents a stored memory/message
204
+ */
205
+ interface Memory {
206
+ /** Optional unique identifier */
207
+ id?: UUID;
208
+ /** Associated user ID */
209
+ entityId: UUID;
210
+ /** Associated agent ID */
211
+ agentId?: UUID;
212
+ /** Optional creation timestamp in milliseconds since epoch */
213
+ createdAt?: number;
214
+ /** Memory content */
215
+ content: Content;
216
+ /** Optional embedding vector for semantic search */
217
+ embedding?: number[];
218
+ /** Associated room ID */
219
+ roomId: UUID;
220
+ /** Associated world ID (optional) */
221
+ worldId?: UUID;
222
+ /** Whether memory is unique (used to prevent duplicates) */
223
+ unique?: boolean;
224
+ /** Embedding similarity score (set when retrieved via search) */
225
+ similarity?: number;
226
+ /** Metadata for the memory */
227
+ metadata?: MemoryMetadata;
228
+ }
229
+ /**
230
+ * Specialized memory type for messages with enhanced type checking
231
+ */
232
+ interface MessageMemory extends Memory {
233
+ metadata: MessageMetadata;
234
+ content: Content & {
235
+ text: string;
236
+ };
237
+ }
238
+ /**
239
+ * Factory function to create a new message memory with proper defaults
240
+ */
241
+ declare function createMessageMemory(params: {
242
+ id?: UUID;
243
+ entityId: UUID;
244
+ agentId?: UUID;
245
+ roomId: UUID;
246
+ content: Content & {
247
+ text: string;
248
+ };
249
+ embedding?: number[];
250
+ }): MessageMemory;
251
+ /**
252
+ * Type guard to check if a memory metadata is a DocumentMetadata
253
+ * @param metadata The metadata to check
254
+ * @returns True if the metadata is a DocumentMetadata
255
+ */
256
+ declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
257
+ /**
258
+ * Type guard to check if a memory metadata is a FragmentMetadata
259
+ * @param metadata The metadata to check
260
+ * @returns True if the metadata is a FragmentMetadata
261
+ */
262
+ declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
263
+ /**
264
+ * Type guard to check if a memory metadata is a MessageMetadata
265
+ * @param metadata The metadata to check
266
+ * @returns True if the metadata is a MessageMetadata
267
+ */
268
+ declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
269
+ /**
270
+ * Type guard to check if a memory metadata is a DescriptionMetadata
271
+ * @param metadata The metadata to check
272
+ * @returns True if the metadata is a DescriptionMetadata
273
+ */
274
+ declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
275
+ /**
276
+ * Type guard to check if a memory metadata is a CustomMetadata
277
+ * @param metadata The metadata to check
278
+ * @returns True if the metadata is a CustomMetadata
279
+ */
280
+ declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
281
+ /**
282
+ * Memory type guard for document memories
283
+ */
284
+ declare function isDocumentMemory(memory: Memory): memory is Memory & {
285
+ metadata: DocumentMetadata;
286
+ };
287
+ /**
288
+ * Memory type guard for fragment memories
289
+ */
290
+ declare function isFragmentMemory(memory: Memory): memory is Memory & {
291
+ metadata: FragmentMetadata;
292
+ };
293
+ /**
294
+ * Safely access the text content of a memory
295
+ * @param memory The memory to extract text from
296
+ * @param defaultValue Optional default value if no text is found
297
+ * @returns The text content or default value
298
+ */
299
+ declare function getMemoryText(memory: Memory, defaultValue?: string): string;
300
+
301
+ /**
302
+ * Represents a single item of knowledge that can be processed and stored by the agent.
303
+ * Knowledge items consist of content (text and optional structured data) and metadata.
304
+ * These items are typically added to the agent's knowledge base via `AgentRuntime.addKnowledge`
305
+ * and retrieved using `AgentRuntime.getKnowledge`.
306
+ * The `id` is a unique identifier for the knowledge item, often derived from its source or content.
307
+ */
308
+ type KnowledgeItem = {
309
+ /** A Universally Unique Identifier for this specific knowledge item. */
310
+ id: UUID;
311
+ /** The actual content of the knowledge item, which must include text and can have other fields. */
312
+ content: Content;
313
+ /** Optional metadata associated with this knowledge item, conforming to `MemoryMetadata`. */
314
+ metadata?: MemoryMetadata;
315
+ };
316
+ /**
317
+ * Defines the scope or visibility of knowledge items within the agent's system.
318
+ * - `SHARED`: Indicates knowledge that is broadly accessible, potentially across different agents or users if the system architecture permits.
319
+ * - `PRIVATE`: Indicates knowledge that is restricted, typically to the specific agent or user context it belongs to.
320
+ * This enum is used to manage access and retrieval of knowledge items, often in conjunction with `AgentRuntime.addKnowledge` or `AgentRuntime.getKnowledge` scopes.
321
+ */
322
+ declare enum KnowledgeScope {
323
+ SHARED = "shared",
324
+ PRIVATE = "private"
325
+ }
326
+ /**
327
+ * Specifies prefixes for keys used in caching mechanisms, helping to namespace cached data.
328
+ * For example, `KNOWLEDGE` might be used to prefix keys for cached knowledge embeddings or processed documents.
329
+ * This helps in organizing the cache and avoiding key collisions.
330
+ * Used internally by caching strategies, potentially within `IDatabaseAdapter` cache methods or runtime caching layers.
331
+ */
332
+ declare enum CacheKeyPrefix {
333
+ KNOWLEDGE = "knowledge"
334
+ }
335
+ /**
336
+ * Represents an item within a directory listing, specifically for knowledge loading.
337
+ * When an agent's `Character.knowledge` configuration includes a directory, this type
338
+ * is used to specify the path to that directory and whether its contents should be treated as shared.
339
+ * - `directory`: The path to the directory containing knowledge files.
340
+ * - `shared`: An optional boolean (defaults to false) indicating if the knowledge from this directory is considered shared or private.
341
+ */
342
+ interface DirectoryItem {
343
+ /** The path to the directory containing knowledge files. */
344
+ directory: string;
345
+ /** If true, knowledge from this directory is considered shared; otherwise, it's private. Defaults to false. */
346
+ shared?: boolean;
347
+ }
348
+ /**
349
+ * Represents a row structure, typically from a database query related to text chunking or processing.
350
+ * This interface is quite minimal and seems to be a placeholder or a base for more specific chunk-related types.
351
+ * The `id` would be the unique identifier for the chunk.
352
+ * It might be used when splitting large documents into smaller, manageable pieces for embedding or analysis.
353
+ */
354
+ interface ChunkRow {
355
+ /** The unique identifier for this chunk of text. */
356
+ id: string;
357
+ }
358
+
359
+ interface Component {
360
+ id: UUID;
361
+ entityId: UUID;
362
+ agentId: UUID;
363
+ roomId: UUID;
364
+ worldId: UUID;
365
+ sourceEntityId: UUID;
366
+ type: string;
367
+ createdAt: number;
368
+ data: Metadata;
369
+ }
370
+ /**
371
+ * Represents a user account
372
+ */
373
+ interface Entity {
374
+ /** Unique identifier, optional on creation */
375
+ id?: UUID;
376
+ /** Names of the entity */
377
+ names: string[];
378
+ /** Additional metadata */
379
+ metadata: Metadata;
380
+ /** Agent ID this account is related to, for agents should be themselves */
381
+ agentId: UUID;
382
+ /** Optional array of components */
383
+ components?: Component[];
384
+ }
385
+ /**
386
+ * Defines roles within a system, typically for access control or permissions, often within a `World`.
387
+ * - `OWNER`: Represents the highest level of control, typically the creator or primary administrator.
388
+ * - `ADMIN`: Represents administrative privileges, usually a subset of owner capabilities.
389
+ * - `NONE`: Indicates no specific role or default, minimal permissions.
390
+ * These roles are often used in `World.metadata.roles` to assign roles to entities.
391
+ */
392
+ declare enum Role {
393
+ OWNER = "OWNER",
394
+ ADMIN = "ADMIN",
395
+ NONE = "NONE"
396
+ }
397
+ type World = {
398
+ id: UUID;
399
+ name?: string;
400
+ agentId: UUID;
401
+ serverId: string;
402
+ metadata?: {
403
+ ownership?: {
404
+ ownerId: string;
405
+ };
406
+ roles?: {
407
+ [entityId: UUID]: Role;
408
+ };
409
+ [key: string]: unknown;
410
+ };
411
+ };
412
+ declare enum ChannelType {
413
+ SELF = "SELF",// Messages to self
414
+ DM = "DM",// Direct messages between two participants
415
+ GROUP = "GROUP",// Group messages with multiple participants
416
+ VOICE_DM = "VOICE_DM",// Voice direct messages
417
+ VOICE_GROUP = "VOICE_GROUP",// Voice channels with multiple participants
418
+ FEED = "FEED",// Social media feed
419
+ THREAD = "THREAD",// Threaded conversation
420
+ WORLD = "WORLD",// World channel
421
+ FORUM = "FORUM",// Forum discussion
422
+ API = "API"
423
+ }
424
+ type Room = {
425
+ id: UUID;
426
+ name?: string;
427
+ agentId?: UUID;
428
+ source: string;
429
+ type: ChannelType;
430
+ channelId?: string;
431
+ serverId?: string;
432
+ worldId?: UUID;
433
+ metadata?: Metadata;
434
+ };
435
+ type RoomMetadata = {
436
+ [key: string]: unknown;
437
+ };
438
+ /**
439
+ * Room participant with account details
440
+ */
441
+ interface Participant {
442
+ /** Unique identifier */
443
+ id: UUID;
444
+ /** Associated account */
445
+ entity: Entity;
446
+ }
447
+ /**
448
+ * Represents a relationship between users
449
+ */
450
+ interface Relationship {
451
+ /** Unique identifier */
452
+ id: UUID;
453
+ /** First user ID */
454
+ sourceEntityId: UUID;
455
+ /** Second user ID */
456
+ targetEntityId: UUID;
457
+ /** Agent ID */
458
+ agentId: UUID;
459
+ /** Tags for filtering/categorizing relationships */
460
+ tags: string[];
461
+ /** Additional metadata about the relationship */
462
+ metadata: Metadata;
463
+ /** Optional creation timestamp */
464
+ createdAt?: string;
465
+ }
466
+
467
+ /**
468
+ * Example message for demonstration
469
+ */
470
+ interface MessageExample {
471
+ /** Associated user */
472
+ name: string;
473
+ /** Message content */
474
+ content: Content;
475
+ }
476
+ type TemplateType = string | ((options: {
477
+ state: State | {
478
+ [key: string]: string;
479
+ };
480
+ }) => string);
481
+ /**
482
+ * Configuration for an agent's character, defining its personality, knowledge, and capabilities.
483
+ * This is a central piece of an agent's definition, used by the `AgentRuntime` to initialize and operate the agent.
484
+ * It includes:
485
+ * - `id`: Optional unique identifier for the character.
486
+ * - `name`, `username`: Identifying names for the character.
487
+ * - `system`: A system prompt that guides the agent's overall behavior.
488
+ * - `templates`: A map of prompt templates for various situations (e.g., message generation, summarization).
489
+ * - `bio`: A textual biography or description of the character.
490
+ * - `messageExamples`, `postExamples`: Examples of how the character communicates.
491
+ * - `topics`, `adjectives`: Keywords describing the character's knowledge areas and traits.
492
+ * - `knowledge`: Paths to knowledge files or directories to be loaded into the agent's memory.
493
+ * - `plugins`: A list of plugin names to be loaded for this character.
494
+ * - `settings`, `secrets`: Configuration key-value pairs, with secrets being handled more securely.
495
+ * - `style`: Guidelines for the character's writing style in different contexts (chat, post).
496
+ */
497
+ interface Character {
498
+ /** Optional unique identifier */
499
+ id?: UUID;
500
+ /** Character name */
501
+ name: string;
502
+ /** Optional username */
503
+ username?: string;
504
+ /** Optional system prompt */
505
+ system?: string;
506
+ /** Optional prompt templates */
507
+ templates?: {
508
+ [key: string]: TemplateType;
509
+ };
510
+ /** Character biography */
511
+ bio: string | string[];
512
+ /** Example messages */
513
+ messageExamples?: MessageExample[][];
514
+ /** Example posts */
515
+ postExamples?: string[];
516
+ /** Known topics */
517
+ topics?: string[];
518
+ /** Character traits */
519
+ adjectives?: string[];
520
+ /** Optional knowledge base */
521
+ knowledge?: (string | {
522
+ path: string;
523
+ shared?: boolean;
524
+ } | DirectoryItem)[];
525
+ /** Available plugins */
526
+ plugins?: string[];
527
+ /** Optional configuration */
528
+ settings?: {
529
+ [key: string]: string | boolean | number | Record<string, any>;
530
+ };
531
+ /** Optional secrets */
532
+ secrets?: {
533
+ [key: string]: string | boolean | number;
534
+ };
535
+ /** Writing style guides */
536
+ style?: {
537
+ all?: string[];
538
+ chat?: string[];
539
+ post?: string[];
540
+ };
541
+ }
542
+ declare enum AgentStatus {
543
+ ACTIVE = "active",
544
+ INACTIVE = "inactive"
545
+ }
546
+ /**
547
+ * Represents an operational agent, extending the `Character` definition with runtime status and timestamps.
548
+ * While `Character` defines the blueprint, `Agent` represents an instantiated and potentially running version.
549
+ * It includes:
550
+ * - `enabled`: A boolean indicating if the agent is currently active or disabled.
551
+ * - `status`: The current operational status, typically `AgentStatus.ACTIVE` or `AgentStatus.INACTIVE`.
552
+ * - `createdAt`, `updatedAt`: Timestamps for when the agent record was created and last updated in the database.
553
+ * This interface is primarily used by the `IDatabaseAdapter` for agent management.
554
+ */
555
+ interface Agent extends Character {
556
+ enabled?: boolean;
557
+ status?: AgentStatus;
558
+ createdAt: number;
559
+ updatedAt: number;
560
+ }
561
+
562
+ /**
563
+ * Defines the contract for a Task Worker, which is responsible for executing a specific type of task.
564
+ * Task workers are registered with the `AgentRuntime` and are invoked when a `Task` of their designated `name` needs processing.
565
+ * This pattern allows for modular and extensible background task processing.
566
+ */
567
+ interface TaskWorker {
568
+ /** The unique name of the task type this worker handles. This name links `Task` instances to this worker. */
569
+ name: string;
570
+ /**
571
+ * The core execution logic for the task. This function is called by the runtime when a task needs to be processed.
572
+ * It receives the `AgentRuntime`, task-specific `options`, and the `Task` object itself.
573
+ */
574
+ execute: (runtime: IAgentRuntime, options: {
575
+ [key: string]: unknown;
576
+ }, task: Task) => Promise<void>;
577
+ /**
578
+ * Optional validation function that can be used to determine if a task is valid or should be executed,
579
+ * often based on the current message and state. This might be used by an action or evaluator
580
+ * before creating or queueing a task.
581
+ */
582
+ validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
583
+ }
584
+ /**
585
+ * Defines metadata associated with a `Task`.
586
+ * This can include scheduling information like `updateInterval` or UI-related details
587
+ * for presenting task options to a user.
588
+ * The `[key: string]: unknown;` allows for additional, unspecified metadata fields.
589
+ */
590
+ type TaskMetadata = {
591
+ /** Optional. If the task is recurring, this specifies the interval in milliseconds between updates or executions. */
592
+ updateInterval?: number;
593
+ /** Optional. Describes options or parameters that can be configured for this task, often for UI presentation. */
594
+ options?: {
595
+ name: string;
596
+ description: string;
597
+ }[];
598
+ /** Allows for other dynamic metadata properties related to the task. */
599
+ [key: string]: unknown;
600
+ };
601
+ /**
602
+ * Represents a task to be performed, often in the background or at a later time.
603
+ * Tasks are managed by the `AgentRuntime` and processed by registered `TaskWorker`s.
604
+ * They can be associated with a room, world, and tagged for categorization and retrieval.
605
+ * The `IDatabaseAdapter` handles persistence of task data.
606
+ */
607
+ interface Task {
608
+ /** Optional. A Universally Unique Identifier for the task. Generated if not provided. */
609
+ id?: UUID;
610
+ /** The name of the task, which should correspond to a registered `TaskWorker.name`. */
611
+ name: string;
612
+ /** Optional. Timestamp of the last update to this task. */
613
+ updatedAt?: number;
614
+ /** Optional. Metadata associated with the task, conforming to `TaskMetadata`. */
615
+ metadata?: TaskMetadata;
616
+ /** A human-readable description of what the task does or its purpose. */
617
+ description: string;
618
+ /** Optional. The UUID of the room this task is associated with. */
619
+ roomId?: UUID;
620
+ /** Optional. The UUID of the world this task is associated with. */
621
+ worldId?: UUID;
622
+ entityId?: UUID;
623
+ tags: string[];
624
+ }
625
+
626
+ /**
627
+ * Represents a log entry
628
+ */
629
+ interface Log {
630
+ /** Optional unique identifier */
631
+ id?: UUID;
632
+ /** Associated entity ID */
633
+ entityId: UUID;
634
+ /** Associated room ID */
635
+ roomId?: UUID;
636
+ /** Log body */
637
+ body: {
638
+ [key: string]: unknown;
639
+ };
640
+ /** Log type */
641
+ type: string;
642
+ /** Log creation timestamp */
643
+ createdAt: Date;
644
+ }
645
+ /**
646
+ * Interface for database operations
647
+ */
648
+ interface IDatabaseAdapter {
649
+ /** Database instance */
650
+ db: any;
651
+ /** Initialize database connection */
652
+ initialize(config?: any): Promise<void>;
653
+ /** Initialize database connection */
654
+ init(): Promise<void>;
655
+ /** Run database migrations */
656
+ runMigrations(schema?: any, pluginName?: string): Promise<void>;
657
+ /** Check if the database connection is ready */
658
+ isReady(): Promise<boolean>;
659
+ /** Close database connection */
660
+ close(): Promise<void>;
661
+ getConnection(): Promise<any>;
662
+ getAgent(agentId: UUID): Promise<Agent | null>;
663
+ /** Get all agents */
664
+ getAgents(): Promise<Partial<Agent>[]>;
665
+ createAgent(agent: Partial<Agent>): Promise<boolean>;
666
+ updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
667
+ deleteAgent(agentId: UUID): Promise<boolean>;
668
+ ensureEmbeddingDimension(dimension: number): Promise<void>;
669
+ /** Get entity by IDs */
670
+ getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
671
+ /** Get entities for room */
672
+ getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
673
+ /** Create new entities */
674
+ createEntities(entities: Entity[]): Promise<boolean>;
675
+ /** Update entity */
676
+ updateEntity(entity: Entity): Promise<void>;
677
+ /** Get component by ID */
678
+ getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
679
+ /** Get all components for an entity */
680
+ getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
681
+ /** Create component */
682
+ createComponent(component: Component): Promise<boolean>;
683
+ /** Update component */
684
+ updateComponent(component: Component): Promise<void>;
685
+ /** Delete component */
686
+ deleteComponent(componentId: UUID): Promise<void>;
687
+ /** Get memories matching criteria */
688
+ getMemories(params: {
689
+ entityId?: UUID;
690
+ agentId?: UUID;
691
+ count?: number;
692
+ unique?: boolean;
693
+ tableName: string;
694
+ start?: number;
695
+ end?: number;
696
+ roomId?: UUID;
697
+ worldId?: UUID;
698
+ }): Promise<Memory[]>;
699
+ getMemoryById(id: UUID): Promise<Memory | null>;
700
+ getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
701
+ getMemoriesByRoomIds(params: {
702
+ tableName: string;
703
+ roomIds: UUID[];
704
+ limit?: number;
705
+ }): Promise<Memory[]>;
706
+ getCachedEmbeddings(params: {
707
+ query_table_name: string;
708
+ query_threshold: number;
709
+ query_input: string;
710
+ query_field_name: string;
711
+ query_field_sub_name: string;
712
+ query_match_count: number;
713
+ }): Promise<{
714
+ embedding: number[];
715
+ levenshtein_score: number;
716
+ }[]>;
717
+ log(params: {
718
+ body: {
719
+ [key: string]: unknown;
720
+ };
721
+ entityId: UUID;
722
+ roomId: UUID;
723
+ type: string;
724
+ }): Promise<void>;
725
+ getLogs(params: {
726
+ entityId: UUID;
727
+ roomId?: UUID;
728
+ type?: string;
729
+ count?: number;
730
+ offset?: number;
731
+ }): Promise<Log[]>;
732
+ deleteLog(logId: UUID): Promise<void>;
733
+ searchMemories(params: {
734
+ embedding: number[];
735
+ match_threshold?: number;
736
+ count?: number;
737
+ unique?: boolean;
738
+ tableName: string;
739
+ query?: string;
740
+ roomId?: UUID;
741
+ worldId?: UUID;
742
+ entityId?: UUID;
743
+ }): Promise<Memory[]>;
744
+ createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
745
+ updateMemory(memory: Partial<Memory> & {
746
+ id: UUID;
747
+ metadata?: MemoryMetadata;
748
+ }): Promise<boolean>;
749
+ deleteMemory(memoryId: UUID): Promise<void>;
750
+ deleteManyMemories(memoryIds: UUID[]): Promise<void>;
751
+ deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
752
+ countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
753
+ createWorld(world: World): Promise<UUID>;
754
+ getWorld(id: UUID): Promise<World | null>;
755
+ removeWorld(id: UUID): Promise<void>;
756
+ getAllWorlds(): Promise<World[]>;
757
+ updateWorld(world: World): Promise<void>;
758
+ getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
759
+ createRooms(rooms: Room[]): Promise<UUID[]>;
760
+ deleteRoom(roomId: UUID): Promise<void>;
761
+ deleteRoomsByWorldId(worldId: UUID): Promise<void>;
762
+ updateRoom(room: Room): Promise<void>;
763
+ getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
764
+ getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
765
+ getRoomsByWorld(worldId: UUID): Promise<Room[]>;
766
+ removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
767
+ getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
768
+ getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
769
+ addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
770
+ getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
771
+ setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
772
+ /**
773
+ * Creates a new relationship between two entities.
774
+ * @param params Object containing the relationship details
775
+ * @returns Promise resolving to boolean indicating success
776
+ */
777
+ createRelationship(params: {
778
+ sourceEntityId: UUID;
779
+ targetEntityId: UUID;
780
+ tags?: string[];
781
+ metadata?: Metadata;
782
+ }): Promise<boolean>;
783
+ /**
784
+ * Updates an existing relationship between two entities.
785
+ * @param relationship The relationship object with updated data
786
+ * @returns Promise resolving to void
787
+ */
788
+ updateRelationship(relationship: Relationship): Promise<void>;
789
+ /**
790
+ * Retrieves a relationship between two entities if it exists.
791
+ * @param params Object containing the entity IDs and agent ID
792
+ * @returns Promise resolving to the Relationship object or null if not found
793
+ */
794
+ getRelationship(params: {
795
+ sourceEntityId: UUID;
796
+ targetEntityId: UUID;
797
+ }): Promise<Relationship | null>;
798
+ /**
799
+ * Retrieves all relationships for a specific entity.
800
+ * @param params Object containing the user ID, agent ID and optional tags to filter by
801
+ * @returns Promise resolving to an array of Relationship objects
802
+ */
803
+ getRelationships(params: {
804
+ entityId: UUID;
805
+ tags?: string[];
806
+ }): Promise<Relationship[]>;
807
+ getCache<T>(key: string): Promise<T | undefined>;
808
+ setCache<T>(key: string, value: T): Promise<boolean>;
809
+ deleteCache(key: string): Promise<boolean>;
810
+ createTask(task: Task): Promise<UUID>;
811
+ getTasks(params: {
812
+ roomId?: UUID;
813
+ tags?: string[];
814
+ entityId?: UUID;
815
+ }): Promise<Task[]>;
816
+ getTask(id: UUID): Promise<Task | null>;
817
+ getTasksByName(name: string): Promise<Task[]>;
818
+ updateTask(id: UUID, task: Partial<Task>): Promise<void>;
819
+ deleteTask(id: UUID): Promise<void>;
820
+ getMemoriesByWorldId(params: {
821
+ worldId: UUID;
822
+ count?: number;
823
+ tableName?: string;
824
+ }): Promise<Memory[]>;
825
+ }
826
+ /**
827
+ * Result interface for embedding similarity searches
828
+ */
829
+ interface EmbeddingSearchResult {
830
+ embedding: number[];
831
+ levenshtein_score: number;
832
+ }
833
+ /**
834
+ * Options for memory retrieval operations
835
+ */
836
+ interface MemoryRetrievalOptions {
837
+ roomId: UUID;
838
+ count?: number;
839
+ unique?: boolean;
840
+ start?: number;
841
+ end?: number;
842
+ agentId?: UUID;
843
+ }
844
+ /**
845
+ * Options for memory search operations
846
+ */
847
+ interface MemorySearchOptions {
848
+ embedding: number[];
849
+ match_threshold?: number;
850
+ count?: number;
851
+ roomId: UUID;
852
+ agentId?: UUID;
853
+ unique?: boolean;
854
+ metadata?: Partial<MemoryMetadata>;
855
+ }
856
+ /**
857
+ * Options for multi-room memory retrieval
858
+ */
859
+ interface MultiRoomMemoryOptions {
860
+ roomIds: UUID[];
861
+ limit?: number;
862
+ agentId?: UUID;
863
+ }
864
+ /**
865
+ * Unified options pattern for memory operations
866
+ * Provides a simpler, more consistent interface
867
+ */
868
+ interface UnifiedMemoryOptions {
869
+ roomId: UUID;
870
+ limit?: number;
871
+ agentId?: UUID;
872
+ unique?: boolean;
873
+ start?: number;
874
+ end?: number;
875
+ }
876
+ /**
877
+ * Specialized memory search options
878
+ */
879
+ interface UnifiedSearchOptions extends UnifiedMemoryOptions {
880
+ embedding: number[];
881
+ similarity?: number;
882
+ }
883
+ /**
884
+ * Represents a generic database connection object.
885
+ * The actual type of this connection will depend on the specific database adapter implementation
886
+ * (e.g., a connection pool object for PostgreSQL, a client instance for a NoSQL database).
887
+ * This `unknown` type serves as a placeholder in the abstract `IDatabaseAdapter`.
888
+ */
889
+ type DbConnection = unknown;
890
+ declare const VECTOR_DIMS: {
891
+ readonly SMALL: 384;
892
+ readonly MEDIUM: 512;
893
+ readonly LARGE: 768;
894
+ readonly XL: 1024;
895
+ readonly XXL: 1536;
896
+ readonly XXXL: 3072;
897
+ };
898
+
899
+ /**
900
+ * Information describing the target of a message.
901
+ */
902
+ interface TargetInfo {
903
+ source: string;
904
+ roomId?: UUID;
905
+ channelId?: string;
906
+ serverId?: string;
907
+ entityId?: UUID;
908
+ threadId?: string;
909
+ }
910
+ /**
911
+ * Function signature for handlers responsible for sending messages to specific platforms.
912
+ */
913
+ type SendHandlerFunction = (runtime: IAgentRuntime, target: TargetInfo, content: Content) => Promise<void>;
914
+ declare enum SOCKET_MESSAGE_TYPE {
915
+ ROOM_JOINING = 1,
916
+ SEND_MESSAGE = 2,
917
+ MESSAGE = 3,
918
+ ACK = 4,
919
+ THINKING = 5,
920
+ CONTROL = 6
921
+ }
922
+ /**
923
+ * Interface for control messages sent from the backend to the frontend
924
+ * to manage UI state and interaction capabilities
925
+ */
926
+ interface ControlMessage {
927
+ /** Message type identifier */
928
+ type: 'control';
929
+ /** Control message payload */
930
+ payload: {
931
+ /** Action to perform */
932
+ action: 'disable_input' | 'enable_input';
933
+ /** Optional target element identifier */
934
+ target?: string;
935
+ /** Additional optional parameters */
936
+ [key: string]: unknown;
937
+ };
938
+ /** Room ID to ensure signal is directed to the correct chat window */
939
+ roomId: UUID;
940
+ }
941
+
942
+ type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
943
+ /**
944
+ * Defines the recognized types of models that the agent runtime can use.
945
+ * These include models for text generation (small, large, reasoning, completion),
946
+ * text embedding, tokenization (encode/decode), image generation and description,
947
+ * audio transcription, text-to-speech, and generic object generation.
948
+ * This constant is used throughout the system, particularly in `AgentRuntime.useModel`,
949
+ * `AgentRuntime.registerModel`, and in `ModelParamsMap` / `ModelResultMap` to ensure
950
+ * type safety and clarity when working with different AI models.
951
+ * String values are used for extensibility with custom model types.
952
+ */
953
+ declare const ModelType: {
954
+ readonly SMALL: "TEXT_SMALL";
955
+ readonly MEDIUM: "TEXT_LARGE";
956
+ readonly LARGE: "TEXT_LARGE";
957
+ readonly TEXT_SMALL: "TEXT_SMALL";
958
+ readonly TEXT_LARGE: "TEXT_LARGE";
959
+ readonly TEXT_EMBEDDING: "TEXT_EMBEDDING";
960
+ readonly TEXT_TOKENIZER_ENCODE: "TEXT_TOKENIZER_ENCODE";
961
+ readonly TEXT_TOKENIZER_DECODE: "TEXT_TOKENIZER_DECODE";
962
+ readonly TEXT_REASONING_SMALL: "REASONING_SMALL";
963
+ readonly TEXT_REASONING_LARGE: "REASONING_LARGE";
964
+ readonly TEXT_COMPLETION: "TEXT_COMPLETION";
965
+ readonly IMAGE: "IMAGE";
966
+ readonly IMAGE_DESCRIPTION: "IMAGE_DESCRIPTION";
967
+ readonly TRANSCRIPTION: "TRANSCRIPTION";
968
+ readonly TEXT_TO_SPEECH: "TEXT_TO_SPEECH";
969
+ readonly AUDIO: "AUDIO";
970
+ readonly VIDEO: "VIDEO";
971
+ readonly OBJECT_SMALL: "OBJECT_SMALL";
972
+ readonly OBJECT_LARGE: "OBJECT_LARGE";
973
+ };
974
+ /**
975
+ * Model configuration setting keys used in character settings.
976
+ * These constants define the keys for accessing model parameters
977
+ * from character configuration with support for per-model-type settings.
978
+ *
979
+ * Setting Precedence (highest to lowest):
980
+ * 1. Parameters passed directly to useModel()
981
+ * 2. Model-specific settings (e.g., TEXT_SMALL_TEMPERATURE)
982
+ * 3. Default settings (e.g., DEFAULT_TEMPERATURE)
983
+ *
984
+ * Example character settings:
985
+ * ```
986
+ * settings: {
987
+ * DEFAULT_TEMPERATURE: 0.7, // Applies to all models
988
+ * TEXT_SMALL_TEMPERATURE: 0.5, // Overrides default for TEXT_SMALL
989
+ * TEXT_LARGE_MAX_TOKENS: 4096, // Specific to TEXT_LARGE
990
+ * OBJECT_SMALL_TEMPERATURE: 0.3, // Specific to OBJECT_SMALL
991
+ * }
992
+ * ```
993
+ */
994
+ declare const MODEL_SETTINGS: {
995
+ readonly DEFAULT_MAX_TOKENS: "DEFAULT_MAX_TOKENS";
996
+ readonly DEFAULT_TEMPERATURE: "DEFAULT_TEMPERATURE";
997
+ readonly DEFAULT_FREQUENCY_PENALTY: "DEFAULT_FREQUENCY_PENALTY";
998
+ readonly DEFAULT_PRESENCE_PENALTY: "DEFAULT_PRESENCE_PENALTY";
999
+ readonly TEXT_SMALL_MAX_TOKENS: "TEXT_SMALL_MAX_TOKENS";
1000
+ readonly TEXT_SMALL_TEMPERATURE: "TEXT_SMALL_TEMPERATURE";
1001
+ readonly TEXT_SMALL_FREQUENCY_PENALTY: "TEXT_SMALL_FREQUENCY_PENALTY";
1002
+ readonly TEXT_SMALL_PRESENCE_PENALTY: "TEXT_SMALL_PRESENCE_PENALTY";
1003
+ readonly TEXT_LARGE_MAX_TOKENS: "TEXT_LARGE_MAX_TOKENS";
1004
+ readonly TEXT_LARGE_TEMPERATURE: "TEXT_LARGE_TEMPERATURE";
1005
+ readonly TEXT_LARGE_FREQUENCY_PENALTY: "TEXT_LARGE_FREQUENCY_PENALTY";
1006
+ readonly TEXT_LARGE_PRESENCE_PENALTY: "TEXT_LARGE_PRESENCE_PENALTY";
1007
+ readonly OBJECT_SMALL_MAX_TOKENS: "OBJECT_SMALL_MAX_TOKENS";
1008
+ readonly OBJECT_SMALL_TEMPERATURE: "OBJECT_SMALL_TEMPERATURE";
1009
+ readonly OBJECT_SMALL_FREQUENCY_PENALTY: "OBJECT_SMALL_FREQUENCY_PENALTY";
1010
+ readonly OBJECT_SMALL_PRESENCE_PENALTY: "OBJECT_SMALL_PRESENCE_PENALTY";
1011
+ readonly OBJECT_LARGE_MAX_TOKENS: "OBJECT_LARGE_MAX_TOKENS";
1012
+ readonly OBJECT_LARGE_TEMPERATURE: "OBJECT_LARGE_TEMPERATURE";
1013
+ readonly OBJECT_LARGE_FREQUENCY_PENALTY: "OBJECT_LARGE_FREQUENCY_PENALTY";
1014
+ readonly OBJECT_LARGE_PRESENCE_PENALTY: "OBJECT_LARGE_PRESENCE_PENALTY";
1015
+ readonly MODEL_MAX_TOKEN: "MODEL_MAX_TOKEN";
1016
+ readonly MODEL_TEMPERATURE: "MODEL_TEMPERATURE";
1017
+ readonly MODEL_FREQ_PENALTY: "MODEL_FREQ_PENALTY";
1018
+ readonly MODEL_PRESENCE_PENALTY: "MODEL_PRESENCE_PENALTY";
1019
+ };
1020
+ /**
1021
+ * Helper to get the model-specific setting key for a given model type and parameter.
1022
+ * @param modelType The model type (e.g., TEXT_SMALL, TEXT_LARGE)
1023
+ * @param param The parameter name (e.g., MAX_TOKENS, TEMPERATURE)
1024
+ * @returns The appropriate setting key or null if not a supported model type
1025
+ */
1026
+ declare function getModelSpecificSettingKey(modelType: ModelTypeName, param: 'MAX_TOKENS' | 'TEMPERATURE' | 'FREQUENCY_PENALTY' | 'PRESENCE_PENALTY'): string | null;
1027
+ /**
1028
+ * Parameters for generating text using a language model.
1029
+ * This structure is typically passed to `AgentRuntime.useModel` when the `modelType` is one of
1030
+ * `ModelType.TEXT_SMALL`, `ModelType.TEXT_LARGE`, `ModelType.TEXT_REASONING_SMALL`,
1031
+ * `ModelType.TEXT_REASONING_LARGE`, or `ModelType.TEXT_COMPLETION`.
1032
+ * It includes essential information like the prompt, model type, and various generation controls.
1033
+ */
1034
+ type GenerateTextParams = {
1035
+ /** The `AgentRuntime` instance, providing access to models and other services. */
1036
+ runtime: IAgentRuntime;
1037
+ /** The input string or prompt that the language model will use to generate text. */
1038
+ prompt: string;
1039
+ /** Specifies the type of text generation model to use (e.g., TEXT_LARGE, REASONING_SMALL). */
1040
+ modelType: ModelTypeName;
1041
+ /** Optional. The maximum number of tokens to generate in the response. */
1042
+ maxTokens?: number;
1043
+ /** Optional. Controls randomness (0.0-1.0). Lower values are more deterministic, higher are more creative. */
1044
+ temperature?: number;
1045
+ /** Optional. Penalizes new tokens based on their existing frequency in the text so far. */
1046
+ frequencyPenalty?: number;
1047
+ /** Optional. Penalizes new tokens based on whether they appear in the text so far. */
1048
+ presencePenalty?: number;
1049
+ /** Optional. A list of sequences at which the model will stop generating further tokens. */
1050
+ stopSequences?: string[];
1051
+ };
1052
+ /**
1053
+ * Parameters for detokenizing text, i.e., converting a sequence of numerical tokens back into a string.
1054
+ * This is the reverse operation of tokenization.
1055
+ * This structure is used with `AgentRuntime.useModel` when the `modelType` is `ModelType.TEXT_TOKENIZER_DECODE`.
1056
+ */
1057
+ interface DetokenizeTextParams {
1058
+ /** An array of numerical tokens to be converted back into text. */
1059
+ tokens: number[];
1060
+ /** The model type used for detokenization, ensuring consistency with the original tokenization. */
1061
+ modelType: ModelTypeName;
1062
+ }
1063
+ /**
1064
+ * Base parameters common to all model types
1065
+ */
1066
+ interface BaseModelParams {
1067
+ /** The agent runtime for accessing services and utilities */
1068
+ runtime: IAgentRuntime;
1069
+ }
1070
+ /**
1071
+ * Parameters for text generation models
1072
+ */
1073
+ interface TextGenerationParams extends BaseModelParams {
1074
+ /** The prompt to generate text from */
1075
+ prompt: string;
1076
+ /** Model temperature (0.0 to 1.0, lower is more deterministic) */
1077
+ temperature?: number;
1078
+ /** Maximum number of tokens to generate */
1079
+ maxTokens?: number;
1080
+ /** Sequences that should stop generation when encountered */
1081
+ stopSequences?: string[];
1082
+ /** Frequency penalty to apply */
1083
+ frequencyPenalty?: number;
1084
+ /** Presence penalty to apply */
1085
+ presencePenalty?: number;
1086
+ }
1087
+ /**
1088
+ * Parameters for text embedding models
1089
+ */
1090
+ interface TextEmbeddingParams extends BaseModelParams {
1091
+ /** The text to create embeddings for */
1092
+ text: string;
1093
+ }
1094
+ /**
1095
+ * Parameters for text tokenization models
1096
+ */
1097
+ interface TokenizeTextParams extends BaseModelParams {
1098
+ /** The text to tokenize */
1099
+ prompt: string;
1100
+ /** The model type to use for tokenization */
1101
+ modelType: ModelTypeName;
1102
+ }
1103
+ /**
1104
+ * Parameters for image generation models
1105
+ */
1106
+ interface ImageGenerationParams extends BaseModelParams {
1107
+ /** The prompt describing the image to generate */
1108
+ prompt: string;
1109
+ /** The dimensions of the image to generate */
1110
+ size?: string;
1111
+ /** Number of images to generate */
1112
+ count?: number;
1113
+ }
1114
+ /**
1115
+ * Parameters for image description models
1116
+ */
1117
+ interface ImageDescriptionParams extends BaseModelParams {
1118
+ /** The URL or path of the image to describe */
1119
+ imageUrl: string;
1120
+ /** Optional prompt to guide the description */
1121
+ prompt?: string;
1122
+ }
1123
+ /**
1124
+ * Parameters for transcription models
1125
+ */
1126
+ interface TranscriptionParams extends BaseModelParams {
1127
+ /** The URL or path of the audio file to transcribe */
1128
+ audioUrl: string;
1129
+ /** Optional prompt to guide transcription */
1130
+ prompt?: string;
1131
+ }
1132
+ /**
1133
+ * Parameters for text-to-speech models
1134
+ */
1135
+ interface TextToSpeechParams extends BaseModelParams {
1136
+ /** The text to convert to speech */
1137
+ text: string;
1138
+ /** The voice to use */
1139
+ voice?: string;
1140
+ /** The speaking speed */
1141
+ speed?: number;
1142
+ }
1143
+ /**
1144
+ * Parameters for audio processing models
1145
+ */
1146
+ interface AudioProcessingParams extends BaseModelParams {
1147
+ /** The URL or path of the audio file to process */
1148
+ audioUrl: string;
1149
+ /** The type of audio processing to perform */
1150
+ processingType: string;
1151
+ }
1152
+ /**
1153
+ * Parameters for video processing models
1154
+ */
1155
+ interface VideoProcessingParams extends BaseModelParams {
1156
+ /** The URL or path of the video file to process */
1157
+ videoUrl: string;
1158
+ /** The type of video processing to perform */
1159
+ processingType: string;
1160
+ }
1161
+ /**
1162
+ * Optional JSON schema for validating generated objects
1163
+ */
1164
+ type JSONSchema = {
1165
+ type: string;
1166
+ properties?: Record<string, any>;
1167
+ required?: string[];
1168
+ items?: JSONSchema;
1169
+ [key: string]: any;
1170
+ };
1171
+ /**
1172
+ * Parameters for object generation models
1173
+ * @template T - The expected return type, inferred from schema if provided
1174
+ */
1175
+ interface ObjectGenerationParams extends BaseModelParams {
1176
+ /** The prompt describing the object to generate */
1177
+ prompt: string;
1178
+ /** Optional JSON schema for validation */
1179
+ schema?: JSONSchema;
1180
+ /** Type of object to generate */
1181
+ output?: 'object' | 'array' | 'enum';
1182
+ /** For enum type, the allowed values */
1183
+ enumValues?: string[];
1184
+ /** Model type to use */
1185
+ modelType?: ModelTypeName;
1186
+ /** Model temperature (0.0 to 1.0) */
1187
+ temperature?: number;
1188
+ /** Sequences that should stop generation */
1189
+ stopSequences?: string[];
1190
+ }
1191
+ /**
1192
+ * Map of model types to their parameter types
1193
+ */
1194
+ interface ModelParamsMap {
1195
+ [ModelType.TEXT_SMALL]: TextGenerationParams;
1196
+ [ModelType.TEXT_LARGE]: TextGenerationParams;
1197
+ [ModelType.TEXT_EMBEDDING]: TextEmbeddingParams | string | null;
1198
+ [ModelType.TEXT_TOKENIZER_ENCODE]: TokenizeTextParams;
1199
+ [ModelType.TEXT_TOKENIZER_DECODE]: DetokenizeTextParams;
1200
+ [ModelType.TEXT_REASONING_SMALL]: TextGenerationParams;
1201
+ [ModelType.TEXT_REASONING_LARGE]: TextGenerationParams;
1202
+ [ModelType.IMAGE]: ImageGenerationParams;
1203
+ [ModelType.IMAGE_DESCRIPTION]: ImageDescriptionParams | string;
1204
+ [ModelType.TRANSCRIPTION]: TranscriptionParams | Buffer | string;
1205
+ [ModelType.TEXT_TO_SPEECH]: TextToSpeechParams | string;
1206
+ [ModelType.AUDIO]: AudioProcessingParams;
1207
+ [ModelType.VIDEO]: VideoProcessingParams;
1208
+ [ModelType.OBJECT_SMALL]: ObjectGenerationParams;
1209
+ [ModelType.OBJECT_LARGE]: ObjectGenerationParams;
1210
+ [key: string]: BaseModelParams | any;
1211
+ }
1212
+ /**
1213
+ * Map of model types to their return value types
1214
+ */
1215
+ interface ModelResultMap {
1216
+ [ModelType.TEXT_SMALL]: string;
1217
+ [ModelType.TEXT_LARGE]: string;
1218
+ [ModelType.TEXT_EMBEDDING]: number[];
1219
+ [ModelType.TEXT_TOKENIZER_ENCODE]: number[];
1220
+ [ModelType.TEXT_TOKENIZER_DECODE]: string;
1221
+ [ModelType.TEXT_REASONING_SMALL]: string;
1222
+ [ModelType.TEXT_REASONING_LARGE]: string;
1223
+ [ModelType.IMAGE]: {
1224
+ url: string;
1225
+ }[];
1226
+ [ModelType.IMAGE_DESCRIPTION]: {
1227
+ title: string;
1228
+ description: string;
1229
+ };
1230
+ [ModelType.TRANSCRIPTION]: string;
1231
+ [ModelType.TEXT_TO_SPEECH]: any | Buffer;
1232
+ [ModelType.AUDIO]: any;
1233
+ [ModelType.VIDEO]: any;
1234
+ [ModelType.OBJECT_SMALL]: any;
1235
+ [ModelType.OBJECT_LARGE]: any;
1236
+ [key: string]: any;
1237
+ }
1238
+ /**
1239
+ * Defines the structure for a model handler registration within the `AgentRuntime`.
1240
+ * Each model (e.g., for text generation, embedding) is associated with a handler function,
1241
+ * the name of the provider (plugin or system) that registered it, and an optional priority.
1242
+ * The `priority` (higher is more preferred) helps in selecting which handler to use if multiple
1243
+ * handlers are registered for the same model type. The `registrationOrder` (not in type, but used in runtime)
1244
+ * serves as a tie-breaker. See `AgentRuntime.registerModel` and `AgentRuntime.getModel`.
1245
+ */
1246
+ interface ModelHandler {
1247
+ /** The function that executes the model, taking runtime and parameters, and returning a Promise. */
1248
+ handler: (runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>;
1249
+ /** The name of the provider (e.g., plugin name) that registered this model handler. */
1250
+ provider: string;
1251
+ /**
1252
+ * Optional priority for this model handler. Higher numbers indicate higher priority.
1253
+ * This is used by `AgentRuntime.getModel` to select the most appropriate handler
1254
+ * when multiple are available for a given model type. Defaults to 0 if not specified.
1255
+ */
1256
+ priority?: number;
1257
+ registrationOrder?: number;
1258
+ }
1259
+
1260
+ /**
1261
+ * Standard event types across all platforms
1262
+ */
1263
+ declare enum EventType {
1264
+ WORLD_JOINED = "WORLD_JOINED",
1265
+ WORLD_CONNECTED = "WORLD_CONNECTED",
1266
+ WORLD_LEFT = "WORLD_LEFT",
1267
+ ENTITY_JOINED = "ENTITY_JOINED",
1268
+ ENTITY_LEFT = "ENTITY_LEFT",
1269
+ ENTITY_UPDATED = "ENTITY_UPDATED",
1270
+ ROOM_JOINED = "ROOM_JOINED",
1271
+ ROOM_LEFT = "ROOM_LEFT",
1272
+ MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
1273
+ MESSAGE_SENT = "MESSAGE_SENT",
1274
+ MESSAGE_DELETED = "MESSAGE_DELETED",
1275
+ CHANNEL_CLEARED = "CHANNEL_CLEARED",
1276
+ VOICE_MESSAGE_RECEIVED = "VOICE_MESSAGE_RECEIVED",
1277
+ VOICE_MESSAGE_SENT = "VOICE_MESSAGE_SENT",
1278
+ REACTION_RECEIVED = "REACTION_RECEIVED",
1279
+ POST_GENERATED = "POST_GENERATED",
1280
+ INTERACTION_RECEIVED = "INTERACTION_RECEIVED",
1281
+ RUN_STARTED = "RUN_STARTED",
1282
+ RUN_ENDED = "RUN_ENDED",
1283
+ RUN_TIMEOUT = "RUN_TIMEOUT",
1284
+ ACTION_STARTED = "ACTION_STARTED",
1285
+ ACTION_COMPLETED = "ACTION_COMPLETED",
1286
+ EVALUATOR_STARTED = "EVALUATOR_STARTED",
1287
+ EVALUATOR_COMPLETED = "EVALUATOR_COMPLETED",
1288
+ MODEL_USED = "MODEL_USED"
1289
+ }
1290
+ /**
1291
+ * Platform-specific event type prefix
1292
+ */
1293
+ declare enum PlatformPrefix {
1294
+ DISCORD = "DISCORD",
1295
+ TELEGRAM = "TELEGRAM",
1296
+ TWITTER = "TWITTER"
1297
+ }
1298
+ /**
1299
+ * Base payload interface for all events
1300
+ */
1301
+ interface EventPayload {
1302
+ runtime: IAgentRuntime;
1303
+ source: string;
1304
+ onComplete?: () => void;
1305
+ }
1306
+ /**
1307
+ * Payload for world-related events
1308
+ */
1309
+ interface WorldPayload extends EventPayload {
1310
+ world: World;
1311
+ rooms: Room[];
1312
+ entities: Entity[];
1313
+ }
1314
+ /**
1315
+ * Payload for entity-related events
1316
+ */
1317
+ interface EntityPayload extends EventPayload {
1318
+ entityId: UUID;
1319
+ worldId?: UUID;
1320
+ roomId?: UUID;
1321
+ metadata?: {
1322
+ orginalId: string;
1323
+ username: string;
1324
+ displayName?: string;
1325
+ [key: string]: any;
1326
+ };
1327
+ }
1328
+ /**
1329
+ * Payload for reaction-related events
1330
+ */
1331
+ interface MessagePayload extends EventPayload {
1332
+ message: Memory;
1333
+ callback?: HandlerCallback;
1334
+ onComplete?: () => void;
1335
+ }
1336
+ /**
1337
+ * Payload for channel cleared events
1338
+ */
1339
+ interface ChannelClearedPayload extends EventPayload {
1340
+ roomId: UUID;
1341
+ channelId: string;
1342
+ memoryCount: number;
1343
+ }
1344
+ /**
1345
+ * Payload for events that are invoked without a message
1346
+ */
1347
+ interface InvokePayload extends EventPayload {
1348
+ worldId: UUID;
1349
+ userId: string;
1350
+ roomId: UUID;
1351
+ callback?: HandlerCallback;
1352
+ source: string;
1353
+ }
1354
+ /**
1355
+ * Run event payload type
1356
+ */
1357
+ interface RunEventPayload extends EventPayload {
1358
+ runId: UUID;
1359
+ messageId: UUID;
1360
+ roomId: UUID;
1361
+ entityId: UUID;
1362
+ startTime: number;
1363
+ status: 'started' | 'completed' | 'timeout';
1364
+ endTime?: number;
1365
+ duration?: number;
1366
+ error?: string;
1367
+ }
1368
+ /**
1369
+ * Action event payload type
1370
+ */
1371
+ interface ActionEventPayload extends EventPayload {
1372
+ actionId: UUID;
1373
+ actionName: string;
1374
+ startTime?: number;
1375
+ completed?: boolean;
1376
+ error?: Error;
1377
+ }
1378
+ /**
1379
+ * Evaluator event payload type
1380
+ */
1381
+ interface EvaluatorEventPayload extends EventPayload {
1382
+ evaluatorId: UUID;
1383
+ evaluatorName: string;
1384
+ startTime?: number;
1385
+ completed?: boolean;
1386
+ error?: Error;
1387
+ }
1388
+ /**
1389
+ * Model event payload type
1390
+ */
1391
+ interface ModelEventPayload extends EventPayload {
1392
+ provider: string;
1393
+ type: ModelTypeName;
1394
+ prompt: string;
1395
+ tokens?: {
1396
+ prompt: number;
1397
+ completion: number;
1398
+ total: number;
1399
+ };
1400
+ }
1401
+ type MessageReceivedHandlerParams = {
1402
+ runtime: IAgentRuntime;
1403
+ message: Memory;
1404
+ callback: HandlerCallback;
1405
+ onComplete?: () => void;
1406
+ };
1407
+ /**
1408
+ * Maps event types to their corresponding payload types
1409
+ */
1410
+ interface EventPayloadMap {
1411
+ [EventType.WORLD_JOINED]: WorldPayload;
1412
+ [EventType.WORLD_CONNECTED]: WorldPayload;
1413
+ [EventType.WORLD_LEFT]: WorldPayload;
1414
+ [EventType.ENTITY_JOINED]: EntityPayload;
1415
+ [EventType.ENTITY_LEFT]: EntityPayload;
1416
+ [EventType.ENTITY_UPDATED]: EntityPayload;
1417
+ [EventType.MESSAGE_RECEIVED]: MessagePayload;
1418
+ [EventType.MESSAGE_SENT]: MessagePayload;
1419
+ [EventType.MESSAGE_DELETED]: MessagePayload;
1420
+ [EventType.CHANNEL_CLEARED]: ChannelClearedPayload;
1421
+ [EventType.REACTION_RECEIVED]: MessagePayload;
1422
+ [EventType.POST_GENERATED]: InvokePayload;
1423
+ [EventType.INTERACTION_RECEIVED]: MessagePayload;
1424
+ [EventType.RUN_STARTED]: RunEventPayload;
1425
+ [EventType.RUN_ENDED]: RunEventPayload;
1426
+ [EventType.RUN_TIMEOUT]: RunEventPayload;
1427
+ [EventType.ACTION_STARTED]: ActionEventPayload;
1428
+ [EventType.ACTION_COMPLETED]: ActionEventPayload;
1429
+ [EventType.EVALUATOR_STARTED]: EvaluatorEventPayload;
1430
+ [EventType.EVALUATOR_COMPLETED]: EvaluatorEventPayload;
1431
+ [EventType.MODEL_USED]: ModelEventPayload;
1432
+ }
1433
+ /**
1434
+ * Event handler function type
1435
+ */
1436
+ type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
1437
+ /**
1438
+ * Defines a more specific type for event handlers, expecting an `Metadata`.
1439
+ * This aims to improve upon generic 'any' type handlers, providing a clearer contract
1440
+ * for functions that respond to events emitted within the agent runtime (see `emitEvent` in `AgentRuntime`).
1441
+ * Handlers can be synchronous or asynchronous.
1442
+ */
1443
+ type TypedEventHandler = (data: Metadata) => Promise<void> | void;
1444
+
1445
+ /**
1446
+ * Core service type registry that can be extended by plugins via module augmentation.
1447
+ * Plugins can extend this interface to add their own service types:
1448
+ *
1449
+ * @example
1450
+ * ```typescript
1451
+ * declare module '@elizaos/core' {
1452
+ * interface ServiceTypeRegistry {
1453
+ * MY_CUSTOM_SERVICE: 'my_custom_service';
1454
+ * }
1455
+ * }
1456
+ * ```
1457
+ */
1458
+ interface ServiceTypeRegistry {
1459
+ TRANSCRIPTION: 'transcription';
1460
+ VIDEO: 'video';
1461
+ BROWSER: 'browser';
1462
+ PDF: 'pdf';
1463
+ REMOTE_FILES: 'aws_s3';
1464
+ WEB_SEARCH: 'web_search';
1465
+ EMAIL: 'email';
1466
+ TEE: 'tee';
1467
+ TASK: 'task';
1468
+ WALLET: 'wallet';
1469
+ LP_POOL: 'lp_pool';
1470
+ TOKEN_DATA: 'token_data';
1471
+ MESSAGE: 'message';
1472
+ POST: 'post';
1473
+ UNKNOWN: 'unknown';
1474
+ }
1475
+ /**
1476
+ * Type for service names that includes both core services and any plugin-registered services
1477
+ */
1478
+ type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
1479
+ /**
1480
+ * Helper type to extract service type values from the registry
1481
+ */
1482
+ type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
1483
+ /**
1484
+ * Helper type to check if a service type exists in the registry
1485
+ */
1486
+ type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
1487
+ /**
1488
+ * Type-safe service class definition
1489
+ */
1490
+ type TypedServiceClass<T extends ServiceTypeName> = {
1491
+ new (runtime?: IAgentRuntime): Service;
1492
+ serviceType: T;
1493
+ start(runtime: IAgentRuntime): Promise<Service>;
1494
+ };
1495
+ /**
1496
+ * Map of service type names to their implementation classes
1497
+ */
1498
+ interface ServiceClassMap {
1499
+ }
1500
+ /**
1501
+ * Helper to infer service instance type from service type name
1502
+ */
1503
+ type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
1504
+ /**
1505
+ * Runtime service registry type
1506
+ */
1507
+ type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
1508
+ /**
1509
+ * Enumerates the recognized types of services that can be registered and used by the agent runtime.
1510
+ * Services provide specialized functionalities like audio transcription, video processing,
1511
+ * web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,
1512
+ * secure execution via TEE (Trusted Execution Environment), and task management.
1513
+ * This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).
1514
+ * Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.
1515
+ */
1516
+ declare const ServiceType: {
1517
+ readonly TRANSCRIPTION: "transcription";
1518
+ readonly VIDEO: "video";
1519
+ readonly BROWSER: "browser";
1520
+ readonly PDF: "pdf";
1521
+ readonly REMOTE_FILES: "aws_s3";
1522
+ readonly WEB_SEARCH: "web_search";
1523
+ readonly EMAIL: "email";
1524
+ readonly TEE: "tee";
1525
+ readonly TASK: "task";
1526
+ readonly WALLET: "wallet";
1527
+ readonly LP_POOL: "lp_pool";
1528
+ readonly TOKEN_DATA: "token_data";
1529
+ readonly MESSAGE: "message";
1530
+ readonly POST: "post";
1531
+ readonly UNKNOWN: "unknown";
1532
+ };
1533
+ /**
1534
+ * Client instance
1535
+ */
1536
+ declare abstract class Service {
1537
+ /** Runtime instance */
1538
+ protected runtime: IAgentRuntime;
1539
+ constructor(runtime?: IAgentRuntime);
1540
+ abstract stop(): Promise<void>;
1541
+ /** Service type */
1542
+ static serviceType: string;
1543
+ /** Service name */
1544
+ abstract capabilityDescription: string;
1545
+ /** Service configuration */
1546
+ config?: Metadata;
1547
+ /** Start service connection */
1548
+ static start(_runtime: IAgentRuntime): Promise<Service>;
1549
+ /** Stop service connection */
1550
+ static stop(_runtime: IAgentRuntime): Promise<unknown>;
1551
+ }
1552
+ /**
1553
+ * Generic service interface that provides better type checking for services
1554
+ * @template ConfigType The configuration type for this service
1555
+ * @template ResultType The result type returned by the service operations
1556
+ */
1557
+ interface TypedService<ConfigType extends Metadata = Metadata, ResultType = unknown> extends Service {
1558
+ /**
1559
+ * The configuration for this service instance
1560
+ */
1561
+ config?: ConfigType;
1562
+ /**
1563
+ * Process an input with this service
1564
+ * @param input The input to process
1565
+ * @returns A promise resolving to the result
1566
+ */
1567
+ process(input: unknown): Promise<ResultType>;
1568
+ }
1569
+ /**
1570
+ * Generic factory function to create a typed service instance
1571
+ * @param runtime The agent runtime
1572
+ * @param serviceType The type of service to get
1573
+ * @returns The service instance or null if not available
1574
+ */
1575
+ declare function getTypedService<T extends TypedService<any, any>>(runtime: IAgentRuntime, serviceType: ServiceTypeName): T | null;
1576
+ /**
1577
+ * Standardized service error type for consistent error handling
1578
+ */
1579
+ interface ServiceError {
1580
+ code: string;
1581
+ message: string;
1582
+ details?: unknown;
1583
+ cause?: Error;
1584
+ }
1585
+ /**
1586
+ * Safely create a ServiceError from any caught error
1587
+ */
1588
+ declare function createServiceError(error: unknown, code?: string): ServiceError;
1589
+
1590
+ /**
1591
+ * Represents a test case for evaluating agent or plugin functionality.
1592
+ * Each test case has a name and a function that contains the test logic.
1593
+ * The test function receives the `IAgentRuntime` instance, allowing it to interact with the agent's capabilities.
1594
+ * Test cases are typically grouped into `TestSuite`s.
1595
+ */
1596
+ interface TestCase {
1597
+ /** A descriptive name for the test case, e.g., "should respond to greetings". */
1598
+ name: string;
1599
+ /**
1600
+ * The function that executes the test logic. It can be synchronous or asynchronous.
1601
+ * It receives the `IAgentRuntime` to interact with the agent and its services.
1602
+ * The function should typically contain assertions to verify expected outcomes.
1603
+ */
1604
+ fn: (runtime: IAgentRuntime) => Promise<void> | void;
1605
+ }
1606
+ /**
1607
+ * Represents a suite of related test cases for an agent or plugin.
1608
+ * This helps in organizing tests and running them collectively.
1609
+ * A `ProjectAgent` can define one or more `TestSuite`s.
1610
+ */
1611
+ interface TestSuite {
1612
+ /** A descriptive name for the test suite, e.g., "Core Functionality Tests". */
1613
+ name: string;
1614
+ /** An array of `TestCase` objects that belong to this suite. */
1615
+ tests: TestCase[];
1616
+ }
1617
+
1618
+ type Route = {
1619
+ type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
1620
+ path: string;
1621
+ filePath?: string;
1622
+ public?: boolean;
1623
+ name?: string extends {
1624
+ public: true;
1625
+ } ? string : string | undefined;
1626
+ handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
1627
+ isMultipart?: boolean;
1628
+ };
1629
+ /**
1630
+ * Plugin for extending agent functionality
1631
+ */
1632
+ type PluginEvents = {
1633
+ [K in keyof EventPayloadMap]?: EventHandler<K>[];
1634
+ } & {
1635
+ [key: string]: ((params: any) => Promise<any>)[];
1636
+ };
1637
+ interface Plugin {
1638
+ name: string;
1639
+ description: string;
1640
+ init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
1641
+ config?: {
1642
+ [key: string]: any;
1643
+ };
1644
+ services?: (typeof Service)[];
1645
+ componentTypes?: {
1646
+ name: string;
1647
+ schema: Record<string, unknown>;
1648
+ validator?: (data: any) => boolean;
1649
+ }[];
1650
+ actions?: Action[];
1651
+ providers?: Provider[];
1652
+ evaluators?: Evaluator[];
1653
+ adapter?: IDatabaseAdapter;
1654
+ models?: {
1655
+ [key: string]: (...args: any[]) => Promise<any>;
1656
+ };
1657
+ events?: PluginEvents;
1658
+ routes?: Route[];
1659
+ tests?: TestSuite[];
1660
+ dependencies?: string[];
1661
+ testDependencies?: string[];
1662
+ priority?: number;
1663
+ schema?: any;
1664
+ }
1665
+ interface ProjectAgent {
1666
+ character: Character;
1667
+ init?: (runtime: IAgentRuntime) => Promise<void>;
1668
+ plugins?: Plugin[];
1669
+ tests?: TestSuite | TestSuite[];
1670
+ }
1671
+ interface Project {
1672
+ agents: ProjectAgent[];
1673
+ }
1674
+
1675
+ /**
1676
+ * Represents the core runtime environment for an agent.
1677
+ * Defines methods for database interaction, plugin management, event handling,
1678
+ * state composition, model usage, and task management.
1679
+ */
1680
+ interface IAgentRuntime extends IDatabaseAdapter {
1681
+ agentId: UUID;
1682
+ character: Character;
1683
+ providers: Provider[];
1684
+ actions: Action[];
1685
+ evaluators: Evaluator[];
1686
+ plugins: Plugin[];
1687
+ services: Map<ServiceTypeName, Service[]>;
1688
+ events: Map<string, ((params: any) => Promise<void>)[]>;
1689
+ fetch?: typeof fetch | null;
1690
+ routes: Route[];
1691
+ logger: any;
1692
+ registerPlugin(plugin: Plugin): Promise<void>;
1693
+ initialize(): Promise<void>;
1694
+ getConnection(): Promise<any>;
1695
+ getService<T extends Service>(service: ServiceTypeName | string): T | null;
1696
+ getServicesByType<T extends Service>(service: ServiceTypeName | string): T[];
1697
+ getAllServices(): Map<ServiceTypeName, Service[]>;
1698
+ registerService(service: typeof Service): Promise<void>;
1699
+ getRegisteredServiceTypes(): ServiceTypeName[];
1700
+ hasService(serviceType: ServiceTypeName | string): boolean;
1701
+ registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
1702
+ setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
1703
+ getSetting(key: string): string | boolean | null | any;
1704
+ getConversationLength(): number;
1705
+ processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
1706
+ evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
1707
+ registerProvider(provider: Provider): void;
1708
+ registerAction(action: Action): void;
1709
+ registerEvaluator(evaluator: Evaluator): void;
1710
+ ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
1711
+ ensureConnection({ entityId, roomId, metadata, userName, worldName, name, source, channelId, serverId, type, worldId, userId, }: {
1712
+ entityId: UUID;
1713
+ roomId: UUID;
1714
+ userName?: string;
1715
+ name?: string;
1716
+ worldName?: string;
1717
+ source?: string;
1718
+ channelId?: string;
1719
+ serverId?: string;
1720
+ type: any;
1721
+ worldId: UUID;
1722
+ userId?: UUID;
1723
+ metadata?: Record<string, any>;
1724
+ }): Promise<void>;
1725
+ ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
1726
+ ensureWorldExists(world: World): Promise<void>;
1727
+ ensureRoomExists(room: Room): Promise<void>;
1728
+ composeState(message: Memory, includeList?: string[], onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
1729
+ useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any): Promise<R>;
1730
+ registerModel(modelType: ModelTypeName | string, handler: (params: any) => Promise<any>, provider: string, priority?: number): void;
1731
+ getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
1732
+ registerEvent(event: string, handler: (params: any) => Promise<void>): void;
1733
+ getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
1734
+ emitEvent(event: string | string[], params: any): Promise<void>;
1735
+ registerTaskWorker(taskHandler: TaskWorker): void;
1736
+ getTaskWorker(name: string): TaskWorker | undefined;
1737
+ stop(): Promise<void>;
1738
+ addEmbeddingToMemory(memory: Memory): Promise<Memory>;
1739
+ getAllMemories(): Promise<Memory[]>;
1740
+ clearAllAgentMemories(): Promise<void>;
1741
+ createRunId(): UUID;
1742
+ startRun(): UUID;
1743
+ endRun(): void;
1744
+ getCurrentRunId(): UUID;
1745
+ getEntityById(entityId: UUID): Promise<Entity | null>;
1746
+ getRoom(roomId: UUID): Promise<Room | null>;
1747
+ createEntity(entity: Entity): Promise<boolean>;
1748
+ createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
1749
+ addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
1750
+ getRooms(worldId: UUID): Promise<Room[]>;
1751
+ registerSendHandler(source: string, handler: SendHandlerFunction): void;
1752
+ sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
1753
+ }
1754
+
1755
+ /**
1756
+ * Example content with associated user for demonstration purposes
1757
+ */
1758
+ interface ActionExample {
1759
+ /** User associated with the example */
1760
+ name: string;
1761
+ /** Content of the example */
1762
+ content: Content;
1763
+ }
1764
+ /**
1765
+ * Callback function type for handlers
1766
+ */
1767
+ type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
1768
+ /**
1769
+ * Handler function type for processing messages
1770
+ */
1771
+ type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
1772
+ [key: string]: unknown;
1773
+ }, callback?: HandlerCallback, responses?: Memory[]) => Promise<ActionResult | void | undefined>;
1774
+ /**
1775
+ * Validator function type for actions/evaluators
1776
+ */
1777
+ type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
1778
+ /**
1779
+ * Represents an action the agent can perform
1780
+ */
1781
+ interface Action {
1782
+ /** Similar action descriptions */
1783
+ similes?: string[];
1784
+ /** Detailed description */
1785
+ description: string;
1786
+ /** Example usages */
1787
+ examples?: ActionExample[][];
1788
+ /** Handler function */
1789
+ handler: Handler;
1790
+ /** Action name */
1791
+ name: string;
1792
+ /** Validation function */
1793
+ validate: Validator;
1794
+ }
1795
+ /**
1796
+ * Example for evaluating agent behavior
1797
+ */
1798
+ interface EvaluationExample {
1799
+ /** Evaluation context */
1800
+ prompt: string;
1801
+ /** Example messages */
1802
+ messages: Array<ActionExample>;
1803
+ /** Expected outcome */
1804
+ outcome: string;
1805
+ }
1806
+ /**
1807
+ * Evaluator for assessing agent responses
1808
+ */
1809
+ interface Evaluator {
1810
+ /** Whether to always run */
1811
+ alwaysRun?: boolean;
1812
+ /** Detailed description */
1813
+ description: string;
1814
+ /** Similar evaluator descriptions */
1815
+ similes?: string[];
1816
+ /** Example evaluations */
1817
+ examples: EvaluationExample[];
1818
+ /** Handler function */
1819
+ handler: Handler;
1820
+ /** Evaluator name */
1821
+ name: string;
1822
+ /** Validation function */
1823
+ validate: Validator;
1824
+ }
1825
+ interface ProviderResult {
1826
+ values?: {
1827
+ [key: string]: any;
1828
+ };
1829
+ data?: {
1830
+ [key: string]: any;
1831
+ };
1832
+ text?: string;
1833
+ }
1834
+ /**
1835
+ * Provider for external data/services
1836
+ */
1837
+ interface Provider {
1838
+ /** Provider name */
1839
+ name: string;
1840
+ /** Description of the provider */
1841
+ description?: string;
1842
+ /** Whether the provider is dynamic */
1843
+ dynamic?: boolean;
1844
+ /** Position of the provider in the provider list, positive or negative */
1845
+ position?: number;
1846
+ /**
1847
+ * Whether the provider is private
1848
+ *
1849
+ * Private providers are not displayed in the regular provider list, they have to be called explicitly
1850
+ */
1851
+ private?: boolean;
1852
+ /** Data retrieval function */
1853
+ get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
1854
+ }
1855
+ /**
1856
+ * Result returned by an action after execution
1857
+ * Used for action chaining and state management
1858
+ */
1859
+ interface ActionResult {
1860
+ /** Optional text description of the result */
1861
+ text?: string;
1862
+ /** Values to merge into the state */
1863
+ values?: Record<string, any>;
1864
+ /** Data payload containing action-specific results */
1865
+ data?: Record<string, any>;
1866
+ /** Whether the action succeeded - defaults to true */
1867
+ success: boolean;
1868
+ /** Error information if the action failed */
1869
+ error?: string | Error;
1870
+ }
1871
+ /**
1872
+ * Context provided to actions during execution
1873
+ * Allows actions to access previous results and update state
1874
+ */
1875
+ interface ActionContext {
1876
+ /** Results from previously executed actions in this run */
1877
+ previousResults: ActionResult[];
1878
+ /** Get a specific previous result by action name */
1879
+ getPreviousResult?: (actionName: string) => ActionResult | undefined;
1880
+ }
1881
+ /**
1882
+ * Helper function to create ActionResult with proper defaults
1883
+ */
1884
+ declare function createActionResult(partial?: Partial<ActionResult>): ActionResult;
19
1885
 
20
1886
  /**
21
1887
  * Represents an agent's registration details within a Trusted Execution Environment (TEE) context.
@@ -185,6 +2051,36 @@ declare abstract class ITokenDataService extends Service {
185
2051
  abstract getTokensByAddresses(addresses: string[], chain: string): Promise<TokenData[]>;
186
2052
  }
187
2053
 
2054
+ /**
2055
+ * Interface representing settings with string key-value pairs.
2056
+ */
2057
+ interface RuntimeSettings {
2058
+ [key: string]: string | undefined;
2059
+ }
2060
+ interface Setting {
2061
+ name: string;
2062
+ description: string;
2063
+ usageDescription: string;
2064
+ value: string | boolean | null;
2065
+ required: boolean;
2066
+ public?: boolean;
2067
+ secret?: boolean;
2068
+ validation?: (value: any) => boolean;
2069
+ dependsOn?: string[];
2070
+ onSetAction?: (value: any) => string;
2071
+ visibleIf?: (settings: {
2072
+ [key: string]: Setting;
2073
+ }) => boolean;
2074
+ }
2075
+ interface WorldSettings {
2076
+ [key: string]: Setting;
2077
+ }
2078
+ interface OnboardingConfig {
2079
+ settings: {
2080
+ [key: string]: Omit<Setting, 'value'>;
2081
+ };
2082
+ }
2083
+
188
2084
  /**
189
2085
  * Represents a single asset holding within a wallet, including its value.
190
2086
  * This extends a generic TokenBalance with wallet-specific valuation.
@@ -2825,6 +4721,51 @@ declare function encryptObjectValues(obj: Record<string, any>, salt: string): Re
2825
4721
  */
2826
4722
  declare function decryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any>;
2827
4723
 
2828
- declare const defaultSpec: typeof v2;
4724
+ /**
4725
+ * Service builder class that provides type-safe service creation
4726
+ * with automatic type inference
4727
+ */
4728
+ declare class ServiceBuilder<TService extends Service = Service> {
4729
+ protected serviceType: ServiceTypeName | string;
4730
+ protected startFn: (runtime: IAgentRuntime) => Promise<TService>;
4731
+ protected stopFn?: () => Promise<void>;
4732
+ protected description: string;
4733
+ constructor(serviceType: ServiceTypeName | string);
4734
+ /**
4735
+ * Set the service description
4736
+ */
4737
+ withDescription(description: string): this;
4738
+ /**
4739
+ * Set the start function for the service
4740
+ */
4741
+ withStart(startFn: (runtime: IAgentRuntime) => Promise<TService>): this;
4742
+ /**
4743
+ * Set the stop function for the service
4744
+ */
4745
+ withStop(stopFn: () => Promise<void>): this;
4746
+ /**
4747
+ * Build the service class with all configured properties
4748
+ */
4749
+ build(): new (runtime?: IAgentRuntime) => TService;
4750
+ }
4751
+ /**
4752
+ * Create a type-safe service builder
4753
+ * @param serviceType - The service type name
4754
+ * @returns A new ServiceBuilder instance
4755
+ */
4756
+ declare function createService<TService extends Service = Service>(serviceType: ServiceTypeName | string): ServiceBuilder<TService>;
4757
+ /**
4758
+ * Type-safe service definition helper
4759
+ */
4760
+ interface ServiceDefinition<T extends Service = Service> {
4761
+ serviceType: ServiceTypeName;
4762
+ description: string;
4763
+ start: (runtime: IAgentRuntime) => Promise<T>;
4764
+ stop?: () => Promise<void>;
4765
+ }
4766
+ /**
4767
+ * Define a service with type safety
4768
+ */
4769
+ declare function defineService<T extends Service = Service>(definition: ServiceDefinition<T>): new (runtime?: IAgentRuntime) => T;
2829
4770
 
2830
- export { Action, Agent, AgentRuntime, type BrowserNavigationOptions, ChannelType, Character, type CharacterValidationResult, type ClickOptions, Component, Content, ContentType, DatabaseAdapter, type DeriveKeyAttestationData, type ElementSelector, type EmailAccount, type EmailAddress, type EmailAttachment, type EmailFolder, type EmailMessage, type EmailSearchOptions, type EmailSendOptions, Entity, Evaluator, type ExtractedContent, HandlerCallback, IAgentRuntime, IBrowserService, IDatabaseAdapter, IEmailService, ILpService, IMessageService, IPdfService, IPostService, ITokenDataService, ITranscriptionService, IVideoService, IWalletService, IWebSearchService, type ImageSearchOptions, Log, type LpPositionDetails, Memory, MemoryMetadata, type MessageAttachment, type MessageChannel, type MessageContent, type MessageInfo, type MessageParticipant, type MessageReaction, type MessageReference, type MessageSearchOptions, type MessageSendOptions, Metadata, ModelHandler, ModelParamsMap, ModelResultMap, ModelTypeName, type NewsSearchOptions, OnboardingConfig, Participant, type PdfConversionOptions, type PdfExtractionResult, type PdfGenerationOptions, Plugin, type PoolInfo, type PostAnalytics, type PostAuthor, type PostContent, type PostCreateOptions, type PostEngagement, type PostInfo, type PostLocation, type PostMedia, type PostSearchOptions, Provider, Relationship, type RemoteAttestationMessage, type RemoteAttestationQuote, Role, Room, Route, RuntimeSettings, type ScreenshotOptions, type SearchOptions, type SearchResponse, type SearchResult, Semaphore, SendHandlerFunction, type ServerOwnershipState, Service, ServiceTypeName, Setting, type SpeechToTextOptions, State, TEEMode, TargetInfo, Task, TaskWorker, type TeeAgent, type TeePluginConfig, TeeType, TemplateType, type TextToSpeechOptions, type TokenBalance, type TokenData, type TransactionResult, type TranscriptionOptions, type TranscriptionResult, type TranscriptionSegment, type TranscriptionWord, type TypeOptions, UUID, type VideoDownloadOptions, type VideoFormat, type VideoInfo, type VideoProcessingOptions, type VideoSearchOptions, type WalletAsset, type WalletPortfolio, World, WorldSettings, addHeader, booleanFooter, characterSchema, composeActionExamples, composePrompt, composePromptFromState, createLogger, createSettingFromConfig, createUniqueUuid, decryptObjectValues, decryptStringValue as decryptSecret, decryptStringValue, decryptedCharacter, defaultSpec, elizaLogger, encryptObjectValues, encryptStringValue, encryptedCharacter, findEntityByName, findWorldsForOwner, formatActionNames, formatActions, formatEntities, formatMessages, formatPosts, formatTimestamp, getContentTypeFromMimeType, getEntityDetails, getLocalServerUrl, getSalt, getUserServerRole, getWorldSettings, imageDescriptionTemplate, initializeOnboarding, isValidCharacter, logger, messageHandlerTemplate, normalizeJsonString, parseAndValidateCharacter, parseBooleanFromText, parseJSONObjectFromText, parseKeyValueXml, postCreationTemplate, safeReplacer, saltSettingValue, saltWorldSettings, shouldRespondTemplate, splitChunks, stringToUuid, trimTokens, truncateToCompleteSentence, unsaltSettingValue, unsaltWorldSettings, updateWorldSettings, v2, validateCharacter, validateUuid };
4771
+ export { type Action, type ActionContext, type ActionEventPayload, type ActionExample, type ActionResult, type Agent, AgentRuntime, AgentStatus, type AudioProcessingParams, type BaseMetadata, type BaseModelParams, type BrowserNavigationOptions, CacheKeyPrefix, type ChannelClearedPayload, ChannelType, type Character, type CharacterValidationResult, type ChunkRow, type ClickOptions, type Component, type Content, ContentType, type ControlMessage, type CustomMetadata, DatabaseAdapter, type DbConnection, type DeriveKeyAttestationData, type DescriptionMetadata, type DetokenizeTextParams, type DirectoryItem, type DocumentMetadata, type ElementSelector, type EmailAccount, type EmailAddress, type EmailAttachment, type EmailFolder, type EmailMessage, type EmailSearchOptions, type EmailSendOptions, type EmbeddingSearchResult, type EnhancedState, type Entity, type EntityPayload, type EvaluationExample, type Evaluator, type EvaluatorEventPayload, type EventHandler, type EventPayload, type EventPayloadMap, EventType, type ExtractedContent, type FragmentMetadata, type GenerateTextParams, type Handler, type HandlerCallback, type IAgentRuntime, IBrowserService, type IDatabaseAdapter, IEmailService, ILpService, IMessageService, IPdfService, IPostService, ITokenDataService, ITranscriptionService, IVideoService, IWalletService, IWebSearchService, type ImageDescriptionParams, type ImageGenerationParams, type ImageSearchOptions, type InvokePayload, type IsValidServiceType, type JSONSchema, type KnowledgeItem, KnowledgeScope, type Log, type LpPositionDetails, MODEL_SETTINGS, type Media, type Memory, type MemoryMetadata, type MemoryRetrievalOptions, type MemoryScope, type MemorySearchOptions, MemoryType, type MemoryTypeAlias, type MessageAttachment, type MessageChannel, type MessageContent, type MessageExample, type MessageInfo, type MessageMemory, type MessageMetadata, type MessageParticipant, type MessagePayload, type MessageReaction, type MessageReceivedHandlerParams, type MessageReference, type MessageSearchOptions, type MessageSendOptions, type Metadata, type ModelEventPayload, type ModelHandler, type ModelParamsMap, type ModelResultMap, ModelType, type ModelTypeName, type MultiRoomMemoryOptions, type NewsSearchOptions, type ObjectGenerationParams, type OnboardingConfig, type Participant, type PdfConversionOptions, type PdfExtractionResult, type PdfGenerationOptions, PlatformPrefix, type Plugin, type PluginEvents, type PoolInfo, type PostAnalytics, type PostAuthor, type PostContent, type PostCreateOptions, type PostEngagement, type PostInfo, type PostLocation, type PostMedia, type PostSearchOptions, type Project, type ProjectAgent, type Provider, type ProviderResult, type Relationship, type RemoteAttestationMessage, type RemoteAttestationQuote, Role, type Room, type RoomMetadata, type Route, type RunEventPayload, type RuntimeSettings, SOCKET_MESSAGE_TYPE, type ScreenshotOptions, type SearchOptions, type SearchResponse, type SearchResult, Semaphore, type SendHandlerFunction, type ServerOwnershipState, Service, ServiceBuilder, type ServiceClassMap, type ServiceDefinition, type ServiceError, type ServiceInstance, type ServiceRegistry, ServiceType, type ServiceTypeName, type ServiceTypeRegistry, type ServiceTypeValue, type Setting, type SpeechToTextOptions, type State, type StateArray, type StateObject, type StateValue, TEEMode, type TargetInfo, type Task, type TaskMetadata, type TaskWorker, type TeeAgent, type TeePluginConfig, TeeType, type TemplateType, type TestCase, type TestSuite, type TextEmbeddingParams, type TextGenerationParams, type TextToSpeechOptions, type TextToSpeechParams, type TokenBalance, type TokenData, type TokenizeTextParams, type TransactionResult, type TranscriptionOptions, type TranscriptionParams, type TranscriptionResult, type TranscriptionSegment, type TranscriptionWord, type TypeOptions, type TypedEventHandler, type TypedService, type TypedServiceClass, type UUID, type UnifiedMemoryOptions, type UnifiedSearchOptions, VECTOR_DIMS, type Validator, type VideoDownloadOptions, type VideoFormat, type VideoInfo, type VideoProcessingOptions, type VideoProcessingParams, type VideoSearchOptions, type WalletAsset, type WalletPortfolio, type World, type WorldPayload, type WorldSettings, addHeader, asUUID, booleanFooter, characterSchema, composeActionExamples, composePrompt, composePromptFromState, createActionResult, createLogger, createMessageMemory, createService, createServiceError, createSettingFromConfig, createUniqueUuid, decryptObjectValues, decryptStringValue as decryptSecret, decryptStringValue, decryptedCharacter, defineService, elizaLogger, encryptObjectValues, encryptStringValue, encryptedCharacter, findEntityByName, findWorldsForOwner, formatActionNames, formatActions, formatEntities, formatMessages, formatPosts, formatTimestamp, getContentTypeFromMimeType, getEntityDetails, getLocalServerUrl, getMemoryText, getModelSpecificSettingKey, getSalt, getTypedService, getUserServerRole, getWorldSettings, imageDescriptionTemplate, initializeOnboarding, isCustomMetadata, isDescriptionMetadata, isDocumentMemory, isDocumentMetadata, isFragmentMemory, isFragmentMetadata, isMessageMetadata, isValidCharacter, logger, messageHandlerTemplate, normalizeJsonString, parseAndValidateCharacter, parseBooleanFromText, parseJSONObjectFromText, parseKeyValueXml, postCreationTemplate, safeReplacer, saltSettingValue, saltWorldSettings, shouldRespondTemplate, splitChunks, stringToUuid, trimTokens, truncateToCompleteSentence, unsaltSettingValue, unsaltWorldSettings, updateWorldSettings, validateCharacter, validateUuid };