@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,287 @@
1
+ import React from 'react';
2
+ import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query';
3
+ import { panels } from '../../../frontend/index';
4
+
5
+ // Time response interface
6
+ interface TimeResponse {
7
+ timestamp: string;
8
+ unix: number;
9
+ formatted: string;
10
+ timezone: string;
11
+ }
12
+
13
+ // Enhanced Panel Component with time display
14
+ const EnhancedPanelComponent: React.FC<{ agentId: string }> = ({ agentId }) => {
15
+ const apiBase = window.ELIZA_CONFIG?.apiBase || 'http://localhost:3000';
16
+
17
+ const {
18
+ data: timeData,
19
+ isLoading,
20
+ error,
21
+ } = useQuery<TimeResponse>({
22
+ queryKey: ['panelTime', agentId],
23
+ queryFn: async () => {
24
+ const response = await fetch(`${apiBase}/api/time`);
25
+ if (!response.ok) {
26
+ throw new Error('Failed to fetch time');
27
+ }
28
+ return response.json();
29
+ },
30
+ refetchInterval: 5000, // Refresh every 5 seconds
31
+ });
32
+
33
+ return (
34
+ <div className="p-4 space-y-4">
35
+ <div>
36
+ <h2 className="text-lg font-semibold mb-2">Example Panel</h2>
37
+ <div>Hello {agentId}!</div>
38
+ </div>
39
+
40
+ <div className="border-t pt-4">
41
+ <h3 className="text-md font-medium mb-2">Server Time</h3>
42
+ {isLoading && <div className="text-gray-600">Loading time...</div>}
43
+ {error && <div className="text-red-600">Error loading time</div>}
44
+ {timeData && (
45
+ <div className="text-sm space-y-1">
46
+ <div>Time: {timeData.formatted}</div>
47
+ <div className="text-gray-600">Timezone: {timeData.timezone}</div>
48
+ </div>
49
+ )}
50
+ </div>
51
+ </div>
52
+ );
53
+ };
54
+
55
+ describe('PanelComponent Tests', () => {
56
+ // Get the Panel component from the exported panels
57
+ const PanelComponent = panels[0]?.component;
58
+
59
+ describe('Panel Registration', () => {
60
+ it('should export panels array with correct structure', () => {
61
+ expect(panels).to.be.an('array');
62
+ expect(panels).to.have.length.greaterThan(0);
63
+
64
+ const panel = panels[0];
65
+ expect(panel).to.have.property('name', 'Example');
66
+ expect(panel).to.have.property('path', 'example');
67
+ expect(panel).to.have.property('component');
68
+ expect(panel).to.have.property('icon', 'Book');
69
+ expect(panel).to.have.property('public', false);
70
+ expect(panel).to.have.property('shortLabel', 'Example');
71
+ });
72
+ });
73
+
74
+ describe('Component Rendering', () => {
75
+ it('should render with agent ID', () => {
76
+ const testAgentId = 'test-agent-12345';
77
+
78
+ if (!PanelComponent) {
79
+ throw new Error('PanelComponent not found in panels export');
80
+ }
81
+
82
+ cy.mount(<PanelComponent agentId={testAgentId} />);
83
+
84
+ // Updated to match the corrected text in the component
85
+ cy.contains(`Hello ${testAgentId}!`).should('be.visible');
86
+ });
87
+
88
+ it('should handle different agent IDs', () => {
89
+ const agentIds = ['agent-1', 'agent-2', '12345678-1234-1234-1234-123456789abc', 'test-agent'];
90
+
91
+ agentIds.forEach((agentId) => {
92
+ cy.mount(<PanelComponent agentId={agentId} />);
93
+ cy.contains(`Hello ${agentId}!`).should('be.visible');
94
+ });
95
+ });
96
+
97
+ it('should render without crashing with empty agent ID', () => {
98
+ cy.mount(<PanelComponent agentId="" />);
99
+ cy.contains('Hello !').should('be.visible');
100
+ });
101
+ });
102
+
103
+ describe('Enhanced Panel with Time Display', () => {
104
+ const queryClient = new QueryClient({
105
+ defaultOptions: {
106
+ queries: {
107
+ retry: false,
108
+ },
109
+ },
110
+ });
111
+
112
+ beforeEach(() => {
113
+ // Set up ELIZA_CONFIG for API testing
114
+ cy.window().then((win) => {
115
+ win.ELIZA_CONFIG = {
116
+ agentId: 'test-agent',
117
+ apiBase: 'http://localhost:3000',
118
+ };
119
+ });
120
+ });
121
+
122
+ it('should fetch and display time in panel', () => {
123
+ cy.intercept('GET', '**/api/time', {
124
+ statusCode: 200,
125
+ body: {
126
+ timestamp: '2024-01-01T12:00:00.000Z',
127
+ unix: 1704110400,
128
+ formatted: '1/1/2024, 12:00:00 PM',
129
+ timezone: 'America/New_York',
130
+ },
131
+ }).as('getPanelTime');
132
+
133
+ cy.mount(
134
+ <QueryClientProvider client={queryClient}>
135
+ <EnhancedPanelComponent agentId="test-panel-123" />
136
+ </QueryClientProvider>
137
+ );
138
+
139
+ // Wait for API call
140
+ cy.wait('@getPanelTime');
141
+
142
+ // Check panel content
143
+ cy.contains('Example Panel').should('be.visible');
144
+ cy.contains('Hello test-panel-123!').should('be.visible');
145
+
146
+ // Check time display
147
+ cy.contains('Server Time').should('be.visible');
148
+ cy.contains('Time: 1/1/2024, 12:00:00 PM').should('be.visible');
149
+ cy.contains('Timezone: America/New_York').should('be.visible');
150
+ });
151
+
152
+ it('should handle API errors in panel', () => {
153
+ cy.intercept('GET', '**/api/time', {
154
+ statusCode: 500,
155
+ body: { error: 'Server error' },
156
+ }).as('getPanelTimeError');
157
+
158
+ cy.mount(
159
+ <QueryClientProvider client={queryClient}>
160
+ <EnhancedPanelComponent agentId="test-panel-error" />
161
+ </QueryClientProvider>
162
+ );
163
+
164
+ // Wait for failed API call
165
+ cy.wait('@getPanelTimeError');
166
+
167
+ // Check error display
168
+ cy.contains('Error loading time').should('be.visible');
169
+ });
170
+
171
+ it('should show loading state in panel', () => {
172
+ cy.intercept('GET', '**/api/time', (req) => {
173
+ // Use simpler delay approach
174
+ req.reply({
175
+ statusCode: 200,
176
+ body: {
177
+ timestamp: new Date().toISOString(),
178
+ unix: Math.floor(Date.now() / 1000),
179
+ formatted: new Date().toLocaleString(),
180
+ timezone: 'UTC',
181
+ },
182
+ delay: 1000, // Add delay directly
183
+ });
184
+ }).as('getPanelTimeDelayed');
185
+
186
+ cy.mount(
187
+ <QueryClientProvider client={queryClient}>
188
+ <EnhancedPanelComponent agentId="test-panel-loading" />
189
+ </QueryClientProvider>
190
+ );
191
+
192
+ // Check loading state
193
+ cy.contains('Loading time...').should('be.visible');
194
+
195
+ // Wait for data
196
+ cy.wait('@getPanelTimeDelayed');
197
+ cy.contains('Loading time...').should('not.exist');
198
+ });
199
+ });
200
+
201
+ describe('Panel Integration', () => {
202
+ it('should integrate with agent UI system', () => {
203
+ // Verify panel can be used in the agent UI
204
+ const panel = panels[0];
205
+
206
+ // Create a mock agent UI container
207
+ const AgentUIContainer = ({ agentId }: { agentId: string }) => {
208
+ const Component = panel.component;
209
+ return (
210
+ <div className="agent-ui-container">
211
+ <div className="panel-header">
212
+ <span className="panel-icon">{panel.icon}</span>
213
+ <span className="panel-name">{panel.name}</span>
214
+ </div>
215
+ <div className="panel-content">
216
+ <Component agentId={agentId} />
217
+ </div>
218
+ </div>
219
+ );
220
+ };
221
+
222
+ cy.mount(<AgentUIContainer agentId="ui-test-agent" />);
223
+
224
+ // Verify integration
225
+ cy.get('.agent-ui-container').should('be.visible');
226
+ cy.get('.panel-icon').contains('Book').should('be.visible');
227
+ cy.get('.panel-name').contains('Example').should('be.visible');
228
+ cy.get('.panel-content').contains('Hello ui-test-agent!').should('be.visible');
229
+ });
230
+
231
+ it('should handle panel switching', () => {
232
+ // Simulate multiple panels
233
+ const mockPanels = [
234
+ ...panels,
235
+ {
236
+ name: 'Second Panel',
237
+ path: 'second',
238
+ component: ({ agentId }: { agentId: string }) => <div>Second panel for {agentId}</div>,
239
+ icon: 'Settings',
240
+ public: false,
241
+ shortLabel: 'Second',
242
+ },
243
+ ];
244
+
245
+ let currentPanel = 0;
246
+
247
+ const PanelSwitcher = () => {
248
+ const [activePanel, setActivePanel] = React.useState(0);
249
+ const ActiveComponent = mockPanels[activePanel].component;
250
+
251
+ return (
252
+ <div>
253
+ <div className="panel-tabs">
254
+ {mockPanels.map((panel, index) => (
255
+ <button
256
+ key={panel.path}
257
+ onClick={() => setActivePanel(index)}
258
+ className={activePanel === index ? 'active' : ''}
259
+ data-testid={`tab-${panel.path}`}
260
+ >
261
+ {panel.name}
262
+ </button>
263
+ ))}
264
+ </div>
265
+ <div className="panel-content">
266
+ <ActiveComponent agentId="switch-test" />
267
+ </div>
268
+ </div>
269
+ );
270
+ };
271
+
272
+ cy.mount(<PanelSwitcher />);
273
+
274
+ // Check initial panel
275
+ cy.contains('Hello switch-test!').should('be.visible');
276
+
277
+ // Switch to second panel
278
+ cy.get('[data-testid="tab-second"]').click();
279
+ cy.contains('Second panel for switch-test').should('be.visible');
280
+ cy.contains('Hello switch-test!').should('not.exist');
281
+
282
+ // Switch back
283
+ cy.get('[data-testid="tab-example"]').click();
284
+ cy.contains('Hello switch-test!').should('be.visible');
285
+ });
286
+ });
287
+ });
@@ -0,0 +1,38 @@
1
+ /// <reference types="cypress" />
2
+ /// <reference types="@cypress/react" />
3
+
4
+ // ***********************************************
5
+ // This file is where you can create custom Cypress commands
6
+ // and overwrite existing commands.
7
+ //
8
+ // For comprehensive examples, visit:
9
+ // https://on.cypress.io/custom-commands
10
+ // ***********************************************
11
+
12
+ // Example custom command
13
+ // Cypress.Commands.add('login', (email, password) => { ... })
14
+
15
+ // Custom command to check if element is in dark mode
16
+ Cypress.Commands.add('shouldBeDarkMode', () => {
17
+ cy.get('html').should('have.class', 'dark');
18
+ });
19
+
20
+ // Custom command to set ELIZA_CONFIG
21
+ Cypress.Commands.add('setElizaConfig', (config) => {
22
+ cy.window().then((win) => {
23
+ (win as any).ELIZA_CONFIG = config;
24
+ });
25
+ });
26
+
27
+ // TypeScript definitions
28
+ declare global {
29
+ namespace Cypress {
30
+ interface Chainable {
31
+ shouldBeDarkMode(): Chainable<JQuery<HTMLElement>>;
32
+ setElizaConfig(config: { agentId: string; apiBase?: string }): Chainable<Window>;
33
+ mount(component: React.ReactElement): Chainable<any>;
34
+ }
35
+ }
36
+ }
37
+
38
+ export {};
@@ -0,0 +1,11 @@
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" />
6
+ <title>Cypress Component Testing</title>
7
+ </head>
8
+ <body>
9
+ <div id="__cy_root" data-cy-root></div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,33 @@
1
+ // ***********************************************************
2
+ // This file is processed and loaded automatically before your test files.
3
+ // You can change the location of this file or turn off processing using the
4
+ // 'supportFile' config option.
5
+ // ***********************************************************
6
+
7
+ // Import commands.js using ES2015 syntax:
8
+ import './commands';
9
+
10
+ // Import Testing Library Cypress commands
11
+ import '@testing-library/cypress/add-commands';
12
+
13
+ // Import styles
14
+ import '../../../frontend/index.css';
15
+
16
+ // Add custom TypeScript types
17
+ declare global {
18
+ namespace Cypress {
19
+ interface Chainable {
20
+ /**
21
+ * Custom command to mount React components
22
+ * @example cy.mount(<Component />)
23
+ */
24
+ mount(component: React.ReactElement): Chainable<any>;
25
+ }
26
+ }
27
+ }
28
+
29
+ // Import React mount function
30
+ import { mount } from '@cypress/react';
31
+
32
+ // Make mount available globally
33
+ Cypress.Commands.add('mount', mount);
@@ -0,0 +1,11 @@
1
+ // ***********************************************************
2
+ // This file is processed and loaded automatically before your test files.
3
+ // You can change the location of this file or turn off processing using the
4
+ // 'supportFile' config option.
5
+ // ***********************************************************
6
+
7
+ // Import commands
8
+ import './commands';
9
+
10
+ // Import Testing Library Cypress commands
11
+ import '@testing-library/cypress/add-commands';
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "target": "es2015",
5
+ "lib": ["es2015", "dom"],
6
+ "types": ["cypress", "@testing-library/cypress"],
7
+ "isolatedModules": false
8
+ },
9
+ "include": ["**/*.ts", "**/*.tsx"]
10
+ }
@@ -0,0 +1,47 @@
1
+ # E2E Tests for Plugin Starter
2
+
3
+ This directory contains end-to-end tests for the ElizaOS plugin starter template.
4
+
5
+ ## Overview
6
+
7
+ E2E tests run in a real ElizaOS runtime environment, allowing you to test your plugin's behavior as it would work in production.
8
+
9
+ ## Test Structure
10
+
11
+ - **StarterPluginTestSuite** - Main test suite containing all e2e tests
12
+ - `example_test` - Verifies plugin is loaded correctly
13
+ - `should_have_hello_world_action` - Checks action registration
14
+ - `hello_world_action_test` - **Key test**: Simulates asking the agent to say "hello" and validates the response contains "hello world"
15
+ - `hello_world_provider_test` - Tests provider functionality
16
+ - `starter_service_test` - Tests service lifecycle
17
+
18
+ ## Running Tests
19
+
20
+ ```bash
21
+ # Run all tests (component + e2e)
22
+ npm test
23
+
24
+ # Run only e2e tests
25
+ npm run test:e2e
26
+
27
+ # Run only component tests
28
+ npm run test:component
29
+ ```
30
+
31
+ ## Implementation Details
32
+
33
+ 1. **Test Export**: Tests are exported through `src/tests.ts` to be included in the plugin build
34
+ 2. **Plugin Integration**: The test suite is added to the plugin's `tests` array
35
+ 3. **Runtime Access**: Each test receives a real runtime instance with full access to:
36
+ - Plugin actions, providers, and services
37
+ - Agent character configuration
38
+ - Database and model access
39
+
40
+ ## Known Issues
41
+
42
+ - The test runner may look for tests on other plugins (e.g., @elizaos/plugin-sql) instead of the current plugin
43
+ - TypeScript validation in the test runner may flag type issues that don't affect actual functionality
44
+
45
+ ## Writing New Tests
46
+
47
+ See the comprehensive documentation at the top of `starter-plugin.ts` for detailed instructions on adding new tests.