@elizaos/api-client 1.4.5 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/api-client/src/client.d.ts +25 -0
  2. package/dist/api-client/src/client.d.ts.map +1 -0
  3. package/dist/api-client/src/index.d.ts +20 -0
  4. package/dist/api-client/src/index.d.ts.map +1 -0
  5. package/dist/api-client/src/lib/base-client.d.ts +31 -0
  6. package/dist/api-client/src/lib/base-client.d.ts.map +1 -0
  7. package/dist/api-client/src/services/agents.d.ts +107 -0
  8. package/dist/api-client/src/services/agents.d.ts.map +1 -0
  9. package/dist/api-client/src/services/audio.d.ts +48 -0
  10. package/dist/api-client/src/services/audio.d.ts.map +1 -0
  11. package/dist/api-client/src/services/media.d.ts +14 -0
  12. package/dist/api-client/src/services/media.d.ts.map +1 -0
  13. package/dist/api-client/src/services/memory.d.ts +107 -0
  14. package/dist/api-client/src/services/memory.d.ts.map +1 -0
  15. package/dist/api-client/src/services/messaging.d.ts +164 -0
  16. package/dist/api-client/src/services/messaging.d.ts.map +1 -0
  17. package/dist/api-client/src/services/server.d.ts +47 -0
  18. package/dist/api-client/src/services/server.d.ts.map +1 -0
  19. package/dist/api-client/src/services/sessions.d.ts +52 -0
  20. package/dist/api-client/src/services/sessions.d.ts.map +1 -0
  21. package/dist/api-client/src/services/system.d.ts +56 -0
  22. package/dist/api-client/src/services/system.d.ts.map +1 -0
  23. package/dist/api-client/src/types/agents.d.ts +67 -0
  24. package/dist/api-client/src/types/agents.d.ts.map +1 -0
  25. package/dist/api-client/src/types/audio.d.ts +42 -0
  26. package/dist/api-client/src/types/audio.d.ts.map +1 -0
  27. package/dist/api-client/src/types/base.d.ts +30 -0
  28. package/dist/api-client/src/types/base.d.ts.map +1 -0
  29. package/dist/api-client/src/types/media.d.ts +21 -0
  30. package/dist/api-client/src/types/media.d.ts.map +1 -0
  31. package/dist/api-client/src/types/memory.d.ts +43 -0
  32. package/dist/api-client/src/types/memory.d.ts.map +1 -0
  33. package/dist/api-client/src/types/messaging.d.ts +186 -0
  34. package/dist/api-client/src/types/messaging.d.ts.map +1 -0
  35. package/dist/api-client/src/types/server.d.ts +44 -0
  36. package/dist/api-client/src/types/server.d.ts.map +1 -0
  37. package/dist/api-client/src/types/sessions.d.ts +134 -0
  38. package/dist/api-client/src/types/sessions.d.ts.map +1 -0
  39. package/dist/api-client/src/types/system.d.ts +16 -0
  40. package/dist/api-client/src/types/system.d.ts.map +1 -0
  41. package/dist/core/src/actions.d.ts +23 -0
  42. package/dist/core/src/actions.d.ts.map +1 -0
  43. package/dist/core/src/database.d.ts +481 -0
  44. package/dist/core/src/database.d.ts.map +1 -0
  45. package/dist/core/src/entities.d.ts +49 -0
  46. package/dist/core/src/entities.d.ts.map +1 -0
  47. package/dist/core/src/index.d.ts +27 -0
  48. package/dist/core/src/index.d.ts.map +1 -0
  49. package/dist/core/src/logger.d.ts +46 -0
  50. package/dist/core/src/logger.d.ts.map +1 -0
  51. package/dist/core/src/prompts.d.ts +8 -0
  52. package/dist/core/src/prompts.d.ts.map +1 -0
  53. package/dist/core/src/roles.d.ts +30 -0
  54. package/dist/core/src/roles.d.ts.map +1 -0
  55. package/dist/core/src/runtime.d.ts +328 -0
  56. package/dist/core/src/runtime.d.ts.map +1 -0
  57. package/dist/core/src/schemas/character.d.ts +228 -0
  58. package/dist/core/src/schemas/character.d.ts.map +1 -0
  59. package/dist/core/src/search.d.ts +317 -0
  60. package/dist/core/src/search.d.ts.map +1 -0
  61. package/dist/core/src/sentry/instrument.d.ts +12 -0
  62. package/dist/core/src/sentry/instrument.d.ts.map +1 -0
  63. package/dist/core/src/services.d.ts +49 -0
  64. package/dist/core/src/services.d.ts.map +1 -0
  65. package/dist/core/src/settings.d.ts +87 -0
  66. package/dist/core/src/settings.d.ts.map +1 -0
  67. package/dist/core/src/types/agent.d.ts +98 -0
  68. package/dist/core/src/types/agent.d.ts.map +1 -0
  69. package/dist/core/src/types/browser.d.ts +127 -0
  70. package/dist/core/src/types/browser.d.ts.map +1 -0
  71. package/dist/core/src/types/components.d.ts +135 -0
  72. package/dist/core/src/types/components.d.ts.map +1 -0
  73. package/dist/core/src/types/database.d.ts +278 -0
  74. package/dist/core/src/types/database.d.ts.map +1 -0
  75. package/dist/core/src/types/email.d.ts +143 -0
  76. package/dist/core/src/types/email.d.ts.map +1 -0
  77. package/dist/core/src/types/environment.d.ts +109 -0
  78. package/dist/core/src/types/environment.d.ts.map +1 -0
  79. package/dist/core/src/types/events.d.ts +208 -0
  80. package/dist/core/src/types/events.d.ts.map +1 -0
  81. package/dist/core/src/types/index.d.ts +30 -0
  82. package/dist/core/src/types/index.d.ts.map +1 -0
  83. package/dist/core/src/types/knowledge.d.ts +60 -0
  84. package/dist/core/src/types/knowledge.d.ts.map +1 -0
  85. package/dist/core/src/types/lp.d.ts +115 -0
  86. package/dist/core/src/types/lp.d.ts.map +1 -0
  87. package/dist/core/src/types/memory.d.ts +165 -0
  88. package/dist/core/src/types/memory.d.ts.map +1 -0
  89. package/dist/core/src/types/message.d.ts +202 -0
  90. package/dist/core/src/types/message.d.ts.map +1 -0
  91. package/dist/core/src/types/messaging.d.ts +45 -0
  92. package/dist/core/src/types/messaging.d.ts.map +1 -0
  93. package/dist/core/src/types/model.d.ts +319 -0
  94. package/dist/core/src/types/model.d.ts.map +1 -0
  95. package/dist/core/src/types/pdf.d.ts +68 -0
  96. package/dist/core/src/types/pdf.d.ts.map +1 -0
  97. package/dist/core/src/types/plugin.d.ts +64 -0
  98. package/dist/core/src/types/plugin.d.ts.map +1 -0
  99. package/dist/core/src/types/post.d.ts +242 -0
  100. package/dist/core/src/types/post.d.ts.map +1 -0
  101. package/dist/core/src/types/primitives.d.ts +72 -0
  102. package/dist/core/src/types/primitives.d.ts.map +1 -0
  103. package/dist/core/src/types/runtime.d.ts +106 -0
  104. package/dist/core/src/types/runtime.d.ts.map +1 -0
  105. package/dist/core/src/types/service.d.ts +147 -0
  106. package/dist/core/src/types/service.d.ts.map +1 -0
  107. package/dist/core/src/types/settings.d.ts +30 -0
  108. package/dist/core/src/types/settings.d.ts.map +1 -0
  109. package/dist/core/src/types/state.d.ts +59 -0
  110. package/dist/core/src/types/state.d.ts.map +1 -0
  111. package/dist/core/src/types/task.d.ts +68 -0
  112. package/dist/core/src/types/task.d.ts.map +1 -0
  113. package/dist/core/src/types/tee.d.ts +97 -0
  114. package/dist/core/src/types/tee.d.ts.map +1 -0
  115. package/dist/core/src/types/testing.d.ts +29 -0
  116. package/dist/core/src/types/testing.d.ts.map +1 -0
  117. package/dist/core/src/types/token.d.ts +73 -0
  118. package/dist/core/src/types/token.d.ts.map +1 -0
  119. package/dist/core/src/types/transcription.d.ts +108 -0
  120. package/dist/core/src/types/transcription.d.ts.map +1 -0
  121. package/dist/core/src/types/video.d.ts +93 -0
  122. package/dist/core/src/types/video.d.ts.map +1 -0
  123. package/dist/core/src/types/wallet.d.ts +49 -0
  124. package/dist/core/src/types/wallet.d.ts.map +1 -0
  125. package/dist/core/src/types/web-search.d.ts +112 -0
  126. package/dist/core/src/types/web-search.d.ts.map +1 -0
  127. package/dist/core/src/utils/buffer.d.ts +105 -0
  128. package/dist/core/src/utils/buffer.d.ts.map +1 -0
  129. package/dist/core/src/utils/environment.d.ts +106 -0
  130. package/dist/core/src/utils/environment.d.ts.map +1 -0
  131. package/dist/core/src/utils/server-health.d.ts +23 -0
  132. package/dist/core/src/utils/server-health.d.ts.map +1 -0
  133. package/dist/core/src/utils.d.ts +177 -0
  134. package/dist/core/src/utils.d.ts.map +1 -0
  135. package/dist/index.d.ts +1 -1102
  136. package/dist/index.js +144 -449
  137. package/dist/index.js.map +19 -1
  138. package/dist/tsconfig.build.tsbuildinfo +1 -0
  139. package/package.json +5 -6
