@elizaos/core 1.4.5 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/browser/index.browser.js +1109 -0
- package/dist/browser/index.browser.js.map +707 -0
- package/dist/browser/index.d.ts +1 -0
- package/dist/index.d.ts +3 -4885
- package/dist/index.js +8 -5287
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.node.js +74451 -0
- package/dist/node/index.node.js.map +1027 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +32 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,4886 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { browser as Sentry };
|
|
1
|
+
// Type definitions for @elizaos/core
|
|
2
|
+
// Re-export all types from the built Node entry by default
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
* Defines a custom type UUID representing a universally unique identifier
|
|
7
|
-
*/
|
|
8
|
-
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
9
|
-
/**
|
|
10
|
-
* Helper function to safely cast a string to strongly typed UUID
|
|
11
|
-
* @param id The string UUID to validate and cast
|
|
12
|
-
* @returns The same UUID with branded type information
|
|
13
|
-
*/
|
|
14
|
-
declare function asUUID(id: string): UUID;
|
|
15
|
-
/**
|
|
16
|
-
* Represents the content of a memory, message, or other information
|
|
17
|
-
*/
|
|
18
|
-
interface Content {
|
|
19
|
-
/** The agent's internal thought process */
|
|
20
|
-
thought?: string;
|
|
21
|
-
/** The main text content visible to users */
|
|
22
|
-
text?: string;
|
|
23
|
-
/** Optional actions to be performed */
|
|
24
|
-
actions?: string[];
|
|
25
|
-
/** Optional providers to use for context generation */
|
|
26
|
-
providers?: string[];
|
|
27
|
-
/** Optional source/origin of the content */
|
|
28
|
-
source?: string;
|
|
29
|
-
/** Optional target/destination for responses */
|
|
30
|
-
target?: string;
|
|
31
|
-
/** URL of the original message/post (e.g. tweet URL, Discord message link) */
|
|
32
|
-
url?: string;
|
|
33
|
-
/** UUID of parent message if this is a reply/thread */
|
|
34
|
-
inReplyTo?: UUID;
|
|
35
|
-
/** Array of media attachments */
|
|
36
|
-
attachments?: Media[];
|
|
37
|
-
/** room type */
|
|
38
|
-
channelType?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Additional dynamic properties
|
|
41
|
-
* Use specific properties above instead of this when possible
|
|
42
|
-
*/
|
|
43
|
-
[key: string]: unknown;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Represents a media attachment
|
|
47
|
-
*/
|
|
48
|
-
type Media = {
|
|
49
|
-
/** Unique identifier */
|
|
50
|
-
id: string;
|
|
51
|
-
/** Media URL */
|
|
52
|
-
url: string;
|
|
53
|
-
/** Media title */
|
|
54
|
-
title?: string;
|
|
55
|
-
/** Media source */
|
|
56
|
-
source?: string;
|
|
57
|
-
/** Media description */
|
|
58
|
-
description?: string;
|
|
59
|
-
/** Text content */
|
|
60
|
-
text?: string;
|
|
61
|
-
/** Content type */
|
|
62
|
-
contentType?: ContentType;
|
|
63
|
-
};
|
|
64
|
-
declare enum ContentType {
|
|
65
|
-
IMAGE = "image",
|
|
66
|
-
VIDEO = "video",
|
|
67
|
-
AUDIO = "audio",
|
|
68
|
-
DOCUMENT = "document",
|
|
69
|
-
LINK = "link"
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* A generic type for metadata objects, allowing for arbitrary key-value pairs.
|
|
73
|
-
* This encourages consumers to perform type checking or casting.
|
|
74
|
-
*/
|
|
75
|
-
type Metadata = Record<string, unknown>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Represents the current state or context of a conversation or agent interaction.
|
|
79
|
-
* This interface is a flexible container for various pieces of information that define the agent's
|
|
80
|
-
* understanding at a point in time. It includes:
|
|
81
|
-
* - `values`: A key-value store for general state variables, often populated by providers.
|
|
82
|
-
* - `data`: Another key-value store, potentially for more structured or internal data.
|
|
83
|
-
* - `text`: A string representation of the current context, often a summary or concatenated history.
|
|
84
|
-
* The `[key: string]: any;` allows for dynamic properties, though `EnhancedState` offers better typing.
|
|
85
|
-
* This state object is passed to handlers for actions, evaluators, and providers.
|
|
86
|
-
*/
|
|
87
|
-
interface State {
|
|
88
|
-
/** Additional dynamic properties */
|
|
89
|
-
[key: string]: any;
|
|
90
|
-
values: {
|
|
91
|
-
[key: string]: any;
|
|
92
|
-
};
|
|
93
|
-
data: {
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
};
|
|
96
|
-
text: string;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Defines the possible primitive types or structured types for a value within the agent's state.
|
|
100
|
-
* This type is used to provide more specific typing for properties within `StateObject` and `StateArray`,
|
|
101
|
-
* moving away from a generic 'any' type for better type safety and clarity in state management.
|
|
102
|
-
*/
|
|
103
|
-
type StateValue = string | number | boolean | null | StateObject | StateArray;
|
|
104
|
-
/**
|
|
105
|
-
* Represents a generic object structure within the agent's state, where keys are strings
|
|
106
|
-
* and values can be any `StateValue`. This allows for nested objects within the state.
|
|
107
|
-
* It's a fundamental part of the `EnhancedState` interface.
|
|
108
|
-
*/
|
|
109
|
-
interface StateObject {
|
|
110
|
-
[key: string]: StateValue;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Represents an array of `StateValue` types within the agent's state.
|
|
114
|
-
* This allows for lists of mixed or uniform types to be stored in the state,
|
|
115
|
-
* contributing to the structured definition of `EnhancedState`.
|
|
116
|
-
*/
|
|
117
|
-
type StateArray = StateValue[];
|
|
118
|
-
/**
|
|
119
|
-
* Enhanced State interface with more specific types for its core properties.
|
|
120
|
-
* This interface provides a more structured representation of an agent's conversational state,
|
|
121
|
-
* building upon the base `State` by typing `values` and `data` as `StateObject`.
|
|
122
|
-
* The `text` property typically holds a textual summary or context derived from the state.
|
|
123
|
-
* Additional dynamic properties are still allowed via the index signature `[key: string]: StateValue;`.
|
|
124
|
-
*/
|
|
125
|
-
interface EnhancedState {
|
|
126
|
-
/** Holds directly accessible state values, often used for template rendering or quick lookups. */
|
|
127
|
-
values: StateObject;
|
|
128
|
-
/** Stores more complex or structured data, potentially namespaced by providers or internal systems. */
|
|
129
|
-
data: StateObject;
|
|
130
|
-
/** A textual representation or summary of the current state, often used as context for models. */
|
|
131
|
-
text: string;
|
|
132
|
-
/** Allows for additional dynamic properties to be added to the state object. */
|
|
133
|
-
[key: string]: StateValue;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Memory type enumeration for built-in memory types
|
|
138
|
-
*/
|
|
139
|
-
type MemoryTypeAlias = string;
|
|
140
|
-
/**
|
|
141
|
-
* Enumerates the built-in types of memories that can be stored and retrieved.
|
|
142
|
-
* - `DOCUMENT`: Represents a whole document or a large piece of text.
|
|
143
|
-
* - `FRAGMENT`: A chunk or segment of a `DOCUMENT`, often created for embedding and search.
|
|
144
|
-
* - `MESSAGE`: A conversational message, typically from a user or the agent.
|
|
145
|
-
* - `DESCRIPTION`: A descriptive piece of information, perhaps about an entity or concept.
|
|
146
|
-
* - `CUSTOM`: For any other type of memory not covered by the built-in types.
|
|
147
|
-
* This enum is used in `MemoryMetadata` to categorize memories and influences how they are processed or queried.
|
|
148
|
-
*/
|
|
149
|
-
declare enum MemoryType {
|
|
150
|
-
DOCUMENT = "document",
|
|
151
|
-
FRAGMENT = "fragment",
|
|
152
|
-
MESSAGE = "message",
|
|
153
|
-
DESCRIPTION = "description",
|
|
154
|
-
CUSTOM = "custom"
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Defines the scope of a memory, indicating its visibility and accessibility.
|
|
158
|
-
* - `shared`: The memory is accessible to multiple entities or across different contexts (e.g., a public fact).
|
|
159
|
-
* - `private`: The memory is specific to a single entity or a private context (e.g., a user's personal preference).
|
|
160
|
-
* - `room`: The memory is scoped to a specific room or channel.
|
|
161
|
-
* This is used in `MemoryMetadata` to control how memories are stored and retrieved based on context.
|
|
162
|
-
*/
|
|
163
|
-
type MemoryScope = 'shared' | 'private' | 'room';
|
|
164
|
-
/**
|
|
165
|
-
* Base interface for all memory metadata types.
|
|
166
|
-
* It includes common properties for all memories, such as:
|
|
167
|
-
* - `type`: The kind of memory (e.g., `MemoryType.MESSAGE`, `MemoryType.DOCUMENT`).
|
|
168
|
-
* - `source`: An optional string indicating the origin of the memory (e.g., 'discord', 'user_input').
|
|
169
|
-
* - `sourceId`: An optional UUID linking to a source entity or object.
|
|
170
|
-
* - `scope`: The visibility scope of the memory (`shared`, `private`, or `room`).
|
|
171
|
-
* - `timestamp`: An optional numerical timestamp (e.g., milliseconds since epoch) of when the memory was created or relevant.
|
|
172
|
-
* - `tags`: Optional array of strings for categorizing or filtering memories.
|
|
173
|
-
* Specific metadata types like `DocumentMetadata` or `MessageMetadata` extend this base.
|
|
174
|
-
*/
|
|
175
|
-
interface BaseMetadata {
|
|
176
|
-
type: MemoryTypeAlias;
|
|
177
|
-
source?: string;
|
|
178
|
-
sourceId?: UUID;
|
|
179
|
-
scope?: MemoryScope;
|
|
180
|
-
timestamp?: number;
|
|
181
|
-
tags?: string[];
|
|
182
|
-
}
|
|
183
|
-
interface DocumentMetadata extends BaseMetadata {
|
|
184
|
-
type: MemoryType.DOCUMENT;
|
|
185
|
-
}
|
|
186
|
-
interface FragmentMetadata extends BaseMetadata {
|
|
187
|
-
type: MemoryType.FRAGMENT;
|
|
188
|
-
documentId: UUID;
|
|
189
|
-
position: number;
|
|
190
|
-
}
|
|
191
|
-
interface MessageMetadata extends BaseMetadata {
|
|
192
|
-
type: MemoryType.MESSAGE;
|
|
193
|
-
}
|
|
194
|
-
interface DescriptionMetadata extends BaseMetadata {
|
|
195
|
-
type: MemoryType.DESCRIPTION;
|
|
196
|
-
}
|
|
197
|
-
interface CustomMetadata extends BaseMetadata {
|
|
198
|
-
[key: string]: unknown;
|
|
199
|
-
}
|
|
200
|
-
type MemoryMetadata = DocumentMetadata | FragmentMetadata | MessageMetadata | DescriptionMetadata | CustomMetadata;
|
|
201
|
-
/**
|
|
202
|
-
* Represents a stored memory/message
|
|
203
|
-
*/
|
|
204
|
-
interface Memory {
|
|
205
|
-
/** Optional unique identifier */
|
|
206
|
-
id?: UUID;
|
|
207
|
-
/** Associated user ID */
|
|
208
|
-
entityId: UUID;
|
|
209
|
-
/** Associated agent ID */
|
|
210
|
-
agentId?: UUID;
|
|
211
|
-
/** Optional creation timestamp in milliseconds since epoch */
|
|
212
|
-
createdAt?: number;
|
|
213
|
-
/** Memory content */
|
|
214
|
-
content: Content;
|
|
215
|
-
/** Optional embedding vector for semantic search */
|
|
216
|
-
embedding?: number[];
|
|
217
|
-
/** Associated room ID */
|
|
218
|
-
roomId: UUID;
|
|
219
|
-
/** Associated world ID (optional) */
|
|
220
|
-
worldId?: UUID;
|
|
221
|
-
/** Whether memory is unique (used to prevent duplicates) */
|
|
222
|
-
unique?: boolean;
|
|
223
|
-
/** Embedding similarity score (set when retrieved via search) */
|
|
224
|
-
similarity?: number;
|
|
225
|
-
/** Metadata for the memory */
|
|
226
|
-
metadata?: MemoryMetadata;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Specialized memory type for messages with enhanced type checking
|
|
230
|
-
*/
|
|
231
|
-
interface MessageMemory extends Memory {
|
|
232
|
-
metadata: MessageMetadata;
|
|
233
|
-
content: Content & {
|
|
234
|
-
text: string;
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Factory function to create a new message memory with proper defaults
|
|
239
|
-
*/
|
|
240
|
-
declare function createMessageMemory(params: {
|
|
241
|
-
id?: UUID;
|
|
242
|
-
entityId: UUID;
|
|
243
|
-
agentId?: UUID;
|
|
244
|
-
roomId: UUID;
|
|
245
|
-
content: Content & {
|
|
246
|
-
text: string;
|
|
247
|
-
};
|
|
248
|
-
embedding?: number[];
|
|
249
|
-
}): MessageMemory;
|
|
250
|
-
/**
|
|
251
|
-
* Type guard to check if a memory metadata is a DocumentMetadata
|
|
252
|
-
* @param metadata The metadata to check
|
|
253
|
-
* @returns True if the metadata is a DocumentMetadata
|
|
254
|
-
*/
|
|
255
|
-
declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
|
|
256
|
-
/**
|
|
257
|
-
* Type guard to check if a memory metadata is a FragmentMetadata
|
|
258
|
-
* @param metadata The metadata to check
|
|
259
|
-
* @returns True if the metadata is a FragmentMetadata
|
|
260
|
-
*/
|
|
261
|
-
declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
|
|
262
|
-
/**
|
|
263
|
-
* Type guard to check if a memory metadata is a MessageMetadata
|
|
264
|
-
* @param metadata The metadata to check
|
|
265
|
-
* @returns True if the metadata is a MessageMetadata
|
|
266
|
-
*/
|
|
267
|
-
declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
|
|
268
|
-
/**
|
|
269
|
-
* Type guard to check if a memory metadata is a DescriptionMetadata
|
|
270
|
-
* @param metadata The metadata to check
|
|
271
|
-
* @returns True if the metadata is a DescriptionMetadata
|
|
272
|
-
*/
|
|
273
|
-
declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
|
|
274
|
-
/**
|
|
275
|
-
* Type guard to check if a memory metadata is a CustomMetadata
|
|
276
|
-
* @param metadata The metadata to check
|
|
277
|
-
* @returns True if the metadata is a CustomMetadata
|
|
278
|
-
*/
|
|
279
|
-
declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
|
|
280
|
-
/**
|
|
281
|
-
* Memory type guard for document memories
|
|
282
|
-
*/
|
|
283
|
-
declare function isDocumentMemory(memory: Memory): memory is Memory & {
|
|
284
|
-
metadata: DocumentMetadata;
|
|
285
|
-
};
|
|
286
|
-
/**
|
|
287
|
-
* Memory type guard for fragment memories
|
|
288
|
-
*/
|
|
289
|
-
declare function isFragmentMemory(memory: Memory): memory is Memory & {
|
|
290
|
-
metadata: FragmentMetadata;
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* Safely access the text content of a memory
|
|
294
|
-
* @param memory The memory to extract text from
|
|
295
|
-
* @param defaultValue Optional default value if no text is found
|
|
296
|
-
* @returns The text content or default value
|
|
297
|
-
*/
|
|
298
|
-
declare function getMemoryText(memory: Memory, defaultValue?: string): string;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Represents a single item of knowledge that can be processed and stored by the agent.
|
|
302
|
-
* Knowledge items consist of content (text and optional structured data) and metadata.
|
|
303
|
-
* These items are typically added to the agent's knowledge base via `AgentRuntime.addKnowledge`
|
|
304
|
-
* and retrieved using `AgentRuntime.getKnowledge`.
|
|
305
|
-
* The `id` is a unique identifier for the knowledge item, often derived from its source or content.
|
|
306
|
-
*/
|
|
307
|
-
type KnowledgeItem = {
|
|
308
|
-
/** A Universally Unique Identifier for this specific knowledge item. */
|
|
309
|
-
id: UUID;
|
|
310
|
-
/** The actual content of the knowledge item, which must include text and can have other fields. */
|
|
311
|
-
content: Content;
|
|
312
|
-
/** Optional metadata associated with this knowledge item, conforming to `MemoryMetadata`. */
|
|
313
|
-
metadata?: MemoryMetadata;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Defines the scope or visibility of knowledge items within the agent's system.
|
|
317
|
-
* - `SHARED`: Indicates knowledge that is broadly accessible, potentially across different agents or users if the system architecture permits.
|
|
318
|
-
* - `PRIVATE`: Indicates knowledge that is restricted, typically to the specific agent or user context it belongs to.
|
|
319
|
-
* This enum is used to manage access and retrieval of knowledge items, often in conjunction with `AgentRuntime.addKnowledge` or `AgentRuntime.getKnowledge` scopes.
|
|
320
|
-
*/
|
|
321
|
-
declare enum KnowledgeScope {
|
|
322
|
-
SHARED = "shared",
|
|
323
|
-
PRIVATE = "private"
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Specifies prefixes for keys used in caching mechanisms, helping to namespace cached data.
|
|
327
|
-
* For example, `KNOWLEDGE` might be used to prefix keys for cached knowledge embeddings or processed documents.
|
|
328
|
-
* This helps in organizing the cache and avoiding key collisions.
|
|
329
|
-
* Used internally by caching strategies, potentially within `IDatabaseAdapter` cache methods or runtime caching layers.
|
|
330
|
-
*/
|
|
331
|
-
declare enum CacheKeyPrefix {
|
|
332
|
-
KNOWLEDGE = "knowledge"
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Represents an item within a directory listing, specifically for knowledge loading.
|
|
336
|
-
* When an agent's `Character.knowledge` configuration includes a directory, this type
|
|
337
|
-
* is used to specify the path to that directory and whether its contents should be treated as shared.
|
|
338
|
-
* - `directory`: The path to the directory containing knowledge files.
|
|
339
|
-
* - `shared`: An optional boolean (defaults to false) indicating if the knowledge from this directory is considered shared or private.
|
|
340
|
-
*/
|
|
341
|
-
interface DirectoryItem {
|
|
342
|
-
/** The path to the directory containing knowledge files. */
|
|
343
|
-
directory: string;
|
|
344
|
-
/** If true, knowledge from this directory is considered shared; otherwise, it's private. Defaults to false. */
|
|
345
|
-
shared?: boolean;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Represents a row structure, typically from a database query related to text chunking or processing.
|
|
349
|
-
* This interface is quite minimal and seems to be a placeholder or a base for more specific chunk-related types.
|
|
350
|
-
* The `id` would be the unique identifier for the chunk.
|
|
351
|
-
* It might be used when splitting large documents into smaller, manageable pieces for embedding or analysis.
|
|
352
|
-
*/
|
|
353
|
-
interface ChunkRow {
|
|
354
|
-
/** The unique identifier for this chunk of text. */
|
|
355
|
-
id: string;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
interface Component {
|
|
359
|
-
id: UUID;
|
|
360
|
-
entityId: UUID;
|
|
361
|
-
agentId: UUID;
|
|
362
|
-
roomId: UUID;
|
|
363
|
-
worldId: UUID;
|
|
364
|
-
sourceEntityId: UUID;
|
|
365
|
-
type: string;
|
|
366
|
-
createdAt: number;
|
|
367
|
-
data: Metadata;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Represents a user account
|
|
371
|
-
*/
|
|
372
|
-
interface Entity {
|
|
373
|
-
/** Unique identifier, optional on creation */
|
|
374
|
-
id?: UUID;
|
|
375
|
-
/** Names of the entity */
|
|
376
|
-
names: string[];
|
|
377
|
-
/** Additional metadata */
|
|
378
|
-
metadata: Metadata;
|
|
379
|
-
/** Agent ID this account is related to, for agents should be themselves */
|
|
380
|
-
agentId: UUID;
|
|
381
|
-
/** Optional array of components */
|
|
382
|
-
components?: Component[];
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Defines roles within a system, typically for access control or permissions, often within a `World`.
|
|
386
|
-
* - `OWNER`: Represents the highest level of control, typically the creator or primary administrator.
|
|
387
|
-
* - `ADMIN`: Represents administrative privileges, usually a subset of owner capabilities.
|
|
388
|
-
* - `NONE`: Indicates no specific role or default, minimal permissions.
|
|
389
|
-
* These roles are often used in `World.metadata.roles` to assign roles to entities.
|
|
390
|
-
*/
|
|
391
|
-
declare enum Role {
|
|
392
|
-
OWNER = "OWNER",
|
|
393
|
-
ADMIN = "ADMIN",
|
|
394
|
-
NONE = "NONE"
|
|
395
|
-
}
|
|
396
|
-
type World = {
|
|
397
|
-
id: UUID;
|
|
398
|
-
name?: string;
|
|
399
|
-
agentId: UUID;
|
|
400
|
-
serverId: string;
|
|
401
|
-
metadata?: {
|
|
402
|
-
ownership?: {
|
|
403
|
-
ownerId: string;
|
|
404
|
-
};
|
|
405
|
-
roles?: {
|
|
406
|
-
[entityId: UUID]: Role;
|
|
407
|
-
};
|
|
408
|
-
[key: string]: unknown;
|
|
409
|
-
};
|
|
410
|
-
};
|
|
411
|
-
declare enum ChannelType {
|
|
412
|
-
SELF = "SELF",// Messages to self
|
|
413
|
-
DM = "DM",// Direct messages between two participants
|
|
414
|
-
GROUP = "GROUP",// Group messages with multiple participants
|
|
415
|
-
VOICE_DM = "VOICE_DM",// Voice direct messages
|
|
416
|
-
VOICE_GROUP = "VOICE_GROUP",// Voice channels with multiple participants
|
|
417
|
-
FEED = "FEED",// Social media feed
|
|
418
|
-
THREAD = "THREAD",// Threaded conversation
|
|
419
|
-
WORLD = "WORLD",// World channel
|
|
420
|
-
FORUM = "FORUM",// Forum discussion
|
|
421
|
-
API = "API"
|
|
422
|
-
}
|
|
423
|
-
type Room = {
|
|
424
|
-
id: UUID;
|
|
425
|
-
name?: string;
|
|
426
|
-
agentId?: UUID;
|
|
427
|
-
source: string;
|
|
428
|
-
type: ChannelType;
|
|
429
|
-
channelId?: string;
|
|
430
|
-
serverId?: string;
|
|
431
|
-
worldId?: UUID;
|
|
432
|
-
metadata?: Metadata;
|
|
433
|
-
};
|
|
434
|
-
type RoomMetadata = {
|
|
435
|
-
[key: string]: unknown;
|
|
436
|
-
};
|
|
437
|
-
/**
|
|
438
|
-
* Room participant with account details
|
|
439
|
-
*/
|
|
440
|
-
interface Participant {
|
|
441
|
-
/** Unique identifier */
|
|
442
|
-
id: UUID;
|
|
443
|
-
/** Associated account */
|
|
444
|
-
entity: Entity;
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Represents a relationship between users
|
|
448
|
-
*/
|
|
449
|
-
interface Relationship {
|
|
450
|
-
/** Unique identifier */
|
|
451
|
-
id: UUID;
|
|
452
|
-
/** First user ID */
|
|
453
|
-
sourceEntityId: UUID;
|
|
454
|
-
/** Second user ID */
|
|
455
|
-
targetEntityId: UUID;
|
|
456
|
-
/** Agent ID */
|
|
457
|
-
agentId: UUID;
|
|
458
|
-
/** Tags for filtering/categorizing relationships */
|
|
459
|
-
tags: string[];
|
|
460
|
-
/** Additional metadata about the relationship */
|
|
461
|
-
metadata: Metadata;
|
|
462
|
-
/** Optional creation timestamp */
|
|
463
|
-
createdAt?: string;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Example message for demonstration
|
|
468
|
-
*/
|
|
469
|
-
interface MessageExample {
|
|
470
|
-
/** Associated user */
|
|
471
|
-
name: string;
|
|
472
|
-
/** Message content */
|
|
473
|
-
content: Content;
|
|
474
|
-
}
|
|
475
|
-
type TemplateType = string | ((options: {
|
|
476
|
-
state: State | {
|
|
477
|
-
[key: string]: string;
|
|
478
|
-
};
|
|
479
|
-
}) => string);
|
|
480
|
-
/**
|
|
481
|
-
* Configuration for an agent's character, defining its personality, knowledge, and capabilities.
|
|
482
|
-
* This is a central piece of an agent's definition, used by the `AgentRuntime` to initialize and operate the agent.
|
|
483
|
-
* It includes:
|
|
484
|
-
* - `id`: Optional unique identifier for the character.
|
|
485
|
-
* - `name`, `username`: Identifying names for the character.
|
|
486
|
-
* - `system`: A system prompt that guides the agent's overall behavior.
|
|
487
|
-
* - `templates`: A map of prompt templates for various situations (e.g., message generation, summarization).
|
|
488
|
-
* - `bio`: A textual biography or description of the character.
|
|
489
|
-
* - `messageExamples`, `postExamples`: Examples of how the character communicates.
|
|
490
|
-
* - `topics`, `adjectives`: Keywords describing the character's knowledge areas and traits.
|
|
491
|
-
* - `knowledge`: Paths to knowledge files or directories to be loaded into the agent's memory.
|
|
492
|
-
* - `plugins`: A list of plugin names to be loaded for this character.
|
|
493
|
-
* - `settings`, `secrets`: Configuration key-value pairs, with secrets being handled more securely.
|
|
494
|
-
* - `style`: Guidelines for the character's writing style in different contexts (chat, post).
|
|
495
|
-
*/
|
|
496
|
-
interface Character {
|
|
497
|
-
/** Optional unique identifier */
|
|
498
|
-
id?: UUID;
|
|
499
|
-
/** Character name */
|
|
500
|
-
name: string;
|
|
501
|
-
/** Optional username */
|
|
502
|
-
username?: string;
|
|
503
|
-
/** Optional system prompt */
|
|
504
|
-
system?: string;
|
|
505
|
-
/** Optional prompt templates */
|
|
506
|
-
templates?: {
|
|
507
|
-
[key: string]: TemplateType;
|
|
508
|
-
};
|
|
509
|
-
/** Character biography */
|
|
510
|
-
bio: string | string[];
|
|
511
|
-
/** Example messages */
|
|
512
|
-
messageExamples?: MessageExample[][];
|
|
513
|
-
/** Example posts */
|
|
514
|
-
postExamples?: string[];
|
|
515
|
-
/** Known topics */
|
|
516
|
-
topics?: string[];
|
|
517
|
-
/** Character traits */
|
|
518
|
-
adjectives?: string[];
|
|
519
|
-
/** Optional knowledge base */
|
|
520
|
-
knowledge?: (string | {
|
|
521
|
-
path: string;
|
|
522
|
-
shared?: boolean;
|
|
523
|
-
} | DirectoryItem)[];
|
|
524
|
-
/** Available plugins */
|
|
525
|
-
plugins?: string[];
|
|
526
|
-
/** Optional configuration */
|
|
527
|
-
settings?: {
|
|
528
|
-
[key: string]: string | boolean | number | Record<string, any>;
|
|
529
|
-
};
|
|
530
|
-
/** Optional secrets */
|
|
531
|
-
secrets?: {
|
|
532
|
-
[key: string]: string | boolean | number;
|
|
533
|
-
};
|
|
534
|
-
/** Writing style guides */
|
|
535
|
-
style?: {
|
|
536
|
-
all?: string[];
|
|
537
|
-
chat?: string[];
|
|
538
|
-
post?: string[];
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
declare enum AgentStatus {
|
|
542
|
-
ACTIVE = "active",
|
|
543
|
-
INACTIVE = "inactive"
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Represents an operational agent, extending the `Character` definition with runtime status and timestamps.
|
|
547
|
-
* While `Character` defines the blueprint, `Agent` represents an instantiated and potentially running version.
|
|
548
|
-
* It includes:
|
|
549
|
-
* - `enabled`: A boolean indicating if the agent is currently active or disabled.
|
|
550
|
-
* - `status`: The current operational status, typically `AgentStatus.ACTIVE` or `AgentStatus.INACTIVE`.
|
|
551
|
-
* - `createdAt`, `updatedAt`: Timestamps for when the agent record was created and last updated in the database.
|
|
552
|
-
* This interface is primarily used by the `IDatabaseAdapter` for agent management.
|
|
553
|
-
*/
|
|
554
|
-
interface Agent extends Character {
|
|
555
|
-
enabled?: boolean;
|
|
556
|
-
status?: AgentStatus;
|
|
557
|
-
createdAt: number;
|
|
558
|
-
updatedAt: number;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Defines the contract for a Task Worker, which is responsible for executing a specific type of task.
|
|
563
|
-
* Task workers are registered with the `AgentRuntime` and are invoked when a `Task` of their designated `name` needs processing.
|
|
564
|
-
* This pattern allows for modular and extensible background task processing.
|
|
565
|
-
*/
|
|
566
|
-
interface TaskWorker {
|
|
567
|
-
/** The unique name of the task type this worker handles. This name links `Task` instances to this worker. */
|
|
568
|
-
name: string;
|
|
569
|
-
/**
|
|
570
|
-
* The core execution logic for the task. This function is called by the runtime when a task needs to be processed.
|
|
571
|
-
* It receives the `AgentRuntime`, task-specific `options`, and the `Task` object itself.
|
|
572
|
-
*/
|
|
573
|
-
execute: (runtime: IAgentRuntime, options: {
|
|
574
|
-
[key: string]: unknown;
|
|
575
|
-
}, task: Task) => Promise<void>;
|
|
576
|
-
/**
|
|
577
|
-
* Optional validation function that can be used to determine if a task is valid or should be executed,
|
|
578
|
-
* often based on the current message and state. This might be used by an action or evaluator
|
|
579
|
-
* before creating or queueing a task.
|
|
580
|
-
*/
|
|
581
|
-
validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Defines metadata associated with a `Task`.
|
|
585
|
-
* This can include scheduling information like `updateInterval` or UI-related details
|
|
586
|
-
* for presenting task options to a user.
|
|
587
|
-
* The `[key: string]: unknown;` allows for additional, unspecified metadata fields.
|
|
588
|
-
*/
|
|
589
|
-
type TaskMetadata = {
|
|
590
|
-
/** Optional. If the task is recurring, this specifies the interval in milliseconds between updates or executions. */
|
|
591
|
-
updateInterval?: number;
|
|
592
|
-
/** Optional. Describes options or parameters that can be configured for this task, often for UI presentation. */
|
|
593
|
-
options?: {
|
|
594
|
-
name: string;
|
|
595
|
-
description: string;
|
|
596
|
-
}[];
|
|
597
|
-
/** Allows for other dynamic metadata properties related to the task. */
|
|
598
|
-
[key: string]: unknown;
|
|
599
|
-
};
|
|
600
|
-
/**
|
|
601
|
-
* Represents a task to be performed, often in the background or at a later time.
|
|
602
|
-
* Tasks are managed by the `AgentRuntime` and processed by registered `TaskWorker`s.
|
|
603
|
-
* They can be associated with a room, world, and tagged for categorization and retrieval.
|
|
604
|
-
* The `IDatabaseAdapter` handles persistence of task data.
|
|
605
|
-
*/
|
|
606
|
-
interface Task {
|
|
607
|
-
/** Optional. A Universally Unique Identifier for the task. Generated if not provided. */
|
|
608
|
-
id?: UUID;
|
|
609
|
-
/** The name of the task, which should correspond to a registered `TaskWorker.name`. */
|
|
610
|
-
name: string;
|
|
611
|
-
/** Optional. Timestamp of the last update to this task. */
|
|
612
|
-
updatedAt?: number;
|
|
613
|
-
/** Optional. Metadata associated with the task, conforming to `TaskMetadata`. */
|
|
614
|
-
metadata?: TaskMetadata;
|
|
615
|
-
/** A human-readable description of what the task does or its purpose. */
|
|
616
|
-
description: string;
|
|
617
|
-
/** Optional. The UUID of the room this task is associated with. */
|
|
618
|
-
roomId?: UUID;
|
|
619
|
-
/** Optional. The UUID of the world this task is associated with. */
|
|
620
|
-
worldId?: UUID;
|
|
621
|
-
entityId?: UUID;
|
|
622
|
-
tags: string[];
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* Represents a log entry
|
|
627
|
-
*/
|
|
628
|
-
interface Log {
|
|
629
|
-
/** Optional unique identifier */
|
|
630
|
-
id?: UUID;
|
|
631
|
-
/** Associated entity ID */
|
|
632
|
-
entityId: UUID;
|
|
633
|
-
/** Associated room ID */
|
|
634
|
-
roomId?: UUID;
|
|
635
|
-
/** Log body */
|
|
636
|
-
body: {
|
|
637
|
-
[key: string]: unknown;
|
|
638
|
-
};
|
|
639
|
-
/** Log type */
|
|
640
|
-
type: string;
|
|
641
|
-
/** Log creation timestamp */
|
|
642
|
-
createdAt: Date;
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Interface for database operations
|
|
646
|
-
*/
|
|
647
|
-
interface IDatabaseAdapter {
|
|
648
|
-
/** Database instance */
|
|
649
|
-
db: any;
|
|
650
|
-
/** Initialize database connection */
|
|
651
|
-
initialize(config?: any): Promise<void>;
|
|
652
|
-
/** Initialize database connection */
|
|
653
|
-
init(): Promise<void>;
|
|
654
|
-
/** Run database migrations */
|
|
655
|
-
runMigrations(schema?: any, pluginName?: string): Promise<void>;
|
|
656
|
-
/** Check if the database connection is ready */
|
|
657
|
-
isReady(): Promise<boolean>;
|
|
658
|
-
/** Close database connection */
|
|
659
|
-
close(): Promise<void>;
|
|
660
|
-
getConnection(): Promise<any>;
|
|
661
|
-
getAgent(agentId: UUID): Promise<Agent | null>;
|
|
662
|
-
/** Get all agents */
|
|
663
|
-
getAgents(): Promise<Partial<Agent>[]>;
|
|
664
|
-
createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
665
|
-
updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
666
|
-
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
667
|
-
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
668
|
-
/** Get entity by IDs */
|
|
669
|
-
getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
670
|
-
/** Get entities for room */
|
|
671
|
-
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
672
|
-
/** Create new entities */
|
|
673
|
-
createEntities(entities: Entity[]): Promise<boolean>;
|
|
674
|
-
/** Update entity */
|
|
675
|
-
updateEntity(entity: Entity): Promise<void>;
|
|
676
|
-
/** Get component by ID */
|
|
677
|
-
getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
678
|
-
/** Get all components for an entity */
|
|
679
|
-
getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
680
|
-
/** Create component */
|
|
681
|
-
createComponent(component: Component): Promise<boolean>;
|
|
682
|
-
/** Update component */
|
|
683
|
-
updateComponent(component: Component): Promise<void>;
|
|
684
|
-
/** Delete component */
|
|
685
|
-
deleteComponent(componentId: UUID): Promise<void>;
|
|
686
|
-
/** Get memories matching criteria */
|
|
687
|
-
getMemories(params: {
|
|
688
|
-
entityId?: UUID;
|
|
689
|
-
agentId?: UUID;
|
|
690
|
-
count?: number;
|
|
691
|
-
unique?: boolean;
|
|
692
|
-
tableName: string;
|
|
693
|
-
start?: number;
|
|
694
|
-
end?: number;
|
|
695
|
-
roomId?: UUID;
|
|
696
|
-
worldId?: UUID;
|
|
697
|
-
}): Promise<Memory[]>;
|
|
698
|
-
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
699
|
-
getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
|
|
700
|
-
getMemoriesByRoomIds(params: {
|
|
701
|
-
tableName: string;
|
|
702
|
-
roomIds: UUID[];
|
|
703
|
-
limit?: number;
|
|
704
|
-
}): Promise<Memory[]>;
|
|
705
|
-
getCachedEmbeddings(params: {
|
|
706
|
-
query_table_name: string;
|
|
707
|
-
query_threshold: number;
|
|
708
|
-
query_input: string;
|
|
709
|
-
query_field_name: string;
|
|
710
|
-
query_field_sub_name: string;
|
|
711
|
-
query_match_count: number;
|
|
712
|
-
}): Promise<{
|
|
713
|
-
embedding: number[];
|
|
714
|
-
levenshtein_score: number;
|
|
715
|
-
}[]>;
|
|
716
|
-
log(params: {
|
|
717
|
-
body: {
|
|
718
|
-
[key: string]: unknown;
|
|
719
|
-
};
|
|
720
|
-
entityId: UUID;
|
|
721
|
-
roomId: UUID;
|
|
722
|
-
type: string;
|
|
723
|
-
}): Promise<void>;
|
|
724
|
-
getLogs(params: {
|
|
725
|
-
entityId: UUID;
|
|
726
|
-
roomId?: UUID;
|
|
727
|
-
type?: string;
|
|
728
|
-
count?: number;
|
|
729
|
-
offset?: number;
|
|
730
|
-
}): Promise<Log[]>;
|
|
731
|
-
deleteLog(logId: UUID): Promise<void>;
|
|
732
|
-
searchMemories(params: {
|
|
733
|
-
embedding: number[];
|
|
734
|
-
match_threshold?: number;
|
|
735
|
-
count?: number;
|
|
736
|
-
unique?: boolean;
|
|
737
|
-
tableName: string;
|
|
738
|
-
query?: string;
|
|
739
|
-
roomId?: UUID;
|
|
740
|
-
worldId?: UUID;
|
|
741
|
-
entityId?: UUID;
|
|
742
|
-
}): Promise<Memory[]>;
|
|
743
|
-
createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
744
|
-
updateMemory(memory: Partial<Memory> & {
|
|
745
|
-
id: UUID;
|
|
746
|
-
metadata?: MemoryMetadata;
|
|
747
|
-
}): Promise<boolean>;
|
|
748
|
-
deleteMemory(memoryId: UUID): Promise<void>;
|
|
749
|
-
deleteManyMemories(memoryIds: UUID[]): Promise<void>;
|
|
750
|
-
deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
751
|
-
countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
752
|
-
createWorld(world: World): Promise<UUID>;
|
|
753
|
-
getWorld(id: UUID): Promise<World | null>;
|
|
754
|
-
removeWorld(id: UUID): Promise<void>;
|
|
755
|
-
getAllWorlds(): Promise<World[]>;
|
|
756
|
-
updateWorld(world: World): Promise<void>;
|
|
757
|
-
getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
|
|
758
|
-
createRooms(rooms: Room[]): Promise<UUID[]>;
|
|
759
|
-
deleteRoom(roomId: UUID): Promise<void>;
|
|
760
|
-
deleteRoomsByWorldId(worldId: UUID): Promise<void>;
|
|
761
|
-
updateRoom(room: Room): Promise<void>;
|
|
762
|
-
getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
763
|
-
getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
764
|
-
getRoomsByWorld(worldId: UUID): Promise<Room[]>;
|
|
765
|
-
removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
766
|
-
getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
767
|
-
getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
768
|
-
addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
|
|
769
|
-
getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
770
|
-
setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
771
|
-
/**
|
|
772
|
-
* Creates a new relationship between two entities.
|
|
773
|
-
* @param params Object containing the relationship details
|
|
774
|
-
* @returns Promise resolving to boolean indicating success
|
|
775
|
-
*/
|
|
776
|
-
createRelationship(params: {
|
|
777
|
-
sourceEntityId: UUID;
|
|
778
|
-
targetEntityId: UUID;
|
|
779
|
-
tags?: string[];
|
|
780
|
-
metadata?: Metadata;
|
|
781
|
-
}): Promise<boolean>;
|
|
782
|
-
/**
|
|
783
|
-
* Updates an existing relationship between two entities.
|
|
784
|
-
* @param relationship The relationship object with updated data
|
|
785
|
-
* @returns Promise resolving to void
|
|
786
|
-
*/
|
|
787
|
-
updateRelationship(relationship: Relationship): Promise<void>;
|
|
788
|
-
/**
|
|
789
|
-
* Retrieves a relationship between two entities if it exists.
|
|
790
|
-
* @param params Object containing the entity IDs and agent ID
|
|
791
|
-
* @returns Promise resolving to the Relationship object or null if not found
|
|
792
|
-
*/
|
|
793
|
-
getRelationship(params: {
|
|
794
|
-
sourceEntityId: UUID;
|
|
795
|
-
targetEntityId: UUID;
|
|
796
|
-
}): Promise<Relationship | null>;
|
|
797
|
-
/**
|
|
798
|
-
* Retrieves all relationships for a specific entity.
|
|
799
|
-
* @param params Object containing the user ID, agent ID and optional tags to filter by
|
|
800
|
-
* @returns Promise resolving to an array of Relationship objects
|
|
801
|
-
*/
|
|
802
|
-
getRelationships(params: {
|
|
803
|
-
entityId: UUID;
|
|
804
|
-
tags?: string[];
|
|
805
|
-
}): Promise<Relationship[]>;
|
|
806
|
-
getCache<T>(key: string): Promise<T | undefined>;
|
|
807
|
-
setCache<T>(key: string, value: T): Promise<boolean>;
|
|
808
|
-
deleteCache(key: string): Promise<boolean>;
|
|
809
|
-
createTask(task: Task): Promise<UUID>;
|
|
810
|
-
getTasks(params: {
|
|
811
|
-
roomId?: UUID;
|
|
812
|
-
tags?: string[];
|
|
813
|
-
entityId?: UUID;
|
|
814
|
-
}): Promise<Task[]>;
|
|
815
|
-
getTask(id: UUID): Promise<Task | null>;
|
|
816
|
-
getTasksByName(name: string): Promise<Task[]>;
|
|
817
|
-
updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
818
|
-
deleteTask(id: UUID): Promise<void>;
|
|
819
|
-
getMemoriesByWorldId(params: {
|
|
820
|
-
worldId: UUID;
|
|
821
|
-
count?: number;
|
|
822
|
-
tableName?: string;
|
|
823
|
-
}): Promise<Memory[]>;
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Result interface for embedding similarity searches
|
|
827
|
-
*/
|
|
828
|
-
interface EmbeddingSearchResult {
|
|
829
|
-
embedding: number[];
|
|
830
|
-
levenshtein_score: number;
|
|
831
|
-
}
|
|
832
|
-
/**
|
|
833
|
-
* Options for memory retrieval operations
|
|
834
|
-
*/
|
|
835
|
-
interface MemoryRetrievalOptions {
|
|
836
|
-
roomId: UUID;
|
|
837
|
-
count?: number;
|
|
838
|
-
unique?: boolean;
|
|
839
|
-
start?: number;
|
|
840
|
-
end?: number;
|
|
841
|
-
agentId?: UUID;
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* Options for memory search operations
|
|
845
|
-
*/
|
|
846
|
-
interface MemorySearchOptions {
|
|
847
|
-
embedding: number[];
|
|
848
|
-
match_threshold?: number;
|
|
849
|
-
count?: number;
|
|
850
|
-
roomId: UUID;
|
|
851
|
-
agentId?: UUID;
|
|
852
|
-
unique?: boolean;
|
|
853
|
-
metadata?: Partial<MemoryMetadata>;
|
|
854
|
-
}
|
|
855
|
-
/**
|
|
856
|
-
* Options for multi-room memory retrieval
|
|
857
|
-
*/
|
|
858
|
-
interface MultiRoomMemoryOptions {
|
|
859
|
-
roomIds: UUID[];
|
|
860
|
-
limit?: number;
|
|
861
|
-
agentId?: UUID;
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
* Unified options pattern for memory operations
|
|
865
|
-
* Provides a simpler, more consistent interface
|
|
866
|
-
*/
|
|
867
|
-
interface UnifiedMemoryOptions {
|
|
868
|
-
roomId: UUID;
|
|
869
|
-
limit?: number;
|
|
870
|
-
agentId?: UUID;
|
|
871
|
-
unique?: boolean;
|
|
872
|
-
start?: number;
|
|
873
|
-
end?: number;
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Specialized memory search options
|
|
877
|
-
*/
|
|
878
|
-
interface UnifiedSearchOptions extends UnifiedMemoryOptions {
|
|
879
|
-
embedding: number[];
|
|
880
|
-
similarity?: number;
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Represents a generic database connection object.
|
|
884
|
-
* The actual type of this connection will depend on the specific database adapter implementation
|
|
885
|
-
* (e.g., a connection pool object for PostgreSQL, a client instance for a NoSQL database).
|
|
886
|
-
* This `unknown` type serves as a placeholder in the abstract `IDatabaseAdapter`.
|
|
887
|
-
*/
|
|
888
|
-
type DbConnection = unknown;
|
|
889
|
-
declare const VECTOR_DIMS: {
|
|
890
|
-
readonly SMALL: 384;
|
|
891
|
-
readonly MEDIUM: 512;
|
|
892
|
-
readonly LARGE: 768;
|
|
893
|
-
readonly XL: 1024;
|
|
894
|
-
readonly XXL: 1536;
|
|
895
|
-
readonly XXXL: 3072;
|
|
896
|
-
};
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* Information describing the target of a message.
|
|
900
|
-
*/
|
|
901
|
-
interface TargetInfo {
|
|
902
|
-
source: string;
|
|
903
|
-
roomId?: UUID;
|
|
904
|
-
channelId?: string;
|
|
905
|
-
serverId?: string;
|
|
906
|
-
entityId?: UUID;
|
|
907
|
-
threadId?: string;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* Function signature for handlers responsible for sending messages to specific platforms.
|
|
911
|
-
*/
|
|
912
|
-
type SendHandlerFunction = (runtime: IAgentRuntime, target: TargetInfo, content: Content) => Promise<void>;
|
|
913
|
-
declare enum SOCKET_MESSAGE_TYPE {
|
|
914
|
-
ROOM_JOINING = 1,
|
|
915
|
-
SEND_MESSAGE = 2,
|
|
916
|
-
MESSAGE = 3,
|
|
917
|
-
ACK = 4,
|
|
918
|
-
THINKING = 5,
|
|
919
|
-
CONTROL = 6
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* Interface for control messages sent from the backend to the frontend
|
|
923
|
-
* to manage UI state and interaction capabilities
|
|
924
|
-
*/
|
|
925
|
-
interface ControlMessage {
|
|
926
|
-
/** Message type identifier */
|
|
927
|
-
type: 'control';
|
|
928
|
-
/** Control message payload */
|
|
929
|
-
payload: {
|
|
930
|
-
/** Action to perform */
|
|
931
|
-
action: 'disable_input' | 'enable_input';
|
|
932
|
-
/** Optional target element identifier */
|
|
933
|
-
target?: string;
|
|
934
|
-
/** Additional optional parameters */
|
|
935
|
-
[key: string]: unknown;
|
|
936
|
-
};
|
|
937
|
-
/** Room ID to ensure signal is directed to the correct chat window */
|
|
938
|
-
roomId: UUID;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
type ModelTypeName = (typeof ModelType)[keyof typeof ModelType] | string;
|
|
942
|
-
/**
|
|
943
|
-
* Defines the recognized types of models that the agent runtime can use.
|
|
944
|
-
* These include models for text generation (small, large, reasoning, completion),
|
|
945
|
-
* text embedding, tokenization (encode/decode), image generation and description,
|
|
946
|
-
* audio transcription, text-to-speech, and generic object generation.
|
|
947
|
-
* This constant is used throughout the system, particularly in `AgentRuntime.useModel`,
|
|
948
|
-
* `AgentRuntime.registerModel`, and in `ModelParamsMap` / `ModelResultMap` to ensure
|
|
949
|
-
* type safety and clarity when working with different AI models.
|
|
950
|
-
* String values are used for extensibility with custom model types.
|
|
951
|
-
*/
|
|
952
|
-
declare const ModelType: {
|
|
953
|
-
readonly SMALL: "TEXT_SMALL";
|
|
954
|
-
readonly MEDIUM: "TEXT_LARGE";
|
|
955
|
-
readonly LARGE: "TEXT_LARGE";
|
|
956
|
-
readonly TEXT_SMALL: "TEXT_SMALL";
|
|
957
|
-
readonly TEXT_LARGE: "TEXT_LARGE";
|
|
958
|
-
readonly TEXT_EMBEDDING: "TEXT_EMBEDDING";
|
|
959
|
-
readonly TEXT_TOKENIZER_ENCODE: "TEXT_TOKENIZER_ENCODE";
|
|
960
|
-
readonly TEXT_TOKENIZER_DECODE: "TEXT_TOKENIZER_DECODE";
|
|
961
|
-
readonly TEXT_REASONING_SMALL: "REASONING_SMALL";
|
|
962
|
-
readonly TEXT_REASONING_LARGE: "REASONING_LARGE";
|
|
963
|
-
readonly TEXT_COMPLETION: "TEXT_COMPLETION";
|
|
964
|
-
readonly IMAGE: "IMAGE";
|
|
965
|
-
readonly IMAGE_DESCRIPTION: "IMAGE_DESCRIPTION";
|
|
966
|
-
readonly TRANSCRIPTION: "TRANSCRIPTION";
|
|
967
|
-
readonly TEXT_TO_SPEECH: "TEXT_TO_SPEECH";
|
|
968
|
-
readonly AUDIO: "AUDIO";
|
|
969
|
-
readonly VIDEO: "VIDEO";
|
|
970
|
-
readonly OBJECT_SMALL: "OBJECT_SMALL";
|
|
971
|
-
readonly OBJECT_LARGE: "OBJECT_LARGE";
|
|
972
|
-
};
|
|
973
|
-
/**
|
|
974
|
-
* Model configuration setting keys used in character settings.
|
|
975
|
-
* These constants define the keys for accessing model parameters
|
|
976
|
-
* from character configuration with support for per-model-type settings.
|
|
977
|
-
*
|
|
978
|
-
* Setting Precedence (highest to lowest):
|
|
979
|
-
* 1. Parameters passed directly to useModel()
|
|
980
|
-
* 2. Model-specific settings (e.g., TEXT_SMALL_TEMPERATURE)
|
|
981
|
-
* 3. Default settings (e.g., DEFAULT_TEMPERATURE)
|
|
982
|
-
*
|
|
983
|
-
* Example character settings:
|
|
984
|
-
* ```
|
|
985
|
-
* settings: {
|
|
986
|
-
* DEFAULT_TEMPERATURE: 0.7, // Applies to all models
|
|
987
|
-
* TEXT_SMALL_TEMPERATURE: 0.5, // Overrides default for TEXT_SMALL
|
|
988
|
-
* TEXT_LARGE_MAX_TOKENS: 4096, // Specific to TEXT_LARGE
|
|
989
|
-
* OBJECT_SMALL_TEMPERATURE: 0.3, // Specific to OBJECT_SMALL
|
|
990
|
-
* }
|
|
991
|
-
* ```
|
|
992
|
-
*/
|
|
993
|
-
declare const MODEL_SETTINGS: {
|
|
994
|
-
readonly DEFAULT_MAX_TOKENS: "DEFAULT_MAX_TOKENS";
|
|
995
|
-
readonly DEFAULT_TEMPERATURE: "DEFAULT_TEMPERATURE";
|
|
996
|
-
readonly DEFAULT_FREQUENCY_PENALTY: "DEFAULT_FREQUENCY_PENALTY";
|
|
997
|
-
readonly DEFAULT_PRESENCE_PENALTY: "DEFAULT_PRESENCE_PENALTY";
|
|
998
|
-
readonly TEXT_SMALL_MAX_TOKENS: "TEXT_SMALL_MAX_TOKENS";
|
|
999
|
-
readonly TEXT_SMALL_TEMPERATURE: "TEXT_SMALL_TEMPERATURE";
|
|
1000
|
-
readonly TEXT_SMALL_FREQUENCY_PENALTY: "TEXT_SMALL_FREQUENCY_PENALTY";
|
|
1001
|
-
readonly TEXT_SMALL_PRESENCE_PENALTY: "TEXT_SMALL_PRESENCE_PENALTY";
|
|
1002
|
-
readonly TEXT_LARGE_MAX_TOKENS: "TEXT_LARGE_MAX_TOKENS";
|
|
1003
|
-
readonly TEXT_LARGE_TEMPERATURE: "TEXT_LARGE_TEMPERATURE";
|
|
1004
|
-
readonly TEXT_LARGE_FREQUENCY_PENALTY: "TEXT_LARGE_FREQUENCY_PENALTY";
|
|
1005
|
-
readonly TEXT_LARGE_PRESENCE_PENALTY: "TEXT_LARGE_PRESENCE_PENALTY";
|
|
1006
|
-
readonly OBJECT_SMALL_MAX_TOKENS: "OBJECT_SMALL_MAX_TOKENS";
|
|
1007
|
-
readonly OBJECT_SMALL_TEMPERATURE: "OBJECT_SMALL_TEMPERATURE";
|
|
1008
|
-
readonly OBJECT_SMALL_FREQUENCY_PENALTY: "OBJECT_SMALL_FREQUENCY_PENALTY";
|
|
1009
|
-
readonly OBJECT_SMALL_PRESENCE_PENALTY: "OBJECT_SMALL_PRESENCE_PENALTY";
|
|
1010
|
-
readonly OBJECT_LARGE_MAX_TOKENS: "OBJECT_LARGE_MAX_TOKENS";
|
|
1011
|
-
readonly OBJECT_LARGE_TEMPERATURE: "OBJECT_LARGE_TEMPERATURE";
|
|
1012
|
-
readonly OBJECT_LARGE_FREQUENCY_PENALTY: "OBJECT_LARGE_FREQUENCY_PENALTY";
|
|
1013
|
-
readonly OBJECT_LARGE_PRESENCE_PENALTY: "OBJECT_LARGE_PRESENCE_PENALTY";
|
|
1014
|
-
readonly MODEL_MAX_TOKEN: "MODEL_MAX_TOKEN";
|
|
1015
|
-
readonly MODEL_TEMPERATURE: "MODEL_TEMPERATURE";
|
|
1016
|
-
readonly MODEL_FREQ_PENALTY: "MODEL_FREQ_PENALTY";
|
|
1017
|
-
readonly MODEL_PRESENCE_PENALTY: "MODEL_PRESENCE_PENALTY";
|
|
1018
|
-
};
|
|
1019
|
-
/**
|
|
1020
|
-
* Helper to get the model-specific setting key for a given model type and parameter.
|
|
1021
|
-
* @param modelType The model type (e.g., TEXT_SMALL, TEXT_LARGE)
|
|
1022
|
-
* @param param The parameter name (e.g., MAX_TOKENS, TEMPERATURE)
|
|
1023
|
-
* @returns The appropriate setting key or null if not a supported model type
|
|
1024
|
-
*/
|
|
1025
|
-
declare function getModelSpecificSettingKey(modelType: ModelTypeName, param: 'MAX_TOKENS' | 'TEMPERATURE' | 'FREQUENCY_PENALTY' | 'PRESENCE_PENALTY'): string | null;
|
|
1026
|
-
/**
|
|
1027
|
-
* Parameters for generating text using a language model.
|
|
1028
|
-
* This structure is typically passed to `AgentRuntime.useModel` when the `modelType` is one of
|
|
1029
|
-
* `ModelType.TEXT_SMALL`, `ModelType.TEXT_LARGE`, `ModelType.TEXT_REASONING_SMALL`,
|
|
1030
|
-
* `ModelType.TEXT_REASONING_LARGE`, or `ModelType.TEXT_COMPLETION`.
|
|
1031
|
-
* It includes essential information like the prompt, model type, and various generation controls.
|
|
1032
|
-
*/
|
|
1033
|
-
type GenerateTextParams = {
|
|
1034
|
-
/** The `AgentRuntime` instance, providing access to models and other services. */
|
|
1035
|
-
runtime: IAgentRuntime;
|
|
1036
|
-
/** The input string or prompt that the language model will use to generate text. */
|
|
1037
|
-
prompt: string;
|
|
1038
|
-
/** Specifies the type of text generation model to use (e.g., TEXT_LARGE, REASONING_SMALL). */
|
|
1039
|
-
modelType: ModelTypeName;
|
|
1040
|
-
/** Optional. The maximum number of tokens to generate in the response. */
|
|
1041
|
-
maxTokens?: number;
|
|
1042
|
-
/** Optional. Controls randomness (0.0-1.0). Lower values are more deterministic, higher are more creative. */
|
|
1043
|
-
temperature?: number;
|
|
1044
|
-
/** Optional. Penalizes new tokens based on their existing frequency in the text so far. */
|
|
1045
|
-
frequencyPenalty?: number;
|
|
1046
|
-
/** Optional. Penalizes new tokens based on whether they appear in the text so far. */
|
|
1047
|
-
presencePenalty?: number;
|
|
1048
|
-
/** Optional. A list of sequences at which the model will stop generating further tokens. */
|
|
1049
|
-
stopSequences?: string[];
|
|
1050
|
-
};
|
|
1051
|
-
/**
|
|
1052
|
-
* Parameters for detokenizing text, i.e., converting a sequence of numerical tokens back into a string.
|
|
1053
|
-
* This is the reverse operation of tokenization.
|
|
1054
|
-
* This structure is used with `AgentRuntime.useModel` when the `modelType` is `ModelType.TEXT_TOKENIZER_DECODE`.
|
|
1055
|
-
*/
|
|
1056
|
-
interface DetokenizeTextParams {
|
|
1057
|
-
/** An array of numerical tokens to be converted back into text. */
|
|
1058
|
-
tokens: number[];
|
|
1059
|
-
/** The model type used for detokenization, ensuring consistency with the original tokenization. */
|
|
1060
|
-
modelType: ModelTypeName;
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Base parameters common to all model types
|
|
1064
|
-
*/
|
|
1065
|
-
interface BaseModelParams {
|
|
1066
|
-
/** The agent runtime for accessing services and utilities */
|
|
1067
|
-
runtime: IAgentRuntime;
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Parameters for text generation models
|
|
1071
|
-
*/
|
|
1072
|
-
interface TextGenerationParams extends BaseModelParams {
|
|
1073
|
-
/** The prompt to generate text from */
|
|
1074
|
-
prompt: string;
|
|
1075
|
-
/** Model temperature (0.0 to 1.0, lower is more deterministic) */
|
|
1076
|
-
temperature?: number;
|
|
1077
|
-
/** Maximum number of tokens to generate */
|
|
1078
|
-
maxTokens?: number;
|
|
1079
|
-
/** Sequences that should stop generation when encountered */
|
|
1080
|
-
stopSequences?: string[];
|
|
1081
|
-
/** Frequency penalty to apply */
|
|
1082
|
-
frequencyPenalty?: number;
|
|
1083
|
-
/** Presence penalty to apply */
|
|
1084
|
-
presencePenalty?: number;
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* Parameters for text embedding models
|
|
1088
|
-
*/
|
|
1089
|
-
interface TextEmbeddingParams extends BaseModelParams {
|
|
1090
|
-
/** The text to create embeddings for */
|
|
1091
|
-
text: string;
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Parameters for text tokenization models
|
|
1095
|
-
*/
|
|
1096
|
-
interface TokenizeTextParams extends BaseModelParams {
|
|
1097
|
-
/** The text to tokenize */
|
|
1098
|
-
prompt: string;
|
|
1099
|
-
/** The model type to use for tokenization */
|
|
1100
|
-
modelType: ModelTypeName;
|
|
1101
|
-
}
|
|
1102
|
-
/**
|
|
1103
|
-
* Parameters for image generation models
|
|
1104
|
-
*/
|
|
1105
|
-
interface ImageGenerationParams extends BaseModelParams {
|
|
1106
|
-
/** The prompt describing the image to generate */
|
|
1107
|
-
prompt: string;
|
|
1108
|
-
/** The dimensions of the image to generate */
|
|
1109
|
-
size?: string;
|
|
1110
|
-
/** Number of images to generate */
|
|
1111
|
-
count?: number;
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* Parameters for image description models
|
|
1115
|
-
*/
|
|
1116
|
-
interface ImageDescriptionParams extends BaseModelParams {
|
|
1117
|
-
/** The URL or path of the image to describe */
|
|
1118
|
-
imageUrl: string;
|
|
1119
|
-
/** Optional prompt to guide the description */
|
|
1120
|
-
prompt?: string;
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Parameters for transcription models
|
|
1124
|
-
*/
|
|
1125
|
-
interface TranscriptionParams extends BaseModelParams {
|
|
1126
|
-
/** The URL or path of the audio file to transcribe */
|
|
1127
|
-
audioUrl: string;
|
|
1128
|
-
/** Optional prompt to guide transcription */
|
|
1129
|
-
prompt?: string;
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* Parameters for text-to-speech models
|
|
1133
|
-
*/
|
|
1134
|
-
interface TextToSpeechParams extends BaseModelParams {
|
|
1135
|
-
/** The text to convert to speech */
|
|
1136
|
-
text: string;
|
|
1137
|
-
/** The voice to use */
|
|
1138
|
-
voice?: string;
|
|
1139
|
-
/** The speaking speed */
|
|
1140
|
-
speed?: number;
|
|
1141
|
-
}
|
|
1142
|
-
/**
|
|
1143
|
-
* Parameters for audio processing models
|
|
1144
|
-
*/
|
|
1145
|
-
interface AudioProcessingParams extends BaseModelParams {
|
|
1146
|
-
/** The URL or path of the audio file to process */
|
|
1147
|
-
audioUrl: string;
|
|
1148
|
-
/** The type of audio processing to perform */
|
|
1149
|
-
processingType: string;
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Parameters for video processing models
|
|
1153
|
-
*/
|
|
1154
|
-
interface VideoProcessingParams extends BaseModelParams {
|
|
1155
|
-
/** The URL or path of the video file to process */
|
|
1156
|
-
videoUrl: string;
|
|
1157
|
-
/** The type of video processing to perform */
|
|
1158
|
-
processingType: string;
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* Optional JSON schema for validating generated objects
|
|
1162
|
-
*/
|
|
1163
|
-
type JSONSchema = {
|
|
1164
|
-
type: string;
|
|
1165
|
-
properties?: Record<string, any>;
|
|
1166
|
-
required?: string[];
|
|
1167
|
-
items?: JSONSchema;
|
|
1168
|
-
[key: string]: any;
|
|
1169
|
-
};
|
|
1170
|
-
/**
|
|
1171
|
-
* Parameters for object generation models
|
|
1172
|
-
* @template T - The expected return type, inferred from schema if provided
|
|
1173
|
-
*/
|
|
1174
|
-
interface ObjectGenerationParams extends BaseModelParams {
|
|
1175
|
-
/** The prompt describing the object to generate */
|
|
1176
|
-
prompt: string;
|
|
1177
|
-
/** Optional JSON schema for validation */
|
|
1178
|
-
schema?: JSONSchema;
|
|
1179
|
-
/** Type of object to generate */
|
|
1180
|
-
output?: 'object' | 'array' | 'enum';
|
|
1181
|
-
/** For enum type, the allowed values */
|
|
1182
|
-
enumValues?: string[];
|
|
1183
|
-
/** Model type to use */
|
|
1184
|
-
modelType?: ModelTypeName;
|
|
1185
|
-
/** Model temperature (0.0 to 1.0) */
|
|
1186
|
-
temperature?: number;
|
|
1187
|
-
/** Sequences that should stop generation */
|
|
1188
|
-
stopSequences?: string[];
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Map of model types to their parameter types
|
|
1192
|
-
*/
|
|
1193
|
-
interface ModelParamsMap {
|
|
1194
|
-
[ModelType.TEXT_SMALL]: TextGenerationParams;
|
|
1195
|
-
[ModelType.TEXT_LARGE]: TextGenerationParams;
|
|
1196
|
-
[ModelType.TEXT_EMBEDDING]: TextEmbeddingParams | string | null;
|
|
1197
|
-
[ModelType.TEXT_TOKENIZER_ENCODE]: TokenizeTextParams;
|
|
1198
|
-
[ModelType.TEXT_TOKENIZER_DECODE]: DetokenizeTextParams;
|
|
1199
|
-
[ModelType.TEXT_REASONING_SMALL]: TextGenerationParams;
|
|
1200
|
-
[ModelType.TEXT_REASONING_LARGE]: TextGenerationParams;
|
|
1201
|
-
[ModelType.IMAGE]: ImageGenerationParams;
|
|
1202
|
-
[ModelType.IMAGE_DESCRIPTION]: ImageDescriptionParams | string;
|
|
1203
|
-
[ModelType.TRANSCRIPTION]: TranscriptionParams | Buffer | string;
|
|
1204
|
-
[ModelType.TEXT_TO_SPEECH]: TextToSpeechParams | string;
|
|
1205
|
-
[ModelType.AUDIO]: AudioProcessingParams;
|
|
1206
|
-
[ModelType.VIDEO]: VideoProcessingParams;
|
|
1207
|
-
[ModelType.OBJECT_SMALL]: ObjectGenerationParams;
|
|
1208
|
-
[ModelType.OBJECT_LARGE]: ObjectGenerationParams;
|
|
1209
|
-
[key: string]: BaseModelParams | any;
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* Map of model types to their return value types
|
|
1213
|
-
*/
|
|
1214
|
-
interface ModelResultMap {
|
|
1215
|
-
[ModelType.TEXT_SMALL]: string;
|
|
1216
|
-
[ModelType.TEXT_LARGE]: string;
|
|
1217
|
-
[ModelType.TEXT_EMBEDDING]: number[];
|
|
1218
|
-
[ModelType.TEXT_TOKENIZER_ENCODE]: number[];
|
|
1219
|
-
[ModelType.TEXT_TOKENIZER_DECODE]: string;
|
|
1220
|
-
[ModelType.TEXT_REASONING_SMALL]: string;
|
|
1221
|
-
[ModelType.TEXT_REASONING_LARGE]: string;
|
|
1222
|
-
[ModelType.IMAGE]: {
|
|
1223
|
-
url: string;
|
|
1224
|
-
}[];
|
|
1225
|
-
[ModelType.IMAGE_DESCRIPTION]: {
|
|
1226
|
-
title: string;
|
|
1227
|
-
description: string;
|
|
1228
|
-
};
|
|
1229
|
-
[ModelType.TRANSCRIPTION]: string;
|
|
1230
|
-
[ModelType.TEXT_TO_SPEECH]: any | Buffer;
|
|
1231
|
-
[ModelType.AUDIO]: any;
|
|
1232
|
-
[ModelType.VIDEO]: any;
|
|
1233
|
-
[ModelType.OBJECT_SMALL]: any;
|
|
1234
|
-
[ModelType.OBJECT_LARGE]: any;
|
|
1235
|
-
[key: string]: any;
|
|
1236
|
-
}
|
|
1237
|
-
/**
|
|
1238
|
-
* Defines the structure for a model handler registration within the `AgentRuntime`.
|
|
1239
|
-
* Each model (e.g., for text generation, embedding) is associated with a handler function,
|
|
1240
|
-
* the name of the provider (plugin or system) that registered it, and an optional priority.
|
|
1241
|
-
* The `priority` (higher is more preferred) helps in selecting which handler to use if multiple
|
|
1242
|
-
* handlers are registered for the same model type. The `registrationOrder` (not in type, but used in runtime)
|
|
1243
|
-
* serves as a tie-breaker. See `AgentRuntime.registerModel` and `AgentRuntime.getModel`.
|
|
1244
|
-
*/
|
|
1245
|
-
interface ModelHandler {
|
|
1246
|
-
/** The function that executes the model, taking runtime and parameters, and returning a Promise. */
|
|
1247
|
-
handler: (runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>;
|
|
1248
|
-
/** The name of the provider (e.g., plugin name) that registered this model handler. */
|
|
1249
|
-
provider: string;
|
|
1250
|
-
/**
|
|
1251
|
-
* Optional priority for this model handler. Higher numbers indicate higher priority.
|
|
1252
|
-
* This is used by `AgentRuntime.getModel` to select the most appropriate handler
|
|
1253
|
-
* when multiple are available for a given model type. Defaults to 0 if not specified.
|
|
1254
|
-
*/
|
|
1255
|
-
priority?: number;
|
|
1256
|
-
registrationOrder?: number;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
/**
|
|
1260
|
-
* Standard event types across all platforms
|
|
1261
|
-
*/
|
|
1262
|
-
declare enum EventType {
|
|
1263
|
-
WORLD_JOINED = "WORLD_JOINED",
|
|
1264
|
-
WORLD_CONNECTED = "WORLD_CONNECTED",
|
|
1265
|
-
WORLD_LEFT = "WORLD_LEFT",
|
|
1266
|
-
ENTITY_JOINED = "ENTITY_JOINED",
|
|
1267
|
-
ENTITY_LEFT = "ENTITY_LEFT",
|
|
1268
|
-
ENTITY_UPDATED = "ENTITY_UPDATED",
|
|
1269
|
-
ROOM_JOINED = "ROOM_JOINED",
|
|
1270
|
-
ROOM_LEFT = "ROOM_LEFT",
|
|
1271
|
-
MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
|
|
1272
|
-
MESSAGE_SENT = "MESSAGE_SENT",
|
|
1273
|
-
MESSAGE_DELETED = "MESSAGE_DELETED",
|
|
1274
|
-
CHANNEL_CLEARED = "CHANNEL_CLEARED",
|
|
1275
|
-
VOICE_MESSAGE_RECEIVED = "VOICE_MESSAGE_RECEIVED",
|
|
1276
|
-
VOICE_MESSAGE_SENT = "VOICE_MESSAGE_SENT",
|
|
1277
|
-
REACTION_RECEIVED = "REACTION_RECEIVED",
|
|
1278
|
-
POST_GENERATED = "POST_GENERATED",
|
|
1279
|
-
INTERACTION_RECEIVED = "INTERACTION_RECEIVED",
|
|
1280
|
-
RUN_STARTED = "RUN_STARTED",
|
|
1281
|
-
RUN_ENDED = "RUN_ENDED",
|
|
1282
|
-
RUN_TIMEOUT = "RUN_TIMEOUT",
|
|
1283
|
-
ACTION_STARTED = "ACTION_STARTED",
|
|
1284
|
-
ACTION_COMPLETED = "ACTION_COMPLETED",
|
|
1285
|
-
EVALUATOR_STARTED = "EVALUATOR_STARTED",
|
|
1286
|
-
EVALUATOR_COMPLETED = "EVALUATOR_COMPLETED",
|
|
1287
|
-
MODEL_USED = "MODEL_USED",
|
|
1288
|
-
EMBEDDING_GENERATION_REQUESTED = "EMBEDDING_GENERATION_REQUESTED",
|
|
1289
|
-
EMBEDDING_GENERATION_COMPLETED = "EMBEDDING_GENERATION_COMPLETED",
|
|
1290
|
-
EMBEDDING_GENERATION_FAILED = "EMBEDDING_GENERATION_FAILED"
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Platform-specific event type prefix
|
|
1294
|
-
*/
|
|
1295
|
-
declare enum PlatformPrefix {
|
|
1296
|
-
DISCORD = "DISCORD",
|
|
1297
|
-
TELEGRAM = "TELEGRAM",
|
|
1298
|
-
TWITTER = "TWITTER"
|
|
1299
|
-
}
|
|
1300
|
-
/**
|
|
1301
|
-
* Base payload interface for all events
|
|
1302
|
-
*/
|
|
1303
|
-
interface EventPayload {
|
|
1304
|
-
runtime: IAgentRuntime;
|
|
1305
|
-
source: string;
|
|
1306
|
-
onComplete?: () => void;
|
|
1307
|
-
}
|
|
1308
|
-
/**
|
|
1309
|
-
* Payload for world-related events
|
|
1310
|
-
*/
|
|
1311
|
-
interface WorldPayload extends EventPayload {
|
|
1312
|
-
world: World;
|
|
1313
|
-
rooms: Room[];
|
|
1314
|
-
entities: Entity[];
|
|
1315
|
-
}
|
|
1316
|
-
/**
|
|
1317
|
-
* Payload for entity-related events
|
|
1318
|
-
*/
|
|
1319
|
-
interface EntityPayload extends EventPayload {
|
|
1320
|
-
entityId: UUID;
|
|
1321
|
-
worldId?: UUID;
|
|
1322
|
-
roomId?: UUID;
|
|
1323
|
-
metadata?: {
|
|
1324
|
-
orginalId: string;
|
|
1325
|
-
username: string;
|
|
1326
|
-
displayName?: string;
|
|
1327
|
-
[key: string]: any;
|
|
1328
|
-
};
|
|
1329
|
-
}
|
|
1330
|
-
/**
|
|
1331
|
-
* Payload for reaction-related events
|
|
1332
|
-
*/
|
|
1333
|
-
interface MessagePayload extends EventPayload {
|
|
1334
|
-
message: Memory;
|
|
1335
|
-
callback?: HandlerCallback;
|
|
1336
|
-
onComplete?: () => void;
|
|
1337
|
-
}
|
|
1338
|
-
/**
|
|
1339
|
-
* Payload for channel cleared events
|
|
1340
|
-
*/
|
|
1341
|
-
interface ChannelClearedPayload extends EventPayload {
|
|
1342
|
-
roomId: UUID;
|
|
1343
|
-
channelId: string;
|
|
1344
|
-
memoryCount: number;
|
|
1345
|
-
}
|
|
1346
|
-
/**
|
|
1347
|
-
* Payload for events that are invoked without a message
|
|
1348
|
-
*/
|
|
1349
|
-
interface InvokePayload extends EventPayload {
|
|
1350
|
-
worldId: UUID;
|
|
1351
|
-
userId: string;
|
|
1352
|
-
roomId: UUID;
|
|
1353
|
-
callback?: HandlerCallback;
|
|
1354
|
-
source: string;
|
|
1355
|
-
}
|
|
1356
|
-
/**
|
|
1357
|
-
* Run event payload type
|
|
1358
|
-
*/
|
|
1359
|
-
interface RunEventPayload extends EventPayload {
|
|
1360
|
-
runId: UUID;
|
|
1361
|
-
messageId: UUID;
|
|
1362
|
-
roomId: UUID;
|
|
1363
|
-
entityId: UUID;
|
|
1364
|
-
startTime: number;
|
|
1365
|
-
status: 'started' | 'completed' | 'timeout';
|
|
1366
|
-
endTime?: number;
|
|
1367
|
-
duration?: number;
|
|
1368
|
-
error?: string;
|
|
1369
|
-
}
|
|
1370
|
-
/**
|
|
1371
|
-
* Action event payload type
|
|
1372
|
-
*/
|
|
1373
|
-
interface ActionEventPayload extends EventPayload {
|
|
1374
|
-
actionId: UUID;
|
|
1375
|
-
actionName: string;
|
|
1376
|
-
startTime?: number;
|
|
1377
|
-
completed?: boolean;
|
|
1378
|
-
error?: Error;
|
|
1379
|
-
}
|
|
1380
|
-
/**
|
|
1381
|
-
* Evaluator event payload type
|
|
1382
|
-
*/
|
|
1383
|
-
interface EvaluatorEventPayload extends EventPayload {
|
|
1384
|
-
evaluatorId: UUID;
|
|
1385
|
-
evaluatorName: string;
|
|
1386
|
-
startTime?: number;
|
|
1387
|
-
completed?: boolean;
|
|
1388
|
-
error?: Error;
|
|
1389
|
-
}
|
|
1390
|
-
/**
|
|
1391
|
-
* Model event payload type
|
|
1392
|
-
*/
|
|
1393
|
-
interface ModelEventPayload extends EventPayload {
|
|
1394
|
-
provider: string;
|
|
1395
|
-
type: ModelTypeName;
|
|
1396
|
-
prompt: string;
|
|
1397
|
-
tokens?: {
|
|
1398
|
-
prompt: number;
|
|
1399
|
-
completion: number;
|
|
1400
|
-
total: number;
|
|
1401
|
-
};
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* Payload for embedding generation events
|
|
1405
|
-
*/
|
|
1406
|
-
interface EmbeddingGenerationPayload extends EventPayload {
|
|
1407
|
-
memory: Memory;
|
|
1408
|
-
priority?: 'high' | 'normal' | 'low';
|
|
1409
|
-
retryCount?: number;
|
|
1410
|
-
maxRetries?: number;
|
|
1411
|
-
embedding?: number[];
|
|
1412
|
-
error?: any;
|
|
1413
|
-
}
|
|
1414
|
-
type MessageReceivedHandlerParams = {
|
|
1415
|
-
runtime: IAgentRuntime;
|
|
1416
|
-
message: Memory;
|
|
1417
|
-
callback: HandlerCallback;
|
|
1418
|
-
onComplete?: () => void;
|
|
1419
|
-
};
|
|
1420
|
-
/**
|
|
1421
|
-
* Maps event types to their corresponding payload types
|
|
1422
|
-
*/
|
|
1423
|
-
interface EventPayloadMap {
|
|
1424
|
-
[EventType.WORLD_JOINED]: WorldPayload;
|
|
1425
|
-
[EventType.WORLD_CONNECTED]: WorldPayload;
|
|
1426
|
-
[EventType.WORLD_LEFT]: WorldPayload;
|
|
1427
|
-
[EventType.ENTITY_JOINED]: EntityPayload;
|
|
1428
|
-
[EventType.ENTITY_LEFT]: EntityPayload;
|
|
1429
|
-
[EventType.ENTITY_UPDATED]: EntityPayload;
|
|
1430
|
-
[EventType.MESSAGE_RECEIVED]: MessagePayload;
|
|
1431
|
-
[EventType.MESSAGE_SENT]: MessagePayload;
|
|
1432
|
-
[EventType.MESSAGE_DELETED]: MessagePayload;
|
|
1433
|
-
[EventType.CHANNEL_CLEARED]: ChannelClearedPayload;
|
|
1434
|
-
[EventType.REACTION_RECEIVED]: MessagePayload;
|
|
1435
|
-
[EventType.POST_GENERATED]: InvokePayload;
|
|
1436
|
-
[EventType.INTERACTION_RECEIVED]: MessagePayload;
|
|
1437
|
-
[EventType.RUN_STARTED]: RunEventPayload;
|
|
1438
|
-
[EventType.RUN_ENDED]: RunEventPayload;
|
|
1439
|
-
[EventType.RUN_TIMEOUT]: RunEventPayload;
|
|
1440
|
-
[EventType.ACTION_STARTED]: ActionEventPayload;
|
|
1441
|
-
[EventType.ACTION_COMPLETED]: ActionEventPayload;
|
|
1442
|
-
[EventType.EVALUATOR_STARTED]: EvaluatorEventPayload;
|
|
1443
|
-
[EventType.EVALUATOR_COMPLETED]: EvaluatorEventPayload;
|
|
1444
|
-
[EventType.MODEL_USED]: ModelEventPayload;
|
|
1445
|
-
[EventType.EMBEDDING_GENERATION_REQUESTED]: EmbeddingGenerationPayload;
|
|
1446
|
-
[EventType.EMBEDDING_GENERATION_COMPLETED]: EmbeddingGenerationPayload;
|
|
1447
|
-
[EventType.EMBEDDING_GENERATION_FAILED]: EmbeddingGenerationPayload;
|
|
1448
|
-
}
|
|
1449
|
-
/**
|
|
1450
|
-
* Event handler function type
|
|
1451
|
-
*/
|
|
1452
|
-
type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
|
|
1453
|
-
/**
|
|
1454
|
-
* Defines a more specific type for event handlers, expecting an `Metadata`.
|
|
1455
|
-
* This aims to improve upon generic 'any' type handlers, providing a clearer contract
|
|
1456
|
-
* for functions that respond to events emitted within the agent runtime (see `emitEvent` in `AgentRuntime`).
|
|
1457
|
-
* Handlers can be synchronous or asynchronous.
|
|
1458
|
-
*/
|
|
1459
|
-
type TypedEventHandler = (data: Metadata) => Promise<void> | void;
|
|
1460
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* Core service type registry that can be extended by plugins via module augmentation.
|
|
1463
|
-
* Plugins can extend this interface to add their own service types:
|
|
1464
|
-
*
|
|
1465
|
-
* @example
|
|
1466
|
-
* ```typescript
|
|
1467
|
-
* declare module '@elizaos/core' {
|
|
1468
|
-
* interface ServiceTypeRegistry {
|
|
1469
|
-
* MY_CUSTOM_SERVICE: 'my_custom_service';
|
|
1470
|
-
* }
|
|
1471
|
-
* }
|
|
1472
|
-
* ```
|
|
1473
|
-
*/
|
|
1474
|
-
interface ServiceTypeRegistry {
|
|
1475
|
-
TRANSCRIPTION: 'transcription';
|
|
1476
|
-
VIDEO: 'video';
|
|
1477
|
-
BROWSER: 'browser';
|
|
1478
|
-
PDF: 'pdf';
|
|
1479
|
-
REMOTE_FILES: 'aws_s3';
|
|
1480
|
-
WEB_SEARCH: 'web_search';
|
|
1481
|
-
EMAIL: 'email';
|
|
1482
|
-
TEE: 'tee';
|
|
1483
|
-
TASK: 'task';
|
|
1484
|
-
WALLET: 'wallet';
|
|
1485
|
-
LP_POOL: 'lp_pool';
|
|
1486
|
-
TOKEN_DATA: 'token_data';
|
|
1487
|
-
MESSAGE: 'message';
|
|
1488
|
-
POST: 'post';
|
|
1489
|
-
UNKNOWN: 'unknown';
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Type for service names that includes both core services and any plugin-registered services
|
|
1493
|
-
*/
|
|
1494
|
-
type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
|
|
1495
|
-
/**
|
|
1496
|
-
* Helper type to extract service type values from the registry
|
|
1497
|
-
*/
|
|
1498
|
-
type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
|
|
1499
|
-
/**
|
|
1500
|
-
* Helper type to check if a service type exists in the registry
|
|
1501
|
-
*/
|
|
1502
|
-
type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
|
|
1503
|
-
/**
|
|
1504
|
-
* Type-safe service class definition
|
|
1505
|
-
*/
|
|
1506
|
-
type TypedServiceClass<T extends ServiceTypeName> = {
|
|
1507
|
-
new (runtime?: IAgentRuntime): Service;
|
|
1508
|
-
serviceType: T;
|
|
1509
|
-
start(runtime: IAgentRuntime): Promise<Service>;
|
|
1510
|
-
};
|
|
1511
|
-
/**
|
|
1512
|
-
* Map of service type names to their implementation classes
|
|
1513
|
-
*/
|
|
1514
|
-
interface ServiceClassMap {
|
|
1515
|
-
}
|
|
1516
|
-
/**
|
|
1517
|
-
* Helper to infer service instance type from service type name
|
|
1518
|
-
*/
|
|
1519
|
-
type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
|
|
1520
|
-
/**
|
|
1521
|
-
* Runtime service registry type
|
|
1522
|
-
*/
|
|
1523
|
-
type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
|
|
1524
|
-
/**
|
|
1525
|
-
* Enumerates the recognized types of services that can be registered and used by the agent runtime.
|
|
1526
|
-
* Services provide specialized functionalities like audio transcription, video processing,
|
|
1527
|
-
* web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,
|
|
1528
|
-
* secure execution via TEE (Trusted Execution Environment), and task management.
|
|
1529
|
-
* This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).
|
|
1530
|
-
* Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.
|
|
1531
|
-
*/
|
|
1532
|
-
declare const ServiceType: {
|
|
1533
|
-
readonly TRANSCRIPTION: "transcription";
|
|
1534
|
-
readonly VIDEO: "video";
|
|
1535
|
-
readonly BROWSER: "browser";
|
|
1536
|
-
readonly PDF: "pdf";
|
|
1537
|
-
readonly REMOTE_FILES: "aws_s3";
|
|
1538
|
-
readonly WEB_SEARCH: "web_search";
|
|
1539
|
-
readonly EMAIL: "email";
|
|
1540
|
-
readonly TEE: "tee";
|
|
1541
|
-
readonly TASK: "task";
|
|
1542
|
-
readonly WALLET: "wallet";
|
|
1543
|
-
readonly LP_POOL: "lp_pool";
|
|
1544
|
-
readonly TOKEN_DATA: "token_data";
|
|
1545
|
-
readonly MESSAGE: "message";
|
|
1546
|
-
readonly POST: "post";
|
|
1547
|
-
readonly UNKNOWN: "unknown";
|
|
1548
|
-
};
|
|
1549
|
-
/**
|
|
1550
|
-
* Client instance
|
|
1551
|
-
*/
|
|
1552
|
-
declare abstract class Service {
|
|
1553
|
-
/** Runtime instance */
|
|
1554
|
-
protected runtime: IAgentRuntime;
|
|
1555
|
-
constructor(runtime?: IAgentRuntime);
|
|
1556
|
-
abstract stop(): Promise<void>;
|
|
1557
|
-
/** Service type */
|
|
1558
|
-
static serviceType: string;
|
|
1559
|
-
/** Service name */
|
|
1560
|
-
abstract capabilityDescription: string;
|
|
1561
|
-
/** Service configuration */
|
|
1562
|
-
config?: Metadata;
|
|
1563
|
-
/** Start service connection */
|
|
1564
|
-
static start(_runtime: IAgentRuntime): Promise<Service>;
|
|
1565
|
-
/** Stop service connection */
|
|
1566
|
-
static stop(_runtime: IAgentRuntime): Promise<unknown>;
|
|
1567
|
-
}
|
|
1568
|
-
/**
|
|
1569
|
-
* Generic service interface that provides better type checking for services
|
|
1570
|
-
* @template ConfigType The configuration type for this service
|
|
1571
|
-
* @template ResultType The result type returned by the service operations
|
|
1572
|
-
*/
|
|
1573
|
-
interface TypedService<ConfigType extends Metadata = Metadata, ResultType = unknown> extends Service {
|
|
1574
|
-
/**
|
|
1575
|
-
* The configuration for this service instance
|
|
1576
|
-
*/
|
|
1577
|
-
config?: ConfigType;
|
|
1578
|
-
/**
|
|
1579
|
-
* Process an input with this service
|
|
1580
|
-
* @param input The input to process
|
|
1581
|
-
* @returns A promise resolving to the result
|
|
1582
|
-
*/
|
|
1583
|
-
process(input: unknown): Promise<ResultType>;
|
|
1584
|
-
}
|
|
1585
|
-
/**
|
|
1586
|
-
* Generic factory function to create a typed service instance
|
|
1587
|
-
* @param runtime The agent runtime
|
|
1588
|
-
* @param serviceType The type of service to get
|
|
1589
|
-
* @returns The service instance or null if not available
|
|
1590
|
-
*/
|
|
1591
|
-
declare function getTypedService<T extends TypedService<any, any>>(runtime: IAgentRuntime, serviceType: ServiceTypeName): T | null;
|
|
1592
|
-
/**
|
|
1593
|
-
* Standardized service error type for consistent error handling
|
|
1594
|
-
*/
|
|
1595
|
-
interface ServiceError {
|
|
1596
|
-
code: string;
|
|
1597
|
-
message: string;
|
|
1598
|
-
details?: unknown;
|
|
1599
|
-
cause?: Error;
|
|
1600
|
-
}
|
|
1601
|
-
/**
|
|
1602
|
-
* Safely create a ServiceError from any caught error
|
|
1603
|
-
*/
|
|
1604
|
-
declare function createServiceError(error: unknown, code?: string): ServiceError;
|
|
1605
|
-
|
|
1606
|
-
/**
|
|
1607
|
-
* Represents a test case for evaluating agent or plugin functionality.
|
|
1608
|
-
* Each test case has a name and a function that contains the test logic.
|
|
1609
|
-
* The test function receives the `IAgentRuntime` instance, allowing it to interact with the agent's capabilities.
|
|
1610
|
-
* Test cases are typically grouped into `TestSuite`s.
|
|
1611
|
-
*/
|
|
1612
|
-
interface TestCase {
|
|
1613
|
-
/** A descriptive name for the test case, e.g., "should respond to greetings". */
|
|
1614
|
-
name: string;
|
|
1615
|
-
/**
|
|
1616
|
-
* The function that executes the test logic. It can be synchronous or asynchronous.
|
|
1617
|
-
* It receives the `IAgentRuntime` to interact with the agent and its services.
|
|
1618
|
-
* The function should typically contain assertions to verify expected outcomes.
|
|
1619
|
-
*/
|
|
1620
|
-
fn: (runtime: IAgentRuntime) => Promise<void> | void;
|
|
1621
|
-
}
|
|
1622
|
-
/**
|
|
1623
|
-
* Represents a suite of related test cases for an agent or plugin.
|
|
1624
|
-
* This helps in organizing tests and running them collectively.
|
|
1625
|
-
* A `ProjectAgent` can define one or more `TestSuite`s.
|
|
1626
|
-
*/
|
|
1627
|
-
interface TestSuite {
|
|
1628
|
-
/** A descriptive name for the test suite, e.g., "Core Functionality Tests". */
|
|
1629
|
-
name: string;
|
|
1630
|
-
/** An array of `TestCase` objects that belong to this suite. */
|
|
1631
|
-
tests: TestCase[];
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
type Route = {
|
|
1635
|
-
type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
|
|
1636
|
-
path: string;
|
|
1637
|
-
filePath?: string;
|
|
1638
|
-
public?: boolean;
|
|
1639
|
-
name?: string extends {
|
|
1640
|
-
public: true;
|
|
1641
|
-
} ? string : string | undefined;
|
|
1642
|
-
handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
|
|
1643
|
-
isMultipart?: boolean;
|
|
1644
|
-
};
|
|
1645
|
-
/**
|
|
1646
|
-
* Plugin for extending agent functionality
|
|
1647
|
-
*/
|
|
1648
|
-
type PluginEvents = {
|
|
1649
|
-
[K in keyof EventPayloadMap]?: EventHandler<K>[];
|
|
1650
|
-
} & {
|
|
1651
|
-
[key: string]: ((params: any) => Promise<any>)[];
|
|
1652
|
-
};
|
|
1653
|
-
interface Plugin {
|
|
1654
|
-
name: string;
|
|
1655
|
-
description: string;
|
|
1656
|
-
init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
|
|
1657
|
-
config?: {
|
|
1658
|
-
[key: string]: any;
|
|
1659
|
-
};
|
|
1660
|
-
services?: (typeof Service)[];
|
|
1661
|
-
componentTypes?: {
|
|
1662
|
-
name: string;
|
|
1663
|
-
schema: Record<string, unknown>;
|
|
1664
|
-
validator?: (data: any) => boolean;
|
|
1665
|
-
}[];
|
|
1666
|
-
actions?: Action[];
|
|
1667
|
-
providers?: Provider[];
|
|
1668
|
-
evaluators?: Evaluator[];
|
|
1669
|
-
adapter?: IDatabaseAdapter;
|
|
1670
|
-
models?: {
|
|
1671
|
-
[key: string]: (...args: any[]) => Promise<any>;
|
|
1672
|
-
};
|
|
1673
|
-
events?: PluginEvents;
|
|
1674
|
-
routes?: Route[];
|
|
1675
|
-
tests?: TestSuite[];
|
|
1676
|
-
dependencies?: string[];
|
|
1677
|
-
testDependencies?: string[];
|
|
1678
|
-
priority?: number;
|
|
1679
|
-
schema?: any;
|
|
1680
|
-
}
|
|
1681
|
-
interface ProjectAgent {
|
|
1682
|
-
character: Character;
|
|
1683
|
-
init?: (runtime: IAgentRuntime) => Promise<void>;
|
|
1684
|
-
plugins?: Plugin[];
|
|
1685
|
-
tests?: TestSuite | TestSuite[];
|
|
1686
|
-
}
|
|
1687
|
-
interface Project {
|
|
1688
|
-
agents: ProjectAgent[];
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
/**
|
|
1692
|
-
* Represents the core runtime environment for an agent.
|
|
1693
|
-
* Defines methods for database interaction, plugin management, event handling,
|
|
1694
|
-
* state composition, model usage, and task management.
|
|
1695
|
-
*/
|
|
1696
|
-
interface IAgentRuntime extends IDatabaseAdapter {
|
|
1697
|
-
agentId: UUID;
|
|
1698
|
-
character: Character;
|
|
1699
|
-
providers: Provider[];
|
|
1700
|
-
actions: Action[];
|
|
1701
|
-
evaluators: Evaluator[];
|
|
1702
|
-
plugins: Plugin[];
|
|
1703
|
-
services: Map<ServiceTypeName, Service[]>;
|
|
1704
|
-
events: Map<string, ((params: any) => Promise<void>)[]>;
|
|
1705
|
-
fetch?: typeof fetch | null;
|
|
1706
|
-
routes: Route[];
|
|
1707
|
-
logger: any;
|
|
1708
|
-
registerPlugin(plugin: Plugin): Promise<void>;
|
|
1709
|
-
initialize(): Promise<void>;
|
|
1710
|
-
getConnection(): Promise<any>;
|
|
1711
|
-
getService<T extends Service>(service: ServiceTypeName | string): T | null;
|
|
1712
|
-
getServicesByType<T extends Service>(service: ServiceTypeName | string): T[];
|
|
1713
|
-
getAllServices(): Map<ServiceTypeName, Service[]>;
|
|
1714
|
-
registerService(service: typeof Service): Promise<void>;
|
|
1715
|
-
getServiceLoadPromise(serviceType: ServiceTypeName): Promise<Service>;
|
|
1716
|
-
getRegisteredServiceTypes(): ServiceTypeName[];
|
|
1717
|
-
hasService(serviceType: ServiceTypeName | string): boolean;
|
|
1718
|
-
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
1719
|
-
setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
|
|
1720
|
-
getSetting(key: string): string | boolean | null | any;
|
|
1721
|
-
getConversationLength(): number;
|
|
1722
|
-
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
|
|
1723
|
-
evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
|
|
1724
|
-
registerProvider(provider: Provider): void;
|
|
1725
|
-
registerAction(action: Action): void;
|
|
1726
|
-
registerEvaluator(evaluator: Evaluator): void;
|
|
1727
|
-
ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
|
|
1728
|
-
ensureConnection({ entityId, roomId, metadata, userName, worldName, name, source, channelId, serverId, type, worldId, userId, }: {
|
|
1729
|
-
entityId: UUID;
|
|
1730
|
-
roomId: UUID;
|
|
1731
|
-
userName?: string;
|
|
1732
|
-
name?: string;
|
|
1733
|
-
worldName?: string;
|
|
1734
|
-
source?: string;
|
|
1735
|
-
channelId?: string;
|
|
1736
|
-
serverId?: string;
|
|
1737
|
-
type: any;
|
|
1738
|
-
worldId: UUID;
|
|
1739
|
-
userId?: UUID;
|
|
1740
|
-
metadata?: Record<string, any>;
|
|
1741
|
-
}): Promise<void>;
|
|
1742
|
-
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
1743
|
-
ensureWorldExists(world: World): Promise<void>;
|
|
1744
|
-
ensureRoomExists(room: Room): Promise<void>;
|
|
1745
|
-
composeState(message: Memory, includeList?: string[], onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
|
|
1746
|
-
useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any): Promise<R>;
|
|
1747
|
-
registerModel(modelType: ModelTypeName | string, handler: (params: any) => Promise<any>, provider: string, priority?: number): void;
|
|
1748
|
-
getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
|
|
1749
|
-
registerEvent(event: string, handler: (params: any) => Promise<void>): void;
|
|
1750
|
-
getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
|
|
1751
|
-
emitEvent(event: string | string[], params: any): Promise<void>;
|
|
1752
|
-
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
1753
|
-
getTaskWorker(name: string): TaskWorker | undefined;
|
|
1754
|
-
stop(): Promise<void>;
|
|
1755
|
-
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
1756
|
-
/**
|
|
1757
|
-
* Queue a memory for async embedding generation.
|
|
1758
|
-
* This method is non-blocking and returns immediately.
|
|
1759
|
-
* The embedding will be generated asynchronously via event handlers.
|
|
1760
|
-
* @param memory The memory to generate embeddings for
|
|
1761
|
-
* @param priority Priority level for the embedding generation
|
|
1762
|
-
*/
|
|
1763
|
-
queueEmbeddingGeneration(memory: Memory, priority?: 'high' | 'normal' | 'low'): Promise<void>;
|
|
1764
|
-
getAllMemories(): Promise<Memory[]>;
|
|
1765
|
-
clearAllAgentMemories(): Promise<void>;
|
|
1766
|
-
updateMemory(memory: Partial<Memory> & {
|
|
1767
|
-
id: UUID;
|
|
1768
|
-
metadata?: MemoryMetadata;
|
|
1769
|
-
}): Promise<boolean>;
|
|
1770
|
-
createRunId(): UUID;
|
|
1771
|
-
startRun(): UUID;
|
|
1772
|
-
endRun(): void;
|
|
1773
|
-
getCurrentRunId(): UUID;
|
|
1774
|
-
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
1775
|
-
getRoom(roomId: UUID): Promise<Room | null>;
|
|
1776
|
-
createEntity(entity: Entity): Promise<boolean>;
|
|
1777
|
-
createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
|
|
1778
|
-
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
1779
|
-
getRooms(worldId: UUID): Promise<Room[]>;
|
|
1780
|
-
registerSendHandler(source: string, handler: SendHandlerFunction): void;
|
|
1781
|
-
sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
/**
|
|
1785
|
-
* Example content with associated user for demonstration purposes
|
|
1786
|
-
*/
|
|
1787
|
-
interface ActionExample {
|
|
1788
|
-
/** User associated with the example */
|
|
1789
|
-
name: string;
|
|
1790
|
-
/** Content of the example */
|
|
1791
|
-
content: Content;
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* Callback function type for handlers
|
|
1795
|
-
*/
|
|
1796
|
-
type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
|
|
1797
|
-
/**
|
|
1798
|
-
* Handler function type for processing messages
|
|
1799
|
-
*/
|
|
1800
|
-
type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
|
|
1801
|
-
[key: string]: unknown;
|
|
1802
|
-
}, callback?: HandlerCallback, responses?: Memory[]) => Promise<ActionResult | void | undefined>;
|
|
1803
|
-
/**
|
|
1804
|
-
* Validator function type for actions/evaluators
|
|
1805
|
-
*/
|
|
1806
|
-
type Validator = (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<boolean>;
|
|
1807
|
-
/**
|
|
1808
|
-
* Represents an action the agent can perform
|
|
1809
|
-
*/
|
|
1810
|
-
interface Action {
|
|
1811
|
-
/** Similar action descriptions */
|
|
1812
|
-
similes?: string[];
|
|
1813
|
-
/** Detailed description */
|
|
1814
|
-
description: string;
|
|
1815
|
-
/** Example usages */
|
|
1816
|
-
examples?: ActionExample[][];
|
|
1817
|
-
/** Handler function */
|
|
1818
|
-
handler: Handler;
|
|
1819
|
-
/** Action name */
|
|
1820
|
-
name: string;
|
|
1821
|
-
/** Validation function */
|
|
1822
|
-
validate: Validator;
|
|
1823
|
-
}
|
|
1824
|
-
/**
|
|
1825
|
-
* Example for evaluating agent behavior
|
|
1826
|
-
*/
|
|
1827
|
-
interface EvaluationExample {
|
|
1828
|
-
/** Evaluation context */
|
|
1829
|
-
prompt: string;
|
|
1830
|
-
/** Example messages */
|
|
1831
|
-
messages: Array<ActionExample>;
|
|
1832
|
-
/** Expected outcome */
|
|
1833
|
-
outcome: string;
|
|
1834
|
-
}
|
|
1835
|
-
/**
|
|
1836
|
-
* Evaluator for assessing agent responses
|
|
1837
|
-
*/
|
|
1838
|
-
interface Evaluator {
|
|
1839
|
-
/** Whether to always run */
|
|
1840
|
-
alwaysRun?: boolean;
|
|
1841
|
-
/** Detailed description */
|
|
1842
|
-
description: string;
|
|
1843
|
-
/** Similar evaluator descriptions */
|
|
1844
|
-
similes?: string[];
|
|
1845
|
-
/** Example evaluations */
|
|
1846
|
-
examples: EvaluationExample[];
|
|
1847
|
-
/** Handler function */
|
|
1848
|
-
handler: Handler;
|
|
1849
|
-
/** Evaluator name */
|
|
1850
|
-
name: string;
|
|
1851
|
-
/** Validation function */
|
|
1852
|
-
validate: Validator;
|
|
1853
|
-
}
|
|
1854
|
-
interface ProviderResult {
|
|
1855
|
-
values?: {
|
|
1856
|
-
[key: string]: any;
|
|
1857
|
-
};
|
|
1858
|
-
data?: {
|
|
1859
|
-
[key: string]: any;
|
|
1860
|
-
};
|
|
1861
|
-
text?: string;
|
|
1862
|
-
}
|
|
1863
|
-
/**
|
|
1864
|
-
* Provider for external data/services
|
|
1865
|
-
*/
|
|
1866
|
-
interface Provider {
|
|
1867
|
-
/** Provider name */
|
|
1868
|
-
name: string;
|
|
1869
|
-
/** Description of the provider */
|
|
1870
|
-
description?: string;
|
|
1871
|
-
/** Whether the provider is dynamic */
|
|
1872
|
-
dynamic?: boolean;
|
|
1873
|
-
/** Position of the provider in the provider list, positive or negative */
|
|
1874
|
-
position?: number;
|
|
1875
|
-
/**
|
|
1876
|
-
* Whether the provider is private
|
|
1877
|
-
*
|
|
1878
|
-
* Private providers are not displayed in the regular provider list, they have to be called explicitly
|
|
1879
|
-
*/
|
|
1880
|
-
private?: boolean;
|
|
1881
|
-
/** Data retrieval function */
|
|
1882
|
-
get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
|
|
1883
|
-
}
|
|
1884
|
-
/**
|
|
1885
|
-
* Result returned by an action after execution
|
|
1886
|
-
* Used for action chaining and state management
|
|
1887
|
-
*/
|
|
1888
|
-
interface ActionResult {
|
|
1889
|
-
/** Optional text description of the result */
|
|
1890
|
-
text?: string;
|
|
1891
|
-
/** Values to merge into the state */
|
|
1892
|
-
values?: Record<string, any>;
|
|
1893
|
-
/** Data payload containing action-specific results */
|
|
1894
|
-
data?: Record<string, any>;
|
|
1895
|
-
/** Whether the action succeeded - defaults to true */
|
|
1896
|
-
success: boolean;
|
|
1897
|
-
/** Error information if the action failed */
|
|
1898
|
-
error?: string | Error;
|
|
1899
|
-
}
|
|
1900
|
-
/**
|
|
1901
|
-
* Context provided to actions during execution
|
|
1902
|
-
* Allows actions to access previous results and update state
|
|
1903
|
-
*/
|
|
1904
|
-
interface ActionContext {
|
|
1905
|
-
/** Results from previously executed actions in this run */
|
|
1906
|
-
previousResults: ActionResult[];
|
|
1907
|
-
/** Get a specific previous result by action name */
|
|
1908
|
-
getPreviousResult?: (actionName: string) => ActionResult | undefined;
|
|
1909
|
-
}
|
|
1910
|
-
/**
|
|
1911
|
-
* Helper function to create ActionResult with proper defaults
|
|
1912
|
-
*/
|
|
1913
|
-
declare function createActionResult(partial?: Partial<ActionResult>): ActionResult;
|
|
1914
|
-
|
|
1915
|
-
/**
|
|
1916
|
-
* Represents an agent's registration details within a Trusted Execution Environment (TEE) context.
|
|
1917
|
-
* This is typically stored in a database table (e.g., `TeeAgent`) to manage agents operating in a TEE.
|
|
1918
|
-
* It allows for multiple registrations of the same `agentId` to support scenarios where an agent might restart,
|
|
1919
|
-
* generating a new keypair and attestation each time.
|
|
1920
|
-
*/
|
|
1921
|
-
interface TeeAgent {
|
|
1922
|
-
/** Primary key for the TEE agent registration record (e.g., a UUID or auto-incrementing ID). */
|
|
1923
|
-
id: string;
|
|
1924
|
-
/** The core identifier of the agent, which can be duplicated across multiple TEE registrations. */
|
|
1925
|
-
agentId: string;
|
|
1926
|
-
/** The human-readable name of the agent. */
|
|
1927
|
-
agentName: string;
|
|
1928
|
-
/** Timestamp (e.g., Unix epoch in milliseconds) when this TEE registration was created. */
|
|
1929
|
-
createdAt: number;
|
|
1930
|
-
/** The public key associated with this specific TEE agent instance/session. */
|
|
1931
|
-
publicKey: string;
|
|
1932
|
-
/** The attestation document proving the authenticity and integrity of the TEE instance. */
|
|
1933
|
-
attestation: string;
|
|
1934
|
-
}
|
|
1935
|
-
/**
|
|
1936
|
-
* Defines the operational modes for a Trusted Execution Environment (TEE).
|
|
1937
|
-
* This enum is used to configure how TEE functionalities are engaged, allowing for
|
|
1938
|
-
* different setups for local development, Docker-based development, and production.
|
|
1939
|
-
*/
|
|
1940
|
-
declare enum TEEMode {
|
|
1941
|
-
/** TEE functionality is completely disabled. */
|
|
1942
|
-
OFF = "OFF",
|
|
1943
|
-
/** For local development, potentially using a TEE simulator. */
|
|
1944
|
-
LOCAL = "LOCAL",// For local development with simulator
|
|
1945
|
-
/** For Docker-based development environments, possibly with a TEE simulator. */
|
|
1946
|
-
DOCKER = "DOCKER",// For docker development with simulator
|
|
1947
|
-
/** For production deployments, using actual TEE hardware without a simulator. */
|
|
1948
|
-
PRODUCTION = "PRODUCTION"
|
|
1949
|
-
}
|
|
1950
|
-
/**
|
|
1951
|
-
* Represents a quote obtained during remote attestation for a Trusted Execution Environment (TEE).
|
|
1952
|
-
* This quote is a piece of evidence provided by the TEE, cryptographically signed, which can be
|
|
1953
|
-
* verified by a relying party to ensure the TEE's integrity and authenticity.
|
|
1954
|
-
*/
|
|
1955
|
-
interface RemoteAttestationQuote {
|
|
1956
|
-
/** The attestation quote data, typically a base64 encoded string or similar format. */
|
|
1957
|
-
quote: string;
|
|
1958
|
-
/** Timestamp (e.g., Unix epoch in milliseconds) when the quote was generated or received. */
|
|
1959
|
-
timestamp: number;
|
|
1960
|
-
}
|
|
1961
|
-
/**
|
|
1962
|
-
* Data structure used in the attestation process for deriving a key within a Trusted Execution Environment (TEE).
|
|
1963
|
-
* This information helps establish a secure channel or verify the identity of the agent instance
|
|
1964
|
-
* requesting key derivation.
|
|
1965
|
-
*/
|
|
1966
|
-
interface DeriveKeyAttestationData {
|
|
1967
|
-
/** The unique identifier of the agent for which the key derivation is being attested. */
|
|
1968
|
-
agentId: string;
|
|
1969
|
-
/** The public key of the agent instance involved in the key derivation process. */
|
|
1970
|
-
publicKey: string;
|
|
1971
|
-
/** Optional subject or context information related to the key derivation. */
|
|
1972
|
-
subject?: string;
|
|
1973
|
-
}
|
|
1974
|
-
/**
|
|
1975
|
-
* Represents a message that has been attested by a Trusted Execution Environment (TEE).
|
|
1976
|
-
* This structure binds a message to an agent's identity and a timestamp, all within the
|
|
1977
|
-
* context of a remote attestation process, ensuring the message originated from a trusted TEE instance.
|
|
1978
|
-
*/
|
|
1979
|
-
interface RemoteAttestationMessage {
|
|
1980
|
-
/** The unique identifier of the agent sending the attested message. */
|
|
1981
|
-
agentId: string;
|
|
1982
|
-
/** Timestamp (e.g., Unix epoch in milliseconds) when the message was attested or sent. */
|
|
1983
|
-
timestamp: number;
|
|
1984
|
-
/** The actual message content, including details about the entity, room, and the content itself. */
|
|
1985
|
-
message: {
|
|
1986
|
-
entityId: string;
|
|
1987
|
-
roomId: string;
|
|
1988
|
-
content: string;
|
|
1989
|
-
};
|
|
1990
|
-
}
|
|
1991
|
-
/**
|
|
1992
|
-
* Enumerates different types or vendors of Trusted Execution Environments (TEEs).
|
|
1993
|
-
* This allows the system to adapt to specific TEE technologies, like Intel TDX on DSTACK.
|
|
1994
|
-
*/
|
|
1995
|
-
declare enum TeeType {
|
|
1996
|
-
/** Represents Intel Trusted Domain Extensions (TDX) running on DSTACK infrastructure. */
|
|
1997
|
-
TDX_DSTACK = "tdx_dstack"
|
|
1998
|
-
}
|
|
1999
|
-
/**
|
|
2000
|
-
* Configuration for a TEE (Trusted Execution Environment) plugin.
|
|
2001
|
-
* This allows specifying the TEE vendor and any vendor-specific configurations.
|
|
2002
|
-
* It's used to initialize and configure TEE-related functionalities within the agent system.
|
|
2003
|
-
*/
|
|
2004
|
-
interface TeePluginConfig {
|
|
2005
|
-
/** Optional. The name or identifier of the TEE vendor (e.g., 'tdx_dstack' from `TeeType`). */
|
|
2006
|
-
vendor?: string;
|
|
2007
|
-
/** Optional. Vendor-specific configuration options, conforming to `TeeVendorConfig`. */
|
|
2008
|
-
vendorConfig?: Metadata;
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
/**
|
|
2012
|
-
* A standardized representation of a token holding.
|
|
2013
|
-
*/
|
|
2014
|
-
interface TokenBalance {
|
|
2015
|
-
address: string;
|
|
2016
|
-
balance: string;
|
|
2017
|
-
decimals: number;
|
|
2018
|
-
uiAmount?: number;
|
|
2019
|
-
name?: string;
|
|
2020
|
-
symbol?: string;
|
|
2021
|
-
logoURI?: string;
|
|
2022
|
-
}
|
|
2023
|
-
/**
|
|
2024
|
-
* Generic representation of token data that can be provided by various services.
|
|
2025
|
-
*/
|
|
2026
|
-
interface TokenData {
|
|
2027
|
-
id: string;
|
|
2028
|
-
symbol: string;
|
|
2029
|
-
name: string;
|
|
2030
|
-
address: string;
|
|
2031
|
-
chain: string;
|
|
2032
|
-
sourceProvider: string;
|
|
2033
|
-
price?: number;
|
|
2034
|
-
priceChange24hPercent?: number;
|
|
2035
|
-
priceChange24hUSD?: number;
|
|
2036
|
-
volume24hUSD?: number;
|
|
2037
|
-
marketCapUSD?: number;
|
|
2038
|
-
liquidity?: number;
|
|
2039
|
-
holders?: number;
|
|
2040
|
-
logoURI?: string;
|
|
2041
|
-
decimals?: number;
|
|
2042
|
-
lastUpdatedAt?: Date;
|
|
2043
|
-
raw?: any;
|
|
2044
|
-
}
|
|
2045
|
-
/**
|
|
2046
|
-
* Interface for a generic service that provides token data.
|
|
2047
|
-
*/
|
|
2048
|
-
declare abstract class ITokenDataService extends Service {
|
|
2049
|
-
static readonly serviceType: "token_data";
|
|
2050
|
-
readonly capabilityDescription: string;
|
|
2051
|
-
/**
|
|
2052
|
-
* Fetches detailed information for a single token.
|
|
2053
|
-
* @param address The token's contract address.
|
|
2054
|
-
* @param chain The blockchain the token resides on.
|
|
2055
|
-
* @returns A Promise resolving to TokenData or null if not found.
|
|
2056
|
-
*/
|
|
2057
|
-
abstract getTokenDetails(address: string, chain: string): Promise<TokenData | null>;
|
|
2058
|
-
/**
|
|
2059
|
-
* Fetches a list of trending tokens.
|
|
2060
|
-
* @param chain Optional: Filter by a specific blockchain.
|
|
2061
|
-
* @param limit Optional: Number of tokens to return. Defaults to a service-specific value.
|
|
2062
|
-
* @param timePeriod Optional: Time period for trending data (e.g., '24h', '7d'). Defaults to service-specific.
|
|
2063
|
-
* @returns A Promise resolving to an array of TokenData.
|
|
2064
|
-
*/
|
|
2065
|
-
abstract getTrendingTokens(chain?: string, limit?: number, timePeriod?: string): Promise<TokenData[]>;
|
|
2066
|
-
/**
|
|
2067
|
-
* Searches for tokens based on a query string.
|
|
2068
|
-
* @param query The search query (e.g., symbol, name, address).
|
|
2069
|
-
* @param chain Optional: Filter by a specific blockchain.
|
|
2070
|
-
* @param limit Optional: Number of results to return.
|
|
2071
|
-
* @returns A Promise resolving to an array of TokenData.
|
|
2072
|
-
*/
|
|
2073
|
-
abstract searchTokens(query: string, chain?: string, limit?: number): Promise<TokenData[]>;
|
|
2074
|
-
/**
|
|
2075
|
-
* Fetches data for multiple tokens by their addresses on a specific chain.
|
|
2076
|
-
* @param addresses Array of token contract addresses.
|
|
2077
|
-
* @param chain The blockchain the tokens reside on.
|
|
2078
|
-
* @returns A Promise resolving to an array of TokenData. May not include all requested if some are not found.
|
|
2079
|
-
*/
|
|
2080
|
-
abstract getTokensByAddresses(addresses: string[], chain: string): Promise<TokenData[]>;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
/**
|
|
2084
|
-
* Interface representing settings with string key-value pairs.
|
|
2085
|
-
*/
|
|
2086
|
-
interface RuntimeSettings {
|
|
2087
|
-
[key: string]: string | undefined;
|
|
2088
|
-
}
|
|
2089
|
-
interface Setting {
|
|
2090
|
-
name: string;
|
|
2091
|
-
description: string;
|
|
2092
|
-
usageDescription: string;
|
|
2093
|
-
value: string | boolean | null;
|
|
2094
|
-
required: boolean;
|
|
2095
|
-
public?: boolean;
|
|
2096
|
-
secret?: boolean;
|
|
2097
|
-
validation?: (value: any) => boolean;
|
|
2098
|
-
dependsOn?: string[];
|
|
2099
|
-
onSetAction?: (value: any) => string;
|
|
2100
|
-
visibleIf?: (settings: {
|
|
2101
|
-
[key: string]: Setting;
|
|
2102
|
-
}) => boolean;
|
|
2103
|
-
}
|
|
2104
|
-
interface WorldSettings {
|
|
2105
|
-
[key: string]: Setting;
|
|
2106
|
-
}
|
|
2107
|
-
interface OnboardingConfig {
|
|
2108
|
-
settings: {
|
|
2109
|
-
[key: string]: Omit<Setting, 'value'>;
|
|
2110
|
-
};
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
/**
|
|
2114
|
-
* Represents a single asset holding within a wallet, including its value.
|
|
2115
|
-
* This extends a generic TokenBalance with wallet-specific valuation.
|
|
2116
|
-
*/
|
|
2117
|
-
interface WalletAsset extends TokenBalance {
|
|
2118
|
-
priceUsd?: number;
|
|
2119
|
-
valueUsd?: number;
|
|
2120
|
-
}
|
|
2121
|
-
/**
|
|
2122
|
-
* Represents the entire portfolio of assets in a wallet.
|
|
2123
|
-
*/
|
|
2124
|
-
interface WalletPortfolio {
|
|
2125
|
-
totalValueUsd: number;
|
|
2126
|
-
assets: WalletAsset[];
|
|
2127
|
-
}
|
|
2128
|
-
/**
|
|
2129
|
-
* Abstract interface for a Wallet Service.
|
|
2130
|
-
* Plugins that provide wallet functionality (e.g., for Solana, EVM) should implement this service.
|
|
2131
|
-
* It provides a standardized way for other plugins to query the state of a wallet.
|
|
2132
|
-
*/
|
|
2133
|
-
declare abstract class IWalletService extends Service {
|
|
2134
|
-
static readonly serviceType: "wallet";
|
|
2135
|
-
readonly capabilityDescription = "Provides standardized access to wallet balances and portfolios.";
|
|
2136
|
-
/**
|
|
2137
|
-
* Retrieves the entire portfolio of assets held by the wallet.
|
|
2138
|
-
* @param owner - Optional: The specific wallet address/owner to query if the service manages multiple.
|
|
2139
|
-
* @returns A promise that resolves to the wallet's portfolio.
|
|
2140
|
-
*/
|
|
2141
|
-
abstract getPortfolio(owner?: string): Promise<WalletPortfolio>;
|
|
2142
|
-
/**
|
|
2143
|
-
* Retrieves the balance of a specific asset in the wallet.
|
|
2144
|
-
* @param assetAddress - The mint address or native identifier of the asset.
|
|
2145
|
-
* @param owner - Optional: The specific wallet address/owner to query.
|
|
2146
|
-
* @returns A promise that resolves to the user-friendly (decimal-adjusted) balance of the asset held.
|
|
2147
|
-
*/
|
|
2148
|
-
abstract getBalance(assetAddress: string, owner?: string): Promise<number>;
|
|
2149
|
-
/**
|
|
2150
|
-
* Transfers SOL from a specified keypair to a given public key.
|
|
2151
|
-
* This is a low-level function primarily for Solana-based wallet services.
|
|
2152
|
-
* @param from - The Keypair of the sender.
|
|
2153
|
-
* @param to - The PublicKey of the recipient.
|
|
2154
|
-
* @param lamports - The amount in lamports to transfer.
|
|
2155
|
-
* @returns A promise that resolves with the transaction signature.
|
|
2156
|
-
*/
|
|
2157
|
-
abstract transferSol(from: any, to: any, lamports: number): Promise<string>;
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
/**
|
|
2161
|
-
* A standardized representation of a liquidity pool from any DEX.
|
|
2162
|
-
*/
|
|
2163
|
-
type PoolInfo = {
|
|
2164
|
-
id: string;
|
|
2165
|
-
displayName?: string;
|
|
2166
|
-
dex: string;
|
|
2167
|
-
tokenA: {
|
|
2168
|
-
mint: string;
|
|
2169
|
-
symbol?: string;
|
|
2170
|
-
reserve?: string;
|
|
2171
|
-
decimals?: number;
|
|
2172
|
-
};
|
|
2173
|
-
tokenB: {
|
|
2174
|
-
mint: string;
|
|
2175
|
-
symbol?: string;
|
|
2176
|
-
reserve?: string;
|
|
2177
|
-
decimals?: number;
|
|
2178
|
-
};
|
|
2179
|
-
lpTokenMint?: string;
|
|
2180
|
-
apr?: number;
|
|
2181
|
-
apy?: number;
|
|
2182
|
-
tvl?: number;
|
|
2183
|
-
fee?: number;
|
|
2184
|
-
metadata?: Metadata;
|
|
2185
|
-
};
|
|
2186
|
-
/**
|
|
2187
|
-
* A standardized representation of a user's position in a liquidity pool.
|
|
2188
|
-
*/
|
|
2189
|
-
type LpPositionDetails = {
|
|
2190
|
-
poolId: string;
|
|
2191
|
-
dex: string;
|
|
2192
|
-
lpTokenBalance: TokenBalance;
|
|
2193
|
-
underlyingTokens: TokenBalance[];
|
|
2194
|
-
valueUsd?: number;
|
|
2195
|
-
accruedFees?: TokenBalance[];
|
|
2196
|
-
rewards?: TokenBalance[];
|
|
2197
|
-
metadata?: Metadata;
|
|
2198
|
-
};
|
|
2199
|
-
/**
|
|
2200
|
-
* A standardized result for blockchain transactions.
|
|
2201
|
-
*/
|
|
2202
|
-
type TransactionResult = {
|
|
2203
|
-
success: boolean;
|
|
2204
|
-
transactionId?: string;
|
|
2205
|
-
error?: string;
|
|
2206
|
-
data?: any;
|
|
2207
|
-
};
|
|
2208
|
-
/**
|
|
2209
|
-
* Abstract interface for a Liquidity Pool Service.
|
|
2210
|
-
* DEX-specific plugins (e.g., for Orca, Raydium) must implement this service
|
|
2211
|
-
* to allow the LP Manager to interact with them in a standardized way.
|
|
2212
|
-
*/
|
|
2213
|
-
declare abstract class ILpService extends Service {
|
|
2214
|
-
static readonly serviceType = "lp";
|
|
2215
|
-
readonly capabilityDescription = "Provides standardized access to DEX liquidity pools.";
|
|
2216
|
-
/**
|
|
2217
|
-
* Returns the name of the DEX this service interacts with.
|
|
2218
|
-
* @returns The name of the DEX (e.g., "Orca", "Raydium").
|
|
2219
|
-
*/
|
|
2220
|
-
abstract getDexName(): string;
|
|
2221
|
-
/**
|
|
2222
|
-
* Fetches a list of available liquidity pools from the DEX.
|
|
2223
|
-
* @param tokenAMint - Optional: Filter pools by the mint address of the first token.
|
|
2224
|
-
* @param tokenBMint - Optional: Filter pools by the mint address of the second token.
|
|
2225
|
-
* @returns A promise that resolves to an array of standardized PoolInfo objects.
|
|
2226
|
-
*/
|
|
2227
|
-
abstract getPools(tokenAMint?: string, tokenBMint?: string): Promise<PoolInfo[]>;
|
|
2228
|
-
/**
|
|
2229
|
-
* Adds liquidity to a specified pool.
|
|
2230
|
-
* @param params - The parameters for adding liquidity.
|
|
2231
|
-
* @returns A promise resolving to a transaction result, including the LP tokens received.
|
|
2232
|
-
*/
|
|
2233
|
-
abstract addLiquidity(params: {
|
|
2234
|
-
userVault: any;
|
|
2235
|
-
poolId: string;
|
|
2236
|
-
tokenAAmountLamports: string;
|
|
2237
|
-
tokenBAmountLamports?: string;
|
|
2238
|
-
slippageBps: number;
|
|
2239
|
-
tickLowerIndex?: number;
|
|
2240
|
-
tickUpperIndex?: number;
|
|
2241
|
-
}): Promise<TransactionResult & {
|
|
2242
|
-
lpTokensReceived?: TokenBalance;
|
|
2243
|
-
}>;
|
|
2244
|
-
/**
|
|
2245
|
-
* Removes liquidity from a specified pool.
|
|
2246
|
-
* @param params - The parameters for removing liquidity.
|
|
2247
|
-
* @returns A promise resolving to a transaction result, including the tokens received.
|
|
2248
|
-
*/
|
|
2249
|
-
abstract removeLiquidity(params: {
|
|
2250
|
-
userVault: any;
|
|
2251
|
-
poolId: string;
|
|
2252
|
-
lpTokenAmountLamports: string;
|
|
2253
|
-
slippageBps: number;
|
|
2254
|
-
}): Promise<TransactionResult & {
|
|
2255
|
-
tokensReceived?: TokenBalance[];
|
|
2256
|
-
}>;
|
|
2257
|
-
/**
|
|
2258
|
-
* Fetches the details of a specific LP position for a user.
|
|
2259
|
-
* @param userAccountPublicKey - The user's wallet public key.
|
|
2260
|
-
* @param poolOrPositionIdentifier - The identifier for the pool or a specific position (e.g., position NFT mint).
|
|
2261
|
-
* @returns A promise resolving to the position details or null if not found.
|
|
2262
|
-
*/
|
|
2263
|
-
abstract getLpPositionDetails(userAccountPublicKey: string, poolOrPositionIdentifier: string): Promise<LpPositionDetails | null>;
|
|
2264
|
-
/**
|
|
2265
|
-
* Fetches the latest market data (e.g., APY, TVL) for a list of pools.
|
|
2266
|
-
* @param poolIds - An array of pool IDs to fetch data for.
|
|
2267
|
-
* @returns A promise resolving to a map of pool IDs to their partial market data.
|
|
2268
|
-
*/
|
|
2269
|
-
abstract getMarketDataForPools(poolIds: string[]): Promise<Record<string, Partial<PoolInfo>>>;
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
interface PdfExtractionResult {
|
|
2273
|
-
text: string;
|
|
2274
|
-
pageCount: number;
|
|
2275
|
-
metadata?: {
|
|
2276
|
-
title?: string;
|
|
2277
|
-
author?: string;
|
|
2278
|
-
createdAt?: Date;
|
|
2279
|
-
modifiedAt?: Date;
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2282
|
-
interface PdfGenerationOptions {
|
|
2283
|
-
format?: 'A4' | 'A3' | 'Letter';
|
|
2284
|
-
orientation?: 'portrait' | 'landscape';
|
|
2285
|
-
margins?: {
|
|
2286
|
-
top?: number;
|
|
2287
|
-
bottom?: number;
|
|
2288
|
-
left?: number;
|
|
2289
|
-
right?: number;
|
|
2290
|
-
};
|
|
2291
|
-
header?: string;
|
|
2292
|
-
footer?: string;
|
|
2293
|
-
}
|
|
2294
|
-
interface PdfConversionOptions {
|
|
2295
|
-
quality?: 'high' | 'medium' | 'low';
|
|
2296
|
-
outputFormat?: 'pdf' | 'pdf/a';
|
|
2297
|
-
compression?: boolean;
|
|
2298
|
-
}
|
|
2299
|
-
/**
|
|
2300
|
-
* Interface for PDF processing services
|
|
2301
|
-
*/
|
|
2302
|
-
declare abstract class IPdfService extends Service {
|
|
2303
|
-
static readonly serviceType: "pdf";
|
|
2304
|
-
readonly capabilityDescription = "PDF processing, extraction, and generation capabilities";
|
|
2305
|
-
/**
|
|
2306
|
-
* Extract text and metadata from a PDF file
|
|
2307
|
-
* @param pdfPath - Path to the PDF file or buffer
|
|
2308
|
-
* @returns Promise resolving to extracted text and metadata
|
|
2309
|
-
*/
|
|
2310
|
-
abstract extractText(pdfPath: string | Buffer): Promise<PdfExtractionResult>;
|
|
2311
|
-
/**
|
|
2312
|
-
* Generate a PDF from HTML content
|
|
2313
|
-
* @param htmlContent - HTML content to convert to PDF
|
|
2314
|
-
* @param options - PDF generation options
|
|
2315
|
-
* @returns Promise resolving to PDF buffer
|
|
2316
|
-
*/
|
|
2317
|
-
abstract generatePdf(htmlContent: string, options?: PdfGenerationOptions): Promise<Buffer>;
|
|
2318
|
-
/**
|
|
2319
|
-
* Convert a document to PDF format
|
|
2320
|
-
* @param filePath - Path to the document file
|
|
2321
|
-
* @param options - Conversion options
|
|
2322
|
-
* @returns Promise resolving to PDF buffer
|
|
2323
|
-
*/
|
|
2324
|
-
abstract convertToPdf(filePath: string, options?: PdfConversionOptions): Promise<Buffer>;
|
|
2325
|
-
/**
|
|
2326
|
-
* Merge multiple PDF files into one
|
|
2327
|
-
* @param pdfPaths - Array of PDF file paths or buffers
|
|
2328
|
-
* @returns Promise resolving to merged PDF buffer
|
|
2329
|
-
*/
|
|
2330
|
-
abstract mergePdfs(pdfPaths: (string | Buffer)[]): Promise<Buffer>;
|
|
2331
|
-
/**
|
|
2332
|
-
* Split a PDF into individual pages
|
|
2333
|
-
* @param pdfPath - Path to the PDF file or buffer
|
|
2334
|
-
* @returns Promise resolving to array of page buffers
|
|
2335
|
-
*/
|
|
2336
|
-
abstract splitPdf(pdfPath: string | Buffer): Promise<Buffer[]>;
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
interface VideoInfo {
|
|
2340
|
-
title?: string;
|
|
2341
|
-
duration?: number;
|
|
2342
|
-
url: string;
|
|
2343
|
-
thumbnail?: string;
|
|
2344
|
-
description?: string;
|
|
2345
|
-
uploader?: string;
|
|
2346
|
-
viewCount?: number;
|
|
2347
|
-
uploadDate?: Date;
|
|
2348
|
-
formats?: VideoFormat[];
|
|
2349
|
-
}
|
|
2350
|
-
interface VideoFormat {
|
|
2351
|
-
formatId: string;
|
|
2352
|
-
url: string;
|
|
2353
|
-
extension: string;
|
|
2354
|
-
quality: string;
|
|
2355
|
-
fileSize?: number;
|
|
2356
|
-
videoCodec?: string;
|
|
2357
|
-
audioCodec?: string;
|
|
2358
|
-
resolution?: string;
|
|
2359
|
-
fps?: number;
|
|
2360
|
-
bitrate?: number;
|
|
2361
|
-
}
|
|
2362
|
-
interface VideoDownloadOptions {
|
|
2363
|
-
format?: string;
|
|
2364
|
-
quality?: 'best' | 'worst' | 'bestvideo' | 'bestaudio' | string;
|
|
2365
|
-
outputPath?: string;
|
|
2366
|
-
audioOnly?: boolean;
|
|
2367
|
-
videoOnly?: boolean;
|
|
2368
|
-
subtitles?: boolean;
|
|
2369
|
-
embedSubs?: boolean;
|
|
2370
|
-
writeInfoJson?: boolean;
|
|
2371
|
-
}
|
|
2372
|
-
interface VideoProcessingOptions {
|
|
2373
|
-
startTime?: number;
|
|
2374
|
-
endTime?: number;
|
|
2375
|
-
outputFormat?: string;
|
|
2376
|
-
resolution?: string;
|
|
2377
|
-
bitrate?: string;
|
|
2378
|
-
framerate?: number;
|
|
2379
|
-
audioCodec?: string;
|
|
2380
|
-
videoCodec?: string;
|
|
2381
|
-
}
|
|
2382
|
-
/**
|
|
2383
|
-
* Interface for video processing and download services
|
|
2384
|
-
*/
|
|
2385
|
-
declare abstract class IVideoService extends Service {
|
|
2386
|
-
static readonly serviceType: "video";
|
|
2387
|
-
readonly capabilityDescription = "Video download, processing, and conversion capabilities";
|
|
2388
|
-
/**
|
|
2389
|
-
* Get video information without downloading
|
|
2390
|
-
* @param url - Video URL
|
|
2391
|
-
* @returns Promise resolving to video information
|
|
2392
|
-
*/
|
|
2393
|
-
abstract getVideoInfo(url: string): Promise<VideoInfo>;
|
|
2394
|
-
/**
|
|
2395
|
-
* Download a video from URL
|
|
2396
|
-
* @param url - Video URL
|
|
2397
|
-
* @param options - Download options
|
|
2398
|
-
* @returns Promise resolving to downloaded file path
|
|
2399
|
-
*/
|
|
2400
|
-
abstract downloadVideo(url: string, options?: VideoDownloadOptions): Promise<string>;
|
|
2401
|
-
/**
|
|
2402
|
-
* Extract audio from video
|
|
2403
|
-
* @param videoPath - Path to video file or video URL
|
|
2404
|
-
* @param outputPath - Optional output path for audio file
|
|
2405
|
-
* @returns Promise resolving to audio file path
|
|
2406
|
-
*/
|
|
2407
|
-
abstract extractAudio(videoPath: string, outputPath?: string): Promise<string>;
|
|
2408
|
-
/**
|
|
2409
|
-
* Generate thumbnail from video
|
|
2410
|
-
* @param videoPath - Path to video file or video URL
|
|
2411
|
-
* @param timestamp - Timestamp in seconds to capture thumbnail
|
|
2412
|
-
* @returns Promise resolving to thumbnail image path
|
|
2413
|
-
*/
|
|
2414
|
-
abstract getThumbnail(videoPath: string, timestamp?: number): Promise<string>;
|
|
2415
|
-
/**
|
|
2416
|
-
* Convert video to different format
|
|
2417
|
-
* @param videoPath - Path to input video file
|
|
2418
|
-
* @param outputPath - Path for output video file
|
|
2419
|
-
* @param options - Processing options
|
|
2420
|
-
* @returns Promise resolving to converted video path
|
|
2421
|
-
*/
|
|
2422
|
-
abstract convertVideo(videoPath: string, outputPath: string, options?: VideoProcessingOptions): Promise<string>;
|
|
2423
|
-
/**
|
|
2424
|
-
* Get available formats for a video URL
|
|
2425
|
-
* @param url - Video URL
|
|
2426
|
-
* @returns Promise resolving to available formats
|
|
2427
|
-
*/
|
|
2428
|
-
abstract getAvailableFormats(url: string): Promise<VideoFormat[]>;
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
interface BrowserNavigationOptions {
|
|
2432
|
-
timeout?: number;
|
|
2433
|
-
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
|
|
2434
|
-
viewport?: {
|
|
2435
|
-
width: number;
|
|
2436
|
-
height: number;
|
|
2437
|
-
};
|
|
2438
|
-
userAgent?: string;
|
|
2439
|
-
headers?: Record<string, string>;
|
|
2440
|
-
}
|
|
2441
|
-
interface ScreenshotOptions {
|
|
2442
|
-
fullPage?: boolean;
|
|
2443
|
-
clip?: {
|
|
2444
|
-
x: number;
|
|
2445
|
-
y: number;
|
|
2446
|
-
width: number;
|
|
2447
|
-
height: number;
|
|
2448
|
-
};
|
|
2449
|
-
format?: 'png' | 'jpeg' | 'webp';
|
|
2450
|
-
quality?: number;
|
|
2451
|
-
omitBackground?: boolean;
|
|
2452
|
-
}
|
|
2453
|
-
interface ElementSelector {
|
|
2454
|
-
selector: string;
|
|
2455
|
-
text?: string;
|
|
2456
|
-
timeout?: number;
|
|
2457
|
-
}
|
|
2458
|
-
interface ExtractedContent {
|
|
2459
|
-
text: string;
|
|
2460
|
-
html: string;
|
|
2461
|
-
links: Array<{
|
|
2462
|
-
url: string;
|
|
2463
|
-
text: string;
|
|
2464
|
-
}>;
|
|
2465
|
-
images: Array<{
|
|
2466
|
-
src: string;
|
|
2467
|
-
alt?: string;
|
|
2468
|
-
}>;
|
|
2469
|
-
title?: string;
|
|
2470
|
-
metadata?: Record<string, string>;
|
|
2471
|
-
}
|
|
2472
|
-
interface ClickOptions {
|
|
2473
|
-
timeout?: number;
|
|
2474
|
-
force?: boolean;
|
|
2475
|
-
waitForNavigation?: boolean;
|
|
2476
|
-
}
|
|
2477
|
-
interface TypeOptions {
|
|
2478
|
-
delay?: number;
|
|
2479
|
-
timeout?: number;
|
|
2480
|
-
clear?: boolean;
|
|
2481
|
-
}
|
|
2482
|
-
/**
|
|
2483
|
-
* Interface for browser automation services
|
|
2484
|
-
*/
|
|
2485
|
-
declare abstract class IBrowserService extends Service {
|
|
2486
|
-
static readonly serviceType: "browser";
|
|
2487
|
-
readonly capabilityDescription = "Web browser automation and scraping capabilities";
|
|
2488
|
-
/**
|
|
2489
|
-
* Navigate to a URL
|
|
2490
|
-
* @param url - URL to navigate to
|
|
2491
|
-
* @param options - Navigation options
|
|
2492
|
-
* @returns Promise resolving when navigation completes
|
|
2493
|
-
*/
|
|
2494
|
-
abstract navigate(url: string, options?: BrowserNavigationOptions): Promise<void>;
|
|
2495
|
-
/**
|
|
2496
|
-
* Take a screenshot of the current page
|
|
2497
|
-
* @param options - Screenshot options
|
|
2498
|
-
* @returns Promise resolving to screenshot buffer
|
|
2499
|
-
*/
|
|
2500
|
-
abstract screenshot(options?: ScreenshotOptions): Promise<Buffer>;
|
|
2501
|
-
/**
|
|
2502
|
-
* Extract text and content from the current page
|
|
2503
|
-
* @param selector - Optional CSS selector to extract from specific element
|
|
2504
|
-
* @returns Promise resolving to extracted content
|
|
2505
|
-
*/
|
|
2506
|
-
abstract extractContent(selector?: string): Promise<ExtractedContent>;
|
|
2507
|
-
/**
|
|
2508
|
-
* Click on an element
|
|
2509
|
-
* @param selector - CSS selector or element selector
|
|
2510
|
-
* @param options - Click options
|
|
2511
|
-
* @returns Promise resolving when click completes
|
|
2512
|
-
*/
|
|
2513
|
-
abstract click(selector: string | ElementSelector, options?: ClickOptions): Promise<void>;
|
|
2514
|
-
/**
|
|
2515
|
-
* Type text into an input field
|
|
2516
|
-
* @param selector - CSS selector for input field
|
|
2517
|
-
* @param text - Text to type
|
|
2518
|
-
* @param options - Typing options
|
|
2519
|
-
* @returns Promise resolving when typing completes
|
|
2520
|
-
*/
|
|
2521
|
-
abstract type(selector: string, text: string, options?: TypeOptions): Promise<void>;
|
|
2522
|
-
/**
|
|
2523
|
-
* Wait for an element to appear
|
|
2524
|
-
* @param selector - CSS selector or element selector
|
|
2525
|
-
* @returns Promise resolving when element is found
|
|
2526
|
-
*/
|
|
2527
|
-
abstract waitForElement(selector: string | ElementSelector): Promise<void>;
|
|
2528
|
-
/**
|
|
2529
|
-
* Evaluate JavaScript in the browser context
|
|
2530
|
-
* @param script - JavaScript code to evaluate
|
|
2531
|
-
* @param args - Arguments to pass to the script
|
|
2532
|
-
* @returns Promise resolving to evaluation result
|
|
2533
|
-
*/
|
|
2534
|
-
abstract evaluate<T = any>(script: string, ...args: any[]): Promise<T>;
|
|
2535
|
-
/**
|
|
2536
|
-
* Get the current page URL
|
|
2537
|
-
* @returns Promise resolving to current URL
|
|
2538
|
-
*/
|
|
2539
|
-
abstract getCurrentUrl(): Promise<string>;
|
|
2540
|
-
/**
|
|
2541
|
-
* Go back in browser history
|
|
2542
|
-
* @returns Promise resolving when navigation completes
|
|
2543
|
-
*/
|
|
2544
|
-
abstract goBack(): Promise<void>;
|
|
2545
|
-
/**
|
|
2546
|
-
* Go forward in browser history
|
|
2547
|
-
* @returns Promise resolving when navigation completes
|
|
2548
|
-
*/
|
|
2549
|
-
abstract goForward(): Promise<void>;
|
|
2550
|
-
/**
|
|
2551
|
-
* Refresh the current page
|
|
2552
|
-
* @returns Promise resolving when refresh completes
|
|
2553
|
-
*/
|
|
2554
|
-
abstract refresh(): Promise<void>;
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
interface TranscriptionOptions {
|
|
2558
|
-
language?: string;
|
|
2559
|
-
model?: string;
|
|
2560
|
-
temperature?: number;
|
|
2561
|
-
prompt?: string;
|
|
2562
|
-
response_format?: 'json' | 'text' | 'srt' | 'vtt' | 'verbose_json';
|
|
2563
|
-
timestamp_granularities?: ('word' | 'segment')[];
|
|
2564
|
-
word_timestamps?: boolean;
|
|
2565
|
-
segment_timestamps?: boolean;
|
|
2566
|
-
}
|
|
2567
|
-
interface TranscriptionResult {
|
|
2568
|
-
text: string;
|
|
2569
|
-
language?: string;
|
|
2570
|
-
duration?: number;
|
|
2571
|
-
segments?: TranscriptionSegment[];
|
|
2572
|
-
words?: TranscriptionWord[];
|
|
2573
|
-
confidence?: number;
|
|
2574
|
-
}
|
|
2575
|
-
interface TranscriptionSegment {
|
|
2576
|
-
id: number;
|
|
2577
|
-
text: string;
|
|
2578
|
-
start: number;
|
|
2579
|
-
end: number;
|
|
2580
|
-
confidence?: number;
|
|
2581
|
-
tokens?: number[];
|
|
2582
|
-
temperature?: number;
|
|
2583
|
-
avg_logprob?: number;
|
|
2584
|
-
compression_ratio?: number;
|
|
2585
|
-
no_speech_prob?: number;
|
|
2586
|
-
}
|
|
2587
|
-
interface TranscriptionWord {
|
|
2588
|
-
word: string;
|
|
2589
|
-
start: number;
|
|
2590
|
-
end: number;
|
|
2591
|
-
confidence?: number;
|
|
2592
|
-
}
|
|
2593
|
-
interface SpeechToTextOptions {
|
|
2594
|
-
language?: string;
|
|
2595
|
-
model?: string;
|
|
2596
|
-
continuous?: boolean;
|
|
2597
|
-
interimResults?: boolean;
|
|
2598
|
-
maxAlternatives?: number;
|
|
2599
|
-
}
|
|
2600
|
-
interface TextToSpeechOptions {
|
|
2601
|
-
voice?: string;
|
|
2602
|
-
model?: string;
|
|
2603
|
-
speed?: number;
|
|
2604
|
-
format?: 'mp3' | 'wav' | 'flac' | 'aac';
|
|
2605
|
-
response_format?: 'mp3' | 'opus' | 'aac' | 'flac';
|
|
2606
|
-
}
|
|
2607
|
-
/**
|
|
2608
|
-
* Interface for audio transcription and speech services
|
|
2609
|
-
*/
|
|
2610
|
-
declare abstract class ITranscriptionService extends Service {
|
|
2611
|
-
static readonly serviceType: "transcription";
|
|
2612
|
-
readonly capabilityDescription = "Audio transcription and speech processing capabilities";
|
|
2613
|
-
/**
|
|
2614
|
-
* Transcribe audio file to text
|
|
2615
|
-
* @param audioPath - Path to audio file or audio buffer
|
|
2616
|
-
* @param options - Transcription options
|
|
2617
|
-
* @returns Promise resolving to transcription result
|
|
2618
|
-
*/
|
|
2619
|
-
abstract transcribeAudio(audioPath: string | Buffer, options?: TranscriptionOptions): Promise<TranscriptionResult>;
|
|
2620
|
-
/**
|
|
2621
|
-
* Transcribe video file to text (extracts audio first)
|
|
2622
|
-
* @param videoPath - Path to video file or video buffer
|
|
2623
|
-
* @param options - Transcription options
|
|
2624
|
-
* @returns Promise resolving to transcription result
|
|
2625
|
-
*/
|
|
2626
|
-
abstract transcribeVideo(videoPath: string | Buffer, options?: TranscriptionOptions): Promise<TranscriptionResult>;
|
|
2627
|
-
/**
|
|
2628
|
-
* Real-time speech to text from audio stream
|
|
2629
|
-
* @param audioStream - Audio stream or buffer
|
|
2630
|
-
* @param options - Speech to text options
|
|
2631
|
-
* @returns Promise resolving to transcription result
|
|
2632
|
-
*/
|
|
2633
|
-
abstract speechToText(audioStream: NodeJS.ReadableStream | Buffer, options?: SpeechToTextOptions): Promise<TranscriptionResult>;
|
|
2634
|
-
/**
|
|
2635
|
-
* Convert text to speech
|
|
2636
|
-
* @param text - Text to convert to speech
|
|
2637
|
-
* @param options - Text to speech options
|
|
2638
|
-
* @returns Promise resolving to audio buffer
|
|
2639
|
-
*/
|
|
2640
|
-
abstract textToSpeech(text: string, options?: TextToSpeechOptions): Promise<Buffer>;
|
|
2641
|
-
/**
|
|
2642
|
-
* Get supported languages for transcription
|
|
2643
|
-
* @returns Promise resolving to array of supported language codes
|
|
2644
|
-
*/
|
|
2645
|
-
abstract getSupportedLanguages(): Promise<string[]>;
|
|
2646
|
-
/**
|
|
2647
|
-
* Get available voices for text to speech
|
|
2648
|
-
* @returns Promise resolving to array of available voices
|
|
2649
|
-
*/
|
|
2650
|
-
abstract getAvailableVoices(): Promise<Array<{
|
|
2651
|
-
id: string;
|
|
2652
|
-
name: string;
|
|
2653
|
-
language: string;
|
|
2654
|
-
gender?: 'male' | 'female' | 'neutral';
|
|
2655
|
-
}>>;
|
|
2656
|
-
/**
|
|
2657
|
-
* Detect language of audio file
|
|
2658
|
-
* @param audioPath - Path to audio file or audio buffer
|
|
2659
|
-
* @returns Promise resolving to detected language code
|
|
2660
|
-
*/
|
|
2661
|
-
abstract detectLanguage(audioPath: string | Buffer): Promise<string>;
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
interface SearchOptions {
|
|
2665
|
-
limit?: number;
|
|
2666
|
-
offset?: number;
|
|
2667
|
-
language?: string;
|
|
2668
|
-
region?: string;
|
|
2669
|
-
dateRange?: {
|
|
2670
|
-
start?: Date;
|
|
2671
|
-
end?: Date;
|
|
2672
|
-
};
|
|
2673
|
-
fileType?: string;
|
|
2674
|
-
site?: string;
|
|
2675
|
-
sortBy?: 'relevance' | 'date' | 'popularity';
|
|
2676
|
-
safeSearch?: 'strict' | 'moderate' | 'off';
|
|
2677
|
-
}
|
|
2678
|
-
interface SearchResult {
|
|
2679
|
-
title: string;
|
|
2680
|
-
url: string;
|
|
2681
|
-
description: string;
|
|
2682
|
-
displayUrl?: string;
|
|
2683
|
-
thumbnail?: string;
|
|
2684
|
-
publishedDate?: Date;
|
|
2685
|
-
source?: string;
|
|
2686
|
-
relevanceScore?: number;
|
|
2687
|
-
snippet?: string;
|
|
2688
|
-
}
|
|
2689
|
-
interface SearchResponse {
|
|
2690
|
-
query: string;
|
|
2691
|
-
results: SearchResult[];
|
|
2692
|
-
totalResults?: number;
|
|
2693
|
-
searchTime?: number;
|
|
2694
|
-
suggestions?: string[];
|
|
2695
|
-
nextPageToken?: string;
|
|
2696
|
-
relatedSearches?: string[];
|
|
2697
|
-
}
|
|
2698
|
-
interface NewsSearchOptions extends SearchOptions {
|
|
2699
|
-
category?: 'general' | 'business' | 'entertainment' | 'health' | 'science' | 'sports' | 'technology';
|
|
2700
|
-
freshness?: 'day' | 'week' | 'month';
|
|
2701
|
-
}
|
|
2702
|
-
interface ImageSearchOptions extends SearchOptions {
|
|
2703
|
-
size?: 'small' | 'medium' | 'large' | 'wallpaper' | 'any';
|
|
2704
|
-
color?: 'color' | 'monochrome' | 'red' | 'orange' | 'yellow' | 'green' | 'blue' | 'purple' | 'pink' | 'brown' | 'black' | 'gray' | 'white';
|
|
2705
|
-
type?: 'photo' | 'clipart' | 'line' | 'animated';
|
|
2706
|
-
layout?: 'square' | 'wide' | 'tall' | 'any';
|
|
2707
|
-
license?: 'any' | 'public' | 'share' | 'sharecommercially' | 'modify';
|
|
2708
|
-
}
|
|
2709
|
-
interface VideoSearchOptions extends SearchOptions {
|
|
2710
|
-
duration?: 'short' | 'medium' | 'long' | 'any';
|
|
2711
|
-
resolution?: 'high' | 'standard' | 'any';
|
|
2712
|
-
quality?: 'high' | 'standard' | 'any';
|
|
2713
|
-
}
|
|
2714
|
-
/**
|
|
2715
|
-
* Interface for web search services
|
|
2716
|
-
*/
|
|
2717
|
-
declare abstract class IWebSearchService extends Service {
|
|
2718
|
-
static readonly serviceType: "web_search";
|
|
2719
|
-
readonly capabilityDescription = "Web search and content discovery capabilities";
|
|
2720
|
-
/**
|
|
2721
|
-
* Perform a general web search
|
|
2722
|
-
* @param query - Search query
|
|
2723
|
-
* @param options - Search options
|
|
2724
|
-
* @returns Promise resolving to search results
|
|
2725
|
-
*/
|
|
2726
|
-
abstract search(query: string, options?: SearchOptions): Promise<SearchResponse>;
|
|
2727
|
-
/**
|
|
2728
|
-
* Search for news articles
|
|
2729
|
-
* @param query - Search query
|
|
2730
|
-
* @param options - News search options
|
|
2731
|
-
* @returns Promise resolving to news search results
|
|
2732
|
-
*/
|
|
2733
|
-
abstract searchNews(query: string, options?: NewsSearchOptions): Promise<SearchResponse>;
|
|
2734
|
-
/**
|
|
2735
|
-
* Search for images
|
|
2736
|
-
* @param query - Search query
|
|
2737
|
-
* @param options - Image search options
|
|
2738
|
-
* @returns Promise resolving to image search results
|
|
2739
|
-
*/
|
|
2740
|
-
abstract searchImages(query: string, options?: ImageSearchOptions): Promise<SearchResponse>;
|
|
2741
|
-
/**
|
|
2742
|
-
* Search for videos
|
|
2743
|
-
* @param query - Search query
|
|
2744
|
-
* @param options - Video search options
|
|
2745
|
-
* @returns Promise resolving to video search results
|
|
2746
|
-
*/
|
|
2747
|
-
abstract searchVideos(query: string, options?: VideoSearchOptions): Promise<SearchResponse>;
|
|
2748
|
-
/**
|
|
2749
|
-
* Get search suggestions for a query
|
|
2750
|
-
* @param query - Partial search query
|
|
2751
|
-
* @returns Promise resolving to array of suggestions
|
|
2752
|
-
*/
|
|
2753
|
-
abstract getSuggestions(query: string): Promise<string[]>;
|
|
2754
|
-
/**
|
|
2755
|
-
* Get trending searches
|
|
2756
|
-
* @param region - Optional region code
|
|
2757
|
-
* @returns Promise resolving to trending search queries
|
|
2758
|
-
*/
|
|
2759
|
-
abstract getTrendingSearches(region?: string): Promise<string[]>;
|
|
2760
|
-
/**
|
|
2761
|
-
* Get detailed information about a specific URL
|
|
2762
|
-
* @param url - URL to analyze
|
|
2763
|
-
* @returns Promise resolving to page information
|
|
2764
|
-
*/
|
|
2765
|
-
abstract getPageInfo(url: string): Promise<{
|
|
2766
|
-
title: string;
|
|
2767
|
-
description: string;
|
|
2768
|
-
content: string;
|
|
2769
|
-
metadata: Record<string, string>;
|
|
2770
|
-
images: string[];
|
|
2771
|
-
links: string[];
|
|
2772
|
-
}>;
|
|
2773
|
-
}
|
|
2774
|
-
|
|
2775
|
-
interface EmailAddress {
|
|
2776
|
-
email: string;
|
|
2777
|
-
name?: string;
|
|
2778
|
-
}
|
|
2779
|
-
interface EmailAttachment {
|
|
2780
|
-
filename: string;
|
|
2781
|
-
content: Buffer | string;
|
|
2782
|
-
contentType?: string;
|
|
2783
|
-
contentDisposition?: 'attachment' | 'inline';
|
|
2784
|
-
cid?: string;
|
|
2785
|
-
}
|
|
2786
|
-
interface EmailMessage {
|
|
2787
|
-
from: EmailAddress;
|
|
2788
|
-
to: EmailAddress[];
|
|
2789
|
-
cc?: EmailAddress[];
|
|
2790
|
-
bcc?: EmailAddress[];
|
|
2791
|
-
subject: string;
|
|
2792
|
-
text?: string;
|
|
2793
|
-
html?: string;
|
|
2794
|
-
attachments?: EmailAttachment[];
|
|
2795
|
-
replyTo?: EmailAddress;
|
|
2796
|
-
date?: Date;
|
|
2797
|
-
messageId?: string;
|
|
2798
|
-
references?: string[];
|
|
2799
|
-
inReplyTo?: string;
|
|
2800
|
-
priority?: 'high' | 'normal' | 'low';
|
|
2801
|
-
}
|
|
2802
|
-
interface EmailSendOptions {
|
|
2803
|
-
retry?: number;
|
|
2804
|
-
timeout?: number;
|
|
2805
|
-
trackOpens?: boolean;
|
|
2806
|
-
trackClicks?: boolean;
|
|
2807
|
-
tags?: string[];
|
|
2808
|
-
}
|
|
2809
|
-
interface EmailSearchOptions {
|
|
2810
|
-
query?: string;
|
|
2811
|
-
from?: string;
|
|
2812
|
-
to?: string;
|
|
2813
|
-
subject?: string;
|
|
2814
|
-
folder?: string;
|
|
2815
|
-
since?: Date;
|
|
2816
|
-
before?: Date;
|
|
2817
|
-
limit?: number;
|
|
2818
|
-
offset?: number;
|
|
2819
|
-
unread?: boolean;
|
|
2820
|
-
flagged?: boolean;
|
|
2821
|
-
hasAttachments?: boolean;
|
|
2822
|
-
}
|
|
2823
|
-
interface EmailFolder {
|
|
2824
|
-
name: string;
|
|
2825
|
-
path: string;
|
|
2826
|
-
type: 'inbox' | 'sent' | 'drafts' | 'trash' | 'spam' | 'custom';
|
|
2827
|
-
messageCount?: number;
|
|
2828
|
-
unreadCount?: number;
|
|
2829
|
-
children?: EmailFolder[];
|
|
2830
|
-
}
|
|
2831
|
-
interface EmailAccount {
|
|
2832
|
-
email: string;
|
|
2833
|
-
name?: string;
|
|
2834
|
-
provider?: string;
|
|
2835
|
-
folders?: EmailFolder[];
|
|
2836
|
-
quotaUsed?: number;
|
|
2837
|
-
quotaLimit?: number;
|
|
2838
|
-
}
|
|
2839
|
-
/**
|
|
2840
|
-
* Interface for email services
|
|
2841
|
-
*/
|
|
2842
|
-
declare abstract class IEmailService extends Service {
|
|
2843
|
-
static readonly serviceType: "email";
|
|
2844
|
-
readonly capabilityDescription = "Email sending, receiving, and management capabilities";
|
|
2845
|
-
/**
|
|
2846
|
-
* Send an email
|
|
2847
|
-
* @param message - Email message to send
|
|
2848
|
-
* @param options - Send options
|
|
2849
|
-
* @returns Promise resolving to message ID
|
|
2850
|
-
*/
|
|
2851
|
-
abstract sendEmail(message: EmailMessage, options?: EmailSendOptions): Promise<string>;
|
|
2852
|
-
/**
|
|
2853
|
-
* Get emails from a folder
|
|
2854
|
-
* @param options - Search options
|
|
2855
|
-
* @returns Promise resolving to array of emails
|
|
2856
|
-
*/
|
|
2857
|
-
abstract getEmails(options?: EmailSearchOptions): Promise<EmailMessage[]>;
|
|
2858
|
-
/**
|
|
2859
|
-
* Get a specific email by ID
|
|
2860
|
-
* @param messageId - Message ID
|
|
2861
|
-
* @returns Promise resolving to email message
|
|
2862
|
-
*/
|
|
2863
|
-
abstract getEmail(messageId: string): Promise<EmailMessage>;
|
|
2864
|
-
/**
|
|
2865
|
-
* Delete an email
|
|
2866
|
-
* @param messageId - Message ID
|
|
2867
|
-
* @returns Promise resolving when deletion completes
|
|
2868
|
-
*/
|
|
2869
|
-
abstract deleteEmail(messageId: string): Promise<void>;
|
|
2870
|
-
/**
|
|
2871
|
-
* Mark an email as read/unread
|
|
2872
|
-
* @param messageId - Message ID
|
|
2873
|
-
* @param read - True to mark as read, false for unread
|
|
2874
|
-
* @returns Promise resolving when operation completes
|
|
2875
|
-
*/
|
|
2876
|
-
abstract markEmailAsRead(messageId: string, read: boolean): Promise<void>;
|
|
2877
|
-
/**
|
|
2878
|
-
* Flag/unflag an email
|
|
2879
|
-
* @param messageId - Message ID
|
|
2880
|
-
* @param flagged - True to flag, false to unflag
|
|
2881
|
-
* @returns Promise resolving when operation completes
|
|
2882
|
-
*/
|
|
2883
|
-
abstract flagEmail(messageId: string, flagged: boolean): Promise<void>;
|
|
2884
|
-
/**
|
|
2885
|
-
* Move email to a different folder
|
|
2886
|
-
* @param messageId - Message ID
|
|
2887
|
-
* @param folderPath - Destination folder path
|
|
2888
|
-
* @returns Promise resolving when move completes
|
|
2889
|
-
*/
|
|
2890
|
-
abstract moveEmail(messageId: string, folderPath: string): Promise<void>;
|
|
2891
|
-
/**
|
|
2892
|
-
* Get available folders
|
|
2893
|
-
* @returns Promise resolving to array of folders
|
|
2894
|
-
*/
|
|
2895
|
-
abstract getFolders(): Promise<EmailFolder[]>;
|
|
2896
|
-
/**
|
|
2897
|
-
* Create a new folder
|
|
2898
|
-
* @param folderName - Name of the folder
|
|
2899
|
-
* @param parentPath - Optional parent folder path
|
|
2900
|
-
* @returns Promise resolving when folder is created
|
|
2901
|
-
*/
|
|
2902
|
-
abstract createFolder(folderName: string, parentPath?: string): Promise<void>;
|
|
2903
|
-
/**
|
|
2904
|
-
* Get account information
|
|
2905
|
-
* @returns Promise resolving to account details
|
|
2906
|
-
*/
|
|
2907
|
-
abstract getAccountInfo(): Promise<EmailAccount>;
|
|
2908
|
-
/**
|
|
2909
|
-
* Search emails
|
|
2910
|
-
* @param query - Search query
|
|
2911
|
-
* @param options - Search options
|
|
2912
|
-
* @returns Promise resolving to search results
|
|
2913
|
-
*/
|
|
2914
|
-
abstract searchEmails(query: string, options?: EmailSearchOptions): Promise<EmailMessage[]>;
|
|
2915
|
-
}
|
|
2916
|
-
|
|
2917
|
-
interface MessageParticipant {
|
|
2918
|
-
id: UUID;
|
|
2919
|
-
name: string;
|
|
2920
|
-
username?: string;
|
|
2921
|
-
avatar?: string;
|
|
2922
|
-
status?: 'online' | 'offline' | 'away' | 'busy';
|
|
2923
|
-
}
|
|
2924
|
-
interface MessageAttachment {
|
|
2925
|
-
id: UUID;
|
|
2926
|
-
filename: string;
|
|
2927
|
-
url: string;
|
|
2928
|
-
mimeType: string;
|
|
2929
|
-
size: number;
|
|
2930
|
-
width?: number;
|
|
2931
|
-
height?: number;
|
|
2932
|
-
duration?: number;
|
|
2933
|
-
thumbnail?: string;
|
|
2934
|
-
}
|
|
2935
|
-
interface MessageReaction {
|
|
2936
|
-
emoji: string;
|
|
2937
|
-
count: number;
|
|
2938
|
-
users: UUID[];
|
|
2939
|
-
hasReacted: boolean;
|
|
2940
|
-
}
|
|
2941
|
-
interface MessageReference {
|
|
2942
|
-
messageId: UUID;
|
|
2943
|
-
channelId: UUID;
|
|
2944
|
-
type: 'reply' | 'forward' | 'quote';
|
|
2945
|
-
}
|
|
2946
|
-
interface MessageContent {
|
|
2947
|
-
text?: string;
|
|
2948
|
-
html?: string;
|
|
2949
|
-
markdown?: string;
|
|
2950
|
-
attachments?: MessageAttachment[];
|
|
2951
|
-
reactions?: MessageReaction[];
|
|
2952
|
-
reference?: MessageReference;
|
|
2953
|
-
mentions?: UUID[];
|
|
2954
|
-
embeds?: Array<{
|
|
2955
|
-
title?: string;
|
|
2956
|
-
description?: string;
|
|
2957
|
-
url?: string;
|
|
2958
|
-
image?: string;
|
|
2959
|
-
fields?: Array<{
|
|
2960
|
-
name: string;
|
|
2961
|
-
value: string;
|
|
2962
|
-
inline?: boolean;
|
|
2963
|
-
}>;
|
|
2964
|
-
}>;
|
|
2965
|
-
}
|
|
2966
|
-
interface MessageInfo {
|
|
2967
|
-
id: UUID;
|
|
2968
|
-
channelId: UUID;
|
|
2969
|
-
senderId: UUID;
|
|
2970
|
-
content: MessageContent;
|
|
2971
|
-
timestamp: Date;
|
|
2972
|
-
edited?: Date;
|
|
2973
|
-
deleted?: Date;
|
|
2974
|
-
pinned?: boolean;
|
|
2975
|
-
thread?: {
|
|
2976
|
-
id: UUID;
|
|
2977
|
-
messageCount: number;
|
|
2978
|
-
participants: UUID[];
|
|
2979
|
-
lastMessageAt: Date;
|
|
2980
|
-
};
|
|
2981
|
-
}
|
|
2982
|
-
interface MessageSendOptions {
|
|
2983
|
-
replyTo?: UUID;
|
|
2984
|
-
ephemeral?: boolean;
|
|
2985
|
-
silent?: boolean;
|
|
2986
|
-
scheduled?: Date;
|
|
2987
|
-
thread?: UUID;
|
|
2988
|
-
nonce?: string;
|
|
2989
|
-
}
|
|
2990
|
-
interface MessageSearchOptions {
|
|
2991
|
-
query?: string;
|
|
2992
|
-
channelId?: UUID;
|
|
2993
|
-
senderId?: UUID;
|
|
2994
|
-
before?: Date;
|
|
2995
|
-
after?: Date;
|
|
2996
|
-
limit?: number;
|
|
2997
|
-
offset?: number;
|
|
2998
|
-
hasAttachments?: boolean;
|
|
2999
|
-
pinned?: boolean;
|
|
3000
|
-
mentions?: UUID;
|
|
3001
|
-
}
|
|
3002
|
-
interface MessageChannel {
|
|
3003
|
-
id: UUID;
|
|
3004
|
-
name: string;
|
|
3005
|
-
type: 'text' | 'voice' | 'dm' | 'group' | 'announcement' | 'thread';
|
|
3006
|
-
description?: string;
|
|
3007
|
-
participants?: MessageParticipant[];
|
|
3008
|
-
permissions?: {
|
|
3009
|
-
canSend: boolean;
|
|
3010
|
-
canRead: boolean;
|
|
3011
|
-
canDelete: boolean;
|
|
3012
|
-
canPin: boolean;
|
|
3013
|
-
canManage: boolean;
|
|
3014
|
-
};
|
|
3015
|
-
lastMessageAt?: Date;
|
|
3016
|
-
messageCount?: number;
|
|
3017
|
-
unreadCount?: number;
|
|
3018
|
-
}
|
|
3019
|
-
/**
|
|
3020
|
-
* Interface for messaging services
|
|
3021
|
-
*/
|
|
3022
|
-
declare abstract class IMessageService extends Service {
|
|
3023
|
-
static readonly serviceType: "message";
|
|
3024
|
-
readonly capabilityDescription = "Message sending, receiving, and management capabilities";
|
|
3025
|
-
/**
|
|
3026
|
-
* Send a message to a channel
|
|
3027
|
-
* @param channelId - Channel ID
|
|
3028
|
-
* @param content - Message content
|
|
3029
|
-
* @param options - Send options
|
|
3030
|
-
* @returns Promise resolving to message ID
|
|
3031
|
-
*/
|
|
3032
|
-
abstract sendMessage(channelId: UUID, content: MessageContent, options?: MessageSendOptions): Promise<UUID>;
|
|
3033
|
-
/**
|
|
3034
|
-
* Get messages from a channel
|
|
3035
|
-
* @param channelId - Channel ID
|
|
3036
|
-
* @param options - Search options
|
|
3037
|
-
* @returns Promise resolving to array of messages
|
|
3038
|
-
*/
|
|
3039
|
-
abstract getMessages(channelId: UUID, options?: MessageSearchOptions): Promise<MessageInfo[]>;
|
|
3040
|
-
/**
|
|
3041
|
-
* Get a specific message by ID
|
|
3042
|
-
* @param messageId - Message ID
|
|
3043
|
-
* @returns Promise resolving to message
|
|
3044
|
-
*/
|
|
3045
|
-
abstract getMessage(messageId: UUID): Promise<MessageInfo>;
|
|
3046
|
-
/**
|
|
3047
|
-
* Edit a message
|
|
3048
|
-
* @param messageId - Message ID
|
|
3049
|
-
* @param content - New message content
|
|
3050
|
-
* @returns Promise resolving when edit completes
|
|
3051
|
-
*/
|
|
3052
|
-
abstract editMessage(messageId: UUID, content: MessageContent): Promise<void>;
|
|
3053
|
-
/**
|
|
3054
|
-
* Delete a message
|
|
3055
|
-
* @param messageId - Message ID
|
|
3056
|
-
* @returns Promise resolving when deletion completes
|
|
3057
|
-
*/
|
|
3058
|
-
abstract deleteMessage(messageId: UUID): Promise<void>;
|
|
3059
|
-
/**
|
|
3060
|
-
* Add a reaction to a message
|
|
3061
|
-
* @param messageId - Message ID
|
|
3062
|
-
* @param emoji - Reaction emoji
|
|
3063
|
-
* @returns Promise resolving when reaction is added
|
|
3064
|
-
*/
|
|
3065
|
-
abstract addReaction(messageId: UUID, emoji: string): Promise<void>;
|
|
3066
|
-
/**
|
|
3067
|
-
* Remove a reaction from a message
|
|
3068
|
-
* @param messageId - Message ID
|
|
3069
|
-
* @param emoji - Reaction emoji
|
|
3070
|
-
* @returns Promise resolving when reaction is removed
|
|
3071
|
-
*/
|
|
3072
|
-
abstract removeReaction(messageId: UUID, emoji: string): Promise<void>;
|
|
3073
|
-
/**
|
|
3074
|
-
* Pin a message
|
|
3075
|
-
* @param messageId - Message ID
|
|
3076
|
-
* @returns Promise resolving when message is pinned
|
|
3077
|
-
*/
|
|
3078
|
-
abstract pinMessage(messageId: UUID): Promise<void>;
|
|
3079
|
-
/**
|
|
3080
|
-
* Unpin a message
|
|
3081
|
-
* @param messageId - Message ID
|
|
3082
|
-
* @returns Promise resolving when message is unpinned
|
|
3083
|
-
*/
|
|
3084
|
-
abstract unpinMessage(messageId: UUID): Promise<void>;
|
|
3085
|
-
/**
|
|
3086
|
-
* Get available channels
|
|
3087
|
-
* @returns Promise resolving to array of channels
|
|
3088
|
-
*/
|
|
3089
|
-
abstract getChannels(): Promise<MessageChannel[]>;
|
|
3090
|
-
/**
|
|
3091
|
-
* Get channel information
|
|
3092
|
-
* @param channelId - Channel ID
|
|
3093
|
-
* @returns Promise resolving to channel info
|
|
3094
|
-
*/
|
|
3095
|
-
abstract getChannel(channelId: UUID): Promise<MessageChannel>;
|
|
3096
|
-
/**
|
|
3097
|
-
* Create a new channel
|
|
3098
|
-
* @param name - Channel name
|
|
3099
|
-
* @param type - Channel type
|
|
3100
|
-
* @param options - Channel options
|
|
3101
|
-
* @returns Promise resolving to new channel ID
|
|
3102
|
-
*/
|
|
3103
|
-
abstract createChannel(name: string, type: MessageChannel['type'], options?: {
|
|
3104
|
-
description?: string;
|
|
3105
|
-
participants?: UUID[];
|
|
3106
|
-
private?: boolean;
|
|
3107
|
-
}): Promise<UUID>;
|
|
3108
|
-
/**
|
|
3109
|
-
* Search messages across channels
|
|
3110
|
-
* @param query - Search query
|
|
3111
|
-
* @param options - Search options
|
|
3112
|
-
* @returns Promise resolving to search results
|
|
3113
|
-
*/
|
|
3114
|
-
abstract searchMessages(query: string, options?: MessageSearchOptions): Promise<MessageInfo[]>;
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
interface PostMedia {
|
|
3118
|
-
id: UUID;
|
|
3119
|
-
url: string;
|
|
3120
|
-
type: 'image' | 'video' | 'audio' | 'document';
|
|
3121
|
-
mimeType: string;
|
|
3122
|
-
size: number;
|
|
3123
|
-
width?: number;
|
|
3124
|
-
height?: number;
|
|
3125
|
-
duration?: number;
|
|
3126
|
-
thumbnail?: string;
|
|
3127
|
-
description?: string;
|
|
3128
|
-
altText?: string;
|
|
3129
|
-
}
|
|
3130
|
-
interface PostLocation {
|
|
3131
|
-
name: string;
|
|
3132
|
-
address?: string;
|
|
3133
|
-
coordinates?: {
|
|
3134
|
-
latitude: number;
|
|
3135
|
-
longitude: number;
|
|
3136
|
-
};
|
|
3137
|
-
placeId?: string;
|
|
3138
|
-
}
|
|
3139
|
-
interface PostAuthor {
|
|
3140
|
-
id: UUID;
|
|
3141
|
-
username: string;
|
|
3142
|
-
displayName: string;
|
|
3143
|
-
avatar?: string;
|
|
3144
|
-
verified?: boolean;
|
|
3145
|
-
followerCount?: number;
|
|
3146
|
-
followingCount?: number;
|
|
3147
|
-
bio?: string;
|
|
3148
|
-
website?: string;
|
|
3149
|
-
}
|
|
3150
|
-
interface PostEngagement {
|
|
3151
|
-
likes: number;
|
|
3152
|
-
shares: number;
|
|
3153
|
-
comments: number;
|
|
3154
|
-
views?: number;
|
|
3155
|
-
hasLiked: boolean;
|
|
3156
|
-
hasShared: boolean;
|
|
3157
|
-
hasCommented: boolean;
|
|
3158
|
-
hasSaved: boolean;
|
|
3159
|
-
}
|
|
3160
|
-
interface PostContent {
|
|
3161
|
-
text?: string;
|
|
3162
|
-
html?: string;
|
|
3163
|
-
media?: PostMedia[];
|
|
3164
|
-
location?: PostLocation;
|
|
3165
|
-
tags?: string[];
|
|
3166
|
-
mentions?: UUID[];
|
|
3167
|
-
links?: Array<{
|
|
3168
|
-
url: string;
|
|
3169
|
-
title?: string;
|
|
3170
|
-
description?: string;
|
|
3171
|
-
image?: string;
|
|
3172
|
-
}>;
|
|
3173
|
-
poll?: {
|
|
3174
|
-
question: string;
|
|
3175
|
-
options: Array<{
|
|
3176
|
-
text: string;
|
|
3177
|
-
votes: number;
|
|
3178
|
-
}>;
|
|
3179
|
-
expiresAt?: Date;
|
|
3180
|
-
multipleChoice?: boolean;
|
|
3181
|
-
};
|
|
3182
|
-
}
|
|
3183
|
-
interface PostInfo {
|
|
3184
|
-
id: UUID;
|
|
3185
|
-
author: PostAuthor;
|
|
3186
|
-
content: PostContent;
|
|
3187
|
-
platform: string;
|
|
3188
|
-
platformId: string;
|
|
3189
|
-
url: string;
|
|
3190
|
-
createdAt: Date;
|
|
3191
|
-
editedAt?: Date;
|
|
3192
|
-
scheduledAt?: Date;
|
|
3193
|
-
engagement: PostEngagement;
|
|
3194
|
-
visibility: 'public' | 'private' | 'followers' | 'friends' | 'unlisted';
|
|
3195
|
-
replyTo?: UUID;
|
|
3196
|
-
thread?: {
|
|
3197
|
-
id: UUID;
|
|
3198
|
-
position: number;
|
|
3199
|
-
total: number;
|
|
3200
|
-
};
|
|
3201
|
-
crossPosted?: Array<{
|
|
3202
|
-
platform: string;
|
|
3203
|
-
platformId: string;
|
|
3204
|
-
url: string;
|
|
3205
|
-
}>;
|
|
3206
|
-
}
|
|
3207
|
-
interface PostCreateOptions {
|
|
3208
|
-
platforms?: string[];
|
|
3209
|
-
scheduledAt?: Date;
|
|
3210
|
-
visibility?: PostInfo['visibility'];
|
|
3211
|
-
replyTo?: UUID;
|
|
3212
|
-
thread?: boolean;
|
|
3213
|
-
location?: PostLocation;
|
|
3214
|
-
tags?: string[];
|
|
3215
|
-
mentions?: UUID[];
|
|
3216
|
-
enableComments?: boolean;
|
|
3217
|
-
enableSharing?: boolean;
|
|
3218
|
-
contentWarning?: string;
|
|
3219
|
-
sensitive?: boolean;
|
|
3220
|
-
}
|
|
3221
|
-
interface PostSearchOptions {
|
|
3222
|
-
query?: string;
|
|
3223
|
-
author?: UUID;
|
|
3224
|
-
platform?: string;
|
|
3225
|
-
tags?: string[];
|
|
3226
|
-
mentions?: UUID[];
|
|
3227
|
-
since?: Date;
|
|
3228
|
-
before?: Date;
|
|
3229
|
-
limit?: number;
|
|
3230
|
-
offset?: number;
|
|
3231
|
-
hasMedia?: boolean;
|
|
3232
|
-
hasLocation?: boolean;
|
|
3233
|
-
visibility?: PostInfo['visibility'];
|
|
3234
|
-
sortBy?: 'date' | 'engagement' | 'relevance';
|
|
3235
|
-
}
|
|
3236
|
-
interface PostAnalytics {
|
|
3237
|
-
postId: UUID;
|
|
3238
|
-
platform: string;
|
|
3239
|
-
impressions: number;
|
|
3240
|
-
reach: number;
|
|
3241
|
-
engagement: PostEngagement;
|
|
3242
|
-
clicks: number;
|
|
3243
|
-
shares: number;
|
|
3244
|
-
saves: number;
|
|
3245
|
-
demographics?: {
|
|
3246
|
-
age?: Record<string, number>;
|
|
3247
|
-
gender?: Record<string, number>;
|
|
3248
|
-
location?: Record<string, number>;
|
|
3249
|
-
};
|
|
3250
|
-
topPerformingHours?: Array<{
|
|
3251
|
-
hour: number;
|
|
3252
|
-
engagement: number;
|
|
3253
|
-
}>;
|
|
3254
|
-
}
|
|
3255
|
-
/**
|
|
3256
|
-
* Interface for social media posting services
|
|
3257
|
-
*/
|
|
3258
|
-
declare abstract class IPostService extends Service {
|
|
3259
|
-
static readonly serviceType: "post";
|
|
3260
|
-
readonly capabilityDescription = "Social media posting and content management capabilities";
|
|
3261
|
-
/**
|
|
3262
|
-
* Create and publish a new post
|
|
3263
|
-
* @param content - Post content
|
|
3264
|
-
* @param options - Publishing options
|
|
3265
|
-
* @returns Promise resolving to post ID
|
|
3266
|
-
*/
|
|
3267
|
-
abstract createPost(content: PostContent, options?: PostCreateOptions): Promise<UUID>;
|
|
3268
|
-
/**
|
|
3269
|
-
* Get posts from timeline or specific user
|
|
3270
|
-
* @param options - Search options
|
|
3271
|
-
* @returns Promise resolving to array of posts
|
|
3272
|
-
*/
|
|
3273
|
-
abstract getPosts(options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
3274
|
-
/**
|
|
3275
|
-
* Get a specific post by ID
|
|
3276
|
-
* @param postId - Post ID
|
|
3277
|
-
* @returns Promise resolving to post info
|
|
3278
|
-
*/
|
|
3279
|
-
abstract getPost(postId: UUID): Promise<PostInfo>;
|
|
3280
|
-
/**
|
|
3281
|
-
* Edit an existing post
|
|
3282
|
-
* @param postId - Post ID
|
|
3283
|
-
* @param content - New post content
|
|
3284
|
-
* @returns Promise resolving when edit completes
|
|
3285
|
-
*/
|
|
3286
|
-
abstract editPost(postId: UUID, content: PostContent): Promise<void>;
|
|
3287
|
-
/**
|
|
3288
|
-
* Delete a post
|
|
3289
|
-
* @param postId - Post ID
|
|
3290
|
-
* @returns Promise resolving when deletion completes
|
|
3291
|
-
*/
|
|
3292
|
-
abstract deletePost(postId: UUID): Promise<void>;
|
|
3293
|
-
/**
|
|
3294
|
-
* Like/unlike a post
|
|
3295
|
-
* @param postId - Post ID
|
|
3296
|
-
* @param like - True to like, false to unlike
|
|
3297
|
-
* @returns Promise resolving when operation completes
|
|
3298
|
-
*/
|
|
3299
|
-
abstract likePost(postId: UUID, like: boolean): Promise<void>;
|
|
3300
|
-
/**
|
|
3301
|
-
* Share/repost a post
|
|
3302
|
-
* @param postId - Post ID
|
|
3303
|
-
* @param comment - Optional comment when sharing
|
|
3304
|
-
* @returns Promise resolving to share ID
|
|
3305
|
-
*/
|
|
3306
|
-
abstract sharePost(postId: UUID, comment?: string): Promise<UUID>;
|
|
3307
|
-
/**
|
|
3308
|
-
* Save/unsave a post
|
|
3309
|
-
* @param postId - Post ID
|
|
3310
|
-
* @param save - True to save, false to unsave
|
|
3311
|
-
* @returns Promise resolving when operation completes
|
|
3312
|
-
*/
|
|
3313
|
-
abstract savePost(postId: UUID, save: boolean): Promise<void>;
|
|
3314
|
-
/**
|
|
3315
|
-
* Comment on a post
|
|
3316
|
-
* @param postId - Post ID
|
|
3317
|
-
* @param content - Comment content
|
|
3318
|
-
* @returns Promise resolving to comment ID
|
|
3319
|
-
*/
|
|
3320
|
-
abstract commentOnPost(postId: UUID, content: PostContent): Promise<UUID>;
|
|
3321
|
-
/**
|
|
3322
|
-
* Get comments for a post
|
|
3323
|
-
* @param postId - Post ID
|
|
3324
|
-
* @param options - Search options
|
|
3325
|
-
* @returns Promise resolving to array of comments
|
|
3326
|
-
*/
|
|
3327
|
-
abstract getComments(postId: UUID, options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
3328
|
-
/**
|
|
3329
|
-
* Schedule a post for later publishing
|
|
3330
|
-
* @param content - Post content
|
|
3331
|
-
* @param scheduledAt - When to publish
|
|
3332
|
-
* @param options - Publishing options
|
|
3333
|
-
* @returns Promise resolving to scheduled post ID
|
|
3334
|
-
*/
|
|
3335
|
-
abstract schedulePost(content: PostContent, scheduledAt: Date, options?: PostCreateOptions): Promise<UUID>;
|
|
3336
|
-
/**
|
|
3337
|
-
* Get analytics for a post
|
|
3338
|
-
* @param postId - Post ID
|
|
3339
|
-
* @returns Promise resolving to post analytics
|
|
3340
|
-
*/
|
|
3341
|
-
abstract getPostAnalytics(postId: UUID): Promise<PostAnalytics>;
|
|
3342
|
-
/**
|
|
3343
|
-
* Get trending posts
|
|
3344
|
-
* @param options - Search options
|
|
3345
|
-
* @returns Promise resolving to trending posts
|
|
3346
|
-
*/
|
|
3347
|
-
abstract getTrendingPosts(options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
3348
|
-
/**
|
|
3349
|
-
* Search posts across platforms
|
|
3350
|
-
* @param query - Search query
|
|
3351
|
-
* @param options - Search options
|
|
3352
|
-
* @returns Promise resolving to search results
|
|
3353
|
-
*/
|
|
3354
|
-
abstract searchPosts(query: string, options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
3355
|
-
}
|
|
3356
|
-
|
|
3357
|
-
/**
|
|
3358
|
-
* Composes a context string by replacing placeholders in a template with corresponding values from the state.
|
|
3359
|
-
*
|
|
3360
|
-
* This function takes a template string with placeholders in the format `{{placeholder}}` and a state object.
|
|
3361
|
-
* It replaces each placeholder with the value from the state object that matches the placeholder's name.
|
|
3362
|
-
* If a matching key is not found in the state object for a given placeholder, the placeholder is replaced with an empty string.
|
|
3363
|
-
*
|
|
3364
|
-
* @param {Object} params - The parameters for composing the context.
|
|
3365
|
-
* @param {State} params.state - The state object containing values to replace the placeholders in the template.
|
|
3366
|
-
* @param {TemplateType} params.template - The template string or function containing placeholders to be replaced with state values.
|
|
3367
|
-
* @returns {string} The composed context string with placeholders replaced by corresponding state values.
|
|
3368
|
-
*
|
|
3369
|
-
* @example
|
|
3370
|
-
* // Given a state object and a template
|
|
3371
|
-
* const state = { userName: "Alice", userAge: 30 };
|
|
3372
|
-
* const template = "Hello, {{userName}}! You are {{userAge}} years old";
|
|
3373
|
-
*
|
|
3374
|
-
* // Composing the context with simple string replacement will result in:
|
|
3375
|
-
* // "Hello, Alice! You are 30 years old."
|
|
3376
|
-
* const contextSimple = composePromptFromState({ state, template });
|
|
3377
|
-
*
|
|
3378
|
-
* // Using composePromptFromState with a template function for dynamic template
|
|
3379
|
-
* const template = ({ state }) => {
|
|
3380
|
-
* const tone = Math.random() > 0.5 ? "kind" : "rude";
|
|
3381
|
-
* return `Hello, {{userName}}! You are {{userAge}} years old. Be ${tone}`;
|
|
3382
|
-
* };
|
|
3383
|
-
* const contextSimple = composePromptFromState({ state, template });
|
|
3384
|
-
*/
|
|
3385
|
-
/**
|
|
3386
|
-
* Function to compose a prompt using a provided template and state.
|
|
3387
|
-
* It compiles the template (upgrading double braces to triple braces for non-HTML escaping)
|
|
3388
|
-
* and then populates it with values from the state. Additionally, it processes the
|
|
3389
|
-
* resulting string with `composeRandomUser` to replace placeholders like `{{nameX}}`.
|
|
3390
|
-
*
|
|
3391
|
-
* @param {Object} options - Object containing state and template information.
|
|
3392
|
-
* @param {State} options.state - The state object containing values to fill the template.
|
|
3393
|
-
* @param {TemplateType} options.template - The template string or function to be used for composing the prompt.
|
|
3394
|
-
* @returns {string} The composed prompt output, with state values and random user names populated.
|
|
3395
|
-
*/
|
|
3396
|
-
declare const composePrompt: ({ state, template, }: {
|
|
3397
|
-
state: {
|
|
3398
|
-
[key: string]: string;
|
|
3399
|
-
};
|
|
3400
|
-
template: TemplateType;
|
|
3401
|
-
}) => string;
|
|
3402
|
-
/**
|
|
3403
|
-
* Function to compose a prompt using a provided template and state.
|
|
3404
|
-
*
|
|
3405
|
-
* @param {Object} options - Object containing state and template information.
|
|
3406
|
-
* @param {State} options.state - The state object containing values to fill the template.
|
|
3407
|
-
* @param {TemplateType} options.template - The template to be used for composing the prompt.
|
|
3408
|
-
* @returns {string} The composed prompt output.
|
|
3409
|
-
*/
|
|
3410
|
-
declare const composePromptFromState: ({ state, template, }: {
|
|
3411
|
-
state: State;
|
|
3412
|
-
template: TemplateType;
|
|
3413
|
-
}) => string;
|
|
3414
|
-
/**
|
|
3415
|
-
* Adds a header to a body of text.
|
|
3416
|
-
*
|
|
3417
|
-
* This function takes a header string and a body string and returns a new string with the header prepended to the body.
|
|
3418
|
-
* If the body string is empty, the header is returned as is.
|
|
3419
|
-
*
|
|
3420
|
-
* @param {string} header - The header to add to the body.
|
|
3421
|
-
* @param {string} body - The body to which to add the header.
|
|
3422
|
-
* @returns {string} The body with the header prepended.
|
|
3423
|
-
*
|
|
3424
|
-
* @example
|
|
3425
|
-
* // Given a header and a body
|
|
3426
|
-
* const header = "Header";
|
|
3427
|
-
* const body = "Body";
|
|
3428
|
-
*
|
|
3429
|
-
* // Adding the header to the body will result in:
|
|
3430
|
-
* // "Header\nBody"
|
|
3431
|
-
* const text = addHeader(header, body);
|
|
3432
|
-
*/
|
|
3433
|
-
declare const addHeader: (header: string, body: string) => string;
|
|
3434
|
-
declare const formatPosts: ({ messages, entities, conversationHeader, }: {
|
|
3435
|
-
messages: Memory[];
|
|
3436
|
-
entities: Entity[];
|
|
3437
|
-
conversationHeader?: boolean;
|
|
3438
|
-
}) => string;
|
|
3439
|
-
/**
|
|
3440
|
-
* Format messages into a string
|
|
3441
|
-
* @param {Object} params - The formatting parameters
|
|
3442
|
-
* @param {Memory[]} params.messages - List of messages to format
|
|
3443
|
-
* @param {Entity[]} params.entities - List of entities for name resolution
|
|
3444
|
-
* @returns {string} Formatted message string with timestamps and user information
|
|
3445
|
-
*/
|
|
3446
|
-
declare const formatMessages: ({ messages, entities, }: {
|
|
3447
|
-
messages: Memory[];
|
|
3448
|
-
entities: Entity[];
|
|
3449
|
-
}) => string;
|
|
3450
|
-
declare const formatTimestamp: (messageDate: number) => string;
|
|
3451
|
-
/**
|
|
3452
|
-
* Parses key-value pairs from a simple XML structure within a given text.
|
|
3453
|
-
* It looks for an XML block (e.g., <response>...</response>) and extracts
|
|
3454
|
-
* text content from direct child elements (e.g., <key>value</key>).
|
|
3455
|
-
*
|
|
3456
|
-
* Note: This uses regex and is suitable for simple, predictable XML structures.
|
|
3457
|
-
* For complex XML, a proper parsing library is recommended.
|
|
3458
|
-
*
|
|
3459
|
-
* @param text - The input text containing the XML structure.
|
|
3460
|
-
* @returns An object with key-value pairs extracted from the XML, or null if parsing fails.
|
|
3461
|
-
*/
|
|
3462
|
-
declare function parseKeyValueXml(text: string): Record<string, any> | null;
|
|
3463
|
-
/**
|
|
3464
|
-
* Parses a JSON object from a given text. The function looks for a JSON block wrapped in triple backticks
|
|
3465
|
-
* with `json` language identifier, and if not found, it searches for an object pattern within the text.
|
|
3466
|
-
* It then attempts to parse the JSON string into a JavaScript object. If parsing is successful and the result
|
|
3467
|
-
* is an object (but not an array), it returns the object; otherwise, it tries to parse an array if the result
|
|
3468
|
-
* is an array, or returns null if parsing is unsuccessful or the result is neither an object nor an array.
|
|
3469
|
-
*
|
|
3470
|
-
* @param text - The input text from which to extract and parse the JSON object.
|
|
3471
|
-
* @returns An object parsed from the JSON string if successful; otherwise, null or the result of parsing an array.
|
|
3472
|
-
*/
|
|
3473
|
-
declare function parseJSONObjectFromText(text: string): Record<string, any> | null;
|
|
3474
|
-
/**
|
|
3475
|
-
* Normalizes a JSON-like string by correcting formatting issues:
|
|
3476
|
-
* - Removes extra spaces after '{' and before '}'.
|
|
3477
|
-
* - Wraps unquoted values in double quotes.
|
|
3478
|
-
* - Converts single-quoted values to double-quoted.
|
|
3479
|
-
* - Ensures consistency in key-value formatting.
|
|
3480
|
-
* - Normalizes mixed adjacent quote pairs.
|
|
3481
|
-
*
|
|
3482
|
-
* This is useful for cleaning up improperly formatted JSON strings
|
|
3483
|
-
* before parsing them into valid JSON.
|
|
3484
|
-
*
|
|
3485
|
-
* @param str - The JSON-like string to normalize.
|
|
3486
|
-
* @returns A properly formatted JSON string.
|
|
3487
|
-
*/
|
|
3488
|
-
declare const normalizeJsonString: (str: string) => string;
|
|
3489
|
-
/**
|
|
3490
|
-
* Truncate text to fit within the character limit, ensuring it ends at a complete sentence.
|
|
3491
|
-
*/
|
|
3492
|
-
declare function truncateToCompleteSentence(text: string, maxLength: number): string;
|
|
3493
|
-
declare function splitChunks(content: string, chunkSize?: number, bleed?: number): Promise<string[]>;
|
|
3494
|
-
/**
|
|
3495
|
-
* Trims the provided text prompt to a specified token limit using a tokenizer model and type.
|
|
3496
|
-
*/
|
|
3497
|
-
declare function trimTokens(prompt: string, maxTokens: number, runtime: IAgentRuntime): Promise<string>;
|
|
3498
|
-
declare function safeReplacer(): (_key: string, value: any) => any;
|
|
3499
|
-
/**
|
|
3500
|
-
* Parses a string to determine its boolean equivalent.
|
|
3501
|
-
*
|
|
3502
|
-
* Recognized affirmative values: "YES", "Y", "TRUE", "T", "1", "ON", "ENABLE"
|
|
3503
|
-
* Recognized negative values: "NO", "N", "FALSE", "F", "0", "OFF", "DISABLE"
|
|
3504
|
-
*
|
|
3505
|
-
* @param {string | undefined | null} value - The input text to parse
|
|
3506
|
-
* @returns {boolean} - Returns `true` for affirmative inputs, `false` for negative or unrecognized inputs
|
|
3507
|
-
*/
|
|
3508
|
-
declare function parseBooleanFromText(value: string | undefined | null): boolean;
|
|
3509
|
-
/**
|
|
3510
|
-
* Validates a UUID value.
|
|
3511
|
-
*
|
|
3512
|
-
* @param {unknown} value - The value to validate.
|
|
3513
|
-
* @returns {UUID | null} Returns the validated UUID value or null if validation fails.
|
|
3514
|
-
*/
|
|
3515
|
-
declare function validateUuid(value: unknown): UUID | null;
|
|
3516
|
-
/**
|
|
3517
|
-
* Converts a string or number to a UUID.
|
|
3518
|
-
*
|
|
3519
|
-
* @param {string | number} target - The string or number to convert to a UUID.
|
|
3520
|
-
* @returns {UUID} The UUID generated from the input target.
|
|
3521
|
-
* @throws {TypeError} Throws an error if the input target is not a string.
|
|
3522
|
-
*/
|
|
3523
|
-
declare function stringToUuid(target: string | number): UUID;
|
|
3524
|
-
declare const getContentTypeFromMimeType: (mimeType: string) => ContentType | undefined;
|
|
3525
|
-
declare function getLocalServerUrl(path: string): string;
|
|
3526
|
-
|
|
3527
|
-
declare const characterSchema: z.ZodObject<{
|
|
3528
|
-
id: z.ZodOptional<z.ZodString>;
|
|
3529
|
-
name: z.ZodString;
|
|
3530
|
-
username: z.ZodOptional<z.ZodString>;
|
|
3531
|
-
system: z.ZodOptional<z.ZodString>;
|
|
3532
|
-
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>]>>>;
|
|
3533
|
-
bio: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
3534
|
-
messageExamples: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
|
|
3535
|
-
name: z.ZodString;
|
|
3536
|
-
content: z.ZodObject<{
|
|
3537
|
-
text: z.ZodOptional<z.ZodString>;
|
|
3538
|
-
thought: z.ZodOptional<z.ZodString>;
|
|
3539
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3540
|
-
providers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3541
|
-
source: z.ZodOptional<z.ZodString>;
|
|
3542
|
-
target: z.ZodOptional<z.ZodString>;
|
|
3543
|
-
url: z.ZodOptional<z.ZodString>;
|
|
3544
|
-
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
3545
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
3546
|
-
channelType: z.ZodOptional<z.ZodString>;
|
|
3547
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
3548
|
-
text: z.ZodOptional<z.ZodString>;
|
|
3549
|
-
thought: z.ZodOptional<z.ZodString>;
|
|
3550
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3551
|
-
providers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3552
|
-
source: z.ZodOptional<z.ZodString>;
|
|
3553
|
-
target: z.ZodOptional<z.ZodString>;
|
|
3554
|
-
url: z.ZodOptional<z.ZodString>;
|
|
3555
|
-
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
3556
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
3557
|
-
channelType: z.ZodOptional<z.ZodString>;
|
|
3558
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
3559
|
-
text: z.ZodOptional<z.ZodString>;
|
|
3560
|
-
thought: z.ZodOptional<z.ZodString>;
|
|
3561
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3562
|
-
providers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3563
|
-
source: z.ZodOptional<z.ZodString>;
|
|
3564
|
-
target: z.ZodOptional<z.ZodString>;
|
|
3565
|
-
url: z.ZodOptional<z.ZodString>;
|
|
3566
|
-
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
3567
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
3568
|
-
channelType: z.ZodOptional<z.ZodString>;
|
|
3569
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
3570
|
-
}, "strip", z.ZodTypeAny, {
|
|
3571
|
-
content?: {
|
|
3572
|
-
thought?: string;
|
|
3573
|
-
text?: string;
|
|
3574
|
-
actions?: string[];
|
|
3575
|
-
providers?: string[];
|
|
3576
|
-
source?: string;
|
|
3577
|
-
target?: string;
|
|
3578
|
-
url?: string;
|
|
3579
|
-
inReplyTo?: string;
|
|
3580
|
-
attachments?: any[];
|
|
3581
|
-
channelType?: string;
|
|
3582
|
-
} & {
|
|
3583
|
-
[k: string]: unknown;
|
|
3584
|
-
};
|
|
3585
|
-
name?: string;
|
|
3586
|
-
}, {
|
|
3587
|
-
content?: {
|
|
3588
|
-
thought?: string;
|
|
3589
|
-
text?: string;
|
|
3590
|
-
actions?: string[];
|
|
3591
|
-
providers?: string[];
|
|
3592
|
-
source?: string;
|
|
3593
|
-
target?: string;
|
|
3594
|
-
url?: string;
|
|
3595
|
-
inReplyTo?: string;
|
|
3596
|
-
attachments?: any[];
|
|
3597
|
-
channelType?: string;
|
|
3598
|
-
} & {
|
|
3599
|
-
[k: string]: unknown;
|
|
3600
|
-
};
|
|
3601
|
-
name?: string;
|
|
3602
|
-
}>, "many">, "many">>;
|
|
3603
|
-
postExamples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3604
|
-
topics: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3605
|
-
adjectives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3606
|
-
knowledge: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
3607
|
-
path: z.ZodString;
|
|
3608
|
-
shared: z.ZodOptional<z.ZodBoolean>;
|
|
3609
|
-
}, "strip", z.ZodTypeAny, {
|
|
3610
|
-
shared?: boolean;
|
|
3611
|
-
path?: string;
|
|
3612
|
-
}, {
|
|
3613
|
-
shared?: boolean;
|
|
3614
|
-
path?: string;
|
|
3615
|
-
}>, z.ZodObject<{
|
|
3616
|
-
directory: z.ZodString;
|
|
3617
|
-
shared: z.ZodOptional<z.ZodBoolean>;
|
|
3618
|
-
}, "strip", z.ZodTypeAny, {
|
|
3619
|
-
shared?: boolean;
|
|
3620
|
-
directory?: string;
|
|
3621
|
-
}, {
|
|
3622
|
-
shared?: boolean;
|
|
3623
|
-
directory?: string;
|
|
3624
|
-
}>]>, "many">>;
|
|
3625
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3626
|
-
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodAny]>>>;
|
|
3627
|
-
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber]>>>;
|
|
3628
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
3629
|
-
all: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3630
|
-
chat: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3631
|
-
post: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3632
|
-
}, "strip", z.ZodTypeAny, {
|
|
3633
|
-
post?: string[];
|
|
3634
|
-
all?: string[];
|
|
3635
|
-
chat?: string[];
|
|
3636
|
-
}, {
|
|
3637
|
-
post?: string[];
|
|
3638
|
-
all?: string[];
|
|
3639
|
-
chat?: string[];
|
|
3640
|
-
}>>;
|
|
3641
|
-
}, "strict", z.ZodTypeAny, {
|
|
3642
|
-
knowledge?: (string | {
|
|
3643
|
-
shared?: boolean;
|
|
3644
|
-
directory?: string;
|
|
3645
|
-
} | {
|
|
3646
|
-
shared?: boolean;
|
|
3647
|
-
path?: string;
|
|
3648
|
-
})[];
|
|
3649
|
-
username?: string;
|
|
3650
|
-
id?: string;
|
|
3651
|
-
name?: string;
|
|
3652
|
-
system?: string;
|
|
3653
|
-
templates?: Record<string, string | ((...args: unknown[]) => unknown)>;
|
|
3654
|
-
bio?: string | string[];
|
|
3655
|
-
messageExamples?: {
|
|
3656
|
-
content?: {
|
|
3657
|
-
thought?: string;
|
|
3658
|
-
text?: string;
|
|
3659
|
-
actions?: string[];
|
|
3660
|
-
providers?: string[];
|
|
3661
|
-
source?: string;
|
|
3662
|
-
target?: string;
|
|
3663
|
-
url?: string;
|
|
3664
|
-
inReplyTo?: string;
|
|
3665
|
-
attachments?: any[];
|
|
3666
|
-
channelType?: string;
|
|
3667
|
-
} & {
|
|
3668
|
-
[k: string]: unknown;
|
|
3669
|
-
};
|
|
3670
|
-
name?: string;
|
|
3671
|
-
}[][];
|
|
3672
|
-
postExamples?: string[];
|
|
3673
|
-
topics?: string[];
|
|
3674
|
-
adjectives?: string[];
|
|
3675
|
-
plugins?: string[];
|
|
3676
|
-
settings?: Record<string, any>;
|
|
3677
|
-
secrets?: Record<string, string | number | boolean>;
|
|
3678
|
-
style?: {
|
|
3679
|
-
post?: string[];
|
|
3680
|
-
all?: string[];
|
|
3681
|
-
chat?: string[];
|
|
3682
|
-
};
|
|
3683
|
-
}, {
|
|
3684
|
-
knowledge?: (string | {
|
|
3685
|
-
shared?: boolean;
|
|
3686
|
-
directory?: string;
|
|
3687
|
-
} | {
|
|
3688
|
-
shared?: boolean;
|
|
3689
|
-
path?: string;
|
|
3690
|
-
})[];
|
|
3691
|
-
username?: string;
|
|
3692
|
-
id?: string;
|
|
3693
|
-
name?: string;
|
|
3694
|
-
system?: string;
|
|
3695
|
-
templates?: Record<string, string | ((...args: unknown[]) => unknown)>;
|
|
3696
|
-
bio?: string | string[];
|
|
3697
|
-
messageExamples?: {
|
|
3698
|
-
content?: {
|
|
3699
|
-
thought?: string;
|
|
3700
|
-
text?: string;
|
|
3701
|
-
actions?: string[];
|
|
3702
|
-
providers?: string[];
|
|
3703
|
-
source?: string;
|
|
3704
|
-
target?: string;
|
|
3705
|
-
url?: string;
|
|
3706
|
-
inReplyTo?: string;
|
|
3707
|
-
attachments?: any[];
|
|
3708
|
-
channelType?: string;
|
|
3709
|
-
} & {
|
|
3710
|
-
[k: string]: unknown;
|
|
3711
|
-
};
|
|
3712
|
-
name?: string;
|
|
3713
|
-
}[][];
|
|
3714
|
-
postExamples?: string[];
|
|
3715
|
-
topics?: string[];
|
|
3716
|
-
adjectives?: string[];
|
|
3717
|
-
plugins?: string[];
|
|
3718
|
-
settings?: Record<string, any>;
|
|
3719
|
-
secrets?: Record<string, string | number | boolean>;
|
|
3720
|
-
style?: {
|
|
3721
|
-
post?: string[];
|
|
3722
|
-
all?: string[];
|
|
3723
|
-
chat?: string[];
|
|
3724
|
-
};
|
|
3725
|
-
}>;
|
|
3726
|
-
interface CharacterValidationResult {
|
|
3727
|
-
success: boolean;
|
|
3728
|
-
data?: Character;
|
|
3729
|
-
error?: {
|
|
3730
|
-
message: string;
|
|
3731
|
-
issues?: z.ZodIssue[];
|
|
3732
|
-
};
|
|
3733
|
-
}
|
|
3734
|
-
/**
|
|
3735
|
-
* Safely validates character data using Zod schema
|
|
3736
|
-
* @param data - Raw character data to validate
|
|
3737
|
-
* @returns Validation result with success flag and either data or error
|
|
3738
|
-
*/
|
|
3739
|
-
declare function validateCharacter(data: unknown): CharacterValidationResult;
|
|
3740
|
-
/**
|
|
3741
|
-
* Safely parses JSON string and validates as character
|
|
3742
|
-
* @param jsonString - JSON string to parse and validate
|
|
3743
|
-
* @returns Validation result with success flag and either data or error
|
|
3744
|
-
*/
|
|
3745
|
-
declare function parseAndValidateCharacter(jsonString: string): CharacterValidationResult;
|
|
3746
|
-
/**
|
|
3747
|
-
* Type guard to check if data is a valid Character
|
|
3748
|
-
* @param data - Data to check
|
|
3749
|
-
* @returns True if data is a valid Character
|
|
3750
|
-
*/
|
|
3751
|
-
declare function isValidCharacter(data: unknown): data is Character;
|
|
3752
|
-
|
|
3753
|
-
/**
|
|
3754
|
-
* Composes a set of example conversations based on provided actions and a specified count.
|
|
3755
|
-
* It randomly selects examples from the provided actions and formats them with generated names.
|
|
3756
|
-
*
|
|
3757
|
-
* @param actionsData - An array of `Action` objects from which to draw examples.
|
|
3758
|
-
* @param count - The number of examples to generate.
|
|
3759
|
-
* @returns A string containing formatted examples of conversations.
|
|
3760
|
-
*/
|
|
3761
|
-
declare const composeActionExamples: (actionsData: Action[], count: number) => string;
|
|
3762
|
-
/**
|
|
3763
|
-
* Formats the names of the provided actions into a comma-separated string.
|
|
3764
|
-
* @param actions - An array of `Action` objects from which to extract names.
|
|
3765
|
-
* @returns A comma-separated string of action names.
|
|
3766
|
-
*/
|
|
3767
|
-
declare function formatActionNames(actions: Action[]): string;
|
|
3768
|
-
/**
|
|
3769
|
-
* Formats the provided actions into a detailed string listing each action's name and description.
|
|
3770
|
-
* @param actions - An array of `Action` objects to format.
|
|
3771
|
-
* @returns A detailed string of actions, including names and descriptions.
|
|
3772
|
-
*/
|
|
3773
|
-
declare function formatActions(actions: Action[]): string;
|
|
3774
|
-
|
|
3775
|
-
/**
|
|
3776
|
-
* An abstract class representing a database adapter for managing various entities
|
|
3777
|
-
* like entities, memories, entities, goals, and rooms.
|
|
3778
|
-
*/
|
|
3779
|
-
/**
|
|
3780
|
-
* Database adapter class to be extended by individual database adapters.
|
|
3781
|
-
*
|
|
3782
|
-
* @template DB - The type of the database instance.
|
|
3783
|
-
* @abstract
|
|
3784
|
-
* implements IDatabaseAdapter
|
|
3785
|
-
*/
|
|
3786
|
-
declare abstract class DatabaseAdapter<DB = unknown> implements IDatabaseAdapter {
|
|
3787
|
-
/**
|
|
3788
|
-
* The database instance.
|
|
3789
|
-
*/
|
|
3790
|
-
db: DB;
|
|
3791
|
-
/**
|
|
3792
|
-
* Initialize the database adapter.
|
|
3793
|
-
* @returns A Promise that resolves when initialization is complete.
|
|
3794
|
-
*/
|
|
3795
|
-
abstract initialize(config?: any): Promise<void>;
|
|
3796
|
-
/**
|
|
3797
|
-
* Initialize the database adapter.
|
|
3798
|
-
* @returns A Promise that resolves when initialization is complete.
|
|
3799
|
-
*/
|
|
3800
|
-
abstract init(): Promise<void>;
|
|
3801
|
-
/**
|
|
3802
|
-
* Run database migrations
|
|
3803
|
-
* @param migrationsPaths Optional array of paths to migration folders
|
|
3804
|
-
* @returns A Promise that resolves when migrations are complete.
|
|
3805
|
-
*/
|
|
3806
|
-
abstract runMigrations(migrationsPaths?: string[]): Promise<void>;
|
|
3807
|
-
/**
|
|
3808
|
-
* Check if the database connection is ready.
|
|
3809
|
-
* @returns A Promise that resolves to true if the database is ready, false otherwise.
|
|
3810
|
-
*/
|
|
3811
|
-
abstract isReady(): Promise<boolean>;
|
|
3812
|
-
/**
|
|
3813
|
-
* Optional close method for the database adapter.
|
|
3814
|
-
* @returns A Promise that resolves when closing is complete.
|
|
3815
|
-
*/
|
|
3816
|
-
abstract close(): Promise<void>;
|
|
3817
|
-
/**
|
|
3818
|
-
* Retrieves a connection to the database.
|
|
3819
|
-
* @returns A Promise that resolves to the database connection.
|
|
3820
|
-
*/
|
|
3821
|
-
abstract getConnection(): Promise<unknown>;
|
|
3822
|
-
/**
|
|
3823
|
-
* Retrieves an account by its ID.
|
|
3824
|
-
* @param entityIds The UUIDs of the user account to retrieve.
|
|
3825
|
-
* @returns A Promise that resolves to the Entity object or null if not found.
|
|
3826
|
-
*/
|
|
3827
|
-
abstract getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
3828
|
-
abstract getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
3829
|
-
/**
|
|
3830
|
-
* Creates a new entities in the database.
|
|
3831
|
-
* @param entities The entity objects to create.
|
|
3832
|
-
* @returns A Promise that resolves when the account creation is complete.
|
|
3833
|
-
*/
|
|
3834
|
-
abstract createEntities(entities: Entity[]): Promise<boolean>;
|
|
3835
|
-
/**
|
|
3836
|
-
* Updates an existing entity in the database.
|
|
3837
|
-
* @param entity The entity object with updated properties.
|
|
3838
|
-
* @returns A Promise that resolves when the account update is complete.
|
|
3839
|
-
*/
|
|
3840
|
-
abstract updateEntity(entity: Entity): Promise<void>;
|
|
3841
|
-
/**
|
|
3842
|
-
* Retrieves a single component by entity ID and type.
|
|
3843
|
-
* @param entityId The UUID of the entity the component belongs to
|
|
3844
|
-
* @param type The type identifier for the component
|
|
3845
|
-
* @param worldId Optional UUID of the world the component belongs to
|
|
3846
|
-
* @param sourceEntityId Optional UUID of the source entity
|
|
3847
|
-
* @returns Promise resolving to the Component if found, null otherwise
|
|
3848
|
-
*/
|
|
3849
|
-
abstract getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
3850
|
-
/**
|
|
3851
|
-
* Retrieves all components for an entity.
|
|
3852
|
-
* @param entityId The UUID of the entity to get components for
|
|
3853
|
-
* @param worldId Optional UUID of the world to filter components by
|
|
3854
|
-
* @param sourceEntityId Optional UUID of the source entity to filter by
|
|
3855
|
-
* @returns Promise resolving to array of Component objects
|
|
3856
|
-
*/
|
|
3857
|
-
abstract getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
3858
|
-
/**
|
|
3859
|
-
* Creates a new component in the database.
|
|
3860
|
-
* @param component The component object to create
|
|
3861
|
-
* @returns Promise resolving to true if creation was successful
|
|
3862
|
-
*/
|
|
3863
|
-
abstract createComponent(component: Component): Promise<boolean>;
|
|
3864
|
-
/**
|
|
3865
|
-
* Updates an existing component in the database.
|
|
3866
|
-
* @param component The component object with updated properties
|
|
3867
|
-
* @returns Promise that resolves when the update is complete
|
|
3868
|
-
*/
|
|
3869
|
-
abstract updateComponent(component: Component): Promise<void>;
|
|
3870
|
-
/**
|
|
3871
|
-
* Deletes a component from the database.
|
|
3872
|
-
* @param componentId The UUID of the component to delete
|
|
3873
|
-
* @returns Promise that resolves when the deletion is complete
|
|
3874
|
-
*/
|
|
3875
|
-
abstract deleteComponent(componentId: UUID): Promise<void>;
|
|
3876
|
-
/**
|
|
3877
|
-
* Retrieves memories based on the specified parameters.
|
|
3878
|
-
* @param params An object containing parameters for the memory retrieval.
|
|
3879
|
-
* @returns A Promise that resolves to an array of Memory objects.
|
|
3880
|
-
*/
|
|
3881
|
-
abstract getMemories(params: {
|
|
3882
|
-
entityId?: UUID;
|
|
3883
|
-
agentId?: UUID;
|
|
3884
|
-
count?: number;
|
|
3885
|
-
unique?: boolean;
|
|
3886
|
-
tableName: string;
|
|
3887
|
-
start?: number;
|
|
3888
|
-
end?: number;
|
|
3889
|
-
roomId?: UUID;
|
|
3890
|
-
worldId?: UUID;
|
|
3891
|
-
}): Promise<Memory[]>;
|
|
3892
|
-
abstract getMemoriesByRoomIds(params: {
|
|
3893
|
-
roomIds: UUID[];
|
|
3894
|
-
tableName: string;
|
|
3895
|
-
limit?: number;
|
|
3896
|
-
}): Promise<Memory[]>;
|
|
3897
|
-
abstract getMemoryById(id: UUID): Promise<Memory | null>;
|
|
3898
|
-
/**
|
|
3899
|
-
* Retrieves multiple memories by their IDs
|
|
3900
|
-
* @param memoryIds Array of UUIDs of the memories to retrieve
|
|
3901
|
-
* @param tableName Optional table name to filter memories by type
|
|
3902
|
-
* @returns Promise resolving to array of Memory objects
|
|
3903
|
-
*/
|
|
3904
|
-
abstract getMemoriesByIds(memoryIds: UUID[], tableName?: string): Promise<Memory[]>;
|
|
3905
|
-
/**
|
|
3906
|
-
* Retrieves cached embeddings based on the specified query parameters.
|
|
3907
|
-
* @param params An object containing parameters for the embedding retrieval.
|
|
3908
|
-
* @returns A Promise that resolves to an array of objects containing embeddings and levenshtein scores.
|
|
3909
|
-
*/
|
|
3910
|
-
abstract getCachedEmbeddings({ query_table_name, query_threshold, query_input, query_field_name, query_field_sub_name, query_match_count, }: {
|
|
3911
|
-
query_table_name: string;
|
|
3912
|
-
query_threshold: number;
|
|
3913
|
-
query_input: string;
|
|
3914
|
-
query_field_name: string;
|
|
3915
|
-
query_field_sub_name: string;
|
|
3916
|
-
query_match_count: number;
|
|
3917
|
-
}): Promise<{
|
|
3918
|
-
embedding: number[];
|
|
3919
|
-
levenshtein_score: number;
|
|
3920
|
-
}[]>;
|
|
3921
|
-
/**
|
|
3922
|
-
* Logs an event or action with the specified details.
|
|
3923
|
-
* @param params An object containing parameters for the log entry.
|
|
3924
|
-
* @returns A Promise that resolves when the log entry has been saved.
|
|
3925
|
-
*/
|
|
3926
|
-
abstract log(params: {
|
|
3927
|
-
body: {
|
|
3928
|
-
[key: string]: unknown;
|
|
3929
|
-
};
|
|
3930
|
-
entityId: UUID;
|
|
3931
|
-
roomId: UUID;
|
|
3932
|
-
type: string;
|
|
3933
|
-
}): Promise<void>;
|
|
3934
|
-
/**
|
|
3935
|
-
* Retrieves logs based on the specified parameters.
|
|
3936
|
-
* @param params An object containing parameters for the log retrieval.
|
|
3937
|
-
* @returns A Promise that resolves to an array of Log objects.
|
|
3938
|
-
*/
|
|
3939
|
-
abstract getLogs(params: {
|
|
3940
|
-
entityId: UUID;
|
|
3941
|
-
roomId?: UUID;
|
|
3942
|
-
type?: string;
|
|
3943
|
-
count?: number;
|
|
3944
|
-
offset?: number;
|
|
3945
|
-
}): Promise<Log[]>;
|
|
3946
|
-
/**
|
|
3947
|
-
* Deletes a log from the database.
|
|
3948
|
-
* @param logId The UUID of the log to delete.
|
|
3949
|
-
* @returns A Promise that resolves when the log has been deleted.
|
|
3950
|
-
*/
|
|
3951
|
-
abstract deleteLog(logId: UUID): Promise<void>;
|
|
3952
|
-
/**
|
|
3953
|
-
* Searches for memories based on embeddings and other specified parameters.
|
|
3954
|
-
* @param params An object containing parameters for the memory search.
|
|
3955
|
-
* @returns A Promise that resolves to an array of Memory objects.
|
|
3956
|
-
*/
|
|
3957
|
-
abstract searchMemories(params: {
|
|
3958
|
-
tableName: string;
|
|
3959
|
-
embedding: number[];
|
|
3960
|
-
match_threshold?: number;
|
|
3961
|
-
count?: number;
|
|
3962
|
-
unique?: boolean;
|
|
3963
|
-
query?: string;
|
|
3964
|
-
roomId?: UUID;
|
|
3965
|
-
worldId?: UUID;
|
|
3966
|
-
entityId?: UUID;
|
|
3967
|
-
}): Promise<Memory[]>;
|
|
3968
|
-
/**
|
|
3969
|
-
* Creates a new memory in the database.
|
|
3970
|
-
* @param memory The memory object to create.
|
|
3971
|
-
* @param tableName The table where the memory should be stored.
|
|
3972
|
-
* @param unique Indicates if the memory should be unique.
|
|
3973
|
-
* @returns A Promise that resolves when the memory has been created.
|
|
3974
|
-
*/
|
|
3975
|
-
abstract createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
3976
|
-
/**
|
|
3977
|
-
* Updates an existing memory in the database.
|
|
3978
|
-
* @param memory The memory object with updated content and optional embedding
|
|
3979
|
-
* @returns Promise resolving to boolean indicating success
|
|
3980
|
-
*/
|
|
3981
|
-
abstract updateMemory(memory: Partial<Memory> & {
|
|
3982
|
-
id: UUID;
|
|
3983
|
-
metadata?: MemoryMetadata;
|
|
3984
|
-
}): Promise<boolean>;
|
|
3985
|
-
/**
|
|
3986
|
-
* Removes a specific memory from the database.
|
|
3987
|
-
* @param memoryId The UUID of the memory to remove.
|
|
3988
|
-
* @returns A Promise that resolves when the memory has been removed.
|
|
3989
|
-
*/
|
|
3990
|
-
abstract deleteMemory(memoryId: UUID): Promise<void>;
|
|
3991
|
-
/**
|
|
3992
|
-
* Removes multiple memories from the database in a single batch operation.
|
|
3993
|
-
* @param memoryIds An array of UUIDs of the memories to remove.
|
|
3994
|
-
* @returns A Promise that resolves when all memories have been removed.
|
|
3995
|
-
*/
|
|
3996
|
-
abstract deleteManyMemories(memoryIds: UUID[]): Promise<void>;
|
|
3997
|
-
/**
|
|
3998
|
-
* Removes all memories associated with a specific room.
|
|
3999
|
-
* @param roomId The UUID of the room whose memories should be removed.
|
|
4000
|
-
* @param tableName The table from which the memories should be removed.
|
|
4001
|
-
* @returns A Promise that resolves when all memories have been removed.
|
|
4002
|
-
*/
|
|
4003
|
-
abstract deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
4004
|
-
/**
|
|
4005
|
-
* Counts the number of memories in a specific room.
|
|
4006
|
-
* @param roomId The UUID of the room for which to count memories.
|
|
4007
|
-
* @param unique Specifies whether to count only unique memories.
|
|
4008
|
-
* @param tableName Optional table name to count memories from.
|
|
4009
|
-
* @returns A Promise that resolves to the number of memories.
|
|
4010
|
-
*/
|
|
4011
|
-
abstract countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
4012
|
-
/**
|
|
4013
|
-
* Retrieves a world by its ID.
|
|
4014
|
-
* @param id The UUID of the world to retrieve.
|
|
4015
|
-
* @returns A Promise that resolves to the World object or null if not found.
|
|
4016
|
-
*/
|
|
4017
|
-
abstract getWorld(id: UUID): Promise<World | null>;
|
|
4018
|
-
/**
|
|
4019
|
-
* Retrieves all worlds for an agent.
|
|
4020
|
-
* @returns A Promise that resolves to an array of World objects.
|
|
4021
|
-
*/
|
|
4022
|
-
abstract getAllWorlds(): Promise<World[]>;
|
|
4023
|
-
/**
|
|
4024
|
-
* Creates a new world in the database.
|
|
4025
|
-
* @param world The world object to create.
|
|
4026
|
-
* @returns A Promise that resolves to the UUID of the created world.
|
|
4027
|
-
*/
|
|
4028
|
-
abstract createWorld(world: World): Promise<UUID>;
|
|
4029
|
-
/**
|
|
4030
|
-
* Updates an existing world in the database.
|
|
4031
|
-
* @param world The world object with updated properties.
|
|
4032
|
-
* @returns A Promise that resolves when the world has been updated.
|
|
4033
|
-
*/
|
|
4034
|
-
abstract updateWorld(world: World): Promise<void>;
|
|
4035
|
-
/**
|
|
4036
|
-
* Removes a specific world from the database.
|
|
4037
|
-
* @param id The UUID of the world to remove.
|
|
4038
|
-
* @returns A Promise that resolves when the world has been removed.
|
|
4039
|
-
*/
|
|
4040
|
-
abstract removeWorld(id: UUID): Promise<void>;
|
|
4041
|
-
/**
|
|
4042
|
-
* Retrieves the room ID for a given room, if it exists.
|
|
4043
|
-
* @param roomIds The UUIDs of the rooms to retrieve.
|
|
4044
|
-
* @returns A Promise that resolves to the room ID or null if not found.
|
|
4045
|
-
*/
|
|
4046
|
-
abstract getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
|
|
4047
|
-
/**
|
|
4048
|
-
* Retrieves all rooms for a given world.
|
|
4049
|
-
* @param worldId The UUID of the world to retrieve rooms for.
|
|
4050
|
-
* @returns A Promise that resolves to an array of Room objects.
|
|
4051
|
-
*/
|
|
4052
|
-
abstract getRoomsByWorld(worldId: UUID): Promise<Room[]>;
|
|
4053
|
-
/**
|
|
4054
|
-
* Creates new rooms in the database.
|
|
4055
|
-
* @param rooms Array of Room objects to create.
|
|
4056
|
-
* @returns A Promise that resolves to the UUIDs of the created rooms.
|
|
4057
|
-
*/
|
|
4058
|
-
abstract createRooms(rooms: Room[]): Promise<UUID[]>;
|
|
4059
|
-
/**
|
|
4060
|
-
* Updates a specific room in the database.
|
|
4061
|
-
* @param room The room object with updated properties.
|
|
4062
|
-
* @returns A Promise that resolves when the room has been updated.
|
|
4063
|
-
*/
|
|
4064
|
-
abstract updateRoom(room: Room): Promise<void>;
|
|
4065
|
-
/**
|
|
4066
|
-
* Removes a specific room from the database.
|
|
4067
|
-
* @param roomId The UUID of the room to remove.
|
|
4068
|
-
* @returns A Promise that resolves when the room has been removed.
|
|
4069
|
-
*/
|
|
4070
|
-
abstract deleteRoom(roomId: UUID): Promise<void>;
|
|
4071
|
-
/**
|
|
4072
|
-
* Retrieves room IDs for which a specific user is a participant.
|
|
4073
|
-
* @param entityId The UUID of the user.
|
|
4074
|
-
* @returns A Promise that resolves to an array of room IDs.
|
|
4075
|
-
*/
|
|
4076
|
-
abstract getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
4077
|
-
/**
|
|
4078
|
-
* Retrieves room IDs for which specific users are participants.
|
|
4079
|
-
* @param userIds An array of UUIDs of the users.
|
|
4080
|
-
* @returns A Promise that resolves to an array of room IDs.
|
|
4081
|
-
*/
|
|
4082
|
-
abstract getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
4083
|
-
/**
|
|
4084
|
-
* Adds users as a participant to a specific room.
|
|
4085
|
-
* @param entityIds The UUIDs of the users to add as a participant.
|
|
4086
|
-
* @param roomId The UUID of the room to which the user will be added.
|
|
4087
|
-
* @returns A Promise that resolves to a boolean indicating success or failure.
|
|
4088
|
-
*/
|
|
4089
|
-
abstract addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
|
|
4090
|
-
/**
|
|
4091
|
-
* Removes a user as a participant from a specific room.
|
|
4092
|
-
* @param entityId The UUID of the user to remove as a participant.
|
|
4093
|
-
* @param roomId The UUID of the room from which the user will be removed.
|
|
4094
|
-
* @returns A Promise that resolves to a boolean indicating success or failure.
|
|
4095
|
-
*/
|
|
4096
|
-
abstract removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
4097
|
-
/**
|
|
4098
|
-
* Retrieves participants associated with a specific account.
|
|
4099
|
-
* @param entityId The UUID of the account.
|
|
4100
|
-
* @returns A Promise that resolves to an array of Participant objects.
|
|
4101
|
-
*/
|
|
4102
|
-
abstract getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
4103
|
-
/**
|
|
4104
|
-
* Retrieves participants for a specific room.
|
|
4105
|
-
* @param roomId The UUID of the room for which to retrieve participants.
|
|
4106
|
-
* @returns A Promise that resolves to an array of UUIDs representing the participants.
|
|
4107
|
-
*/
|
|
4108
|
-
abstract getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
4109
|
-
abstract getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
4110
|
-
abstract setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
4111
|
-
/**
|
|
4112
|
-
* Creates a new relationship between two users.
|
|
4113
|
-
* @param params Object containing the relationship details including entity IDs, agent ID, optional tags and metadata
|
|
4114
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the creation.
|
|
4115
|
-
*/
|
|
4116
|
-
abstract createRelationship(params: {
|
|
4117
|
-
sourceEntityId: UUID;
|
|
4118
|
-
targetEntityId: UUID;
|
|
4119
|
-
tags?: string[];
|
|
4120
|
-
metadata?: Record<string, unknown>;
|
|
4121
|
-
}): Promise<boolean>;
|
|
4122
|
-
/**
|
|
4123
|
-
* Retrieves a relationship between two users if it exists.
|
|
4124
|
-
* @param params Object containing the entity IDs and agent ID
|
|
4125
|
-
* @returns A Promise that resolves to the Relationship object or null if not found.
|
|
4126
|
-
*/
|
|
4127
|
-
abstract getRelationship(params: {
|
|
4128
|
-
sourceEntityId: UUID;
|
|
4129
|
-
targetEntityId: UUID;
|
|
4130
|
-
}): Promise<Relationship | null>;
|
|
4131
|
-
/**
|
|
4132
|
-
* Retrieves all relationships for a specific user.
|
|
4133
|
-
* @param params Object containing the user ID, agent ID and optional tags to filter by
|
|
4134
|
-
* @returns A Promise that resolves to an array of Relationship objects.
|
|
4135
|
-
*/
|
|
4136
|
-
abstract getRelationships(params: {
|
|
4137
|
-
entityId: UUID;
|
|
4138
|
-
tags?: string[];
|
|
4139
|
-
}): Promise<Relationship[]>;
|
|
4140
|
-
/**
|
|
4141
|
-
* Updates an existing relationship between two users.
|
|
4142
|
-
* @param params Object containing the relationship details to update including entity IDs, agent ID, optional tags and metadata
|
|
4143
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the update.
|
|
4144
|
-
*/
|
|
4145
|
-
abstract updateRelationship(params: {
|
|
4146
|
-
sourceEntityId: UUID;
|
|
4147
|
-
targetEntityId: UUID;
|
|
4148
|
-
tags?: string[];
|
|
4149
|
-
metadata?: Record<string, unknown>;
|
|
4150
|
-
}): Promise<void>;
|
|
4151
|
-
/**
|
|
4152
|
-
* Retrieves an agent by its ID.
|
|
4153
|
-
* @param agentId The UUID of the agent to retrieve.
|
|
4154
|
-
* @returns A Promise that resolves to the Agent object or null if not found.
|
|
4155
|
-
*/
|
|
4156
|
-
abstract getAgent(agentId: UUID): Promise<Agent | null>;
|
|
4157
|
-
/**
|
|
4158
|
-
* Retrieves all agents from the database.
|
|
4159
|
-
* @returns A Promise that resolves to an array of Agent objects.
|
|
4160
|
-
*/
|
|
4161
|
-
abstract getAgents(): Promise<Partial<Agent>[]>;
|
|
4162
|
-
/**
|
|
4163
|
-
* Creates a new agent in the database.
|
|
4164
|
-
* @param agent The agent object to create.
|
|
4165
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the creation.
|
|
4166
|
-
*/
|
|
4167
|
-
abstract createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
4168
|
-
/**
|
|
4169
|
-
* Updates an existing agent in the database.
|
|
4170
|
-
* @param agentId The UUID of the agent to update.
|
|
4171
|
-
* @param agent The agent object with updated properties.
|
|
4172
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the update.
|
|
4173
|
-
*/
|
|
4174
|
-
abstract updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
4175
|
-
/**
|
|
4176
|
-
* Deletes an agent from the database.
|
|
4177
|
-
* @param agentId The UUID of the agent to delete.
|
|
4178
|
-
* @returns A Promise that resolves to a boolean indicating success or failure of the deletion.
|
|
4179
|
-
*/
|
|
4180
|
-
abstract deleteAgent(agentId: UUID): Promise<boolean>;
|
|
4181
|
-
/**
|
|
4182
|
-
* Ensures an embedding dimension exists in the database.
|
|
4183
|
-
* @param dimension The dimension to ensure exists.
|
|
4184
|
-
* @returns A Promise that resolves when the embedding dimension has been ensured to exist.
|
|
4185
|
-
*/
|
|
4186
|
-
abstract ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
4187
|
-
/**
|
|
4188
|
-
* Retrieves a cached value by key from the database.
|
|
4189
|
-
* @param key The key to look up in the cache
|
|
4190
|
-
* @returns Promise resolving to the cached string value
|
|
4191
|
-
*/
|
|
4192
|
-
abstract getCache<T>(key: string): Promise<T | undefined>;
|
|
4193
|
-
/**
|
|
4194
|
-
* Sets a value in the cache with the given key.
|
|
4195
|
-
* @param key The key to store the value under
|
|
4196
|
-
* @param value The value to cache
|
|
4197
|
-
* @returns Promise resolving to true if the cache was set successfully
|
|
4198
|
-
*/
|
|
4199
|
-
abstract setCache<T>(key: string, value: T): Promise<boolean>;
|
|
4200
|
-
/**
|
|
4201
|
-
* Deletes a value from the cache by key.
|
|
4202
|
-
* @param key The key to delete from the cache
|
|
4203
|
-
* @returns Promise resolving to true if the value was successfully deleted
|
|
4204
|
-
*/
|
|
4205
|
-
abstract deleteCache(key: string): Promise<boolean>;
|
|
4206
|
-
/**
|
|
4207
|
-
* Creates a new task instance in the database.
|
|
4208
|
-
* @param task The task object to create
|
|
4209
|
-
* @returns Promise resolving to the UUID of the created task
|
|
4210
|
-
*/
|
|
4211
|
-
abstract createTask(task: Task): Promise<UUID>;
|
|
4212
|
-
/**
|
|
4213
|
-
* Retrieves tasks based on specified parameters.
|
|
4214
|
-
* @param params Object containing optional roomId and tags to filter tasks
|
|
4215
|
-
* @returns Promise resolving to an array of Task objects
|
|
4216
|
-
*/
|
|
4217
|
-
abstract getTasks(params: {
|
|
4218
|
-
roomId?: UUID;
|
|
4219
|
-
tags?: string[];
|
|
4220
|
-
entityId?: UUID;
|
|
4221
|
-
}): Promise<Task[]>;
|
|
4222
|
-
/**
|
|
4223
|
-
* Retrieves a specific task by its ID.
|
|
4224
|
-
* @param id The UUID of the task to retrieve
|
|
4225
|
-
* @returns Promise resolving to the Task object if found, null otherwise
|
|
4226
|
-
*/
|
|
4227
|
-
abstract getTask(id: UUID): Promise<Task | null>;
|
|
4228
|
-
/**
|
|
4229
|
-
* Retrieves a specific task by its name.
|
|
4230
|
-
* @param name The name of the task to retrieve
|
|
4231
|
-
* @returns Promise resolving to the Task object if found, null otherwise
|
|
4232
|
-
*/
|
|
4233
|
-
abstract getTasksByName(name: string): Promise<Task[]>;
|
|
4234
|
-
/**
|
|
4235
|
-
* Updates an existing task in the database.
|
|
4236
|
-
* @param id The UUID of the task to update
|
|
4237
|
-
* @param task Partial Task object containing the fields to update
|
|
4238
|
-
* @returns Promise resolving when the update is complete
|
|
4239
|
-
*/
|
|
4240
|
-
abstract updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
4241
|
-
/**
|
|
4242
|
-
* Deletes a task from the database.
|
|
4243
|
-
* @param id The UUID of the task to delete
|
|
4244
|
-
* @returns Promise resolving when the deletion is complete
|
|
4245
|
-
*/
|
|
4246
|
-
abstract deleteTask(id: UUID): Promise<void>;
|
|
4247
|
-
abstract getMemoriesByWorldId(params: {
|
|
4248
|
-
worldId: UUID;
|
|
4249
|
-
count?: number;
|
|
4250
|
-
tableName?: string;
|
|
4251
|
-
}): Promise<Memory[]>;
|
|
4252
|
-
abstract deleteRoomsByWorldId(worldId: UUID): Promise<void>;
|
|
4253
|
-
}
|
|
4254
|
-
|
|
4255
|
-
/**
|
|
4256
|
-
* Finds an entity by name in the given runtime environment.
|
|
4257
|
-
*
|
|
4258
|
-
* @param {IAgentRuntime} runtime - The agent runtime environment.
|
|
4259
|
-
* @param {Memory} message - The memory message containing relevant information.
|
|
4260
|
-
* @param {State} state - The current state of the system.
|
|
4261
|
-
* @returns {Promise<Entity | null>} A promise that resolves to the found entity or null if not found.
|
|
4262
|
-
*/
|
|
4263
|
-
declare function findEntityByName(runtime: IAgentRuntime, message: Memory, state: State): Promise<Entity | null>;
|
|
4264
|
-
/**
|
|
4265
|
-
* Function to create a unique UUID based on the runtime and base user ID.
|
|
4266
|
-
*
|
|
4267
|
-
* @param {RuntimeContext} runtime - The runtime context object.
|
|
4268
|
-
* @param {UUID|string} baseUserId - The base user ID to use in generating the UUID.
|
|
4269
|
-
* @returns {UUID} - The unique UUID generated based on the runtime and base user ID.
|
|
4270
|
-
*/
|
|
4271
|
-
declare const createUniqueUuid: (runtime: any, baseUserId: UUID | string) => UUID;
|
|
4272
|
-
/**
|
|
4273
|
-
* Get details for a list of entities.
|
|
4274
|
-
*/
|
|
4275
|
-
/**
|
|
4276
|
-
* Retrieves entity details for a specific room from the database.
|
|
4277
|
-
*
|
|
4278
|
-
* @param {Object} params - The input parameters
|
|
4279
|
-
* @param {IAgentRuntime} params.runtime - The Agent Runtime instance
|
|
4280
|
-
* @param {UUID} params.roomId - The ID of the room to retrieve entity details for
|
|
4281
|
-
* @returns {Promise<Array>} - A promise that resolves to an array of unique entity details
|
|
4282
|
-
*/
|
|
4283
|
-
declare function getEntityDetails({ runtime, roomId, }: {
|
|
4284
|
-
runtime: IAgentRuntime;
|
|
4285
|
-
roomId: UUID;
|
|
4286
|
-
}): Promise<any[]>;
|
|
4287
|
-
/**
|
|
4288
|
-
* Format entities into a string
|
|
4289
|
-
* @param entities - list of entities
|
|
4290
|
-
* @returns string
|
|
4291
|
-
*/
|
|
4292
|
-
/**
|
|
4293
|
-
* Format the given entities into a string representation.
|
|
4294
|
-
*
|
|
4295
|
-
* @param {Object} options - The options object.
|
|
4296
|
-
* @param {Entity[]} options.entities - The list of entities to format.
|
|
4297
|
-
* @returns {string} A formatted string representing the entities.
|
|
4298
|
-
*/
|
|
4299
|
-
declare function formatEntities({ entities }: {
|
|
4300
|
-
entities: Entity[];
|
|
4301
|
-
}): string;
|
|
4302
|
-
|
|
4303
|
-
/**
|
|
4304
|
-
* Detects the current runtime environment (browser vs Node.js)
|
|
4305
|
-
* Results are cached for performance
|
|
4306
|
-
*/
|
|
4307
|
-
declare function getEnvironment(): {
|
|
4308
|
-
isBrowser: boolean;
|
|
4309
|
-
isNode: boolean;
|
|
4310
|
-
};
|
|
4311
|
-
/**
|
|
4312
|
-
* Clears the cached environment detection result
|
|
4313
|
-
* Useful for testing or when environment changes
|
|
4314
|
-
*/
|
|
4315
|
-
declare function clearEnvironmentCache(): void;
|
|
4316
|
-
/**
|
|
4317
|
-
* Checks if running in Node.js environment
|
|
4318
|
-
*/
|
|
4319
|
-
declare function isNodeEnv(): boolean;
|
|
4320
|
-
/**
|
|
4321
|
-
* Checks if running in browser environment
|
|
4322
|
-
*/
|
|
4323
|
-
declare function isBrowserEnv(): boolean;
|
|
4324
|
-
/**
|
|
4325
|
-
* Checks if process object is available
|
|
4326
|
-
*/
|
|
4327
|
-
declare function hasProcess(): boolean;
|
|
4328
|
-
/**
|
|
4329
|
-
* Gets an environment variable value if process.env is available
|
|
4330
|
-
*/
|
|
4331
|
-
declare function getProcessEnv(key: string): string | undefined;
|
|
4332
|
-
declare const envDetector: {
|
|
4333
|
-
getEnvironment: typeof getEnvironment;
|
|
4334
|
-
clearCache: typeof clearEnvironmentCache;
|
|
4335
|
-
isNode: typeof isNodeEnv;
|
|
4336
|
-
isBrowser: typeof isBrowserEnv;
|
|
4337
|
-
hasProcess: typeof hasProcess;
|
|
4338
|
-
getProcessEnv: typeof getProcessEnv;
|
|
4339
|
-
};
|
|
4340
|
-
type LogFn = (obj: Record<string, unknown> | string | Error, msg?: string, ...args: unknown[]) => void;
|
|
4341
|
-
interface LoggerBindings extends Record<string, unknown> {
|
|
4342
|
-
__forceType?: 'browser' | 'node';
|
|
4343
|
-
level?: string;
|
|
4344
|
-
maxMemoryLogs?: number;
|
|
4345
|
-
}
|
|
4346
|
-
interface Logger {
|
|
4347
|
-
trace: LogFn;
|
|
4348
|
-
debug: LogFn;
|
|
4349
|
-
info: LogFn;
|
|
4350
|
-
warn: LogFn;
|
|
4351
|
-
error: LogFn;
|
|
4352
|
-
fatal: LogFn;
|
|
4353
|
-
success: LogFn;
|
|
4354
|
-
progress: LogFn;
|
|
4355
|
-
log: LogFn;
|
|
4356
|
-
clear: () => void;
|
|
4357
|
-
child: (bindings: Record<string, unknown>) => Logger;
|
|
4358
|
-
level?: string;
|
|
4359
|
-
}
|
|
4360
|
-
/**
|
|
4361
|
-
* Interface representing a log entry.
|
|
4362
|
-
* @property time - The timestamp of the log entry
|
|
4363
|
-
* @property level - The log level as a number or string
|
|
4364
|
-
* @property msg - The log message content
|
|
4365
|
-
* @property diagnostic - Flag indicating if this is a diagnostic log
|
|
4366
|
-
* @property agentName - Name of the agent that created the log
|
|
4367
|
-
* @property agentId - ID of the agent that created the log
|
|
4368
|
-
* @property [key: string] - Additional properties that can be added to the log entry
|
|
4369
|
-
*/
|
|
4370
|
-
interface LogEntry {
|
|
4371
|
-
time?: number;
|
|
4372
|
-
level?: number | string;
|
|
4373
|
-
msg?: string;
|
|
4374
|
-
diagnostic?: boolean;
|
|
4375
|
-
agentName?: string;
|
|
4376
|
-
agentId?: string;
|
|
4377
|
-
[key: string]: unknown;
|
|
4378
|
-
}
|
|
4379
|
-
declare function createLogger(bindings?: LoggerBindings | boolean): Logger;
|
|
4380
|
-
interface ElizaLogger extends Logger {
|
|
4381
|
-
success: LogFn;
|
|
4382
|
-
progress: LogFn;
|
|
4383
|
-
log: LogFn;
|
|
4384
|
-
}
|
|
4385
|
-
declare const typedLogger: ElizaLogger;
|
|
4386
|
-
|
|
4387
|
-
declare const elizaLogger: ElizaLogger;
|
|
4388
|
-
|
|
4389
|
-
declare const shouldRespondTemplate = "<task>Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.</task>\n\n<providers>\n{{providers}}\n</providers>\n\n<instructions>Decide if {{agentName}} should respond to or interact with the conversation.\nIf the message is directed at or relevant to {{agentName}}, respond with RESPOND action.\nIf a user asks {{agentName}} to be quiet, respond with STOP action.\nIf {{agentName}} should ignore the message, respond with IGNORE action.</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <name>{{agentName}}</name>\n <reasoning>Your reasoning here</reasoning>\n <action>RESPOND | IGNORE | STOP</action>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
4390
|
-
declare const messageHandlerTemplate = "<task>Generate dialog and actions for the character {{agentName}}.</task>\n\n<providers>\n{{providers}}\n</providers>\n\n<instructions>\nWrite a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.\n\nIMPORTANT ACTION ORDERING RULES:\n- Actions are executed in the ORDER you list them - the order MATTERS!\n- REPLY should come FIRST to acknowledge the user's request before executing other actions\n- Common patterns:\n - For requests requiring tool use: REPLY,CALL_MCP_TOOL (acknowledge first, then gather info)\n - For task execution: REPLY,SEND_MESSAGE or REPLY,EVM_SWAP_TOKENS (acknowledge first, then do the task)\n - For multi-step operations: REPLY,ACTION1,ACTION2 (acknowledge first, then complete all steps)\n- REPLY is used to acknowledge and inform the user about what you're going to do\n- Follow-up actions execute the actual tasks after acknowledgment\n- Use IGNORE only when you should not respond at all\n- If you use IGNORE, do not include any other actions. IGNORE should be used alone when you should not respond or take any actions.\n\nIMPORTANT PROVIDER SELECTION RULES:\n- Only include providers if they are needed to respond accurately.\n- If the message mentions images, photos, pictures, attachments, or visual content, OR if you see \"(Attachments:\" in the conversation, you MUST include \"ATTACHMENTS\" in your providers list\n- If the message asks about or references specific people, include \"ENTITIES\" in your providers list \n- If the message asks about relationships or connections between people, include \"RELATIONSHIPS\" in your providers list\n- If the message asks about facts or specific information, include \"FACTS\" in your providers list\n- If the message asks about the environment or world context, include \"WORLD\" in your providers list\n- If no additional context is needed, you may leave the providers list empty.\n\nIMPORTANT CODE BLOCK FORMATTING RULES:\n- If {{agentName}} includes code examples, snippets, or multi-line code in the response, ALWAYS wrap the code with ``` fenced code blocks (specify the language if known, e.g., ```python).\n- ONLY use fenced code blocks for actual code. Do NOT wrap non-code text, instructions, or single words in fenced code blocks.\n- If including inline code (short single words or function names), use single backticks (`) as appropriate.\n- This ensures the user sees clearly formatted and copyable code when relevant.\n\nFirst, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.\n</instructions>\n\n<keys>\n\"thought\" should be a short description of what the agent is thinking about and planning.\n\"actions\" should be a comma-separated list of the actions {{agentName}} plans to take based on the thought, IN THE ORDER THEY SHOULD BE EXECUTED (if none, use IGNORE, if simply responding with text, use REPLY)\n\"providers\" should be a comma-separated list of the providers that {{agentName}} will use to have the right context for responding and acting (NEVER use \"IGNORE\" as a provider - use specific provider names like ATTACHMENTS, ENTITIES, FACTS, KNOWLEDGE, etc.)\n\"text\" should be the text of the next message for {{agentName}} which they will send to the conversation.\n</keys>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <thought>Your thought here</thought>\n <actions>ACTION1,ACTION2</actions>\n <providers>PROVIDER1,PROVIDER2</providers>\n <text>Your response text here</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
4391
|
-
declare const postCreationTemplate = "# Task: Create a post in the voice and style and perspective of {{agentName}} @{{twitterUserName}}.\n\nExample task outputs:\n1. A post about the importance of AI in our lives\n<response>\n <thought>I am thinking about writing a post about the importance of AI in our lives</thought>\n <post>AI is changing the world and it is important to understand how it works</post>\n <imagePrompt>A futuristic cityscape with flying cars and people using AI to do things</imagePrompt>\n</response>\n\n2. A post about dogs\n<response>\n <thought>I am thinking about writing a post about dogs</thought>\n <post>Dogs are man's best friend and they are loyal and loving</post>\n <imagePrompt>A dog playing with a ball in a park</imagePrompt>\n</response>\n\n3. A post about finding a new job\n<response>\n <thought>Getting a job is hard, I bet there's a good tweet in that</thought>\n <post>Just keep going!</post>\n <imagePrompt>A person looking at a computer screen with a job search website</imagePrompt>\n</response>\n\n{{providers}}\n\nWrite a post that is {{adjective}} about {{topic}} (without mentioning {{topic}} directly), from the perspective of {{agentName}}. Do not add commentary or acknowledge this request, just write the post.\nYour response should be 1, 2, or 3 sentences (choose the length at random).\nYour response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.\n\nYour output should be formatted in XML like this:\n<response>\n <thought>Your thought here</thought>\n <post>Your post text here</post>\n <imagePrompt>Optional image prompt here</imagePrompt>\n</response>\n\nThe \"post\" field should be the post you want to send. Do not including any thinking or internal reflection in the \"post\" field.\nThe \"imagePrompt\" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.\nThe \"thought\" field should be a short description of what the agent is thinking about before responding, including a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.\n\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.";
|
|
4392
|
-
declare const booleanFooter = "Respond with only a YES or a NO.";
|
|
4393
|
-
declare const imageDescriptionTemplate = "<task>Analyze the provided image and generate a comprehensive description with multiple levels of detail.</task>\n\n<instructions>\nCarefully examine the image and provide:\n1. A concise, descriptive title that captures the main subject or scene\n2. A brief summary description (1-2 sentences) highlighting the key elements\n3. An extensive, detailed description that covers all visible elements, composition, lighting, colors, mood, and any other relevant details\n\nBe objective and descriptive. Focus on what you can actually see in the image rather than making assumptions about context or meaning.\n</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <title>A concise, descriptive title for the image</title>\n <description>A brief 1-2 sentence summary of the key elements in the image</description>\n <text>An extensive, detailed description covering all visible elements, composition, lighting, colors, mood, setting, objects, people, activities, and any other relevant details you can observe in the image</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
4394
|
-
|
|
4395
|
-
/**
|
|
4396
|
-
* Represents the state of server ownership, including a mapping of server IDs to their respective World objects.
|
|
4397
|
-
*/
|
|
4398
|
-
/**
|
|
4399
|
-
* Interface representing the ownership state of servers.
|
|
4400
|
-
* @property {Object.<string, World>} servers - The servers and their corresponding worlds, where the key is the server ID and the value is the World object.
|
|
4401
|
-
*/
|
|
4402
|
-
interface ServerOwnershipState {
|
|
4403
|
-
servers: {
|
|
4404
|
-
[serverId: string]: World;
|
|
4405
|
-
};
|
|
4406
|
-
}
|
|
4407
|
-
/**
|
|
4408
|
-
* Gets a user's role from world metadata
|
|
4409
|
-
*/
|
|
4410
|
-
/**
|
|
4411
|
-
* Retrieve the server role of a specified user entity within a given server.
|
|
4412
|
-
*
|
|
4413
|
-
* @param {IAgentRuntime} runtime - The runtime object containing necessary configurations and services.
|
|
4414
|
-
* @param {string} entityId - The unique identifier of the user entity.
|
|
4415
|
-
* @param {string} serverId - The unique identifier of the server.
|
|
4416
|
-
* @returns {Promise<Role>} The role of the user entity within the server, resolved as a Promise.
|
|
4417
|
-
*/
|
|
4418
|
-
declare function getUserServerRole(runtime: IAgentRuntime, entityId: string, serverId: string): Promise<Role>;
|
|
4419
|
-
/**
|
|
4420
|
-
* Finds a server where the given user is the owner
|
|
4421
|
-
*/
|
|
4422
|
-
declare function findWorldsForOwner(runtime: IAgentRuntime, entityId: string): Promise<World[] | null>;
|
|
4423
|
-
|
|
4424
|
-
declare class Semaphore {
|
|
4425
|
-
private permits;
|
|
4426
|
-
private waiting;
|
|
4427
|
-
constructor(count: number);
|
|
4428
|
-
acquire(): Promise<void>;
|
|
4429
|
-
release(): void;
|
|
4430
|
-
}
|
|
4431
|
-
declare class AgentRuntime implements IAgentRuntime {
|
|
4432
|
-
#private;
|
|
4433
|
-
readonly agentId: UUID;
|
|
4434
|
-
readonly character: Character;
|
|
4435
|
-
adapter: IDatabaseAdapter;
|
|
4436
|
-
readonly actions: Action[];
|
|
4437
|
-
readonly evaluators: Evaluator[];
|
|
4438
|
-
readonly providers: Provider[];
|
|
4439
|
-
readonly plugins: Plugin[];
|
|
4440
|
-
private isInitialized;
|
|
4441
|
-
events: Map<string, ((params: any) => Promise<void>)[]>;
|
|
4442
|
-
stateCache: Map<`${string}-${string}-${string}-${string}-${string}`, {
|
|
4443
|
-
values: {
|
|
4444
|
-
[key: string]: any;
|
|
4445
|
-
};
|
|
4446
|
-
data: {
|
|
4447
|
-
[key: string]: any;
|
|
4448
|
-
};
|
|
4449
|
-
text: string;
|
|
4450
|
-
}>;
|
|
4451
|
-
readonly fetch: typeof fetch;
|
|
4452
|
-
services: Map<ServiceTypeName, Service[]>;
|
|
4453
|
-
private serviceTypes;
|
|
4454
|
-
models: Map<string, ModelHandler[]>;
|
|
4455
|
-
routes: Route[];
|
|
4456
|
-
private taskWorkers;
|
|
4457
|
-
private sendHandlers;
|
|
4458
|
-
private eventHandlers;
|
|
4459
|
-
private allAvailablePlugins;
|
|
4460
|
-
private characterPlugins;
|
|
4461
|
-
logger: any;
|
|
4462
|
-
private settings;
|
|
4463
|
-
private servicesInitQueue;
|
|
4464
|
-
private servicePromiseHandles;
|
|
4465
|
-
private servicePromises;
|
|
4466
|
-
private currentRunId?;
|
|
4467
|
-
private currentActionContext?;
|
|
4468
|
-
private maxWorkingMemoryEntries;
|
|
4469
|
-
constructor(opts: {
|
|
4470
|
-
conversationLength?: number;
|
|
4471
|
-
agentId?: UUID;
|
|
4472
|
-
character?: Character;
|
|
4473
|
-
plugins?: Plugin[];
|
|
4474
|
-
fetch?: typeof fetch;
|
|
4475
|
-
adapter?: IDatabaseAdapter;
|
|
4476
|
-
settings?: RuntimeSettings;
|
|
4477
|
-
events?: {
|
|
4478
|
-
[key: string]: ((params: any) => void)[];
|
|
4479
|
-
};
|
|
4480
|
-
allAvailablePlugins?: Plugin[];
|
|
4481
|
-
});
|
|
4482
|
-
/**
|
|
4483
|
-
* Create a new run ID for tracking a sequence of model calls
|
|
4484
|
-
*/
|
|
4485
|
-
createRunId(): UUID;
|
|
4486
|
-
/**
|
|
4487
|
-
* Start a new run for tracking prompts
|
|
4488
|
-
*/
|
|
4489
|
-
startRun(): UUID;
|
|
4490
|
-
/**
|
|
4491
|
-
* End the current run
|
|
4492
|
-
*/
|
|
4493
|
-
endRun(): void;
|
|
4494
|
-
/**
|
|
4495
|
-
* Get the current run ID (creates one if it doesn't exist)
|
|
4496
|
-
*/
|
|
4497
|
-
getCurrentRunId(): UUID;
|
|
4498
|
-
registerPlugin(plugin: Plugin): Promise<void>;
|
|
4499
|
-
getAllServices(): Map<ServiceTypeName, Service[]>;
|
|
4500
|
-
stop(): Promise<void>;
|
|
4501
|
-
initialize(): Promise<void>;
|
|
4502
|
-
runPluginMigrations(): Promise<void>;
|
|
4503
|
-
getConnection(): Promise<unknown>;
|
|
4504
|
-
setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
|
|
4505
|
-
getSetting(key: string): string | boolean | null | any;
|
|
4506
|
-
getConversationLength(): number;
|
|
4507
|
-
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
4508
|
-
registerProvider(provider: Provider): void;
|
|
4509
|
-
registerAction(action: Action): void;
|
|
4510
|
-
registerEvaluator(evaluator: Evaluator): void;
|
|
4511
|
-
private updateActionPlan;
|
|
4512
|
-
private updateActionStep;
|
|
4513
|
-
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
|
|
4514
|
-
evaluate(message: Memory, state: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[]>;
|
|
4515
|
-
ensureConnections(entities: any, rooms: any, source: any, world: any): Promise<void>;
|
|
4516
|
-
ensureConnection({ entityId, roomId, worldId, worldName, userName, name, source, type, channelId, serverId, userId, metadata, }: {
|
|
4517
|
-
entityId: UUID;
|
|
4518
|
-
roomId: UUID;
|
|
4519
|
-
worldId: UUID;
|
|
4520
|
-
worldName?: string;
|
|
4521
|
-
userName?: string;
|
|
4522
|
-
name?: string;
|
|
4523
|
-
source?: string;
|
|
4524
|
-
type?: ChannelType;
|
|
4525
|
-
channelId?: string;
|
|
4526
|
-
serverId?: string;
|
|
4527
|
-
userId?: UUID;
|
|
4528
|
-
metadata?: Record<string, any>;
|
|
4529
|
-
}): Promise<void>;
|
|
4530
|
-
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
4531
|
-
removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
4532
|
-
getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
4533
|
-
getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
4534
|
-
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
4535
|
-
addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
|
|
4536
|
-
/**
|
|
4537
|
-
* Ensure the existence of a world.
|
|
4538
|
-
*/
|
|
4539
|
-
ensureWorldExists({ id, name, serverId, metadata }: World): Promise<void>;
|
|
4540
|
-
ensureRoomExists({ id, name, source, type, channelId, serverId, worldId, metadata }: Room): Promise<void>;
|
|
4541
|
-
composeState(message: Memory, includeList?: string[] | null, onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
|
|
4542
|
-
getService<T extends Service = Service>(serviceName: ServiceTypeName | string): T | null;
|
|
4543
|
-
/**
|
|
4544
|
-
* Type-safe service getter that ensures the correct service type is returned
|
|
4545
|
-
* @template T - The expected service class type
|
|
4546
|
-
* @param serviceName - The service type name
|
|
4547
|
-
* @returns The service instance with proper typing, or null if not found
|
|
4548
|
-
*/
|
|
4549
|
-
getTypedService<T extends Service = Service>(serviceName: ServiceTypeName | string): T | null;
|
|
4550
|
-
/**
|
|
4551
|
-
* Get all services of a specific type
|
|
4552
|
-
* @template T - The expected service class type
|
|
4553
|
-
* @param serviceName - The service type name
|
|
4554
|
-
* @returns Array of service instances with proper typing
|
|
4555
|
-
*/
|
|
4556
|
-
getServicesByType<T extends Service = Service>(serviceName: ServiceTypeName | string): T[];
|
|
4557
|
-
/**
|
|
4558
|
-
* Get all registered service types
|
|
4559
|
-
* @returns Array of registered service type names
|
|
4560
|
-
*/
|
|
4561
|
-
getRegisteredServiceTypes(): ServiceTypeName[];
|
|
4562
|
-
/**
|
|
4563
|
-
* Check if a service type is registered
|
|
4564
|
-
* @param serviceType - The service type to check
|
|
4565
|
-
* @returns true if the service is registered
|
|
4566
|
-
*/
|
|
4567
|
-
hasService(serviceType: ServiceTypeName | string): boolean;
|
|
4568
|
-
registerService(serviceDef: typeof Service): Promise<void>;
|
|
4569
|
-
private _createServiceResolver;
|
|
4570
|
-
getServiceLoadPromise(serviceType: ServiceTypeName): Promise<Service>;
|
|
4571
|
-
registerModel(modelType: ModelTypeName, handler: (params: any) => Promise<any>, provider: string, priority?: number): void;
|
|
4572
|
-
getModel(modelType: ModelTypeName, provider?: string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
|
|
4573
|
-
/**
|
|
4574
|
-
* Retrieves model configuration settings from character settings with support for
|
|
4575
|
-
* model-specific overrides and default fallbacks.
|
|
4576
|
-
*
|
|
4577
|
-
* Precedence order (highest to lowest):
|
|
4578
|
-
* 1. Model-specific settings (e.g., TEXT_SMALL_TEMPERATURE)
|
|
4579
|
-
* 2. Default settings (e.g., DEFAULT_TEMPERATURE)
|
|
4580
|
-
* 3. Legacy settings for backwards compatibility (e.g., MODEL_TEMPERATURE)
|
|
4581
|
-
*
|
|
4582
|
-
* @param modelType The specific model type to get settings for
|
|
4583
|
-
* @returns Object containing model parameters if they exist, or null if no settings are configured
|
|
4584
|
-
*/
|
|
4585
|
-
private getModelSettings;
|
|
4586
|
-
useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any, provider?: string): Promise<R>;
|
|
4587
|
-
registerEvent(event: string, handler: (params: any) => Promise<void>): void;
|
|
4588
|
-
getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
|
|
4589
|
-
emitEvent(event: string | string[], params: any): Promise<void>;
|
|
4590
|
-
ensureEmbeddingDimension(): Promise<void>;
|
|
4591
|
-
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
4592
|
-
getTaskWorker(name: string): TaskWorker | undefined;
|
|
4593
|
-
get db(): any;
|
|
4594
|
-
init(): Promise<void>;
|
|
4595
|
-
close(): Promise<void>;
|
|
4596
|
-
getAgent(agentId: UUID): Promise<Agent | null>;
|
|
4597
|
-
getAgents(): Promise<Partial<Agent>[]>;
|
|
4598
|
-
createAgent(agent: Partial<Agent>): Promise<boolean>;
|
|
4599
|
-
updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
4600
|
-
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
4601
|
-
ensureAgentExists(agent: Partial<Agent>): Promise<Agent>;
|
|
4602
|
-
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
4603
|
-
getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
4604
|
-
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
4605
|
-
createEntity(entity: Entity): Promise<boolean>;
|
|
4606
|
-
createEntities(entities: Entity[]): Promise<boolean>;
|
|
4607
|
-
updateEntity(entity: Entity): Promise<void>;
|
|
4608
|
-
getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
4609
|
-
getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
4610
|
-
createComponent(component: Component): Promise<boolean>;
|
|
4611
|
-
updateComponent(component: Component): Promise<void>;
|
|
4612
|
-
deleteComponent(componentId: UUID): Promise<void>;
|
|
4613
|
-
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
4614
|
-
queueEmbeddingGeneration(memory: Memory, priority?: 'high' | 'normal' | 'low'): Promise<void>;
|
|
4615
|
-
getMemories(params: {
|
|
4616
|
-
entityId?: UUID;
|
|
4617
|
-
agentId?: UUID;
|
|
4618
|
-
roomId?: UUID;
|
|
4619
|
-
count?: number;
|
|
4620
|
-
unique?: boolean;
|
|
4621
|
-
tableName: string;
|
|
4622
|
-
start?: number;
|
|
4623
|
-
end?: number;
|
|
4624
|
-
}): Promise<Memory[]>;
|
|
4625
|
-
getAllMemories(): Promise<Memory[]>;
|
|
4626
|
-
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
4627
|
-
getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
|
|
4628
|
-
getMemoriesByRoomIds(params: {
|
|
4629
|
-
tableName: string;
|
|
4630
|
-
roomIds: UUID[];
|
|
4631
|
-
limit?: number;
|
|
4632
|
-
}): Promise<Memory[]>;
|
|
4633
|
-
getCachedEmbeddings(params: {
|
|
4634
|
-
query_table_name: string;
|
|
4635
|
-
query_threshold: number;
|
|
4636
|
-
query_input: string;
|
|
4637
|
-
query_field_name: string;
|
|
4638
|
-
query_field_sub_name: string;
|
|
4639
|
-
query_match_count: number;
|
|
4640
|
-
}): Promise<{
|
|
4641
|
-
embedding: number[];
|
|
4642
|
-
levenshtein_score: number;
|
|
4643
|
-
}[]>;
|
|
4644
|
-
log(params: {
|
|
4645
|
-
body: {
|
|
4646
|
-
[key: string]: unknown;
|
|
4647
|
-
};
|
|
4648
|
-
entityId: UUID;
|
|
4649
|
-
roomId: UUID;
|
|
4650
|
-
type: string;
|
|
4651
|
-
}): Promise<void>;
|
|
4652
|
-
searchMemories(params: {
|
|
4653
|
-
embedding: number[];
|
|
4654
|
-
query?: string;
|
|
4655
|
-
match_threshold?: number;
|
|
4656
|
-
count?: number;
|
|
4657
|
-
roomId?: UUID;
|
|
4658
|
-
unique?: boolean;
|
|
4659
|
-
worldId?: UUID;
|
|
4660
|
-
entityId?: UUID;
|
|
4661
|
-
tableName: string;
|
|
4662
|
-
}): Promise<Memory[]>;
|
|
4663
|
-
rerankMemories(query: string, memories: Memory[]): Promise<Memory[]>;
|
|
4664
|
-
createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
|
|
4665
|
-
updateMemory(memory: Partial<Memory> & {
|
|
4666
|
-
id: UUID;
|
|
4667
|
-
metadata?: MemoryMetadata;
|
|
4668
|
-
}): Promise<boolean>;
|
|
4669
|
-
deleteMemory(memoryId: UUID): Promise<void>;
|
|
4670
|
-
deleteManyMemories(memoryIds: UUID[]): Promise<void>;
|
|
4671
|
-
clearAllAgentMemories(): Promise<void>;
|
|
4672
|
-
deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
4673
|
-
countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
4674
|
-
getLogs(params: {
|
|
4675
|
-
entityId: UUID;
|
|
4676
|
-
roomId?: UUID;
|
|
4677
|
-
type?: string;
|
|
4678
|
-
count?: number;
|
|
4679
|
-
offset?: number;
|
|
4680
|
-
}): Promise<Log[]>;
|
|
4681
|
-
deleteLog(logId: UUID): Promise<void>;
|
|
4682
|
-
createWorld(world: World): Promise<UUID>;
|
|
4683
|
-
getWorld(id: UUID): Promise<World | null>;
|
|
4684
|
-
removeWorld(worldId: UUID): Promise<void>;
|
|
4685
|
-
getAllWorlds(): Promise<World[]>;
|
|
4686
|
-
updateWorld(world: World): Promise<void>;
|
|
4687
|
-
getRoom(roomId: UUID): Promise<Room | null>;
|
|
4688
|
-
getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
|
|
4689
|
-
createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
|
|
4690
|
-
createRooms(rooms: Room[]): Promise<UUID[]>;
|
|
4691
|
-
deleteRoom(roomId: UUID): Promise<void>;
|
|
4692
|
-
deleteRoomsByWorldId(worldId: UUID): Promise<void>;
|
|
4693
|
-
updateRoom(room: Room): Promise<void>;
|
|
4694
|
-
getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
4695
|
-
getRoomsForParticipants(userIds: UUID[]): Promise<UUID[]>;
|
|
4696
|
-
getRooms(worldId: UUID): Promise<Room[]>;
|
|
4697
|
-
getRoomsByWorld(worldId: UUID): Promise<Room[]>;
|
|
4698
|
-
getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
4699
|
-
setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
4700
|
-
createRelationship(params: {
|
|
4701
|
-
sourceEntityId: UUID;
|
|
4702
|
-
targetEntityId: UUID;
|
|
4703
|
-
tags?: string[];
|
|
4704
|
-
metadata?: {
|
|
4705
|
-
[key: string]: any;
|
|
4706
|
-
};
|
|
4707
|
-
}): Promise<boolean>;
|
|
4708
|
-
updateRelationship(relationship: Relationship): Promise<void>;
|
|
4709
|
-
getRelationship(params: {
|
|
4710
|
-
sourceEntityId: UUID;
|
|
4711
|
-
targetEntityId: UUID;
|
|
4712
|
-
}): Promise<Relationship | null>;
|
|
4713
|
-
getRelationships(params: {
|
|
4714
|
-
entityId: UUID;
|
|
4715
|
-
tags?: string[];
|
|
4716
|
-
}): Promise<Relationship[]>;
|
|
4717
|
-
getCache<T>(key: string): Promise<T | undefined>;
|
|
4718
|
-
setCache<T>(key: string, value: T): Promise<boolean>;
|
|
4719
|
-
deleteCache(key: string): Promise<boolean>;
|
|
4720
|
-
createTask(task: Task): Promise<UUID>;
|
|
4721
|
-
getTasks(params: {
|
|
4722
|
-
roomId?: UUID;
|
|
4723
|
-
tags?: string[];
|
|
4724
|
-
entityId?: UUID;
|
|
4725
|
-
}): Promise<Task[]>;
|
|
4726
|
-
getTask(id: UUID): Promise<Task | null>;
|
|
4727
|
-
getTasksByName(name: string): Promise<Task[]>;
|
|
4728
|
-
updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
4729
|
-
deleteTask(id: UUID): Promise<void>;
|
|
4730
|
-
on(event: string, callback: (data: any) => void): void;
|
|
4731
|
-
off(event: string, callback: (data: any) => void): void;
|
|
4732
|
-
emit(event: string, data: any): void;
|
|
4733
|
-
sendControlMessage(params: {
|
|
4734
|
-
roomId: UUID;
|
|
4735
|
-
action: 'enable_input' | 'disable_input';
|
|
4736
|
-
target?: string;
|
|
4737
|
-
}): Promise<void>;
|
|
4738
|
-
registerSendHandler(source: string, handler: SendHandlerFunction): void;
|
|
4739
|
-
sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
|
|
4740
|
-
getMemoriesByWorldId(params: {
|
|
4741
|
-
worldId: UUID;
|
|
4742
|
-
count?: number;
|
|
4743
|
-
tableName?: string;
|
|
4744
|
-
}): Promise<Memory[]>;
|
|
4745
|
-
runMigrations(migrationsPaths?: string[]): Promise<void>;
|
|
4746
|
-
isReady(): Promise<boolean>;
|
|
4747
|
-
}
|
|
4748
|
-
|
|
4749
|
-
/**
|
|
4750
|
-
* Creates a new Setting object based on provided config settings.
|
|
4751
|
-
* @param {Omit<Setting, "value">} configSetting - The configuration settings for the new Setting object.
|
|
4752
|
-
* @returns {Setting} - The newly created Setting object.
|
|
4753
|
-
*/
|
|
4754
|
-
/**
|
|
4755
|
-
* Creates a Setting object from a configSetting object by omitting the 'value' property.
|
|
4756
|
-
*
|
|
4757
|
-
* @param {Omit<Setting, 'value'>} configSetting - The configSetting object to create the Setting from.
|
|
4758
|
-
* @returns {Setting} A new Setting object created from the provided configSetting object.
|
|
4759
|
-
*/
|
|
4760
|
-
declare function createSettingFromConfig(configSetting: Omit<Setting, 'value'>): Setting;
|
|
4761
|
-
/**
|
|
4762
|
-
* Retrieves the salt based on env variable SECRET_SALT
|
|
4763
|
-
*
|
|
4764
|
-
* @returns {string} The salt for the agent.
|
|
4765
|
-
*/
|
|
4766
|
-
declare function getSalt(): string;
|
|
4767
|
-
/**
|
|
4768
|
-
* Common encryption function for string values
|
|
4769
|
-
* @param {string} value - The string value to encrypt
|
|
4770
|
-
* @param {string} salt - The salt to use for encryption
|
|
4771
|
-
* @returns {string} - The encrypted value in 'iv:encrypted' format
|
|
4772
|
-
*/
|
|
4773
|
-
declare function encryptStringValue(value: string, salt: string): string;
|
|
4774
|
-
/**
|
|
4775
|
-
* Common decryption function for string values
|
|
4776
|
-
* @param {string} value - The encrypted value in 'iv:encrypted' format
|
|
4777
|
-
* @param {string} salt - The salt to use for decryption
|
|
4778
|
-
* @returns {string} - The decrypted string value
|
|
4779
|
-
*/
|
|
4780
|
-
declare function decryptStringValue(value: string, salt: string): string;
|
|
4781
|
-
/**
|
|
4782
|
-
* Applies salt to the value of a setting
|
|
4783
|
-
* Only applies to secret settings with string values
|
|
4784
|
-
*/
|
|
4785
|
-
declare function saltSettingValue(setting: Setting, salt: string): Setting;
|
|
4786
|
-
/**
|
|
4787
|
-
* Removes salt from the value of a setting
|
|
4788
|
-
* Only applies to secret settings with string values
|
|
4789
|
-
*/
|
|
4790
|
-
declare function unsaltSettingValue(setting: Setting, salt: string): Setting;
|
|
4791
|
-
/**
|
|
4792
|
-
* Applies salt to all settings in a WorldSettings object
|
|
4793
|
-
*/
|
|
4794
|
-
declare function saltWorldSettings(worldSettings: WorldSettings, salt: string): WorldSettings;
|
|
4795
|
-
/**
|
|
4796
|
-
* Removes salt from all settings in a WorldSettings object
|
|
4797
|
-
*/
|
|
4798
|
-
declare function unsaltWorldSettings(worldSettings: WorldSettings, salt: string): WorldSettings;
|
|
4799
|
-
/**
|
|
4800
|
-
* Updates settings state in world metadata
|
|
4801
|
-
*/
|
|
4802
|
-
declare function updateWorldSettings(runtime: IAgentRuntime, serverId: string, worldSettings: WorldSettings): Promise<boolean>;
|
|
4803
|
-
/**
|
|
4804
|
-
* Gets settings state from world metadata
|
|
4805
|
-
*/
|
|
4806
|
-
declare function getWorldSettings(runtime: IAgentRuntime, serverId: string): Promise<WorldSettings | null>;
|
|
4807
|
-
/**
|
|
4808
|
-
* Initializes settings configuration for a server
|
|
4809
|
-
*/
|
|
4810
|
-
declare function initializeOnboarding(runtime: IAgentRuntime, world: World, config: OnboardingConfig): Promise<WorldSettings | null>;
|
|
4811
|
-
/**
|
|
4812
|
-
* Encrypts sensitive data in a Character object
|
|
4813
|
-
* @param {Character} character - The character object to encrypt secrets for
|
|
4814
|
-
* @returns {Character} - A copy of the character with encrypted secrets
|
|
4815
|
-
*/
|
|
4816
|
-
declare function encryptedCharacter(character: Character): Character;
|
|
4817
|
-
/**
|
|
4818
|
-
* Decrypts sensitive data in a Character object
|
|
4819
|
-
* @param {Character} character - The character object with encrypted secrets
|
|
4820
|
-
* @param {IAgentRuntime} runtime - The runtime information needed for salt generation
|
|
4821
|
-
* @returns {Character} - A copy of the character with decrypted secrets
|
|
4822
|
-
*/
|
|
4823
|
-
declare function decryptedCharacter(character: Character, _runtime: IAgentRuntime): Character;
|
|
4824
|
-
/**
|
|
4825
|
-
* Helper function to encrypt all string values in an object
|
|
4826
|
-
* @param {Record<string, any>} obj - Object with values to encrypt
|
|
4827
|
-
* @param {string} salt - The salt to use for encryption
|
|
4828
|
-
* @returns {Record<string, any>} - Object with encrypted values
|
|
4829
|
-
*/
|
|
4830
|
-
declare function encryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any>;
|
|
4831
|
-
/**
|
|
4832
|
-
* Helper function to decrypt all string values in an object
|
|
4833
|
-
* @param {Record<string, any>} obj - Object with encrypted values
|
|
4834
|
-
* @param {string} salt - The salt to use for decryption
|
|
4835
|
-
* @returns {Record<string, any>} - Object with decrypted values
|
|
4836
|
-
*/
|
|
4837
|
-
declare function decryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any>;
|
|
4838
|
-
|
|
4839
|
-
/**
|
|
4840
|
-
* Service builder class that provides type-safe service creation
|
|
4841
|
-
* with automatic type inference
|
|
4842
|
-
*/
|
|
4843
|
-
declare class ServiceBuilder<TService extends Service = Service> {
|
|
4844
|
-
protected serviceType: ServiceTypeName | string;
|
|
4845
|
-
protected startFn: (runtime: IAgentRuntime) => Promise<TService>;
|
|
4846
|
-
protected stopFn?: () => Promise<void>;
|
|
4847
|
-
protected description: string;
|
|
4848
|
-
constructor(serviceType: ServiceTypeName | string);
|
|
4849
|
-
/**
|
|
4850
|
-
* Set the service description
|
|
4851
|
-
*/
|
|
4852
|
-
withDescription(description: string): this;
|
|
4853
|
-
/**
|
|
4854
|
-
* Set the start function for the service
|
|
4855
|
-
*/
|
|
4856
|
-
withStart(startFn: (runtime: IAgentRuntime) => Promise<TService>): this;
|
|
4857
|
-
/**
|
|
4858
|
-
* Set the stop function for the service
|
|
4859
|
-
*/
|
|
4860
|
-
withStop(stopFn: () => Promise<void>): this;
|
|
4861
|
-
/**
|
|
4862
|
-
* Build the service class with all configured properties
|
|
4863
|
-
*/
|
|
4864
|
-
build(): new (runtime?: IAgentRuntime) => TService;
|
|
4865
|
-
}
|
|
4866
|
-
/**
|
|
4867
|
-
* Create a type-safe service builder
|
|
4868
|
-
* @param serviceType - The service type name
|
|
4869
|
-
* @returns A new ServiceBuilder instance
|
|
4870
|
-
*/
|
|
4871
|
-
declare function createService<TService extends Service = Service>(serviceType: ServiceTypeName | string): ServiceBuilder<TService>;
|
|
4872
|
-
/**
|
|
4873
|
-
* Type-safe service definition helper
|
|
4874
|
-
*/
|
|
4875
|
-
interface ServiceDefinition<T extends Service = Service> {
|
|
4876
|
-
serviceType: ServiceTypeName;
|
|
4877
|
-
description: string;
|
|
4878
|
-
start: (runtime: IAgentRuntime) => Promise<T>;
|
|
4879
|
-
stop?: () => Promise<void>;
|
|
4880
|
-
}
|
|
4881
|
-
/**
|
|
4882
|
-
* Define a service with type safety
|
|
4883
|
-
*/
|
|
4884
|
-
declare function defineService<T extends Service = Service>(definition: ServiceDefinition<T>): new (runtime?: IAgentRuntime) => T;
|
|
4885
|
-
|
|
4886
|
-
export { type Action, type ActionContext, type ActionEventPayload, type ActionExample, type ActionResult, type Agent, AgentRuntime, AgentStatus, type AudioProcessingParams, type BaseMetadata, type BaseModelParams, type BrowserNavigationOptions, CacheKeyPrefix, type ChannelClearedPayload, ChannelType, type Character, type CharacterValidationResult, type ChunkRow, type ClickOptions, type Component, type Content, ContentType, type ControlMessage, type CustomMetadata, DatabaseAdapter, type DbConnection, type DeriveKeyAttestationData, type DescriptionMetadata, type DetokenizeTextParams, type DirectoryItem, type DocumentMetadata, type ElementSelector, type ElizaLogger, type EmailAccount, type EmailAddress, type EmailAttachment, type EmailFolder, type EmailMessage, type EmailSearchOptions, type EmailSendOptions, type EmbeddingGenerationPayload, type EmbeddingSearchResult, type EnhancedState, type Entity, type EntityPayload, type EvaluationExample, type Evaluator, type EvaluatorEventPayload, type EventHandler, type EventPayload, type EventPayloadMap, EventType, type ExtractedContent, type FragmentMetadata, type GenerateTextParams, type Handler, type HandlerCallback, type IAgentRuntime, IBrowserService, type IDatabaseAdapter, IEmailService, ILpService, IMessageService, IPdfService, IPostService, ITokenDataService, ITranscriptionService, IVideoService, IWalletService, IWebSearchService, type ImageDescriptionParams, type ImageGenerationParams, type ImageSearchOptions, type InvokePayload, type IsValidServiceType, type JSONSchema, type KnowledgeItem, KnowledgeScope, type Log, type LogEntry, type Logger, type LoggerBindings, type LpPositionDetails, MODEL_SETTINGS, type Media, type Memory, type MemoryMetadata, type MemoryRetrievalOptions, type MemoryScope, type MemorySearchOptions, MemoryType, type MemoryTypeAlias, type MessageAttachment, type MessageChannel, type MessageContent, type MessageExample, type MessageInfo, type MessageMemory, type MessageMetadata, type MessageParticipant, type MessagePayload, type MessageReaction, type MessageReceivedHandlerParams, type MessageReference, type MessageSearchOptions, type MessageSendOptions, type Metadata, type ModelEventPayload, type ModelHandler, type ModelParamsMap, type ModelResultMap, ModelType, type ModelTypeName, type MultiRoomMemoryOptions, type NewsSearchOptions, type ObjectGenerationParams, type OnboardingConfig, type Participant, type PdfConversionOptions, type PdfExtractionResult, type PdfGenerationOptions, PlatformPrefix, type Plugin, type PluginEvents, type PoolInfo, type PostAnalytics, type PostAuthor, type PostContent, type PostCreateOptions, type PostEngagement, type PostInfo, type PostLocation, type PostMedia, type PostSearchOptions, type Project, type ProjectAgent, type Provider, type ProviderResult, type Relationship, type RemoteAttestationMessage, type RemoteAttestationQuote, Role, type Room, type RoomMetadata, type Route, type RunEventPayload, type RuntimeSettings, SOCKET_MESSAGE_TYPE, type ScreenshotOptions, type SearchOptions, type SearchResponse, type SearchResult, Semaphore, type SendHandlerFunction, type ServerOwnershipState, Service, ServiceBuilder, type ServiceClassMap, type ServiceDefinition, type ServiceError, type ServiceInstance, type ServiceRegistry, ServiceType, type ServiceTypeName, type ServiceTypeRegistry, type ServiceTypeValue, type Setting, type SpeechToTextOptions, type State, type StateArray, type StateObject, type StateValue, TEEMode, type TargetInfo, type Task, type TaskMetadata, type TaskWorker, type TeeAgent, type TeePluginConfig, TeeType, type TemplateType, type TestCase, type TestSuite, type TextEmbeddingParams, type TextGenerationParams, type TextToSpeechOptions, type TextToSpeechParams, type TokenBalance, type TokenData, type TokenizeTextParams, type TransactionResult, type TranscriptionOptions, type TranscriptionParams, type TranscriptionResult, type TranscriptionSegment, type TranscriptionWord, type TypeOptions, type TypedEventHandler, type TypedService, type TypedServiceClass, type UUID, type UnifiedMemoryOptions, type UnifiedSearchOptions, VECTOR_DIMS, type Validator, type VideoDownloadOptions, type VideoFormat, type VideoInfo, type VideoProcessingOptions, type VideoProcessingParams, type VideoSearchOptions, type WalletAsset, type WalletPortfolio, type World, type WorldPayload, type WorldSettings, addHeader, asUUID, booleanFooter, characterSchema, composeActionExamples, composePrompt, composePromptFromState, createActionResult, createLogger, createMessageMemory, createService, createServiceError, createSettingFromConfig, createUniqueUuid, decryptObjectValues, decryptStringValue as decryptSecret, decryptStringValue, decryptedCharacter, defineService, elizaLogger, encryptObjectValues, encryptStringValue, encryptedCharacter, envDetector, findEntityByName, findWorldsForOwner, formatActionNames, formatActions, formatEntities, formatMessages, formatPosts, formatTimestamp, getContentTypeFromMimeType, getEntityDetails, getLocalServerUrl, getMemoryText, getModelSpecificSettingKey, getSalt, getTypedService, getUserServerRole, getWorldSettings, imageDescriptionTemplate, initializeOnboarding, isCustomMetadata, isDescriptionMetadata, isDocumentMemory, isDocumentMetadata, isFragmentMemory, isFragmentMetadata, isMessageMetadata, isValidCharacter, typedLogger as logger, messageHandlerTemplate, normalizeJsonString, parseAndValidateCharacter, parseBooleanFromText, parseJSONObjectFromText, parseKeyValueXml, postCreationTemplate, safeReplacer, saltSettingValue, saltWorldSettings, shouldRespondTemplate, splitChunks, stringToUuid, trimTokens, truncateToCompleteSentence, unsaltSettingValue, unsaltWorldSettings, updateWorldSettings, validateCharacter, validateUuid };
|
|
4
|
+
export * from './node/index';
|