@elizaos/cli 1.3.1 → 1.4.2
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.
- package/README.md +47 -1
- package/dist/{bun-exec-6CQHTS4F.js → bun-exec-ULMPAIQC.js} +1 -1
- package/dist/{chunk-2ALAPQLV.js → chunk-D3QSET5H.js} +342 -360
- package/dist/{chunk-FDEDLANP.js → chunk-FQYWRHLX.js} +1 -1
- package/dist/{chunk-RM6LUTKD.js → chunk-FSSUAWXQ.js} +3 -3
- package/dist/chunk-GXWWPFBO.js +39 -0
- package/dist/{chunk-D3Q2UZLZ.js → chunk-I4L4T7QX.js} +1 -1
- package/dist/{chunk-KDNV7EA5.js → chunk-SMZBJQJR.js} +1 -1
- package/dist/commands/agent/actions/index.d.ts +5 -0
- package/dist/commands/agent/actions/index.js +4 -4
- package/dist/commands/agent/index.d.ts +2 -2
- package/dist/commands/agent/index.js +4 -4
- package/dist/commands/create/actions/index.js +5 -5
- package/dist/commands/create/index.js +6 -6
- package/dist/commands/shared/index.d.ts +11 -28
- package/dist/commands/shared/index.js +7 -3
- package/dist/index.js +599 -483
- package/dist/{plugin-creator-H26ZLR6H.js → plugin-creator-TCUFII32.js} +2 -2
- package/dist/{registry-N626N4VG.js → registry-RF6PW3EN.js} +4 -4
- package/dist/templates/plugin-quick-starter/README.md +52 -10
- package/dist/templates/plugin-quick-starter/package.json +10 -3
- package/dist/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
- package/dist/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
- package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +537 -146
- package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
- package/dist/templates/plugin-quick-starter/src/plugin.ts +20 -26
- package/dist/templates/plugin-starter/README.md +124 -49
- package/dist/templates/plugin-starter/package.json +10 -3
- package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
- package/{templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → dist/templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
- package/dist/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
- package/dist/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
- package/dist/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
- package/dist/templates/plugin-starter/src/plugin.ts +21 -27
- package/dist/templates/project-starter/README.md +25 -12
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-starter/src/__tests__/actions.test.ts +2 -2
- package/dist/templates/project-starter/src/__tests__/e2e/README.md +103 -0
- package/dist/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
- package/dist/templates/project-starter/src/__tests__/env.test.ts +3 -1
- package/dist/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
- package/dist/templates/project-starter/src/__tests__/integration.test.ts +2 -2
- package/dist/templates/project-starter/src/__tests__/models.test.ts +3 -3
- package/dist/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
- package/dist/templates/project-starter/src/__tests__/provider.test.ts +2 -2
- package/dist/templates/project-starter/src/index.ts +4 -3
- package/dist/templates/project-starter/src/plugin.ts +5 -5
- package/dist/templates/project-starter/tsup.config.ts +2 -1
- package/dist/templates/project-tee-starter/.dockerignore +64 -14
- package/dist/templates/project-tee-starter/Dockerfile +9 -5
- package/dist/templates/project-tee-starter/GUIDE.md +103 -42
- package/dist/templates/project-tee-starter/README.md +83 -24
- package/dist/templates/project-tee-starter/docker-compose.yaml +5 -2
- package/dist/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
- package/dist/templates/project-tee-starter/package.json +34 -14
- package/dist/templates/project-tee-starter/postcss.config.js +3 -0
- package/dist/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
- package/dist/templates/project-tee-starter/scripts/test-all.sh +82 -0
- package/dist/templates/project-tee-starter/src/__tests__/build-order.test.ts +62 -0
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/character.test.ts +20 -18
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +11 -4
- package/dist/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
- package/dist/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +3 -2
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/file-structure.test.ts +16 -5
- package/dist/templates/project-tee-starter/src/__tests__/frontend.test.ts +459 -0
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/plugin.test.ts +5 -3
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/provider.test.ts +2 -2
- package/dist/templates/project-tee-starter/src/__tests__/routes.test.ts +30 -0
- package/dist/templates/project-tee-starter/src/__tests__/tee-validation.test.ts +295 -0
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
- package/dist/templates/project-tee-starter/src/__tests__/vite-config-utils.ts +51 -0
- package/dist/templates/project-tee-starter/src/frontend/index.css +106 -0
- package/dist/templates/project-tee-starter/src/frontend/index.html +20 -0
- package/dist/templates/project-tee-starter/src/frontend/index.tsx +370 -0
- package/dist/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
- package/dist/templates/project-tee-starter/src/frontend/utils.ts +6 -0
- package/dist/templates/project-tee-starter/src/index.ts +8 -6
- package/dist/templates/project-tee-starter/src/plugin.ts +223 -61
- package/dist/templates/project-tee-starter/tailwind.config.js +62 -0
- package/dist/templates/project-tee-starter/tsconfig.build.json +2 -2
- package/dist/templates/project-tee-starter/tsconfig.json +8 -5
- package/dist/templates/project-tee-starter/tsup.config.ts +3 -2
- package/dist/templates/project-tee-starter/vite.config.ts +39 -0
- package/dist/url-utils-CKc_Ebt_.d.ts +35 -0
- package/dist/{utils-H66532NB.js → utils-5HPZSIF6.js} +4 -4
- package/package.json +7 -6
- package/templates/plugin-quick-starter/README.md +52 -10
- package/templates/plugin-quick-starter/package.json +10 -3
- package/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
- package/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
- package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +537 -146
- package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
- package/templates/plugin-quick-starter/src/plugin.ts +20 -26
- package/templates/plugin-starter/README.md +124 -49
- package/templates/plugin-starter/package.json +10 -3
- package/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
- package/{dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
- package/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
- package/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
- package/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
- package/templates/plugin-starter/src/plugin.ts +21 -27
- package/templates/project-starter/README.md +25 -12
- package/templates/project-starter/package.json +4 -4
- package/templates/project-starter/src/__tests__/actions.test.ts +2 -2
- package/templates/project-starter/src/__tests__/e2e/README.md +103 -0
- package/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
- package/templates/project-starter/src/__tests__/env.test.ts +3 -1
- package/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
- package/templates/project-starter/src/__tests__/integration.test.ts +2 -2
- package/templates/project-starter/src/__tests__/models.test.ts +3 -3
- package/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
- package/templates/project-starter/src/__tests__/provider.test.ts +2 -2
- package/templates/project-starter/src/index.ts +4 -3
- package/templates/project-starter/src/plugin.ts +5 -5
- package/templates/project-starter/tsup.config.ts +2 -1
- package/templates/project-tee-starter/.dockerignore +64 -14
- package/templates/project-tee-starter/Dockerfile +9 -5
- package/templates/project-tee-starter/GUIDE.md +103 -42
- package/templates/project-tee-starter/README.md +83 -24
- package/templates/project-tee-starter/docker-compose.yaml +5 -2
- package/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
- package/templates/project-tee-starter/package.json +34 -14
- package/templates/project-tee-starter/postcss.config.js +3 -0
- package/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
- package/templates/project-tee-starter/scripts/test-all.sh +82 -0
- package/templates/project-tee-starter/src/__tests__/build-order.test.ts +62 -0
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/character.test.ts +20 -18
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +11 -4
- package/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
- package/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +3 -2
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/file-structure.test.ts +16 -5
- package/templates/project-tee-starter/src/__tests__/frontend.test.ts +459 -0
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/plugin.test.ts +5 -3
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/provider.test.ts +2 -2
- package/templates/project-tee-starter/src/__tests__/routes.test.ts +30 -0
- package/templates/project-tee-starter/src/__tests__/tee-validation.test.ts +295 -0
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
- package/templates/project-tee-starter/src/__tests__/vite-config-utils.ts +51 -0
- package/templates/project-tee-starter/src/frontend/index.css +106 -0
- package/templates/project-tee-starter/src/frontend/index.html +20 -0
- package/templates/project-tee-starter/src/frontend/index.tsx +370 -0
- package/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
- package/templates/project-tee-starter/src/frontend/utils.ts +6 -0
- package/templates/project-tee-starter/src/index.ts +8 -6
- package/templates/project-tee-starter/src/plugin.ts +223 -61
- package/templates/project-tee-starter/tailwind.config.js +62 -0
- package/templates/project-tee-starter/tsconfig.build.json +2 -2
- package/templates/project-tee-starter/tsconfig.json +8 -5
- package/templates/project-tee-starter/tsup.config.ts +3 -2
- package/templates/project-tee-starter/vite.config.ts +39 -0
- package/dist/chunk-4O6EZU37.js +0 -14
- package/dist/migration-guides/advanced-migration-guide.md +0 -459
- package/dist/migration-guides/completion-requirements.md +0 -379
- package/dist/migration-guides/integrated-migration-loop.md +0 -392
- package/dist/migration-guides/migration-guide.md +0 -712
- package/dist/migration-guides/prompt-and-generation-guide.md +0 -702
- package/dist/migration-guides/state-and-providers-guide.md +0 -544
- package/dist/migration-guides/testing-guide.md +0 -1021
- package/dist/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
- package/dist/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
- package/dist/templates/plugin-starter/dist/index.js +0 -387
- package/dist/templates/plugin-starter/dist/index.js.map +0 -1
- package/dist/templates/plugin-starter/src/tests.ts +0 -6
- package/dist/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
- package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
- package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
- package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
- package/dist/templates/project-tee-starter/__tests__/routes.test.ts +0 -21
- package/dist/templates/project-tee-starter/e2e/project.test.ts +0 -38
- package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
- package/templates/plugin-starter/dist/.vite/manifest.json +0 -11
- package/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
- package/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
- package/templates/plugin-starter/dist/index.d.ts +0 -14
- package/templates/plugin-starter/dist/index.js +0 -387
- package/templates/plugin-starter/dist/index.js.map +0 -1
- package/templates/plugin-starter/src/tests.ts +0 -6
- package/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
- package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
- package/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
- package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
- package/templates/project-tee-starter/__tests__/routes.test.ts +0 -21
- package/templates/project-tee-starter/e2e/project.test.ts +0 -38
- package/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
- /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
- /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
- /package/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
- /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', () => {
|
|
@@ -39,7 +39,8 @@ describe('Environment Setup', () => {
|
|
|
39
39
|
expect(fs.existsSync(packageJsonPath)).toBe(true);
|
|
40
40
|
|
|
41
41
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
42
|
-
expect(packageJson).toHaveProperty('name'
|
|
42
|
+
expect(packageJson).toHaveProperty('name');
|
|
43
|
+
expect(typeof packageJson.name).toBe('string');
|
|
43
44
|
expect(packageJson).toHaveProperty('version');
|
|
44
45
|
expect(packageJson).toHaveProperty('type', 'module');
|
|
45
46
|
expect(packageJson).toHaveProperty('main');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from 'bun:test';
|
|
2
|
-
import teeStarterPlugin from '../
|
|
3
|
-
import { mrTeeCharacter } from '../
|
|
2
|
+
import teeStarterPlugin from '../plugin';
|
|
3
|
+
import { mrTeeCharacter } from '../character';
|
|
4
4
|
|
|
5
5
|
describe('Error Handling', () => {
|
|
6
6
|
describe('Plugin Error Handling', () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
1
|
+
import { describe, expect, it, beforeAll } from 'bun:test';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { $ } from 'bun';
|
|
4
5
|
import { logger } from '@elizaos/core';
|
|
5
6
|
|
|
6
7
|
// Helper function to check if a file exists
|
|
@@ -14,12 +15,21 @@ function directoryExists(dirPath: string): boolean {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
describe('Project Structure Validation', () => {
|
|
17
|
-
const rootDir = path.resolve(__dirname, '..');
|
|
18
|
+
const rootDir = path.resolve(__dirname, '..', '..');
|
|
19
|
+
const distDir = path.join(rootDir, 'dist');
|
|
20
|
+
|
|
21
|
+
beforeAll(async () => {
|
|
22
|
+
// Build the project if dist doesn't exist
|
|
23
|
+
if (!fs.existsSync(distDir)) {
|
|
24
|
+
console.log('Building project for tests...');
|
|
25
|
+
await $`cd ${rootDir} && bun run build`;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
18
28
|
|
|
19
29
|
describe('Directory Structure', () => {
|
|
20
30
|
it('should have the expected directory structure', () => {
|
|
21
31
|
expect(directoryExists(path.join(rootDir, 'src'))).toBe(true);
|
|
22
|
-
expect(directoryExists(path.join(rootDir, '__tests__'))).toBe(true);
|
|
32
|
+
expect(directoryExists(path.join(rootDir, 'src', '__tests__'))).toBe(true);
|
|
23
33
|
});
|
|
24
34
|
|
|
25
35
|
it('should have a dist directory after building', () => {
|
|
@@ -59,8 +69,9 @@ describe('Project Structure Validation', () => {
|
|
|
59
69
|
it('should have the correct package.json configuration', () => {
|
|
60
70
|
const packageJson = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf8'));
|
|
61
71
|
|
|
62
|
-
// Check package name
|
|
63
|
-
expect(packageJson.name).
|
|
72
|
+
// Check package name - should be valid (not checking exact name since it's dynamic in created projects)
|
|
73
|
+
expect(packageJson.name).toBeTruthy();
|
|
74
|
+
expect(typeof packageJson.name).toBe('string');
|
|
64
75
|
|
|
65
76
|
// Check scripts
|
|
66
77
|
expect(packageJson.scripts).toHaveProperty('build');
|