@@ -0,0 +1,208 @@
1
+ import type { HandlerCallback } from './components';
2
+ import type { Entity, Room, World } from './environment';
3
+ import type { Memory } from './memory';
4
+ import type { ModelTypeName } from './model';
5
+ import type { Metadata, UUID } from './primitives';
6
+ import type { IAgentRuntime } from './runtime';
7
+ /**
8
+ * Standard event types across all platforms
9
+ */
10
+ export declare enum EventType {
11
+ WORLD_JOINED = "WORLD_JOINED",
12
+ WORLD_CONNECTED = "WORLD_CONNECTED",
13
+ WORLD_LEFT = "WORLD_LEFT",
14
+ ENTITY_JOINED = "ENTITY_JOINED",
15
+ ENTITY_LEFT = "ENTITY_LEFT",
16
+ ENTITY_UPDATED = "ENTITY_UPDATED",
17
+ ROOM_JOINED = "ROOM_JOINED",
18
+ ROOM_LEFT = "ROOM_LEFT",
19
+ MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
20
+ MESSAGE_SENT = "MESSAGE_SENT",
21
+ MESSAGE_DELETED = "MESSAGE_DELETED",
22
+ CHANNEL_CLEARED = "CHANNEL_CLEARED",
23
+ VOICE_MESSAGE_RECEIVED = "VOICE_MESSAGE_RECEIVED",
24
+ VOICE_MESSAGE_SENT = "VOICE_MESSAGE_SENT",
25
+ REACTION_RECEIVED = "REACTION_RECEIVED",
26
+ POST_GENERATED = "POST_GENERATED",
27
+ INTERACTION_RECEIVED = "INTERACTION_RECEIVED",
28
+ RUN_STARTED = "RUN_STARTED",
29
+ RUN_ENDED = "RUN_ENDED",
30
+ RUN_TIMEOUT = "RUN_TIMEOUT",
31
+ ACTION_STARTED = "ACTION_STARTED",
32
+ ACTION_COMPLETED = "ACTION_COMPLETED",
33
+ EVALUATOR_STARTED = "EVALUATOR_STARTED",
34
+ EVALUATOR_COMPLETED = "EVALUATOR_COMPLETED",
35
+ MODEL_USED = "MODEL_USED",
36
+ EMBEDDING_GENERATION_REQUESTED = "EMBEDDING_GENERATION_REQUESTED",
37
+ EMBEDDING_GENERATION_COMPLETED = "EMBEDDING_GENERATION_COMPLETED",
38
+ EMBEDDING_GENERATION_FAILED = "EMBEDDING_GENERATION_FAILED"
39
+ }
40
+ /**
41
+ * Platform-specific event type prefix
42
+ */
43
+ export declare enum PlatformPrefix {
44
+ DISCORD = "DISCORD",
45
+ TELEGRAM = "TELEGRAM",
46
+ TWITTER = "TWITTER"
47
+ }
48
+ /**
49
+ * Base payload interface for all events
50
+ */
51
+ export interface EventPayload {
52
+ runtime: IAgentRuntime;
53
+ source: string;
54
+ onComplete?: () => void;
55
+ }
56
+ /**
57
+ * Payload for world-related events
58
+ */
59
+ export interface WorldPayload extends EventPayload {
60
+ world: World;
61
+ rooms: Room[];
62
+ entities: Entity[];
63
+ }
64
+ /**
65
+ * Payload for entity-related events
66
+ */
67
+ export interface EntityPayload extends EventPayload {
68
+ entityId: UUID;
69
+ worldId?: UUID;
70
+ roomId?: UUID;
71
+ metadata?: {
72
+ orginalId: string;
73
+ username: string;
74
+ displayName?: string;
75
+ [key: string]: any;
76
+ };
77
+ }
78
+ /**
79
+ * Payload for reaction-related events
80
+ */
81
+ export interface MessagePayload extends EventPayload {
82
+ message: Memory;
83
+ callback?: HandlerCallback;
84
+ onComplete?: () => void;
85
+ }
86
+ /**
87
+ * Payload for channel cleared events
88
+ */
89
+ export interface ChannelClearedPayload extends EventPayload {
90
+ roomId: UUID;
91
+ channelId: string;
92
+ memoryCount: number;
93
+ }
94
+ /**
95
+ * Payload for events that are invoked without a message
96
+ */
97
+ export interface InvokePayload extends EventPayload {
98
+ worldId: UUID;
99
+ userId: string;
100
+ roomId: UUID;
101
+ callback?: HandlerCallback;
102
+ source: string;
103
+ }
104
+ /**
105
+ * Run event payload type
106
+ */
107
+ export interface RunEventPayload extends EventPayload {
108
+ runId: UUID;
109
+ messageId: UUID;
110
+ roomId: UUID;
111
+ entityId: UUID;
112
+ startTime: number;
113
+ status: 'started' | 'completed' | 'timeout';
114
+ endTime?: number;
115
+ duration?: number;
116
+ error?: string;
117
+ }
118
+ /**
119
+ * Action event payload type
120
+ */
121
+ export interface ActionEventPayload extends EventPayload {
122
+ actionId: UUID;
123
+ actionName: string;
124
+ startTime?: number;
125
+ completed?: boolean;
126
+ error?: Error;
127
+ }
128
+ /**
129
+ * Evaluator event payload type
130
+ */
131
+ export interface EvaluatorEventPayload extends EventPayload {
132
+ evaluatorId: UUID;
133
+ evaluatorName: string;
134
+ startTime?: number;
135
+ completed?: boolean;
136
+ error?: Error;
137
+ }
138
+ /**
139
+ * Model event payload type
140
+ */
141
+ export interface ModelEventPayload extends EventPayload {
142
+ provider: string;
143
+ type: ModelTypeName;
144
+ prompt: string;
145
+ tokens?: {
146
+ prompt: number;
147
+ completion: number;
148
+ total: number;
149
+ };
150
+ }
151
+ /**
152
+ * Payload for embedding generation events
153
+ */
154
+ export interface EmbeddingGenerationPayload extends EventPayload {
155
+ memory: Memory;
156
+ priority?: 'high' | 'normal' | 'low';
157
+ retryCount?: number;
158
+ maxRetries?: number;
159
+ embedding?: number[];
160
+ error?: any;
161
+ }
162
+ export type MessageReceivedHandlerParams = {
163
+ runtime: IAgentRuntime;
164
+ message: Memory;
165
+ callback: HandlerCallback;
166
+ onComplete?: () => void;
167
+ };
168
+ /**
169
+ * Maps event types to their corresponding payload types
170
+ */
171
+ export interface EventPayloadMap {
172
+ [EventType.WORLD_JOINED]: WorldPayload;
173
+ [EventType.WORLD_CONNECTED]: WorldPayload;
174
+ [EventType.WORLD_LEFT]: WorldPayload;
175
+ [EventType.ENTITY_JOINED]: EntityPayload;
176
+ [EventType.ENTITY_LEFT]: EntityPayload;
177
+ [EventType.ENTITY_UPDATED]: EntityPayload;
178
+ [EventType.MESSAGE_RECEIVED]: MessagePayload;
179
+ [EventType.MESSAGE_SENT]: MessagePayload;
180
+ [EventType.MESSAGE_DELETED]: MessagePayload;
181
+ [EventType.CHANNEL_CLEARED]: ChannelClearedPayload;
182
+ [EventType.REACTION_RECEIVED]: MessagePayload;
183
+ [EventType.POST_GENERATED]: InvokePayload;
184
+ [EventType.INTERACTION_RECEIVED]: MessagePayload;
185
+ [EventType.RUN_STARTED]: RunEventPayload;
186
+ [EventType.RUN_ENDED]: RunEventPayload;
187
+ [EventType.RUN_TIMEOUT]: RunEventPayload;
188
+ [EventType.ACTION_STARTED]: ActionEventPayload;
189
+ [EventType.ACTION_COMPLETED]: ActionEventPayload;
190
+ [EventType.EVALUATOR_STARTED]: EvaluatorEventPayload;
191
+ [EventType.EVALUATOR_COMPLETED]: EvaluatorEventPayload;
192
+ [EventType.MODEL_USED]: ModelEventPayload;
193
+ [EventType.EMBEDDING_GENERATION_REQUESTED]: EmbeddingGenerationPayload;
194
+ [EventType.EMBEDDING_GENERATION_COMPLETED]: EmbeddingGenerationPayload;
195
+ [EventType.EMBEDDING_GENERATION_FAILED]: EmbeddingGenerationPayload;
196
+ }
197
+ /**
198
+ * Event handler function type
199
+ */
200
+ export type EventHandler<T extends keyof EventPayloadMap> = (payload: EventPayloadMap[T]) => Promise<void>;
201
+ /**
202
+ * Defines a more specific type for event handlers, expecting an `Metadata`.
203
+ * This aims to improve upon generic 'any' type handlers, providing a clearer contract
204
+ * for functions that respond to events emitted within the agent runtime (see `emitEvent` in `AgentRuntime`).
205
+ * Handlers can be synchronous or asynchronous.
206
+ */
207
+ export type TypedEventHandler = (data: Metadata) => Promise<void> | void;
208
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,UAAU,eAAe;IAGzB,aAA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AAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
@@ -0,0 +1,30 @@
1
+ export * from './primitives';
2
+ export * from './state';
3
+ export * from './memory';
4
+ export * from './knowledge';
5
+ export * from './environment';
6
+ export * from './agent';
7
+ export * from './components';
8
+ export * from './plugin';
9
+ export * from './service';
10
+ export * from './model';
11
+ export * from './database';
12
+ export * from './events';
13
+ export * from './task';
14
+ export * from './tee';
15
+ export * from './runtime';
16
+ export * from './token';
17
+ export * from './messaging';
18
+ export * from './testing';
19
+ export * from './settings';
20
+ export * from './wallet';
21
+ export * from './lp';
22
+ export * from './pdf';
23
+ export * from './video';
24
+ export * from './browser';
25
+ export * from './transcription';
26
+ export * from './web-search';
27
+ export * from './email';
28
+ export * from './message';
29
+ export * from './post';
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { MemoryMetadata } from './memory';
2
+ import type { Content, UUID } from './primitives';
3
+ /**
4
+ * Represents a single item of knowledge that can be processed and stored by the agent.
5
+ * Knowledge items consist of content (text and optional structured data) and metadata.
6
+ * These items are typically added to the agent's knowledge base via `AgentRuntime.addKnowledge`
7
+ * and retrieved using `AgentRuntime.getKnowledge`.
8
+ * The `id` is a unique identifier for the knowledge item, often derived from its source or content.
9
+ */
10
+ export type KnowledgeItem = {
11
+ /** A Universally Unique Identifier for this specific knowledge item. */
12
+ id: UUID;
13
+ /** The actual content of the knowledge item, which must include text and can have other fields. */
14
+ content: Content;
15
+ /** Optional metadata associated with this knowledge item, conforming to `MemoryMetadata`. */
16
+ metadata?: MemoryMetadata;
17
+ };
18
+ /**
19
+ * Defines the scope or visibility of knowledge items within the agent's system.
20
+ * - `SHARED`: Indicates knowledge that is broadly accessible, potentially across different agents or users if the system architecture permits.
21
+ * - `PRIVATE`: Indicates knowledge that is restricted, typically to the specific agent or user context it belongs to.
22
+ * This enum is used to manage access and retrieval of knowledge items, often in conjunction with `AgentRuntime.addKnowledge` or `AgentRuntime.getKnowledge` scopes.
23
+ */
24
+ export declare enum KnowledgeScope {
25
+ SHARED = "shared",
26
+ PRIVATE = "private"
27
+ }
28
+ /**
29
+ * Specifies prefixes for keys used in caching mechanisms, helping to namespace cached data.
30
+ * For example, `KNOWLEDGE` might be used to prefix keys for cached knowledge embeddings or processed documents.
31
+ * This helps in organizing the cache and avoiding key collisions.
32
+ * Used internally by caching strategies, potentially within `IDatabaseAdapter` cache methods or runtime caching layers.
33
+ */
34
+ export declare enum CacheKeyPrefix {
35
+ KNOWLEDGE = "knowledge"
36
+ }
37
+ /**
38
+ * Represents an item within a directory listing, specifically for knowledge loading.
39
+ * When an agent's `Character.knowledge` configuration includes a directory, this type
40
+ * is used to specify the path to that directory and whether its contents should be treated as shared.
41
+ * - `directory`: The path to the directory containing knowledge files.
42
+ * - `shared`: An optional boolean (defaults to false) indicating if the knowledge from this directory is considered shared or private.
43
+ */
44
+ export interface DirectoryItem {
45
+ /** The path to the directory containing knowledge files. */
46
+ directory: string;
47
+ /** If true, knowledge from this directory is considered shared; otherwise, it's private. Defaults to false. */
48
+ shared?: boolean;
49
+ }
50
+ /**
51
+ * Represents a row structure, typically from a database query related to text chunking or processing.
52
+ * This interface is quite minimal and seems to be a placeholder or a base for more specific chunk-related types.
53
+ * The `id` would be the unique identifier for the chunk.
54
+ * It might be used when splitting large documents into smaller, manageable pieces for embedding or analysis.
55
+ */
56
+ export interface ChunkRow {
57
+ /** The unique identifier for this chunk of text. */
58
+ id: string;
59
+ }
60
+ //# sourceMappingURL=knowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,wEAAwE;IACxE,EAAE,EAAE,IAAI,CAAC;IACT,mGAAmG;IACnG,OAAO,EAAE,OAAO,CAAC;IACjB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,oBAAY,cAAc;IACxB,SAAS,cAAc;CACxB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,+GAA+G;IAC/G,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;CAEZ"}
@@ -0,0 +1,115 @@
1
+ import type { Metadata } from './primitives';
2
+ import { Service } from './service';
3
+ import type { TokenBalance } from './token';
4
+ /**
5
+ * A standardized representation of a liquidity pool from any DEX.
6
+ */
7
+ export type PoolInfo = {
8
+ id: string;
9
+ displayName?: string;
10
+ dex: string;
11
+ tokenA: {
12
+ mint: string;
13
+ symbol?: string;
14
+ reserve?: string;
15
+ decimals?: number;
16
+ };
17
+ tokenB: {
18
+ mint: string;
19
+ symbol?: string;
20
+ reserve?: string;
21
+ decimals?: number;
22
+ };
23
+ lpTokenMint?: string;
24
+ apr?: number;
25
+ apy?: number;
26
+ tvl?: number;
27
+ fee?: number;
28
+ metadata?: Metadata;
29
+ };
30
+ /**
31
+ * A standardized representation of a user's position in a liquidity pool.
32
+ */
33
+ export type LpPositionDetails = {
34
+ poolId: string;
35
+ dex: string;
36
+ lpTokenBalance: TokenBalance;
37
+ underlyingTokens: TokenBalance[];
38
+ valueUsd?: number;
39
+ accruedFees?: TokenBalance[];
40
+ rewards?: TokenBalance[];
41
+ metadata?: Metadata;
42
+ };
43
+ /**
44
+ * A standardized result for blockchain transactions.
45
+ */
46
+ export type TransactionResult = {
47
+ success: boolean;
48
+ transactionId?: string;
49
+ error?: string;
50
+ data?: any;
51
+ };
52
+ /**
53
+ * Abstract interface for a Liquidity Pool Service.
54
+ * DEX-specific plugins (e.g., for Orca, Raydium) must implement this service
55
+ * to allow the LP Manager to interact with them in a standardized way.
56
+ */
57
+ export declare abstract class ILpService extends Service {
58
+ static readonly serviceType = "lp";
59
+ readonly capabilityDescription = "Provides standardized access to DEX liquidity pools.";
60
+ /**
61
+ * Returns the name of the DEX this service interacts with.
62
+ * @returns The name of the DEX (e.g., "Orca", "Raydium").
63
+ */
64
+ abstract getDexName(): string;
65
+ /**
66
+ * Fetches a list of available liquidity pools from the DEX.
67
+ * @param tokenAMint - Optional: Filter pools by the mint address of the first token.
68
+ * @param tokenBMint - Optional: Filter pools by the mint address of the second token.
69
+ * @returns A promise that resolves to an array of standardized PoolInfo objects.
70
+ */
71
+ abstract getPools(tokenAMint?: string, tokenBMint?: string): Promise<PoolInfo[]>;
72
+ /**
73
+ * Adds liquidity to a specified pool.
74
+ * @param params - The parameters for adding liquidity.
75
+ * @returns A promise resolving to a transaction result, including the LP tokens received.
76
+ */
77
+ abstract addLiquidity(params: {
78
+ userVault: any;
79
+ poolId: string;
80
+ tokenAAmountLamports: string;
81
+ tokenBAmountLamports?: string;
82
+ slippageBps: number;
83
+ tickLowerIndex?: number;
84
+ tickUpperIndex?: number;
85
+ }): Promise<TransactionResult & {
86
+ lpTokensReceived?: TokenBalance;
87
+ }>;
88
+ /**
89
+ * Removes liquidity from a specified pool.
90
+ * @param params - The parameters for removing liquidity.
91
+ * @returns A promise resolving to a transaction result, including the tokens received.
92
+ */
93
+ abstract removeLiquidity(params: {
94
+ userVault: any;
95
+ poolId: string;
96
+ lpTokenAmountLamports: string;
97
+ slippageBps: number;
98
+ }): Promise<TransactionResult & {
99
+ tokensReceived?: TokenBalance[];
100
+ }>;
101
+ /**
102
+ * Fetches the details of a specific LP position for a user.
103
+ * @param userAccountPublicKey - The user's wallet public key.
104
+ * @param poolOrPositionIdentifier - The identifier for the pool or a specific position (e.g., position NFT mint).
105
+ * @returns A promise resolving to the position details or null if not found.
106
+ */
107
+ abstract getLpPositionDetails(userAccountPublicKey: string, poolOrPositionIdentifier: string): Promise<LpPositionDetails | null>;
108
+ /**
109
+ * Fetches the latest market data (e.g., APY, TVL) for a list of pools.
110
+ * @param poolIds - An array of pool IDs to fetch data for.
111
+ * @returns A promise resolving to a map of pool IDs to their partial market data.
112
+ */
113
+ abstract getMarketDataForPools(poolIds: string[]): Promise<Record<string, Partial<PoolInfo>>>;
114
+ }
115
+ //# sourceMappingURL=lp.d.ts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;;OAKG;IACH,QAAQ,CAAC,oBAAoB,CAC3B,oBAAoB,EAAE,MAAM,EAC5B,wBAAwB,EAAE,MAAM,GAC/B,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAEpC;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC9F"}
@@ -0,0 +1,165 @@
1
+ import type { Content, UUID } from './primitives';
2
+ /**
3
+ * Memory type enumeration for built-in memory types
4
+ */
5
+ export type MemoryTypeAlias = string;
6
+ /**
7
+ * Enumerates the built-in types of memories that can be stored and retrieved.
8
+ * - `DOCUMENT`: Represents a whole document or a large piece of text.
9
+ * - `FRAGMENT`: A chunk or segment of a `DOCUMENT`, often created for embedding and search.
10
+ * - `MESSAGE`: A conversational message, typically from a user or the agent.
11
+ * - `DESCRIPTION`: A descriptive piece of information, perhaps about an entity or concept.
12
+ * - `CUSTOM`: For any other type of memory not covered by the built-in types.
13
+ * This enum is used in `MemoryMetadata` to categorize memories and influences how they are processed or queried.
14
+ */
15
+ export declare enum MemoryType {
16
+ DOCUMENT = "document",
17
+ FRAGMENT = "fragment",
18
+ MESSAGE = "message",
19
+ DESCRIPTION = "description",
20
+ CUSTOM = "custom"
21
+ }
22
+ /**
23
+ * Defines the scope of a memory, indicating its visibility and accessibility.
24
+ * - `shared`: The memory is accessible to multiple entities or across different contexts (e.g., a public fact).
25
+ * - `private`: The memory is specific to a single entity or a private context (e.g., a user's personal preference).
26
+ * - `room`: The memory is scoped to a specific room or channel.
27
+ * This is used in `MemoryMetadata` to control how memories are stored and retrieved based on context.
28
+ */
29
+ export type MemoryScope = 'shared' | 'private' | 'room';
30
+ /**
31
+ * Base interface for all memory metadata types.
32
+ * It includes common properties for all memories, such as:
33
+ * - `type`: The kind of memory (e.g., `MemoryType.MESSAGE`, `MemoryType.DOCUMENT`).
34
+ * - `source`: An optional string indicating the origin of the memory (e.g., 'discord', 'user_input').
35
+ * - `sourceId`: An optional UUID linking to a source entity or object.
36
+ * - `scope`: The visibility scope of the memory (`shared`, `private`, or `room`).
37
+ * - `timestamp`: An optional numerical timestamp (e.g., milliseconds since epoch) of when the memory was created or relevant.
38
+ * - `tags`: Optional array of strings for categorizing or filtering memories.
39
+ * Specific metadata types like `DocumentMetadata` or `MessageMetadata` extend this base.
40
+ */
41
+ export interface BaseMetadata {
42
+ type: MemoryTypeAlias;
43
+ source?: string;
44
+ sourceId?: UUID;
45
+ scope?: MemoryScope;
46
+ timestamp?: number;
47
+ tags?: string[];
48
+ }
49
+ export interface DocumentMetadata extends BaseMetadata {
50
+ type: MemoryType.DOCUMENT;
51
+ }
52
+ export interface FragmentMetadata extends BaseMetadata {
53
+ type: MemoryType.FRAGMENT;
54
+ documentId: UUID;
55
+ position: number;
56
+ }
57
+ export interface MessageMetadata extends BaseMetadata {
58
+ type: MemoryType.MESSAGE;
59
+ }
60
+ export interface DescriptionMetadata extends BaseMetadata {
61
+ type: MemoryType.DESCRIPTION;
62
+ }
63
+ export interface CustomMetadata extends BaseMetadata {
64
+ [key: string]: unknown;
65
+ }
66
+ export type MemoryMetadata = DocumentMetadata | FragmentMetadata | MessageMetadata | DescriptionMetadata | CustomMetadata;
67
+ /**
68
+ * Represents a stored memory/message
69
+ */
70
+ export interface Memory {
71
+ /** Optional unique identifier */
72
+ id?: UUID;
73
+ /** Associated user ID */
74
+ entityId: UUID;
75
+ /** Associated agent ID */
76
+ agentId?: UUID;
77
+ /** Optional creation timestamp in milliseconds since epoch */
78
+ createdAt?: number;
79
+ /** Memory content */
80
+ content: Content;
81
+ /** Optional embedding vector for semantic search */
82
+ embedding?: number[];
83
+ /** Associated room ID */
84
+ roomId: UUID;
85
+ /** Associated world ID (optional) */
86
+ worldId?: UUID;
87
+ /** Whether memory is unique (used to prevent duplicates) */
88
+ unique?: boolean;
89
+ /** Embedding similarity score (set when retrieved via search) */
90
+ similarity?: number;
91
+ /** Metadata for the memory */
92
+ metadata?: MemoryMetadata;
93
+ }
94
+ /**
95
+ * Specialized memory type for messages with enhanced type checking
96
+ */
97
+ export interface MessageMemory extends Memory {
98
+ metadata: MessageMetadata;
99
+ content: Content & {
100
+ text: string;
101
+ };
102
+ }
103
+ /**
104
+ * Factory function to create a new message memory with proper defaults
105
+ */
106
+ export declare function createMessageMemory(params: {
107
+ id?: UUID;
108
+ entityId: UUID;
109
+ agentId?: UUID;
110
+ roomId: UUID;
111
+ content: Content & {
112
+ text: string;
113
+ };
114
+ embedding?: number[];
115
+ }): MessageMemory;
116
+ /**
117
+ * Type guard to check if a memory metadata is a DocumentMetadata
118
+ * @param metadata The metadata to check
119
+ * @returns True if the metadata is a DocumentMetadata
120
+ */
121
+ export declare function isDocumentMetadata(metadata: MemoryMetadata): metadata is DocumentMetadata;
122
+ /**
123
+ * Type guard to check if a memory metadata is a FragmentMetadata
124
+ * @param metadata The metadata to check
125
+ * @returns True if the metadata is a FragmentMetadata
126
+ */
127
+ export declare function isFragmentMetadata(metadata: MemoryMetadata): metadata is FragmentMetadata;
128
+ /**
129
+ * Type guard to check if a memory metadata is a MessageMetadata
130
+ * @param metadata The metadata to check
131
+ * @returns True if the metadata is a MessageMetadata
132
+ */
133
+ export declare function isMessageMetadata(metadata: MemoryMetadata): metadata is MessageMetadata;
134
+ /**
135
+ * Type guard to check if a memory metadata is a DescriptionMetadata
136
+ * @param metadata The metadata to check
137
+ * @returns True if the metadata is a DescriptionMetadata
138
+ */
139
+ export declare function isDescriptionMetadata(metadata: MemoryMetadata): metadata is DescriptionMetadata;
140
+ /**
141
+ * Type guard to check if a memory metadata is a CustomMetadata
142
+ * @param metadata The metadata to check
143
+ * @returns True if the metadata is a CustomMetadata
144
+ */
145
+ export declare function isCustomMetadata(metadata: MemoryMetadata): metadata is CustomMetadata;
146
+ /**
147
+ * Memory type guard for document memories
148
+ */
149
+ export declare function isDocumentMemory(memory: Memory): memory is Memory & {
150
+ metadata: DocumentMetadata;
151
+ };
152
+ /**
153
+ * Memory type guard for fragment memories
154
+ */
155
+ export declare function isFragmentMemory(memory: Memory): memory is Memory & {
156
+ metadata: FragmentMetadata;
157
+ };
158
+ /**
159
+ * Safely access the text content of a memory
160
+ * @param memory The memory to extract text from
161
+ * @param defaultValue Optional default value if no text is found
162
+ * @returns The text content or default value
163
+ */
164
+ export declare function getMemoryText(memory: Memory, defaultValue?: string): string;
165
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC;;;;;;;;GAQG;AACH,oBAAY,UAAU;IACpB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CAClB;AACD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAExD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;IAC1B,UAAU,EAAE,IAAI,CAAC;IACjB,QAAQ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