@elizaos/core 1.0.6 → 1.0.7

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.
@@ -1,4 +1,4 @@
1
- import { a as Action$1, I as IDatabaseAdapter$1, U as UUID$1, E as Entity$1, b as Component$1, M as Memory$1, L as Log$1, c as MemoryMetadata$1, W as World$1, R as Room$1, d as Participant$1, e as Relationship$1, f as Agent$1, T as Task$1, g as IAgentRuntime$1, h as Role$1, i as ServiceTypeName$1, j as Service$1, k as Route$1, l as Character$1, P as Provider$1, m as Evaluator$1, n as Plugin$1, o as RuntimeSettings$1, S as State$1, H as HandlerCallback$1, p as ModelTypeName$1, q as ModelResultMap$1, r as ModelParamsMap$1, s as TaskWorker$1, t as TargetInfo$1, C as Content$1, u as TemplateType$1, v as ActionEventPayload$1, A as ActionExample$1, w as AgentStatus$1, x as AudioProcessingParams$1, B as BaseMetadata$1, y as BaseModelParams$1, z as CacheKeyPrefix$1, D as ChannelType$1, F as ChunkRow$1, G as ComponentData$1, J as ContentType$1, K as ControlMessage$1, N as CustomMetadata$1, O as DbConnection$1, Q as DeriveKeyAttestationData$1, V as DescriptionMetadata$1, X as DetokenizeTextParams$1, Y as DirectoryItem$1, Z as DocumentMetadata$1, _ as EmbeddingSearchResult$1, $ as EnhancedState$1, a0 as EntityPayload$1, a1 as EvaluationExample$1, a2 as EvaluatorEventPayload$1, a3 as EventDataObject$1, a4 as EventHandler$1, a5 as EventPayload$1, a6 as EventPayloadMap$1, a7 as EventType$1, a8 as FragmentMetadata$1, a9 as GenerateTextParams$1, aa as Handler$1, ab as ImageDescriptionParams$1, ac as ImageGenerationParams$1, ad as InvokePayload$1, ae as IsValidServiceType$1, af as JSONSchema$1, ag as KnowledgeItem$1, ah as KnowledgeScope$1, ai as Media$1, aj as MemoryRetrievalOptions$1, ak as MemoryScope$1, al as MemorySearchOptions$1, am as MemoryType$1, an as MemoryTypeAlias$1, ao as MessageExample$1, ap as MessageMemory$1, aq as MessageMetadata$1, ar as MessagePayload$1, as as MessageReceivedHandlerParams$1, at as MetadataObject$1, au as ModelEventPayload$1, av as ModelHandler$1, aw as ModelType$1, ax as MultiRoomMemoryOptions$1, ay as ObjectGenerationParams$1, az as OnboardingConfig$1, aA as PlatformPrefix$1, aB as PluginEvents$1, aC as Project$1, aD as ProjectAgent$1, aE as ProviderResult$1, aF as RemoteAttestationMessage$1, aG as RemoteAttestationQuote$1, aH as RoomMetadata$1, aI as RunEventPayload$1, aJ as SOCKET_MESSAGE_TYPE$1, aK as SendHandlerFunction$1, aL as ServiceClassMap$1, aM as ServiceConfig$1, aN as ServiceError$1, aO as ServiceInstance$1, aP as ServiceRegistry$1, aQ as ServiceType$1, aR as ServiceTypeRegistry$1, aS as ServiceTypeValue$1, aT as Setting$1, aU as StateArray$1, aV as StateObject$1, aW as StateValue$1, aX as TEEMode$1, aY as TaskMetadata$1, aZ as TeeAgent$1, a_ as TeePluginConfig$1, a$ as TeeType$1, b0 as TeeVendorConfig$1, b1 as TestCase$1, b2 as TestSuite$1, b3 as TextEmbeddingParams$1, b4 as TextGenerationParams$1, b5 as TextToSpeechParams$1, b6 as TokenizeTextParams$1, b7 as TranscriptionParams$1, b8 as TypedEventHandler$1, b9 as TypedService$1, ba as TypedServiceClass$1, bb as UnifiedMemoryOptions$1, bc as UnifiedSearchOptions$1, bd as VECTOR_DIMS$1, be as Validator$1, bf as VideoProcessingParams$1, bg as WorldPayload$1, bh as WorldSettings$1, bi as asUUID$1, bj as createMessageMemory$1, bk as createServiceError$1, bl as getMemoryText$1, bm as getTypedService$1, bn as isCustomMetadata$1, bo as isDescriptionMetadata$1, bp as isDocumentMemory$1, bq as isDocumentMetadata$1, br as isFragmentMemory$1, bs as isFragmentMetadata$1, bt as isMessageMetadata$1 } from './types-D9v-eW3g.js';
1
+ import { a as Action$1, I as IDatabaseAdapter$1, U as UUID$1, E as Entity$1, b as Component$1, M as Memory$1, L as Log$1, c as MemoryMetadata$1, W as World$1, R as Room$1, d as Participant$1, e as Relationship$1, f as Agent$1, T as Task$1, g as IAgentRuntime$1, h as Role$1, i as ServiceTypeName$1, j as Service$1, k as Route$1, l as Character$1, P as Provider$1, m as Evaluator$1, n as Plugin$1, o as RuntimeSettings$1, S as State$1, H as HandlerCallback$1, p as ModelTypeName$1, q as ModelResultMap$1, r as ModelParamsMap$1, s as TaskWorker$1, t as TargetInfo$1, C as Content$1, u as TemplateType$1, v as ActionEventPayload$1, A as ActionExample$1, w as AgentStatus$1, x as AudioProcessingParams$1, B as BaseMetadata$1, y as BaseModelParams$1, z as CacheKeyPrefix$1, D as ChannelType$1, F as ChunkRow$1, G as ComponentData$1, J as ContentType$1, K as ControlMessage$1, N as CustomMetadata$1, O as DbConnection$1, Q as DeriveKeyAttestationData, V as DescriptionMetadata$1, X as DetokenizeTextParams$1, Y as DirectoryItem$1, Z as DocumentMetadata$1, _ as EmbeddingSearchResult$1, $ as EnhancedState$1, a0 as EntityPayload$1, a1 as EvaluationExample$1, a2 as EvaluatorEventPayload$1, a3 as EventDataObject$1, a4 as EventHandler$1, a5 as EventPayload$1, a6 as EventPayloadMap$1, a7 as EventType$1, a8 as FragmentMetadata$1, a9 as GenerateTextParams$1, aa as Handler$1, ab as ImageDescriptionParams$1, ac as ImageGenerationParams$1, ad as InvokePayload$1, ae as IsValidServiceType$1, af as JSONSchema$1, ag as KnowledgeItem$1, ah as KnowledgeScope$1, ai as Media$1, aj as MemoryRetrievalOptions$1, ak as MemoryScope$1, al as MemorySearchOptions$1, am as MemoryType$1, an as MemoryTypeAlias$1, ao as MessageExample$1, ap as MessageMemory$1, aq as MessageMetadata$1, ar as MessagePayload$1, as as MessageReceivedHandlerParams$1, at as MetadataObject$1, au as ModelEventPayload$1, av as ModelHandler$1, aw as ModelType$1, ax as MultiRoomMemoryOptions$1, ay as ObjectGenerationParams$1, az as OnboardingConfig$1, aA as PlatformPrefix$1, aB as PluginEvents$1, aC as Project$1, aD as ProjectAgent$1, aE as ProviderResult$1, aF as RemoteAttestationMessage, aG as RemoteAttestationQuote, aH as RoomMetadata$1, aI as RunEventPayload$1, aJ as SOCKET_MESSAGE_TYPE$1, aK as SendHandlerFunction$1, aL as ServiceClassMap$1, aM as ServiceConfig$1, aN as ServiceError$1, aO as ServiceInstance$1, aP as ServiceRegistry$1, aQ as ServiceType$1, aR as ServiceTypeRegistry$1, aS as ServiceTypeValue$1, aT as Setting$1, aU as StateArray$1, aV as StateObject$1, aW as StateValue$1, aX as TEEMode, aY as TaskMetadata$1, aZ as TeeAgent, a_ as TeePluginConfig, a$ as TeeType, b0 as TeeVendorConfig, b1 as TestCase$1, b2 as TestSuite$1, b3 as TextEmbeddingParams$1, b4 as TextGenerationParams$1, b5 as TextToSpeechParams$1, b6 as TokenizeTextParams$1, b7 as TranscriptionParams$1, b8 as TypedEventHandler$1, b9 as TypedService$1, ba as TypedServiceClass$1, bb as UnifiedMemoryOptions$1, bc as UnifiedSearchOptions$1, bd as VECTOR_DIMS$1, be as Validator$1, bf as VideoProcessingParams$1, bg as WorldPayload$1, bh as WorldSettings$1, bi as asUUID$1, bj as createMessageMemory$1, bk as createServiceError$1, bl as getMemoryText$1, bm as getTypedService$1, bn as isCustomMetadata$1, bo as isDescriptionMetadata$1, bp as isDocumentMemory$1, bq as isDocumentMetadata$1, br as isFragmentMemory$1, bs as isFragmentMetadata$1, bt as isMessageMetadata$1 } from './types-sJIakXg4.js';
2
2
 
3
3
  /**
4
4
  * Defines a custom type UUID representing a universally unique identifier
@@ -39,124 +39,32 @@ interface Content {
39
39
  [key: string]: unknown;
40
40
  }
41
41
  /**
42
- * Example content with associated user for demonstration purposes
43
- */
44
- interface ActionExample {
45
- /** User associated with the example */
46
- name: string;
47
- /** Content of the example */
48
- content: Content;
49
- }
50
- type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
51
- /**
52
- * Defines the recognized types of models that the agent runtime can use.
53
- * These include models for text generation (small, large, reasoning, completion),
54
- * text embedding, tokenization (encode/decode), image generation and description,
55
- * audio transcription, text-to-speech, and generic object generation.
56
- * This constant is used throughout the system, particularly in `AgentRuntime.useModel`,
57
- * `AgentRuntime.registerModel`, and in `ModelParamsMap` / `ModelResultMap` to ensure
58
- * type safety and clarity when working with different AI models.
59
- * String values are used for extensibility with custom model types.
60
- */
61
- declare const ModelType: {
62
- readonly SMALL: "TEXT_SMALL";
63
- readonly MEDIUM: "TEXT_LARGE";
64
- readonly LARGE: "TEXT_LARGE";
65
- readonly TEXT_SMALL: "TEXT_SMALL";
66
- readonly TEXT_LARGE: "TEXT_LARGE";
67
- readonly TEXT_EMBEDDING: "TEXT_EMBEDDING";
68
- readonly TEXT_TOKENIZER_ENCODE: "TEXT_TOKENIZER_ENCODE";
69
- readonly TEXT_TOKENIZER_DECODE: "TEXT_TOKENIZER_DECODE";
70
- readonly TEXT_REASONING_SMALL: "REASONING_SMALL";
71
- readonly TEXT_REASONING_LARGE: "REASONING_LARGE";
72
- readonly TEXT_COMPLETION: "TEXT_COMPLETION";
73
- readonly IMAGE: "IMAGE";
74
- readonly IMAGE_DESCRIPTION: "IMAGE_DESCRIPTION";
75
- readonly TRANSCRIPTION: "TRANSCRIPTION";
76
- readonly TEXT_TO_SPEECH: "TEXT_TO_SPEECH";
77
- readonly AUDIO: "AUDIO";
78
- readonly VIDEO: "VIDEO";
79
- readonly OBJECT_SMALL: "OBJECT_SMALL";
80
- readonly OBJECT_LARGE: "OBJECT_LARGE";
81
- };
82
- /**
83
- * Core service type registry that can be extended by plugins via module augmentation.
84
- * Plugins can extend this interface to add their own service types:
85
- *
86
- * @example
87
- * ```typescript
88
- * declare module '@elizaos/core' {
89
- * interface ServiceTypeRegistry {
90
- * MY_CUSTOM_SERVICE: 'my_custom_service';
91
- * }
92
- * }
93
- * ```
94
- */
95
- interface ServiceTypeRegistry {
96
- TRANSCRIPTION: 'transcription';
97
- VIDEO: 'video';
98
- BROWSER: 'browser';
99
- PDF: 'pdf';
100
- REMOTE_FILES: 'aws_s3';
101
- WEB_SEARCH: 'web_search';
102
- EMAIL: 'email';
103
- TEE: 'tee';
104
- TASK: 'task';
105
- INSTRUMENTATION: 'instrumentation';
106
- }
107
- /**
108
- * Type for service names that includes both core services and any plugin-registered services
109
- */
110
- type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
111
- /**
112
- * Helper type to extract service type values from the registry
113
- */
114
- type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
115
- /**
116
- * Helper type to check if a service type exists in the registry
117
- */
118
- type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
119
- /**
120
- * Type-safe service class definition
42
+ * Represents a media attachment
121
43
  */
