@elizaos/cli 1.4.2 → 1.4.4

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 (35) hide show
  1. package/dist/{chunk-SMZBJQJR.js → chunk-HOC6B3QV.js} +1 -1
  2. package/dist/{chunk-D3QSET5H.js → chunk-N5G5XSGP.js} +29 -5
  3. package/dist/{chunk-FSSUAWXQ.js → chunk-NSNXXD3I.js} +2 -2
  4. package/dist/commands/agent/actions/index.js +1 -1
  5. package/dist/commands/agent/index.js +1 -1
  6. package/dist/commands/create/actions/index.js +2 -2
  7. package/dist/commands/create/index.js +3 -3
  8. package/dist/index.js +138 -128
  9. package/dist/{registry-RF6PW3EN.js → registry-ELONUC44.js} +1 -1
  10. package/dist/templates/plugin-quick-starter/package.json +2 -2
  11. package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +1 -0
  12. package/dist/templates/plugin-starter/package.json +2 -2
  13. package/dist/templates/plugin-starter/src/__tests__/test-utils.ts +1 -0
  14. package/dist/templates/project-starter/package.json +4 -4
  15. package/dist/templates/project-starter/src/__tests__/config.test.ts +6 -15
  16. package/dist/templates/project-starter/src/__tests__/error-handling.test.ts +4 -18
  17. package/dist/templates/project-starter/src/__tests__/events.test.ts +27 -23
  18. package/dist/templates/project-tee-starter/package.json +4 -4
  19. package/dist/templates/project-tee-starter/src/__tests__/config.test.ts +40 -0
  20. package/dist/templates/project-tee-starter/src/index.ts +1 -2
  21. package/dist/templates/project-tee-starter/src/plugin.ts +21 -19
  22. package/dist/{utils-5HPZSIF6.js → utils-X6UXPLKD.js} +1 -1
  23. package/package.json +6 -7
  24. package/templates/plugin-quick-starter/package.json +2 -2
  25. package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +1 -0
  26. package/templates/plugin-starter/package.json +2 -2
  27. package/templates/plugin-starter/src/__tests__/test-utils.ts +1 -0
  28. package/templates/project-starter/package.json +4 -4
  29. package/templates/project-starter/src/__tests__/config.test.ts +6 -15
  30. package/templates/project-starter/src/__tests__/error-handling.test.ts +4 -18
  31. package/templates/project-starter/src/__tests__/events.test.ts +27 -23
  32. package/templates/project-tee-starter/package.json +4 -4
  33. package/templates/project-tee-starter/src/__tests__/config.test.ts +40 -0
  34. package/templates/project-tee-starter/src/index.ts +1 -2
  35. package/templates/project-tee-starter/src/plugin.ts +21 -19
@@ -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([]);
@@ -1,7 +1,6 @@
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';
5
4
 
6
5
  const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
7
6
  logger.info(`Initializing character: ${character.name}`);
@@ -11,7 +10,7 @@ const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
11
10
  export const projectAgent: ProjectAgent = {
12
11
  character,
13
12
  init: async (runtime: IAgentRuntime) => await initCharacter({ runtime }),
14
- tests: [ProjectTeeStarterTestSuite], // Export tests from ProjectAgent
13
+ plugins: [teeStarterPlugin], // Add any additional plugins here
15
14
  };
16
15
 
17
16
  const project: Project = {
@@ -213,34 +213,36 @@ export class StarterService extends Service {
213
213
  const teeStarterPlugin: Plugin = {
214
214
  name: 'mr-tee-starter-plugin',
215
215
  description: "Mr. TEE's starter plugin - using plugin-tee for attestation",
216
- config: {
217
- TEE_MODE: process.env.TEE_MODE,
218
- TEE_VENDOR: process.env.TEE_VENDOR,
219
- WALLET_SECRET_SALT: process.env.WALLET_SECRET_SALT,
220
- },
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>,
221
234
  async init(config: Record<string, string>, runtime: IAgentRuntime) {
222
235
  logger.info('*** Initializing Mr. TEE plugin ***');
223
236
  try {
224
237
  // Merge process.env values with config, config takes precedence
225
- const mergedConfig = {
238
+ const rawConfig = {
226
239
  TEE_MODE: config.TEE_MODE ?? process.env.TEE_MODE,
227
240
  TEE_VENDOR: config.TEE_VENDOR ?? process.env.TEE_VENDOR,
228
241
  WALLET_SECRET_SALT: config.WALLET_SECRET_SALT ?? process.env.WALLET_SECRET_SALT,
229
242
  };
230
243
 
231
- // Apply test defaults if in test environment
232
- const isTestEnvironment = process.env.NODE_ENV === 'test' || process.argv.includes('test');
233
-
234
- if (isTestEnvironment) {
235
- // Apply test-only defaults - NEVER use these in production
236
- mergedConfig.TEE_MODE = mergedConfig.TEE_MODE || 'OFF';
237
- mergedConfig.TEE_VENDOR = mergedConfig.TEE_VENDOR || 'phala';
238
- // Test salt - this is ONLY for test environments and should NEVER be used in production
239
- mergedConfig.WALLET_SECRET_SALT =
240
- mergedConfig.WALLET_SECRET_SALT || 'test_default_salt_12345';
241
- }
242
-
243
- const validatedConfig = await configSchema.parseAsync(mergedConfig);
244
+ // Parse and validate configuration with schema (includes test defaults)
245
+ const validatedConfig = configSchema.parse(rawConfig);
244
246
 
245
247
  // Production safety check - ensure test defaults aren't used in production
246
248
  if (