@elizaos/plugin-tee 2.0.0-alpha.6 → 2.0.11-beta.7

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 (46) hide show
  1. package/README.md +83 -0
  2. package/package.json +22 -11
  3. package/dist/index.js +0 -31230
  4. package/dist/index.js.map +0 -186
  5. package/dist/node/actions/index.d.ts +0 -2
  6. package/dist/node/actions/index.d.ts.map +0 -1
  7. package/dist/node/actions/index.js +0 -1
  8. package/dist/node/actions/remoteAttestation.d.ts +0 -3
  9. package/dist/node/actions/remoteAttestation.d.ts.map +0 -1
  10. package/dist/node/actions/remoteAttestation.js +0 -142
  11. package/dist/node/index.d.ts +0 -10
  12. package/dist/node/index.d.ts.map +0 -1
  13. package/dist/node/index.js +0 -34
  14. package/dist/node/providers/base.d.ts +0 -8
  15. package/dist/node/providers/base.d.ts.map +0 -1
  16. package/dist/node/providers/base.js +0 -4
  17. package/dist/node/providers/deriveKey.d.ts +0 -24
  18. package/dist/node/providers/deriveKey.d.ts.map +0 -1
  19. package/dist/node/providers/deriveKey.js +0 -144
  20. package/dist/node/providers/index.d.ts +0 -4
  21. package/dist/node/providers/index.d.ts.map +0 -1
  22. package/dist/node/providers/index.js +0 -3
  23. package/dist/node/providers/remoteAttestation.d.ts +0 -10
  24. package/dist/node/providers/remoteAttestation.d.ts.map +0 -1
  25. package/dist/node/providers/remoteAttestation.js +0 -74
  26. package/dist/node/services/index.d.ts +0 -2
  27. package/dist/node/services/index.d.ts.map +0 -1
  28. package/dist/node/services/index.js +0 -1
  29. package/dist/node/services/tee.d.ts +0 -24
  30. package/dist/node/services/tee.d.ts.map +0 -1
  31. package/dist/node/services/tee.js +0 -42
  32. package/dist/node/types/index.d.ts +0 -58
  33. package/dist/node/types/index.d.ts.map +0 -1
  34. package/dist/node/types/index.js +0 -35
  35. package/dist/node/utils/index.d.ts +0 -9
  36. package/dist/node/utils/index.d.ts.map +0 -1
  37. package/dist/node/utils/index.js +0 -61
  38. package/dist/node/vendors/index.d.ts +0 -5
  39. package/dist/node/vendors/index.d.ts.map +0 -1
  40. package/dist/node/vendors/index.js +0 -14
  41. package/dist/node/vendors/phala.d.ts +0 -10
  42. package/dist/node/vendors/phala.d.ts.map +0 -1
  43. package/dist/node/vendors/phala.js +0 -18
  44. package/dist/node/vendors/types.d.ts +0 -13
  45. package/dist/node/vendors/types.d.ts.map +0 -1
  46. package/dist/node/vendors/types.js +0 -3
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @elizaos/plugin-tee
2
+
3
+ Trusted Execution Environment (TEE) integration plugin for elizaOS. Adds secure key derivation and remote attestation to Eliza agents running inside a TEE.
4
+
5
+ ## What it does
6
+
7
+ - **Remote attestation** — generates a verifiable TDX quote proving an agent is executing inside a real TEE (Phala Network / dstack).
8
+ - **Key derivation** — deterministically derives Ed25519 (Solana) and ECDSA (EVM) keypairs from a secret salt inside the TEE, with per-derivation attestation.
9
+ - **TEEService** — a runtime service (`ServiceType.TEE`) that other plugins can call to derive keys without going through providers.
10
+
11
+ ## Quick start
12
+
13
+ ```typescript
14
+ import { teePlugin, TEEService } from "@elizaos/plugin-tee";
15
+
16
+ const runtime = new AgentRuntime({
17
+ plugins: [teePlugin],
18
+ // TEE_MODE defaults to LOCAL; set WALLET_SECRET_SALT for key derivation
19
+ });
20
+
21
+ // Access via service
22
+ const svc = runtime.getService<TEEService>(TEEService.serviceType);
23
+ const { keypair, attestation } = await svc.deriveEd25519Keypair("salt", "solana", agentId);
24
+ const { keypair: evmKeypair } = await svc.deriveEcdsaKeypair("salt", "evm", agentId);
25
+ ```
26
+
27
+ ## Configuration
28
+
29
+ | Variable | Required | Default | Description |
30
+ |----------|----------|---------|-------------|
31
+ | `TEE_MODE` | no | `LOCAL` | Operation mode: `LOCAL`, `DOCKER`, or `PRODUCTION`. `init` defaults to `LOCAL` when unset and throws only on a present-but-invalid value. |
32
+ | `WALLET_SECRET_SALT` | **yes** | — | Secret salt used as the derivation path for all keypairs. Sensitive — treat as a private key. |
33
+ | `TEE_VENDOR` | no | `PHALA` | TEE vendor. Only `PHALA` is supported. |
34
+
35
+ ### TEE modes
36
+
37
+ | Mode | dstack endpoint | Use |
38
+ |------|----------------|-----|
39
+ | `LOCAL` | `http://localhost:8090` | Local simulator |
40
+ | `DOCKER` | `http://host.docker.internal:8090` | Docker simulator |
41
+ | `PRODUCTION` | (TappdClient default) | Real TEE hardware |
42
+
43
+ Run the Phala dstack simulator for `LOCAL`/`DOCKER` development: see [Phala dstack docs](https://github.com/Phala-Network/dstack).
44
+
45
+ ## Providers registered
46
+
47
+ | Provider | Description |
48
+ |----------|-------------|
49
+ | `phala-derive-key` | Derives Solana public key and EVM address from `WALLET_SECRET_SALT`; injects `solana_public_key` and `evm_address` into agent context. |
50
+ | `phala-remote-attestation` | Generates a TDX quote over the current message payload; injects `quote` and `timestamp`. |
51
+
52
+ Both providers are dynamic and gated to `secrets` / `agent_internal` contexts.
53
+
54
+ ## TEEService API
55
+
56
+ ```typescript
57
+ class TEEService {
58
+ static serviceType: ServiceType.TEE;
59
+
60
+ // Derive Ed25519 keypair (Solana)
61
+ deriveEd25519Keypair(path: string, subject: string, agentId: UUID):
62
+ Promise<{ keypair: Keypair; attestation: RemoteAttestationQuote }>;
63
+
64
+ // Derive ECDSA keypair (EVM)
65
+ deriveEcdsaKeypair(path: string, subject: string, agentId: UUID):
66
+ Promise<{ keypair: PrivateKeyAccount; attestation: RemoteAttestationQuote }>;
67
+
68
+ // Derive raw key bytes
69
+ rawDeriveKey(path: string, subject: string): Promise<DeriveKeyResponse>;
70
+ }
71
+ ```
72
+
73
+ ## Enabling the plugin
74
+
75
+ Add `@elizaos/plugin-tee` to your agent character's `plugins` array and set the required environment variables. The plugin is opt-in and not auto-loaded.
76
+
77
+ ## Development
78
+
79
+ ```bash
80
+ bun run --cwd plugins/plugin-tee build # compile
81
+ bun run --cwd plugins/plugin-tee test # run tests
82
+ bun run --cwd plugins/plugin-tee format:check # lint
83
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-tee",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.11-beta.7",
4
4
  "type": "module",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/node/index.js",
@@ -14,6 +14,11 @@
14
14
  "./package.json": "./package.json",
15
15
  ".": {
16
16
  "types": "./dist/index.d.ts",
17
+ "eliza-source": {
18
+ "types": "./src/index.ts",
19
+ "import": "./src/index.ts",
20
+ "default": "./src/index.ts"
21
+ },
17
22
  "node": {
18
23
  "types": "./dist/node/index.d.ts",
19
24
  "import": "./dist/node/index.js",
@@ -24,6 +29,12 @@
24
29
  "default": "./dist/node/index.js"
25
30
  },
26
31
  "default": "./dist/node/index.js"
32
+ },
33
+ "./*.css": "./dist/*.css",
34
+ "./*": {
35
+ "types": "./dist/*.d.ts",
36
+ "import": "./dist/*.js",
37
+ "default": "./dist/*.js"
27
38
  }
28
39
  },
29
40
  "files": [
@@ -33,26 +44,26 @@
33
44
  ],
34
45
  "sideEffects": false,
35
46
  "dependencies": {
36
- "@elizaos/core": "2.0.0-alpha.3",
37
- "@phala/dstack-sdk": "0.1.11",
47
+ "@elizaos/core": "2.0.11-beta.7",
48
+ "@phala/dstack-sdk": "^0.5.7",
38
49
  "@solana/web3.js": "1.98.4",
39
- "viem": "2.29.4"
50
+ "viem": "^2.48.8"
40
51
  },
41
52
  "devDependencies": {
42
- "@biomejs/biome": "^2.3.11",
53
+ "@biomejs/biome": "^2.4.14",
43
54
  "@types/node": "^25.0.3",
44
- "typescript": "^5.9.3",
55
+ "typescript": "^6.0.3",
45
56
  "vitest": "^4.0.0"
46
57
  },
47
58
  "scripts": {
48
- "build:typescript": "tsc -p tsconfig.build.json",
59
+ "build:typescript": "tsc --noCheck -p tsconfig.build.json",
49
60
  "dev": "bun --hot build.ts",
50
- "clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
61
+ "clean": "rm -rf dist .turbo .turbo-tsconfig.json tsconfig.tsbuildinfo",
51
62
  "format": "bunx @biomejs/biome format --write .",
52
63
  "format:check": "bunx @biomejs/biome format .",
53
64
  "typecheck": "echo \"Typecheck skipped for release\"",
54
65
  "test": "bun run test:typescript",
55
- "test:typescript": "vitest run src/__tests__/ --config vitest.config.ts --passWithNoTests",
66
+ "test:typescript": "vitest run src/__tests__/ --config vitest.config.ts",
56
67
  "test:watch": "vitest",
57
68
  "lint": "echo \"Lint skipped for release\"",
58
69
  "lint:check": "bun run lint",
@@ -62,7 +73,7 @@
62
73
  "publishConfig": {
63
74
  "access": "public"
64
75
  },
65
- "gitHead": "646c632924826e2b75c2304a75ee56959fe4a460",
76
+ "gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e",
66
77
  "agentConfig": {
67
78
  "pluginType": "elizaos:plugin:1.0.0",
68
79
  "pluginParameters": {
@@ -88,7 +99,7 @@
88
99
  }
89
100
  }
90
101
  },
91
- "milady": {
102
+ "eliza": {
92
103
  "platforms": [
93
104
  "node"
94
105
  ],