@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
@@ -57,7 +57,7 @@ const runCoreModelTests = async (
57
57
  expect(typeof basicResponse).toBe('string');
58
58
  } catch (e) {
59
59
  basicError = e as Error;
60
- logger.error(`${modelType} model call failed:`, e);
60
+ logger.error({ error: e }, `${modelType} model call failed:`);
61
61
  }
62
62
 
63
63
  // Test with empty prompt
@@ -72,7 +72,7 @@ const runCoreModelTests = async (
72
72
  emptyResponse = await modelFn(mockRuntime, emptyParams);
73
73
  } catch (e) {
74
74
  emptyError = e as Error;
75
- logger.error(`${modelType} empty prompt test failed:`, e);
75
+ logger.error({ error: e }, `${modelType} empty prompt test failed:`);
76
76
  }
77
77
 
78
78
  // Test with all parameters
@@ -92,7 +92,7 @@ const runCoreModelTests = async (
92
92
  fullResponse = await modelFn(mockRuntime, fullParams);
93
93
  } catch (e) {
94
94
  fullError = e as Error;
95
- logger.error(`${modelType} all parameters test failed:`, e);
95
+ logger.error({ error: e }, `${modelType} all parameters test failed:`);
96
96
  }
97
97
 
98
98
  return {
@@ -137,7 +137,7 @@ describe('Plugin Configuration', () => {
137
137
  expect(true).toBe(true); // If we got here, init succeeded
138
138
  } catch (e) {
139
139
  error = e as Error;
140
- logger.error('Plugin initialization error:', e);
140
+ logger.error({ error: e }, 'Plugin initialization error:');
141
141
  }
142
142
 
143
143
  documentTestResult(
@@ -256,7 +256,7 @@ describe('StarterService', () => {
256
256
  expect(typeof startResult.stop).toBe('function');
257
257
  } catch (e) {
258
258
  error = e as Error;
259
- logger.error('Service start error:', e);
259
+ logger.error({ error: e }, 'Service start error:');
260
260
  }
261
261
 
262
262
  documentTestResult(
@@ -316,7 +316,7 @@ describe('StarterService', () => {
316
316
  expect(stopSpy).toHaveBeenCalled();
317
317
  } catch (e) {
318
318
  error = e as Error;
319
- logger.error('Service stop error:', e);
319
+ logger.error({ error: e }, 'Service stop error:');
320
320
  }
321
321
 
322
322
  documentTestResult(
@@ -213,7 +213,7 @@ describe('Provider Tests', () => {
213
213
  }
214
214
  } catch (e) {
215
215
  error = e as Error;
216
- logger.error('Error in provider.get:', e);
216
+ logger.error({ error: e }, 'Error in provider.get:');
217
217
  }
218
218
 
219
219
  documentTestResult('Provider get method', result, error);
@@ -249,7 +249,7 @@ describe('Provider Tests', () => {
249
249
  logger.info('Provider handled invalid input without throwing');
250
250
  } catch (e) {
251
251
  error = e as Error;
252
- logger.error('Provider threw an error with invalid input:', e);
252
+ logger.error({ error: e }, 'Provider threw an error with invalid input:');
253
253
  }
254
254
 
255
255
  documentTestResult('Provider error handling', result, error);
@@ -1,23 +1,24 @@
1
1
  import { logger, type IAgentRuntime, type Project, type ProjectAgent } from '@elizaos/core';
2
2
  import starterPlugin from './plugin.ts';
3
3
  import { character } from './character.ts';
4
+ import { ProjectStarterTestSuite } from './__tests__/e2e/project-starter.e2e';
4
5
 
5
6
  const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
6
7
  logger.info('Initializing character');
7
- logger.info('Name: ', character.name);
8
+ logger.info({ name: character.name }, 'Name:');
8
9
  };
9
10
 
10
11
  export const projectAgent: ProjectAgent = {
11
12
  character,
12
13
  init: async (runtime: IAgentRuntime) => await initCharacter({ runtime }),
13
14
  // plugins: [starterPlugin], <-- Import custom plugins here
15
+ tests: [ProjectStarterTestSuite], // Export tests from ProjectAgent
14
16
  };
17
+
15
18
  const project: Project = {
16
19
  agents: [projectAgent],
17
20
  };
18
21
 
19
- // Export test suites for the test runner
20
- export { testSuites } from './__tests__/e2e';
21
22
  export { character } from './character.ts';
22
23
 
23
24
  export default project;
@@ -95,7 +95,7 @@ const helloWorldAction: Action = {
95
95
  success: true,
96
96
  };
97
97
  } catch (error) {
98
- logger.error('Error in HELLO_WORLD action:', error);
98
+ logger.error({ error }, 'Error in HELLO_WORLD action:');
99
99
 
100
100
  return {
101
101
  text: 'Failed to send hello world greeting',
@@ -248,28 +248,28 @@ const plugin: Plugin = {
248
248
  async (params) => {
249
249
  logger.info('MESSAGE_RECEIVED event received');
250
250
  // print the keys
251
- logger.info(Object.keys(params));
251
+ logger.info({ keys: Object.keys(params) }, 'MESSAGE_RECEIVED param keys');
252
252
  },
253
253
  ],
254
254
  VOICE_MESSAGE_RECEIVED: [
255
255
  async (params) => {
256
256
  logger.info('VOICE_MESSAGE_RECEIVED event received');
257
257
  // print the keys
258
- logger.info(Object.keys(params));
258
+ logger.info({ keys: Object.keys(params) }, 'VOICE_MESSAGE_RECEIVED param keys');
259
259
  },
260
260
  ],
261
261
  WORLD_CONNECTED: [
262
262
  async (params) => {
263
263
  logger.info('WORLD_CONNECTED event received');
264
264
  // print the keys
265
- logger.info(Object.keys(params));
265
+ logger.info({ keys: Object.keys(params) }, 'WORLD_CONNECTED param keys');
266
266
  },
267
267
  ],
268
268
  WORLD_JOINED: [
269
269
  async (params) => {
270
270
  logger.info('WORLD_JOINED event received');
271
271
  // print the keys
272
- logger.info(Object.keys(params));
272
+ logger.info({ keys: Object.keys(params) }, 'WORLD_JOINED param keys');
273
273
  },
274
274
  ],
275
275
  },
@@ -104,17 +104,56 @@ project-tee-starter/
104
104
 
105
105
  ## 🧪 Testing
106
106
 
107
+ ElizaOS employs a dual testing strategy:
108
+
109
+ 1. **Component Tests** (`src/__tests__/*.test.ts`)
110
+
111
+ - Run with Bun's native test runner
112
+ - Fast, isolated tests using mocks
113
+ - Perfect for TDD and component logic
114
+
115
+ 2. **E2E Tests** (`src/__tests__/e2e/*.e2e.ts`)
116
+ - Run with ElizaOS custom test runner
117
+ - Real runtime with actual database (PGLite)
118
+ - Test complete user scenarios including TEE functionality
119
+
120
+ ### Test Structure
121
+
122
+ ```
123
+ src/
124
+ __tests__/ # All tests live inside src
125
+ *.test.ts # Component tests (use Bun test runner)
126
+ e2e/ # E2E tests (use ElizaOS test runner)
127
+ project-tee-starter.e2e.ts # E2E test suite with TEE-specific tests
128
+ README.md # E2E testing documentation
129
+ index.ts # Export tests here: tests: [ProjectTeeStarterTestSuite]
130
+ ```
131
+
132
+ ### Running Tests
133
+
107
134
  ```bash
108
- # Run all tests
109
- bun test
135
+ # Run all tests (component + e2e)
136
+ elizaos test
110
137
 
111
138
  # Component tests only
112
- bun test:component
139
+ elizaos test component
140
+
141
+ # E2E tests only
142
+ elizaos test e2e
113
143
 
114
- # E2E tests
115
- bun test:e2e
144
+ # With specific port for E2E tests
145
+ elizaos test --port 4000
116
146
  ```
117
147
 
148
+ ### TEE-Specific Testing
149
+
150
+ The E2E tests include TEE-specific scenarios:
151
+
152
+ - TEE service availability checks
153
+ - Attestation action registration
154
+ - Secure memory operations
155
+ - Concurrent secure operations handling
156
+
118
157
  ## 🚀 Deployment
119
158
 
120
159
  ### Local Development
@@ -33,11 +33,11 @@
33
33
  "GUIDE.md"
34
34
  ],
35
35
  "dependencies": {
36
- "@elizaos/cli": "1.3.2",
37
- "@elizaos/core": "1.3.2",
38
- "@elizaos/plugin-bootstrap": "1.3.2",
36
+ "@elizaos/cli": "1.4.3",
37
+ "@elizaos/core": "1.4.3",
38
+ "@elizaos/plugin-bootstrap": "1.4.3",
39
39
  "@elizaos/plugin-redpill": "1.2.1",
40
- "@elizaos/plugin-sql": "1.3.2",
40
+ "@elizaos/plugin-sql": "1.4.3",
41
41
  "@phala/dstack-sdk": "0.1.11",
42
42
  "@solana/web3.js": "1.98.2",
43
43
  "@tanstack/react-query": "^5.29.0",
@@ -5,7 +5,7 @@ import { $ } from 'bun';
5
5
  import { getViteOutDir } from './vite-config-utils';
6
6
 
7
7
  describe('Build Order Integration Test', () => {
8
- const rootDir = path.resolve(__dirname, '..');
8
+ const rootDir = path.resolve(__dirname, '..', '..');
9
9
  const distDir = path.join(rootDir, 'dist');
10
10
  let viteBuildDir: string;
11
11
  const tsupBuildMarker = path.join(distDir, 'index.js'); // TSup creates this
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
- import { mrTeeCharacter as character } from '../src/character';
2
+ import { mrTeeCharacter as character } from '../character';
3
3
  import dotenv from 'dotenv';
4
4
  import * as path from 'node:path';
5
5
 
@@ -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 Configuration', () => {
5
5
  it('should not have custom configuration (relies on character settings)', () => {
@@ -18,6 +18,46 @@ describe('Plugin Configuration', () => {
18
18
  );
19
19
  });
20
20
 
21
+ it('should parse and validate config during initialization', async () => {
22
+ // Mock runtime for testing
23
+ const mockRuntime = {
24
+ logger: {
25
+ info: () => {},
26
+ warn: () => {},
27
+ debug: () => {},
28
+ error: () => {},
29
+ },
30
+ } as any;
31
+
32
+ // Test that config parsing happens during init, not at import time
33
+ const originalEnv = {
34
+ NODE_ENV: process.env.NODE_ENV,
35
+ TEE_MODE: process.env.TEE_MODE,
36
+ WALLET_SECRET_SALT: process.env.WALLET_SECRET_SALT,
37
+ };
38
+
39
+ try {
40
+ // Set test environment with valid defaults
41
+ process.env.NODE_ENV = 'test';
42
+ process.env.TEE_MODE = 'OFF';
43
+ process.env.WALLET_SECRET_SALT = 'test_salt_12345';
44
+
45
+ // Config should be parsed and validated during init without throwing
46
+ await expect(teeStarterPlugin.init({}, mockRuntime)).resolves.toBeUndefined();
47
+
48
+ // Test with invalid config should fail validation during init
49
+ const invalidConfig = { TEE_MODE: 'INVALID_MODE' };
50
+ await expect(teeStarterPlugin.init(invalidConfig, mockRuntime)).rejects.toThrow(
51
+ 'Invalid plugin configuration'
52
+ );
53
+ } finally {
54
+ // Restore original environment
55
+ process.env.NODE_ENV = originalEnv.NODE_ENV;
56
+ process.env.TEE_MODE = originalEnv.TEE_MODE;
57
+ process.env.WALLET_SECRET_SALT = originalEnv.WALLET_SECRET_SALT;
58
+ }
59
+ });
60
+
21
61
  it('should be a TEE-focused plugin with appropriate components', () => {
22
62
  // Verify plugin has TEE-specific components
23
63
  expect(teeStarterPlugin.actions).toEqual([]);
@@ -0,0 +1,128 @@
1
+ # E2E Tests for Project TEE Starter
2
+
3
+ This directory contains end-to-end tests for the ElizaOS project TEE (Trusted Execution Environment) starter template.
4
+
5
+ ## ElizaOS Testing Philosophy
6
+
7
+ ElizaOS employs a dual testing strategy:
8
+
9
+ 1. **Component Tests** (`src/__tests__/*.test.ts`)
10
+
11
+ - Run with Bun's native test runner
12
+ - Fast, isolated tests using mocks
13
+ - Perfect for TDD and component logic
14
+ - Command: `bun test`
15
+
16
+ 2. **E2E Tests** (`src/__tests__/e2e/*.e2e.ts`)
17
+ - Run with ElizaOS custom test runner
18
+ - Real runtime with actual database (PGLite)
19
+ - Test complete user scenarios
20
+ - Command: `elizaos test --type e2e`
21
+
22
+ ## Overview
23
+
24
+ E2E tests run in a real ElizaOS runtime environment, allowing you to test your TEE-enabled project's behavior as it would work in production. These tests include validation of TEE-specific functionality such as attestation, secure operations, and cryptographic features.
25
+
26
+ ## Test Structure
27
+
28
+ - **ProjectTeeStarterTestSuite** - Main test suite containing all e2e tests
29
+ - `tee_project_should_initialize_correctly` - Verifies TEE project and runtime initialization
30
+ - `tee_character_should_be_loaded_correctly` - Checks character configuration including TEE settings
31
+ - `tee_service_should_be_available` - Tests TEE service registration and availability
32
+ - `tee_attestation_action_should_be_registered` - Validates TEE-specific actions
33
+ - `agent_should_respond_with_tee_awareness` - Tests agent's understanding of TEE capabilities
34
+ - `secure_memory_operations_should_work` - Validates secure data handling
35
+ - `tee_plugin_integration_should_work` - Tests TEE plugin integration
36
+ - `concurrent_secure_operations_should_be_handled` - Tests concurrent secure operations
37
+ - `tee_configuration_should_be_valid` - Validates TEE-specific configuration
38
+
39
+ ## Integration with Project
40
+
41
+ E2E tests are integrated directly into your project through the main index.ts file:
42
+
43
+ ```typescript
44
+ // src/index.ts
45
+ import { ProjectTeeStarterTestSuite } from './__tests__/e2e/project-tee-starter.e2e';
46
+
47
+ export const project: Project = {
48
+ agents: [projectAgent],
49
+ tests: [ProjectTeeStarterTestSuite], // Direct import!
50
+ };
51
+ ```
52
+
53
+ ## Running Tests
54
+
55
+ ```bash
56
+ # Run all tests (component + e2e)
57
+ elizaos test
58
+
59
+ # Run only e2e tests (slower, full integration)
60
+ elizaos test --type e2e
61
+
62
+ # Run only component tests (fast, for TDD)
63
+ bun test
64
+ # or
65
+ elizaos test --type component
66
+ ```
67
+
68
+ ## TEE-Specific Testing Considerations
69
+
70
+ ### Development Environment
71
+
72
+ - TEE hardware features may not be available in development
73
+ - Tests gracefully handle missing TEE services with warnings
74
+ - Mock TEE services can be used for development testing
75
+
76
+ ### Production Environment
77
+
78
+ - Full TEE capabilities should be available
79
+ - Attestation endpoints should be configured
80
+ - Secure key storage should be operational
81
+
82
+ ### Configuration
83
+
84
+ TEE-specific environment variables:
85
+
86
+ - `TEE_MODE`: Enable/disable TEE mode
87
+ - `TEE_ATTESTATION_ENDPOINT`: Attestation service endpoint
88
+ - `TEE_PROVIDER`: TEE provider (e.g., 'phala', 'sgx')
89
+
90
+ ## Implementation Details
91
+
92
+ 1. **Direct Import**: Tests are imported directly from the e2e test file
93
+ 2. **Project Integration**: The test suite is added to the project's `tests` array
94
+ 3. **TEE Detection**: Tests detect and adapt to TEE availability
95
+ 4. **Secure Operations**: Tests validate secure data handling and cryptographic operations
96
+ 5. **Runtime Access**: Each test receives a real runtime instance with full access to:
97
+ - TEE services and attestation
98
+ - Secure memory operations
99
+ - Cryptographic functions
100
+ - All standard ElizaOS features
101
+
102
+ ## Key Differences from Standard Project Tests
103
+
104
+ - **Export Location**: Tests are exported from the `ProjectAgent` in `src/index.ts` (not directly from `Project`)
105
+ - **TEE Service Testing**: Additional tests for TEE service availability
106
+ - **Attestation Validation**: Tests for attestation generation and verification
107
+ - **Secure Operations**: Validation of secure data handling
108
+ - **Hardware Adaptation**: Tests adapt to TEE hardware availability
109
+ - **Cryptographic Features**: Testing of signing and verification operations
110
+
111
+ ## Writing New Tests
112
+
113
+ See the comprehensive documentation at the top of `project-tee-starter.e2e.ts` for detailed instructions on adding new tests.
114
+
115
+ ## Best Practices
116
+
117
+ 1. **Hardware Independence**: Write tests that work with or without TEE hardware
118
+ 2. **Security Validation**: Test security features without exposing sensitive data
119
+ 3. **Attestation Mocking**: Use mock attestation in development environments
120
+ 4. **Error Handling**: Test both successful and failed secure operations
121
+ 5. **Configuration Testing**: Validate all TEE-specific configuration options
122
+
123
+ ## Known Considerations
124
+
125
+ - TEE features may require specific hardware or cloud environments
126
+ - Some cryptographic operations may be simulated in development
127
+ - Attestation verification requires connection to attestation services
128
+ - Performance characteristics may differ between TEE and non-TEE environments