@elizaos/plugin-trust 1.2.0 → 1.2.1

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 (2) hide show
  1. package/README.md +242 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,244 @@
1
- # @elizaos/plugin-bootstrap
1
+ # @elizaos/plugin-trust
2
2
 
3
- Event handlers, services, actions, providers and functionality on top of the elizaOS core package.
3
+ A comprehensive trust, security, and permission management plugin for ElizaOS, providing multi-dimensional trust scoring, context-aware permissions, and advanced security features.
4
4
 
5
- Should be imported into most agents.
5
+ ## Features
6
+
7
+ - **Multi-dimensional Trust System**: Calculate and track trust scores across multiple dimensions (reliability, competence, integrity, benevolence, transparency)
8
+ - **Context-aware Permission Management**: Dynamic permission system that adapts based on trust levels and context
9
+ - **Security Module**: Advanced threat detection including prompt injection, credential theft, and phishing attempts
10
+ - **Permission Elevation System**: Temporary permission elevation based on trust and justification
11
+ - **Credential Protection**: Automatic detection and prevention of credential theft attempts
12
+ - **LLM-based Evaluation**: AI-powered security threat and trust action evaluation
13
+ - **Role Management**: Hierarchical role system with OWNER, ADMIN, and NONE roles
14
+ - **Settings Management**: Onboarding and configuration system for world/server settings
15
+ - **Trust Interaction Tracking**: Record and analyze trust-affecting behaviors
16
+ - **Security Event Monitoring**: Track and respond to security incidents with trust impact
17
+
18
+ ## Installation
19
+
20
+ As this is a workspace package, it's installed as part of the ElizaOS monorepo:
21
+
22
+ ```bash
23
+ bun install
24
+ ```
25
+
26
+ ## Configuration
27
+
28
+ The plugin requires the following environment variables:
29
+
30
+ ```bash
31
+ # World Configuration (Optional)
32
+ WORLD_ID=your_world_id
33
+
34
+ # Security Settings (Optional)
35
+ TRUST_SCORE_THRESHOLD=60 # Minimum trust score for certain actions
36
+ SECURITY_ALERT_THRESHOLD=0.8 # Threshold for security alerts
37
+ CREDENTIAL_SCAN_ENABLED=true # Enable credential theft scanning
38
+
39
+ # Permission Settings (Optional)
40
+ ELEVATION_DURATION_MINUTES=60 # Default elevation duration
41
+ MAX_ELEVATION_REQUESTS=5 # Max elevation requests per user per day
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ```json
47
+ {
48
+ "plugins": [
49
+ ...otherPlugins,
50
+ "@elizaos/plugin-trust"
51
+ ]
52
+ }
53
+ ```
54
+
55
+ ### Available Actions
56
+
57
+ The plugin provides the following actions:
58
+
59
+ 1. **UPDATE_ROLE** - Assign roles (Admin, Owner, None) to users in a channel
60
+ - Similes: `CHANGE_ROLE`, `SET_PERMISSIONS`, `ASSIGN_ROLE`, `MAKE_ADMIN`
61
+
62
+ 2. **UPDATE_SETTINGS** - Save configuration settings during onboarding
63
+ - Similes: `UPDATE_SETTING`, `SAVE_SETTING`, `SET_CONFIGURATION`, `CONFIGURE`
64
+
65
+ 3. **RECORD_TRUST_INTERACTION** - Record trust-affecting interactions between entities
66
+ - Similes: `record trust event`, `log trust interaction`, `track behavior`
67
+
68
+ 4. **EVALUATE_TRUST** - Evaluate trust score and profile for an entity
69
+ - Similes: `check trust score`, `trust rating`, `show trust level`
70
+
71
+ 5. **REQUEST_ELEVATION** - Request temporary elevation of permissions
72
+ - Similes: `need temporary access`, `request higher privileges`, `elevate my permissions`
73
+
74
+ ### Providers
75
+
76
+ The plugin includes four state providers:
77
+
78
+ 1. **roleProvider** - Provides role information for entities in a world
79
+ 2. **settingsProvider** - Provides current settings and configuration state
80
+ 3. **trustProfileProvider** - Provides detailed trust profile information
81
+ 4. **securityStatusProvider** - Provides current security status and threat level
82
+
83
+ ### Evaluators
84
+
85
+ 1. **reflectionEvaluator** - Analyzes interactions for trust-affecting behaviors
86
+ 2. **trustChangeEvaluator** - Automatically detects and records trust changes based on behavior patterns
87
+
88
+ ### Services
89
+
90
+ The plugin registers five core services:
91
+
92
+ 1. **TrustEngine** (`trust-engine`)
93
+ - Multi-dimensional trust scoring and evidence-based evaluation
94
+ - Trust profile calculation and decision making
95
+ - Interaction history tracking
96
+
97
+ 2. **SecurityModule** (`security-module`)
98
+ - Threat detection and assessment
99
+ - Prompt injection detection
100
+ - Phishing and impersonation detection
101
+ - Security event logging with trust impact
102
+
103
+ 3. **ContextualPermissionSystem** (`contextual-permissions`)
104
+ - Dynamic permission checking based on trust and context
105
+ - Permission elevation request handling
106
+ - Role-based access control integration
107
+
108
+ 4. **CredentialProtector** (`credential-protector`)
109
+ - Credential theft detection and prevention
110
+ - Sensitive data protection
111
+ - Victim alerting system
112
+
113
+ 5. **LLMEvaluator** (`llm-evaluator`)
114
+ - AI-powered security threat evaluation
115
+ - Behavioral analysis and anomaly detection
116
+ - Trust action evaluation with reasoning
117
+
118
+ ## Trust System
119
+
120
+ ### Trust Dimensions
121
+
122
+ The trust system evaluates entities across five dimensions:
123
+ - **Reliability**: Consistency in behavior and keeping promises
124
+ - **Competence**: Skill and capability demonstrations
125
+ - **Integrity**: Ethical behavior and honesty
126
+ - **Benevolence**: Positive intentions and helpfulness
127
+ - **Transparency**: Openness and clarity in communication
128
+
129
+ ### Trust Evidence Types
130
+
131
+ ```typescript
132
+ enum TrustEvidenceType {
133
+ PROMISE_KEPT = 'PROMISE_KEPT',
134
+ PROMISE_BROKEN = 'PROMISE_BROKEN',
135
+ HELPFUL_ACTION = 'HELPFUL_ACTION',
136
+ HARMFUL_ACTION = 'HARMFUL_ACTION',
137
+ VERIFICATION_SUCCESS = 'VERIFICATION_SUCCESS',
138
+ VERIFICATION_FAILURE = 'VERIFICATION_FAILURE',
139
+ COMMUNITY_CONTRIBUTION = 'COMMUNITY_CONTRIBUTION',
140
+ SECURITY_VIOLATION = 'SECURITY_VIOLATION',
141
+ SPAM_BEHAVIOR = 'SPAM_BEHAVIOR',
142
+ SUSPICIOUS_ACTIVITY = 'SUSPICIOUS_ACTIVITY'
143
+ }
144
+ ```
145
+
146
+ ## Permission System
147
+
148
+ ### Permission Types
149
+
150
+ The system supports various permission actions:
151
+ - `manage_roles`: Ability to change user roles
152
+ - `manage_settings`: Ability to modify world/server settings
153
+ - `moderate_content`: Content moderation capabilities
154
+ - `access_sensitive`: Access to sensitive information
155
+ - `execute_admin`: Execute administrative commands
156
+
157
+ ### Permission Elevation
158
+
159
+ Users can request temporary permission elevation based on:
160
+ - Current trust score
161
+ - Justification provided
162
+ - Context of the request
163
+ - Historical behavior
164
+
165
+ ## Security Features
166
+
167
+ ### Threat Detection
168
+
169
+ The security module detects:
170
+ - Prompt injection attempts
171
+ - Credential theft attempts
172
+ - Phishing messages
173
+ - Impersonation attempts
174
+ - Multi-account abuse patterns
175
+ - Suspicious behavioral patterns
176
+
177
+ ### Security Response
178
+
179
+ When threats are detected:
180
+ 1. Security event is logged
181
+ 2. Trust score is impacted
182
+ 3. Potential victims are alerted
183
+ 4. Access may be restricted
184
+
185
+ ## Testing
186
+
187
+ The plugin includes comprehensive E2E tests accessible via:
188
+
189
+ ```typescript
190
+ import { tests } from '@elizaos/plugin-trust';
191
+ ```
192
+
193
+ Run tests with:
194
+ ```bash
195
+ bun test
196
+ ```
197
+
198
+ ## Example Usage
199
+
200
+ ### Evaluating Trust
201
+ ```typescript
202
+ // User: "What is my trust score?"
203
+ // Agent: "Trust Level: Good (65/100) based on 42 interactions"
204
+
205
+ // User: "Show detailed trust profile for Alice"
206
+ // Agent provides detailed breakdown of trust dimensions
207
+ ```
208
+
209
+ ### Managing Roles
210
+ ```typescript
211
+ // User: "Make @john an ADMIN"
212
+ // Agent: "Updated john's role to ADMIN."
213
+ ```
214
+
215
+ ### Requesting Elevation
216
+ ```typescript
217
+ // User: "I need permission to manage roles to help moderate spam"
218
+ // Agent evaluates request based on trust and grants/denies
219
+ ```
220
+
221
+ ## Schema
222
+
223
+ The plugin uses Drizzle ORM with the following main tables:
224
+ - `trustInteractions`: Stores all trust-affecting interactions
225
+ - `trustProfiles`: Caches calculated trust profiles
226
+ - `securityEvents`: Logs security-related events
227
+ - `permissionGrants`: Tracks permission elevations
228
+
229
+ ## Notes
230
+
231
+ - Trust scores range from 0-100 and affect available permissions
232
+ - The system maintains a complete audit trail of all trust-affecting actions
233
+ - Permission elevation is temporary and logged for security
234
+ - Trust profiles are recalculated based on recent interactions
235
+ - Security threats immediately impact trust scores
236
+ - The plugin integrates seamlessly with ElizaOS's world and role systems
237
+ - All actions respect the hierarchical role system (OWNER > ADMIN > NONE)
238
+
239
+ ## Dependencies
240
+
241
+ - `@elizaos/core`: Core ElizaOS functionality
242
+ - `@elizaos/plugin-anthropic`: LLM evaluation capabilities
243
+ - `drizzle-orm`: Database ORM for trust data persistence
244
+ - `dedent`: String formatting for templates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-trust",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Trust and permission management plugin for ElizaOS",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",