@elizaos/cli 1.3.2 → 1.4.3

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 (128) hide show
  1. package/README.md +46 -0
  2. package/dist/{bun-exec-6CQHTS4F.js → bun-exec-ULMPAIQC.js} +1 -1
  3. package/dist/{chunk-FDEDLANP.js → chunk-FQYWRHLX.js} +1 -1
  4. package/dist/{chunk-5GUS4CFO.js → chunk-HOC6B3QV.js} +1 -1
  5. package/dist/{chunk-D3Q2UZLZ.js → chunk-I4L4T7QX.js} +1 -1
  6. package/dist/{chunk-E6XYTE3A.js → chunk-N5G5XSGP.js} +97 -76
  7. package/dist/{chunk-T2QDIXGU.js → chunk-NSNXXD3I.js} +3 -3
  8. package/dist/commands/agent/actions/index.js +3 -3
  9. package/dist/commands/agent/index.js +3 -3
  10. package/dist/commands/create/actions/index.js +4 -4
  11. package/dist/commands/create/index.js +5 -5
  12. package/dist/index.js +146 -112
  13. package/dist/{plugin-creator-H26ZLR6H.js → plugin-creator-TCUFII32.js} +2 -2
  14. package/dist/{registry-433S5F3Y.js → registry-ELONUC44.js} +3 -3
  15. package/dist/templates/plugin-quick-starter/README.md +52 -10
  16. package/dist/templates/plugin-quick-starter/package.json +2 -2
  17. package/dist/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
  18. package/dist/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
  19. package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +55 -17
  20. package/dist/templates/plugin-quick-starter/src/plugin.ts +14 -14
  21. package/dist/templates/plugin-starter/README.md +124 -49
  22. package/dist/templates/plugin-starter/package.json +2 -2
  23. package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
  24. package/{templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → dist/templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
  25. package/dist/templates/plugin-starter/src/plugin.ts +5 -7
  26. package/dist/templates/project-starter/README.md +24 -11
  27. package/dist/templates/project-starter/package.json +4 -4
  28. package/dist/templates/project-starter/src/__tests__/actions.test.ts +2 -2
  29. package/dist/templates/project-starter/src/__tests__/config.test.ts +6 -15
  30. package/dist/templates/project-starter/src/__tests__/e2e/README.md +103 -0
  31. package/dist/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
  32. package/dist/templates/project-starter/src/__tests__/error-handling.test.ts +4 -18
  33. package/dist/templates/project-starter/src/__tests__/events.test.ts +27 -23
  34. package/dist/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  35. package/dist/templates/project-starter/src/__tests__/models.test.ts +3 -3
  36. package/dist/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
  37. package/dist/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  38. package/dist/templates/project-starter/src/index.ts +4 -3
  39. package/dist/templates/project-starter/src/plugin.ts +5 -5
  40. package/dist/templates/project-tee-starter/README.md +44 -5
  41. package/dist/templates/project-tee-starter/package.json +4 -4
  42. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/build-order.test.ts +1 -1
  43. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/character.test.ts +1 -1
  44. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +41 -1
  45. package/dist/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
  46. package/dist/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
  47. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +1 -1
  48. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
  49. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
  50. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/file-structure.test.ts +2 -2
  51. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
  52. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
  53. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/plugin.test.ts +1 -1
  54. package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/provider.test.ts +2 -2
  55. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/routes.test.ts +1 -1
  56. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/tee-validation.test.ts +1 -1
  57. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
  58. package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/vite-config-utils.ts +14 -2
  59. package/dist/templates/project-tee-starter/src/index.ts +2 -0
  60. package/dist/templates/project-tee-starter/src/plugin.ts +40 -26
  61. package/dist/{utils-DBLSDYBF.js → utils-X6UXPLKD.js} +3 -3
  62. package/package.json +6 -7
  63. package/templates/plugin-quick-starter/README.md +52 -10
  64. package/templates/plugin-quick-starter/package.json +2 -2
  65. package/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
  66. package/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
  67. package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +55 -17
  68. package/templates/plugin-quick-starter/src/plugin.ts +14 -14
  69. package/templates/plugin-starter/README.md +124 -49
  70. package/templates/plugin-starter/package.json +2 -2
  71. package/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
  72. package/{dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
  73. package/templates/plugin-starter/src/plugin.ts +5 -7
  74. package/templates/project-starter/README.md +24 -11
  75. package/templates/project-starter/package.json +4 -4
  76. package/templates/project-starter/src/__tests__/actions.test.ts +2 -2
  77. package/templates/project-starter/src/__tests__/config.test.ts +6 -15
  78. package/templates/project-starter/src/__tests__/e2e/README.md +103 -0
  79. package/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
  80. package/templates/project-starter/src/__tests__/error-handling.test.ts +4 -18
  81. package/templates/project-starter/src/__tests__/events.test.ts +27 -23
  82. package/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  83. package/templates/project-starter/src/__tests__/models.test.ts +3 -3
  84. package/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
  85. package/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  86. package/templates/project-starter/src/index.ts +4 -3
  87. package/templates/project-starter/src/plugin.ts +5 -5
  88. package/templates/project-tee-starter/README.md +44 -5
  89. package/templates/project-tee-starter/package.json +4 -4
  90. package/templates/project-tee-starter/{__tests__ → src/__tests__}/build-order.test.ts +1 -1
  91. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/character.test.ts +1 -1
  92. package/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +41 -1
  93. package/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
  94. package/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
  95. package/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +1 -1
  96. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
  97. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
  98. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/file-structure.test.ts +2 -2
  99. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
  100. package/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
  101. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/plugin.test.ts +1 -1
  102. package/templates/project-tee-starter/{__tests__ → src/__tests__}/provider.test.ts +2 -2
  103. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/routes.test.ts +1 -1
  104. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/tee-validation.test.ts +1 -1
  105. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
  106. package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/vite-config-utils.ts +14 -2
  107. package/templates/project-tee-starter/src/index.ts +2 -0
  108. package/templates/project-tee-starter/src/plugin.ts +40 -26
  109. package/dist/templates/plugin-starter/src/tests.ts +0 -6
  110. package/dist/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
  111. package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
  112. package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
  113. package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
  114. package/dist/templates/project-tee-starter/e2e/project.test.ts +0 -38
  115. package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
  116. package/templates/plugin-starter/src/tests.ts +0 -6
  117. package/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
  118. package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
  119. package/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
  120. package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
  121. package/templates/project-tee-starter/e2e/project.test.ts +0 -38
  122. package/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
  123. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
  124. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/frontend.test.ts +0 -0
  125. /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
  126. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
  127. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/frontend.test.ts +0 -0
  128. /package/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
@@ -0,0 +1,280 @@
1
+ import {
2
+ type Content,
3
+ type HandlerCallback,
4
+ type IAgentRuntime,
5
+ type Memory,
6
+ type UUID,
7
+ ChannelType,
8
+ logger,
9
+ } from '@elizaos/core';
10
+ import { v4 as uuidv4 } from 'uuid';
11
+
12
+ /**
13
+ * E2E Test Suite for Project TEE Starter
14
+ * ======================================
15
+ *
16
+ * This test suite validates TEE (Trusted Execution Environment) specific functionality
17
+ * while gracefully handling non-TEE environments where tests are expected to fail.
18
+ *
19
+ * TEST CATEGORIES:
20
+ * ---------------
21
+ * 1. ALWAYS PASS: Basic project setup tests that work in any environment
22
+ * 2. TEE-OPTIONAL: Tests that check for TEE features but pass with warnings if unavailable
23
+ * 3. TEE-REQUIRED: Tests that only pass in actual TEE environments (skip otherwise)
24
+ *
25
+ * ENVIRONMENT DETECTION:
26
+ * ---------------------
27
+ * Tests detect TEE availability by checking:
28
+ * - TEE service registration
29
+ * - TEE-specific environment variables
30
+ * - Embedding model availability
31
+ * - Database schema completeness
32
+ */
33
+
34
+ interface TestCase {
35
+ name: string;
36
+ category?: 'always-pass' | 'tee-optional' | 'tee-required';
37
+ fn: (runtime: IAgentRuntime) => Promise<void>;
38
+ }
39
+
40
+ export class ProjectTeeStarterTestSuite {
41
+ name = 'Project TEE Starter E2E Tests';
42
+ description = 'E2E tests for TEE-specific project features with graceful fallbacks';
43
+
44
+ // Helper to detect TEE environment
45
+ private async detectTeeEnvironment(runtime: IAgentRuntime): Promise<{
46
+ hasService: boolean;
47
+ hasEndpoint: boolean;
48
+ hasEmbeddings: boolean;
49
+ isFullTee: boolean;
50
+ }> {
51
+ const teeService = runtime.getService('tee') || runtime.getService('mr-tee-service');
52
+ const hasEndpoint = !!runtime.getSetting('TEE_ATTESTATION_ENDPOINT');
53
+
54
+ // Check for embedding capability
55
+ let hasEmbeddings = false;
56
+ try {
57
+ // Check if embedding model is available via service
58
+ const embeddingService = runtime.getService('embedding');
59
+ hasEmbeddings = !!embeddingService;
60
+ } catch {
61
+ hasEmbeddings = false;
62
+ }
63
+
64
+ return {
65
+ hasService: !!teeService,
66
+ hasEndpoint,
67
+ hasEmbeddings,
68
+ isFullTee: !!teeService && hasEndpoint && hasEmbeddings,
69
+ };
70
+ }
71
+
72
+ tests: TestCase[] = [
73
+ // ALWAYS PASS: Basic project validation
74
+ {
75
+ name: 'tee_project_should_initialize_correctly',
76
+ category: 'always-pass',
77
+ fn: async (runtime: IAgentRuntime) => {
78
+ if (!runtime.agentId) {
79
+ throw new Error('Agent ID is not set');
80
+ }
81
+
82
+ logger.info(`✓ TEE Project initialized with agent ID: ${runtime.agentId}`);
83
+ },
84
+ },
85
+
86
+ {
87
+ name: 'tee_character_should_be_loaded_correctly',
88
+ category: 'always-pass',
89
+ fn: async (runtime: IAgentRuntime) => {
90
+ if (!runtime.character.name) {
91
+ throw new Error('Character name is not set');
92
+ }
93
+
94
+ if (!runtime.character.bio || runtime.character.bio.length === 0) {
95
+ throw new Error('Character bio is not set');
96
+ }
97
+
98
+ logger.info(`✓ TEE Character "${runtime.character.name}" loaded successfully`);
99
+ },
100
+ },
101
+
102
+ // TEE-OPTIONAL: Features that may or may not be available
103
+ {
104
+ name: 'tee_service_availability_check',
105
+ category: 'tee-optional',
106
+ fn: async (runtime: IAgentRuntime) => {
107
+ const env = await this.detectTeeEnvironment(runtime);
108
+
109
+ if (env.hasService) {
110
+ logger.info('✓ TEE service is available and registered');
111
+ } else {
112
+ logger.info('⚠ TEE service not available (expected in non-TEE environments)');
113
+ }
114
+
115
+ // This test always passes - it's just informational
116
+ },
117
+ },
118
+
119
+ {
120
+ name: 'tee_configuration_check',
121
+ category: 'tee-optional',
122
+ fn: async (runtime: IAgentRuntime) => {
123
+ const env = await this.detectTeeEnvironment(runtime);
124
+ const plugins = runtime.character.plugins || [];
125
+ const teePlugins = plugins.filter(
126
+ (p) => p.toLowerCase().includes('tee') || p.toLowerCase().includes('attestation')
127
+ );
128
+
129
+ logger.info(`✓ Found ${teePlugins.length} TEE-related plugins: ${teePlugins.join(', ')}`);
130
+ logger.info(`✓ TEE mode configured: ${env.isFullTee ? 'FULL' : 'OFF'}`);
131
+
132
+ if (!env.hasEndpoint) {
133
+ logger.info('⚠ TEE_ATTESTATION_ENDPOINT not configured (expected in development)');
134
+ }
135
+ },
136
+ },
137
+
138
+ {
139
+ name: 'tee_plugin_integration_check',
140
+ category: 'tee-optional',
141
+ fn: async (runtime: IAgentRuntime) => {
142
+ const plugins = runtime.character.plugins || [];
143
+ const hasTeePlugin = plugins.some(
144
+ (p) => p.toLowerCase().includes('tee') || p === 'mr-tee-starter-plugin'
145
+ );
146
+
147
+ if (hasTeePlugin) {
148
+ logger.info('✓ TEE plugin is loaded in character configuration');
149
+ } else {
150
+ logger.info('⚠ No TEE plugin in character configuration');
151
+ }
152
+ },
153
+ },
154
+
155
+ // TEE-REQUIRED: Tests that only work in full TEE environments
156
+ {
157
+ name: 'secure_attestation_flow',
158
+ category: 'tee-required',
159
+ fn: async (runtime: IAgentRuntime) => {
160
+ const env = await this.detectTeeEnvironment(runtime);
161
+
162
+ if (!env.isFullTee) {
163
+ logger.info('⚠ Skipping attestation test (requires full TEE environment)');
164
+ return;
165
+ }
166
+
167
+ // Test attestation action availability
168
+ const attestationAction = runtime.actions.find((a) =>
169
+ a.name.toLowerCase().includes('attest')
170
+ );
171
+
172
+ if (!attestationAction) {
173
+ throw new Error('Attestation action not found in TEE environment');
174
+ }
175
+
176
+ logger.info('✓ Attestation flow validated');
177
+ },
178
+ },
179
+
180
+ {
181
+ name: 'secure_memory_operations_with_embeddings',
182
+ category: 'tee-required',
183
+ fn: async (runtime: IAgentRuntime) => {
184
+ const env = await this.detectTeeEnvironment(runtime);
185
+
186
+ if (!env.hasEmbeddings) {
187
+ logger.info('⚠ Skipping embedding test (requires embedding model)');
188
+ return;
189
+ }
190
+
191
+ try {
192
+ const testContent = 'Secure TEE test message';
193
+
194
+ // Create a test memory with content
195
+ const testMemory: Memory = {
196
+ id: uuidv4() as UUID,
197
+ entityId: uuidv4() as UUID,
198
+ agentId: runtime.agentId,
199
+ roomId: uuidv4() as UUID,
200
+ content: {
201
+ text: testContent,
202
+ action: null,
203
+ } as Content,
204
+ createdAt: Date.now(),
205
+ embedding: [], // Would be populated by embedding service
206
+ };
207
+
208
+ await runtime.createMemory(testMemory, 'messages', false);
209
+ logger.info('✓ Secure memory operations with embeddings working');
210
+ } catch (error) {
211
+ logger.info(`⚠ Embedding test failed: ${error.message}`);
212
+ }
213
+ },
214
+ },
215
+
216
+ {
217
+ name: 'tee_agent_message_processing',
218
+ category: 'tee-required',
219
+ fn: async (runtime: IAgentRuntime) => {
220
+ const env = await this.detectTeeEnvironment(runtime);
221
+
222
+ if (!env.isFullTee) {
223
+ logger.info('⚠ Skipping message processing test (requires full TEE environment)');
224
+ return;
225
+ }
226
+
227
+ try {
228
+ const testMessage: Memory = {
229
+ id: uuidv4() as UUID,
230
+ entityId: uuidv4() as UUID,
231
+ agentId: runtime.agentId,
232
+ roomId: uuidv4() as UUID,
233
+ content: {
234
+ text: 'Test TEE secure message processing',
235
+ action: null,
236
+ } as Content,
237
+ createdAt: Date.now(),
238
+ embedding: [],
239
+ };
240
+
241
+ await runtime.createMemory(testMessage, 'messages', false);
242
+ logger.info('✓ TEE message processing completed');
243
+ } catch (error) {
244
+ logger.info(`⚠ Message processing test failed: ${error.message}`);
245
+ }
246
+ },
247
+ },
248
+
249
+ // Database connectivity test (handles schema differences)
250
+ {
251
+ name: 'database_connectivity_and_schema',
252
+ category: 'tee-optional',
253
+ fn: async (runtime: IAgentRuntime) => {
254
+ try {
255
+ // Try a simple query that should work regardless of schema
256
+ const testRoomId = uuidv4() as UUID;
257
+ const memories = await runtime.getMemories({
258
+ roomId: testRoomId,
259
+ count: 1,
260
+ tableName: 'messages',
261
+ });
262
+
263
+ logger.info('✓ Database connection is working');
264
+ } catch (error) {
265
+ // Check if it's a schema issue
266
+ if (error.message?.includes('embeddings.dim_384')) {
267
+ logger.info(
268
+ '⚠ Database schema missing embedding columns (expected without embedding model)'
269
+ );
270
+ } else {
271
+ logger.info(`⚠ Database test failed: ${error.message}`);
272
+ }
273
+ }
274
+ },
275
+ },
276
+ ];
277
+ }
278
+
279
+ // Export the test suite for the test runner
280
+ export default new ProjectTeeStarterTestSuite();
@@ -4,7 +4,7 @@ import { describe, expect, it } from 'bun:test';
4
4
  import { fileURLToPath } from 'node:url';
5
5
 
6
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
- const projectRoot = path.resolve(__dirname, '..');
7
+ const projectRoot = path.resolve(__dirname, '..', '..');
8
8
 
9
9
  describe('Environment Setup', () => {
10
10
  it('should verify configuration files exist', () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from 'bun:test';
2
- import teeStarterPlugin from '../src/plugin';
3
- import { mrTeeCharacter } from '../src/character';
2
+ import teeStarterPlugin from '../plugin';
3
+ import { mrTeeCharacter } from '../character';
4
4
 
5
5
  describe('Error Handling', () => {
6
6
  describe('Plugin Error Handling', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'bun:test';
2
- import teeStarterPlugin from '../src/plugin';
2
+ import teeStarterPlugin from '../plugin';
3
3
 
4
4
  describe('Plugin Events', () => {
5
5
  it('should not have custom events (relies on plugin-tee for TEE events)', () => {
@@ -15,7 +15,7 @@ function directoryExists(dirPath: string): boolean {
15
15
  }
16
16
 
17
17
  describe('Project Structure Validation', () => {
18
- const rootDir = path.resolve(__dirname, '..');
18
+ const rootDir = path.resolve(__dirname, '..', '..');
19
19
  const distDir = path.join(rootDir, 'dist');
20
20
 
21
21
  beforeAll(async () => {
@@ -29,7 +29,7 @@ describe('Project Structure Validation', () => {
29
29
  describe('Directory Structure', () => {
30
30
  it('should have the expected directory structure', () => {
31
31
  expect(directoryExists(path.join(rootDir, 'src'))).toBe(true);
32
- expect(directoryExists(path.join(rootDir, '__tests__'))).toBe(true);
32
+ expect(directoryExists(path.join(rootDir, 'src', '__tests__'))).toBe(true);
33
33
  });
34
34
 
35
35
  it('should have a dist directory after building', () => {
@@ -2,8 +2,8 @@ import { describe, expect, it, spyOn, beforeAll, afterAll } from 'bun:test';
2
2
  import * as fs from 'node:fs';
3
3
  import * as path from 'node:path';
4
4
  import { logger, IAgentRuntime, Plugin } from '@elizaos/core';
5
- import { character } from '../src/index';
6
- import plugin from '../src/plugin';
5
+ import { character } from '../index';
6
+ import plugin from '../plugin';
7
7
  import { createMockRuntime } from './test-utils';
8
8
  import * as os from 'node:os';
9
9
 
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'bun:test';
2
- import teeStarterPlugin from '../src/plugin';
2
+ import teeStarterPlugin from '../plugin';
3
3
 
4
4
  describe('Plugin Models', () => {
5
5
  it('should not have custom models (using plugin-tee and other plugins for model handling)', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, spyOn, mock } from 'bun:test';
2
- import teeStarterPlugin from '../src/plugin';
2
+ import teeStarterPlugin from '../plugin';
3
3
  import { logger } from '@elizaos/core';
4
4
 
5
5
  // Spy on logger to capture logs
@@ -1,10 +1,10 @@
1
1
  import { describe, expect, it, spyOn, beforeAll, afterAll } from 'bun:test';
2
- import plugin from '../src/plugin';
2
+ import plugin from '../plugin';
3
3
  import type { IAgentRuntime, Memory, State, Provider } from '@elizaos/core';
4
4
  import { logger } from '@elizaos/core';
5
5
  import { v4 as uuidv4 } from 'uuid';
6
6
  import dotenv from 'dotenv';
7
- import teeStarterPlugin from '../src/plugin';
7
+ import teeStarterPlugin from '../plugin';
8
8
 
9
9
  // Setup environment variables
10
10
  dotenv.config();
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'bun:test';
2
- import teeStarterPlugin from '../src/plugin';
2
+ import teeStarterPlugin from '../plugin';
3
3
 
4
4
  describe('Plugin Routes', () => {
5
5
  it('should have TEE-specific routes for status and frontend', () => {
@@ -10,7 +10,7 @@ const mockLogger = {
10
10
  };
11
11
 
12
12
  // We'll test the validation logic by importing the plugin and testing its init method
13
- import teeStarterPlugin from '../src/plugin';
13
+ import teeStarterPlugin from '../plugin';
14
14
 
15
15
  // Mock runtime for testing
16
16
  const mockRuntime = {} as IAgentRuntime;
@@ -7,8 +7,8 @@ import {
7
7
  documentTestResult,
8
8
  runCoreActionTests,
9
9
  } from './utils/core-test-utils';
10
- import { mrTeeCharacter } from '../src/character';
11
- import plugin from '../src/plugin';
10
+ import { mrTeeCharacter } from '../character';
11
+ import plugin from '../plugin';
12
12
 
13
13
  /**
14
14
  * Creates an enhanced mock runtime for testing that includes the project's
@@ -1,17 +1,29 @@
1
1
  import path from 'node:path';
2
2
  import fs from 'node:fs';
3
3
 
4
+ // Default output directories
5
+ const DEFAULT_VITE_OUT_DIR = 'dist/frontend';
6
+ const DEFAULT_VITE_VAR_DIR = 'dist/.vite';
7
+
4
8
  /**
5
9
  * Extracts the Vite output directory from vite.config.ts
6
10
  */
7
11
  export async function getViteOutDir(rootDir: string): Promise<string> {
8
12
  const viteConfigPath = path.join(rootDir, 'vite.config.ts');
13
+
14
+ // Check if vite config exists
15
+ if (!fs.existsSync(viteConfigPath)) {
16
+ // Return default if config doesn't exist
17
+ return DEFAULT_VITE_OUT_DIR;
18
+ }
19
+
9
20
  const configContent = await fs.promises.readFile(viteConfigPath, 'utf-8');
10
21
 
11
22
  // Extract the outDir value using regex
12
23
  const outDirMatch = configContent.match(/outDir\s*:\s*['"`]([^'"`]+)['"`]/);
13
24
  if (!outDirMatch) {
14
- throw new Error('Could not find outDir in vite.config.ts');
25
+ // Return default output directory if outDir configuration is not found in vite.config.ts
26
+ return DEFAULT_VITE_OUT_DIR;
15
27
  }
16
28
 
17
29
  let outDir = outDirMatch[1];
@@ -24,7 +36,7 @@ export async function getViteOutDir(rootDir: string): Promise<string> {
24
36
  outDir = outDir.replace('${outDir}', varMatch[1]);
25
37
  } else {
26
38
  // Default fallback
27
- outDir = 'dist/.vite';
39
+ outDir = DEFAULT_VITE_VAR_DIR;
28
40
  }
29
41
  }
30
42
 
@@ -1,6 +1,7 @@
1
1
  import { logger, type IAgentRuntime, type Project, type ProjectAgent } from '@elizaos/core';
2
2
  import teeStarterPlugin, { StarterService } from './plugin.ts';
3
3
  import { mrTeeCharacter as character } from './character.ts';
4
+ import ProjectTeeStarterTestSuite from './__tests__/e2e/project-tee-starter.e2e';
4
5
 
5
6
  const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
6
7
  logger.info(`Initializing character: ${character.name}`);
@@ -10,6 +11,7 @@ const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
10
11
  export const projectAgent: ProjectAgent = {
11
12
  character,
12
13
  init: async (runtime: IAgentRuntime) => await initCharacter({ runtime }),
14
+ tests: [ProjectTeeStarterTestSuite], // Export tests from ProjectAgent
13
15
  };
14
16
 
15
17
  const project: Project = {
@@ -119,6 +119,18 @@ const deriveEd25519Keypair = (deriveKeyResponse: DeriveKeyResponse): Keypair =>
119
119
  return Keypair.fromSeed(seedArray.slice(0, 32));
120
120
  };
121
121
 
122
+ /**
123
+ * Checks if an error is a TEE connection error
124
+ * @param error The error to check
125
+ * @returns True if the error is a TEE connection error
126
+ */
127
+ const isTeeConnectionError = (error: unknown): boolean => {
128
+ return (
129
+ error instanceof Error &&
130
+ (error.message.includes('ENOENT') || error.message.includes('Failed to connect'))
131
+ );
132
+ };
133
+
122
134
  /**
123
135
  * Handles TEE key derivation and logging
124
136
  */
@@ -135,18 +147,18 @@ const handleTeeKeyDerivation = async (config: TeeServiceConfig): Promise<void> =
135
147
  const ed25519Keypair = deriveEd25519Keypair(deriveKeyResponse);
136
148
 
137
149
  logger.log('ECDSA Key Derived Successfully!');
138
- logger.log('ECDSA Keypair:', ecdsaKeypair.address);
139
- logger.log('ED25519 Keypair:', ed25519Keypair.publicKey);
150
+ logger.log({ address: ecdsaKeypair.address }, 'ECDSA Keypair:');
151
+ logger.log({ publicKey: ed25519Keypair.publicKey }, 'ED25519 Keypair:');
140
152
 
141
153
  const signature = await ecdsaKeypair.signMessage({ message: 'Hello, world!' });
142
- logger.log('Sign message w/ ECDSA keypair: Hello world!, Signature: ', signature);
154
+ logger.log({ signature }, 'Sign message w/ ECDSA keypair: Hello world!, Signature:');
143
155
  } catch (error) {
144
156
  // Handle TEE connection errors gracefully
145
- if (error instanceof Error && error.message.includes('ENOENT')) {
157
+ if (isTeeConnectionError(error)) {
146
158
  logger.warn('TEE daemon not available - running in non-TEE mode for testing');
147
159
  logger.warn('To run with TEE, ensure tappd is running at /var/run/tappd.sock');
148
160
  } else {
149
- logger.error('Error connecting to TEE:', error);
161
+ logger.warn({ error }, 'TEE daemon connection failed, running in non-TEE mode:');
150
162
  }
151
163
  // Continue without TEE functionality for testing
152
164
  }
@@ -201,34 +213,36 @@ export class StarterService extends Service {
201
213
  const teeStarterPlugin: Plugin = {
202
214
  name: 'mr-tee-starter-plugin',
203
215
  description: "Mr. TEE's starter plugin - using plugin-tee for attestation",
204
- config: {
205
- TEE_MODE: process.env.TEE_MODE,
206
- TEE_VENDOR: process.env.TEE_VENDOR,
207
- WALLET_SECRET_SALT: process.env.WALLET_SECRET_SALT,
208
- },
216
+ // Use dynamic getters so tests/CI always see current env values
217
+ config: Object.defineProperties(
218
+ {},
219
+ {
220
+ TEE_MODE: {
221
+ get: () => process.env.TEE_MODE,
222
+ enumerable: true,
223
+ },
224
+ TEE_VENDOR: {
225
+ get: () => process.env.TEE_VENDOR,
226
+ enumerable: true,
227
+ },
228
+ WALLET_SECRET_SALT: {
229
+ get: () => process.env.WALLET_SECRET_SALT,
230
+ enumerable: true,
231
+ },
232
+ }
233
+ ) as Record<string, string>,
209
234
  async init(config: Record<string, string>, runtime: IAgentRuntime) {
210
235
  logger.info('*** Initializing Mr. TEE plugin ***');
211
236
  try {
212
237
  // Merge process.env values with config, config takes precedence
213
- const mergedConfig = {
238
+ const rawConfig = {
214
239
  TEE_MODE: config.TEE_MODE ?? process.env.TEE_MODE,
215
240
  TEE_VENDOR: config.TEE_VENDOR ?? process.env.TEE_VENDOR,
216
241
  WALLET_SECRET_SALT: config.WALLET_SECRET_SALT ?? process.env.WALLET_SECRET_SALT,
217
242
  };
218
243
 
219
- // Apply test defaults if in test environment
220
- const isTestEnvironment = process.env.NODE_ENV === 'test' || process.argv.includes('test');
221
-
222
- if (isTestEnvironment) {
223
- // Apply test-only defaults - NEVER use these in production
224
- mergedConfig.TEE_MODE = mergedConfig.TEE_MODE || 'OFF';
225
- mergedConfig.TEE_VENDOR = mergedConfig.TEE_VENDOR || 'phala';
226
- // Test salt - this is ONLY for test environments and should NEVER be used in production
227
- mergedConfig.WALLET_SECRET_SALT =
228
- mergedConfig.WALLET_SECRET_SALT || 'test_default_salt_12345';
229
- }
230
-
231
- const validatedConfig = await configSchema.parseAsync(mergedConfig);
244
+ // Parse and validate configuration with schema (includes test defaults)
245
+ const validatedConfig = configSchema.parse(rawConfig);
232
246
 
233
247
  // Production safety check - ensure test defaults aren't used in production
234
248
  if (
@@ -289,8 +303,8 @@ const teeStarterPlugin: Plugin = {
289
303
  MESSAGE_RECEIVED: [
290
304
  async (params) => {
291
305
  logger.info(
292
- '[MR_TEE_PLUGIN] MESSAGE_RECEIVED event',
293
- params.message?.content?.text?.substring(0, 50)
306
+ { preview: params.message?.content?.text?.substring(0, 50) },
307
+ '[MR_TEE_PLUGIN] MESSAGE_RECEIVED event'
294
308
  );
295
309
  },
296
310
  ],
@@ -1,6 +0,0 @@
1
- /**
2
- * Test exports for the starter plugin
3
- * This file exports the test suite so it can be included in the plugin build
4
- */
5
-
6
- export { StarterPluginTestSuite } from './__tests__/e2e/starter-plugin';
@@ -1,14 +0,0 @@
1
- /**
2
- * E2E Test Suite Exports
3
- *
4
- * This file exports all E2E test suites for the ElizaOS test runner.
5
- */
6
-
7
- import projectTestSuite from './project.test';
8
- import starterTestSuite from './starter-plugin.test';
9
- import naturalLanguageTestSuite from './natural-language.test';
10
-
11
- // Export test suites for the test runner to discover
12
- export const testSuites = [projectTestSuite, starterTestSuite, naturalLanguageTestSuite];
13
-
14
- export default testSuites;