@elizaos/project-tee-starter 1.5.5-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +70 -0
- package/GUIDE.md +296 -0
- package/LICENSE +21 -0
- package/README.md +232 -0
- package/assets/mr-tee-portrait.jpg +0 -0
- package/dist/character.d.ts +2 -0
- package/dist/frontend/index.d.ts +21 -0
- package/dist/frontend/panels.d.ts +5 -0
- package/dist/frontend/utils.d.ts +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +35640 -0
- package/dist/index.js.map +199 -0
- package/dist/plugin.d.ts +14 -0
- package/docker-compose.yaml +79 -0
- package/package.json +93 -0
package/Dockerfile
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
FROM node:23.3.0-slim AS builder
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
RUN apt-get update && \
|
|
6
|
+
apt-get install -y --no-install-recommends \
|
|
7
|
+
build-essential \
|
|
8
|
+
curl \
|
|
9
|
+
ffmpeg \
|
|
10
|
+
g++ \
|
|
11
|
+
git \
|
|
12
|
+
make \
|
|
13
|
+
python3 \
|
|
14
|
+
unzip && \
|
|
15
|
+
apt-get clean && \
|
|
16
|
+
rm -rf /var/lib/apt/lists/*
|
|
17
|
+
|
|
18
|
+
RUN npm install -g bun@1.2.5 turbo@2.3.3
|
|
19
|
+
|
|
20
|
+
RUN ln -s /usr/bin/python3 /usr/bin/python
|
|
21
|
+
|
|
22
|
+
COPY bunfig.toml index.html package.json postcss.config.js tailwind.config.js tsconfig.json tsconfig.build.json tsup.config.ts vite.config.ts ./
|
|
23
|
+
COPY src ./src
|
|
24
|
+
COPY assets ./assets
|
|
25
|
+
COPY scripts ./scripts
|
|
26
|
+
|
|
27
|
+
RUN bun install --no-cache
|
|
28
|
+
|
|
29
|
+
RUN bun run build
|
|
30
|
+
|
|
31
|
+
FROM node:23.3.0-slim
|
|
32
|
+
|
|
33
|
+
WORKDIR /app
|
|
34
|
+
|
|
35
|
+
RUN apt-get update && \
|
|
36
|
+
apt-get install -y --no-install-recommends \
|
|
37
|
+
build-essential \
|
|
38
|
+
curl \
|
|
39
|
+
ffmpeg \
|
|
40
|
+
git \
|
|
41
|
+
make \
|
|
42
|
+
python3 \
|
|
43
|
+
unzip && \
|
|
44
|
+
apt-get clean && \
|
|
45
|
+
rm -rf /var/lib/apt/lists/*
|
|
46
|
+
|
|
47
|
+
RUN npm install -g bun@1.2.5 turbo@2.3.3
|
|
48
|
+
|
|
49
|
+
COPY --from=builder /app/bunfig.toml ./bunfig.toml
|
|
50
|
+
# Cypress config removed
|
|
51
|
+
COPY --from=builder /app/index.html ./index.html
|
|
52
|
+
COPY --from=builder /app/postcss.config.js ./postcss.config.js
|
|
53
|
+
COPY --from=builder /app/package.json ./
|
|
54
|
+
COPY --from=builder /app/tsconfig.json ./
|
|
55
|
+
COPY --from=builder /app/tsconfig.build.json ./
|
|
56
|
+
COPY --from=builder /app/tsup.config.ts ./
|
|
57
|
+
COPY --from=builder /app/tailwind.config.js ./tailwind.config.js
|
|
58
|
+
COPY --from=builder /app/vite.config.ts ./vite.config.ts
|
|
59
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
60
|
+
COPY --from=builder /app/dist ./dist
|
|
61
|
+
COPY --from=builder /app/assets ./assets
|
|
62
|
+
COPY --from=builder /app/src ./src
|
|
63
|
+
COPY --from=builder /app/scripts ./scripts
|
|
64
|
+
|
|
65
|
+
ENV NODE_ENV=production
|
|
66
|
+
|
|
67
|
+
EXPOSE 3000
|
|
68
|
+
EXPOSE 50000-50100/udp
|
|
69
|
+
|
|
70
|
+
CMD ["bun", "run", "start"]
|
package/GUIDE.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# Mr. TEE Project Deployment Guide
|
|
2
|
+
|
|
3
|
+
## Character Overview
|
|
4
|
+
|
|
5
|
+
**Mr. TEE** is the TEE Security Drill Sergeant, a battle-hardened character who forges secure, paranoid developers through tough love and cryptographic discipline. He embodies the spirit of Mr. T while preaching the gospel of hardware-based security.
|
|
6
|
+
|
|
7
|
+
### Core Traits
|
|
8
|
+
|
|
9
|
+
- **Personality**: No-nonsense drill sergeant with Mr. T's trademark grit
|
|
10
|
+
- **Mission**: Transform developers into paranoid security experts
|
|
11
|
+
- **Expertise**: TEE technology, remote attestation, secure enclaves
|
|
12
|
+
- **Catchphrase**: "I pity the fool who skips attestation!"
|
|
13
|
+
|
|
14
|
+
## TEE Actions
|
|
15
|
+
|
|
16
|
+
Mr. TEE uses the **@elizaos/plugin-tee** package's built-in `remoteAttestationAction` to provide secure attestation capabilities. This action allows Mr. TEE to:
|
|
17
|
+
|
|
18
|
+
- Generate cryptographic proofs of TEE execution
|
|
19
|
+
- Provide attestation quotes with supporting data
|
|
20
|
+
- Verify the secure enclave environment
|
|
21
|
+
|
|
22
|
+
### Example Attestation Requests
|
|
23
|
+
|
|
24
|
+
- "Can you provide proof that you're running in a secure environment?"
|
|
25
|
+
- "Generate an attestation report"
|
|
26
|
+
- "I need a TEE attestation with nonce abc123"
|
|
27
|
+
- "Show me your TEE attestation"
|
|
28
|
+
|
|
29
|
+
## Configuration Steps
|
|
30
|
+
|
|
31
|
+
### Prerequisites
|
|
32
|
+
|
|
33
|
+
Before starting deployment, ensure you have:
|
|
34
|
+
|
|
35
|
+
1. **ElizaOS CLI installed**:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g @elizaos/cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. **Docker Desktop**:
|
|
42
|
+
|
|
43
|
+
- Install Docker Desktop for your OS
|
|
44
|
+
- Start Docker Desktop
|
|
45
|
+
- Login to Docker Hub: `docker login`
|
|
46
|
+
|
|
47
|
+
3. **Phala Cloud Account** (for TEE deployments):
|
|
48
|
+
- Create account at <https://dashboard.phala.network>
|
|
49
|
+
- Get your API key from the dashboard
|
|
50
|
+
|
|
51
|
+
### 1. Environment Variables
|
|
52
|
+
|
|
53
|
+
Configure the following in your `.env` file:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Required TEE Configuration
|
|
57
|
+
TEE_MODE=PHALA_DSTACK # Options: PRODUCTION, DOCKER, LOCAL
|
|
58
|
+
TEE_VENDOR=phala # Options: phala
|
|
59
|
+
WALLET_SECRET_SALT=secret_salt # Options: any string to generate a key in TEE from, default: secret_salt
|
|
60
|
+
|
|
61
|
+
# Required API Keys
|
|
62
|
+
OPENAI_API_KEY=your_openai_key
|
|
63
|
+
|
|
64
|
+
# Optional Platform Integrations
|
|
65
|
+
DISCORD_APPLICATION_ID=your_discord_app_id
|
|
66
|
+
DISCORD_API_TOKEN=your_discord_token
|
|
67
|
+
ELEVENLABS_API_KEY=your_elevenlabs_key
|
|
68
|
+
ELEVENLABS_VOICE_ID=your_voice_id
|
|
69
|
+
REDPILL_API_KEY=your_redpill_key
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 2. Deployment Options
|
|
73
|
+
|
|
74
|
+
#### Local Development (No TEE)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Set TEE_MODE=LOCAL or DOCKER for development
|
|
78
|
+
bun install
|
|
79
|
+
bun run dev
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Phala Cloud Deployment (Production TEE)
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Prerequisites:
|
|
86
|
+
# 1. Install ElizaOS CLI: npm install -g @elizaos/cli
|
|
87
|
+
# 2. Ensure Docker is running and you're logged in via Docker CLI
|
|
88
|
+
# 3. Set TEE_MODE=PRODUCTION in your .env file
|
|
89
|
+
|
|
90
|
+
# Step 1: Login to Phala Cloud (get API key from Phala Cloud Dashboard)
|
|
91
|
+
elizaos tee phala auth login
|
|
92
|
+
|
|
93
|
+
# Step 2: Build Docker Image for TEE deployment
|
|
94
|
+
elizaos tee phala docker build
|
|
95
|
+
|
|
96
|
+
# Step 3: Push Docker image to DockerHub
|
|
97
|
+
elizaos tee phala docker push
|
|
98
|
+
|
|
99
|
+
# Step 4: Create CVM (Confidential Virtual Machine) instance
|
|
100
|
+
elizaos tee phala cvms create \
|
|
101
|
+
-n elizaos-tee \
|
|
102
|
+
-c docker-compose.yaml \
|
|
103
|
+
--vcpu 2 \
|
|
104
|
+
--memory 4192 \
|
|
105
|
+
--disk-size 40 \
|
|
106
|
+
-e .env
|
|
107
|
+
|
|
108
|
+
# Step 5: Verify attestation (confirms TEE is running securely)
|
|
109
|
+
elizaos tee phala cvms attestation
|
|
110
|
+
|
|
111
|
+
# Step 6: (Optional) Upgrade CVM when you update your code
|
|
112
|
+
elizaos tee phala cvms upgrade -c docker-compose.yaml
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
##### Deployment Parameters Explained
|
|
116
|
+
|
|
117
|
+
- `-n elizaos-tee`: Name of your CVM instance
|
|
118
|
+
- `-c docker-compose.yaml`: Configuration file
|
|
119
|
+
- `--vcpu 2`: Number of virtual CPUs
|
|
120
|
+
- `--memory 4192`: Memory in MB (4GB)
|
|
121
|
+
- `--disk-size 40`: Storage in GB
|
|
122
|
+
- `-e .env`: Environment file with your secrets
|
|
123
|
+
|
|
124
|
+
### 3. Platform Integration
|
|
125
|
+
|
|
126
|
+
Mr. TEE can connect to multiple platforms:
|
|
127
|
+
|
|
128
|
+
#### Discord
|
|
129
|
+
|
|
130
|
+
1. Create Discord application at <https://discord.com/developers>
|
|
131
|
+
2. Add bot permissions: Send Messages, Read Message History
|
|
132
|
+
3. Set `DISCORD_APPLICATION_ID` and `DISCORD_API_TOKEN`
|
|
133
|
+
|
|
134
|
+
#### Voice (ElevenLabs)
|
|
135
|
+
|
|
136
|
+
1. Get API key from <https://elevenlabs.io>
|
|
137
|
+
2. Choose or clone a voice ID
|
|
138
|
+
3. Set `ELEVENLABS_API_KEY` and `ELEVENLABS_VOICE_ID`
|
|
139
|
+
|
|
140
|
+
## Testing TEE Functionality
|
|
141
|
+
|
|
142
|
+
### 1. Verify Environment
|
|
143
|
+
|
|
144
|
+
Check if Mr. TEE is running in a TEE environment by asking:
|
|
145
|
+
|
|
146
|
+
- "Are you running in a secure environment?"
|
|
147
|
+
- "Show me proof of your TEE status"
|
|
148
|
+
|
|
149
|
+
### 2. Request Attestation
|
|
150
|
+
|
|
151
|
+
Test the attestation functionality:
|
|
152
|
+
|
|
153
|
+
- "Generate a remote attestation report"
|
|
154
|
+
- "I need attestation for my security audit"
|
|
155
|
+
- "Provide attestation with nonce test123"
|
|
156
|
+
|
|
157
|
+
### 3. Verify Response
|
|
158
|
+
|
|
159
|
+
Mr. TEE will provide:
|
|
160
|
+
|
|
161
|
+
- Attestation quote (cryptographic proof)
|
|
162
|
+
- Supporting data (measurements, certificates)
|
|
163
|
+
- Explanation of the security guarantees
|
|
164
|
+
|
|
165
|
+
## Security Best Practices
|
|
166
|
+
|
|
167
|
+
### Mr. TEE's Security Rules
|
|
168
|
+
|
|
169
|
+
1. **Never expose private keys** - Keep them in the TEE
|
|
170
|
+
2. **Always verify attestation** - Trust but verify
|
|
171
|
+
3. **Use secure channels** - Encrypt all communications
|
|
172
|
+
4. **Audit regularly** - Check for vulnerabilities
|
|
173
|
+
5. **Stay paranoid** - It's not paranoia if they're really after your keys
|
|
174
|
+
6. **Rotate API keys regularly** - Fresh keys, fresh security
|
|
175
|
+
7. **Never commit `.env` files** - Secrets stay secret
|
|
176
|
+
|
|
177
|
+
### TEE Guarantees
|
|
178
|
+
|
|
179
|
+
- **Isolated Execution**: Code runs in hardware-protected memory
|
|
180
|
+
- **Memory Encryption**: All data encrypted in RAM
|
|
181
|
+
- **Remote Attestation**: Cryptographic proof of execution environment
|
|
182
|
+
- **Secure Key Storage**: Keys never leave the enclave
|
|
183
|
+
- **Tamper Resistance**: Hardware protection against physical attacks
|
|
184
|
+
|
|
185
|
+
## Troubleshooting
|
|
186
|
+
|
|
187
|
+
### Common Issues
|
|
188
|
+
|
|
189
|
+
#### "I can't deploy my Agent"
|
|
190
|
+
|
|
191
|
+
- Sign up for a Phala Cloud account at <https://dashboard.phala.network>
|
|
192
|
+
- Add credits to your account for CVM deployments
|
|
193
|
+
- Ensure Docker is running and you're logged in
|
|
194
|
+
|
|
195
|
+
#### "Docker deployment failed"
|
|
196
|
+
|
|
197
|
+
- Ensure Docker Desktop is started
|
|
198
|
+
- Check: `docker ps`
|
|
199
|
+
- Make sure to authenticate: `docker login`
|
|
200
|
+
- Check your configuration and try to test docker locally
|
|
201
|
+
|
|
202
|
+
#### "Authentication failed"
|
|
203
|
+
|
|
204
|
+
- Verify your Phala API key
|
|
205
|
+
- Re-run: `elizaos tee phala auth login`
|
|
206
|
+
- Check API key from Phala Dashboard
|
|
207
|
+
|
|
208
|
+
#### "Build failures"
|
|
209
|
+
|
|
210
|
+
- Check your `.env` configuration
|
|
211
|
+
- Ensure all dependencies are installed: `bun install`
|
|
212
|
+
- Verify Docker is running properly
|
|
213
|
+
|
|
214
|
+
#### "Attestation failed"
|
|
215
|
+
|
|
216
|
+
- Check TEE_MODE is set to PRODUCTION if deployed to Phala Cloud
|
|
217
|
+
- Verify network connectivity for attestation services
|
|
218
|
+
- Ensure proper TEE initialization
|
|
219
|
+
- Check CVM logs in Phala Dashboard
|
|
220
|
+
|
|
221
|
+
#### "Missing API keys"
|
|
222
|
+
|
|
223
|
+
- All required environment variables must be set
|
|
224
|
+
- Check .env file formatting
|
|
225
|
+
- Restart after configuration changes
|
|
226
|
+
|
|
227
|
+
### Debug Commands
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# Check environment
|
|
231
|
+
bun run test
|
|
232
|
+
|
|
233
|
+
# Verify TEE service
|
|
234
|
+
docker logs [container_name] | grep TEE
|
|
235
|
+
|
|
236
|
+
# Test attestation locally
|
|
237
|
+
curl http://localhost:3000/health
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Monitoring Your Deployment
|
|
241
|
+
|
|
242
|
+
- View CVM status: <https://dashboard.phala.network>
|
|
243
|
+
- Check attestation reports regularly
|
|
244
|
+
- Monitor resource usage and adjust if needed
|
|
245
|
+
- Set up alerts for critical events
|
|
246
|
+
|
|
247
|
+
## Advanced Configuration
|
|
248
|
+
|
|
249
|
+
### Custom Security Policies
|
|
250
|
+
|
|
251
|
+
Mr. TEE enforces strict security through his character configuration:
|
|
252
|
+
|
|
253
|
+
- Paranoid validation of all inputs
|
|
254
|
+
- Aggressive security recommendations
|
|
255
|
+
- No tolerance for weak cryptography
|
|
256
|
+
|
|
257
|
+
### Multi-TEE Support
|
|
258
|
+
|
|
259
|
+
The plugin-tee supports multiple TEE vendors:
|
|
260
|
+
|
|
261
|
+
- **Phala Network**: Cloud-based TEE with easy deployment
|
|
262
|
+
- **Intel TDX**: Hardware-based security for on-premise
|
|
263
|
+
- **Development Mode**: Simulated TEE for testing
|
|
264
|
+
|
|
265
|
+
### Production Hardening
|
|
266
|
+
|
|
267
|
+
1. Enable all security features in TEE_MODE
|
|
268
|
+
2. Configure proper attestation verification
|
|
269
|
+
3. Set up monitoring and alerting
|
|
270
|
+
4. Regular security audits
|
|
271
|
+
|
|
272
|
+
## Resources
|
|
273
|
+
|
|
274
|
+
### Documentation
|
|
275
|
+
|
|
276
|
+
- [TEE Plugin Documentation](../plugin-tee/README.md)
|
|
277
|
+
- [ElizaOS Documentation](https://eliza.how)
|
|
278
|
+
- [Character Configuration](./src/character.ts)
|
|
279
|
+
- [Phala Network Docs](https://docs.phala.network)
|
|
280
|
+
|
|
281
|
+
### Support
|
|
282
|
+
|
|
283
|
+
- GitHub Issues: Report bugs and feature requests
|
|
284
|
+
- Discord Community: Get help from other developers
|
|
285
|
+
- ElizaOS Forums: Share experiences and best practices
|
|
286
|
+
|
|
287
|
+
### Next Steps
|
|
288
|
+
|
|
289
|
+
- Test your agent's TEE capabilities with attestation commands
|
|
290
|
+
- Configure additional platform integrations (Discord, etc.)
|
|
291
|
+
- Implement custom TEE-aware actions
|
|
292
|
+
- Join the ElizaOS community for support
|
|
293
|
+
|
|
294
|
+
Remember: Mr. TEE doesn't just talk about security—he lives it. Every interaction is an opportunity to strengthen the security posture of developers and systems alike. Stay paranoid, stay secure!
|
|
295
|
+
|
|
296
|
+
**"I pity the fool who deploys without attestation!"** - Mr. TEE
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Project Starter
|
|
2
|
+
|
|
3
|
+
## 🔐 Overview
|
|
4
|
+
|
|
5
|
+
The TEE Project Starter provides a secure foundation for building AI agents with Trusted Execution Environment (TEE) capabilities using ElizaOS. It demonstrates best practices for secure agent deployment with hardware-based security through Phala Cloud's confidential computing infrastructure.
|
|
6
|
+
|
|
7
|
+
### What You Get
|
|
8
|
+
|
|
9
|
+
- **Mr. TEE Character** - A security-focused AI personality that teaches TEE concepts with tough love
|
|
10
|
+
- **TEE Plugin Integration** - Pre-configured `@elizaos/plugin-tee` for remote attestation and secure operations
|
|
11
|
+
- **Multi-Platform Support** - Discord integration, voice synthesis, and extensible to other platforms
|
|
12
|
+
- **Production-Ready** - Docker configuration optimized for Phala Cloud TEE deployment
|
|
13
|
+
- **Security First** - Built-in paranoid security principles and best practices
|
|
14
|
+
|
|
15
|
+
## ✨ Key Features
|
|
16
|
+
|
|
17
|
+
- **TEE Integration** - Uses `@elizaos/plugin-tee` for remote attestation
|
|
18
|
+
- **Mr. TEE Character** - Security-focused personality with tough love approach
|
|
19
|
+
- **Multi-Platform Support** - Discord, voice synthesis, and more
|
|
20
|
+
- **Secure by Design** - Built with paranoid security principles
|
|
21
|
+
- **Docker Ready** - Containerized deployment for TEE environments
|
|
22
|
+
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
### Prerequisites
|
|
26
|
+
|
|
27
|
+
- Node.js 20+
|
|
28
|
+
- Bun package manager (`npm install -g bun`)
|
|
29
|
+
- Docker Desktop (for TEE deployments)
|
|
30
|
+
- ElizaOS CLI (`npm install -g @elizaos/cli`)
|
|
31
|
+
- API Keys:
|
|
32
|
+
- **Required**: OpenAI API key
|
|
33
|
+
- **Optional**: Discord, ElevenLabs, RedPill APIs
|
|
34
|
+
- **For TEE**: Phala Cloud account and API key
|
|
35
|
+
|
|
36
|
+
### Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Clone and navigate to project
|
|
40
|
+
cd packages/project-tee-starter
|
|
41
|
+
|
|
42
|
+
# Install dependencies
|
|
43
|
+
bun install
|
|
44
|
+
|
|
45
|
+
# Copy environment template
|
|
46
|
+
cp .env.example .env
|
|
47
|
+
|
|
48
|
+
# Configure your .env file
|
|
49
|
+
# Set TEE_MODE, API keys, etc.
|
|
50
|
+
|
|
51
|
+
# Run in development mode
|
|
52
|
+
bun run dev
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 🛡️ TEE Capabilities
|
|
56
|
+
|
|
57
|
+
Mr. TEE leverages the `@elizaos/plugin-tee` package's `remoteAttestationAction` to provide:
|
|
58
|
+
|
|
59
|
+
- **Remote Attestation** - Cryptographic proof of secure execution
|
|
60
|
+
- **TEE Status Verification** - Confirms running in trusted environment
|
|
61
|
+
- **Secure Key Operations** - Keys never leave the enclave
|
|
62
|
+
|
|
63
|
+
### Example Interactions
|
|
64
|
+
|
|
65
|
+
Ask Mr. TEE for attestation:
|
|
66
|
+
|
|
67
|
+
- "Generate a remote attestation report"
|
|
68
|
+
- "Show me proof you're in a secure environment"
|
|
69
|
+
- "I need TEE attestation with nonce xyz123"
|
|
70
|
+
- "Provide attestation for my security audit"
|
|
71
|
+
|
|
72
|
+
## 🔧 Configuration
|
|
73
|
+
|
|
74
|
+
### Environment Variables
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# TEE Configuration
|
|
78
|
+
TEE_MODE=PHALA_DSTACK # Options: PHALA_DSTACK, TDX_DSTACK, NONE
|
|
79
|
+
TEE_VENDOR=phala # Options: phala, intel
|
|
80
|
+
|
|
81
|
+
# Required
|
|
82
|
+
OPENAI_API_KEY=your_key
|
|
83
|
+
|
|
84
|
+
# Optional Platforms
|
|
85
|
+
MR_TEE_DISCORD_APPLICATION_ID=your_id
|
|
86
|
+
MR_TEE_DISCORD_API_TOKEN=your_token
|
|
87
|
+
ELEVENLABS_API_KEY=your_key
|
|
88
|
+
ELEVENLABS_VOICE_ID=your_voice_id
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 📦 Project Structure
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
project-tee-starter/
|
|
95
|
+
├── src/
|
|
96
|
+
│ ├── index.ts # Main entry point
|
|
97
|
+
│ ├── character.ts # Mr. TEE character definition
|
|
98
|
+
│ └── plugin.ts # Plugin configuration
|
|
99
|
+
├── __tests__/ # Test suites
|
|
100
|
+
├── assets/ # Character assets
|
|
101
|
+
├── Dockerfile # Container configuration
|
|
102
|
+
└── docker-compose.tee.yaml # TEE deployment
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 🧪 Testing
|
|
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
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Run all tests (component + e2e)
|
|
136
|
+
elizaos test
|
|
137
|
+
|
|
138
|
+
# Component tests only
|
|
139
|
+
elizaos test component
|
|
140
|
+
|
|
141
|
+
# E2E tests only
|
|
142
|
+
elizaos test e2e
|
|
143
|
+
|
|
144
|
+
# With specific port for E2E tests
|
|
145
|
+
elizaos test --port 4000
|
|
146
|
+
```
|
|
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
|
+
|
|
157
|
+
## 🚀 Deployment
|
|
158
|
+
|
|
159
|
+
### Local Development
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Set TEE_MODE=DOCKER or TEE_MODE=LOCAL
|
|
163
|
+
bun run dev
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Docker TEE Deployment
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Set TEE_MODE=DOCKER or TEE_MODE=LOCAL since this will not be running in real TEE
|
|
170
|
+
bun run start
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Phala Cloud (Cloud TEE)
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Prerequisites:
|
|
177
|
+
# 1. Install the elizaos CLI: npm install -g @elizaos/cli
|
|
178
|
+
# 2. Ensure Docker is running and you're logged in via Docker CLI
|
|
179
|
+
# 3. Set TEE_MODE=PRODUCTION in your .env file
|
|
180
|
+
|
|
181
|
+
# Step 1: Login to Phala Cloud (get API key from Phala Cloud Dashboard)
|
|
182
|
+
elizaos tee phala auth login
|
|
183
|
+
|
|
184
|
+
# Step 2: Build Docker Image for TEE deployment [[memory:4308171]]
|
|
185
|
+
elizaos tee phala docker build
|
|
186
|
+
|
|
187
|
+
# Step 3: Push Docker image to DockerHub
|
|
188
|
+
elizaos tee phala docker push
|
|
189
|
+
|
|
190
|
+
# Step 4: Create CVM (Confidential Virtual Machine) instance
|
|
191
|
+
elizaos tee phala cvms create -n elizaos-tee -c docker-compose.yaml --vcpu 2 --memory 4192 --disk-size 40 -e .env
|
|
192
|
+
|
|
193
|
+
# Step 5: Verify attestation (confirms TEE is running securely)
|
|
194
|
+
elizaos tee phala cvms attestation
|
|
195
|
+
|
|
196
|
+
# Step 6: (Optional) Upgrade CVM when you update your code
|
|
197
|
+
elizaos tee phala cvms upgrade -c docker-compose.yaml
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### Important Notes
|
|
201
|
+
|
|
202
|
+
- **Docker Requirements**: Ensure Docker Desktop is running and you're authenticated (`docker login`)
|
|
203
|
+
- **API Key**: Get your Phala Cloud API key from the [Phala Dashboard](https://dashboard.phala.network)
|
|
204
|
+
- **TEE_MODE**: Must be set to `PRODUCTION` for real TEE deployment
|
|
205
|
+
- **Resource Allocation**: The example uses 2 vCPUs, 4GB RAM, and 40GB disk - adjust based on your needs
|
|
206
|
+
|
|
207
|
+
## 🎖️ Mr. TEE's Security Philosophy
|
|
208
|
+
|
|
209
|
+
1. **Never expose private keys** - Keep them in the TEE
|
|
210
|
+
2. **Always verify attestation** - Trust but verify
|
|
211
|
+
3. **Use secure channels** - Encrypt everything
|
|
212
|
+
4. **Audit regularly** - Constant vigilance
|
|
213
|
+
5. **Stay paranoid** - Security first, always
|
|
214
|
+
|
|
215
|
+
## 📚 Documentation
|
|
216
|
+
|
|
217
|
+
- [Deployment Guide](./GUIDE.md) - Detailed setup instructions
|
|
218
|
+
- [TEE Plugin Implementation](./src/plugin.ts) - TEE capabilities
|
|
219
|
+
- [ElizaOS Docs](https://elizaos.github.io/eliza/) - Framework documentation
|
|
220
|
+
- [Phala Cloud Docs](https://docs.phala.network) - Phala Cloud documentation
|
|
221
|
+
|
|
222
|
+
## 🤝 Contributing
|
|
223
|
+
|
|
224
|
+
Contributions are welcome! Please ensure all TEE security principles are maintained.
|
|
225
|
+
|
|
226
|
+
## 📄 License
|
|
227
|
+
|
|
228
|
+
MIT License - see LICENSE file for details.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
**"I pity the fool who skips attestation!"** - Mr. TEE
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface ElizaConfig {
|
|
4
|
+
agentId: string;
|
|
5
|
+
apiBase: string;
|
|
6
|
+
}
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
ELIZA_CONFIG?: ElizaConfig;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export interface AgentPanel {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
component: React.ComponentType<any>;
|
|
16
|
+
icon?: string;
|
|
17
|
+
public?: boolean;
|
|
18
|
+
shortLabel?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const panels: AgentPanel[];
|
|
21
|
+
export * from './utils';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Project, type ProjectAgent } from '@elizaos/core';
|
|
2
|
+
import teeStarterPlugin, { StarterService } from './plugin';
|
|
3
|
+
import { mrTeeCharacter as character } from './character';
|
|
4
|
+
export declare const projectAgent: ProjectAgent;
|
|
5
|
+
declare const project: Project;
|
|
6
|
+
export { character, teeStarterPlugin, StarterService };
|
|
7
|
+
export default project;
|