122
- type TypedServiceClass<T extends ServiceTypeName> = {
123
- new (runtime?: IAgentRuntime): Service;
124
- serviceType: T;
125
- start(runtime: IAgentRuntime): Promise<Service>;
44
+ type Media = {
45
+ /** Unique identifier */
46
+ id: string;
47
+ /** Media URL */
48
+ url: string;
49
+ /** Media title */
50
+ title?: string;
51
+ /** Media source */
52
+ source?: string;
53
+ /** Media description */
54
+ description?: string;
55
+ /** Text content */
56
+ text?: string;
57
+ /** Content type */
58
+ contentType?: ContentType;
126
59
  };
127
- /**
128
- * Map of service type names to their implementation classes
129
- */
130
- interface ServiceClassMap {
60
+ declare enum ContentType {
61
+ IMAGE = "image",
62
+ VIDEO = "video",
63
+ AUDIO = "audio",
64
+ DOCUMENT = "document",
65
+ LINK = "link"
131
66
  }
132
- /**
133
- * Helper to infer service instance type from service type name
134
- */
135
- type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
136
- /**
137
- * Runtime service registry type
138
- */
139
- type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
140
- /**
141
- * Enumerates the recognized types of services that can be registered and used by the agent runtime.
142
- * Services provide specialized functionalities like audio transcription, video processing,
143
- * web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,
144
- * secure execution via TEE (Trusted Execution Environment), task management, and instrumentation.
145
- * This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).
146
- * Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.
147
- */
148
- declare const ServiceType: {
149
- readonly TRANSCRIPTION: "transcription";
150
- readonly VIDEO: "video";
151
- readonly BROWSER: "browser";
152
- readonly PDF: "pdf";
153
- readonly REMOTE_FILES: "aws_s3";
154
- readonly WEB_SEARCH: "web_search";
155
- readonly EMAIL: "email";
156
- readonly TEE: "tee";
157
- readonly TASK: "task";
158
- readonly INSTRUMENTATION: "instrumentation";
159
- };
67
+
160
68
  /**
161
69
  * Represents the current state or context of a conversation or agent interaction.
162
70
  * This interface is a flexible container for various pieces of information that define the agent's
@@ -178,6 +86,44 @@ interface State {
178
86
  };
179
87
  text: string;
180
88
  }
89
+ /**
90
+ * Defines the possible primitive types or structured types for a value within the agent's state.
91
+ * This type is used to provide more specific typing for properties within `StateObject` and `StateArray`,
92
+ * moving away from a generic 'any' type for better type safety and clarity in state management.
93
+ */
94
+ type StateValue = string | number | boolean | null | StateObject | StateArray;
95
+ /**
96
+ * Represents a generic object structure within the agent's state, where keys are strings
97
+ * and values can be any `StateValue`. This allows for nested objects within the state.
98
+ * It's a fundamental part of the `EnhancedState` interface.
99
+ */
100
+ interface StateObject {
101
+ [key: string]: StateValue;
102
+ }
103
+ /**
104
+ * Represents an array of `StateValue` types within the agent's state.
105
+ * This allows for lists of mixed or uniform types to be stored in the state,
106
+ * contributing to the structured definition of `EnhancedState`.
107
+ */
108
+ type StateArray = StateValue[];
109
+ /**
110
+ * Enhanced State interface with more specific types for its core properties.
111
+ * This interface provides a more structured representation of an agent's conversational state,
112
+ * building upon the base `State` by typing `values` and `data` as `StateObject`.
113
+ * The `text` property typically holds a textual summary or context derived from the state.
114
+ * Additional dynamic properties are still allowed via the index signature `[key: string]: StateValue;`.
115
+ */
116
+ interface EnhancedState {
117
+ /** Holds directly accessible state values, often used for template rendering or quick lookups. */
118
+ values: StateObject;
119
+ /** Stores more complex or structured data, potentially namespaced by providers or internal systems. */
120
+ data: StateObject;
121
+ /** A textual representation or summary of the current state, often used as context for models. */
122
+ text: string;
123
+ /** Allows for additional dynamic properties to be added to the state object. */
124
+ [key: string]: StateValue;
125
+ }
126
+
181
127
  /**
182
128
  * Memory type enumeration for built-in memory types
183
129
  */
@@ -271,145 +217,135 @@ interface Memory {
271
217
  metadata?: MemoryMetadata;
272
218
  }
273
219
  /**
274
- * Represents a log entry
220
+ * Specialized memory type for messages with enhanced type checking
275
221
  */
276
- interface Log {
277
- /** Optional unique identifier */
278
- id?: UUID;
279
- /** Associated entity ID */
280
- entityId: UUID;
281
- /** Associated room ID */
282
- roomId?: UUID;
283
- /** Log body */
284
- body: {
285
- [key: string]: unknown;
222
+ interface MessageMemory extends Memory {
223
+ metadata: MessageMetadata;
224
+ content: Content & {
225
+ text: string;
286
226
  };
287
- /** Log type */
288
- type: string;
289
- /** Log creation timestamp */
290
- createdAt: Date;
291
227
  }
292
228
  /**
293
- * Example message for demonstration
229
+ * Factory function to create a new message memory with proper defaults
294
230
  */
295
- interface MessageExample {
296
- /** Associated user */
297
- name: string;
298
- /** Message content */
299
- content: Content;
300
- }
231
+ declare function createMessageMemory(params: {
232
+ id?: UUID;
233
+ entityId: UUID;
234
+ agentId?: UUID;
235
+ roomId: UUID;
236
+ content: Content & {
237
+ text: string;
238
+ };
239
+ embedding?: number[];
240
+ }): MessageMemory;
301
241
  /**
302
- * Handler function type for processing messages
242
+ * Type guard to check if a memory metadata is a DocumentMetadata
243
+ * @param metadata The metadata to check
244
+ * @returns True if the metadata is a DocumentMetadata
303
245
  */
304
- type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
305
- [key: string]: unknown;
306
- }, callback?: HandlerCallback, responses?: Memory[]) => Promise<unknown>;
246
+ declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
307
247
  /**
308
- * Callback function type for handlers
248
+ * Type guard to check if a memory metadata is a FragmentMetadata
249
+ * @param metadata The metadata to check
250
+ * @returns True if the metadata is a FragmentMetadata
309
251
  */
310
- type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
252
+ declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
311
253
  /**
312
- * Validator function type for actions/evaluators
254
+ * Type guard to check if a memory metadata is a MessageMetadata
255
+ * @param metadata The metadata to check
256
+ * @returns True if the metadata is a MessageMetadata
313
257
  */
314
- type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
258
+ declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
315
259
  /**
316
- * Represents an action the agent can perform
260
+ * Type guard to check if a memory metadata is a DescriptionMetadata
261
+ * @param metadata The metadata to check
262
+ * @returns True if the metadata is a DescriptionMetadata
317
263
  */
318
- interface Action {
319
- /** Similar action descriptions */
320
- similes?: string[];
321
- /** Detailed description */
322
- description: string;
323
- /** Example usages */
324
- examples?: ActionExample[][];
325
- /** Handler function */
326
- handler: Handler;
327
- /** Action name */
328
- name: string;
329
- /** Validation function */
330
- validate: Validator;
331
- }
264
+ declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
332
265
  /**
333
- * Example for evaluating agent behavior
334
- */
335
- interface EvaluationExample {
336
- /** Evaluation context */
337
- prompt: string;
338
- /** Example messages */
339
- messages: Array<ActionExample>;
340
- /** Expected outcome */
341
- outcome: string;
342
- }
266
+ * Type guard to check if a memory metadata is a CustomMetadata
267
+ * @param metadata The metadata to check
268
+ * @returns True if the metadata is a CustomMetadata
269
+ */
270
+ declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
343
271
  /**
344
- * Evaluator for assessing agent responses
272
+ * Memory type guard for document memories
345
273
  */
346
- interface Evaluator {
347
- /** Whether to always run */
348
- alwaysRun?: boolean;
349
- /** Detailed description */
350
- description: string;
351
- /** Similar evaluator descriptions */
352
- similes?: string[];
353
- /** Example evaluations */
354
- examples: EvaluationExample[];
355
- /** Handler function */
356
- handler: Handler;
357
- /** Evaluator name */
358
- name: string;
359
- /** Validation function */
360
- validate: Validator;
274
+ declare function isDocumentMemory(memory: Memory): memory is Memory & {
275
+ metadata: DocumentMetadata;
276
+ };
277
+ /**
278
+ * Memory type guard for fragment memories
279
+ */
280
+ declare function isFragmentMemory(memory: Memory): memory is Memory & {
281
+ metadata: FragmentMetadata;
282
+ };
283
+ /**
284
+ * Safely access the text content of a memory
285
+ * @param memory The memory to extract text from
286
+ * @param defaultValue Optional default value if no text is found
287
+ * @returns The text content or default value
288
+ */
289
+ declare function getMemoryText(memory: Memory, defaultValue?: string): string;
290
+
291
+ /**
292
+ * Represents a single item of knowledge that can be processed and stored by the agent.
293
+ * Knowledge items consist of content (text and optional structured data) and metadata.
294
+ * These items are typically added to the agent's knowledge base via `AgentRuntime.addKnowledge`
295
+ * and retrieved using `AgentRuntime.getKnowledge`.
296
+ * The `id` is a unique identifier for the knowledge item, often derived from its source or content.
297
+ */
298
+ type KnowledgeItem = {
299
+ /** A Universally Unique Identifier for this specific knowledge item. */
300
+ id: UUID;
301
+ /** The actual content of the knowledge item, which must include text and can have other fields. */
302
+ content: Content;
303
+ /** Optional metadata associated with this knowledge item, conforming to `MemoryMetadata`. */
304
+ metadata?: MemoryMetadata;
305
+ };
306
+ /**
307
+ * Defines the scope or visibility of knowledge items within the agent's system.
308
+ * - `SHARED`: Indicates knowledge that is broadly accessible, potentially across different agents or users if the system architecture permits.
309
+ * - `PRIVATE`: Indicates knowledge that is restricted, typically to the specific agent or user context it belongs to.
310
+ * This enum is used to manage access and retrieval of knowledge items, often in conjunction with `AgentRuntime.addKnowledge` or `AgentRuntime.getKnowledge` scopes.
311
+ */
312
+ declare enum KnowledgeScope {
313
+ SHARED = "shared",
314
+ PRIVATE = "private"
361
315
  }
362
- interface ProviderResult {
363
- values?: {
364
- [key: string]: any;
365
- };
366
- data?: {
367
- [key: string]: any;
368
- };
369
- text?: string;
316
+ /**
317
+ * Specifies prefixes for keys used in caching mechanisms, helping to namespace cached data.
318
+ * For example, `KNOWLEDGE` might be used to prefix keys for cached knowledge embeddings or processed documents.
319
+ * This helps in organizing the cache and avoiding key collisions.
320
+ * Used internally by caching strategies, potentially within `IDatabaseAdapter` cache methods or runtime caching layers.
321
+ */
322
+ declare enum CacheKeyPrefix {
323
+ KNOWLEDGE = "knowledge"
370
324
  }
371
325
  /**
372
- * Provider for external data/services
326
+ * Represents an item within a directory listing, specifically for knowledge loading.
327
+ * When an agent's `Character.knowledge` configuration includes a directory, this type
328
+ * is used to specify the path to that directory and whether its contents should be treated as shared.
329
+ * - `directory`: The path to the directory containing knowledge files.
330
+ * - `shared`: An optional boolean (defaults to false) indicating if the knowledge from this directory is considered shared or private.
373
331
  */
374
- interface Provider {
375
- /** Provider name */
376
- name: string;
377
- /** Description of the provider */
378
- description?: string;
379
- /** Whether the provider is dynamic */
380
- dynamic?: boolean;
381
- /** Position of the provider in the provider list, positive or negative */
382
- position?: number;
383
- /**
384
- * Whether the provider is private
385
- *
386
- * Private providers are not displayed in the regular provider list, they have to be called explicitly
387
- */
388
- private?: boolean;
389
- /** Data retrieval function */
390
- get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
332
+ interface DirectoryItem {
333
+ /** The path to the directory containing knowledge files. */
334
+ directory: string;
335
+ /** If true, knowledge from this directory is considered shared; otherwise, it's private. Defaults to false. */
336
+ shared?: boolean;
391
337
  }
392
338
  /**
393
- * Represents a relationship between users
339
+ * Represents a row structure, typically from a database query related to text chunking or processing.
340
+ * This interface is quite minimal and seems to be a placeholder or a base for more specific chunk-related types.
341
+ * The `id` would be the unique identifier for the chunk.
342
+ * It might be used when splitting large documents into smaller, manageable pieces for embedding or analysis.
394
343
  */
395
- interface Relationship {
396
- /** Unique identifier */
397
- id: UUID;
398
- /** First user ID */
399
- sourceEntityId: UUID;
400
- /** Second user ID */
401
- targetEntityId: UUID;
402
- /** Agent ID */
403
- agentId: UUID;
404
- /** Tags for filtering/categorizing relationships */
405
- tags: string[];
406
- /** Additional metadata about the relationship */
407
- metadata: {
408
- [key: string]: any;
409
- };
410
- /** Optional creation timestamp */
411
- createdAt?: string;
344
+ interface ChunkRow {
345
+ /** The unique identifier for this chunk of text. */
346
+ id: string;
412
347
  }
348
+
413
349
  interface Component {
414
350
  id: UUID;
415
351
  entityId: UUID;
@@ -440,6 +376,18 @@ interface Entity {
440
376
  /** Optional array of components */
441
377
  components?: Component[];
442
378
  }
379
+ /**
380
+ * Defines roles within a system, typically for access control or permissions, often within a `World`.
381
+ * - `OWNER`: Represents the highest level of control, typically the creator or primary administrator.
382
+ * - `ADMIN`: Represents administrative privileges, usually a subset of owner capabilities.
383
+ * - `NONE`: Indicates no specific role or default, minimal permissions.
384
+ * These roles are often used in `World.metadata.roles` to assign roles to entities.
385
+ */
386
+ declare enum Role {
387
+ OWNER = "OWNER",
388
+ ADMIN = "ADMIN",
389
+ NONE = "NONE"
390
+ }
443
391
  type World = {
444
392
  id: UUID;
445
393
  name?: string;
@@ -456,6 +404,18 @@ type World = {
456
404
  };
457
405
  };
458
406
  type RoomMetadata = Record<string, unknown>;
407
+ declare enum ChannelType {
408
+ SELF = "SELF",// Messages to self
409
+ DM = "DM",// Direct messages between two participants
410
+ GROUP = "GROUP",// Group messages with multiple participants
411
+ VOICE_DM = "VOICE_DM",// Voice direct messages
412
+ VOICE_GROUP = "VOICE_GROUP",// Voice channels with multiple participants
413
+ FEED = "FEED",// Social media feed
414
+ THREAD = "THREAD",// Threaded conversation
415
+ WORLD = "WORLD",// World channel
416
+ FORUM = "FORUM",// Forum discussion
417
+ API = "API"
418
+ }
459
419
  type Room = {
460
420
  id: UUID;
461
421
  name?: string;
@@ -477,117 +437,42 @@ interface Participant {
477
437
  entity: Entity;
478
438
  }
479
439
  /**
480
- * Represents a media attachment
440
+ * Represents a relationship between users
481
441
  */
482
- type Media = {
442
+ interface Relationship {
483
443
  /** Unique identifier */
484
- id: string;
485
- /** Media URL */
486
- url: string;
487
- /** Media title */
488
- title?: string;
489
- /** Media source */
490
- source?: string;
491
- /** Media description */
492
- description?: string;
493
- /** Text content */
494
- text?: string;
495
- /** Content type */
496
- contentType?: ContentType;
497
- };
498
- declare enum ContentType {
499
- IMAGE = "image",
500
- VIDEO = "video",
501
- AUDIO = "audio",
502
- DOCUMENT = "document",
503
- LINK = "link"
504
- }
505
- declare enum ChannelType {
506
- SELF = "SELF",// Messages to self
507
- DM = "DM",// Direct messages between two participants
508
- GROUP = "GROUP",// Group messages with multiple participants
509
- VOICE_DM = "VOICE_DM",// Voice direct messages
510
- VOICE_GROUP = "VOICE_GROUP",// Voice channels with multiple participants
511
- FEED = "FEED",// Social media feed
512
- THREAD = "THREAD",// Threaded conversation
513
- WORLD = "WORLD",// World channel
514
- FORUM = "FORUM",// Forum discussion
515
- API = "API"
516
- }
517
- /**
518
- * Client instance
519
- */
520
- declare abstract class Service {
521
- /** Runtime instance */
522
- protected runtime: IAgentRuntime;
523
- constructor(runtime?: IAgentRuntime);
524
- abstract stop(): Promise<void>;
525
- /** Service type */
526
- static serviceType: string;
527
- /** Service name */
528
- abstract capabilityDescription: string;
529
- /** Service configuration */
530
- config?: {
444
+ id: UUID;
445
+ /** First user ID */
446
+ sourceEntityId: UUID;
447
+ /** Second user ID */
448
+ targetEntityId: UUID;
449
+ /** Agent ID */
450
+ agentId: UUID;
451
+ /** Tags for filtering/categorizing relationships */
452
+ tags: string[];
453
+ /** Additional metadata about the relationship */
454
+ metadata: {
531
455
  [key: string]: any;
532
456
  };
533
- /** Start service connection */
534
- static start(_runtime: IAgentRuntime): Promise<Service>;
535
- /** Stop service connection */
536
- static stop(_runtime: IAgentRuntime): Promise<unknown>;
457
+ /** Optional creation timestamp */
458
+ createdAt?: string;
537
459
  }
538
- type Route = {
539
- type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
540
- path: string;
541
- filePath?: string;
542
- public?: boolean;
543
- name?: string extends {
544
- public: true;
545
- } ? string : string | undefined;
546
- handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
547
- isMultipart?: boolean;
548
- };
549
460
  /**
550
- * Plugin for extending agent functionality
461
+ * A generic type for the `data` field within a `Component`.
462
+ * While `Record<string, unknown>` allows for flexibility, developers are encouraged
463
+ * to define more specific types for component data where possible to improve type safety
464
+ * and code maintainability. This type serves as a base for various component implementations.
551
465
  */
552
- type PluginEvents = {
553
- [K in keyof EventPayloadMap]?: EventHandler<K>[];
554
- } & {
555
- [key: string]: ((params: EventPayload) => Promise<any>)[];
556
- };
557
- interface Plugin {
558
- name: string;
559
- description: string;
560
- init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
561
- config?: {
562
- [key: string]: any;
563
- };
564
- services?: (typeof Service)[];
565
- componentTypes?: {
566
- name: string;
567
- schema: Record<string, unknown>;
568
- validator?: (data: any) => boolean;
569
- }[];
570
- actions?: Action[];
571
- providers?: Provider[];
572
- evaluators?: Evaluator[];
573
- adapter?: IDatabaseAdapter;
574
- models?: {
575
- [key: string]: (...args: any[]) => Promise<any>;
576
- };
577
- events?: PluginEvents;
578
- routes?: Route[];
579
- tests?: TestSuite[];
580
- dependencies?: string[];
581
- priority?: number;
582
- }
583
- interface ProjectAgent {
584
- character: Character;
585
- init?: (runtime: IAgentRuntime) => Promise<void>;
586
- plugins?: Plugin[];
587
- tests?: TestSuite | TestSuite[];
588
- }
589
- interface Project {
590
- agents: ProjectAgent[];
466
+ type ComponentData = Record<string, unknown>;
467
+
468
+ /**
469
+ * Example message for demonstration
470
+ */
471
+ interface MessageExample {
472
+ /** Associated user */
473
+ name: string;
474
+ /** Message content */
475
+ content: Content;
591
476
  }
592
477
  type TemplateType = string | ((options: {
593
478
  state: State | {
@@ -637,10 +522,7 @@ interface Character {
637
522
  knowledge?: (string | {
638
523
  path: string;
639
524
  shared?: boolean;
640
- } | {
641
- directory: string;
642
- shared?: boolean;
643
- })[];
525
+ } | DirectoryItem)[];
644
526
  /** Available plugins */
645
527
  plugins?: string[];
646
528
  /** Optional configuration */
@@ -677,6 +559,90 @@ interface Agent extends Character {
677
559
  createdAt: number;
678
560
  updatedAt: number;
679
561
  }
562
+
563
+ /**
564
+ * Defines the contract for a Task Worker, which is responsible for executing a specific type of task.
565
+ * Task workers are registered with the `AgentRuntime` and are invoked when a `Task` of their designated `name` needs processing.
566
+ * This pattern allows for modular and extensible background task processing.
567
+ */
568
+ interface TaskWorker {
569
+ /** The unique name of the task type this worker handles. This name links `Task` instances to this worker. */
570
+ name: string;
571
+ /**
572
+ * The core execution logic for the task. This function is called by the runtime when a task needs to be processed.
573
+ * It receives the `AgentRuntime`, task-specific `options`, and the `Task` object itself.
574
+ */
575
+ execute: (runtime: IAgentRuntime, options: {
576
+ [key: string]: unknown;
577
+ }, task: Task) => Promise<void>;
578
+ /**
579
+ * Optional validation function that can be used to determine if a task is valid or should be executed,
580
+ * often based on the current message and state. This might be used by an action or evaluator
581
+ * before creating or queueing a task.
582
+ */
583
+ validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
584
+ }
585
+ /**
586
+ * Defines metadata associated with a `Task`.
587
+ * This can include scheduling information like `updateInterval` or UI-related details
588
+ * for presenting task options to a user.
589
+ * The `[key: string]: unknown;` allows for additional, unspecified metadata fields.
590
+ */
591
+ type TaskMetadata = {
592
+ /** Optional. If the task is recurring, this specifies the interval in milliseconds between updates or executions. */
593
+ updateInterval?: number;
594
+ /** Optional. Describes options or parameters that can be configured for this task, often for UI presentation. */
595
+ options?: {
596
+ name: string;
597
+ description: string;
598
+ }[];
599
+ /** Allows for other dynamic metadata properties related to the task. */
600
+ [key: string]: unknown;
601
+ };
602
+ /**
603
+ * Represents a task to be performed, often in the background or at a later time.
604
+ * Tasks are managed by the `AgentRuntime` and processed by registered `TaskWorker`s.
605
+ * They can be associated with a room, world, and tagged for categorization and retrieval.
606
+ * The `IDatabaseAdapter` handles persistence of task data.
607
+ */
608
+ interface Task {
609
+ /** Optional. A Universally Unique Identifier for the task. Generated if not provided. */
610
+ id?: UUID;
611
+ /** The name of the task, which should correspond to a registered `TaskWorker.name`. */
612
+ name: string;
613
+ /** Optional. Timestamp of the last update to this task. */
614
+ updatedAt?: number;
615
+ /** Optional. Metadata associated with the task, conforming to `TaskMetadata`. */
616
+ metadata?: TaskMetadata;
617
+ /** A human-readable description of what the task does or its purpose. */
618
+ description: string;
619
+ /** Optional. The UUID of the room this task is associated with. */
620
+ roomId?: UUID;
621
+ /** Optional. The UUID of the world this task is associated with. */
622
+ worldId?: UUID;
623
+ entityId?: UUID;
624
+ tags: string[];
625
+ }
626
+
627
+ /**
628
+ * Represents a log entry
629
+ */
630
+ interface Log {
631
+ /** Optional unique identifier */
632
+ id?: UUID;
633
+ /** Associated entity ID */
634
+ entityId: UUID;
635
+ /** Associated room ID */
636
+ roomId?: UUID;
637
+ /** Log body */
638
+ body: {
639
+ [key: string]: unknown;
640
+ };
641
+ /** Log type */
642
+ type: string;
643
+ /** Log creation timestamp */
644
+ createdAt: Date;
645
+ }
680
646
  /**
681
647
  * Interface for database operations
682
648
  */
@@ -694,7 +660,6 @@ interface IDatabaseAdapter {
694
660
  createAgent(agent: Partial<Agent>): Promise<boolean>;
695
661
  updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
696
662
  deleteAgent(agentId: UUID): Promise<boolean>;
697
- ensureAgentExists(agent: Partial<Agent>): Promise<Agent>;
698
663
  ensureEmbeddingDimension(dimension: number): Promise<void>;
699
664
  /** Get entity by IDs */
700
665
  getEntityByIds(entityIds: UUID[]): Promise<Entity[] | null>;
@@ -912,444 +877,105 @@ interface UnifiedSearchOptions extends UnifiedMemoryOptions {
912
877
  similarity?: number;
913
878
  }
914
879
  /**
915
- * Information describing the target of a message.
880
+ * Represents a generic database connection object.
881
+ * The actual type of this connection will depend on the specific database adapter implementation
882
+ * (e.g., a connection pool object for PostgreSQL, a client instance for a NoSQL database).
883
+ * This `unknown` type serves as a placeholder in the abstract `IDatabaseAdapter`.
916
884
  */
917
- interface TargetInfo {
918
- source: string;
919
- roomId?: UUID;
920
- channelId?: string;
921
- serverId?: string;
922
- entityId?: UUID;
923
- threadId?: string;
885
+ type DbConnection = unknown;
886
+ /**
887
+ * A generic type for metadata objects, often used in various parts of the system like
888
+ * `Relationship` metadata or other extensible data structures.
889
+ * It allows for arbitrary key-value pairs where values are of `unknown` type,
890
+ * encouraging consumers to perform type checking or casting.
891
+ */
892
+ type MetadataObject = Record<string, unknown>;
893
+ declare const VECTOR_DIMS: {
894
+ readonly SMALL: 384;
895
+ readonly MEDIUM: 512;
896
+ readonly LARGE: 768;
897
+ readonly XL: 1024;
898
+ readonly XXL: 1536;
899
+ readonly XXXL: 3072;
900
+ };
901
+
902
+ type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
903
+ /**
904
+ * Defines the recognized types of models that the agent runtime can use.
905
+ * These include models for text generation (small, large, reasoning, completion),
906
+ * text embedding, tokenization (encode/decode), image generation and description,
907
+ * audio transcription, text-to-speech, and generic object generation.
908
+ * This constant is used throughout the system, particularly in `AgentRuntime.useModel`,
909
+ * `AgentRuntime.registerModel`, and in `ModelParamsMap` / `ModelResultMap` to ensure
910
+ * type safety and clarity when working with different AI models.
911
+ * String values are used for extensibility with custom model types.
912
+ */
913
+ declare const ModelType: {
914
+ readonly SMALL: "TEXT_SMALL";
915
+ readonly MEDIUM: "TEXT_LARGE";
916
+ readonly LARGE: "TEXT_LARGE";
917
+ readonly TEXT_SMALL: "TEXT_SMALL";
918
+ readonly TEXT_LARGE: "TEXT_LARGE";
919
+ readonly TEXT_EMBEDDING: "TEXT_EMBEDDING";
920
+ readonly TEXT_TOKENIZER_ENCODE: "TEXT_TOKENIZER_ENCODE";
921
+ readonly TEXT_TOKENIZER_DECODE: "TEXT_TOKENIZER_DECODE";
922
+ readonly TEXT_REASONING_SMALL: "REASONING_SMALL";
923
+ readonly TEXT_REASONING_LARGE: "REASONING_LARGE";
924
+ readonly TEXT_COMPLETION: "TEXT_COMPLETION";
925
+ readonly IMAGE: "IMAGE";
926
+ readonly IMAGE_DESCRIPTION: "IMAGE_DESCRIPTION";
927
+ readonly TRANSCRIPTION: "TRANSCRIPTION";
928
+ readonly TEXT_TO_SPEECH: "TEXT_TO_SPEECH";
929
+ readonly AUDIO: "AUDIO";
930
+ readonly VIDEO: "VIDEO";
931
+ readonly OBJECT_SMALL: "OBJECT_SMALL";
932
+ readonly OBJECT_LARGE: "OBJECT_LARGE";
933
+ };
934
+ /**
935
+ * Parameters for generating text using a language model.
936
+ * This structure is typically passed to `AgentRuntime.useModel` when the `modelType` is one of
937
+ * `ModelType.TEXT_SMALL`, `ModelType.TEXT_LARGE`, `ModelType.TEXT_REASONING_SMALL`,
938
+ * `ModelType.TEXT_REASONING_LARGE`, or `ModelType.TEXT_COMPLETION`.
939
+ * It includes essential information like the prompt, model type, and various generation controls.
940
+ */
941
+ type GenerateTextParams = {
942
+ /** The `AgentRuntime` instance, providing access to models and other services. */
943
+ runtime: IAgentRuntime;
944
+ /** The input string or prompt that the language model will use to generate text. */
945
+ prompt: string;
946
+ /** Specifies the type of text generation model to use (e.g., TEXT_LARGE, REASONING_SMALL). */
947
+ modelType: ModelTypeName;
948
+ /** Optional. The maximum number of tokens to generate in the response. */
949
+ maxTokens?: number;
950
+ /** Optional. Controls randomness (0.0-1.0). Lower values are more deterministic, higher are more creative. */
951
+ temperature?: number;
952
+ /** Optional. Penalizes new tokens based on their existing frequency in the text so far. */
953
+ frequencyPenalty?: number;
954
+ /** Optional. Penalizes new tokens based on whether they appear in the text so far. */
955
+ presencePenalty?: number;
956
+ /** Optional. A list of sequences at which the model will stop generating further tokens. */
957
+ stopSequences?: string[];
958
+ };
959
+ /**
960
+ * Parameters for detokenizing text, i.e., converting a sequence of numerical tokens back into a string.
961
+ * This is the reverse operation of tokenization.
962
+ * This structure is used with `AgentRuntime.useModel` when the `modelType` is `ModelType.TEXT_TOKENIZER_DECODE`.
963
+ */
964
+ interface DetokenizeTextParams {
965
+ /** An array of numerical tokens to be converted back into text. */
966
+ tokens: number[];
967
+ /** The model type used for detokenization, ensuring consistency with the original tokenization. */
968
+ modelType: ModelTypeName;
924
969
  }
925
970
  /**
926
- * Function signature for handlers responsible for sending messages to specific platforms.
971
+ * Base parameters common to all model types
927
972
  */
928
- type SendHandlerFunction = (runtime: IAgentRuntime, target: TargetInfo, content: Content) => Promise<void>;
973
+ interface BaseModelParams {
974
+ /** The agent runtime for accessing services and utilities */
975
+ runtime: IAgentRuntime;
976
+ }
929
977
  /**
930
- * Represents the core runtime environment for an agent.
931
- * Defines methods for database interaction, plugin management, event handling,
932
- * state composition, model usage, and task management.
933
- */
934
- interface IAgentRuntime extends IDatabaseAdapter {
935
- agentId: UUID;
936
- character: Character;
937
- providers: Provider[];
938
- actions: Action[];
939
- evaluators: Evaluator[];
940
- plugins: Plugin[];
941
- services: Map<ServiceTypeName, Service>;
942
- events: Map<string, ((params: any) => Promise<void>)[]>;
943
- fetch?: typeof fetch | null;
944
- routes: Route[];
945
- registerPlugin(plugin: Plugin): Promise<void>;
946
- initialize(): Promise<void>;
947
- getConnection(): Promise<any>;
948
- getService<T extends Service>(service: ServiceTypeName | string): T | null;
949
- getAllServices(): Map<ServiceTypeName, Service>;
950
- registerService(service: typeof Service): Promise<void>;
951
- registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
952
- setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
953
- getSetting(key: string): string | boolean | null | any;
954
- getConversationLength(): number;
955
- processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
956
- evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
957
- registerProvider(provider: Provider): void;
958
- registerAction(action: Action): void;
959
- registerEvaluator(evaluator: Evaluator): void;
960
- ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
961
- ensureConnection({ entityId, roomId, metadata, userName, worldName, name, source, channelId, serverId, type, worldId, userId, }: {
962
- entityId: UUID;
963
- roomId: UUID;
964
- userName?: string;
965
- name?: string;
966
- worldName?: string;
967
- source?: string;
968
- channelId?: string;
969
- serverId?: string;
970
- type: ChannelType;
971
- worldId: UUID;
972
- userId?: UUID;
973
- metadata?: Record<string, any>;
974
- }): Promise<void>;
975
- ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
976
- ensureWorldExists(world: World): Promise<void>;
977
- ensureRoomExists(room: Room): Promise<void>;
978
- composeState(message: Memory, includeList?: string[], onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
979
- /**
980
- * Use a model with strongly typed parameters and return values based on model type
981
- * @template T - The model type to use
982
- * @template R - The expected return type, defaults to the type defined in ModelResultMap[T]
983
- * @param {T} modelType - The type of model to use
984
- * @param {ModelParamsMap[T] | any} params - The parameters for the model, typed based on model type
985
- * @returns {Promise<R>} - The model result, typed based on the provided generic type parameter
986
- */
987
- useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any): Promise<R>;
988
- registerModel(modelType: ModelTypeName | string, handler: (params: any) => Promise<any>, provider: string, priority?: number): void;
989
- getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
990
- registerEvent(event: string, handler: (params: any) => Promise<void>): void;
991
- getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
992
- emitEvent(event: string | string[], params: any): Promise<void>;
993
- registerTaskWorker(taskHandler: TaskWorker): void;
994
- getTaskWorker(name: string): TaskWorker | undefined;
995
- stop(): Promise<void>;
996
- addEmbeddingToMemory(memory: Memory): Promise<Memory>;
997
- getEntityById(entityId: UUID): Promise<Entity | null>;
998
- getRoom(roomId: UUID): Promise<Room | null>;
999
- createEntity(entity: Entity): Promise<boolean>;
1000
- createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
1001
- addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
1002
- getRooms(worldId: UUID): Promise<Room[]>;
1003
- /**
1004
- * Registers a handler function responsible for sending messages to a specific source/platform.
1005
- * @param source - The unique identifier string for the source (e.g., 'discord', 'telegram').
1006
- * @param handler - The SendHandlerFunction to be called for this source.
1007
- */
1008
- registerSendHandler(source: string, handler: SendHandlerFunction): void;
1009
- /**
1010
- * Sends a message to a specified target using the appropriate registered handler.
1011
- * @param target - Information describing the target recipient and platform.
1012
- * @param content - The message content to send.
1013
- * @returns Promise resolving when the message sending process is initiated or completed.
1014
- */
1015
- sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
1016
- }
1017
- /**
1018
- * Interface representing settings with string key-value pairs.
1019
- */
1020
- interface RuntimeSettings {
1021
- [key: string]: string | undefined;
1022
- }
1023
- /**
1024
- * Represents a single item of knowledge that can be processed and stored by the agent.
1025
- * Knowledge items consist of content (text and optional structured data) and metadata.
1026
- * These items are typically added to the agent's knowledge base via `AgentRuntime.addKnowledge`
1027
- * and retrieved using `AgentRuntime.getKnowledge`.
1028
- * The `id` is a unique identifier for the knowledge item, often derived from its source or content.
1029
- */
1030
- type KnowledgeItem = {
1031
- /** A Universally Unique Identifier for this specific knowledge item. */
1032
- id: UUID;
1033
- /** The actual content of the knowledge item, which must include text and can have other fields. */
1034
- content: Content;
1035
- /** Optional metadata associated with this knowledge item, conforming to `MemoryMetadata`. */
1036
- metadata?: MemoryMetadata;
1037
- };
1038
- /**
1039
- * Defines the scope or visibility of knowledge items within the agent's system.
1040
- * - `SHARED`: Indicates knowledge that is broadly accessible, potentially across different agents or users if the system architecture permits.
1041
- * - `PRIVATE`: Indicates knowledge that is restricted, typically to the specific agent or user context it belongs to.
1042
- * This enum is used to manage access and retrieval of knowledge items, often in conjunction with `AgentRuntime.addKnowledge` or `AgentRuntime.getKnowledge` scopes.
1043
- */
1044
- declare enum KnowledgeScope {
1045
- SHARED = "shared",
1046
- PRIVATE = "private"
1047
- }
1048
- /**
1049
- * Specifies prefixes for keys used in caching mechanisms, helping to namespace cached data.
1050
- * For example, `KNOWLEDGE` might be used to prefix keys for cached knowledge embeddings or processed documents.
1051
- * This helps in organizing the cache and avoiding key collisions.
1052
- * Used internally by caching strategies, potentially within `IDatabaseAdapter` cache methods or runtime caching layers.
1053
- */
1054
- declare enum CacheKeyPrefix {
1055
- KNOWLEDGE = "knowledge"
1056
- }
1057
- /**
1058
- * Represents an item within a directory listing, specifically for knowledge loading.
1059
- * When an agent's `Character.knowledge` configuration includes a directory, this type
1060
- * is used to specify the path to that directory and whether its contents should be treated as shared.
1061
- * - `directory`: The path to the directory containing knowledge files.
1062
- * - `shared`: An optional boolean (defaults to false) indicating if the knowledge from this directory is considered shared or private.
1063
- */
1064
- interface DirectoryItem {
1065
- /** The path to the directory containing knowledge files. */
1066
- directory: string;
1067
- /** If true, knowledge from this directory is considered shared; otherwise, it's private. Defaults to false. */
1068
- shared?: boolean;
1069
- }
1070
- /**
1071
- * Represents a row structure, typically from a database query related to text chunking or processing.
1072
- * This interface is quite minimal and seems to be a placeholder or a base for more specific chunk-related types.
1073
- * The `id` would be the unique identifier for the chunk.
1074
- * It might be used when splitting large documents into smaller, manageable pieces for embedding or analysis.
1075
- */
1076
- interface ChunkRow {
1077
- /** The unique identifier for this chunk of text. */
1078
- id: string;
1079
- }
1080
- /**
1081
- * Parameters for generating text using a language model.
1082
- * This structure is typically passed to `AgentRuntime.useModel` when the `modelType` is one of
1083
- * `ModelType.TEXT_SMALL`, `ModelType.TEXT_LARGE`, `ModelType.TEXT_REASONING_SMALL`,
1084
- * `ModelType.TEXT_REASONING_LARGE`, or `ModelType.TEXT_COMPLETION`.
1085
- * It includes essential information like the prompt, model type, and various generation controls.
1086
- */
1087
- type GenerateTextParams = {
1088
- /** The `AgentRuntime` instance, providing access to models and other services. */
1089
- runtime: IAgentRuntime;
1090
- /** The input string or prompt that the language model will use to generate text. */
1091
- prompt: string;
1092
- /** Specifies the type of text generation model to use (e.g., TEXT_LARGE, REASONING_SMALL). */
1093
- modelType: ModelTypeName;
1094
- /** Optional. The maximum number of tokens to generate in the response. */
1095
- maxTokens?: number;
1096
- /** Optional. Controls randomness (0.0-1.0). Lower values are more deterministic, higher are more creative. */
1097
- temperature?: number;
1098
- /** Optional. Penalizes new tokens based on their existing frequency in the text so far. */
1099
- frequencyPenalty?: number;
1100
- /** Optional. Penalizes new tokens based on whether they appear in the text so far. */
1101
- presencePenalty?: number;
1102
- /** Optional. A list of sequences at which the model will stop generating further tokens. */
1103
- stopSequences?: string[];
1104
- };
1105
- /**
1106
- * Parameters for detokenizing text, i.e., converting a sequence of numerical tokens back into a string.
1107
- * This is the reverse operation of tokenization.
1108
- * This structure is used with `AgentRuntime.useModel` when the `modelType` is `ModelType.TEXT_TOKENIZER_DECODE`.
1109
- */
1110
- interface DetokenizeTextParams {
1111
- /** An array of numerical tokens to be converted back into text. */
1112
- tokens: number[];
1113
- /** The model type used for detokenization, ensuring consistency with the original tokenization. */
1114
- modelType: ModelTypeName;
1115
- }
1116
- /**
1117
- * Represents a test case for evaluating agent or plugin functionality.
1118
- * Each test case has a name and a function that contains the test logic.
1119
- * The test function receives the `IAgentRuntime` instance, allowing it to interact with the agent's capabilities.
1120
- * Test cases are typically grouped into `TestSuite`s.
1121
- */
1122
- interface TestCase {
1123
- /** A descriptive name for the test case, e.g., "should respond to greetings". */
1124
- name: string;
1125
- /**
1126
- * The function that executes the test logic. It can be synchronous or asynchronous.
1127
- * It receives the `IAgentRuntime` to interact with the agent and its services.
1128
- * The function should typically contain assertions to verify expected outcomes.
1129
- */
1130
- fn: (runtime: IAgentRuntime) => Promise<void> | void;
1131
- }
1132
- /**
1133
- * Represents a suite of related test cases for an agent or plugin.
1134
- * This helps in organizing tests and running them collectively.
1135
- * A `ProjectAgent` can define one or more `TestSuite`s.
1136
- */
1137
- interface TestSuite {
1138
- /** A descriptive name for the test suite, e.g., "Core Functionality Tests". */
1139
- name: string;
1140
- /** An array of `TestCase` objects that belong to this suite. */
1141
- tests: TestCase[];
1142
- }
1143
- /**
1144
- * Represents an agent's registration details within a Trusted Execution Environment (TEE) context.
1145
- * This is typically stored in a database table (e.g., `TeeAgent`) to manage agents operating in a TEE.
1146
- * It allows for multiple registrations of the same `agentId` to support scenarios where an agent might restart,
1147
- * generating a new keypair and attestation each time.
1148
- */
1149
- interface TeeAgent {
1150
- /** Primary key for the TEE agent registration record (e.g., a UUID or auto-incrementing ID). */
1151
- id: string;
1152
- /** The core identifier of the agent, which can be duplicated across multiple TEE registrations. */
1153
- agentId: string;
1154
- /** The human-readable name of the agent. */
1155
- agentName: string;
1156
- /** Timestamp (e.g., Unix epoch in milliseconds) when this TEE registration was created. */
1157
- createdAt: number;
1158
- /** The public key associated with this specific TEE agent instance/session. */
1159
- publicKey: string;
1160
- /** The attestation document proving the authenticity and integrity of the TEE instance. */
1161
- attestation: string;
1162
- }
1163
- /**
1164
- * Defines the operational modes for a Trusted Execution Environment (TEE).
1165
- * This enum is used to configure how TEE functionalities are engaged, allowing for
1166
- * different setups for local development, Docker-based development, and production.
1167
- */
1168
- declare enum TEEMode {
1169
- /** TEE functionality is completely disabled. */
1170
- OFF = "OFF",
1171
- /** For local development, potentially using a TEE simulator. */
1172
- LOCAL = "LOCAL",// For local development with simulator
1173
- /** For Docker-based development environments, possibly with a TEE simulator. */
1174
- DOCKER = "DOCKER",// For docker development with simulator
1175
- /** For production deployments, using actual TEE hardware without a simulator. */
1176
- PRODUCTION = "PRODUCTION"
1177
- }
1178
- /**
1179
- * Represents a quote obtained during remote attestation for a Trusted Execution Environment (TEE).
1180
- * This quote is a piece of evidence provided by the TEE, cryptographically signed, which can be
1181
- * verified by a relying party to ensure the TEE's integrity and authenticity.
1182
- */
1183
- interface RemoteAttestationQuote {
1184
- /** The attestation quote data, typically a base64 encoded string or similar format. */
1185
- quote: string;
1186
- /** Timestamp (e.g., Unix epoch in milliseconds) when the quote was generated or received. */
1187
- timestamp: number;
1188
- }
1189
- /**
1190
- * Data structure used in the attestation process for deriving a key within a Trusted Execution Environment (TEE).
1191
- * This information helps establish a secure channel or verify the identity of the agent instance
1192
- * requesting key derivation.
1193
- */
1194
- interface DeriveKeyAttestationData {
1195
- /** The unique identifier of the agent for which the key derivation is being attested. */
1196
- agentId: string;
1197
- /** The public key of the agent instance involved in the key derivation process. */
1198
- publicKey: string;
1199
- /** Optional subject or context information related to the key derivation. */
1200
- subject?: string;
1201
- }
1202
- /**
1203
- * Represents a message that has been attested by a Trusted Execution Environment (TEE).
1204
- * This structure binds a message to an agent's identity and a timestamp, all within the
1205
- * context of a remote attestation process, ensuring the message originated from a trusted TEE instance.
1206
- */
1207
- interface RemoteAttestationMessage {
1208
- /** The unique identifier of the agent sending the attested message. */
1209
- agentId: string;
1210
- /** Timestamp (e.g., Unix epoch in milliseconds) when the message was attested or sent. */
1211
- timestamp: number;
1212
- /** The actual message content, including details about the entity, room, and the content itself. */
1213
- message: {
1214
- entityId: string;
1215
- roomId: string;
1216
- content: string;
1217
- };
1218
- }
1219
- /**
1220
- * Enumerates different types or vendors of Trusted Execution Environments (TEEs).
1221
- * This allows the system to adapt to specific TEE technologies, like Intel TDX on DSTACK.
1222
- */
1223
- declare enum TeeType {
1224
- /** Represents Intel Trusted Domain Extensions (TDX) running on DSTACK infrastructure. */
1225
- TDX_DSTACK = "tdx_dstack"
1226
- }
1227
- /**
1228
- * Configuration options specific to a particular Trusted Execution Environment (TEE) vendor.
1229
- * This allows for vendor-specific settings to be passed to the TEE plugin or service.
1230
- * The structure is a generic key-value map, as configurations can vary widely between vendors.
1231
- */
1232
- interface TeeVendorConfig {
1233
- [key: string]: unknown;
1234
- }
1235
- /**
1236
- * Configuration for a TEE (Trusted Execution Environment) plugin.
1237
- * This allows specifying the TEE vendor and any vendor-specific configurations.
1238
- * It's used to initialize and configure TEE-related functionalities within the agent system.
1239
- */
1240
- interface TeePluginConfig {
1241
- /** Optional. The name or identifier of the TEE vendor (e.g., 'tdx_dstack' from `TeeType`). */
1242
- vendor?: string;
1243
- /** Optional. Vendor-specific configuration options, conforming to `TeeVendorConfig`. */
1244
- vendorConfig?: TeeVendorConfig;
1245
- }
1246
- /**
1247
- * Defines the contract for a Task Worker, which is responsible for executing a specific type of task.
1248
- * Task workers are registered with the `AgentRuntime` and are invoked when a `Task` of their designated `name` needs processing.
1249
- * This pattern allows for modular and extensible background task processing.
1250
- */
1251
- interface TaskWorker {
1252
- /** The unique name of the task type this worker handles. This name links `Task` instances to this worker. */
1253
- name: string;
1254
- /**
1255
- * The core execution logic for the task. This function is called by the runtime when a task needs to be processed.
1256
- * It receives the `AgentRuntime`, task-specific `options`, and the `Task` object itself.
1257
- */
1258
- execute: (runtime: IAgentRuntime, options: {
1259
- [key: string]: unknown;
1260
- }, task: Task) => Promise<void>;
1261
- /**
1262
- * Optional validation function that can be used to determine if a task is valid or should be executed,
1263
- * often based on the current message and state. This might be used by an action or evaluator
1264
- * before creating or queueing a task.
1265
- */
1266
- validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
1267
- }
1268
- /**
1269
- * Defines metadata associated with a `Task`.
1270
- * This can include scheduling information like `updateInterval` or UI-related details
1271
- * for presenting task options to a user.
1272
- * The `[key: string]: unknown;` allows for additional, unspecified metadata fields.
1273
- */
1274
- type TaskMetadata = {
1275
- /** Optional. If the task is recurring, this specifies the interval in milliseconds between updates or executions. */
1276
- updateInterval?: number;
1277
- /** Optional. Describes options or parameters that can be configured for this task, often for UI presentation. */
1278
- options?: {
1279
- name: string;
1280
- description: string;
1281
- }[];
1282
- /** Allows for other dynamic metadata properties related to the task. */
1283
- [key: string]: unknown;
1284
- };
1285
- /**
1286
- * Represents a task to be performed, often in the background or at a later time.
1287
- * Tasks are managed by the `AgentRuntime` and processed by registered `TaskWorker`s.
1288
- * They can be associated with a room, world, and tagged for categorization and retrieval.
1289
- * The `IDatabaseAdapter` handles persistence of task data.
1290
- */
1291
- interface Task {
1292
- /** Optional. A Universally Unique Identifier for the task. Generated if not provided. */
1293
- id?: UUID;
1294
- /** The name of the task, which should correspond to a registered `TaskWorker.name`. */
1295
- name: string;
1296
- /** Optional. Timestamp of the last update to this task. */
1297
- updatedAt?: number;
1298
- /** Optional. Metadata associated with the task, conforming to `TaskMetadata`. */
1299
- metadata?: TaskMetadata;
1300
- /** A human-readable description of what the task does or its purpose. */
1301
- description: string;
1302
- /** Optional. The UUID of the room this task is associated with. */
1303
- roomId?: UUID;
1304
- /** Optional. The UUID of the world this task is associated with. */
1305
- worldId?: UUID;
1306
- entityId?: UUID;
1307
- tags: string[];
1308
- }
1309
- /**
1310
- * Defines roles within a system, typically for access control or permissions, often within a `World`.
1311
- * - `OWNER`: Represents the highest level of control, typically the creator or primary administrator.
1312
- * - `ADMIN`: Represents administrative privileges, usually a subset of owner capabilities.
1313
- * - `NONE`: Indicates no specific role or default, minimal permissions.
1314
- * These roles are often used in `World.metadata.roles` to assign roles to entities.
1315
- */
1316
- declare enum Role {
1317
- OWNER = "OWNER",
1318
- ADMIN = "ADMIN",
1319
- NONE = "NONE"
1320
- }
1321
- interface Setting {
1322
- name: string;
1323
- description: string;
1324
- usageDescription: string;
1325
- value: string | boolean | null;
1326
- required: boolean;
1327
- public?: boolean;
1328
- secret?: boolean;
1329
- validation?: (value: any) => boolean;
1330
- dependsOn?: string[];
1331
- onSetAction?: (value: any) => string;
1332
- visibleIf?: (settings: {
1333
- [key: string]: Setting;
1334
- }) => boolean;
1335
- }
1336
- interface WorldSettings {
1337
- [key: string]: Setting;
1338
- }
1339
- interface OnboardingConfig {
1340
- settings: {
1341
- [key: string]: Omit<Setting, 'value'>;
1342
- };
1343
- }
1344
- /**
1345
- * Base parameters common to all model types
1346
- */
1347
- interface BaseModelParams {
1348
- /** The agent runtime for accessing services and utilities */
1349
- runtime: IAgentRuntime;
1350
- }
1351
- /**
1352
- * Parameters for text generation models
978
+ * Parameters for text generation models
1353
979
  */
1354
980
  interface TextGenerationParams extends BaseModelParams {
1355
981
  /** The prompt to generate text from */
@@ -1516,6 +1142,71 @@ interface ModelResultMap {
1516
1142
  [ModelType.OBJECT_LARGE]: any;
1517
1143
  [key: string]: any;
1518
1144
  }
1145
+ /**
1146
+ * Defines the structure for a model handler registration within the `AgentRuntime`.
1147
+ * Each model (e.g., for text generation, embedding) is associated with a handler function,
1148
+ * the name of the provider (plugin or system) that registered it, and an optional priority.
1149
+ * The `priority` (higher is more preferred) helps in selecting which handler to use if multiple
1150
+ * handlers are registered for the same model type. The `registrationOrder` (not in type, but used in runtime)
1151
+ * serves as a tie-breaker. See `AgentRuntime.registerModel` and `AgentRuntime.getModel`.
1152
+ */
1153
+ interface ModelHandler {
1154
+ /** The function that executes the model, taking runtime and parameters, and returning a Promise. */
1155
+ handler: (runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>;
1156
+ /** The name of the provider (e.g., plugin name) that registered this model handler. */
1157
+ provider: string;
1158
+ /**
1159
+ * Optional priority for this model handler. Higher numbers indicate higher priority.
1160
+ * This is used by `AgentRuntime.getModel` to select the most appropriate handler
1161
+ * when multiple are available for a given model type. Defaults to 0 if not specified.
1162
+ */
1163
+ priority?: number;
1164
+ registrationOrder?: number;
1165
+ }
1166
+
1167
+ /**
1168
+ * Information describing the target of a message.
1169
+ */
1170
+ interface TargetInfo {
1171
+ source: string;
1172
+ roomId?: UUID;
1173
+ channelId?: string;
1174
+ serverId?: string;
1175
+ entityId?: UUID;
1176
+ threadId?: string;
1177
+ }
1178
+ /**
1179
+ * Function signature for handlers responsible for sending messages to specific platforms.
1180
+ */
1181
+ type SendHandlerFunction = (runtime: IAgentRuntime, target: TargetInfo, content: Content) => Promise<void>;
1182
+ declare enum SOCKET_MESSAGE_TYPE {
1183
+ ROOM_JOINING = 1,
1184
+ SEND_MESSAGE = 2,
1185
+ MESSAGE = 3,
1186
+ ACK = 4,
1187
+ THINKING = 5,
1188
+ CONTROL = 6
1189
+ }
1190
+ /**
1191
+ * Interface for control messages sent from the backend to the frontend
1192
+ * to manage UI state and interaction capabilities
1193
+ */
1194
+ interface ControlMessage {
1195
+ /** Message type identifier */
1196
+ type: 'control';
1197
+ /** Control message payload */
1198
+ payload: {
1199
+ /** Action to perform */
1200
+ action: 'disable_input' | 'enable_input';
1201
+ /** Optional target element identifier */
1202
+ target?: string;
1203
+ /** Additional optional parameters */
1204
+ [key: string]: unknown;
1205
+ };
1206
+ /** Room ID to ensure signal is directed to the correct chat window */
1207
+ roomId: UUID;
1208
+ }
1209
+
1519
1210
  /**
1520
1211
  * Standard event types across all platforms
1521
1212
  */
@@ -1678,42 +1369,129 @@ interface EventPayloadMap {
1678
1369
  [EventType.MODEL_USED]: ModelEventPayload;
1679
1370
  }
1680
1371
  /**
1681
- * Event handler function type
1372
+ * Event handler function type
1373
+ */
1374
+ type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
1375
+ /**
1376
+ * Represents a generic data object that can be passed as a payload in an event.
1377
+ * This type is often used in `TypedEventHandler` to provide a flexible yet somewhat
1378
+ * structured way to handle event data. Specific event handlers might cast this to a
1379
+ * more concrete type based on the event being processed.
1380
+ */
1381
+ type EventDataObject = Record<string, unknown>;
1382
+ /**
1383
+ * Defines a more specific type for event handlers, expecting an `EventDataObject`.
1384
+ * This aims to improve upon generic 'any' type handlers, providing a clearer contract
1385
+ * for functions that respond to events emitted within the agent runtime (see `emitEvent` in `AgentRuntime`).
1386
+ * Handlers can be synchronous or asynchronous.
1387
+ */
1388
+ type TypedEventHandler = (data: EventDataObject) => Promise<void> | void;
1389
+
1390
+ /**
1391
+ * Core service type registry that can be extended by plugins via module augmentation.
1392
+ * Plugins can extend this interface to add their own service types:
1393
+ *
1394
+ * @example
1395
+ * ```typescript
1396
+ * declare module '@elizaos/core' {
1397
+ * interface ServiceTypeRegistry {
1398
+ * MY_CUSTOM_SERVICE: 'my_custom_service';
1399
+ * }
1400
+ * }
1401
+ * ```
1402
+ */
1403
+ interface ServiceTypeRegistry {
1404
+ TRANSCRIPTION: 'transcription';
1405
+ VIDEO: 'video';
1406
+ BROWSER: 'browser';
1407
+ PDF: 'pdf';
1408
+ REMOTE_FILES: 'aws_s3';
1409
+ WEB_SEARCH: 'web_search';
1410
+ EMAIL: 'email';
1411
+ TEE: 'tee';
1412
+ TASK: 'task';
1413
+ INSTRUMENTATION: 'instrumentation';
1414
+ WALLET: 'wallet';
1415
+ LP_POOL: 'lp_pool';
1416
+ TOKEN_DATA: 'token_data';
1417
+ }
1418
+ /**
1419
+ * Type for service names that includes both core services and any plugin-registered services
1420
+ */
1421
+ type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
1422
+ /**
1423
+ * Helper type to extract service type values from the registry
1424
+ */
1425
+ type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
1426
+ /**
1427
+ * Helper type to check if a service type exists in the registry
1428
+ */
1429
+ type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
1430
+ /**
1431
+ * Type-safe service class definition
1432
+ */
1433
+ type TypedServiceClass<T extends ServiceTypeName> = {
1434
+ new (runtime?: IAgentRuntime): Service;
1435
+ serviceType: T;
1436
+ start(runtime: IAgentRuntime): Promise<Service>;
1437
+ };
1438
+ /**
1439
+ * Map of service type names to their implementation classes
1440
+ */
1441
+ interface ServiceClassMap {
1442
+ }
1443
+ /**
1444
+ * Helper to infer service instance type from service type name
1682
1445
  */
1683
- type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
1446
+ type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
1684
1447
  /**
1685
- * Update the Plugin interface with typed events
1448
+ * Runtime service registry type
1686
1449
  */
1687
- declare enum SOCKET_MESSAGE_TYPE {
1688
- ROOM_JOINING = 1,
1689
- SEND_MESSAGE = 2,
1690
- MESSAGE = 3,
1691
- ACK = 4,
1692
- THINKING = 5,
1693
- CONTROL = 6
1694
- }
1450
+ type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
1695
1451
  /**
1696
- * Specialized memory type for messages with enhanced type checking
1452
+ * Enumerates the recognized types of services that can be registered and used by the agent runtime.
1453
+ * Services provide specialized functionalities like audio transcription, video processing,
1454
+ * web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,
1455
+ * secure execution via TEE (Trusted Execution Environment), task management, and instrumentation.
1456
+ * This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).
1457
+ * Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.
1697
1458
  */
1698
- interface MessageMemory extends Memory {
1699
- metadata: MessageMetadata;
1700
- content: Content & {
1701
- text: string;
1702
- };
1703
- }
1459
+ declare const ServiceType: {
1460
+ readonly TRANSCRIPTION: "transcription";
1461
+ readonly VIDEO: "video";
1462
+ readonly BROWSER: "browser";
1463
+ readonly PDF: "pdf";
1464
+ readonly REMOTE_FILES: "aws_s3";
1465
+ readonly WEB_SEARCH: "web_search";
1466
+ readonly EMAIL: "email";
1467
+ readonly TEE: "tee";
1468
+ readonly TASK: "task";
1469
+ readonly INSTRUMENTATION: "instrumentation";
1470
+ readonly WALLET: "wallet";
1471
+ readonly LP_POOL: "lp_pool";
1472
+ readonly TOKEN_DATA: "token_data";
1473
+ };
1704
1474
  /**
1705
- * Factory function to create a new message memory with proper defaults
1475
+ * Client instance
1706
1476
  */
1707
- declare function createMessageMemory(params: {
1708
- id?: UUID;
1709
- entityId: UUID;
1710
- agentId?: UUID;
1711
- roomId: UUID;
1712
- content: Content & {
1713
- text: string;
1477
+ declare abstract class Service {
1478
+ /** Runtime instance */
1479
+ protected runtime: IAgentRuntime;
1480
+ constructor(runtime?: IAgentRuntime);
1481
+ abstract stop(): Promise<void>;
1482
+ /** Service type */
1483
+ static serviceType: string;
1484
+ /** Service name */
1485
+ abstract capabilityDescription: string;
1486
+ /** Service configuration */
1487
+ config?: {
1488
+ [key: string]: any;
1714
1489
  };
1715
- embedding?: number[];
1716
- }): MessageMemory;
1490
+ /** Start service connection */
1491
+ static start(_runtime: IAgentRuntime): Promise<Service>;
1492
+ /** Stop service connection */
1493
+ static stop(_runtime: IAgentRuntime): Promise<unknown>;
1494
+ }
1717
1495
  /**
1718
1496
  * Generic service interface that provides better type checking for services
1719
1497
  * @template ConfigType The configuration type for this service
@@ -1743,196 +1521,327 @@ interface TypedService<ConfigType extends {
1743
1521
  */
1744
1522
  declare function getTypedService<T extends TypedService<any, any>>(runtime: IAgentRuntime, serviceType: ServiceTypeName): T | null;
1745
1523
  /**
1746
- * Type guard to check if a memory metadata is a DocumentMetadata
1747
- * @param metadata The metadata to check
1748
- * @returns True if the metadata is a DocumentMetadata
1524
+ * Standardized service error type for consistent error handling
1749
1525
  */
1750
- declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
1526
+ interface ServiceError {
1527
+ code: string;
1528
+ message: string;
1529
+ details?: unknown;
1530
+ cause?: Error;
1531
+ }
1751
1532
  /**
1752
- * Type guard to check if a memory metadata is a FragmentMetadata
1753
- * @param metadata The metadata to check
1754
- * @returns True if the metadata is a FragmentMetadata
1533
+ * Safely create a ServiceError from any caught error
1755
1534
  */
1756
- declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
1535
+ declare function createServiceError(error: unknown, code?: string): ServiceError;
1757
1536
  /**
1758
- * Type guard to check if a memory metadata is a MessageMetadata
1759
- * @param metadata The metadata to check
1760
- * @returns True if the metadata is a MessageMetadata
1537
+ * A generic type for service configurations.
1538
+ * Services (like `IVideoService`, `IBrowserService`) can have their own specific configuration
1539
+ * structures. This type allows for a flexible way to pass configuration objects,
1540
+ * typically used during service initialization within a plugin or the `AgentRuntime`.
1761
1541
  */
1762
- declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
1542
+ type ServiceConfig = Record<string, unknown>;
1543
+
1763
1544
  /**
1764
- * Type guard to check if a memory metadata is a DescriptionMetadata
1765
- * @param metadata The metadata to check
1766
- * @returns True if the metadata is a DescriptionMetadata
1545
+ * Represents a test case for evaluating agent or plugin functionality.
1546
+ * Each test case has a name and a function that contains the test logic.
1547
+ * The test function receives the `IAgentRuntime` instance, allowing it to interact with the agent's capabilities.
1548
+ * Test cases are typically grouped into `TestSuite`s.
1767
1549
  */
1768
- declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
1550
+ interface TestCase {
1551
+ /** A descriptive name for the test case, e.g., "should respond to greetings". */
1552
+ name: string;
1553
+ /**
1554
+ * The function that executes the test logic. It can be synchronous or asynchronous.
1555
+ * It receives the `IAgentRuntime` to interact with the agent and its services.
1556
+ * The function should typically contain assertions to verify expected outcomes.
1557
+ */
1558
+ fn: (runtime: IAgentRuntime) => Promise<void> | void;
1559
+ }
1769
1560
  /**
1770
- * Type guard to check if a memory metadata is a CustomMetadata
1771
- * @param metadata The metadata to check
1772
- * @returns True if the metadata is a CustomMetadata
1561
+ * Represents a suite of related test cases for an agent or plugin.
1562
+ * This helps in organizing tests and running them collectively.
1563
+ * A `ProjectAgent` can define one or more `TestSuite`s.
1773
1564
  */
1774
- declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
1565
+ interface TestSuite {
1566
+ /** A descriptive name for the test suite, e.g., "Core Functionality Tests". */
1567
+ name: string;
1568
+ /** An array of `TestCase` objects that belong to this suite. */
1569
+ tests: TestCase[];
1570
+ }
1571
+
1572
+ type Route = {
1573
+ type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
1574
+ path: string;
1575
+ filePath?: string;
1576
+ public?: boolean;
1577
+ name?: string extends {
1578
+ public: true;
1579
+ } ? string : string | undefined;
1580
+ handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
1581
+ isMultipart?: boolean;
1582
+ };
1775
1583
  /**
1776
- * Standardized service error type for consistent error handling
1584
+ * Plugin for extending agent functionality
1777
1585
  */
1778
- interface ServiceError {
1779
- code: string;
1780
- message: string;
1781
- details?: unknown;
1782
- cause?: Error;
1586
+ type PluginEvents = {
1587
+ [K in keyof EventPayloadMap]?: EventHandler<K>[];
1588
+ } & {
1589
+ [key: string]: ((params: any) => Promise<any>)[];
1590
+ };
1591
+ interface Plugin {
1592
+ name: string;
1593
+ description: string;
1594
+ init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
1595
+ config?: {
1596
+ [key: string]: any;
1597
+ };
1598
+ services?: (typeof Service)[];
1599
+ componentTypes?: {
1600
+ name: string;
1601
+ schema: Record<string, unknown>;
1602
+ validator?: (data: any) => boolean;
1603
+ }[];
1604
+ actions?: Action[];
1605
+ providers?: Provider[];
1606
+ evaluators?: Evaluator[];
1607
+ adapter?: IDatabaseAdapter;
1608
+ models?: {
1609
+ [key: string]: (...args: any[]) => Promise<any>;
1610
+ };
1611
+ events?: PluginEvents;
1612
+ routes?: Route[];
1613
+ tests?: TestSuite[];
1614
+ dependencies?: string[];
1615
+ priority?: number;
1616
+ }
1617
+ interface ProjectAgent {
1618
+ character: Character;
1619
+ init?: (runtime: IAgentRuntime) => Promise<void>;
1620
+ plugins?: Plugin[];
1621
+ tests?: TestSuite | TestSuite[];
1622
+ }
1623
+ interface Project {
1624
+ agents: ProjectAgent[];
1625
+ }
1626
+
1627
+ /**
1628
+ * Represents the core runtime environment for an agent.
1629
+ * Defines methods for database interaction, plugin management, event handling,
1630
+ * state composition, model usage, and task management.
1631
+ */
1632
+ interface IAgentRuntime extends IDatabaseAdapter {
1633
+ agentId: UUID;
1634
+ character: Character;
1635
+ providers: Provider[];
1636
+ actions: Action[];
1637
+ evaluators: Evaluator[];
1638
+ plugins: Plugin[];
1639
+ services: Map<ServiceTypeName, Service>;
1640
+ events: Map<string, ((params: any) => Promise<void>)[]>;
1641
+ fetch?: typeof fetch | null;
1642
+ routes: Route[];
1643
+ registerPlugin(plugin: Plugin): Promise<void>;
1644
+ initialize(): Promise<void>;
1645
+ getConnection(): Promise<any>;
1646
+ getService<T extends Service>(service: ServiceTypeName | string): T | null;
1647
+ getAllServices(): Map<ServiceTypeName, Service>;
1648
+ registerService(service: typeof Service): Promise<void>;
1649
+ registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
1650
+ setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
1651
+ getSetting(key: string): string | boolean | null | any;
1652
+ getConversationLength(): number;
1653
+ processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
1654
+ evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
1655
+ registerProvider(provider: Provider): void;
1656
+ registerAction(action: Action): void;
1657
+ registerEvaluator(evaluator: Evaluator): void;
1658
+ ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
1659
+ ensureConnection({ entityId, roomId, metadata, userName, worldName, name, source, channelId, serverId, type, worldId, userId, }: {
1660
+ entityId: UUID;
1661
+ roomId: UUID;
1662
+ userName?: string;
1663
+ name?: string;
1664
+ worldName?: string;
1665
+ source?: string;
1666
+ channelId?: string;
1667
+ serverId?: string;
1668
+ type: any;
1669
+ worldId: UUID;
1670
+ userId?: UUID;
1671
+ metadata?: Record<string, any>;
1672
+ }): Promise<void>;
1673
+ ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
1674
+ ensureWorldExists(world: World): Promise<void>;
1675
+ ensureRoomExists(room: Room): Promise<void>;
1676
+ composeState(message: Memory, includeList?: string[], onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
1677
+ /**
1678
+ * Use a model with strongly typed parameters and return values based on model type
1679
+ * @template T - The model type to use
1680
+ * @template R - The expected return type, defaults to the type defined in ModelResultMap[T]
1681
+ * @param {T} modelType - The type of model to use
1682
+ * @param {ModelParamsMap[T] | any} params - The parameters for the model, typed based on model type
1683
+ * @returns {Promise<R>} - The model result, typed based on the provided generic type parameter
1684
+ */
1685
+ useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any): Promise<R>;
1686
+ registerModel(modelType: ModelTypeName | string, handler: (params: any) => Promise<any>, provider: string, priority?: number): void;
1687
+ getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
1688
+ registerEvent(event: string, handler: (params: any) => Promise<void>): void;
1689
+ getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
1690
+ emitEvent(event: string | string[], params: any): Promise<void>;
1691
+ registerTaskWorker(taskHandler: TaskWorker): void;
1692
+ getTaskWorker(name: string): TaskWorker | undefined;
1693
+ stop(): Promise<void>;
1694
+ addEmbeddingToMemory(memory: Memory): Promise<Memory>;
1695
+ getEntityById(entityId: UUID): Promise<Entity | null>;
1696
+ getRoom(roomId: UUID): Promise<Room | null>;
1697
+ createEntity(entity: Entity): Promise<boolean>;
1698
+ createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
1699
+ addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
1700
+ getRooms(worldId: UUID): Promise<Room[]>;
1701
+ /**
1702
+ * Registers a handler function responsible for sending messages to a specific source/platform.
1703
+ * @param source - The unique identifier string for the source (e.g., 'discord', 'telegram').
1704
+ * @param handler - The SendHandlerFunction to be called for this source.
1705
+ */
1706
+ registerSendHandler(source: string, handler: SendHandlerFunction): void;
1707
+ /**
1708
+ * Sends a message to a specified target using the appropriate registered handler.
1709
+ * @param target - Information describing the target recipient and platform.
1710
+ * @param content - The message content to send.
1711
+ * @returns Promise resolving when the message sending process is initiated or completed.
1712
+ */
1713
+ sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
1783
1714
  }
1715
+
1784
1716
  /**
1785
- * Memory type guard for document memories
1786
- */
1787
- declare function isDocumentMemory(memory: Memory): memory is Memory & {
1788
- metadata: DocumentMetadata;
1789
- };
1790
- /**
1791
- * Memory type guard for fragment memories
1792
- */
1793
- declare function isFragmentMemory(memory: Memory): memory is Memory & {
1794
- metadata: FragmentMetadata;
1795
- };
1796
- /**
1797
- * Safely access the text content of a memory
1798
- * @param memory The memory to extract text from
1799
- * @param defaultValue Optional default value if no text is found
1800
- * @returns The text content or default value
1717
+ * Example content with associated user for demonstration purposes
1801
1718
  */
1802
- declare function getMemoryText(memory: Memory, defaultValue?: string): string;
1719
+ interface ActionExample {
1720
+ /** User associated with the example */
1721
+ name: string;
1722
+ /** Content of the example */
1723
+ content: Content;
1724
+ }
1803
1725
  /**
1804
- * Safely create a ServiceError from any caught error
1726
+ * Callback function type for handlers
1805
1727
  */
1806
- declare function createServiceError(error: unknown, code?: string): ServiceError;
1728
+ type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
1807
1729
  /**
1808
- * Replace 'any' types with more specific types
1730
+ * Handler function type for processing messages
1809
1731
  */
1732
+ type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
1733
+ [key: string]: unknown;
1734
+ }, callback?: HandlerCallback, responses?: Memory[]) => Promise<unknown>;
1810
1735
  /**
1811
- * Defines the possible primitive types or structured types for a value within the agent's state.
1812
- * This type is used to provide more specific typing for properties within `StateObject` and `StateArray`,
1813
- * moving away from a generic 'any' type for better type safety and clarity in state management.
1736
+ * Validator function type for actions/evaluators
1814
1737
  */
1815
- type StateValue = string | number | boolean | null | StateObject | StateArray;
1738
+ type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
1816
1739
  /**
1817
- * Represents a generic object structure within the agent's state, where keys are strings
1818
- * and values can be any `StateValue`. This allows for nested objects within the state.
1819
- * It's a fundamental part of the `EnhancedState` interface.
1740
+ * Represents an action the agent can perform
1820
1741
  */
1821
- interface StateObject {
1822
- [key: string]: StateValue;
1742
+ interface Action {
1743
+ /** Similar action descriptions */
1744
+ similes?: string[];
1745
+ /** Detailed description */
1746
+ description: string;
1747
+ /** Example usages */
1748
+ examples?: ActionExample[][];
1749
+ /** Handler function */
1750
+ handler: Handler;
1751
+ /** Action name */
1752
+ name: string;
1753
+ /** Validation function */
1754
+ validate: Validator;
1823
1755
  }
1824
1756
  /**
1825
- * Represents an array of `StateValue` types within the agent's state.
1826
- * This allows for lists of mixed or uniform types to be stored in the state,
1827
- * contributing to the structured definition of `EnhancedState`.
1828
- */
1829
- type StateArray = StateValue[];
1830
- /**
1831
- * Enhanced State interface with more specific types for its core properties.
1832
- * This interface provides a more structured representation of an agent's conversational state,
1833
- * building upon the base `State` by typing `values` and `data` as `StateObject`.
1834
- * The `text` property typically holds a textual summary or context derived from the state.
1835
- * Additional dynamic properties are still allowed via the index signature `[key: string]: StateValue;`.
1757
+ * Example for evaluating agent behavior
1836
1758
  */
1837
- interface EnhancedState {
1838
- /** Holds directly accessible state values, often used for template rendering or quick lookups. */
1839
- values: StateObject;
1840
- /** Stores more complex or structured data, potentially namespaced by providers or internal systems. */
1841
- data: StateObject;
1842
- /** A textual representation or summary of the current state, often used as context for models. */
1843
- text: string;
1844
- /** Allows for additional dynamic properties to be added to the state object. */
1845
- [key: string]: StateValue;
1759
+ interface EvaluationExample {
1760
+ /** Evaluation context */
1761
+ prompt: string;
1762
+ /** Example messages */
1763
+ messages: Array<ActionExample>;
1764
+ /** Expected outcome */
1765
+ outcome: string;
1846
1766
  }
1847
1767
  /**
1848
- * A generic type for the `data` field within a `Component`.
1849
- * While `Record<string, unknown>` allows for flexibility, developers are encouraged
1850
- * to define more specific types for component data where possible to improve type safety
1851
- * and code maintainability. This type serves as a base for various component implementations.
1852
- */
1853
- type ComponentData = Record<string, unknown>;
1854
- /**
1855
- * Represents a generic data object that can be passed as a payload in an event.
1856
- * This type is often used in `TypedEventHandler` to provide a flexible yet somewhat
1857
- * structured way to handle event data. Specific event handlers might cast this to a
1858
- * more concrete type based on the event being processed.
1859
- */
1860
- type EventDataObject = Record<string, unknown>;
1861
- /**
1862
- * Defines a more specific type for event handlers, expecting an `EventDataObject`.
1863
- * This aims to improve upon generic 'any' type handlers, providing a clearer contract
1864
- * for functions that respond to events emitted within the agent runtime (see `emitEvent` in `AgentRuntime`).
1865
- * Handlers can be synchronous or asynchronous.
1866
- */
1867
- type TypedEventHandler = (data: EventDataObject) => Promise<void> | void;
1868
- /**
1869
- * Represents a generic database connection object.
1870
- * The actual type of this connection will depend on the specific database adapter implementation
1871
- * (e.g., a connection pool object for PostgreSQL, a client instance for a NoSQL database).
1872
- * This `unknown` type serves as a placeholder in the abstract `IDatabaseAdapter`.
1873
- */
1874
- type DbConnection = unknown;
1875
- /**
1876
- * A generic type for metadata objects, often used in various parts of the system like
1877
- * `Relationship` metadata or other extensible data structures.
1878
- * It allows for arbitrary key-value pairs where values are of `unknown` type,
1879
- * encouraging consumers to perform type checking or casting.
1768
+ * Evaluator for assessing agent responses
1880
1769
  */
1881
- type MetadataObject = Record<string, unknown>;
1770
+ interface Evaluator {
1771
+ /** Whether to always run */
1772
+ alwaysRun?: boolean;
1773
+ /** Detailed description */
1774
+ description: string;
1775
+ /** Similar evaluator descriptions */
1776
+ similes?: string[];
1777
+ /** Example evaluations */
1778
+ examples: EvaluationExample[];
1779
+ /** Handler function */
1780
+ handler: Handler;
1781
+ /** Evaluator name */
1782
+ name: string;
1783
+ /** Validation function */
1784
+ validate: Validator;
1785
+ }
1786
+ interface ProviderResult {
1787
+ values?: {
1788
+ [key: string]: any;
1789
+ };
1790
+ data?: {
1791
+ [key: string]: any;
1792
+ };
1793
+ text?: string;
1794
+ }
1882
1795
  /**
1883
- * Defines the structure for a model handler registration within the `AgentRuntime`.
1884
- * Each model (e.g., for text generation, embedding) is associated with a handler function,
1885
- * the name of the provider (plugin or system) that registered it, and an optional priority.
1886
- * The `priority` (higher is more preferred) helps in selecting which handler to use if multiple
1887
- * handlers are registered for the same model type. The `registrationOrder` (not in type, but used in runtime)
1888
- * serves as a tie-breaker. See `AgentRuntime.registerModel` and `AgentRuntime.getModel`.
1796
+ * Provider for external data/services
1889
1797
  */
1890
- interface ModelHandler {
1891
- /** The function that executes the model, taking runtime and parameters, and returning a Promise. */
1892
- handler: (runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>;
1893
- /** The name of the provider (e.g., plugin name) that registered this model handler. */
1894
- provider: string;
1798
+ interface Provider {
1799
+ /** Provider name */
1800
+ name: string;
1801
+ /** Description of the provider */
1802
+ description?: string;
1803
+ /** Whether the provider is dynamic */
1804
+ dynamic?: boolean;
1805
+ /** Position of the provider in the provider list, positive or negative */
1806
+ position?: number;
1895
1807
  /**
1896
- * Optional priority for this model handler. Higher numbers indicate higher priority.
1897
- * This is used by `AgentRuntime.getModel` to select the most appropriate handler
1898
- * when multiple are available for a given model type. Defaults to 0 if not specified.
1808
+ * Whether the provider is private
1809
+ *
1810
+ * Private providers are not displayed in the regular provider list, they have to be called explicitly
1899
1811
  */
1900
- priority?: number;
1901
- registrationOrder?: number;
1812
+ private?: boolean;
1813
+ /** Data retrieval function */
1814
+ get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
1902
1815
  }
1816
+
1903
1817
  /**
1904
- * A generic type for service configurations.
1905
- * Services (like `IVideoService`, `IBrowserService`) can have their own specific configuration
1906
- * structures. This type allows for a flexible way to pass configuration objects,
1907
- * typically used during service initialization within a plugin or the `AgentRuntime`.
1908
- */
1909
- type ServiceConfig = Record<string, unknown>;
1910
- declare const VECTOR_DIMS: {
1911
- readonly SMALL: 384;
1912
- readonly MEDIUM: 512;
1913
- readonly LARGE: 768;
1914
- readonly XL: 1024;
1915
- readonly XXL: 1536;
1916
- readonly XXXL: 3072;
1917
- };
1918
- /**
1919
- * Interface for control messages sent from the backend to the frontend
1920
- * to manage UI state and interaction capabilities
1818
+ * Interface representing settings with string key-value pairs.
1921
1819
  */
1922
- interface ControlMessage {
1923
- /** Message type identifier */
1924
- type: 'control';
1925
- /** Control message payload */
1926
- payload: {
1927
- /** Action to perform */
1928
- action: 'disable_input' | 'enable_input';
1929
- /** Optional target element identifier */
1930
- target?: string;
1931
- /** Additional optional parameters */
1932
- [key: string]: unknown;
1820
+ interface RuntimeSettings {
1821
+ [key: string]: string | undefined;
1822
+ }
1823
+ interface Setting {
1824
+ name: string;
1825
+ description: string;
1826
+ usageDescription: string;
1827
+ value: string | boolean | null;
1828
+ required: boolean;
1829
+ public?: boolean;
1830
+ secret?: boolean;
1831
+ validation?: (value: any) => boolean;
1832
+ dependsOn?: string[];
1833
+ onSetAction?: (value: any) => string;
1834
+ visibleIf?: (settings: {
1835
+ [key: string]: Setting;
1836
+ }) => boolean;
1837
+ }
1838
+ interface WorldSettings {
1839
+ [key: string]: Setting;
1840
+ }
1841
+ interface OnboardingConfig {
1842
+ settings: {
1843
+ [key: string]: Omit<Setting, 'value'>;
1933
1844
  };
1934
- /** Room ID to ensure signal is directed to the correct chat window */
1935
- roomId: UUID;
1936
1845
  }
1937
1846
 
1938
1847
  /**
@@ -2384,12 +2293,6 @@ declare abstract class DatabaseAdapter<DB = unknown> implements IDatabaseAdapter
2384
2293
  * @returns A Promise that resolves to a boolean indicating success or failure of the deletion.
2385
2294
  */
2386
2295
  abstract deleteAgent(agentId: UUID$1): Promise<boolean>;
2387
- /**
2388
- * Ensures an agent exists in the database.
2389
- * @param agent The agent object to ensure exists.
2390
- * @returns A Promise that resolves when the agent has been ensured to exist.
2391
- */
2392
- abstract ensureAgentExists(agent: Partial<Agent$1>): Promise<Agent$1>;
2393
2296
  /**
2394
2297
  * Ensures an embedding dimension exists in the database.
2395
2298
  * @param dimension The dimension to ensure exists.
@@ -3057,12 +2960,20 @@ type v2_AgentRuntime = AgentRuntime;
3057
2960
  declare const v2_AgentRuntime: typeof AgentRuntime;
3058
2961
  type v2_DatabaseAdapter<DB = unknown> = DatabaseAdapter<DB>;
3059
2962
  declare const v2_DatabaseAdapter: typeof DatabaseAdapter;
2963
+ declare const v2_DeriveKeyAttestationData: typeof DeriveKeyAttestationData;
2964
+ declare const v2_RemoteAttestationMessage: typeof RemoteAttestationMessage;
2965
+ declare const v2_RemoteAttestationQuote: typeof RemoteAttestationQuote;
3060
2966
  type v2_Semaphore = Semaphore;
3061
2967
  declare const v2_Semaphore: typeof Semaphore;
3062
2968
  type v2_ServerOwnershipState = ServerOwnershipState;
3063
2969
  type v2_ServiceBuilder<TService extends Service$1 = Service$1> = ServiceBuilder<TService>;
3064
2970
  declare const v2_ServiceBuilder: typeof ServiceBuilder;
3065
2971
  type v2_ServiceDefinition<T extends Service$1 = Service$1> = ServiceDefinition<T>;
2972
+ declare const v2_TEEMode: typeof TEEMode;
2973
+ declare const v2_TeeAgent: typeof TeeAgent;
2974
+ declare const v2_TeePluginConfig: typeof TeePluginConfig;
2975
+ declare const v2_TeeType: typeof TeeType;
2976
+ declare const v2_TeeVendorConfig: typeof TeeVendorConfig;
3066
2977
  declare const v2_addHeader: typeof addHeader;
3067
2978
  declare const v2_booleanFooter: typeof booleanFooter;
3068
2979
  declare const v2_composeActionExamples: typeof composeActionExamples;
@@ -3111,7 +3022,7 @@ declare const v2_unsaltWorldSettings: typeof unsaltWorldSettings;
3111
3022
  declare const v2_updateWorldSettings: typeof updateWorldSettings;
3112
3023
  declare const v2_validateUuid: typeof validateUuid;
3113
3024
  declare namespace v2 {
3114
- export { Action$1 as Action, ActionEventPayload$1 as ActionEventPayload, ActionExample$1 as ActionExample, Agent$1 as Agent, v2_AgentRuntime as AgentRuntime, AgentStatus$1 as AgentStatus, AudioProcessingParams$1 as AudioProcessingParams, BaseMetadata$1 as BaseMetadata, BaseModelParams$1 as BaseModelParams, CacheKeyPrefix$1 as CacheKeyPrefix, ChannelType$1 as ChannelType, Character$1 as Character, ChunkRow$1 as ChunkRow, Component$1 as Component, ComponentData$1 as ComponentData, Content$1 as Content, ContentType$1 as ContentType, ControlMessage$1 as ControlMessage, CustomMetadata$1 as CustomMetadata, v2_DatabaseAdapter as DatabaseAdapter, DbConnection$1 as DbConnection, DeriveKeyAttestationData$1 as DeriveKeyAttestationData, DescriptionMetadata$1 as DescriptionMetadata, DetokenizeTextParams$1 as DetokenizeTextParams, DirectoryItem$1 as DirectoryItem, DocumentMetadata$1 as DocumentMetadata, EmbeddingSearchResult$1 as EmbeddingSearchResult, EnhancedState$1 as EnhancedState, Entity$1 as Entity, EntityPayload$1 as EntityPayload, EvaluationExample$1 as EvaluationExample, Evaluator$1 as Evaluator, EvaluatorEventPayload$1 as EvaluatorEventPayload, EventDataObject$1 as EventDataObject, EventHandler$1 as EventHandler, EventPayload$1 as EventPayload, EventPayloadMap$1 as EventPayloadMap, EventType$1 as EventType, FragmentMetadata$1 as FragmentMetadata, GenerateTextParams$1 as GenerateTextParams, Handler$1 as Handler, HandlerCallback$1 as HandlerCallback, IAgentRuntime$1 as IAgentRuntime, IDatabaseAdapter$1 as IDatabaseAdapter, ImageDescriptionParams$1 as ImageDescriptionParams, ImageGenerationParams$1 as ImageGenerationParams, InvokePayload$1 as InvokePayload, IsValidServiceType$1 as IsValidServiceType, JSONSchema$1 as JSONSchema, KnowledgeItem$1 as KnowledgeItem, KnowledgeScope$1 as KnowledgeScope, Log$1 as Log, Media$1 as Media, Memory$1 as Memory, MemoryMetadata$1 as MemoryMetadata, MemoryRetrievalOptions$1 as MemoryRetrievalOptions, MemoryScope$1 as MemoryScope, MemorySearchOptions$1 as MemorySearchOptions, MemoryType$1 as MemoryType, MemoryTypeAlias$1 as MemoryTypeAlias, MessageExample$1 as MessageExample, MessageMemory$1 as MessageMemory, MessageMetadata$1 as MessageMetadata, MessagePayload$1 as MessagePayload, MessageReceivedHandlerParams$1 as MessageReceivedHandlerParams, MetadataObject$1 as MetadataObject, ModelEventPayload$1 as ModelEventPayload, ModelHandler$1 as ModelHandler, ModelParamsMap$1 as ModelParamsMap, ModelResultMap$1 as ModelResultMap, ModelType$1 as ModelType, ModelTypeName$1 as ModelTypeName, MultiRoomMemoryOptions$1 as MultiRoomMemoryOptions, ObjectGenerationParams$1 as ObjectGenerationParams, OnboardingConfig$1 as OnboardingConfig, Participant$1 as Participant, PlatformPrefix$1 as PlatformPrefix, Plugin$1 as Plugin, PluginEvents$1 as PluginEvents, Project$1 as Project, ProjectAgent$1 as ProjectAgent, Provider$1 as Provider, ProviderResult$1 as ProviderResult, Relationship$1 as Relationship, RemoteAttestationMessage$1 as RemoteAttestationMessage, RemoteAttestationQuote$1 as RemoteAttestationQuote, Role$1 as Role, Room$1 as Room, RoomMetadata$1 as RoomMetadata, Route$1 as Route, RunEventPayload$1 as RunEventPayload, RuntimeSettings$1 as RuntimeSettings, SOCKET_MESSAGE_TYPE$1 as SOCKET_MESSAGE_TYPE, v2_Semaphore as Semaphore, SendHandlerFunction$1 as SendHandlerFunction, type v2_ServerOwnershipState as ServerOwnershipState, Service$1 as Service, v2_ServiceBuilder as ServiceBuilder, ServiceClassMap$1 as ServiceClassMap, ServiceConfig$1 as ServiceConfig, type v2_ServiceDefinition as ServiceDefinition, ServiceError$1 as ServiceError, ServiceInstance$1 as ServiceInstance, ServiceRegistry$1 as ServiceRegistry, ServiceType$1 as ServiceType, ServiceTypeName$1 as ServiceTypeName, ServiceTypeRegistry$1 as ServiceTypeRegistry, ServiceTypeValue$1 as ServiceTypeValue, Setting$1 as Setting, State$1 as State, StateArray$1 as StateArray, StateObject$1 as StateObject, StateValue$1 as StateValue, TEEMode$1 as TEEMode, TargetInfo$1 as TargetInfo, Task$1 as Task, TaskMetadata$1 as TaskMetadata, TaskWorker$1 as TaskWorker, TeeAgent$1 as TeeAgent, TeePluginConfig$1 as TeePluginConfig, TeeType$1 as TeeType, TeeVendorConfig$1 as TeeVendorConfig, TemplateType$1 as TemplateType, TestCase$1 as TestCase, TestSuite$1 as TestSuite, TextEmbeddingParams$1 as TextEmbeddingParams, TextGenerationParams$1 as TextGenerationParams, TextToSpeechParams$1 as TextToSpeechParams, TokenizeTextParams$1 as TokenizeTextParams, TranscriptionParams$1 as TranscriptionParams, TypedEventHandler$1 as TypedEventHandler, TypedService$1 as TypedService, TypedServiceClass$1 as TypedServiceClass, UUID$1 as UUID, UnifiedMemoryOptions$1 as UnifiedMemoryOptions, UnifiedSearchOptions$1 as UnifiedSearchOptions, VECTOR_DIMS$1 as VECTOR_DIMS, Validator$1 as Validator, VideoProcessingParams$1 as VideoProcessingParams, World$1 as World, WorldPayload$1 as WorldPayload, WorldSettings$1 as WorldSettings, v2_addHeader as addHeader, asUUID$1 as asUUID, v2_booleanFooter as booleanFooter, v2_composeActionExamples as composeActionExamples, v2_composePrompt as composePrompt, v2_composePromptFromState as composePromptFromState, createMessageMemory$1 as createMessageMemory, v2_createService as createService, createServiceError$1 as createServiceError, v2_createSettingFromConfig as createSettingFromConfig, v2_createUniqueUuid as createUniqueUuid, v2_decryptObjectValues as decryptObjectValues, decryptStringValue as decryptSecret, v2_decryptStringValue as decryptStringValue, v2_decryptedCharacter as decryptedCharacter, v2_defineService as defineService, v2_elizaLogger as elizaLogger, v2_encryptObjectValues as encryptObjectValues, v2_encryptStringValue as encryptStringValue, v2_encryptedCharacter as encryptedCharacter, v2_findEntityByName as findEntityByName, v2_findWorldsForOwner as findWorldsForOwner, v2_formatActionNames as formatActionNames, v2_formatActions as formatActions, v2_formatEntities as formatEntities, v2_formatMessages as formatMessages, v2_formatPosts as formatPosts, v2_formatTimestamp as formatTimestamp, v2_getEntityDetails as getEntityDetails, getMemoryText$1 as getMemoryText, v2_getSalt as getSalt, getTypedService$1 as getTypedService, v2_getUserServerRole as getUserServerRole, v2_getWorldSettings as getWorldSettings, v2_imageDescriptionTemplate as imageDescriptionTemplate, v2_initializeOnboarding as initializeOnboarding, isCustomMetadata$1 as isCustomMetadata, isDescriptionMetadata$1 as isDescriptionMetadata, isDocumentMemory$1 as isDocumentMemory, isDocumentMetadata$1 as isDocumentMetadata, isFragmentMemory$1 as isFragmentMemory, isFragmentMetadata$1 as isFragmentMetadata, isMessageMetadata$1 as isMessageMetadata, v2_logger as logger, v2_messageHandlerTemplate as messageHandlerTemplate, v2_parseBooleanFromText as parseBooleanFromText, v2_parseJSONObjectFromText as parseJSONObjectFromText, v2_parseKeyValueXml as parseKeyValueXml, v2_postCreationTemplate as postCreationTemplate, v2_safeReplacer as safeReplacer, v2_saltSettingValue as saltSettingValue, v2_saltWorldSettings as saltWorldSettings, v2_shouldRespondTemplate as shouldRespondTemplate, v2_stringToUuid as stringToUuid, v2_trimTokens as trimTokens, v2_truncateToCompleteSentence as truncateToCompleteSentence, v2_unsaltSettingValue as unsaltSettingValue, v2_unsaltWorldSettings as unsaltWorldSettings, v2_updateWorldSettings as updateWorldSettings, v2_validateUuid as validateUuid };
3025
+ export { Action$1 as Action, ActionEventPayload$1 as ActionEventPayload, ActionExample$1 as ActionExample, Agent$1 as Agent, v2_AgentRuntime as AgentRuntime, AgentStatus$1 as AgentStatus, AudioProcessingParams$1 as AudioProcessingParams, BaseMetadata$1 as BaseMetadata, BaseModelParams$1 as BaseModelParams, CacheKeyPrefix$1 as CacheKeyPrefix, ChannelType$1 as ChannelType, Character$1 as Character, ChunkRow$1 as ChunkRow, Component$1 as Component, ComponentData$1 as ComponentData, Content$1 as Content, ContentType$1 as ContentType, ControlMessage$1 as ControlMessage, CustomMetadata$1 as CustomMetadata, v2_DatabaseAdapter as DatabaseAdapter, DbConnection$1 as DbConnection, v2_DeriveKeyAttestationData as DeriveKeyAttestationData, DescriptionMetadata$1 as DescriptionMetadata, DetokenizeTextParams$1 as DetokenizeTextParams, DirectoryItem$1 as DirectoryItem, DocumentMetadata$1 as DocumentMetadata, EmbeddingSearchResult$1 as EmbeddingSearchResult, EnhancedState$1 as EnhancedState, Entity$1 as Entity, EntityPayload$1 as EntityPayload, EvaluationExample$1 as EvaluationExample, Evaluator$1 as Evaluator, EvaluatorEventPayload$1 as EvaluatorEventPayload, EventDataObject$1 as EventDataObject, EventHandler$1 as EventHandler, EventPayload$1 as EventPayload, EventPayloadMap$1 as EventPayloadMap, EventType$1 as EventType, FragmentMetadata$1 as FragmentMetadata, GenerateTextParams$1 as GenerateTextParams, Handler$1 as Handler, HandlerCallback$1 as HandlerCallback, IAgentRuntime$1 as IAgentRuntime, IDatabaseAdapter$1 as IDatabaseAdapter, ImageDescriptionParams$1 as ImageDescriptionParams, ImageGenerationParams$1 as ImageGenerationParams, InvokePayload$1 as InvokePayload, IsValidServiceType$1 as IsValidServiceType, JSONSchema$1 as JSONSchema, KnowledgeItem$1 as KnowledgeItem, KnowledgeScope$1 as KnowledgeScope, Log$1 as Log, Media$1 as Media, Memory$1 as Memory, MemoryMetadata$1 as MemoryMetadata, MemoryRetrievalOptions$1 as MemoryRetrievalOptions, MemoryScope$1 as MemoryScope, MemorySearchOptions$1 as MemorySearchOptions, MemoryType$1 as MemoryType, MemoryTypeAlias$1 as MemoryTypeAlias, MessageExample$1 as MessageExample, MessageMemory$1 as MessageMemory, MessageMetadata$1 as MessageMetadata, MessagePayload$1 as MessagePayload, MessageReceivedHandlerParams$1 as MessageReceivedHandlerParams, MetadataObject$1 as MetadataObject, ModelEventPayload$1 as ModelEventPayload, ModelHandler$1 as ModelHandler, ModelParamsMap$1 as ModelParamsMap, ModelResultMap$1 as ModelResultMap, ModelType$1 as ModelType, ModelTypeName$1 as ModelTypeName, MultiRoomMemoryOptions$1 as MultiRoomMemoryOptions, ObjectGenerationParams$1 as ObjectGenerationParams, OnboardingConfig$1 as OnboardingConfig, Participant$1 as Participant, PlatformPrefix$1 as PlatformPrefix, Plugin$1 as Plugin, PluginEvents$1 as PluginEvents, Project$1 as Project, ProjectAgent$1 as ProjectAgent, Provider$1 as Provider, ProviderResult$1 as ProviderResult, Relationship$1 as Relationship, v2_RemoteAttestationMessage as RemoteAttestationMessage, v2_RemoteAttestationQuote as RemoteAttestationQuote, Role$1 as Role, Room$1 as Room, RoomMetadata$1 as RoomMetadata, Route$1 as Route, RunEventPayload$1 as RunEventPayload, RuntimeSettings$1 as RuntimeSettings, SOCKET_MESSAGE_TYPE$1 as SOCKET_MESSAGE_TYPE, v2_Semaphore as Semaphore, SendHandlerFunction$1 as SendHandlerFunction, type v2_ServerOwnershipState as ServerOwnershipState, Service$1 as Service, v2_ServiceBuilder as ServiceBuilder, ServiceClassMap$1 as ServiceClassMap, ServiceConfig$1 as ServiceConfig, type v2_ServiceDefinition as ServiceDefinition, ServiceError$1 as ServiceError, ServiceInstance$1 as ServiceInstance, ServiceRegistry$1 as ServiceRegistry, ServiceType$1 as ServiceType, ServiceTypeName$1 as ServiceTypeName, ServiceTypeRegistry$1 as ServiceTypeRegistry, ServiceTypeValue$1 as ServiceTypeValue, Setting$1 as Setting, State$1 as State, StateArray$1 as StateArray, StateObject$1 as StateObject, StateValue$1 as StateValue, v2_TEEMode as TEEMode, TargetInfo$1 as TargetInfo, Task$1 as Task, TaskMetadata$1 as TaskMetadata, TaskWorker$1 as TaskWorker, v2_TeeAgent as TeeAgent, v2_TeePluginConfig as TeePluginConfig, v2_TeeType as TeeType, v2_TeeVendorConfig as TeeVendorConfig, TemplateType$1 as TemplateType, TestCase$1 as TestCase, TestSuite$1 as TestSuite, TextEmbeddingParams$1 as TextEmbeddingParams, TextGenerationParams$1 as TextGenerationParams, TextToSpeechParams$1 as TextToSpeechParams, TokenizeTextParams$1 as TokenizeTextParams, TranscriptionParams$1 as TranscriptionParams, TypedEventHandler$1 as TypedEventHandler, TypedService$1 as TypedService, TypedServiceClass$1 as TypedServiceClass, UUID$1 as UUID, UnifiedMemoryOptions$1 as UnifiedMemoryOptions, UnifiedSearchOptions$1 as UnifiedSearchOptions, VECTOR_DIMS$1 as VECTOR_DIMS, Validator$1 as Validator, VideoProcessingParams$1 as VideoProcessingParams, World$1 as World, WorldPayload$1 as WorldPayload, WorldSettings$1 as WorldSettings, v2_addHeader as addHeader, asUUID$1 as asUUID, v2_booleanFooter as booleanFooter, v2_composeActionExamples as composeActionExamples, v2_composePrompt as composePrompt, v2_composePromptFromState as composePromptFromState, createMessageMemory$1 as createMessageMemory, v2_createService as createService, createServiceError$1 as createServiceError, v2_createSettingFromConfig as createSettingFromConfig, v2_createUniqueUuid as createUniqueUuid, v2_decryptObjectValues as decryptObjectValues, decryptStringValue as decryptSecret, v2_decryptStringValue as decryptStringValue, v2_decryptedCharacter as decryptedCharacter, v2_defineService as defineService, v2_elizaLogger as elizaLogger, v2_encryptObjectValues as encryptObjectValues, v2_encryptStringValue as encryptStringValue, v2_encryptedCharacter as encryptedCharacter, v2_findEntityByName as findEntityByName, v2_findWorldsForOwner as findWorldsForOwner, v2_formatActionNames as formatActionNames, v2_formatActions as formatActions, v2_formatEntities as formatEntities, v2_formatMessages as formatMessages, v2_formatPosts as formatPosts, v2_formatTimestamp as formatTimestamp, v2_getEntityDetails as getEntityDetails, getMemoryText$1 as getMemoryText, v2_getSalt as getSalt, getTypedService$1 as getTypedService, v2_getUserServerRole as getUserServerRole, v2_getWorldSettings as getWorldSettings, v2_imageDescriptionTemplate as imageDescriptionTemplate, v2_initializeOnboarding as initializeOnboarding, isCustomMetadata$1 as isCustomMetadata, isDescriptionMetadata$1 as isDescriptionMetadata, isDocumentMemory$1 as isDocumentMemory, isDocumentMetadata$1 as isDocumentMetadata, isFragmentMemory$1 as isFragmentMemory, isFragmentMetadata$1 as isFragmentMetadata, isMessageMetadata$1 as isMessageMetadata, v2_logger as logger, v2_messageHandlerTemplate as messageHandlerTemplate, v2_parseBooleanFromText as parseBooleanFromText, v2_parseJSONObjectFromText as parseJSONObjectFromText, v2_parseKeyValueXml as parseKeyValueXml, v2_postCreationTemplate as postCreationTemplate, v2_safeReplacer as safeReplacer, v2_saltSettingValue as saltSettingValue, v2_saltWorldSettings as saltWorldSettings, v2_shouldRespondTemplate as shouldRespondTemplate, v2_stringToUuid as stringToUuid, v2_trimTokens as trimTokens, v2_truncateToCompleteSentence as truncateToCompleteSentence, v2_unsaltSettingValue as unsaltSettingValue, v2_unsaltWorldSettings as unsaltWorldSettings, v2_updateWorldSettings as updateWorldSettings, v2_validateUuid as validateUuid };
3115
3026
  }
3116
3027
 
3117
- export { type MemoryScope as $, type Action as A, asUUID as B, type Component as C, type ActionExample as D, type Entity as E, ModelType as F, type ServiceTypeRegistry as G, type HandlerCallback as H, type IDatabaseAdapter as I, type ServiceTypeValue as J, type IsValidServiceType as K, type Log as L, type Memory as M, type TypedServiceClass as N, type OnboardingConfig as O, type Participant as P, type ServiceClassMap as Q, type Room as R, type State as S, type Task as T, type UUID as U, type ServiceInstance as V, type World as W, type ServiceRegistry as X, ServiceType as Y, type MemoryTypeAlias as Z, MemoryType as _, type MemoryMetadata as a, type EvaluatorEventPayload as a$, type BaseMetadata as a0, type DocumentMetadata as a1, type FragmentMetadata as a2, type MessageMetadata as a3, type DescriptionMetadata as a4, type CustomMetadata as a5, type MessageExample as a6, type Handler as a7, type Validator as a8, type EvaluationExample as a9, type DeriveKeyAttestationData as aA, type RemoteAttestationMessage as aB, TeeType as aC, type TeeVendorConfig as aD, type TeePluginConfig as aE, type TaskMetadata as aF, type BaseModelParams as aG, type TextGenerationParams as aH, type TextEmbeddingParams as aI, type TokenizeTextParams as aJ, type ImageGenerationParams as aK, type ImageDescriptionParams as aL, type TranscriptionParams as aM, type TextToSpeechParams as aN, type AudioProcessingParams as aO, type VideoProcessingParams as aP, type JSONSchema as aQ, type ObjectGenerationParams as aR, EventType as aS, PlatformPrefix as aT, type EventPayload as aU, type WorldPayload as aV, type EntityPayload as aW, type MessagePayload as aX, type InvokePayload as aY, type RunEventPayload as aZ, type ActionEventPayload as a_, type ProviderResult as aa, type RoomMetadata as ab, type Media as ac, ContentType as ad, type PluginEvents as ae, type ProjectAgent as af, type Project as ag, AgentStatus as ah, type EmbeddingSearchResult as ai, type MemoryRetrievalOptions as aj, type MemorySearchOptions as ak, type MultiRoomMemoryOptions as al, type UnifiedMemoryOptions as am, type UnifiedSearchOptions as an, type KnowledgeItem as ao, KnowledgeScope as ap, CacheKeyPrefix as aq, type DirectoryItem as ar, type ChunkRow as as, type GenerateTextParams as at, type DetokenizeTextParams as au, type TestCase as av, type TestSuite as aw, type TeeAgent as ax, TEEMode as ay, type RemoteAttestationQuote as az, type Relationship as b, updateWorldSettings as b$, type ModelEventPayload as b0, type MessageReceivedHandlerParams as b1, type EventPayloadMap as b2, type EventHandler as b3, SOCKET_MESSAGE_TYPE as b4, type MessageMemory as b5, createMessageMemory as b6, type TypedService as b7, getTypedService as b8, isDocumentMetadata as b9, formatActionNames as bA, formatActions as bB, DatabaseAdapter as bC, findEntityByName as bD, createUniqueUuid as bE, getEntityDetails as bF, formatEntities as bG, logger as bH, elizaLogger as bI, shouldRespondTemplate as bJ, messageHandlerTemplate as bK, postCreationTemplate as bL, booleanFooter as bM, imageDescriptionTemplate as bN, type ServerOwnershipState as bO, getUserServerRole as bP, findWorldsForOwner as bQ, Semaphore as bR, AgentRuntime as bS, decryptStringValue as bT, createSettingFromConfig as bU, getSalt as bV, encryptStringValue as bW, saltSettingValue as bX, unsaltSettingValue as bY, saltWorldSettings as bZ, unsaltWorldSettings as b_, isFragmentMetadata as ba, isMessageMetadata as bb, isDescriptionMetadata as bc, isCustomMetadata as bd, type ServiceError as be, isDocumentMemory as bf, isFragmentMemory as bg, getMemoryText as bh, createServiceError as bi, type StateValue as bj, type StateObject as bk, type StateArray as bl, type EnhancedState as bm, type ComponentData as bn, type EventDataObject as bo, type TypedEventHandler as bp, type DbConnection as bq, type MetadataObject as br, type ServiceConfig as bs, VECTOR_DIMS as bt, type ControlMessage as bu, ServiceBuilder$1 as bv, createService$1 as bw, type ServiceDefinition$1 as bx, defineService$1 as by, composeActionExamples as bz, type Agent as c, getWorldSettings as c0, initializeOnboarding as c1, encryptedCharacter as c2, decryptedCharacter as c3, encryptObjectValues as c4, decryptObjectValues as c5, composePrompt as c6, composePromptFromState as c7, addHeader as c8, formatPosts as c9, formatMessages as ca, formatTimestamp as cb, validateUuid as cc, stringToUuid as cd, truncateToCompleteSentence as ce, parseKeyValueXml as cf, parseJSONObjectFromText as cg, parseBooleanFromText as ch, safeReplacer as ci, trimTokens as cj, ServiceBuilder as ck, createService as cl, type ServiceDefinition as cm, defineService as cn, type IAgentRuntime as d, Role as e, Service as f, type Character as g, type Evaluator as h, type Provider as i, type Plugin as j, type ServiceTypeName as k, type ModelHandler as l, type Route as m, type RuntimeSettings as n, ChannelType as o, type ModelTypeName as p, type ModelResultMap as q, type ModelParamsMap as r, type TaskWorker as s, type SendHandlerFunction as t, type TargetInfo as u, type Content as v, type Setting as w, type WorldSettings as x, type TemplateType as y, v2 as z };
3028
+ export { type MessageMetadata as $, type Action as A, asUUID as B, type Component as C, type Media as D, type Entity as E, ContentType as F, type StateValue as G, type HandlerCallback as H, type IDatabaseAdapter as I, type StateObject as J, type StateArray as K, type Log as L, type Memory as M, type EnhancedState as N, type OnboardingConfig as O, type Participant as P, type MemoryTypeAlias as Q, type Room as R, Service as S, type Task as T, type UUID as U, MemoryType as V, type World as W, type MemoryScope as X, type BaseMetadata as Y, type DocumentMetadata as Z, type FragmentMetadata as _, type MemoryMetadata as a, type DbConnection as a$, type DescriptionMetadata as a0, type CustomMetadata as a1, type MessageMemory as a2, createMessageMemory as a3, isDocumentMetadata as a4, isFragmentMetadata as a5, isMessageMetadata as a6, isDescriptionMetadata as a7, isCustomMetadata as a8, isDocumentMemory as a9, ServiceType as aA, type TypedService as aB, getTypedService as aC, type ServiceError as aD, createServiceError as aE, type ServiceConfig as aF, ModelType as aG, type GenerateTextParams as aH, type DetokenizeTextParams as aI, type BaseModelParams as aJ, type TextGenerationParams as aK, type TextEmbeddingParams as aL, type TokenizeTextParams as aM, type ImageGenerationParams as aN, type ImageDescriptionParams as aO, type TranscriptionParams as aP, type TextToSpeechParams as aQ, type AudioProcessingParams as aR, type VideoProcessingParams as aS, type JSONSchema as aT, type ObjectGenerationParams as aU, type EmbeddingSearchResult as aV, type MemoryRetrievalOptions as aW, type MemorySearchOptions as aX, type MultiRoomMemoryOptions as aY, type UnifiedMemoryOptions as aZ, type UnifiedSearchOptions as a_, isFragmentMemory as aa, getMemoryText as ab, type KnowledgeItem as ac, KnowledgeScope as ad, CacheKeyPrefix as ae, type DirectoryItem as af, type ChunkRow as ag, type RoomMetadata as ah, type ComponentData as ai, type MessageExample as aj, AgentStatus as ak, type ActionExample as al, type Handler as am, type Validator as an, type EvaluationExample as ao, type ProviderResult as ap, type PluginEvents as aq, type ProjectAgent as ar, type Project as as, type ServiceTypeRegistry as at, type ServiceTypeValue as au, type IsValidServiceType as av, type TypedServiceClass as aw, type ServiceClassMap as ax, type ServiceInstance as ay, type ServiceRegistry as az, type Relationship as b, composePromptFromState as b$, type MetadataObject as b0, VECTOR_DIMS as b1, EventType as b2, PlatformPrefix as b3, type EventPayload as b4, type WorldPayload as b5, type EntityPayload as b6, type MessagePayload as b7, type InvokePayload as b8, type RunEventPayload as b9, elizaLogger as bA, shouldRespondTemplate as bB, messageHandlerTemplate as bC, postCreationTemplate as bD, booleanFooter as bE, imageDescriptionTemplate as bF, type ServerOwnershipState as bG, getUserServerRole as bH, findWorldsForOwner as bI, Semaphore as bJ, AgentRuntime as bK, decryptStringValue as bL, createSettingFromConfig as bM, getSalt as bN, encryptStringValue as bO, saltSettingValue as bP, unsaltSettingValue as bQ, saltWorldSettings as bR, unsaltWorldSettings as bS, updateWorldSettings as bT, getWorldSettings as bU, initializeOnboarding as bV, encryptedCharacter as bW, decryptedCharacter as bX, encryptObjectValues as bY, decryptObjectValues as bZ, composePrompt as b_, type ActionEventPayload as ba, type EvaluatorEventPayload as bb, type ModelEventPayload as bc, type MessageReceivedHandlerParams as bd, type EventPayloadMap as be, type EventHandler as bf, type EventDataObject as bg, type TypedEventHandler as bh, type TaskMetadata as bi, SOCKET_MESSAGE_TYPE as bj, type ControlMessage as bk, type TestCase as bl, type TestSuite as bm, ServiceBuilder$1 as bn, createService$1 as bo, type ServiceDefinition$1 as bp, defineService$1 as bq, composeActionExamples as br, formatActionNames as bs, formatActions as bt, DatabaseAdapter as bu, findEntityByName as bv, createUniqueUuid as bw, getEntityDetails as bx, formatEntities as by, logger as bz, type Agent as c, addHeader as c0, formatPosts as c1, formatMessages as c2, formatTimestamp as c3, validateUuid as c4, stringToUuid as c5, truncateToCompleteSentence as c6, parseKeyValueXml as c7, parseJSONObjectFromText as c8, parseBooleanFromText as c9, safeReplacer as ca, trimTokens as cb, ServiceBuilder as cc, createService as cd, type ServiceDefinition as ce, defineService as cf, type IAgentRuntime as d, type State as e, Role as f, type Character as g, type Evaluator as h, type Provider as i, type Plugin as j, type ServiceTypeName as k, type ModelHandler as l, type Route as m, type RuntimeSettings as n, ChannelType as o, type ModelTypeName as p, type ModelResultMap as q, type ModelParamsMap as r, type TaskWorker as s, type SendHandlerFunction as t, type TargetInfo as u, type Content as v, type Setting as w, type WorldSettings as x, type TemplateType as y, v2 as z };