@elizaos/core 1.0.4 → 1.0.6

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.
Files changed (35) hide show
  1. package/dist/chunk-2HSL25IJ.js +40 -0
  2. package/dist/chunk-FEPOSPNK.js +157 -0
  3. package/dist/chunk-JX2SRFHQ.js +59 -0
  4. package/dist/chunk-SIAA4J6H.js +21 -0
  5. package/dist/{chunk-HRFT5KDK.js → chunk-TF6QLZZY.js} +180 -402
  6. package/dist/chunk-U2ADTLZY.js +50 -0
  7. package/dist/chunk-YIBXLDIR.js +42 -0
  8. package/dist/index-BHW44X0A.d.ts +112 -0
  9. package/dist/{index-DVKkCFlY.d.ts → index-S6eSMHDH.d.ts} +8 -9
  10. package/dist/index.d.ts +17 -9
  11. package/dist/index.js +7 -1
  12. package/dist/specs/v1/actionExample.d.ts +41 -0
  13. package/dist/specs/v1/actionExample.js +13 -0
  14. package/dist/specs/v1/index.d.ts +10 -4
  15. package/dist/specs/v1/index.js +30 -19
  16. package/dist/specs/v1/messages.d.ts +31 -0
  17. package/dist/specs/v1/messages.js +18 -0
  18. package/dist/specs/v1/posts.d.ts +10 -0
  19. package/dist/specs/v1/posts.js +12 -0
  20. package/dist/specs/v1/provider.d.ts +21 -0
  21. package/dist/specs/v1/provider.js +10 -0
  22. package/dist/specs/v1/runtime.d.ts +146 -0
  23. package/dist/specs/v1/runtime.js +12 -0
  24. package/dist/specs/v1/state.d.ts +21 -0
  25. package/dist/specs/v1/state.js +9 -0
  26. package/dist/specs/v1/templates.d.ts +42 -0
  27. package/dist/specs/v1/templates.js +11 -0
  28. package/dist/{index-Cy9ZgQIe.d.ts → specs/v1/types.d.ts} +137 -555
  29. package/dist/specs/v1/types.js +33 -0
  30. package/dist/specs/v1/uuid.d.ts +27 -0
  31. package/dist/specs/v1/uuid.js +14 -0
  32. package/dist/specs/v2/index.d.ts +2 -4
  33. package/dist/specs/v2/index.js +7 -1
  34. package/dist/{types-DzoA9aTJ.d.ts → types-D9v-eW3g.d.ts} +4 -7
  35. package/package.json +4 -4
