@elizaos/core 1.5.3-beta.3 → 1.5.5-alpha.10

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 (181) hide show
  1. package/dist/actions.d.ts +23 -0
  2. package/dist/actions.d.ts.map +1 -0
  3. package/dist/browser/index.browser.js +172 -179
  4. package/dist/browser/index.browser.js.map +6 -197
  5. package/dist/browser/index.d.ts +2 -2
  6. package/dist/database.d.ts +481 -0
  7. package/dist/database.d.ts.map +1 -0
  8. package/dist/entities.d.ts +49 -0
  9. package/dist/entities.d.ts.map +1 -0
  10. package/{src/index.browser.ts → dist/index.browser.d.ts} +9 -21
  11. package/dist/index.browser.d.ts.map +1 -0
  12. package/dist/index.d.ts +27 -3
  13. package/dist/index.d.ts.map +1 -0
  14. package/{src/index.node.ts → dist/index.node.d.ts} +3 -16
  15. package/dist/index.node.d.ts.map +1 -0
  16. package/dist/logger.d.ts +47 -0
  17. package/dist/logger.d.ts.map +1 -0
  18. package/dist/node/index.d.ts +2 -2
  19. package/dist/node/index.node.js +15514 -439
  20. package/dist/node/index.node.js.map +139 -8
  21. package/dist/prompts.d.ts +8 -0
  22. package/dist/prompts.d.ts.map +1 -0
  23. package/dist/roles.d.ts +30 -0
  24. package/dist/roles.d.ts.map +1 -0
  25. package/dist/runtime.d.ts +328 -0
  26. package/dist/runtime.d.ts.map +1 -0
  27. package/dist/schemas/character.d.ts +228 -0
  28. package/dist/schemas/character.d.ts.map +1 -0
  29. package/dist/search.d.ts +317 -0
  30. package/dist/search.d.ts.map +1 -0
  31. package/dist/sentry/instrument.browser.d.ts +12 -0
  32. package/dist/sentry/instrument.browser.d.ts.map +1 -0
  33. package/dist/sentry/instrument.d.ts +12 -0
  34. package/dist/sentry/instrument.d.ts.map +1 -0
  35. package/dist/sentry/instrument.node.d.ts +11 -0
  36. package/dist/sentry/instrument.node.d.ts.map +1 -0
  37. package/dist/services.d.ts +49 -0
  38. package/dist/services.d.ts.map +1 -0
  39. package/dist/settings.d.ts +87 -0
  40. package/dist/settings.d.ts.map +1 -0
  41. package/{src/types/agent.ts → dist/types/agent.d.ts} +60 -74
  42. package/dist/types/agent.d.ts.map +1 -0
  43. package/dist/types/browser.d.ts +127 -0
  44. package/dist/types/browser.d.ts.map +1 -0
  45. package/dist/types/components.d.ts +135 -0
  46. package/dist/types/components.d.ts.map +1 -0
  47. package/dist/types/database.d.ts +278 -0
  48. package/dist/types/database.d.ts.map +1 -0
  49. package/dist/types/email.d.ts +143 -0
  50. package/dist/types/email.d.ts.map +1 -0
  51. package/dist/types/environment.d.ts +109 -0
  52. package/dist/types/environment.d.ts.map +1 -0
  53. package/dist/types/events.d.ts +207 -0
  54. package/dist/types/events.d.ts.map +1 -0
  55. package/{src/types/index.ts → dist/types/index.d.ts} +1 -0
  56. package/dist/types/index.d.ts.map +1 -0
  57. package/{src/types/knowledge.ts → dist/types/knowledge.d.ts} +18 -23
  58. package/dist/types/knowledge.d.ts.map +1 -0
  59. package/dist/types/lp.d.ts +115 -0
  60. package/dist/types/lp.d.ts.map +1 -0
  61. package/{src/types/memory.ts → dist/types/memory.d.ts} +69 -132
  62. package/dist/types/memory.d.ts.map +1 -0
  63. package/dist/types/message.d.ts +202 -0
  64. package/dist/types/message.d.ts.map +1 -0
  65. package/dist/types/messaging.d.ts +45 -0
  66. package/dist/types/messaging.d.ts.map +1 -0
  67. package/dist/types/model.d.ts +319 -0
  68. package/dist/types/model.d.ts.map +1 -0
  69. package/dist/types/pdf.d.ts +68 -0
  70. package/dist/types/pdf.d.ts.map +1 -0
  71. package/dist/types/plugin.d.ts +64 -0
  72. package/dist/types/plugin.d.ts.map +1 -0
  73. package/dist/types/post.d.ts +242 -0
  74. package/dist/types/post.d.ts.map +1 -0
  75. package/dist/types/primitives.d.ts +72 -0
  76. package/dist/types/primitives.d.ts.map +1 -0
  77. package/dist/types/runtime.d.ts +106 -0
  78. package/dist/types/runtime.d.ts.map +1 -0
  79. package/{src/types/service.ts → dist/types/service.d.ts} +69 -120
  80. package/dist/types/service.d.ts.map +1 -0
  81. package/dist/types/settings.d.ts +30 -0
  82. package/dist/types/settings.d.ts.map +1 -0
  83. package/{src/types/state.ts → dist/types/state.d.ts} +18 -19
  84. package/dist/types/state.d.ts.map +1 -0
  85. package/dist/types/task.d.ts +68 -0
  86. package/dist/types/task.d.ts.map +1 -0
  87. package/dist/types/tee.d.ts +97 -0
  88. package/dist/types/tee.d.ts.map +1 -0
  89. package/dist/types/testing.d.ts +29 -0
  90. package/dist/types/testing.d.ts.map +1 -0
  91. package/dist/types/token.d.ts +73 -0
  92. package/dist/types/token.d.ts.map +1 -0
  93. package/dist/types/transcription.d.ts +108 -0
  94. package/dist/types/transcription.d.ts.map +1 -0
  95. package/dist/types/video.d.ts +93 -0
  96. package/dist/types/video.d.ts.map +1 -0
  97. package/dist/types/wallet.d.ts +49 -0
  98. package/dist/types/wallet.d.ts.map +1 -0
  99. package/dist/types/web-search.d.ts +112 -0
  100. package/dist/types/web-search.d.ts.map +1 -0
  101. package/dist/utils/buffer.d.ts +105 -0
  102. package/dist/utils/buffer.d.ts.map +1 -0
  103. package/dist/utils/environment.d.ts +106 -0
  104. package/dist/utils/environment.d.ts.map +1 -0
  105. package/dist/utils/server-health.d.ts +23 -0
  106. package/dist/utils/server-health.d.ts.map +1 -0
  107. package/dist/utils.d.ts +177 -0
  108. package/dist/utils.d.ts.map +1 -0
  109. package/package.json +5 -5
  110. package/src/__tests__/action-chaining-simple.test.ts +0 -203
  111. package/src/__tests__/actions.test.ts +0 -218
  112. package/src/__tests__/buffer.test.ts +0 -337
  113. package/src/__tests__/character-validation.test.ts +0 -309
  114. package/src/__tests__/database.test.ts +0 -750
  115. package/src/__tests__/entities.test.ts +0 -727
  116. package/src/__tests__/env.test.ts +0 -23
  117. package/src/__tests__/environment.test.ts +0 -285
  118. package/src/__tests__/logger-browser-node.test.ts +0 -716
  119. package/src/__tests__/logger.test.ts +0 -403
  120. package/src/__tests__/messages.test.ts +0 -196
  121. package/src/__tests__/mockCharacter.ts +0 -544
  122. package/src/__tests__/parsing.test.ts +0 -58
  123. package/src/__tests__/prompts.test.ts +0 -159
  124. package/src/__tests__/roles.test.ts +0 -331
  125. package/src/__tests__/runtime-embedding.test.ts +0 -343
  126. package/src/__tests__/runtime.test.ts +0 -978
  127. package/src/__tests__/search.test.ts +0 -15
  128. package/src/__tests__/services-by-type.test.ts +0 -204
  129. package/src/__tests__/services.test.ts +0 -136
  130. package/src/__tests__/settings.test.ts +0 -810
  131. package/src/__tests__/utils.test.ts +0 -1105
  132. package/src/__tests__/uuid.test.ts +0 -94
  133. package/src/actions.ts +0 -122
  134. package/src/database.ts +0 -579
  135. package/src/entities.ts +0 -406
  136. package/src/index.ts +0 -50
  137. package/src/logger.ts +0 -527
  138. package/src/prompts.ts +0 -243
  139. package/src/roles.ts +0 -85
  140. package/src/runtime.ts +0 -2514
  141. package/src/schemas/character.ts +0 -149
  142. package/src/search.ts +0 -1543
  143. package/src/sentry/instrument.browser.ts +0 -65
  144. package/src/sentry/instrument.node.ts +0 -57
  145. package/src/sentry/instrument.ts +0 -82
  146. package/src/services.ts +0 -105
  147. package/src/settings.ts +0 -409
  148. package/src/test_resources/constants.ts +0 -12
  149. package/src/test_resources/testSetup.ts +0 -21
  150. package/src/test_resources/types.ts +0 -22
  151. package/src/types/browser.ts +0 -145
  152. package/src/types/components.ts +0 -184
  153. package/src/types/database.ts +0 -348
  154. package/src/types/email.ts +0 -162
  155. package/src/types/environment.ts +0 -129
  156. package/src/types/events.ts +0 -249
  157. package/src/types/lp.ts +0 -124
  158. package/src/types/message.ts +0 -233
  159. package/src/types/messaging.ts +0 -57
  160. package/src/types/model.ts +0 -359
  161. package/src/types/pdf.ts +0 -77
  162. package/src/types/plugin.ts +0 -78
  163. package/src/types/post.ts +0 -271
  164. package/src/types/primitives.ts +0 -97
  165. package/src/types/runtime.ts +0 -190
  166. package/src/types/settings.ts +0 -30
  167. package/src/types/task.ts +0 -72
  168. package/src/types/tee.ts +0 -107
  169. package/src/types/testing.ts +0 -30
  170. package/src/types/token.ts +0 -96
  171. package/src/types/transcription.ts +0 -133
  172. package/src/types/video.ts +0 -108
  173. package/src/types/wallet.ts +0 -56
  174. package/src/types/web-search.ts +0 -146
  175. package/src/utils/__tests__/buffer.test.ts +0 -80
  176. package/src/utils/__tests__/environment.test.ts +0 -58
  177. package/src/utils/__tests__/stringToUuid.test.ts +0 -88
  178. package/src/utils/buffer.ts +0 -312
  179. package/src/utils/environment.ts +0 -316
  180. package/src/utils/server-health.ts +0 -117
  181. package/src/utils.ts +0 -1076
