@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
@@ -1,94 +0,0 @@
1
- import { beforeEach, describe, expect, it } from 'bun:test';
2
- import type { UUID } from '../types';
3
- import { stringToUuid } from '../utils';
4
-
5
- describe('UUID Module', () => {
6
- // Helper function to generate test strings
7
- const generateTestString = (): string => Math.random().toString(36).substring(7);
8
-
9
- // Test data setup
10
- let testString: string;
11
- let testNumber: number;
12
-
13
- beforeEach(() => {
14
- testString = generateTestString();
15
- testNumber = Math.floor(Math.random() * 1000);
16
- });
17
-
18
- describe('stringToUuid', () => {
19
- it('should generate a valid UUID matching the standard format', () => {
20
- const result = stringToUuid(testString) as UUID;
21
- expect(result).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
22
- });
23
-
24
- it('should generate consistent UUIDs for identical inputs', () => {
25
- const input = testString;
26
- const uuid1 = stringToUuid(input) as UUID;
27
- const uuid2 = stringToUuid(input) as UUID;
28
- expect(uuid1).toBe(uuid2);
29
- });
30
-
31
- it('should generate unique UUIDs for different inputs', () => {
32
- const input1 = testString;
33
- const input2 = generateTestString();
34
- const uuid1 = stringToUuid(input1) as UUID;
35
- const uuid2 = stringToUuid(input2) as UUID;
36
- expect(uuid1).not.toBe(uuid2);
37
- });
38
-
39
- describe('input handling', () => {
40
- it('should convert number inputs to strings correctly', () => {
41
- const numberUuid = stringToUuid(testNumber) as UUID;
42
- const stringUuid = stringToUuid(testNumber.toString()) as UUID;
43
- expect(numberUuid).toBe(stringUuid);
44
- });
45
-
46
- it('should throw TypeError for invalid input types', () => {
47
- expect(() => stringToUuid(undefined as any)).toThrow(TypeError);
48
- expect(() => stringToUuid(null as any)).toThrow(TypeError);
49
- expect(() => stringToUuid({} as any)).toThrow(TypeError);
50
- });
51
-
52
- it('should handle empty string input', () => {
53
- const result = stringToUuid('') as UUID;
54
- expect(result).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
55
- });
56
-
57
- it('should handle Unicode characters and emojis consistently', () => {
58
- const unicodeInput = 'Hello 世界! 🌍';
59
- const result1 = stringToUuid(unicodeInput) as UUID;
60
- const result2 = stringToUuid(unicodeInput) as UUID;
61
- expect(result1).toBe(result2);
62
- expect(result1).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
63
- });
64
- });
65
-
66
- describe('UUID version and variant bits', () => {
67
- it('should set correct version bits (version 5)', () => {
68
- const uuid = stringToUuid(testString) as UUID;
69
- const versionChar = uuid.split('-')[2][0];
70
- expect(versionChar).toBe('0');
71
- });
72
-
73
- it('should set correct variant bits (RFC4122)', () => {
74
- const uuid = stringToUuid(testString) as UUID;
75
- const variantByte = Number.parseInt(uuid.split('-')[3].slice(0, 2), 16);
76
- expect(variantByte >= 0x80 && variantByte <= 0xbf).toBe(true);
77
- });
78
- });
79
-
80
- describe('encoding handling', () => {
81
- it('should handle URL-unsafe characters', () => {
82
- const urlUnsafeInput = 'test?query=value&param=123';
83
- const result = stringToUuid(urlUnsafeInput) as UUID;
84
- expect(result).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
85
- });
86
-
87
- it('should handle very long inputs', () => {
88
- const longInput = 'a'.repeat(1000);
89
- const result = stringToUuid(longInput) as UUID;
90
- expect(result).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
91
- });
92
- });
93
- });
94
- });
package/src/actions.ts DELETED
@@ -1,122 +0,0 @@
1
- import { names, uniqueNamesGenerator } from 'unique-names-generator';
2
- import type { Action, ActionExample } from './types';
3
-
4
- /**
5
- * Composes a set of example conversations based on provided actions and a specified count.
6
- * It randomly selects examples from the provided actions and formats them with generated names.
7
- *
8
- * @param actionsData - An array of `Action` objects from which to draw examples.
9
- * @param count - The number of examples to generate.
10
- * @returns A string containing formatted examples of conversations.
11
- */
12
- export const composeActionExamples = (actionsData: Action[], count: number): string => {
13
- // Handle edge cases
14
- if (!actionsData.length || count <= 0) {
15
- return '';
16
- }
17
-
18
- // Filter out actions without examples
19
- const actionsWithExamples = actionsData.filter(
20
- (action) => action.examples && Array.isArray(action.examples) && action.examples.length > 0
21
- );
22
-
23
- // If no actions have examples, return empty string
24
- if (!actionsWithExamples.length) {
25
- return '';
26
- }
27
-
28
- // Create a working copy of the examples
29
- const examplesCopy: ActionExample[][][] = actionsWithExamples.map((action) => [
30
- ...(action.examples || []),
31
- ]);
32
-
33
- const selectedExamples: ActionExample[][] = [];
34
-
35
- // Keep track of actions that still have examples
36
- let availableActionIndices = examplesCopy
37
- .map((examples, index) => (examples.length > 0 ? index : -1))
38
- .filter((index) => index !== -1);
39
-
40
- // Select examples until we reach the count or run out of examples
41
- while (selectedExamples.length < count && availableActionIndices.length > 0) {
42
- // Randomly select an action
43
- const randomIndex = Math.floor(Math.random() * availableActionIndices.length);
44
- const actionIndex = availableActionIndices[randomIndex];
45
- const examples = examplesCopy[actionIndex];
46
-
47
- // Select a random example from this action
48
- const exampleIndex = Math.floor(Math.random() * examples.length);
49
- selectedExamples.push(examples.splice(exampleIndex, 1)[0]);
50
-
51
- // Remove action if it has no more examples
52
- if (examples.length === 0) {
53
- availableActionIndices.splice(randomIndex, 1);
54
- }
55
- }
56
-
57
- // Format the selected examples
58
- return formatSelectedExamples(selectedExamples);
59
- };
60
-
61
- /**
62
- * Formats selected example conversations with random names.
63
- */
64
- const formatSelectedExamples = (examples: ActionExample[][]): string => {
65
- const MAX_NAME_PLACEHOLDERS = 5;
66
-
67
- return examples
68
- .map((example) => {
69
- // Generate random names for this example
70
- const randomNames = Array.from({ length: MAX_NAME_PLACEHOLDERS }, () =>
71
- uniqueNamesGenerator({ dictionaries: [names] })
72
- );
73
-
74
- // Format the conversation
75
- const conversation = example
76
- .map((message) => {
77
- // Build the base message - only include the text, no action info
78
- let messageText = `${message.name}: ${message.content.text}`;
79
-
80
- // Replace name placeholders
81
- for (let i = 0; i < randomNames.length; i++) {
82
- messageText = messageText.replaceAll(`{{name${i + 1}}}`, randomNames[i]);
83
- }
84
-
85
- return messageText;
86
- })
87
- .join('\n');
88
-
89
- return `\n${conversation}`;
90
- })
91
- .join('\n');
92
- };
93
-
94
- /**
95
- * Formats the names of the provided actions into a comma-separated string.
96
- * @param actions - An array of `Action` objects from which to extract names.
97
- * @returns A comma-separated string of action names.
98
- */
99
- export function formatActionNames(actions: Action[]): string {
100
- if (!actions?.length) return '';
101
-
102
- // Create a shuffled copy instead of mutating the original array
103
- return [...actions]
104
- .sort(() => Math.random() - 0.5)
105
- .map((action) => action.name)
106
- .join(', ');
107
- }
108
-
109
- /**
110
- * Formats the provided actions into a detailed string listing each action's name and description.
111
- * @param actions - An array of `Action` objects to format.
112
- * @returns A detailed string of actions, including names and descriptions.
113
- */
114
- export function formatActions(actions: Action[]): string {
115
- if (!actions?.length) return '';
116
-
117
- // Create a shuffled copy without mutating the original
118
- return [...actions]
119
- .sort(() => Math.random() - 0.5)
120
- .map((action) => `- **${action.name}**: ${action.description || 'No description available'}`)
121
- .join('\n');
122
- }