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