package/src/settings.ts DELETED
@@ -1,409 +0,0 @@
1
- // @ts-ignore
2
- import crypto from 'crypto-browserify';
3
- import { createUniqueUuid } from './entities';
4
- import { getEnv } from './utils/environment';
5
- import { BufferUtils } from './utils/buffer';
6
- import { logger } from './logger';
7
- import type {
8
- Character,
9
- IAgentRuntime,
10
- OnboardingConfig,
11
- Setting,
12
- World,
13
- WorldSettings,
14
- } from './types';
15
-
16
- /**
17
- * Creates a Setting object from a configSetting object by omitting the 'value' property.
18
- *
19
- * @param {Omit<Setting, 'value'>} configSetting - The configSetting object to create the Setting from.
20
- * @returns {Setting} A new Setting object created from the provided configSetting object.
21
- */
22
- export function createSettingFromConfig(configSetting: Omit<Setting, 'value'>): Setting {
23
- return {
24
- name: configSetting.name,
25
- description: configSetting.description,
26
- usageDescription: configSetting.usageDescription || '',
27
- value: null,
28
- required: configSetting.required,
29
- validation: configSetting.validation || undefined,
30
- public: configSetting.public || false,
31
- secret: configSetting.secret || false,
32
- dependsOn: configSetting.dependsOn || [],
33
- onSetAction: configSetting.onSetAction || undefined,
34
- visibleIf: configSetting.visibleIf || undefined,
35
- };
36
- }
37
-
38
- /**
39
- * Retrieves the salt based on env variable SECRET_SALT
40
- *
41
- * @returns {string} The salt for the agent.
42
- */
43
- export function getSalt(): string {
44
- const secretSalt = getEnv('SECRET_SALT', 'secretsalt') || 'secretsalt';
45
-
46
- if (secretSalt === 'secretsalt') {
47
- logger.error('SECRET_SALT is not set or using default value');
48
- }
49
-
50
- const salt = secretSalt;
51
-
52
- //logger.debug(`Generated salt with length: ${salt.length} (truncated for security)`);
53
- return salt;
54
- }
55
-
56
- /**
57
- * Common encryption function for string values
58
- * @param {string} value - The string value to encrypt
59
- * @param {string} salt - The salt to use for encryption
60
- * @returns {string} - The encrypted value in 'iv:encrypted' format
61
- */
62
- export function encryptStringValue(value: string, salt: string): string {
63
- // Check if value is undefined or null
64
- if (value === undefined || value === null) {
65
- logger.debug('Attempted to encrypt undefined or null value');
66
- return value; // Return the value as is (undefined or null)
67
- }
68
-
69
- if (typeof value === 'boolean' || typeof value === 'number') {
70
- logger.debug('Value is a boolean or number, returning as is');
71
- return value;
72
- }
73
-
74
- if (typeof value !== 'string') {
75
- logger.debug(`Value is not a string (type: ${typeof value}), returning as is`);
76
- return value;
77
- }
78
-
79
- // Check if value is already encrypted (has the format "iv:encrypted")
80
- const parts = value.split(':');
81
- if (parts.length === 2) {
82
- try {
83
- // Try to parse the first part as hex to see if it's already encrypted
84
- const possibleIv = BufferUtils.fromHex(parts[0]);
85
- if (possibleIv.length === 16) {
86
- // Value is likely already encrypted, return as is
87
- logger.debug('Value appears to be already encrypted, skipping re-encryption');
88
- return value;
89
- }
90
- } catch (e) {
91
- // Not a valid hex string, proceed with encryption
92
- }
93
- }
94
-
95
- // Create key and iv from the salt
96
- const key = crypto.createHash('sha256').update(salt).digest().slice(0, 32);
97
- const iv = BufferUtils.randomBytes(16);
98
-
99
- // Encrypt the value
100
- const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
101
- let encrypted = cipher.update(value, 'utf8', 'hex');
102
- encrypted += cipher.final('hex');
103
-
104
- // Store IV with the encrypted value so we can decrypt it later
105
- return `${BufferUtils.toHex(iv)}:${encrypted}`;
106
- }
107
-
108
- /**
109
- * Common decryption function for string values
110
- * @param {string} value - The encrypted value in 'iv:encrypted' format
111
- * @param {string} salt - The salt to use for decryption
112
- * @returns {string} - The decrypted string value
113
- */
114
- export function decryptStringValue(value: string, salt: string): string {
115
- try {
116
- // Check if value is undefined or null
117
- if (value === undefined || value === null) {
118
- //logger.debug('Attempted to decrypt undefined or null value');
119
- return value; // Return the value as is (undefined or null)
120
- }
121
-
122
- if (typeof value === 'boolean' || typeof value === 'number') {
123
- //logger.debug('Value is a boolean or number, returning as is');
124
- return value;
125
- }
126
- if (typeof value !== 'string') {
127
- logger.debug(`Value is not a string (type: ${typeof value}), returning as is`);
128
- return value;
129
- }
130
-
131
- // Split the IV and encrypted value
132
- const parts = value.split(':');
133
- if (parts.length !== 2) {
134
- /*
135
- logger.debug(
136
- `Invalid encrypted value format - expected 'iv:encrypted', returning original value`
137
- );
138
- */
139
- return value; // Return the original value without decryption
140
- }
141
-
142
- const iv = BufferUtils.fromHex(parts[0]);
143
- const encrypted = parts[1];
144
-
145
- // Verify IV length
146
- if (iv.length !== 16) {
147
- if (iv.length) {
148
- logger.debug(`Invalid IV length (${iv.length}) - expected 16 bytes`);
149
- }
150
- return value; // Return the original value without decryption
151
- }
152
-
153
- // Create key from the salt
154
- const key = crypto.createHash('sha256').update(salt).digest().slice(0, 32);
155
-
156
- // Decrypt the value
157
- const decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
158
- let decrypted = decipher.update(encrypted, 'hex', 'utf8');
159
- decrypted += decipher.final('utf8');
160
-
161
- return decrypted;
162
- } catch (error) {
163
- logger.error(`Error decrypting value: ${error}`);
164
- // Return the encrypted value on error
165
- return value;
166
- }
167
- }
168
-
169
- /**
170
- * Applies salt to the value of a setting
171
- * Only applies to secret settings with string values
172
- */
173
- export function saltSettingValue(setting: Setting, salt: string): Setting {
174
- const settingCopy = { ...setting };
175
-
176
- // Only encrypt string values in secret settings
177
- if (setting.secret === true && typeof setting.value === 'string' && setting.value) {
178
- settingCopy.value = encryptStringValue(setting.value, salt);
179
- }
180
-
181
- return settingCopy;
182
- }
183
-
184
- /**
185
- * Removes salt from the value of a setting
186
- * Only applies to secret settings with string values
187
- */
188
- export function unsaltSettingValue(setting: Setting, salt: string): Setting {
189
- const settingCopy = { ...setting };
190
-
191
- // Only decrypt string values in secret settings
192
- if (setting.secret === true && typeof setting.value === 'string' && setting.value) {
193
- settingCopy.value = decryptStringValue(setting.value, salt);
194
- }
195
-
196
- return settingCopy;
197
- }
198
-
199
- /**
200
- * Applies salt to all settings in a WorldSettings object
201
- */
202
- export function saltWorldSettings(worldSettings: WorldSettings, salt: string): WorldSettings {
203
- const saltedSettings: WorldSettings = {};
204
-
205
- for (const [key, setting] of Object.entries(worldSettings)) {
206
- saltedSettings[key] = saltSettingValue(setting, salt);
207
- }
208
-
209
- return saltedSettings;
210
- }
211
-
212
- /**
213
- * Removes salt from all settings in a WorldSettings object
214
- */
215
- export function unsaltWorldSettings(worldSettings: WorldSettings, salt: string): WorldSettings {
216
- const unsaltedSettings: WorldSettings = {};
217
-
218
- for (const [key, setting] of Object.entries(worldSettings)) {
219
- unsaltedSettings[key] = unsaltSettingValue(setting, salt);
220
- }
221
-
222
- return unsaltedSettings;
223
- }
224
-
225
- /**
226
- * Updates settings state in world metadata
227
- */
228
- export async function updateWorldSettings(
229
- runtime: IAgentRuntime,
230
- serverId: string,
231
- worldSettings: WorldSettings
232
- ): Promise<boolean> {
233
- const worldId = createUniqueUuid(runtime, serverId);
234
- const world = await runtime.getWorld(worldId);
235
-
236
- if (!world) {
237
- logger.error(`No world found for server ${serverId}`);
238
- return false;
239
- }
240
-
241
- // Initialize metadata if it doesn't exist
242
- if (!world.metadata) {
243
- world.metadata = {};
244
- }
245
-
246
- // Apply salt to settings before saving
247
- const salt = getSalt();
248
- const saltedSettings = saltWorldSettings(worldSettings, salt);
249
-
250
- // Update settings state
251
- world.metadata.settings = saltedSettings;
252
-
253
- // Save updated world
254
- await runtime.updateWorld(world);
255
-
256
- return true;
257
- }
258
-
259
- /**
260
- * Gets settings state from world metadata
261
- */
262
- export async function getWorldSettings(
263
- runtime: IAgentRuntime,
264
- serverId: string
265
- ): Promise<WorldSettings | null> {
266
- const worldId = createUniqueUuid(runtime, serverId);
267
- const world = await runtime.getWorld(worldId);
268
-
269
- if (!world || !world.metadata?.settings) {
270
- return null;
271
- }
272
-
273
- // Get settings from metadata
274
- const saltedSettings = world.metadata.settings as WorldSettings;
275
-
276
- // Remove salt from settings before returning
277
- const salt = getSalt();
278
- return unsaltWorldSettings(saltedSettings, salt);
279
- }
280
-
281
- /**
282
- * Initializes settings configuration for a server
283
- */
284
- export async function initializeOnboarding(
285
- runtime: IAgentRuntime,
286
- world: World,
287
- config: OnboardingConfig
288
- ): Promise<WorldSettings | null> {
289
- // Check if settings state already exists
290
- if (world.metadata?.settings) {
291
- logger.info(`Onboarding state already exists for server ${world.serverId}`);
292
- // Get settings from metadata and remove salt
293
- const saltedSettings = world.metadata.settings as WorldSettings;
294
- const salt = getSalt();
295
- return unsaltWorldSettings(saltedSettings, salt);
296
- }
297
-
298
- // Create new settings state
299
- const worldSettings: WorldSettings = {};
300
-
301
- // Initialize settings from config
302
- if (config.settings) {
303
- for (const [key, configSetting] of Object.entries(config.settings)) {
304
- worldSettings[key] = createSettingFromConfig(configSetting);
305
- }
306
- }
307
-
308
- // Save settings state to world metadata
309
- if (!world.metadata) {
310
- world.metadata = {};
311
- }
312
-
313
- // No need to salt here as the settings are just initialized with null values
314
- world.metadata.settings = worldSettings;
315
-
316
- await runtime.updateWorld(world);
317
-
318
- logger.info(`Initialized settings config for server ${world.serverId}`);
319
- return worldSettings;
320
- }
321
-
322
- /**
323
- * Encrypts sensitive data in a Character object
324
- * @param {Character} character - The character object to encrypt secrets for
325
- * @returns {Character} - A copy of the character with encrypted secrets
326
- */
327
- export function encryptedCharacter(character: Character): Character {
328
- // Create a deep copy to avoid modifying the original
329
- const encryptedChar = JSON.parse(JSON.stringify(character));
330
- const salt = getSalt();
331
-
332
- // Encrypt character.settings.secrets if it exists
333
- if (encryptedChar.settings?.secrets) {
334
- encryptedChar.settings.secrets = encryptObjectValues(encryptedChar.settings.secrets, salt);
335
- }
336
-
337
- // Encrypt character.secrets if it exists
338
- if (encryptedChar.secrets) {
339
- encryptedChar.secrets = encryptObjectValues(encryptedChar.secrets, salt);
340
- }
341
-
342
- return encryptedChar;
343
- }
344
-
345
- /**
346
- * Decrypts sensitive data in a Character object
347
- * @param {Character} character - The character object with encrypted secrets
348
- * @param {IAgentRuntime} runtime - The runtime information needed for salt generation
349
- * @returns {Character} - A copy of the character with decrypted secrets
350
- */
351
- export function decryptedCharacter(character: Character, _runtime: IAgentRuntime): Character {
352
- // Create a deep copy to avoid modifying the original
353
- const decryptedChar = JSON.parse(JSON.stringify(character));
354
- const salt = getSalt();
355
-
356
- // Decrypt character.settings.secrets if it exists
357
- if (decryptedChar.settings?.secrets) {
358
- decryptedChar.settings.secrets = decryptObjectValues(decryptedChar.settings.secrets, salt);
359
- }
360
-
361
- // Decrypt character.secrets if it exists
362
- if (decryptedChar.secrets) {
363
- decryptedChar.secrets = decryptObjectValues(decryptedChar.secrets, salt);
364
- }
365
-
366
- return decryptedChar;
367
- }
368
-
369
- /**
370
- * Helper function to encrypt all string values in an object
371
- * @param {Record<string, any>} obj - Object with values to encrypt
372
- * @param {string} salt - The salt to use for encryption
373
- * @returns {Record<string, any>} - Object with encrypted values
374
- */
375
- export function encryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any> {
376
- const result: Record<string, any> = {};
377
-
378
- for (const [key, value] of Object.entries(obj)) {
379
- if (typeof value === 'string' && value) {
380
- result[key] = encryptStringValue(value, salt);
381
- } else {
382
- result[key] = value;
383
- }
384
- }
385
-
386
- return result;
387
- }
388
-
389
- /**
390
- * Helper function to decrypt all string values in an object
391
- * @param {Record<string, any>} obj - Object with encrypted values
392
- * @param {string} salt - The salt to use for decryption
393
- * @returns {Record<string, any>} - Object with decrypted values
394
- */
395
- export function decryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any> {
396
- const result: Record<string, any> = {};
397
-
398
- for (const [key, value] of Object.entries(obj)) {
399
- if (typeof value === 'string' && value) {
400
- result[key] = decryptStringValue(value, salt);
401
- } else {
402
- result[key] = value;
403
- }
404
- }
405
-
406
- return result;
407
- }
408
-
409
- export { decryptStringValue as decryptSecret };
@@ -1,12 +0,0 @@
1
- import type { UUID } from '@elizaos/core';
2
-
3
- export const SERVER_URL = 'http://localhost:7998';
4
- export const SUPABASE_URL = 'https://pronvzrzfwsptkojvudd.supabase.co';
5
- export const SUPABASE_ANON_KEY =
6
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InByb252enJ6ZndzcHRrb2p2dWRkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDY4NTYwNDcsImV4cCI6MjAyMjQzMjA0N30.I6_-XrqssUb2SWYg5DjsUqSodNS3_RPoET3-aPdqywM';
7
- export const TEST_EMAIL = 'testuser123@example.com';
8
- export const TEST_PASSWORD = 'mock_password_123!@#';
9
- export const TEST_EMAIL_2 = 'testuser234@example.com';
10
- export const TEST_PASSWORD_2 = 'mock_password_234!@#';
11
-
12
- export const zeroUuid = '00000000-0000-0000-0000-000000000000' as UUID;
@@ -1,21 +0,0 @@
1
- import dotenv from 'dotenv';
2
- import path from 'path';
3
- import { fileURLToPath } from 'url';
4
-
5
- // Get the current file's directory
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- // Resolve paths relative to packages/core directory
10
- const packageRoot = path.resolve(__dirname, '../..');
11
- const envTestPath = path.join(packageRoot, '.env.test');
12
- const envPath = path.join(packageRoot, '.env');
13
-
14
- const result = dotenv.config({ path: envTestPath });
15
- if (result.error) {
16
- console.error('Error loading .env.test. Loading .env instead');
17
- const result2 = dotenv.config({ path: envPath });
18
- if (result2.error) {
19
- console.error('Error loading .env:', result2.error);
20
- }
21
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Interface representing a User.
3
- * @typedef {Object} User
4
- * @property {string} id - The user's ID.
5
- * @property {string} [email] - The user's email (optional).
6
- * @property {string} [phone] - The user's phone number (optional).
7
- * @property {string} [role] - The user's role (optional).
8
- */
9
- /**
10
- * Represents a User with optional properties.
11
- * @typedef {Object} User
12
- * @property {string} id - The unique identifier for the user.
13
- * @property {string} [email] - The email address of the user (optional).
14
- * @property {string} [phone] - The phone number of the user (optional).
15
- * @property {string} [role] - The role of the user (optional).
16
- */
17
- export interface User {
18
- id: string;
19
- email?: string;
20
- phone?: string;
21
- role?: string;
22
- }
@@ -1,145 +0,0 @@
1
- import { Service, ServiceType } from './service';
2
-
3
- export interface BrowserNavigationOptions {
4
- timeout?: number;
5
- waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
6
- viewport?: {
7
- width: number;
8
- height: number;
9
- };
10
- userAgent?: string;
11
- headers?: Record<string, string>;
12
- }
13
-
14
- export interface ScreenshotOptions {
15
- fullPage?: boolean;
16
- clip?: {
17
- x: number;
18
- y: number;
19
- width: number;
20
- height: number;
21
- };
22
- format?: 'png' | 'jpeg' | 'webp';
23
- quality?: number;
24
- omitBackground?: boolean;
25
- }
26
-
27
- export interface ElementSelector {
28
- selector: string;
29
- text?: string;
30
- timeout?: number;
31
- }
32
-
33
- export interface ExtractedContent {
34
- text: string;
35
- html: string;
36
- links: Array<{
37
- url: string;
38
- text: string;
39
- }>;
40
- images: Array<{
41
- src: string;
42
- alt?: string;
43
- }>;
44
- title?: string;
45
- metadata?: Record<string, string>;
46
- }
47
-
48
- export interface ClickOptions {
49
- timeout?: number;
50
- force?: boolean;
51
- waitForNavigation?: boolean;
52
- }
53
-
54
- export interface TypeOptions {
55
- delay?: number;
56
- timeout?: number;
57
- clear?: boolean;
58
- }
59
-
60
- /**
61
- * Interface for browser automation services
62
- */
63
- export abstract class IBrowserService extends Service {
64
- static override readonly serviceType = ServiceType.BROWSER;
65
-
66
- public readonly capabilityDescription = 'Web browser automation and scraping capabilities';
67
-
68
- /**
69
- * Navigate to a URL
70
- * @param url - URL to navigate to
71
- * @param options - Navigation options
72
- * @returns Promise resolving when navigation completes
73
- */
74
- abstract navigate(url: string, options?: BrowserNavigationOptions): Promise<void>;
75
-
76
- /**
77
- * Take a screenshot of the current page
78
- * @param options - Screenshot options
79
- * @returns Promise resolving to screenshot buffer
80
- */
81
- abstract screenshot(options?: ScreenshotOptions): Promise<Buffer>;
82
-
83
- /**
84
- * Extract text and content from the current page
85
- * @param selector - Optional CSS selector to extract from specific element
86
- * @returns Promise resolving to extracted content
87
- */
88
- abstract extractContent(selector?: string): Promise<ExtractedContent>;
89
-
90
- /**
91
- * Click on an element
92
- * @param selector - CSS selector or element selector
93
- * @param options - Click options
94
- * @returns Promise resolving when click completes
95
- */
96
- abstract click(selector: string | ElementSelector, options?: ClickOptions): Promise<void>;
97
-
98
- /**
99
- * Type text into an input field
100
- * @param selector - CSS selector for input field
101
- * @param text - Text to type
102
- * @param options - Typing options
103
- * @returns Promise resolving when typing completes
104
- */
105
- abstract type(selector: string, text: string, options?: TypeOptions): Promise<void>;
106
-
107
- /**
108
- * Wait for an element to appear
109
- * @param selector - CSS selector or element selector
110
- * @returns Promise resolving when element is found
111
- */
112
- abstract waitForElement(selector: string | ElementSelector): Promise<void>;
113
-
114
- /**
115
- * Evaluate JavaScript in the browser context
116
- * @param script - JavaScript code to evaluate
117
- * @param args - Arguments to pass to the script
118
- * @returns Promise resolving to evaluation result
119
- */
120
- abstract evaluate<T = any>(script: string, ...args: any[]): Promise<T>;
121
-
122
- /**
123
- * Get the current page URL
124
- * @returns Promise resolving to current URL
125
- */
126
- abstract getCurrentUrl(): Promise<string>;
127
-
128
- /**
129
- * Go back in browser history
130
- * @returns Promise resolving when navigation completes
131
- */
132
- abstract goBack(): Promise<void>;
133
-
134
- /**
135
- * Go forward in browser history
136
- * @returns Promise resolving when navigation completes
137
- */
138
- abstract goForward(): Promise<void>;
139
-
140
- /**
141
- * Refresh the current page
142
- * @returns Promise resolving when refresh completes
143
- */
144
- abstract refresh(): Promise<void>;
145
- }