@@ -0,0 +1,146 @@
1
+ import { IAgentRuntime, UUID, IDatabaseAdapter, Character, Action, Evaluator, Provider, Plugin, IMemoryManager, Service, ServiceType, ModelProviderName, ICacheManager, Adapter, Memory, State, HandlerCallback } from './types.js';
2
+ import 'stream';
3
+
4
+ declare class AgentRuntime implements IAgentRuntime {
5
+ private _runtime;
6
+ get agentId(): UUID;
7
+ get serverUrl(): string;
8
+ get databaseAdapter(): IDatabaseAdapter;
9
+ get token(): string;
10
+ get character(): Character;
11
+ get actions(): Action[];
12
+ get evaluators(): Evaluator[];
13
+ get providers(): Provider[];
14
+ get plugins(): Plugin[];
15
+ get modelProvider(): any;
16
+ get imageModelProvider(): any;
17
+ get imageVisionModelProvider(): any;
18
+ get messageManager(): any;
19
+ get routes(): any;
20
+ get services(): any;
21
+ get events(): any;
22
+ get descriptionManager(): any;
23
+ get documentsManager(): any;
24
+ get knowledgeManager(): any;
25
+ get ragKnowledgeManager(): any;
26
+ get loreManager(): any;
27
+ get cacheManager(): any;
28
+ get clients(): any;
29
+ registerMemoryManager(manager: IMemoryManager): void;
30
+ getMemoryManager(tableName: string): any;
31
+ getService<T extends Service>(service: ServiceType): T | null;
32
+ registerService(service: Service): Promise<void>;
33
+ /**
34
+ * Creates an instance of AgentRuntime.
35
+ * @param opts - The options for configuring the AgentRuntime.
36
+ * @param opts.conversationLength - The number of messages to hold in the recent message cache.
37
+ * @param opts.token - The JWT token, can be a JWT token if outside worker, or an OpenAI token if inside worker.
38
+ * @param opts.serverUrl - The URL of the worker.
39
+ * @param opts.actions - Optional custom actions.
40
+ * @param opts.evaluators - Optional custom evaluators.
41
+ * @param opts.services - Optional custom services.
42
+ * @param opts.memoryManagers - Optional custom memory managers.
43
+ * @param opts.providers - Optional context providers.
44
+ * @param opts.model - The model to use for generateText.
45
+ * @param opts.embeddingModel - The model to use for embedding.
46
+ * @param opts.agentId - Optional ID of the agent.
47
+ * @param opts.databaseAdapter - The database adapter used for interacting with the database.
48
+ * @param opts.fetch - Custom fetch function to use for making requests.
49
+ */
50
+ constructor(opts: {
51
+ conversationLength?: number;
52
+ agentId?: UUID;
53
+ character?: Character;
54
+ token: string;
55
+ serverUrl?: string;
56
+ actions?: Action[];
57
+ evaluators?: Evaluator[];
58
+ plugins?: Plugin[];
59
+ providers?: Provider[];
60
+ modelProvider: ModelProviderName;
61
+ services?: Service[];
62
+ managers?: IMemoryManager[];
63
+ databaseAdapter?: IDatabaseAdapter;
64
+ fetch?: typeof fetch | unknown;
65
+ speechModelPath?: string;
66
+ cacheManager?: ICacheManager;
67
+ logging?: boolean;
68
+ });
69
+ initialize(): Promise<any>;
70
+ stop(): Promise<any>;
71
+ getSetting(key: string): any;
72
+ /**
73
+ * Get the number of messages that are kept in the conversation buffer.
74
+ * @returns The number of recent messages to be kept in memory.
75
+ */
76
+ getConversationLength(): any;
77
+ /**
78
+ * Register an action for the agent to perform.
79
+ * @param action The action to register.
80
+ */
81
+ registerAction(action: Action): any;
82
+ /**
83
+ * Register an evaluator to assess and guide the agent's responses.
84
+ * @param evaluator The evaluator to register.
85
+ */
86
+ registerEvaluator(evaluator: Evaluator): any;
87
+ /**
88
+ * Register a context provider to provide context for message generation.
89
+ * @param provider The context provider to register.
90
+ */
91
+ registerContextProvider(provider: Provider): any;
92
+ /**
93
+ * Register an adapter for the agent to use.
94
+ * @param adapter The adapter to register.
95
+ */
96
+ registerAdapter(adapter: Adapter): void;
97
+ /**
98
+ * Process the actions of a message.
99
+ * @param message The message to process.
100
+ * @param content The content of the message to process actions from.
101
+ */
102
+ processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
103
+ /**
104
+ * Evaluate the message and state using the registered evaluators.
105
+ * @param message The message to evaluate.
106
+ * @param state The state of the agent.
107
+ * @param didRespond Whether the agent responded to the message.~
108
+ * @param callback The handler callback
109
+ * @returns The results of the evaluation.
110
+ */
111
+ evaluate(message: Memory, state: State, didRespond?: boolean, callback?: HandlerCallback): Promise<any>;
112
+ /**
113
+ * Ensure the existence of a participant in the room. If the participant does not exist, they are added to the room.
114
+ * @param userId - The user ID to ensure the existence of.
115
+ * @throws An error if the participant cannot be added.
116
+ */
117
+ ensureParticipantExists(userId: UUID, roomId: UUID): Promise<void>;
118
+ /**
119
+ * Ensure the existence of a user in the database. If the user does not exist, they are added to the database.
120
+ * @param userId - The user ID to ensure the existence of.
121
+ * @param userName - The user name to ensure the existence of.
122
+ * @returns
123
+ */
124
+ ensureUserExists(userId: UUID, userName: string | null, name: string | null, email?: string | null, source?: string | null): Promise<void>;
125
+ ensureParticipantInRoom(userId: UUID, roomId: UUID): Promise<any>;
126
+ ensureConnection(userId: UUID, roomId: UUID, userName?: string, userScreenName?: string, source?: string): Promise<any>;
127
+ /**
128
+ * Ensure the existence of a room between the agent and a user. If no room exists, a new room is created and the user
129
+ * and agent are added as participants. The room ID is returned.
130
+ * @param roomId - The room ID to create a room with.
131
+ * @returns The room ID of the room between the agent and the user.
132
+ * @throws An error if the room cannot be created.
133
+ */
134
+ ensureRoomExists(roomId: UUID): Promise<any>;
135
+ /**
136
+ * Compose the state of the agent into an object that can be passed or used for response generation.
137
+ * @param message The message to compose the state from.
138
+ * @returns The state of the agent.
139
+ */
140
+ composeState(message: Memory, additionalKeys?: {
141
+ [key: string]: unknown;
142
+ }): Promise<any>;
143
+ updateRecentMessageState(state: State): Promise<State>;
144
+ }
145
+
146
+ export { AgentRuntime };
@@ -0,0 +1,12 @@
1
+ import {
2
+ AgentRuntime3 as AgentRuntime
3
+ } from "../../chunk-TF6QLZZY.js";
4
+ import "../../chunk-2HSL25IJ.js";
5
+ import "../../chunk-FEPOSPNK.js";
6
+ import "../../chunk-U2ADTLZY.js";
7
+ import "../../chunk-JX2SRFHQ.js";
8
+ import "../../chunk-YIBXLDIR.js";
9
+ import "../../chunk-SIAA4J6H.js";
10
+ export {
11
+ AgentRuntime
12
+ };
@@ -0,0 +1,21 @@
1
+ import { S as State$1 } from '../../types-D9v-eW3g.js';
2
+ import { State as State$2 } from './types.js';
3
+ import 'stream';
4
+
5
+ /**
6
+ * Represents the state of a conversation or context
7
+ * This is a v1 compatibility wrapper for v2 State
8
+ */
9
+ type State = State$2;
10
+ /**
11
+ * Converts v2 State to v1 compatible State
12
+ * Uses the V2 State interface from core-plugin-v2
13
+ */
14
+ declare function fromV2State(stateV2: State$1): State;
15
+ /**
16
+ * Converts v1 State to v2 State
17
+ * Creates a state object conforming to V2 State interface
18
+ */
19
+ declare function toV2State(state: State): State$1;
20
+
21
+ export { type State, fromV2State, toV2State };
@@ -0,0 +1,9 @@
1
+ import {
2
+ fromV2State,
3
+ toV2State
4
+ } from "../../chunk-YIBXLDIR.js";
5
+ import "../../chunk-SIAA4J6H.js";
6
+ export {
7
+ fromV2State,
8
+ toV2State
9
+ };
@@ -0,0 +1,42 @@
1
+ import { State } from './state.js';
2
+ import '../../types-D9v-eW3g.js';
3
+ import './types.js';
4
+ import 'stream';
5
+
6
+ /**
7
+ * Template type definition for v1 compatibility
8
+ * A template can be either a string or a function that takes state and returns a string
9
+ * This aligns with V2's TemplateType
10
+ */
11
+ type TemplateType = string | ((options: {
12
+ state: State;
13
+ }) => string);
14
+ /**
15
+ * Generic template values interface for typed access to state.values
16
+ * Users can extend this interface for type safety in their templates
17
+ */
18
+ interface TemplateValues {
19
+ [key: string]: unknown;
20
+ }
21
+ /**
22
+ * Create a template function from a v1 template
23
+ * @param template The v1 template (string or function)
24
+ * @returns A function that processes the template with the given state
25
+ */
26
+ declare function createTemplateFunction(template: TemplateType): (state: State) => string;
27
+ /**
28
+ * Process a template with the given state
29
+ * @param template The template to process (string or function)
30
+ * @param state The state to use for processing
31
+ * @returns The processed template string
32
+ */
33
+ declare function processTemplate(template: TemplateType, state: State): string;
34
+ /**
35
+ * Type-safe accessor for template values
36
+ * @param state The state containing the values
37
+ * @param defaultValues Optional default values to use if values are missing
38
+ * @returns The values object with type information
39
+ */
40
+ declare function getTemplateValues<T extends TemplateValues>(state: State, defaultValues?: Partial<T>): T;
41
+
42
+ export { type TemplateType, type TemplateValues, createTemplateFunction, getTemplateValues, processTemplate };
@@ -0,0 +1,11 @@
1
+ import {
2
+ createTemplateFunction,
3
+ getTemplateValues,
4
+ processTemplate
5
+ } from "../../chunk-2HSL25IJ.js";
6
+ import "../../chunk-SIAA4J6H.js";
7
+ export {
8
+ createTemplateFunction,
9
+ getTemplateValues,
10
+ processTemplate
11
+ };