@elizaos/core 2.0.0-alpha.7 → 2.0.0-alpha.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +213 -16
- package/dist/testing/index.js +22 -0
- package/dist/testing/index.js.map +9 -0
- package/package.json +46 -27
- package/dist/actions.d.ts +0 -22
- package/dist/actions.d.ts.map +0 -1
- package/dist/browser/index.browser.js +0 -771
- package/dist/browser/index.browser.js.map +0 -427
- package/dist/browser/index.d.ts +0 -2
- package/dist/character.d.ts +0 -39
- package/dist/character.d.ts.map +0 -1
- package/dist/constants/index.d.ts +0 -7
- package/dist/constants/secrets.d.ts +0 -67
- package/dist/database.d.ts +0 -494
- package/dist/database.d.ts.map +0 -1
- package/dist/elizaos.d.ts +0 -194
- package/dist/elizaos.d.ts.map +0 -1
- package/dist/entities.d.ts +0 -40
- package/dist/entities.d.ts.map +0 -1
- package/dist/index.browser.d.ts +0 -39
- package/dist/index.browser.d.ts.map +0 -1
- package/dist/index.d.ts +0 -40
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.node.d.ts +0 -37
- package/dist/index.node.d.ts.map +0 -1
- package/dist/logger.d.ts +0 -72
- package/dist/logger.d.ts.map +0 -1
- package/dist/memory.d.ts +0 -63
- package/dist/memory.d.ts.map +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.node.js +0 -53403
- package/dist/node/index.node.js.map +0 -511
- package/dist/onboarding-state.d.ts +0 -209
- package/dist/plugin.d.ts +0 -55
- package/dist/plugin.d.ts.map +0 -1
- package/dist/prompts.d.ts +0 -7
- package/dist/prompts.d.ts.map +0 -1
- package/dist/request-context.d.ts +0 -142
- package/dist/request-context.d.ts.map +0 -1
- package/dist/request-context.node.d.ts +0 -36
- package/dist/request-context.node.d.ts.map +0 -1
- package/dist/roles.d.ts +0 -23
- package/dist/roles.d.ts.map +0 -1
- package/dist/runtime.d.ts +0 -366
- package/dist/runtime.d.ts.map +0 -1
- package/dist/schemas/character.d.ts +0 -151
- package/dist/schemas/character.d.ts.map +0 -1
- package/dist/search.d.ts +0 -316
- package/dist/search.d.ts.map +0 -1
- package/dist/secrets.d.ts +0 -11
- package/dist/secrets.d.ts.map +0 -1
- package/dist/services/default-message-service.d.ts +0 -69
- package/dist/services/default-message-service.d.ts.map +0 -1
- package/dist/services/message-service.d.ts +0 -171
- package/dist/services/message-service.d.ts.map +0 -1
- package/dist/services.d.ts +0 -56
- package/dist/services.d.ts.map +0 -1
- package/dist/sessions/index.d.ts +0 -10
- package/dist/sessions/paths.d.ts +0 -56
- package/dist/sessions/provider.d.ts +0 -73
- package/dist/sessions/session-key.d.ts +0 -133
- package/dist/sessions/store.d.ts +0 -75
- package/dist/sessions/types.d.ts +0 -195
- package/dist/settings.d.ts +0 -90
- package/dist/settings.d.ts.map +0 -1
- package/dist/streaming-context.browser.d.ts +0 -26
- package/dist/streaming-context.browser.d.ts.map +0 -1
- package/dist/streaming-context.d.ts +0 -95
- package/dist/streaming-context.d.ts.map +0 -1
- package/dist/streaming-context.node.d.ts +0 -15
- package/dist/streaming-context.node.d.ts.map +0 -1
- package/dist/types/agent.d.ts +0 -97
- package/dist/types/agent.d.ts.map +0 -1
- package/dist/types/components.d.ts +0 -155
- package/dist/types/components.d.ts.map +0 -1
- package/dist/types/database.d.ts +0 -414
- package/dist/types/database.d.ts.map +0 -1
- package/dist/types/elizaos.d.ts +0 -159
- package/dist/types/elizaos.d.ts.map +0 -1
- package/dist/types/environment.d.ts +0 -116
- package/dist/types/environment.d.ts.map +0 -1
- package/dist/types/events.d.ts +0 -203
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -20
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/knowledge.d.ts +0 -30
- package/dist/types/knowledge.d.ts.map +0 -1
- package/dist/types/memory.d.ts +0 -102
- package/dist/types/memory.d.ts.map +0 -1
- package/dist/types/messaging.d.ts +0 -137
- package/dist/types/messaging.d.ts.map +0 -1
- package/dist/types/model.d.ts +0 -513
- package/dist/types/model.d.ts.map +0 -1
- package/dist/types/plugin.d.ts +0 -91
- package/dist/types/plugin.d.ts.map +0 -1
- package/dist/types/primitives.d.ts +0 -96
- package/dist/types/primitives.d.ts.map +0 -1
- package/dist/types/runtime.d.ts +0 -140
- package/dist/types/runtime.d.ts.map +0 -1
- package/dist/types/service.d.ts +0 -150
- package/dist/types/service.d.ts.map +0 -1
- package/dist/types/settings.d.ts +0 -29
- package/dist/types/settings.d.ts.map +0 -1
- package/dist/types/state.d.ts +0 -56
- package/dist/types/state.d.ts.map +0 -1
- package/dist/types/streaming.d.ts +0 -71
- package/dist/types/streaming.d.ts.map +0 -1
- package/dist/types/task.d.ts +0 -67
- package/dist/types/task.d.ts.map +0 -1
- package/dist/types/tee.d.ts +0 -96
- package/dist/types/tee.d.ts.map +0 -1
- package/dist/types/testing.d.ts +0 -28
- package/dist/types/testing.d.ts.map +0 -1
- package/dist/utils/buffer.d.ts +0 -104
- package/dist/utils/buffer.d.ts.map +0 -1
- package/dist/utils/crypto-compat.d.ts +0 -183
- package/dist/utils/crypto-compat.d.ts.map +0 -1
- package/dist/utils/environment.d.ts +0 -50
- package/dist/utils/environment.d.ts.map +0 -1
- package/dist/utils/node.d.ts +0 -5
- package/dist/utils/node.d.ts.map +0 -1
- package/dist/utils/paths.d.ts +0 -92
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/server-health.d.ts +0 -22
- package/dist/utils/server-health.d.ts.map +0 -1
- package/dist/utils/streaming.d.ts +0 -179
- package/dist/utils/streaming.d.ts.map +0 -1
- package/dist/utils/type-guards.d.ts +0 -23
- package/dist/utils/type-guards.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -182
- package/dist/utils.d.ts.map +0 -1
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { ChannelType } from './environment';
|
|
2
|
-
/**
|
|
3
|
-
* Defines a custom type UUID representing a universally unique identifier
|
|
4
|
-
*/
|
|
5
|
-
export type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
6
|
-
/**
|
|
7
|
-
* Helper function to safely cast a string to strongly typed UUID
|
|
8
|
-
* @param id The string UUID to validate and cast
|
|
9
|
-
* @returns The same UUID with branded type information
|
|
10
|
-
*/
|
|
11
|
-
export declare function asUUID(id: string): UUID;
|
|
12
|
-
/**
|
|
13
|
-
* Represents the content of a memory, message, or other information
|
|
14
|
-
*/
|
|
15
|
-
export interface Content {
|
|
16
|
-
/** The agent's internal thought process */
|
|
17
|
-
thought?: string;
|
|
18
|
-
/** The main text content visible to users */
|
|
19
|
-
text?: string;
|
|
20
|
-
/** Optional actions to be performed */
|
|
21
|
-
actions?: string[];
|
|
22
|
-
/** Optional providers to use for context generation */
|
|
23
|
-
providers?: string[];
|
|
24
|
-
/** Optional source/origin of the content */
|
|
25
|
-
source?: string;
|
|
26
|
-
/** Optional target/destination for responses */
|
|
27
|
-
target?: string;
|
|
28
|
-
/** URL of the original message/post (e.g. tweet URL, Discord message link) */
|
|
29
|
-
url?: string;
|
|
30
|
-
/** UUID of parent message if this is a reply/thread */
|
|
31
|
-
inReplyTo?: UUID;
|
|
32
|
-
/** Array of media attachments */
|
|
33
|
-
attachments?: Media[];
|
|
34
|
-
/** room type */
|
|
35
|
-
channelType?: ChannelType;
|
|
36
|
-
/** Platform-provided metadata about mentions */
|
|
37
|
-
mentionContext?: MentionContext;
|
|
38
|
-
/**
|
|
39
|
-
* Internal message ID used for streaming coordination.
|
|
40
|
-
* Set during response generation to ensure streaming chunks and
|
|
41
|
-
* final broadcast use the same message ID.
|
|
42
|
-
*/
|
|
43
|
-
responseMessageId?: UUID;
|
|
44
|
-
/**
|
|
45
|
-
* Additional dynamic properties
|
|
46
|
-
* Use specific properties above instead of this when possible
|
|
47
|
-
*/
|
|
48
|
-
[key: string]: unknown;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Platform-provided metadata about mentions.
|
|
52
|
-
* Contains ONLY technical facts from the platform API.
|
|
53
|
-
* This allows bootstrap to make intelligent decisions about responding
|
|
54
|
-
* while keeping platform-specific logic isolated.
|
|
55
|
-
*/
|
|
56
|
-
export interface MentionContext {
|
|
57
|
-
/** Platform native mention (@Discord, @Telegram, etc.) */
|
|
58
|
-
isMention: boolean;
|
|
59
|
-
/** Reply to agent's message */
|
|
60
|
-
isReply: boolean;
|
|
61
|
-
/** In a thread with agent */
|
|
62
|
-
isThread: boolean;
|
|
63
|
-
/** Platform-specific mention type for debugging/logging */
|
|
64
|
-
mentionType?: 'platform_mention' | 'reply' | 'thread' | 'none';
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Represents a media attachment
|
|
68
|
-
*/
|
|
69
|
-
export type Media = {
|
|
70
|
-
/** Unique identifier */
|
|
71
|
-
id: string;
|
|
72
|
-
/** Media URL */
|
|
73
|
-
url: string;
|
|
74
|
-
/** Media title */
|
|
75
|
-
title?: string;
|
|
76
|
-
/** Media source */
|
|
77
|
-
source?: string;
|
|
78
|
-
/** Media description */
|
|
79
|
-
description?: string;
|
|
80
|
-
/** Text content */
|
|
81
|
-
text?: string;
|
|
82
|
-
/** Content type */
|
|
83
|
-
contentType?: ContentType;
|
|
84
|
-
};
|
|
85
|
-
export declare enum ContentType {
|
|
86
|
-
IMAGE = "image",
|
|
87
|
-
VIDEO = "video",
|
|
88
|
-
AUDIO = "audio",
|
|
89
|
-
DOCUMENT = "document",
|
|
90
|
-
LINK = "link"
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* A generic type for metadata objects, allowing for arbitrary key-value pairs.
|
|
94
|
-
* This encourages consumers to perform type checking or casting.
|
|
95
|
-
*/
|
|
96
|
-
export type Metadata = Record<string, unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/types/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAE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M,KAAK,GAAG;IAClB,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;IAEZ,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mBAAmB;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,mBAAmB;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/types/runtime.d.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { Character } from './agent';
|
|
2
|
-
import type { Action, Evaluator, Provider, ActionResult } from './components';
|
|
3
|
-
import { HandlerCallback } from './components';
|
|
4
|
-
import type { IDatabaseAdapter } from './database';
|
|
5
|
-
import type { IElizaOS } from './elizaos';
|
|
6
|
-
import type { Entity, Room, World, ChannelType } from './environment';
|
|
7
|
-
import type { Logger } from '../logger';
|
|
8
|
-
import { Memory, MemoryMetadata } from './memory';
|
|
9
|
-
import type { SendHandlerFunction, TargetInfo } from './messaging';
|
|
10
|
-
import type { IMessageService } from '../services/message-service';
|
|
11
|
-
import type { ModelParamsMap, ModelResultMap, ModelTypeName, GenerateTextOptions, GenerateTextResult, GenerateTextParams, TextGenerationModelType } from './model';
|
|
12
|
-
import type { Plugin, RuntimeEventStorage, Route } from './plugin';
|
|
13
|
-
import type { Content, UUID } from './primitives';
|
|
14
|
-
import type { Service, ServiceTypeName } from './service';
|
|
15
|
-
import type { State } from './state';
|
|
16
|
-
import type { TaskWorker } from './task';
|
|
17
|
-
import type { EventPayloadMap, EventHandler, EventPayload } from './events';
|
|
18
|
-
/**
|
|
19
|
-
* Represents the core runtime environment for an agent.
|
|
20
|
-
* Defines methods for database interaction, plugin management, event handling,
|
|
21
|
-
* state composition, model usage, and task management.
|
|
22
|
-
*/
|
|
23
|
-
export interface IAgentRuntime extends IDatabaseAdapter {
|
|
24
|
-
agentId: UUID;
|
|
25
|
-
character: Character;
|
|
26
|
-
initPromise: Promise<void>;
|
|
27
|
-
messageService: IMessageService | null;
|
|
28
|
-
providers: Provider[];
|
|
29
|
-
actions: Action[];
|
|
30
|
-
evaluators: Evaluator[];
|
|
31
|
-
plugins: Plugin[];
|
|
32
|
-
services: Map<ServiceTypeName, Service[]>;
|
|
33
|
-
events: RuntimeEventStorage;
|
|
34
|
-
fetch?: typeof fetch | null;
|
|
35
|
-
routes: Route[];
|
|
36
|
-
logger: Logger;
|
|
37
|
-
stateCache: Map<string, State>;
|
|
38
|
-
elizaOS?: IElizaOS;
|
|
39
|
-
registerPlugin(plugin: Plugin): Promise<void>;
|
|
40
|
-
initialize(options?: {
|
|
41
|
-
skipMigrations?: boolean;
|
|
42
|
-
}): Promise<void>;
|
|
43
|
-
getConnection(): Promise<unknown>;
|
|
44
|
-
getService<T extends Service>(service: ServiceTypeName | string): T | null;
|
|
45
|
-
getServicesByType<T extends Service>(service: ServiceTypeName | string): T[];
|
|
46
|
-
getAllServices(): Map<ServiceTypeName, Service[]>;
|
|
47
|
-
registerService(service: typeof Service): Promise<void>;
|
|
48
|
-
getServiceLoadPromise(serviceType: ServiceTypeName): Promise<Service>;
|
|
49
|
-
getRegisteredServiceTypes(): ServiceTypeName[];
|
|
50
|
-
hasService(serviceType: ServiceTypeName | string): boolean;
|
|
51
|
-
hasElizaOS(): this is IAgentRuntime & {
|
|
52
|
-
elizaOS: IElizaOS;
|
|
53
|
-
};
|
|
54
|
-
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
55
|
-
setSetting(key: string, value: string | boolean | null, secret?: boolean): void;
|
|
56
|
-
getSetting(key: string): string | boolean | number | null;
|
|
57
|
-
getConversationLength(): number;
|
|
58
|
-
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback, options?: {
|
|
59
|
-
onStreamChunk?: (chunk: string, messageId?: UUID) => Promise<void>;
|
|
60
|
-
}): Promise<void>;
|
|
61
|
-
getActionResults(messageId: UUID): ActionResult[];
|
|
62
|
-
evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
|
|
63
|
-
registerProvider(provider: Provider): void;
|
|
64
|
-
registerAction(action: Action): void;
|
|
65
|
-
registerEvaluator(evaluator: Evaluator): void;
|
|
66
|
-
ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
|
|
67
|
-
ensureConnection({ entityId, roomId, metadata, userName, worldName, name, source, channelId, messageServerId, type, worldId, userId, }: {
|
|
68
|
-
entityId: UUID;
|
|
69
|
-
roomId: UUID;
|
|
70
|
-
userName?: string;
|
|
71
|
-
name?: string;
|
|
72
|
-
worldName?: string;
|
|
73
|
-
source?: string;
|
|
74
|
-
channelId?: string;
|
|
75
|
-
messageServerId?: UUID;
|
|
76
|
-
type?: ChannelType | string;
|
|
77
|
-
worldId: UUID;
|
|
78
|
-
userId?: UUID;
|
|
79
|
-
metadata?: Record<string, unknown>;
|
|
80
|
-
}): Promise<void>;
|
|
81
|
-
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
82
|
-
ensureWorldExists(world: World): Promise<void>;
|
|
83
|
-
ensureRoomExists(room: Room): Promise<void>;
|
|
84
|
-
composeState(message: Memory, includeList?: string[], onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
|
|
85
|
-
/**
|
|
86
|
-
* Use a model for inference with proper type inference based on parameters.
|
|
87
|
-
*
|
|
88
|
-
* For text generation models (TEXT_SMALL, TEXT_LARGE, TEXT_REASONING_*):
|
|
89
|
-
* - Always returns `string`
|
|
90
|
-
* - If streaming context is active, chunks are sent to callback automatically
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* // Simple usage - streaming happens automatically if context is active
|
|
95
|
-
* const text = await runtime.useModel(ModelType.TEXT_LARGE, { prompt: "Hello" });
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
useModel(modelType: TextGenerationModelType, params: GenerateTextParams, provider?: string): Promise<string>;
|
|
99
|
-
useModel<T extends keyof ModelParamsMap, R = ModelResultMap[T]>(modelType: T, params: ModelParamsMap[T], provider?: string): Promise<R>;
|
|
100
|
-
generateText(input: string, options?: GenerateTextOptions): Promise<GenerateTextResult>;
|
|
101
|
-
registerModel(modelType: ModelTypeName | string, handler: (runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>, provider: string, priority?: number): void;
|
|
102
|
-
getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: Record<string, unknown>) => Promise<unknown>) | undefined;
|
|
103
|
-
registerEvent<T extends keyof EventPayloadMap>(event: T, handler: EventHandler<T>): void;
|
|
104
|
-
registerEvent<P extends EventPayload = EventPayload>(event: string, handler: (params: P) => Promise<void>): void;
|
|
105
|
-
getEvent<T extends keyof EventPayloadMap>(event: T): EventHandler<T>[] | undefined;
|
|
106
|
-
getEvent(event: string): ((params: EventPayload) => Promise<void>)[] | undefined;
|
|
107
|
-
emitEvent<T extends keyof EventPayloadMap>(event: T | T[], params: EventPayloadMap[T]): Promise<void>;
|
|
108
|
-
emitEvent(event: string | string[], params: EventPayload): Promise<void>;
|
|
109
|
-
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
110
|
-
getTaskWorker(name: string): TaskWorker | undefined;
|
|
111
|
-
stop(): Promise<void>;
|
|
112
|
-
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
113
|
-
/**
|
|
114
|
-
* Queue a memory for async embedding generation.
|
|
115
|
-
* This method is non-blocking and returns immediately.
|
|
116
|
-
* The embedding will be generated asynchronously via event handlers.
|
|
117
|
-
* @param memory The memory to generate embeddings for
|
|
118
|
-
* @param priority Priority level for the embedding generation
|
|
119
|
-
*/
|
|
120
|
-
queueEmbeddingGeneration(memory: Memory, priority?: 'high' | 'normal' | 'low'): Promise<void>;
|
|
121
|
-
getAllMemories(): Promise<Memory[]>;
|
|
122
|
-
clearAllAgentMemories(): Promise<void>;
|
|
123
|
-
updateMemory(memory: Partial<Memory> & {
|
|
124
|
-
id: UUID;
|
|
125
|
-
metadata?: MemoryMetadata;
|
|
126
|
-
}): Promise<boolean>;
|
|
127
|
-
createRunId(): UUID;
|
|
128
|
-
startRun(roomId?: UUID): UUID;
|
|
129
|
-
endRun(): void;
|
|
130
|
-
getCurrentRunId(): UUID;
|
|
131
|
-
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
132
|
-
getRoom(roomId: UUID): Promise<Room | null>;
|
|
133
|
-
createEntity(entity: Entity): Promise<boolean>;
|
|
134
|
-
createRoom({ id, name, source, type, channelId, messageServerId, worldId }: Room): Promise<UUID>;
|
|
135
|
-
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
136
|
-
getRooms(worldId: UUID): Promise<Room[]>;
|
|
137
|
-
registerSendHandler(source: string, handler: SendHandlerFunction): void;
|
|
138
|
-
sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
|
|
139
|
-
updateWorld(world: World): Promise<void>;
|
|
140
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/types/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAA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AAQ,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtD,OAAO,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAC5C,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjG,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACzC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACxE,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C"}
|
package/dist/types/service.d.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from './primitives';
|
|
2
|
-
import type { IAgentRuntime } from './runtime';
|
|
3
|
-
/**
|
|
4
|
-
* Core service type registry that can be extended by plugins via module augmentation.
|
|
5
|
-
* Plugins can extend this interface to add their own service types:
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* declare module '@elizaos/core' {
|
|
10
|
-
* interface ServiceTypeRegistry {
|
|
11
|
-
* MY_CUSTOM_SERVICE: 'my_custom_service';
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export interface ServiceTypeRegistry {
|
|
17
|
-
TRANSCRIPTION: 'transcription';
|
|
18
|
-
VIDEO: 'video';
|
|
19
|
-
BROWSER: 'browser';
|
|
20
|
-
PDF: 'pdf';
|
|
21
|
-
REMOTE_FILES: 'aws_s3';
|
|
22
|
-
WEB_SEARCH: 'web_search';
|
|
23
|
-
EMAIL: 'email';
|
|
24
|
-
TEE: 'tee';
|
|
25
|
-
TASK: 'task';
|
|
26
|
-
WALLET: 'wallet';
|
|
27
|
-
LP_POOL: 'lp_pool';
|
|
28
|
-
TOKEN_DATA: 'token_data';
|
|
29
|
-
MESSAGE_SERVICE: 'message_service';
|
|
30
|
-
MESSAGE: 'message';
|
|
31
|
-
POST: 'post';
|
|
32
|
-
UNKNOWN: 'unknown';
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Type for service names that includes both core services and any plugin-registered services
|
|
36
|
-
*/
|
|
37
|
-
export type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
|
|
38
|
-
/**
|
|
39
|
-
* Helper type to extract service type values from the registry
|
|
40
|
-
*/
|
|
41
|
-
export type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
|
|
42
|
-
/**
|
|
43
|
-
* Helper type to check if a service type exists in the registry
|
|
44
|
-
*/
|
|
45
|
-
export type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
|
|
46
|
-
/**
|
|
47
|
-
* Type-safe service class definition
|
|
48
|
-
*/
|
|
49
|
-
export type TypedServiceClass<T extends ServiceTypeName> = {
|
|
50
|
-
new (runtime?: IAgentRuntime): Service;
|
|
51
|
-
serviceType: T;
|
|
52
|
-
start(runtime: IAgentRuntime): Promise<Service>;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Map of service type names to their implementation classes
|
|
56
|
-
*/
|
|
57
|
-
export interface ServiceClassMap {
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Helper to infer service instance type from service type name
|
|
61
|
-
*/
|
|
62
|
-
export type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
|
|
63
|
-
/**
|
|
64
|
-
* Runtime service registry type
|
|
65
|
-
*/
|
|
66
|
-
export type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
|
|
67
|
-
/**
|
|
68
|
-
* Enumerates the recognized types of services that can be registered and used by the agent runtime.
|
|
69
|
-
* Services provide specialized functionalities like audio transcription, video processing,
|
|
70
|
-
* web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,
|
|
71
|
-
* secure execution via TEE (Trusted Execution Environment), and task management.
|
|
72
|
-
* This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).
|
|
73
|
-
* Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.
|
|
74
|
-
*/
|
|
75
|
-
export declare const ServiceType: {
|
|
76
|
-
readonly TRANSCRIPTION: "transcription";
|
|
77
|
-
readonly VIDEO: "video";
|
|
78
|
-
readonly BROWSER: "browser";
|
|
79
|
-
readonly PDF: "pdf";
|
|
80
|
-
readonly REMOTE_FILES: "aws_s3";
|
|
81
|
-
readonly WEB_SEARCH: "web_search";
|
|
82
|
-
readonly EMAIL: "email";
|
|
83
|
-
readonly TEE: "tee";
|
|
84
|
-
readonly TASK: "task";
|
|
85
|
-
readonly WALLET: "wallet";
|
|
86
|
-
readonly LP_POOL: "lp_pool";
|
|
87
|
-
readonly TOKEN_DATA: "token_data";
|
|
88
|
-
readonly MESSAGE_SERVICE: "message_service";
|
|
89
|
-
readonly MESSAGE: "message";
|
|
90
|
-
readonly POST: "post";
|
|
91
|
-
readonly UNKNOWN: "unknown";
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Client instance
|
|
95
|
-
*/
|
|
96
|
-
export declare abstract class Service {
|
|
97
|
-
/** Runtime instance */
|
|
98
|
-
protected runtime: IAgentRuntime;
|
|
99
|
-
constructor(runtime?: IAgentRuntime);
|
|
100
|
-
abstract stop(): Promise<void>;
|
|
101
|
-
/** Service type */
|
|
102
|
-
static serviceType: string;
|
|
103
|
-
/** Service name */
|
|
104
|
-
abstract capabilityDescription: string;
|
|
105
|
-
/** Service configuration */
|
|
106
|
-
config?: Metadata;
|
|
107
|
-
/** Start service connection */
|
|
108
|
-
static start(_runtime: IAgentRuntime): Promise<Service>;
|
|
109
|
-
/** Stop service connection */
|
|
110
|
-
static stop(_runtime: IAgentRuntime): Promise<void>;
|
|
111
|
-
/** Optional static method to register send handlers */
|
|
112
|
-
static registerSendHandlers?(runtime: IAgentRuntime, service: Service): void;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Generic service interface that provides better type checking for services
|
|
116
|
-
* @template ConfigType The configuration type for this service
|
|
117
|
-
* @template ResultType The result type returned by the service operations
|
|
118
|
-
*/
|
|
119
|
-
export interface TypedService<ConfigType extends Metadata = Metadata, InputType = unknown, ResultType = unknown> extends Service {
|
|
120
|
-
/**
|
|
121
|
-
* The configuration for this service instance
|
|
122
|
-
*/
|
|
123
|
-
config?: ConfigType;
|
|
124
|
-
/**
|
|
125
|
-
* Process an input with this service
|
|
126
|
-
* @param input The input to process
|
|
127
|
-
* @returns A promise resolving to the result
|
|
128
|
-
*/
|
|
129
|
-
process(input: InputType): Promise<ResultType>;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Generic factory function to create a typed service instance
|
|
133
|
-
* @param runtime The agent runtime
|
|
134
|
-
* @param serviceType The type of service to get
|
|
135
|
-
* @returns The service instance or null if not available
|
|
136
|
-
*/
|
|
137
|
-
export declare function getTypedService<ConfigType extends Metadata = Metadata, InputType = unknown, ResultType = unknown>(runtime: IAgentRuntime, serviceType: ServiceTypeName): TypedService<ConfigType, InputType, ResultType> | null;
|
|
138
|
-
/**
|
|
139
|
-
* Standardized service error type for consistent error handling
|
|
140
|
-
*/
|
|
141
|
-
export interface ServiceError {
|
|
142
|
-
code: string;
|
|
143
|
-
message: string;
|
|
144
|
-
details?: Record<string, unknown> | string | number | boolean | null;
|
|
145
|
-
cause?: Error;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Safely create a ServiceError from any caught error
|
|
149
|
-
*/
|
|
150
|
-
export declare function createServiceError(error: unknown, code?: string): ServiceError;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/types/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,eAAe,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,SAAS,CAAC;IACnB,GAAG,EAAE,KAAK,CAAC;IACX,YAAY,EAAE,QAAQ,CAAC;IACvB,UAAU,EAAE,YAAY,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,KAAK,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,UAAU,EAAE,YAAY,CAAC;IACzB,eAAe,EAAE,iBAAiB,CAAC;IACnC,OAAO,EAAE,SAAS,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC,MAAM,mBAAmB,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,mBAAmB,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAE3F;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,I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,CAAC,oBAAoB,CAAC,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;CAC7E;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY,CAC3B,UAAU,SAAS,QAAQ,GAAG,QAAQ,EACtC,SAAS,GAAG,OAAO,EACnB,UAAU,GAAG,OAAO,CACpB,SAAQ,OAAO;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAChD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,UAAU,SAAS,QAAQ,GAAG,QAAQ,EACtC,SAAS,GAAG,OAAO,EACnB,UAAU,GAAG,OAAO,EAEpB,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,eAAe,GAC3B,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACrE,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAkB,GAAG,YAAY,CAavF"}
|
package/dist/types/settings.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interface representing settings with string key-value pairs.
|
|
3
|
-
*/
|
|
4
|
-
export interface RuntimeSettings {
|
|
5
|
-
[key: string]: string | undefined;
|
|
6
|
-
}
|
|
7
|
-
export interface Setting {
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
usageDescription: string;
|
|
11
|
-
value: string | boolean | null;
|
|
12
|
-
required: boolean;
|
|
13
|
-
public?: boolean;
|
|
14
|
-
secret?: boolean;
|
|
15
|
-
validation?: (value: string | boolean | null) => boolean;
|
|
16
|
-
dependsOn?: string[];
|
|
17
|
-
onSetAction?: (value: string | boolean | null) => string;
|
|
18
|
-
visibleIf?: (settings: {
|
|
19
|
-
[key: string]: Setting;
|
|
20
|
-
}) => boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface WorldSettings {
|
|
23
|
-
[key: string]: Setting;
|
|
24
|
-
}
|
|
25
|
-
export interface OnboardingConfig {
|
|
26
|
-
settings: {
|
|
27
|
-
[key: string]: Omit<Setting, 'value'>;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC;IACzD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,KAAK,MAAM,CAAC;IACzD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC;CAC/D;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACvC,CAAC;CACH"}
|
package/dist/types/state.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ActionResult } from './components';
|
|
2
|
-
import type { Entity, Room, World } from './environment';
|
|
3
|
-
/** Single step in an action plan */
|
|
4
|
-
export interface ActionPlanStep {
|
|
5
|
-
action: string;
|
|
6
|
-
status: 'pending' | 'completed' | 'failed';
|
|
7
|
-
error?: string;
|
|
8
|
-
result?: ActionResult;
|
|
9
|
-
}
|
|
10
|
-
/** Multi-step action plan */
|
|
11
|
-
export interface ActionPlan {
|
|
12
|
-
thought: string;
|
|
13
|
-
totalSteps: number;
|
|
14
|
-
currentStep: number;
|
|
15
|
-
steps: ActionPlanStep[];
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Structured data cached in state by providers and actions.
|
|
19
|
-
* Common properties are typed for better DX while allowing dynamic extension.
|
|
20
|
-
*/
|
|
21
|
-
export interface StateData {
|
|
22
|
-
/** Cached room data from providers */
|
|
23
|
-
room?: Room;
|
|
24
|
-
/** Cached world data from providers */
|
|
25
|
-
world?: World;
|
|
26
|
-
/** Cached entity data from providers */
|
|
27
|
-
entity?: Entity;
|
|
28
|
-
/** Provider results cache keyed by provider name */
|
|
29
|
-
providers?: Record<string, Record<string, unknown>>;
|
|
30
|
-
/** Current action plan for multi-step actions */
|
|
31
|
-
actionPlan?: ActionPlan;
|
|
32
|
-
/** Results from previous action executions */
|
|
33
|
-
actionResults?: ActionResult[];
|
|
34
|
-
/** Allow additional dynamic properties */
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Represents the current state or context of a conversation or agent interaction.
|
|
39
|
-
* This interface is a flexible container for various pieces of information that define the agent's
|
|
40
|
-
* understanding at a point in time. It includes:
|
|
41
|
-
* - `values`: A key-value store for general state variables, often populated by providers.
|
|
42
|
-
* - `data`: Structured data cache with typed common properties for room, world, entity, etc.
|
|
43
|
-
* - `text`: A string representation of the current context, often a summary or concatenated history.
|
|
44
|
-
* The `[key: string]: unknown;` allows for dynamic properties to be added as needed.
|
|
45
|
-
* This state object is passed to handlers for actions, evaluators, and providers.
|
|
46
|
-
*/
|
|
47
|
-
export interface State {
|
|
48
|
-
/** Additional dynamic properties */
|
|
49
|
-
[key: string]: unknown;
|
|
50
|
-
values: {
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
};
|
|
53
|
-
/** Structured data cache with typed properties */
|
|
54
|
-
data: StateData;
|
|
55
|
-
text: string;
|
|
56
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/types/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEzD,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,6BAA6B;AAC7B,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,uCAAuC;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,iDAAiD;IACjD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,0CAA0C;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,KAAK;IACpB,oCAAoC;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,kDAAkD;IAClD,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Streaming type definitions.
|
|
3
|
-
*
|
|
4
|
-
* This module defines the interface contract for stream content extractors.
|
|
5
|
-
* Implementations are in utils/streaming.ts.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Interface for stream content extractors.
|
|
9
|
-
*
|
|
10
|
-
* Implementations decide HOW to filter LLM output for streaming.
|
|
11
|
-
* Could be XML parsing, JSON parsing, plain text passthrough, or custom logic.
|
|
12
|
-
*
|
|
13
|
-
* The framework doesn't care about format - that's implementation choice.
|
|
14
|
-
*
|
|
15
|
-
* Usage: Create a new instance for each stream. Don't reuse instances.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* // Simple passthrough - streams everything as-is
|
|
20
|
-
* const extractor = new PassthroughExtractor();
|
|
21
|
-
*
|
|
22
|
-
* // XML tag extraction - extracts content from <text> tag
|
|
23
|
-
* const extractor = new XmlTagExtractor('text');
|
|
24
|
-
*
|
|
25
|
-
* // Action-aware XML (DefaultMessageService)
|
|
26
|
-
* const extractor = new ResponseStreamExtractor();
|
|
27
|
-
*
|
|
28
|
-
* // Custom implementation
|
|
29
|
-
* class MyExtractor implements IStreamExtractor {
|
|
30
|
-
* private _done = false;
|
|
31
|
-
* get done() { return this._done; }
|
|
32
|
-
* push(chunk: string) { return this.myCustomLogic(chunk); }
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export interface IStreamExtractor {
|
|
37
|
-
/** Whether extraction is complete (no more content expected from this stream) */
|
|
38
|
-
readonly done: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Process a chunk from the LLM stream.
|
|
41
|
-
* @param chunk - Raw chunk from LLM
|
|
42
|
-
* @returns Text to stream to client (empty string = nothing to stream yet)
|
|
43
|
-
*/
|
|
44
|
-
push(chunk: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* Reset extractor state for retry or reuse.
|
|
47
|
-
* Clears buffer, resets done flag, and any internal state.
|
|
48
|
-
*/
|
|
49
|
-
reset(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Flush any buffered content that hasn't been returned yet.
|
|
52
|
-
* Called when stream ends unexpectedly to recover partial content.
|
|
53
|
-
* Optional - extractors that don't buffer can omit this.
|
|
54
|
-
* @returns Remaining buffered content (empty string if none)
|
|
55
|
-
*/
|
|
56
|
-
flush?(): string;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Tracks extractor state for intelligent retry decisions.
|
|
60
|
-
* Enables:
|
|
61
|
-
* - Skip retry when text extraction is complete (isComplete)
|
|
62
|
-
* - Continuation prompts when text is cut mid-stream
|
|
63
|
-
*/
|
|
64
|
-
export interface IStreamingRetryState {
|
|
65
|
-
/** Text that has been streamed to the user */
|
|
66
|
-
getStreamedText: () => string;
|
|
67
|
-
/** Whether the extractor found the closing tag (text is complete) */
|
|
68
|
-
isComplete: () => boolean;
|
|
69
|
-
/** Reset extractor for fresh streaming on continuation */
|
|
70
|
-
reset: () => void;
|
|
71
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../src/types/streaming.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5B;;;OAGG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;;OAKG;IACH,KAAK,CAAC,IAAI,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,eAAe,EAAE,MAAM,MAAM,CAAC;IAC9B,qEAAqE;IACrE,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,0DAA0D;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
|
package/dist/types/task.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { Memory } from './memory';
|
|
2
|
-
import type { UUID } from './primitives';
|
|
3
|
-
import type { IAgentRuntime } from './runtime';
|
|
4
|
-
import type { State } from './state';
|
|
5
|
-
/**
|
|
6
|
-
* Defines the contract for a Task Worker, which is responsible for executing a specific type of task.
|
|
7
|
-
* Task workers are registered with the `AgentRuntime` and are invoked when a `Task` of their designated `name` needs processing.
|
|
8
|
-
* This pattern allows for modular and extensible background task processing.
|
|
9
|
-
*/
|
|
10
|
-
export interface TaskWorker {
|
|
11
|
-
/** The unique name of the task type this worker handles. This name links `Task` instances to this worker. */
|
|
12
|
-
name: string;
|
|
13
|
-
/**
|
|
14
|
-
* The core execution logic for the task. This function is called by the runtime when a task needs to be processed.
|
|
15
|
-
* It receives the `AgentRuntime`, task-specific `options`, and the `Task` object itself.
|
|
16
|
-
*/
|
|
17
|
-
execute: (runtime: IAgentRuntime, options: {
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}, task: Task) => Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Optional validation function that can be used to determine if a task is valid or should be executed,
|
|
22
|
-
* often based on the current message and state. This might be used by an action or evaluator
|
|
23
|
-
* before creating or queueing a task.
|
|
24
|
-
*/
|
|
25
|
-
validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Defines metadata associated with a `Task`.
|
|
29
|
-
* This can include scheduling information like `updateInterval` or UI-related details
|
|
30
|
-
* for presenting task options to a user.
|
|
31
|
-
* The `[key: string]: unknown;` allows for additional, unspecified metadata fields.
|
|
32
|
-
*/
|
|
33
|
-
export type TaskMetadata = {
|
|
34
|
-
/** Optional. If the task is recurring, this specifies the interval in milliseconds between updates or executions. */
|
|
35
|
-
updateInterval?: number;
|
|
36
|
-
/** Optional. Describes options or parameters that can be configured for this task, often for UI presentation. */
|
|
37
|
-
options?: {
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
}[];
|
|
41
|
-
/** Allows for other dynamic metadata properties related to the task. */
|
|
42
|
-
[key: string]: unknown;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Represents a task to be performed, often in the background or at a later time.
|
|
46
|
-
* Tasks are managed by the `AgentRuntime` and processed by registered `TaskWorker`s.
|
|
47
|
-
* They can be associated with a room, world, and tagged for categorization and retrieval.
|
|
48
|
-
* The `IDatabaseAdapter` handles persistence of task data.
|
|
49
|
-
*/
|
|
50
|
-
export interface Task {
|
|
51
|
-
/** Optional. A Universally Unique Identifier for the task. Generated if not provided. */
|
|
52
|
-
id?: UUID;
|
|
53
|
-
/** The name of the task, which should correspond to a registered `TaskWorker.name`. */
|
|
54
|
-
name: string;
|
|
55
|
-
/** Optional. Timestamp of the last update to this task. */
|
|
56
|
-
updatedAt?: number;
|
|
57
|
-
/** Optional. Metadata associated with the task, conforming to `TaskMetadata`. */
|
|
58
|
-
metadata?: TaskMetadata;
|
|
59
|
-
/** A human-readable description of what the task does or its purpose. */
|
|
60
|
-
description: string;
|
|
61
|
-
/** Optional. The UUID of the room this task is associated with. */
|
|
62
|
-
roomId?: UUID;
|
|
63
|
-
/** Optional. The UUID of the world this task is associated with. */
|
|
64
|
-
worldId?: UUID;
|
|
65
|
-
entityId?: UUID;
|
|
66
|
-
tags: string[];
|
|
67
|
-
}
|
package/dist/types/task.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/types/task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,6GAA6G;IAC7G,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,EAAE,CACP,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,EACnC,IAAI,EAAE,IAAI,KACP,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACxF;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAA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