@elizaos/cli 1.0.8 → 1.0.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 (242) hide show
  1. package/README.md +9 -16
  2. package/dist/assets/{index-CZAd5zm2.js → index-CmuPnu0u.js} +72 -89
  3. package/dist/assets/index-CmuPnu0u.js.br +0 -0
  4. package/dist/assets/index-CmuPnu0u.js.map +1 -0
  5. package/dist/assets/{index-CaEsCLCC.js → index-DDQnwxzL.js} +28798 -16391
  6. package/dist/assets/{index-CaEsCLCC.js.map → index-DDQnwxzL.js.map} +1 -1
  7. package/dist/assets/index-Df1AFSuJ.css +1 -0
  8. package/dist/assets/index-Df1AFSuJ.css.br +0 -0
  9. package/dist/assets/vendor-DSdxb8P-.js.map +1 -1
  10. package/dist/{chunk-REBZFQYE.js → chunk-7HYEGM5V.js} +967 -1597
  11. package/dist/{chunk-W3HS2NP6.js → chunk-B4KJXECB.js} +13 -18
  12. package/dist/{chunk-33BHGAF7.js → chunk-GWQB7PBK.js} +59 -32
  13. package/dist/{chunk-CVADLFW6.js → chunk-LQ6XHF53.js} +4543 -3043
  14. package/dist/{chunk-GYTAJJOD.js → chunk-RIAWNDYI.js} +16 -2
  15. package/dist/{chunk-IEKLJDUU.js → chunk-WS4DWCDZ.js} +54 -32
  16. package/dist/commands/agent/actions/index.d.ts +5 -1
  17. package/dist/commands/agent/actions/index.js +5 -4
  18. package/dist/commands/agent/index.js +3 -4
  19. package/dist/commands/create/actions/index.js +4 -5
  20. package/dist/commands/create/index.js +5 -6
  21. package/dist/{fileFromPath-DCRQMDLJ.js → fileFromPath-KB6XMTJ4.js} +1 -0
  22. package/dist/index.html +2 -2
  23. package/dist/index.js +9346 -102098
  24. package/dist/{migrator-KZLCVEIH.js → migrator-JREQPDN3.js} +42 -220
  25. package/dist/pglite.data +0 -0
  26. package/dist/pglite.wasm +0 -0
  27. package/dist/plugin-creator-T4K2673C.js +910 -0
  28. package/dist/{registry-XFOSZFU4.js → registry-CBMRMYCG.js} +3 -4
  29. package/dist/templates/plugin-starter/README.md +255 -0
  30. package/dist/templates/plugin-starter/bunfig.toml +6 -0
  31. package/dist/templates/plugin-starter/cypress.config.ts +18 -0
  32. package/dist/templates/plugin-starter/index.html +13 -0
  33. package/dist/templates/plugin-starter/package.json +95 -0
  34. package/dist/templates/plugin-starter/postcss.config.js +3 -0
  35. package/dist/templates/plugin-starter/scripts/test-e2e-manual.js +201 -0
  36. package/dist/templates/plugin-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +404 -0
  37. package/dist/templates/plugin-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +287 -0
  38. package/dist/templates/plugin-starter/src/__tests__/cypress/support/commands.ts +38 -0
  39. package/dist/templates/plugin-starter/src/__tests__/cypress/support/component-index.html +11 -0
  40. package/dist/templates/plugin-starter/src/__tests__/cypress/support/component.ts +33 -0
  41. package/dist/templates/plugin-starter/src/__tests__/cypress/support/e2e.ts +11 -0
  42. package/dist/templates/plugin-starter/src/__tests__/cypress/tsconfig.json +10 -0
  43. package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +47 -0
  44. package/dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts +320 -0
  45. package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/integration.test.ts +22 -17
  46. package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/plugin.test.ts +8 -8
  47. package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/test-utils.ts +17 -17
  48. package/dist/templates/plugin-starter/src/frontend/index.css +77 -0
  49. package/dist/templates/plugin-starter/src/frontend/index.tsx +164 -0
  50. package/dist/templates/plugin-starter/src/frontend/utils.ts +6 -0
  51. package/dist/templates/plugin-starter/src/index.ts +274 -0
  52. package/dist/templates/plugin-starter/src/tests.ts +6 -0
  53. package/dist/templates/plugin-starter/tailwind.config.js +62 -0
  54. package/dist/templates/plugin-starter/tsconfig.build.json +11 -0
  55. package/dist/templates/plugin-starter/tsconfig.json +28 -0
  56. package/dist/templates/plugin-starter/tsup.config.ts +20 -0
  57. package/dist/templates/plugin-starter/vite.config.ts +20 -0
  58. package/dist/templates/project-starter/.env.example +153 -0
  59. package/dist/templates/project-starter/README.md +109 -0
  60. package/dist/templates/project-starter/bunfig.toml +6 -0
  61. package/dist/templates/project-starter/cypress.config.ts +31 -0
  62. package/dist/templates/project-starter/index.html +13 -0
  63. package/dist/templates/project-starter/package.json +83 -0
  64. package/dist/templates/project-starter/postcss.config.js +3 -0
  65. package/dist/templates/project-starter/scripts/test-all.sh +101 -0
  66. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/actions.test.ts +6 -6
  67. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/character.test.ts +3 -3
  68. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/config.test.ts +18 -18
  69. package/dist/templates/project-starter/src/__tests__/cypress/component/Accessibility.cy.tsx +271 -0
  70. package/dist/templates/project-starter/src/__tests__/cypress/component/ApiIntegration.cy.tsx +220 -0
  71. package/dist/templates/project-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +146 -0
  72. package/dist/templates/project-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +51 -0
  73. package/dist/templates/project-starter/src/__tests__/cypress/e2e/agent-chat.cy.ts +235 -0
  74. package/dist/templates/project-starter/src/__tests__/cypress/e2e/dashboard.cy.ts +146 -0
  75. package/dist/templates/project-starter/src/__tests__/cypress/e2e/user-workflow.cy.ts +257 -0
  76. package/dist/templates/project-starter/src/__tests__/cypress/support/commands.ts +44 -0
  77. package/dist/templates/project-starter/src/__tests__/cypress/support/component-index.html +11 -0
  78. package/dist/templates/project-starter/src/__tests__/cypress/support/component.ts +33 -0
  79. package/dist/templates/project-starter/src/__tests__/cypress/support/e2e.ts +179 -0
  80. package/dist/templates/project-starter/src/__tests__/e2e/index.ts +14 -0
  81. package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +246 -0
  82. package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +155 -0
  83. package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +421 -0
  84. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/env.test.ts +2 -2
  85. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/error-handling.test.ts +17 -17
  86. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/events.test.ts +7 -7
  87. package/dist/templates/project-starter/src/__tests__/file-structure.test.ts +135 -0
  88. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/integration.test.ts +25 -25
  89. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/models.test.ts +6 -6
  90. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/plugin.test.ts +9 -9
  91. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/provider.test.ts +7 -7
  92. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/routes.test.ts +3 -3
  93. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/test-utils.ts +17 -17
  94. package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/utils/core-test-utils.ts +3 -3
  95. package/dist/templates/project-starter/src/frontend/index.css +77 -0
  96. package/dist/templates/project-starter/src/frontend/index.html +19 -0
  97. package/dist/templates/project-starter/src/frontend/index.tsx +98 -0
  98. package/dist/templates/project-starter/src/frontend/utils.ts +6 -0
  99. package/dist/templates/project-starter/src/index.ts +153 -0
  100. package/dist/templates/project-starter/src/plugin.ts +255 -0
  101. package/dist/templates/project-starter/tailwind.config.js +62 -0
  102. package/dist/templates/project-starter/tsconfig.build.json +20 -0
  103. package/dist/templates/project-starter/tsconfig.json +39 -0
  104. package/dist/templates/project-starter/tsup.config.ts +19 -0
  105. package/dist/templates/project-starter/vite.config.ts +39 -0
  106. package/dist/templates/project-tee-starter/.dockerignore +20 -0
  107. package/dist/templates/project-tee-starter/.env.example +55 -0
  108. package/dist/templates/project-tee-starter/Dockerfile +66 -0
  109. package/dist/templates/project-tee-starter/GUIDE.md +235 -0
  110. package/dist/templates/project-tee-starter/README.md +173 -0
  111. package/dist/templates/project-tee-starter/__tests__/actions.test.ts +9 -0
  112. package/dist/templates/project-tee-starter/__tests__/character.test.ts +86 -0
  113. package/dist/templates/project-tee-starter/__tests__/config.test.ts +31 -0
  114. package/dist/templates/project-tee-starter/__tests__/env.test.ts +87 -0
  115. package/dist/templates/project-tee-starter/__tests__/error-handling.test.ts +30 -0
  116. package/dist/templates/project-tee-starter/__tests__/events.test.ts +21 -0
  117. package/{templates/project-starter → dist/templates/project-tee-starter}/__tests__/file-structure.test.ts +6 -6
  118. package/dist/templates/project-tee-starter/__tests__/integration.test.ts +205 -0
  119. package/dist/templates/project-tee-starter/__tests__/models.test.ts +22 -0
  120. package/dist/templates/project-tee-starter/__tests__/plugin.test.ts +38 -0
  121. package/dist/templates/project-tee-starter/__tests__/provider.test.ts +189 -0
  122. package/dist/templates/project-tee-starter/__tests__/routes.test.ts +21 -0
  123. package/dist/templates/project-tee-starter/__tests__/test-utils.ts +121 -0
  124. package/dist/templates/project-tee-starter/__tests__/utils/core-test-utils.ts +167 -0
  125. package/dist/templates/project-tee-starter/assets/mr-tee-portrait.jpg +0 -0
  126. package/dist/templates/project-tee-starter/bunfig.toml +6 -0
  127. package/dist/templates/project-tee-starter/docker-compose.yaml +57 -0
  128. package/dist/templates/project-tee-starter/e2e/project.test.ts +38 -0
  129. package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +92 -0
  130. package/dist/templates/project-tee-starter/package.json +74 -0
  131. package/dist/templates/project-tee-starter/src/character.ts +257 -0
  132. package/dist/templates/project-tee-starter/src/index.ts +33 -0
  133. package/dist/templates/project-tee-starter/src/plugin.ts +169 -0
  134. package/dist/templates/project-tee-starter/tsconfig.build.json +13 -0
  135. package/dist/templates/project-tee-starter/tsconfig.json +30 -0
  136. package/dist/templates/project-tee-starter/tsup.config.ts +19 -0
  137. package/dist/{utils-DIZZ3HNZ.js → utils-TIALZU53.js} +9 -8
  138. package/package.json +29 -12
  139. package/templates/plugin-starter/README.md +38 -13
  140. package/templates/plugin-starter/bunfig.toml +6 -0
  141. package/templates/plugin-starter/cypress.config.ts +18 -0
  142. package/templates/plugin-starter/index.html +13 -0
  143. package/templates/plugin-starter/package.json +19 -7
  144. package/templates/plugin-starter/postcss.config.js +3 -0
  145. package/templates/plugin-starter/scripts/test-e2e-manual.js +201 -0
  146. package/templates/plugin-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +404 -0
  147. package/templates/plugin-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +287 -0
  148. package/templates/plugin-starter/src/__tests__/cypress/support/commands.ts +38 -0
  149. package/templates/plugin-starter/src/__tests__/cypress/support/component-index.html +11 -0
  150. package/templates/plugin-starter/src/__tests__/cypress/support/component.ts +33 -0
  151. package/templates/plugin-starter/src/__tests__/cypress/support/e2e.ts +11 -0
  152. package/templates/plugin-starter/src/__tests__/cypress/tsconfig.json +10 -0
  153. package/templates/plugin-starter/src/__tests__/e2e/README.md +47 -0
  154. package/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts +320 -0
  155. package/templates/plugin-starter/src/__tests__/integration.test.ts +138 -0
  156. package/templates/plugin-starter/src/__tests__/plugin.test.ts +182 -0
  157. package/templates/plugin-starter/src/__tests__/test-utils.ts +162 -0
  158. package/templates/plugin-starter/src/frontend/index.css +77 -0
  159. package/templates/plugin-starter/src/frontend/index.tsx +164 -0
  160. package/templates/plugin-starter/src/frontend/utils.ts +6 -0
  161. package/templates/plugin-starter/src/index.ts +31 -8
  162. package/templates/plugin-starter/src/tests.ts +6 -0
  163. package/templates/plugin-starter/tailwind.config.js +62 -0
  164. package/templates/plugin-starter/tsconfig.json +8 -8
  165. package/templates/plugin-starter/vite.config.ts +20 -0
  166. package/templates/project-starter/bunfig.toml +6 -0
  167. package/templates/project-starter/cypress.config.ts +31 -0
  168. package/templates/project-starter/index.html +13 -0
  169. package/templates/project-starter/package.json +37 -14
  170. package/templates/project-starter/postcss.config.js +3 -0
  171. package/templates/project-starter/scripts/test-all.sh +101 -0
  172. package/templates/project-starter/src/__tests__/actions.test.ts +155 -0
  173. package/templates/project-starter/src/__tests__/character.test.ts +86 -0
  174. package/templates/project-starter/src/__tests__/config.test.ts +193 -0
  175. package/templates/project-starter/src/__tests__/cypress/component/Accessibility.cy.tsx +271 -0
  176. package/templates/project-starter/src/__tests__/cypress/component/ApiIntegration.cy.tsx +220 -0
  177. package/templates/project-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +146 -0
  178. package/templates/project-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +51 -0
  179. package/templates/project-starter/src/__tests__/cypress/e2e/agent-chat.cy.ts +235 -0
  180. package/templates/project-starter/src/__tests__/cypress/e2e/dashboard.cy.ts +146 -0
  181. package/templates/project-starter/src/__tests__/cypress/e2e/user-workflow.cy.ts +257 -0
  182. package/templates/project-starter/src/__tests__/cypress/support/commands.ts +44 -0
  183. package/templates/project-starter/src/__tests__/cypress/support/component-index.html +11 -0
  184. package/templates/project-starter/src/__tests__/cypress/support/component.ts +33 -0
  185. package/templates/project-starter/src/__tests__/cypress/support/e2e.ts +179 -0
  186. package/templates/project-starter/src/__tests__/e2e/index.ts +14 -0
  187. package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +246 -0
  188. package/templates/project-starter/src/__tests__/e2e/project.test.ts +155 -0
  189. package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +421 -0
  190. package/templates/project-starter/src/__tests__/env.test.ts +87 -0
  191. package/templates/project-starter/src/__tests__/error-handling.test.ts +177 -0
  192. package/templates/project-starter/src/__tests__/events.test.ts +144 -0
  193. package/templates/project-starter/src/__tests__/file-structure.test.ts +135 -0
  194. package/templates/project-starter/src/__tests__/integration.test.ts +209 -0
  195. package/templates/project-starter/src/__tests__/models.test.ts +152 -0
  196. package/templates/project-starter/src/__tests__/plugin.test.ts +393 -0
  197. package/templates/project-starter/src/__tests__/provider.test.ts +325 -0
  198. package/templates/project-starter/src/__tests__/routes.test.ts +79 -0
  199. package/templates/project-starter/src/__tests__/test-utils.ts +121 -0
  200. package/templates/project-starter/src/__tests__/utils/core-test-utils.ts +180 -0
  201. package/templates/project-starter/src/frontend/index.css +77 -0
  202. package/templates/project-starter/src/frontend/index.html +19 -0
  203. package/templates/project-starter/src/frontend/index.tsx +98 -0
  204. package/templates/project-starter/src/frontend/utils.ts +6 -0
  205. package/templates/project-starter/src/index.ts +9 -1
  206. package/templates/project-starter/tailwind.config.js +62 -0
  207. package/templates/project-starter/tsconfig.build.json +9 -2
  208. package/templates/project-starter/tsconfig.json +15 -6
  209. package/templates/project-starter/tsup.config.ts +1 -1
  210. package/templates/project-starter/vite.config.ts +39 -0
  211. package/templates/project-tee-starter/__tests__/actions.test.ts +1 -1
  212. package/templates/project-tee-starter/__tests__/character.test.ts +1 -1
  213. package/templates/project-tee-starter/__tests__/config.test.ts +1 -1
  214. package/templates/project-tee-starter/__tests__/env.test.ts +2 -2
  215. package/templates/project-tee-starter/__tests__/error-handling.test.ts +1 -1
  216. package/templates/project-tee-starter/__tests__/events.test.ts +1 -1
  217. package/templates/project-tee-starter/__tests__/file-structure.test.ts +5 -5
  218. package/templates/project-tee-starter/__tests__/integration.test.ts +22 -26
  219. package/templates/project-tee-starter/__tests__/models.test.ts +1 -1
  220. package/templates/project-tee-starter/__tests__/plugin.test.ts +6 -12
  221. package/templates/project-tee-starter/__tests__/provider.test.ts +6 -6
  222. package/templates/project-tee-starter/__tests__/routes.test.ts +1 -1
  223. package/templates/project-tee-starter/__tests__/test-utils.ts +15 -15
  224. package/templates/project-tee-starter/__tests__/utils/core-test-utils.ts +3 -3
  225. package/templates/project-tee-starter/bunfig.toml +6 -0
  226. package/templates/project-tee-starter/package.json +10 -12
  227. package/dist/assets/index-CZAd5zm2.js.br +0 -0
  228. package/dist/assets/index-CZAd5zm2.js.map +0 -1
  229. package/dist/assets/index-DyA-lndn.css +0 -1
  230. package/dist/assets/index-DyA-lndn.css.br +0 -0
  231. package/dist/chunk-CEE6RKN5.js +0 -2746
  232. package/dist/chunk-MA2ZXPG6.js +0 -260
  233. package/dist/chunk-TUAYJIF2.js +0 -3649
  234. package/dist/lib-NAGYZHVV.js +0 -9
  235. package/dist/plugin-creator-IC42XOHG.js +0 -29165
  236. package/templates/plugin-starter/e2e/starter-plugin.test.ts +0 -171
  237. package/templates/plugin-starter/images/README.md +0 -24
  238. package/templates/plugin-starter/vitest.config.ts +0 -16
  239. package/templates/project-starter/e2e/project.test.ts +0 -34
  240. package/templates/project-starter/e2e/starter-plugin.test.ts +0 -217
  241. package/templates/project-starter/vitest.config.ts +0 -16
  242. package/templates/project-tee-starter/vitest.config.ts +0 -19
