@elizaos/core 1.0.2 → 1.0.4

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,23 +1,20 @@
1
- import { type Pool as PgPool } from 'pg';
1
+ import { Pool } from 'pg';
2
2
  import { PGlite } from '@electric-sql/pglite';
3
- /**
4
- * Type definition for a Universally Unique Identifier (UUID) using a specific format.
5
- * @typedef {`${string}-${string}-${string}-${string}-${string}`} UUID
6
- */
3
+
7
4
  /**
8
5
  * Defines a custom type UUID representing a universally unique identifier
9
6
  */
10
- export type UUID = `${string}-${string}-${string}-${string}-${string}`;
7
+ type UUID = `${string}-${string}-${string}-${string}-${string}`;
11
8
  /**
12
9
  * Helper function to safely cast a string to strongly typed UUID
13
10
  * @param id The string UUID to validate and cast
14
11
  * @returns The same UUID with branded type information
15
12
  */
16
- export declare function asUUID(id: string): UUID;
13
+ declare function asUUID(id: string): UUID;
17
14
  /**
18
15
  * Represents the content of a memory, message, or other information
19
16
  */
20
- export interface Content {
17
+ interface Content {
21
18
  /** The agent's internal thought process */
22
19
  thought?: string;
23
20
  /** The main text content visible to users */
@@ -34,8 +31,6 @@ export interface Content {
34
31
  inReplyTo?: UUID;
35
32
  /** Array of media attachments */
36
33
  attachments?: Media[];
37
- /** room type */
38
- channelType?: string;
39
34
  /**
40
35
  * Additional dynamic properties
41
36
  * Use specific properties above instead of this when possible
@@ -45,13 +40,13 @@ export interface Content {
45
40
  /**
46
41
  * Example content with associated user for demonstration purposes
47
42
  */
48
- export interface ActionExample {
43
+ interface ActionExample {
49
44
  /** User associated with the example */
50
45
  name: string;
51
46
  /** Content of the example */
52
47
  content: Content;
53
48
  }
54
- export type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
49
+ type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
55
50
  /**
56
51
  * Defines the recognized types of models that the agent runtime can use.
57
52
  * These include models for text generation (small, large, reasoning, completion),
@@ -62,7 +57,7 @@ export type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
62
57
  * type safety and clarity when working with different AI models.
63
58
  * String values are used for extensibility with custom model types.
64
59
  */
65
- export declare const ModelType: {
60
+ declare const ModelType: {
66
61
  readonly SMALL: "TEXT_SMALL";
67
62
  readonly MEDIUM: "TEXT_LARGE";
68
63
  readonly LARGE: "TEXT_LARGE";
@@ -96,7 +91,7 @@ export declare const ModelType: {
96
91
  * }
97
92
  * ```
98
93
  */
99
- export interface ServiceTypeRegistry {
94
+ interface ServiceTypeRegistry {
100
95
  TRANSCRIPTION: 'transcription';
101
96
  VIDEO: 'video';
102
97
  BROWSER: 'browser';
@@ -111,19 +106,19 @@ export interface ServiceTypeRegistry {
111
106
  /**
112
107
  * Type for service names that includes both core services and any plugin-registered services
113
108
  */
114
- export type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
109
+ type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
115
110
  /**
116
111
  * Helper type to extract service type values from the registry
117
112
  */
118
- export type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
113
+ type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
119
114
  /**
120
115
  * Helper type to check if a service type exists in the registry
121
116
  */
122
- export type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
117
+ type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
123
118
  /**
124
119
  * Type-safe service class definition
125
120
  */
126
- export type TypedServiceClass<T extends ServiceTypeName> = {
121
+ type TypedServiceClass<T extends ServiceTypeName> = {
127
122
  new (runtime?: IAgentRuntime): Service;
128
123
  serviceType: T;
129
124
  start(runtime: IAgentRuntime): Promise<Service>;
@@ -131,16 +126,16 @@ export type TypedServiceClass<T extends ServiceTypeName> = {
131
126
  /**
132
127
  * Map of service type names to their implementation classes
133
128
  */
134
- export interface ServiceClassMap {
129
+ interface ServiceClassMap {
135
130
  }
136
131
  /**
137
132
  * Helper to infer service instance type from service type name
138
133
  */
139
- export type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
134
+ type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
140
135
  /**
141
136
  * Runtime service registry type
142
137
  */
143
- export type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
138
+ type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
144
139
  /**
145
140
  * Enumerates the recognized types of services that can be registered and used by the agent runtime.
146
141
  * Services provide specialized functionalities like audio transcription, video processing,
@@ -149,7 +144,7 @@ export type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T
149
144
  * This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).
150
145
  * Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.
151
146
  */
152
- export declare const ServiceType: {
147
+ declare const ServiceType: {
153
148
  readonly TRANSCRIPTION: "transcription";
154
149
  readonly VIDEO: "video";
155
150
  readonly BROWSER: "browser";
@@ -171,7 +166,7 @@ export declare const ServiceType: {
171
166
  * The `[key: string]: any;` allows for dynamic properties, though `EnhancedState` offers better typing.
172
167
  * This state object is passed to handlers for actions, evaluators, and providers.
173
168
  */
174
- export interface State {
169
+ interface State {
175
170
  /** Additional dynamic properties */
176
171
  [key: string]: any;
177
172
  values: {
@@ -185,7 +180,7 @@ export interface State {
185
180
  /**
186
181
  * Memory type enumeration for built-in memory types
187
182
  */
188
- export type MemoryTypeAlias = string;
183
+ type MemoryTypeAlias = string;
189
184
  /**
190
185
  * Enumerates the built-in types of memories that can be stored and retrieved.
191
186
  * - `DOCUMENT`: Represents a whole document or a large piece of text.
@@ -195,7 +190,7 @@ export type MemoryTypeAlias = string;
195
190
  * - `CUSTOM`: For any other type of memory not covered by the built-in types.
196
191
  * This enum is used in `MemoryMetadata` to categorize memories and influences how they are processed or queried.
197
192
  */
198
- export declare enum MemoryType {
193
+ declare enum MemoryType {
199
194
  DOCUMENT = "document",
200
195
  FRAGMENT = "fragment",
201
196
  MESSAGE = "message",
@@ -209,7 +204,7 @@ export declare enum MemoryType {
209
204
  * - `room`: The memory is scoped to a specific room or channel.
210
205
  * This is used in `MemoryMetadata` to control how memories are stored and retrieved based on context.
211
206
  */
212
- export type MemoryScope = 'shared' | 'private' | 'room';
207
+ type MemoryScope = 'shared' | 'private' | 'room';
213
208
  /**
214
209
  * Base interface for all memory metadata types.
215
210
  * It includes common properties for all memories, such as:
@@ -221,7 +216,7 @@ export type MemoryScope = 'shared' | 'private' | 'room';
221
216
  * - `tags`: Optional array of strings for categorizing or filtering memories.
222
217
  * Specific metadata types like `DocumentMetadata` or `MessageMetadata` extend this base.
223
218
  */
224
- export interface BaseMetadata {
219
+ interface BaseMetadata {
225
220
  type: MemoryTypeAlias;
226
221
  source?: string;
227
222
  sourceId?: UUID;
@@ -229,28 +224,28 @@ export interface BaseMetadata {
229
224
  timestamp?: number;
230
225
  tags?: string[];
231
226
  }
232
- export interface DocumentMetadata extends BaseMetadata {
227
+ interface DocumentMetadata extends BaseMetadata {
233
228
  type: MemoryType.DOCUMENT;
234
229
  }
235
- export interface FragmentMetadata extends BaseMetadata {
230
+ interface FragmentMetadata extends BaseMetadata {
236
231
  type: MemoryType.FRAGMENT;
237
232
  documentId: UUID;
238
233
  position: number;
239
234
  }
240
- export interface MessageMetadata extends BaseMetadata {
235
+ interface MessageMetadata extends BaseMetadata {
241
236
  type: MemoryType.MESSAGE;
242
237
  }
243
- export interface DescriptionMetadata extends BaseMetadata {
238
+ interface DescriptionMetadata extends BaseMetadata {
244
239
  type: MemoryType.DESCRIPTION;
245
240
  }
246
- export interface CustomMetadata extends BaseMetadata {
241
+ interface CustomMetadata extends BaseMetadata {
247
242
  [key: string]: unknown;
248
243
  }
249
- export type MemoryMetadata = DocumentMetadata | FragmentMetadata | MessageMetadata | DescriptionMetadata | CustomMetadata;
244
+ type MemoryMetadata = DocumentMetadata | FragmentMetadata | MessageMetadata | DescriptionMetadata | CustomMetadata;
250
245
  /**
251
246
  * Represents a stored memory/message
252
247
  */
253
- export interface Memory {
248
+ interface Memory {
254
249
  /** Optional unique identifier */
255
250
  id?: UUID;
256
251
  /** Associated user ID */
@@ -277,7 +272,7 @@ export interface Memory {
277
272
  /**
278
273
  * Represents a log entry
279
274
  */
280
- export interface Log {
275
+ interface Log {
281
276
  /** Optional unique identifier */
282
277
  id?: UUID;
283
278
  /** Associated entity ID */
@@ -296,7 +291,7 @@ export interface Log {
296
291
  /**
297
292
  * Example message for demonstration
298
293
  */
299
- export interface MessageExample {
294
+ interface MessageExample {
300
295
  /** Associated user */
301
296
  name: string;
302
297
  /** Message content */
@@ -305,21 +300,21 @@ export interface MessageExample {
305
300
  /**
306
301
  * Handler function type for processing messages
307
302
  */
308
- export type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
303
+ type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
309
304
  [key: string]: unknown;
310
305
  }, callback?: HandlerCallback, responses?: Memory[]) => Promise<unknown>;
311
306
  /**
312
307
  * Callback function type for handlers
313
308
  */
314
- export type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
309
+ type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
315
310
  /**
316
311
  * Validator function type for actions/evaluators
317
312
  */
318
- export type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
313
+ type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
319
314
  /**
320
315
  * Represents an action the agent can perform
321
316
  */
322
- export interface Action {
317
+ interface Action {
323
318
  /** Similar action descriptions */
324
319
  similes?: string[];
325
320
  /** Detailed description */
@@ -336,7 +331,7 @@ export interface Action {
336
331
  /**
337
332
  * Example for evaluating agent behavior
338
333
  */
339
- export interface EvaluationExample {
334
+ interface EvaluationExample {
340
335
  /** Evaluation context */
341
336
  prompt: string;
342
337
  /** Example messages */
@@ -347,7 +342,7 @@ export interface EvaluationExample {
347
342
  /**
348
343
  * Evaluator for assessing agent responses
349
344
  */
350
- export interface Evaluator {
345
+ interface Evaluator {
351
346
  /** Whether to always run */
352
347
  alwaysRun?: boolean;
353
348
  /** Detailed description */
@@ -363,7 +358,7 @@ export interface Evaluator {
363
358
  /** Validation function */
364
359
  validate: Validator;
365
360
  }
366
- export interface ProviderResult {
361
+ interface ProviderResult {
367
362
  values?: {
368
363
  [key: string]: any;
369
364
  };
@@ -375,7 +370,7 @@ export interface ProviderResult {
375
370
  /**
376
371
  * Provider for external data/services
377
372
  */
378
- export interface Provider {
373
+ interface Provider {
379
374
  /** Provider name */
380
375
  name: string;
381
376
  /** Description of the provider */
@@ -396,7 +391,7 @@ export interface Provider {
396
391
  /**
397
392
  * Represents a relationship between users
398
393
  */
399
- export interface Relationship {
394
+ interface Relationship {
400
395
  /** Unique identifier */
401
396
  id: UUID;
402
397
  /** First user ID */
@@ -414,7 +409,7 @@ export interface Relationship {
414
409
  /** Optional creation timestamp */
415
410
  createdAt?: string;
416
411
  }
417
- export interface Component {
412
+ interface Component {
418
413
  id: UUID;
419
414
  entityId: UUID;
420
415
  agentId: UUID;
@@ -430,7 +425,7 @@ export interface Component {
430
425
  /**
431
426
  * Represents a user account
432
427
  */
433
- export interface Entity {
428
+ interface Entity {
434
429
  /** Unique identifier, optional on creation */
435
430
  id?: UUID;
436
431
  /** Names of the entity */
@@ -444,7 +439,7 @@ export interface Entity {
444
439
  /** Optional array of components */
445
440
  components?: Component[];
446
441
  }
447
- export type World = {
442
+ type World = {
448
443
  id: UUID;
449
444
  name?: string;
450
445
  agentId: UUID;
@@ -459,8 +454,10 @@ export type World = {
459
454
  [key: string]: unknown;
460
455
  };
461
456
  };
462
- export type RoomMetadata = Record<string, unknown>;
463
- export type Room = {
457
+ type RoomMetadata = {
458
+ [key: string]: unknown;
459
+ };
460
+ type Room = {
464
461
  id: UUID;
465
462
  name?: string;
466
463
  agentId?: UUID;
@@ -474,7 +471,7 @@ export type Room = {
474
471
  /**
475
472
  * Room participant with account details
476
473
  */
477
- export interface Participant {
474
+ interface Participant {
478
475
  /** Unique identifier */
479
476
  id: UUID;
480
477
  /** Associated account */
@@ -483,7 +480,7 @@ export interface Participant {
483
480
  /**
484
481
  * Represents a media attachment
485
482
  */
486
- export type Media = {
483
+ type Media = {
487
484
  /** Unique identifier */
488
485
  id: string;
489
486
  /** Media URL */
@@ -499,14 +496,14 @@ export type Media = {
499
496
  /** Content type */
500
497
  contentType?: ContentType;
501
498
  };
502
- export declare enum ContentType {
499
+ declare enum ContentType {
503
500
  IMAGE = "image",
504
501
  VIDEO = "video",
505
502
  AUDIO = "audio",
506
503
  DOCUMENT = "document",
507
504
  LINK = "link"
508
505
  }
509
- export declare enum ChannelType {
506
+ declare enum ChannelType {
510
507
  SELF = "SELF",// Messages to self
511
508
  DM = "dm",// Direct messages between two participants
512
509
  GROUP = "group",// Group messages with multiple participants
@@ -518,28 +515,7 @@ export declare enum ChannelType {
518
515
  FORUM = "FORUM",// Forum discussion
519
516
  API = "API"
520
517
  }
521
- /**
522
- * Client instance
523
- */
524
- export declare abstract class Service {
525
- /** Runtime instance */
526
- protected runtime: IAgentRuntime;
527
- constructor(runtime?: IAgentRuntime);
528
- abstract stop(): Promise<void>;
529
- /** Service type */
530
- static serviceType: string;
531
- /** Service name */
532
- abstract capabilityDescription: string;
533
- /** Service configuration */
534
- config?: {
535
- [key: string]: any;
536
- };
537
- /** Start service connection */
538
- static start(_runtime: IAgentRuntime): Promise<Service>;
539
- /** Stop service connection */
540
- static stop(_runtime: IAgentRuntime): Promise<unknown>;
541
- }
542
- export type Route = {
518
+ type Route = {
543
519
  type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
544
520
  path: string;
545
521
  filePath?: string;
@@ -553,12 +529,12 @@ export type Route = {
553
529
  /**
554
530
  * Plugin for extending agent functionality
555
531
  */
556
- export type PluginEvents = {
532
+ type PluginEvents = {
557
533
  [K in keyof EventPayloadMap]?: EventHandler<K>[];
558
534
  } & {
559
535
  [key: string]: ((params: EventPayload) => Promise<any>)[];
560
536
  };
561
- export interface Plugin {
537
+ interface Plugin {
562
538
  name: string;
563
539
  description: string;
564
540
  init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
@@ -584,16 +560,16 @@ export interface Plugin {
584
560
  dependencies?: string[];
585
561
  priority?: number;
586
562
  }
587
- export interface ProjectAgent {
563
+ interface ProjectAgent {
588
564
  character: Character;
589
565
  init?: (runtime: IAgentRuntime) => Promise<void>;
590
566
  plugins?: Plugin[];
591
567
  tests?: TestSuite | TestSuite[];
592
568
  }
593
- export interface Project {
569
+ interface Project {
594
570
  agents: ProjectAgent[];
595
571
  }
596
- export type TemplateType = string | ((options: {
572
+ type TemplateType = string | ((options: {
597
573
  state: State | {
598
574
  [key: string]: string;
599
575
  };
@@ -614,7 +590,7 @@ export type TemplateType = string | ((options: {
614
590
  * - `settings`, `secrets`: Configuration key-value pairs, with secrets being handled more securely.
615
591
  * - `style`: Guidelines for the character's writing style in different contexts (chat, post).
616
592
  */
617
- export interface Character {
593
+ interface Character {
618
594
  /** Optional unique identifier */
619
595
  id?: UUID;
620
596
  /** Character name */
@@ -662,7 +638,7 @@ export interface Character {
662
638
  post?: string[];
663
639
  };
664
640
  }
665
- export declare enum AgentStatus {
641
+ declare enum AgentStatus {
666
642
  ACTIVE = "active",
667
643
  INACTIVE = "inactive"
668
644
  }
@@ -675,7 +651,7 @@ export declare enum AgentStatus {
675
651
  * - `createdAt`, `updatedAt`: Timestamps for when the agent record was created and last updated in the database.
676
652
  * This interface is primarily used by the `IDatabaseAdapter` for agent management.
677
653
  */
678
- export interface Agent extends Character {
654
+ interface Agent extends Character {
679
655
  enabled?: boolean;
680
656
  status?: AgentStatus;
681
657
  createdAt: number;
@@ -684,14 +660,14 @@ export interface Agent extends Character {
684
660
  /**
685
661
  * Interface for database operations
686
662
  */
687
- export interface IDatabaseAdapter {
663
+ interface IDatabaseAdapter {
688
664
  /** Database instance */
689
665
  db: any;
690
666
  /** Initialize database connection */
691
667
  init(): Promise<void>;
692
668
  /** Close database connection */
693
669
  close(): Promise<void>;
694
- getConnection(): Promise<PGlite | PgPool>;
670
+ getConnection(): Promise<PGlite | Pool>;
695
671
  getAgent(agentId: UUID): Promise<Agent | null>;
696
672
  /** Get all agents */
697
673
  getAgents(): Promise<Partial<Agent>[]>;
@@ -862,14 +838,14 @@ export interface IDatabaseAdapter {
862
838
  /**
863
839
  * Result interface for embedding similarity searches
864
840
  */
865
- export interface EmbeddingSearchResult {
841
+ interface EmbeddingSearchResult {
866
842
  embedding: number[];
867
843
  levenshtein_score: number;
868
844
  }
869
845
  /**
870
846
  * Options for memory retrieval operations
871
847
  */
872
- export interface MemoryRetrievalOptions {
848
+ interface MemoryRetrievalOptions {
873
849
  roomId: UUID;
874
850
  count?: number;
875
851
  unique?: boolean;
@@ -880,7 +856,7 @@ export interface MemoryRetrievalOptions {
880
856
  /**
881
857
  * Options for memory search operations
882
858
  */
883
- export interface MemorySearchOptions {
859
+ interface MemorySearchOptions {
884
860
  embedding: number[];
885
861
  match_threshold?: number;
886
862
  count?: number;
@@ -892,7 +868,7 @@ export interface MemorySearchOptions {
892
868
  /**
893
869
  * Options for multi-room memory retrieval
894
870
  */
895
- export interface MultiRoomMemoryOptions {
871
+ interface MultiRoomMemoryOptions {
896
872
  roomIds: UUID[];
897
873
  limit?: number;
898
874
  agentId?: UUID;
@@ -901,7 +877,7 @@ export interface MultiRoomMemoryOptions {
901
877
  * Unified options pattern for memory operations
902
878
  * Provides a simpler, more consistent interface
903
879
  */
904
- export interface UnifiedMemoryOptions {
880
+ interface UnifiedMemoryOptions {
905
881
  roomId: UUID;
906
882
  limit?: number;
907
883
  agentId?: UUID;
@@ -912,14 +888,14 @@ export interface UnifiedMemoryOptions {
912
888
  /**
913
889
  * Specialized memory search options
914
890
  */
915
- export interface UnifiedSearchOptions extends UnifiedMemoryOptions {
891
+ interface UnifiedSearchOptions extends UnifiedMemoryOptions {
916
892
  embedding: number[];
917
893
  similarity?: number;
918
894
  }
919
895
  /**
920
896
  * Information describing the target of a message.
921
897
  */
922
- export interface TargetInfo {
898
+ interface TargetInfo {
923
899
  source: string;
924
900
  roomId?: UUID;
925
901
  channelId?: string;
@@ -930,13 +906,13 @@ export interface TargetInfo {
930
906
  /**
931
907
  * Function signature for handlers responsible for sending messages to specific platforms.
932
908
  */
933
- export type SendHandlerFunction = (runtime: IAgentRuntime, target: TargetInfo, content: Content) => Promise<void>;
909
+ type SendHandlerFunction = (runtime: IAgentRuntime, target: TargetInfo, content: Content) => Promise<void>;
934
910
  /**
935
911
  * Represents the core runtime environment for an agent.
936
912
  * Defines methods for database interaction, plugin management, event handling,
937
913
  * state composition, model usage, and task management.
938
914
  */
939
- export interface IAgentRuntime extends IDatabaseAdapter {
915
+ interface IAgentRuntime extends IDatabaseAdapter {
940
916
  agentId: UUID;
941
917
  character: Character;
942
918
  providers: Provider[];
@@ -949,7 +925,7 @@ export interface IAgentRuntime extends IDatabaseAdapter {
949
925
  routes: Route[];
950
926
  registerPlugin(plugin: Plugin): Promise<void>;
951
927
  initialize(): Promise<void>;
952
- getConnection(): Promise<PGlite | PgPool>;
928
+ getConnection(): Promise<PGlite | Pool>;
953
929
  getService<T extends Service>(service: ServiceTypeName | string): T | null;
954
930
  getAllServices(): Map<ServiceTypeName, Service>;
955
931
  registerService(service: typeof Service): Promise<void>;
@@ -1024,7 +1000,7 @@ export interface IAgentRuntime extends IDatabaseAdapter {
1024
1000
  /**
1025
1001
  * Interface representing settings with string key-value pairs.
1026
1002
  */
1027
- export interface RuntimeSettings {
1003
+ interface RuntimeSettings {
1028
1004
  [key: string]: string | undefined;
1029
1005
  }
1030
1006
  /**
@@ -1034,7 +1010,7 @@ export interface RuntimeSettings {
1034
1010
  * and retrieved using `AgentRuntime.getKnowledge`.
1035
1011
  * The `id` is a unique identifier for the knowledge item, often derived from its source or content.
1036
1012
  */
1037
- export type KnowledgeItem = {
1013
+ type KnowledgeItem = {
1038
1014
  /** A Universally Unique Identifier for this specific knowledge item. */
1039
1015
  id: UUID;
1040
1016
  /** The actual content of the knowledge item, which must include text and can have other fields. */
@@ -1048,7 +1024,7 @@ export type KnowledgeItem = {
1048
1024
  * - `PRIVATE`: Indicates knowledge that is restricted, typically to the specific agent or user context it belongs to.
1049
1025
  * This enum is used to manage access and retrieval of knowledge items, often in conjunction with `AgentRuntime.addKnowledge` or `AgentRuntime.getKnowledge` scopes.
1050
1026
  */
1051
- export declare enum KnowledgeScope {
1027
+ declare enum KnowledgeScope {
1052
1028
  SHARED = "shared",
1053
1029
  PRIVATE = "private"
1054
1030
  }
@@ -1058,7 +1034,7 @@ export declare enum KnowledgeScope {
1058
1034
  * This helps in organizing the cache and avoiding key collisions.
1059
1035
  * Used internally by caching strategies, potentially within `IDatabaseAdapter` cache methods or runtime caching layers.
1060
1036
  */
1061
- export declare enum CacheKeyPrefix {
1037
+ declare enum CacheKeyPrefix {
1062
1038
  KNOWLEDGE = "knowledge"
1063
1039
  }
1064
1040
  /**
@@ -1068,7 +1044,7 @@ export declare enum CacheKeyPrefix {
1068
1044
  * - `directory`: The path to the directory containing knowledge files.
1069
1045
  * - `shared`: An optional boolean (defaults to false) indicating if the knowledge from this directory is considered shared or private.
1070
1046
  */
1071
- export interface DirectoryItem {
1047
+ interface DirectoryItem {
1072
1048
  /** The path to the directory containing knowledge files. */
1073
1049
  directory: string;
1074
1050
  /** If true, knowledge from this directory is considered shared; otherwise, it's private. Defaults to false. */
@@ -1080,7 +1056,7 @@ export interface DirectoryItem {
1080
1056
  * The `id` would be the unique identifier for the chunk.
1081
1057
  * It might be used when splitting large documents into smaller, manageable pieces for embedding or analysis.
1082
1058
  */
1083
- export interface ChunkRow {
1059
+ interface ChunkRow {
1084
1060
  /** The unique identifier for this chunk of text. */
1085
1061
  id: string;
1086
1062
  }
@@ -1091,7 +1067,7 @@ export interface ChunkRow {
1091
1067
  * `ModelType.TEXT_REASONING_LARGE`, or `ModelType.TEXT_COMPLETION`.
1092
1068
  * It includes essential information like the prompt, model type, and various generation controls.
1093
1069
  */
1094
- export type GenerateTextParams = {
1070
+ type GenerateTextParams = {
1095
1071
  /** The `AgentRuntime` instance, providing access to models and other services. */
1096
1072
  runtime: IAgentRuntime;
1097
1073
  /** The input string or prompt that the language model will use to generate text. */
@@ -1114,7 +1090,7 @@ export type GenerateTextParams = {
1114
1090
  * This is a common preprocessing step for many language models.
1115
1091
  * This structure is used with `AgentRuntime.useModel` when the `modelType` is `ModelType.TEXT_TOKENIZER_ENCODE`.
1116
1092
  */
1117
- export interface TokenizeTextParams {
1093
+ interface TokenizeTextParams {
1118
1094
  /** The input string to be tokenized. */
1119
1095
  prompt: string;
1120
1096
  /** The model type to use for tokenization, which determines the tokenizer algorithm and vocabulary. */
@@ -1125,7 +1101,7 @@ export interface TokenizeTextParams {
1125
1101
  * This is the reverse operation of tokenization.
1126
1102
  * This structure is used with `AgentRuntime.useModel` when the `modelType` is `ModelType.TEXT_TOKENIZER_DECODE`.
1127
1103
  */
1128
- export interface DetokenizeTextParams {
1104
+ interface DetokenizeTextParams {
1129
1105
  /** An array of numerical tokens to be converted back into text. */
1130
1106
  tokens: number[];
1131
1107
  /** The model type used for detokenization, ensuring consistency with the original tokenization. */
@@ -1137,7 +1113,7 @@ export interface DetokenizeTextParams {
1137
1113
  * The test function receives the `IAgentRuntime` instance, allowing it to interact with the agent's capabilities.
1138
1114
  * Test cases are typically grouped into `TestSuite`s.
1139
1115
  */
1140
- export interface TestCase {
1116
+ interface TestCase {
1141
1117
  /** A descriptive name for the test case, e.g., "should respond to greetings". */
1142
1118
  name: string;
1143
1119
  /**
@@ -1152,7 +1128,7 @@ export interface TestCase {
1152
1128
  * This helps in organizing tests and running them collectively.
1153
1129
  * A `ProjectAgent` can define one or more `TestSuite`s.
1154
1130
  */
1155
- export interface TestSuite {
1131
+ interface TestSuite {
1156
1132
  /** A descriptive name for the test suite, e.g., "Core Functionality Tests". */
1157
1133
  name: string;
1158
1134
  /** An array of `TestCase` objects that belong to this suite. */
@@ -1164,7 +1140,7 @@ export interface TestSuite {
1164
1140
  * It allows for multiple registrations of the same `agentId` to support scenarios where an agent might restart,
1165
1141
  * generating a new keypair and attestation each time.
1166
1142
  */
1167
- export interface TeeAgent {
1143
+ interface TeeAgent {
1168
1144
  /** Primary key for the TEE agent registration record (e.g., a UUID or auto-incrementing ID). */
1169
1145
  id: string;
1170
1146
  /** The core identifier of the agent, which can be duplicated across multiple TEE registrations. */
@@ -1183,7 +1159,7 @@ export interface TeeAgent {
1183
1159
  * This enum is used to configure how TEE functionalities are engaged, allowing for
1184
1160
  * different setups for local development, Docker-based development, and production.
1185
1161
  */
1186
- export declare enum TEEMode {
1162
+ declare enum TEEMode {
1187
1163
  /** TEE functionality is completely disabled. */
1188
1164
  OFF = "OFF",
1189
1165
  /** For local development, potentially using a TEE simulator. */
@@ -1198,7 +1174,7 @@ export declare enum TEEMode {
1198
1174
  * This quote is a piece of evidence provided by the TEE, cryptographically signed, which can be
1199
1175
  * verified by a relying party to ensure the TEE's integrity and authenticity.
1200
1176
  */
1201
- export interface RemoteAttestationQuote {
1177
+ interface RemoteAttestationQuote {
1202
1178
  /** The attestation quote data, typically a base64 encoded string or similar format. */
1203
1179
  quote: string;
1204
1180
  /** Timestamp (e.g., Unix epoch in milliseconds) when the quote was generated or received. */
@@ -1209,7 +1185,7 @@ export interface RemoteAttestationQuote {
1209
1185
  * This information helps establish a secure channel or verify the identity of the agent instance
1210
1186
  * requesting key derivation.
1211
1187
  */
1212
- export interface DeriveKeyAttestationData {
1188
+ interface DeriveKeyAttestationData {
1213
1189
  /** The unique identifier of the agent for which the key derivation is being attested. */
1214
1190
  agentId: string;
1215
1191
  /** The public key of the agent instance involved in the key derivation process. */
@@ -1222,7 +1198,7 @@ export interface DeriveKeyAttestationData {
1222
1198
  * This structure binds a message to an agent's identity and a timestamp, all within the
1223
1199
  * context of a remote attestation process, ensuring the message originated from a trusted TEE instance.
1224
1200
  */
1225
- export interface RemoteAttestationMessage {
1201
+ interface RemoteAttestationMessage {
1226
1202
  /** The unique identifier of the agent sending the attested message. */
1227
1203
  agentId: string;
1228
1204
  /** Timestamp (e.g., Unix epoch in milliseconds) when the message was attested or sent. */
@@ -1238,7 +1214,7 @@ export interface RemoteAttestationMessage {
1238
1214
  * Enumerates different types or vendors of Trusted Execution Environments (TEEs).
1239
1215
  * This allows the system to adapt to specific TEE technologies, like Intel TDX on DSTACK.
1240
1216
  */
1241
- export declare enum TeeType {
1217
+ declare enum TeeType {
1242
1218
  /** Represents Intel Trusted Domain Extensions (TDX) running on DSTACK infrastructure. */
1243
1219
  TDX_DSTACK = "tdx_dstack"
1244
1220
  }
@@ -1247,7 +1223,7 @@ export declare enum TeeType {
1247
1223
  * This allows for vendor-specific settings to be passed to the TEE plugin or service.
1248
1224
  * The structure is a generic key-value map, as configurations can vary widely between vendors.
1249
1225
  */
1250
- export interface TeeVendorConfig {
1226
+ interface TeeVendorConfig {
1251
1227
  [key: string]: unknown;
1252
1228
  }
1253
1229
  /**
@@ -1255,7 +1231,7 @@ export interface TeeVendorConfig {
1255
1231
  * This allows specifying the TEE vendor and any vendor-specific configurations.
1256
1232
  * It's used to initialize and configure TEE-related functionalities within the agent system.
1257
1233
  */
1258
- export interface TeePluginConfig {
1234
+ interface TeePluginConfig {
1259
1235
  /** Optional. The name or identifier of the TEE vendor (e.g., 'tdx_dstack' from `TeeType`). */
1260
1236
  vendor?: string;
1261
1237
  /** Optional. Vendor-specific configuration options, conforming to `TeeVendorConfig`. */
@@ -1266,7 +1242,7 @@ export interface TeePluginConfig {
1266
1242
  * Task workers are registered with the `AgentRuntime` and are invoked when a `Task` of their designated `name` needs processing.
1267
1243
  * This pattern allows for modular and extensible background task processing.
1268
1244
  */
1269
- export interface TaskWorker {
1245
+ interface TaskWorker {
1270
1246
  /** The unique name of the task type this worker handles. This name links `Task` instances to this worker. */
1271
1247
  name: string;
1272
1248
  /**
@@ -1289,7 +1265,7 @@ export interface TaskWorker {
1289
1265
  * for presenting task options to a user.
1290
1266
  * The `[key: string]: unknown;` allows for additional, unspecified metadata fields.
1291
1267
  */
1292
- export type TaskMetadata = {
1268
+ type TaskMetadata = {
1293
1269
  /** Optional. If the task is recurring, this specifies the interval in milliseconds between updates or executions. */
1294
1270
  updateInterval?: number;
1295
1271
  /** Optional. Describes options or parameters that can be configured for this task, often for UI presentation. */
@@ -1306,7 +1282,7 @@ export type TaskMetadata = {
1306
1282
  * They can be associated with a room, world, and tagged for categorization and retrieval.
1307
1283
  * The `IDatabaseAdapter` handles persistence of task data.
1308
1284
  */
1309
- export interface Task {
1285
+ interface Task {
1310
1286
  /** Optional. A Universally Unique Identifier for the task. Generated if not provided. */
1311
1287
  id?: UUID;
1312
1288
  /** The name of the task, which should correspond to a registered `TaskWorker.name`. */
@@ -1331,12 +1307,12 @@ export interface Task {
1331
1307
  * - `NONE`: Indicates no specific role or default, minimal permissions.
1332
1308
  * These roles are often used in `World.metadata.roles` to assign roles to entities.
1333
1309
  */
1334
- export declare enum Role {
1310
+ declare enum Role {
1335
1311
  OWNER = "OWNER",
1336
1312
  ADMIN = "ADMIN",
1337
1313
  NONE = "NONE"
1338
1314
  }
1339
- export interface Setting {
1315
+ interface Setting {
1340
1316
  name: string;
1341
1317
  description: string;
1342
1318
  usageDescription: string;
@@ -1351,10 +1327,10 @@ export interface Setting {
1351
1327
  [key: string]: Setting;
1352
1328
  }) => boolean;
1353
1329
  }
1354
- export interface WorldSettings {
1330
+ interface WorldSettings {
1355
1331
  [key: string]: Setting;
1356
1332
  }
1357
- export interface OnboardingConfig {
1333
+ interface OnboardingConfig {
1358
1334
  settings: {
1359
1335
  [key: string]: Omit<Setting, 'value'>;
1360
1336
  };
@@ -1362,14 +1338,14 @@ export interface OnboardingConfig {
1362
1338
  /**
1363
1339
  * Base parameters common to all model types
1364
1340
  */
1365
- export interface BaseModelParams {
1341
+ interface BaseModelParams {
1366
1342
  /** The agent runtime for accessing services and utilities */
1367
1343
  runtime: IAgentRuntime;
1368
1344
  }
1369
1345
  /**
1370
1346
  * Parameters for text generation models
1371
1347
  */
1372
- export interface TextGenerationParams extends BaseModelParams {
1348
+ interface TextGenerationParams extends BaseModelParams {
1373
1349
  /** The prompt to generate text from */
1374
1350
  prompt: string;
1375
1351
  /** Model temperature (0.0 to 1.0, lower is more deterministic) */
@@ -1386,32 +1362,14 @@ export interface TextGenerationParams extends BaseModelParams {
1386
1362
  /**
1387
1363
  * Parameters for text embedding models
1388
1364
  */
1389
- export interface TextEmbeddingParams extends BaseModelParams {
1365
+ interface TextEmbeddingParams extends BaseModelParams {
1390
1366
  /** The text to create embeddings for */
1391
1367
  text: string;
1392
1368
  }
1393
- /**
1394
- * Parameters for text tokenization models
1395
- */
1396
- export interface TokenizeTextParams extends BaseModelParams {
1397
- /** The text to tokenize */
1398
- prompt: string;
1399
- /** The model type to use for tokenization */
1400
- modelType: ModelTypeName;
1401
- }
1402
- /**
1403
- * Parameters for text detokenization models
1404
- */
1405
- export interface DetokenizeTextParams extends BaseModelParams {
1406
- /** The tokens to convert back to text */
1407
- tokens: number[];
1408
- /** The model type to use for detokenization */
1409
- modelType: ModelTypeName;
1410
- }
1411
1369
  /**
1412
1370
  * Parameters for image generation models
1413
1371
  */
1414
- export interface ImageGenerationParams extends BaseModelParams {
1372
+ interface ImageGenerationParams extends BaseModelParams {
1415
1373
  /** The prompt describing the image to generate */
1416
1374
  prompt: string;
1417
1375
  /** The dimensions of the image to generate */
@@ -1422,7 +1380,7 @@ export interface ImageGenerationParams extends BaseModelParams {
1422
1380
  /**
1423
1381
  * Parameters for image description models
1424
1382
  */
1425
- export interface ImageDescriptionParams extends BaseModelParams {
1383
+ interface ImageDescriptionParams extends BaseModelParams {
1426
1384
  /** The URL or path of the image to describe */
1427
1385
  imageUrl: string;
1428
1386
  /** Optional prompt to guide the description */
@@ -1431,7 +1389,7 @@ export interface ImageDescriptionParams extends BaseModelParams {
1431
1389
  /**
1432
1390
  * Parameters for transcription models
1433
1391
  */
1434
- export interface TranscriptionParams extends BaseModelParams {
1392
+ interface TranscriptionParams extends BaseModelParams {
1435
1393
  /** The URL or path of the audio file to transcribe */
1436
1394
  audioUrl: string;
1437
1395
  /** Optional prompt to guide transcription */
@@ -1440,7 +1398,7 @@ export interface TranscriptionParams extends BaseModelParams {
1440
1398
  /**
1441
1399
  * Parameters for text-to-speech models
1442
1400
  */
1443
- export interface TextToSpeechParams extends BaseModelParams {
1401
+ interface TextToSpeechParams extends BaseModelParams {
1444
1402
  /** The text to convert to speech */
1445
1403
  text: string;
1446
1404
  /** The voice to use */
@@ -1451,7 +1409,7 @@ export interface TextToSpeechParams extends BaseModelParams {
1451
1409
  /**
1452
1410
  * Parameters for audio processing models
1453
1411
  */
1454
- export interface AudioProcessingParams extends BaseModelParams {
1412
+ interface AudioProcessingParams extends BaseModelParams {
1455
1413
  /** The URL or path of the audio file to process */
1456
1414
  audioUrl: string;
1457
1415
  /** The type of audio processing to perform */
@@ -1460,7 +1418,7 @@ export interface AudioProcessingParams extends BaseModelParams {
1460
1418
  /**
1461
1419
  * Parameters for video processing models
1462
1420
  */
1463
- export interface VideoProcessingParams extends BaseModelParams {
1421
+ interface VideoProcessingParams extends BaseModelParams {
1464
1422
  /** The URL or path of the video file to process */
1465
1423
  videoUrl: string;
1466
1424
  /** The type of video processing to perform */
@@ -1469,7 +1427,7 @@ export interface VideoProcessingParams extends BaseModelParams {
1469
1427
  /**
1470
1428
  * Optional JSON schema for validating generated objects
1471
1429
  */
1472
- export type JSONSchema = {
1430
+ type JSONSchema = {
1473
1431
  type: string;
1474
1432
  properties?: Record<string, any>;
1475
1433
  required?: string[];
@@ -1480,7 +1438,7 @@ export type JSONSchema = {
1480
1438
  * Parameters for object generation models
1481
1439
  * @template T - The expected return type, inferred from schema if provided
1482
1440
  */
1483
- export interface ObjectGenerationParams<T = any> extends BaseModelParams {
1441
+ interface ObjectGenerationParams<T = any> extends BaseModelParams {
1484
1442
  /** The prompt describing the object to generate */
1485
1443
  prompt: string;
1486
1444
  /** Optional JSON schema for validation */
@@ -1499,7 +1457,7 @@ export interface ObjectGenerationParams<T = any> extends BaseModelParams {
1499
1457
  /**
1500
1458
  * Map of model types to their parameter types
1501
1459
  */
1502
- export interface ModelParamsMap {
1460
+ interface ModelParamsMap {
1503
1461
  [ModelType.TEXT_SMALL]: TextGenerationParams;
1504
1462
  [ModelType.TEXT_LARGE]: TextGenerationParams;
1505
1463
  [ModelType.TEXT_EMBEDDING]: TextEmbeddingParams | string | null;
@@ -1520,7 +1478,7 @@ export interface ModelParamsMap {
1520
1478
  /**
1521
1479
  * Map of model types to their return value types
1522
1480
  */
1523
- export interface ModelResultMap {
1481
+ interface ModelResultMap {
1524
1482
  [ModelType.TEXT_SMALL]: string;
1525
1483
  [ModelType.TEXT_LARGE]: string;
1526
1484
  [ModelType.TEXT_EMBEDDING]: number[];
@@ -1546,7 +1504,7 @@ export interface ModelResultMap {
1546
1504
  /**
1547
1505
  * Standard event types across all platforms
1548
1506
  */
1549
- export declare enum EventType {
1507
+ declare enum EventType {
1550
1508
  WORLD_JOINED = "WORLD_JOINED",
1551
1509
  WORLD_CONNECTED = "WORLD_CONNECTED",
1552
1510
  WORLD_LEFT = "WORLD_LEFT",
@@ -1574,7 +1532,7 @@ export declare enum EventType {
1574
1532
  /**
1575
1533
  * Platform-specific event type prefix
1576
1534
  */
1577
- export declare enum PlatformPrefix {
1535
+ declare enum PlatformPrefix {
1578
1536
  DISCORD = "DISCORD",
1579
1537
  TELEGRAM = "TELEGRAM",
1580
1538
  TWITTER = "TWITTER"
@@ -1582,7 +1540,7 @@ export declare enum PlatformPrefix {
1582
1540
  /**
1583
1541
  * Base payload interface for all events
1584
1542
  */
1585
- export interface EventPayload {
1543
+ interface EventPayload {
1586
1544
  runtime: IAgentRuntime;
1587
1545
  source: string;
1588
1546
  onComplete?: () => void;
@@ -1590,7 +1548,7 @@ export interface EventPayload {
1590
1548
  /**
1591
1549
  * Payload for world-related events
1592
1550
  */
1593
- export interface WorldPayload extends EventPayload {
1551
+ interface WorldPayload extends EventPayload {
1594
1552
  world: World;
1595
1553
  rooms: Room[];
1596
1554
  entities: Entity[];
@@ -1598,7 +1556,7 @@ export interface WorldPayload extends EventPayload {
1598
1556
  /**
1599
1557
  * Payload for entity-related events
1600
1558
  */
1601
- export interface EntityPayload extends EventPayload {
1559
+ interface EntityPayload extends EventPayload {
1602
1560
  entityId: UUID;
1603
1561
  worldId?: UUID;
1604
1562
  roomId?: UUID;
@@ -1612,7 +1570,7 @@ export interface EntityPayload extends EventPayload {
1612
1570
  /**
1613
1571
  * Payload for reaction-related events
1614
1572
  */
1615
- export interface MessagePayload extends EventPayload {
1573
+ interface MessagePayload extends EventPayload {
1616
1574
  message: Memory;
1617
1575
  callback?: HandlerCallback;
1618
1576
  onComplete?: () => void;
@@ -1620,7 +1578,7 @@ export interface MessagePayload extends EventPayload {
1620
1578
  /**
1621
1579
  * Payload for events that are invoked without a message
1622
1580
  */
1623
- export interface InvokePayload extends EventPayload {
1581
+ interface InvokePayload extends EventPayload {
1624
1582
  worldId: UUID;
1625
1583
  userId: string;
1626
1584
  roomId: UUID;
@@ -1630,7 +1588,7 @@ export interface InvokePayload extends EventPayload {
1630
1588
  /**
1631
1589
  * Run event payload type
1632
1590
  */
1633
- export interface RunEventPayload extends EventPayload {
1591
+ interface RunEventPayload extends EventPayload {
1634
1592
  runId: UUID;
1635
1593
  messageId: UUID;
1636
1594
  roomId: UUID;
@@ -1644,7 +1602,7 @@ export interface RunEventPayload extends EventPayload {
1644
1602
  /**
1645
1603
  * Action event payload type
1646
1604
  */
1647
- export interface ActionEventPayload extends EventPayload {
1605
+ interface ActionEventPayload extends EventPayload {
1648
1606
  actionId: UUID;
1649
1607
  actionName: string;
1650
1608
  startTime?: number;
@@ -1654,7 +1612,7 @@ export interface ActionEventPayload extends EventPayload {
1654
1612
  /**
1655
1613
  * Evaluator event payload type
1656
1614
  */
1657
- export interface EvaluatorEventPayload extends EventPayload {
1615
+ interface EvaluatorEventPayload extends EventPayload {
1658
1616
  evaluatorId: UUID;
1659
1617
  evaluatorName: string;
1660
1618
  startTime?: number;
@@ -1664,7 +1622,7 @@ export interface EvaluatorEventPayload extends EventPayload {
1664
1622
  /**
1665
1623
  * Model event payload type
1666
1624
  */
1667
- export interface ModelEventPayload extends EventPayload {
1625
+ interface ModelEventPayload extends EventPayload {
1668
1626
  provider: string;
1669
1627
  type: ModelTypeName;
1670
1628
  prompt: string;
@@ -1681,7 +1639,7 @@ export interface ModelEventPayload extends EventPayload {
1681
1639
  * @property {Memory} message - The message received.
1682
1640
  * @property {HandlerCallback} callback - The callback function to be executed after handling the message.
1683
1641
  */
1684
- export type MessageReceivedHandlerParams = {
1642
+ type MessageReceivedHandlerParams = {
1685
1643
  runtime: IAgentRuntime;
1686
1644
  message: Memory;
1687
1645
  callback: HandlerCallback;
@@ -1690,7 +1648,7 @@ export type MessageReceivedHandlerParams = {
1690
1648
  /**
1691
1649
  * Maps event types to their corresponding payload types
1692
1650
  */
1693
- export interface EventPayloadMap {
1651
+ interface EventPayloadMap {
1694
1652
  [EventType.WORLD_JOINED]: WorldPayload;
1695
1653
  [EventType.WORLD_CONNECTED]: WorldPayload;
1696
1654
  [EventType.WORLD_LEFT]: WorldPayload;
@@ -1714,11 +1672,11 @@ export interface EventPayloadMap {
1714
1672
  /**
1715
1673
  * Event handler function type
1716
1674
  */
1717
- export type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
1675
+ type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
1718
1676
  /**
1719
1677
  * Update the Plugin interface with typed events
1720
1678
  */
1721
- export declare enum SOCKET_MESSAGE_TYPE {
1679
+ declare enum SOCKET_MESSAGE_TYPE {
1722
1680
  ROOM_JOINING = 1,
1723
1681
  SEND_MESSAGE = 2,
1724
1682
  MESSAGE = 3,
@@ -1729,7 +1687,7 @@ export declare enum SOCKET_MESSAGE_TYPE {
1729
1687
  /**
1730
1688
  * Specialized memory type for messages with enhanced type checking
1731
1689
  */
1732
- export interface MessageMemory extends Memory {
1690
+ interface MessageMemory extends Memory {
1733
1691
  metadata: MessageMetadata;
1734
1692
  content: Content & {
1735
1693
  text: string;
@@ -1738,7 +1696,7 @@ export interface MessageMemory extends Memory {
1738
1696
  /**
1739
1697
  * Factory function to create a new message memory with proper defaults
1740
1698
  */
1741
- export declare function createMessageMemory(params: {
1699
+ declare function createMessageMemory(params: {
1742
1700
  id?: UUID;
1743
1701
  entityId: UUID;
1744
1702
  agentId?: UUID;
@@ -1753,7 +1711,7 @@ export declare function createMessageMemory(params: {
1753
1711
  * @template ConfigType The configuration type for this service
1754
1712
  * @template ResultType The result type returned by the service operations
1755
1713
  */
1756
- export interface TypedService<ConfigType extends {
1714
+ interface TypedService<ConfigType extends {
1757
1715
  [key: string]: any;
1758
1716
  } = {
1759
1717
  [key: string]: any;
@@ -1775,41 +1733,41 @@ export interface TypedService<ConfigType extends {
1775
1733
  * @param serviceType The type of service to get
1776
1734
  * @returns The service instance or null if not available
1777
1735
  */
1778
- export declare function getTypedService<T extends TypedService<any, any>>(runtime: IAgentRuntime, serviceType: ServiceTypeName): T | null;
1736
+ declare function getTypedService<T extends TypedService<any, any>>(runtime: IAgentRuntime, serviceType: ServiceTypeName): T | null;
1779
1737
  /**
1780
1738
  * Type guard to check if a memory metadata is a DocumentMetadata
1781
1739
  * @param metadata The metadata to check
1782
1740
  * @returns True if the metadata is a DocumentMetadata
1783
1741
  */
1784
- export declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
1742
+ declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
1785
1743
  /**
1786
1744
  * Type guard to check if a memory metadata is a FragmentMetadata
1787
1745
  * @param metadata The metadata to check
1788
1746
  * @returns True if the metadata is a FragmentMetadata
1789
1747
  */
1790
- export declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
1748
+ declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
1791
1749
  /**
1792
1750
  * Type guard to check if a memory metadata is a MessageMetadata
1793
1751
  * @param metadata The metadata to check
1794
1752
  * @returns True if the metadata is a MessageMetadata
1795
1753
  */
1796
- export declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
1754
+ declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
1797
1755
  /**
1798
1756
  * Type guard to check if a memory metadata is a DescriptionMetadata
1799
1757
  * @param metadata The metadata to check
1800
1758
  * @returns True if the metadata is a DescriptionMetadata
1801
1759
  */
1802
- export declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
1760
+ declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
1803
1761
  /**
1804
1762
  * Type guard to check if a memory metadata is a CustomMetadata
1805
1763
  * @param metadata The metadata to check
1806
1764
  * @returns True if the metadata is a CustomMetadata
1807
1765
  */
1808
- export declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
1766
+ declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
1809
1767
  /**
1810
1768
  * Standardized service error type for consistent error handling
1811
1769
  */
1812
- export interface ServiceError {
1770
+ interface ServiceError {
1813
1771
  code: string;
1814
1772
  message: string;
1815
1773
  details?: unknown;
@@ -1818,13 +1776,13 @@ export interface ServiceError {
1818
1776
  /**
1819
1777
  * Memory type guard for document memories
1820
1778
  */
1821
- export declare function isDocumentMemory(memory: Memory): memory is Memory & {
1779
+ declare function isDocumentMemory(memory: Memory): memory is Memory & {
1822
1780
  metadata: DocumentMetadata;
1823
1781
  };
1824
1782
  /**
1825
1783
  * Memory type guard for fragment memories
1826
1784
  */
1827
- export declare function isFragmentMemory(memory: Memory): memory is Memory & {
1785
+ declare function isFragmentMemory(memory: Memory): memory is Memory & {
1828
1786
  metadata: FragmentMetadata;
1829
1787
  };
1830
1788
  /**
@@ -1833,11 +1791,11 @@ export declare function isFragmentMemory(memory: Memory): memory is Memory & {
1833
1791
  * @param defaultValue Optional default value if no text is found
1834
1792
  * @returns The text content or default value
1835
1793
  */
1836
- export declare function getMemoryText(memory: Memory, defaultValue?: string): string;
1794
+ declare function getMemoryText(memory: Memory, defaultValue?: string): string;
1837
1795
  /**
1838
1796
  * Safely create a ServiceError from any caught error
1839
1797
  */
1840
- export declare function createServiceError(error: unknown, code?: string): ServiceError;
1798
+ declare function createServiceError(error: unknown, code?: string): ServiceError;
1841
1799
  /**
1842
1800
  * Replace 'any' types with more specific types
1843
1801
  */
@@ -1846,13 +1804,13 @@ export declare function createServiceError(error: unknown, code?: string): Servi
1846
1804
  * This type is used to provide more specific typing for properties within `StateObject` and `StateArray`,
1847
1805
  * moving away from a generic 'any' type for better type safety and clarity in state management.
1848
1806
  */
1849
- export type StateValue = string | number | boolean | null | StateObject | StateArray;
1807
+ type StateValue = string | number | boolean | null | StateObject | StateArray;
1850
1808
  /**
1851
1809
  * Represents a generic object structure within the agent's state, where keys are strings
1852
1810
  * and values can be any `StateValue`. This allows for nested objects within the state.
1853
1811
  * It's a fundamental part of the `EnhancedState` interface.
1854
1812
  */
1855
- export interface StateObject {
1813
+ interface StateObject {
1856
1814
  [key: string]: StateValue;
1857
1815
  }
1858
1816
  /**
@@ -1860,7 +1818,7 @@ export interface StateObject {
1860
1818
  * This allows for lists of mixed or uniform types to be stored in the state,
1861
1819
  * contributing to the structured definition of `EnhancedState`.
1862
1820
  */
1863
- export type StateArray = StateValue[];
1821
+ type StateArray = StateValue[];
1864
1822
  /**
1865
1823
  * Enhanced State interface with more specific types for its core properties.
1866
1824
  * This interface provides a more structured representation of an agent's conversational state,
@@ -1868,7 +1826,7 @@ export type StateArray = StateValue[];
1868
1826
  * The `text` property typically holds a textual summary or context derived from the state.
1869
1827
  * Additional dynamic properties are still allowed via the index signature `[key: string]: StateValue;`.
1870
1828
  */
1871
- export interface EnhancedState {
1829
+ interface EnhancedState {
1872
1830
  /** Holds directly accessible state values, often used for template rendering or quick lookups. */
1873
1831
  values: StateObject;
1874
1832
  /** Stores more complex or structured data, potentially namespaced by providers or internal systems. */
@@ -1884,35 +1842,35 @@ export interface EnhancedState {
1884
1842
  * to define more specific types for component data where possible to improve type safety
1885
1843
  * and code maintainability. This type serves as a base for various component implementations.
1886
1844
  */
1887
- export type ComponentData = Record<string, unknown>;
1845
+ type ComponentData = Record<string, unknown>;
1888
1846
  /**
1889
1847
  * Represents a generic data object that can be passed as a payload in an event.
1890
1848
  * This type is often used in `TypedEventHandler` to provide a flexible yet somewhat
1891
1849
  * structured way to handle event data. Specific event handlers might cast this to a
1892
1850
  * more concrete type based on the event being processed.
1893
1851
  */
1894
- export type EventDataObject = Record<string, unknown>;
1852
+ type EventDataObject = Record<string, unknown>;
1895
1853
  /**
1896
1854
  * Defines a more specific type for event handlers, expecting an `EventDataObject`.
1897
1855
  * This aims to improve upon generic 'any' type handlers, providing a clearer contract
1898
1856
  * for functions that respond to events emitted within the agent runtime (see `emitEvent` in `AgentRuntime`).
1899
1857
  * Handlers can be synchronous or asynchronous.
1900
1858
  */
1901
- export type TypedEventHandler = (data: EventDataObject) => Promise<void> | void;
1859
+ type TypedEventHandler = (data: EventDataObject) => Promise<void> | void;
1902
1860
  /**
1903
1861
  * Represents a generic database connection object.
1904
1862
  * The actual type of this connection will depend on the specific database adapter implementation
1905
1863
  * (e.g., a connection pool object for PostgreSQL, a client instance for a NoSQL database).
1906
1864
  * This `unknown` type serves as a placeholder in the abstract `IDatabaseAdapter`.
1907
1865
  */
1908
- export type DbConnection = unknown;
1866
+ type DbConnection = unknown;
1909
1867
  /**
1910
1868
  * A generic type for metadata objects, often used in various parts of the system like
1911
1869
  * `Relationship` metadata or other extensible data structures.
1912
1870
  * It allows for arbitrary key-value pairs where values are of `unknown` type,
1913
1871
  * encouraging consumers to perform type checking or casting.
1914
1872
  */
1915
- export type MetadataObject = Record<string, unknown>;
1873
+ type MetadataObject = Record<string, unknown>;
1916
1874
  /**
1917
1875
  * Defines the structure for a model handler registration within the `AgentRuntime`.
1918
1876
  * Each model (e.g., for text generation, embedding) is associated with a handler function,
@@ -1921,7 +1879,7 @@ export type MetadataObject = Record<string, unknown>;
1921
1879
  * handlers are registered for the same model type. The `registrationOrder` (not in type, but used in runtime)
1922
1880
  * serves as a tie-breaker. See `AgentRuntime.registerModel` and `AgentRuntime.getModel`.
1923
1881
  */
1924
- export interface ModelHandler {
1882
+ interface ModelHandler {
1925
1883
  /** The function that executes the model, taking runtime and parameters, and returning a Promise. */
1926
1884
  handler: (runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>;
1927
1885
  /** The name of the provider (e.g., plugin name) that registered this model handler. */
@@ -1940,8 +1898,8 @@ export interface ModelHandler {
1940
1898
  * structures. This type allows for a flexible way to pass configuration objects,
1941
1899
  * typically used during service initialization within a plugin or the `AgentRuntime`.
1942
1900
  */
1943
- export type ServiceConfig = Record<string, unknown>;
1944
- export declare const VECTOR_DIMS: {
1901
+ type ServiceConfig = Record<string, unknown>;
1902
+ declare const VECTOR_DIMS: {
1945
1903
  readonly SMALL: 384;
1946
1904
  readonly MEDIUM: 512;
1947
1905
  readonly LARGE: 768;
@@ -1953,7 +1911,7 @@ export declare const VECTOR_DIMS: {
1953
1911
  * Interface for control messages sent from the backend to the frontend
1954
1912
  * to manage UI state and interaction capabilities
1955
1913
  */
1956
- export interface ControlMessage {
1914
+ interface ControlMessage {
1957
1915
  /** Message type identifier */
1958
1916
  type: 'control';
1959
1917
  /** Control message payload */
@@ -1968,3 +1926,26 @@ export interface ControlMessage {
1968
1926
  /** Room ID to ensure signal is directed to the correct chat window */
1969
1927
  roomId: UUID;
1970
1928
  }
1929
+ /**
1930
+ * Client instance
1931
+ */
1932
+ declare abstract class Service {
1933
+ /** Runtime instance */
1934
+ protected runtime: IAgentRuntime;
1935
+ constructor(runtime?: IAgentRuntime);
1936
+ abstract stop(): Promise<void>;
1937
+ /** Service type */
1938
+ static serviceType: string;
1939
+ /** Service name */
1940
+ abstract capabilityDescription: string;
1941
+ /** Service configuration */
1942
+ config?: {
1943
+ [key: string]: any;
1944
+ };
1945
+ /** Start service connection */
1946
+ static start(_runtime: IAgentRuntime): Promise<Service>;
1947
+ /** Stop service connection */
1948
+ static stop(_runtime: IAgentRuntime): Promise<unknown>;
1949
+ }
1950
+
1951
+ export { type EnhancedState as $, type ActionExample as A, type BaseMetadata as B, type Content as C, ChannelType as D, type Entity as E, type ChunkRow as F, type ComponentData as G, type HandlerCallback as H, type IDatabaseAdapter as I, ContentType as J, type ControlMessage as K, type Log as L, type Memory as M, type CustomMetadata as N, type DbConnection as O, type Provider as P, type DeriveKeyAttestationData as Q, type Room as R, type State as S, type Task as T, type UUID as U, type DescriptionMetadata as V, type World as W, type DetokenizeTextParams as X, type DirectoryItem as Y, type DocumentMetadata as Z, type EmbeddingSearchResult as _, type Action as a, TeeType as a$, type EntityPayload as a0, type EvaluationExample as a1, type EvaluatorEventPayload as a2, type EventDataObject as a3, type EventHandler as a4, type EventPayload as a5, type EventPayloadMap as a6, EventType as a7, type FragmentMetadata as a8, type GenerateTextParams as a9, PlatformPrefix as aA, type PluginEvents as aB, type Project as aC, type ProjectAgent as aD, type ProviderResult as aE, type RemoteAttestationMessage as aF, type RemoteAttestationQuote as aG, type RoomMetadata as aH, type RunEventPayload as aI, SOCKET_MESSAGE_TYPE as aJ, type SendHandlerFunction as aK, type ServiceClassMap as aL, type ServiceConfig as aM, type ServiceError as aN, type ServiceInstance as aO, type ServiceRegistry as aP, ServiceType as aQ, type ServiceTypeRegistry as aR, type ServiceTypeValue as aS, type Setting as aT, type StateArray as aU, type StateObject as aV, type StateValue as aW, TEEMode as aX, type TaskMetadata as aY, type TeeAgent as aZ, type TeePluginConfig as a_, type Handler as aa, type ImageDescriptionParams as ab, type ImageGenerationParams as ac, type InvokePayload as ad, type IsValidServiceType as ae, type JSONSchema as af, type KnowledgeItem as ag, KnowledgeScope as ah, type Media as ai, type MemoryRetrievalOptions as aj, type MemoryScope as ak, type MemorySearchOptions as al, MemoryType as am, type MemoryTypeAlias as an, type MessageExample as ao, type MessageMemory as ap, type MessageMetadata as aq, type MessagePayload as ar, type MessageReceivedHandlerParams as as, type MetadataObject as at, type ModelEventPayload as au, type ModelHandler as av, ModelType as aw, type MultiRoomMemoryOptions as ax, type ObjectGenerationParams as ay, type OnboardingConfig as az, type Component as b, type TeeVendorConfig as b0, type TestCase as b1, type TestSuite as b2, type TextEmbeddingParams as b3, type TextGenerationParams as b4, type TextToSpeechParams as b5, type TokenizeTextParams as b6, type TranscriptionParams as b7, type TypedEventHandler as b8, type TypedService as b9, type TypedServiceClass as ba, type UnifiedMemoryOptions as bb, type UnifiedSearchOptions as bc, VECTOR_DIMS as bd, type Validator as be, type VideoProcessingParams as bf, type WorldPayload as bg, type WorldSettings as bh, asUUID as bi, createMessageMemory as bj, createServiceError as bk, getMemoryText as bl, getTypedService as bm, isCustomMetadata as bn, isDescriptionMetadata as bo, isDocumentMemory as bp, isDocumentMetadata as bq, isFragmentMemory as br, isFragmentMetadata as bs, isMessageMetadata as bt, type MemoryMetadata as c, type Participant as d, type Relationship as e, type Agent as f, type IAgentRuntime as g, Role as h, type ServiceTypeName as i, Service as j, type Route as k, type Character as l, type Evaluator as m, type Plugin as n, type RuntimeSettings as o, type ModelTypeName as p, type ModelResultMap as q, type ModelParamsMap as r, type TaskWorker as s, type TargetInfo as t, type TemplateType as u, type ActionEventPayload as v, AgentStatus as w, type AudioProcessingParams as x, type BaseModelParams as y, CacheKeyPrefix as z };