@@ -0,0 +1,79 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import plugin from '../plugin';
3
+
4
+ describe('Plugin Routes', () => {
5
+ it('should have routes defined', () => {
6
+ expect(plugin.routes).toBeDefined();
7
+ if (plugin.routes) {
8
+ expect(Array.isArray(plugin.routes)).toBe(true);
9
+ expect(plugin.routes.length).toBeGreaterThan(0);
10
+ }
11
+ });
12
+
13
+ it('should have a route for /helloworld', () => {
14
+ if (plugin.routes) {
15
+ const helloWorldRoute = plugin.routes.find((route) => route.path === '/helloworld');
16
+ expect(helloWorldRoute).toBeDefined();
17
+
18
+ if (helloWorldRoute) {
19
+ expect(helloWorldRoute.type).toBe('GET');
20
+ expect(typeof helloWorldRoute.handler).toBe('function');
21
+ }
22
+ }
23
+ });
24
+
25
+ it('should handle route requests correctly', async () => {
26
+ if (plugin.routes) {
27
+ const helloWorldRoute = plugin.routes.find((route) => route.path === '/helloworld');
28
+
29
+ if (helloWorldRoute && helloWorldRoute.handler) {
30
+ // Create mock request and response objects
31
+ const mockReq = {};
32
+ const mockRes = {
33
+ json: spyOnfn(),
34
+ };
35
+
36
+ // Mock runtime object as third parameter
37
+ const mockRuntime = {} as any;
38
+
39
+ // Call the route handler
40
+ await helloWorldRoute.handler(mockReq, mockRes, mockRuntime);
41
+
42
+ // Verify response
43
+ expect(mockRes.json).toHaveBeenCalledTimes(1);
44
+ expect(mockRes.json).toHaveBeenCalledWith({
45
+ message: 'Hello World!',
46
+ });
47
+ }
48
+ }
49
+ });
50
+
51
+ it('should validate route structure', () => {
52
+ if (plugin.routes) {
53
+ // Validate each route
54
+ plugin.routes.forEach((route) => {
55
+ expect(route).toHaveProperty('path');
56
+ expect(route).toHaveProperty('type');
57
+ expect(route).toHaveProperty('handler');
58
+
59
+ // Path should be a string starting with /
60
+ expect(typeof route.path).toBe('string');
61
+ expect(route.path.startsWith('/')).toBe(true);
62
+
63
+ // Type should be a valid HTTP method
64
+ expect(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).toContain(route.type);
65
+
66
+ // Handler should be a function
67
+ expect(typeof route.handler).toBe('function');
68
+ });
69
+ }
70
+ });
71
+
72
+ it('should have unique route paths', () => {
73
+ if (plugin.routes) {
74
+ const paths = plugin.routes.map((route) => route.path);
75
+ const uniquePaths = new Set(paths);
76
+ expect(paths.length).toBe(uniquePaths.size);
77
+ }
78
+ });
79
+ });
@@ -0,0 +1,121 @@
1
+ import { mock, spyOn } from 'bun:test';
2
+ import { Content, IAgentRuntime, Memory, State, logger } from '@elizaos/core';
3
+ import {
4
+ createMockRuntime as createCoreMockRuntime,
5
+ createMockMessage as createCoreMockMessage,
6
+ createMockState as createCoreMockState,
7
+ documentTestResult,
8
+ runCoreActionTests,
9
+ } from './utils/core-test-utils';
10
+ import { character } from '../index';
11
+ import plugin from '../plugin';
12
+
13
+ /**
14
+ * Creates an enhanced mock runtime for testing that includes the project's
15
+ * character and plugin
16
+ *
17
+ * @param overrides - Optional overrides for the default mock methods and properties
18
+ * @returns A mock runtime for testing
19
+ */
20
+ export function createMockRuntime(overrides: Partial<IAgentRuntime> = {}): IAgentRuntime {
21
+ // Create base mock runtime with default core utilities
22
+ const baseRuntime = createCoreMockRuntime();
23
+
24
+ // Enhance with project-specific configuration
25
+ const mockRuntime = {
26
+ ...baseRuntime,
27
+ character: character,
28
+ plugins: [plugin],
29
+ registerPlugin: mock(),
30
+ initialize: mock(),
31
+ getService: mock(),
32
+ getSetting: mock().mockReturnValue(null),
33
+ useModel: mock().mockResolvedValue('Test model response'),
34
+ getProviderResults: mock().mockResolvedValue([]),
35
+ evaluateProviders: mock().mockResolvedValue([]),
36
+ evaluate: mock().mockResolvedValue([]),
37
+ ...overrides,
38
+ } as unknown as IAgentRuntime;
39
+
40
+ return mockRuntime;
41
+ }
42
+
43
+ /**
44
+ * Creates a mock Message object for testing
45
+ *
46
+ * @param text - The message text
47
+ * @param overrides - Optional overrides for the default memory properties
48
+ * @returns A mock memory object
49
+ */
50
+ export function createMockMessage(text: string, overrides: Partial<Memory> = {}): Memory {
51
+ const baseMessage = createCoreMockMessage(text);
52
+ return {
53
+ ...baseMessage,
54
+ ...overrides,
55
+ };
56
+ }
57
+
58
+ /**
59
+ * Creates a mock State object for testing
60
+ *
61
+ * @param overrides - Optional overrides for the default state properties
62
+ * @returns A mock state object
63
+ */
64
+ export function createMockState(overrides: Partial<State> = {}): State {
65
+ const baseState = createCoreMockState();
66
+ return {
67
+ ...baseState,
68
+ ...overrides,
69
+ };
70
+ }
71
+
72
+ /**
73
+ * Creates a standardized setup for testing with consistent mock objects
74
+ *
75
+ * @param overrides - Optional overrides for default mock implementations
76
+ * @returns An object containing mockRuntime, mockMessage, mockState, and callbackFn
77
+ */
78
+ export function setupTest(
79
+ options: {
80
+ messageText?: string;
81
+ messageOverrides?: Partial<Memory>;
82
+ runtimeOverrides?: Partial<IAgentRuntime>;
83
+ stateOverrides?: Partial<State>;
84
+ } = {}
85
+ ) {
86
+ // Create mock callback function
87
+ const callbackFn = mock();
88
+
89
+ // Create a message
90
+ const mockMessage = createMockMessage(
91
+ options.messageText || 'Test message',
92
+ options.messageOverrides || {}
93
+ );
94
+
95
+ // Create a state object
96
+ const mockState = createMockState(options.stateOverrides || {});
97
+
98
+ // Create a mock runtime
99
+ const mockRuntime = createMockRuntime(options.runtimeOverrides || {});
100
+
101
+ return {
102
+ mockRuntime,
103
+ mockMessage,
104
+ mockState,
105
+ callbackFn,
106
+ };
107
+ }
108
+
109
+ // Export other utility functions
110
+ export { documentTestResult, runCoreActionTests };
111
+
112
+ // Add spy on logger for common usage in tests
113
+ export function setupLoggerSpies() {
114
+ spyOn(logger, 'info').mockImplementation(() => {});
115
+ spyOn(logger, 'error').mockImplementation(() => {});
116
+ spyOn(logger, 'warn').mockImplementation(() => {});
117
+ spyOn(logger, 'debug').mockImplementation(() => {});
118
+
119
+ // allow tests to restore originals
120
+ return () => mock.restore();
121
+ }
@@ -0,0 +1,180 @@
1
+ import { mock } from 'bun:test';
2
+ import { composeActionExamples, formatActionNames, formatActions } from '@elizaos/core';
3
+ import type { Action, Content, IAgentRuntime, Memory, State } from '@elizaos/core';
4
+ import { logger } from '@elizaos/core';
5
+ import { v4 as uuidv4 } from 'uuid';
6
+
7
+ /**
8
+ * Utility functions for reusing core package tests in project-starter tests
9
+ */
10
+
11
+ /**
12
+ * Runs core package action tests against the provided actions
13
+ * @param actions The actions to test
14
+ */
15
+ export const runCoreActionTests = (actions: Action[]) => {
16
+ // Validate action structure (similar to core tests)
17
+ for (const action of actions) {
18
+ if (!action.name) {
19
+ throw new Error('Action missing name property');
20
+ }
21
+ if (!action.description) {
22
+ throw new Error(`Action ${action.name} missing description property`);
23
+ }
24
+ if (!action.examples || !Array.isArray(action.examples)) {
25
+ throw new Error(`Action ${action.name} missing examples array`);
26
+ }
27
+ if (!action.similes || !Array.isArray(action.similes)) {
28
+ throw new Error(`Action ${action.name} missing similes array`);
29
+ }
30
+ if (typeof action.handler !== 'function') {
31
+ throw new Error(`Action ${action.name} missing handler function`);
32
+ }
33
+ if (typeof action.validate !== 'function') {
34
+ throw new Error(`Action ${action.name} missing validate function`);
35
+ }
36
+ }
37
+
38
+ // Validate example structure
39
+ for (const action of actions) {
40
+ for (const example of action.examples ?? []) {
41
+ for (const message of example) {
42
+ if (!message.name) {
43
+ throw new Error(`Example message in action ${action.name} missing name property`);
44
+ }
45
+ if (!message.content) {
46
+ throw new Error(`Example message in action ${action.name} missing content property`);
47
+ }
48
+ if (!message.content.text) {
49
+ throw new Error(`Example message in action ${action.name} missing content.text property`);
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ // Validate uniqueness of action names
56
+ const names = actions.map((action) => action.name);
57
+ const uniqueNames = new Set(names);
58
+ if (names.length !== uniqueNames.size) {
59
+ throw new Error('Duplicate action names found');
60
+ }
61
+
62
+ // Test action formatting
63
+ const formattedNames = formatActionNames(actions);
64
+ if (!formattedNames && actions.length > 0) {
65
+ throw new Error('formatActionNames failed to produce output');
66
+ }
67
+
68
+ const formattedActions = formatActions(actions);
69
+ if (!formattedActions && actions.length > 0) {
70
+ throw new Error('formatActions failed to produce output');
71
+ }
72
+
73
+ const composedExamples = composeActionExamples(actions, 1);
74
+ if (!composedExamples && actions.length > 0) {
75
+ throw new Error('composeActionExamples failed to produce output');
76
+ }
77
+
78
+ return {
79
+ formattedNames,
80
+ formattedActions,
81
+ composedExamples,
82
+ };
83
+ };
84
+
85
+ /**
86
+ * Creates a mock runtime for testing
87
+ */
88
+ export const createMockRuntime = (): IAgentRuntime => {
89
+ return {
90
+ character: {
91
+ name: 'Test Character',
92
+ system: 'You are a helpful assistant for testing.',
93
+ },
94
+ getSetting: (key: string) => null,
95
+ // Include real model functionality
96
+ models: {},
97
+ // Add real database functionality
98
+ db: {
99
+ get: async () => null,
100
+ set: async () => true,
101
+ delete: async () => true,
102
+ getKeys: async () => [],
103
+ },
104
+ // Add real memory functionality
105
+ memory: {
106
+ add: async () => {},
107
+ get: async () => null,
108
+ getByEntityId: async () => [],
109
+ getLatest: async () => null,
110
+ getRecentMessages: async () => [],
111
+ search: async () => [],
112
+ },
113
+ actions: [],
114
+ providers: [],
115
+ getService: mock(),
116
+ processActions: mock(),
117
+ } as any as IAgentRuntime;
118
+ };
119
+
120
+ /**
121
+ * Documents test results for logging and debugging
122
+ */
123
+ export const documentTestResult = (testName: string, result: any, error: Error | null = null) => {
124
+ // Clean, useful test documentation for developers
125
+ logger.info(`✓ Testing: ${testName}`);
126
+
127
+ if (error) {
128
+ logger.error(`✗ Error: ${error.message}`);
129
+ if (error.stack) {
130
+ logger.error(`Stack: ${error.stack}`);
131
+ }
132
+ return;
133
+ }
134
+
135
+ if (result) {
136
+ if (typeof result === 'string') {
137
+ if (result.trim() && result.length > 0) {
138
+ const preview = result.length > 60 ? `${result.substring(0, 60)}...` : result;
139
+ logger.info(` → ${preview}`);
140
+ }
141
+ } else if (typeof result === 'object') {
142
+ try {
143
+ // Show key information in a clean format
144
+ const keys = Object.keys(result);
145
+ if (keys.length > 0) {
146
+ const preview = keys.slice(0, 3).join(', ');
147
+ const more = keys.length > 3 ? ` +${keys.length - 3} more` : '';
148
+ logger.info(` → {${preview}${more}}`);
149
+ }
150
+ } catch (e) {
151
+ logger.info(` → [Complex object]`);
152
+ }
153
+ }
154
+ }
155
+ };
156
+
157
+ /**
158
+ * Creates a mock message for testing
159
+ */
160
+ export const createMockMessage = (text: string): Memory => {
161
+ return {
162
+ entityId: uuidv4(),
163
+ roomId: uuidv4(),
164
+ content: {
165
+ text,
166
+ source: 'test',
167
+ },
168
+ } as Memory;
169
+ };
170
+
171
+ /**
172
+ * Creates a mock state for testing
173
+ */
174
+ export const createMockState = (): State => {
175
+ return {
176
+ values: {},
177
+ data: {},
178
+ text: '',
179
+ };
180
+ };
@@ -0,0 +1,77 @@
1
+ @import 'tailwindcss';
2
+ @config "../../tailwind.config.js";
3
+
4
+ @layer base {
5
+ :root {
6
+ --background: 0 0% 97.65%;
7
+ --foreground: 0 0% 12.55%;
8
+ --muted: 0 0% 93.73%;
9
+ --muted-foreground: 0 0% 39.22%;
10
+ --popover: 0 0% 98.82%;
11
+ --popover-foreground: 0 0% 12.55%;
12
+ --card: 0 0% 98.82%;
13
+ --card-foreground: 0 0% 12.55%;
14
+ --border: 0 0% 84.71%;
15
+ --input: 0 0% 94.12%;
16
+ --primary: 22.93 92.59% 52.35%;
17
+ --primary-foreground: 44 0% 100%;
18
+ --secondary: 34.05 100% 85.49%;
19
+ --secondary-foreground: 16.27 50.43% 22.94%;
20
+ --accent: 0 0% 90.98%;
21
+ --accent-foreground: 0 0% 12.55%;
22
+ --destructive: 10.16 77.87% 53.92%;
23
+ --destructive-foreground: 0 0% 100%;
24
+ --ring: 24.8 79.79% 63.14%;
25
+ --chart-1: 22.93 92.59% 52.35%;
26
+ --chart-2: 34.05 100% 85.49%;
27
+ --chart-3: 0 0% 90.98%;
28
+ --chart-4: 34.05 100% 88.49%;
29
+ --chart-5: 22.93 95.59% 52.35%;
30
+ --radius: 0.5rem;
31
+ }
32
+
33
+ .dark {
34
+ --background: 0 0% 6.67%;
35
+ --foreground: 0 0% 93.33%;
36
+ --muted: 0 0% 13.33%;
37
+ --muted-foreground: 0 0% 70.59%;
38
+ --popover: 0 0% 9.8%;
39
+ --popover-foreground: 0 0% 93.33%;
40
+ --card: 0 0% 9.8%;
41
+ --card-foreground: 0 0% 93.33%;
42
+ --border: 44 14% 11%;
43
+ --input: 0 0% 28.24%;
44
+ --primary: 22.93 92.59% 52.35%;
45
+ --primary-foreground: 29.51 0% 100%;
46
+ --secondary: 28.5 64.52% 12.16%;
47
+ --secondary-foreground: 29.51 100% 88.04%;
48
+ --accent: 0 0% 16.47%;
49
+ --accent-foreground: 0 0% 93.33%;
50
+ --destructive: 10.16 77.87% 53.92%;
51
+ --destructive-foreground: 0 0% 100%;
52
+ --ring: 23.11 59.8% 40%;
53
+ --chart-1: 22.93 92.59% 52.35%;
54
+ --chart-2: 28.5 64.52% 12.16%;
55
+ --chart-3: 0 0% 16.47%;
56
+ --chart-4: 28.5 64.52% 15.16%;
57
+ --chart-5: 22.93 95.59% 52.35%;
58
+ }
59
+ }
60
+
61
+ @layer base {
62
+ * {
63
+ @apply border-border;
64
+ }
65
+ body {
66
+ @apply bg-background text-foreground;
67
+ }
68
+ }
69
+
70
+ /* Force dark mode */
71
+ :root {
72
+ color-scheme: dark;
73
+ }
74
+
75
+ body {
76
+ @apply font-mono bg-background text-foreground;
77
+ }
@@ -0,0 +1,19 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>ElizaOS Frontend</title>
7
+ <script>
8
+ // This will be injected by the server in production
9
+ window.ELIZA_CONFIG = {
10
+ agentId: 'test-agent-id',
11
+ apiBase: 'http://localhost:3000',
12
+ };
13
+ </script>
14
+ </head>
15
+ <body>
16
+ <div id="root"></div>
17
+ <script type="module" src="/index.tsx"></script>
18
+ </body>
19
+ </html>
@@ -0,0 +1,98 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
+ import { createRoot } from 'react-dom/client';
3
+ import './index.css';
4
+ import React from 'react';
5
+ import type { UUID } from '@elizaos/core';
6
+
7
+ const queryClient = new QueryClient();
8
+
9
+ // Define the interface for the ELIZA_CONFIG
10
+ interface ElizaConfig {
11
+ agentId: string;
12
+ apiBase: string;
13
+ }
14
+
15
+ // Declare global window extension for TypeScript
16
+ declare global {
17
+ interface Window {
18
+ ELIZA_CONFIG?: ElizaConfig;
19
+ }
20
+ }
21
+
22
+ /**
23
+ * Main Example route component
24
+ */
25
+ function ExampleRoute() {
26
+ const config = window.ELIZA_CONFIG;
27
+ const agentId = config?.agentId;
28
+
29
+ // Apply dark mode to the root element
30
+ React.useEffect(() => {
31
+ document.documentElement.classList.add('dark');
32
+ }, []);
33
+
34
+ if (!agentId) {
35
+ return (
36
+ <div className="p-4 text-center">
37
+ <div className="text-red-600 font-medium">Error: Agent ID not found</div>
38
+ <div className="text-sm text-gray-600 mt-2">
39
+ The server should inject the agent ID configuration.
40
+ </div>
41
+ </div>
42
+ );
43
+ }
44
+
45
+ return <ExampleProvider agentId={agentId as UUID} />;
46
+ }
47
+
48
+ /**
49
+ * Example provider component
50
+ */
51
+ function ExampleProvider({ agentId }: { agentId: UUID }) {
52
+ return (
53
+ <QueryClientProvider client={queryClient}>
54
+ <div>Hello {agentId}</div>
55
+ </QueryClientProvider>
56
+ );
57
+ }
58
+
59
+ // Initialize the application - no router needed for iframe
60
+ const rootElement = document.getElementById('root');
61
+ if (rootElement) {
62
+ createRoot(rootElement).render(<ExampleRoute />);
63
+ }
64
+
65
+ // Define types for integration with agent UI system
66
+ export interface AgentPanel {
67
+ name: string;
68
+ path: string;
69
+ component: React.ComponentType<any>;
70
+ icon?: string;
71
+ public?: boolean;
72
+ shortLabel?: string; // Optional short label for mobile
73
+ }
74
+
75
+ interface PanelProps {
76
+ agentId: string;
77
+ }
78
+
79
+ /**
80
+ * Example panel component for the plugin system
81
+ */
82
+ const PanelComponent: React.FC<PanelProps> = ({ agentId }) => {
83
+ return <div>Helllo {agentId}!</div>;
84
+ };
85
+
86
+ // Export the panel configuration for integration with the agent UI
87
+ export const panels: AgentPanel[] = [
88
+ {
89
+ name: 'Example',
90
+ path: 'example',
91
+ component: PanelComponent,
92
+ icon: 'Book',
93
+ public: false,
94
+ shortLabel: 'Example',
95
+ },
96
+ ];
97
+
98
+ export * from './utils';
@@ -0,0 +1,6 @@
1
+ import { type ClassValue, clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
@@ -21,7 +21,12 @@ export const character: Character = {
21
21
  ...(process.env.OPENAI_API_KEY ? ['@elizaos/plugin-openai'] : []),
22
22
  ...(!process.env.OPENAI_API_KEY ? ['@elizaos/plugin-local-ai'] : []),
23
23
  ...(process.env.DISCORD_API_TOKEN ? ['@elizaos/plugin-discord'] : []),
24
- ...(process.env.TWITTER_USERNAME ? ['@elizaos/plugin-twitter'] : []),
24
+ ...(process.env.TWITTER_API_KEY &&
25
+ process.env.TWITTER_API_SECRET_KEY &&
26
+ process.env.TWITTER_ACCESS_TOKEN &&
27
+ process.env.TWITTER_ACCESS_TOKEN_SECRET
28
+ ? ['@elizaos/plugin-twitter']
29
+ : []),
25
30
  ...(process.env.TELEGRAM_BOT_TOKEN ? ['@elizaos/plugin-telegram'] : []),
26
31
  ...(!process.env.IGNORE_BOOTSTRAP ? ['@elizaos/plugin-bootstrap'] : []),
27
32
  ],
@@ -142,4 +147,7 @@ const project: Project = {
142
147
  agents: [projectAgent],
143
148
  };
144
149
 
150
+ // Export test suites for the test runner
151
+ export { testSuites } from './__tests__/e2e';
152
+
145
153
  export default project;
@@ -0,0 +1,62 @@
1
+ import tailwindcssAnimate from 'tailwindcss-animate';
2
+
3
+ /** @type {import('tailwindcss').Config} */
4
+ export default {
5
+ darkMode: ['class'],
6
+ content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
7
+ theme: {
8
+ extend: {
9
+ container: {
10
+ center: true,
11
+ },
12
+ borderRadius: {
13
+ lg: 'var(--radius)',
14
+ md: 'calc(var(--radius) - 2px)',
15
+ sm: 'calc(var(--radius) - 4px)',
16
+ },
17
+ colors: {
18
+ background: 'hsl(var(--background))',
19
+ foreground: 'hsl(var(--foreground))',
20
+ card: {
21
+ DEFAULT: 'hsl(var(--card))',
22
+ foreground: 'hsl(var(--card-foreground))',
23
+ },
24
+ popover: {
25
+ DEFAULT: 'hsl(var(--popover))',
26
+ foreground: 'hsl(var(--popover-foreground))',
27
+ },
28
+ primary: {
29
+ DEFAULT: 'hsl(var(--primary))',
30
+ foreground: 'hsl(var(--primary-foreground))',
31
+ },
32
+ secondary: {
33
+ DEFAULT: 'hsl(var(--secondary))',
34
+ foreground: 'hsl(var(--secondary-foreground))',
35
+ },
36
+ muted: {
37
+ DEFAULT: 'hsl(var(--muted))',
38
+ foreground: 'hsl(var(--muted-foreground))',
39
+ },
40
+ accent: {
41
+ DEFAULT: 'hsl(var(--accent))',
42
+ foreground: 'hsl(var(--accent-foreground))',
43
+ },
44
+ destructive: {
45
+ DEFAULT: 'hsl(var(--destructive))',
46
+ foreground: 'hsl(var(--destructive-foreground))',
47
+ },
48
+ border: 'hsl(var(--border))',
49
+ input: 'hsl(var(--input))',
50
+ ring: 'hsl(var(--ring))',
51
+ chart: {
52
+ 1: 'hsl(var(--chart-1))',
53
+ 2: 'hsl(var(--chart-2))',
54
+ 3: 'hsl(var(--chart-3))',
55
+ 4: 'hsl(var(--chart-4))',
56
+ 5: 'hsl(var(--chart-5))',
57
+ },
58
+ },
59
+ },
60
+ },
61
+ plugins: [tailwindcssAnimate],
62
+ };
@@ -8,6 +8,13 @@
8
8
  "declaration": true,
9
9
  "emitDeclarationOnly": true
10
10
  },
11
- "include": ["src/**/*.ts"],
12
- "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
11
+ "include": ["src/index.ts", "src/plugin.ts", "src/frontend/**/*.ts", "src/frontend/**/*.tsx"],
12
+ "exclude": [
13
+ "node_modules",
14
+ "dist",
15
+ "**/*.test.ts",
16
+ "**/*.spec.ts",
17
+ "src/__tests__/**/*",
18
+ "src/**/cypress/**/*"
19
+ ]
13
20
  }