@elizaos/plugin-social-alpha 2.0.0-beta.1 → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 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 CHANGED
@@ -1,176 +1,97 @@
1
- # Marketplace of Trust Plugin
1
+ # @elizaos/plugin-social-alpha
2
2
 
3
- A sophisticated trust scoring system for ElizaOS that analyzes trading calls and calculates user trust scores based on performance metrics.
3
+ An elizaOS plugin that tracks cryptocurrency token recommendations made by users in chat, evaluates their accuracy against real price outcomes, and builds trust scores for each recommender.
4
4
 
5
- ## Overview
5
+ ## What it does
6
6
 
7
- The Marketplace of Trust plugin provides:
8
- - **Trust Score Calculation**: Advanced algorithm that evaluates users based on profit, win rate, Sharpe ratio, and call quality
9
- - **Trading Call Analysis**: Process Discord messages to extract and analyze trading calls
10
- - **Price Data Enrichment**: Integrate with Birdeye and DexScreener APIs for historical price data
11
- - **Algorithm Optimization**: Machine learning-based parameter tuning for optimal trust score accuracy
12
- - **Leaderboard System**: Real-time trust score rankings with beautiful UI
7
+ - **Recommendation capture.** Every incoming message is analyzed with a single LLM call to detect buy/sell calls ("shills" and "FUD"). Detected calls are stored against the sender's trust profile as an elizaOS Component.
8
+ - **Trust scoring.** Scores are calculated using a multi-factor algorithm: profit percentage, win rate, Sharpe ratio, alpha vs market, consistency, and a scam/rug penalty.
9
+ - **Leaderboard.** Ranked leaderboard of all tracked recommenders is available as a JSON API and as a dashboard view (`SocialAlphaView`).
10
+ - **Agent context injection.** The `socialAlpha` provider injects the current speaker's trust stats and the top/bottom leaderboard into the agent's context automatically, so the agent can factor reputation into its responses.
13
11
 
14
- ## Architecture
12
+ ## Capabilities added to an Eliza agent
15
13
 
16
- ```
17
- src/
18
- ├── services/ # Core business logic
19
- │ ├── SimulationService.ts # Consolidated simulation functionality
20
- │ ├── PriceDataService.ts # Price data fetching and enrichment
21
- │ ├── TrustScoreService.ts # Trust score calculation and optimization
22
- │ └── balancedTrustScoreCalculator.ts # Core scoring algorithm
23
- ├── frontend/ # React UI components
24
- │ └── LeaderboardTable.tsx # Trust score leaderboard
25
- └── __tests__/ # Comprehensive test suite
26
- ```
27
-
28
- ## Installation
14
+ | Capability | Description |
15
+ |-----------|-------------|
16
+ | `socialAlpha` provider | Injects trust scores, win rate, avg P&L, and leaderboard into agent context |
17
+ | `MESSAGE_RECEIVED` event handler | Extracts buy/sell signals from messages in real time |
18
+ | `CommunityInvestorService` | Manages all trust score and recommendation data |
19
+ | `GET /api/social-alpha/leaderboard` route | Returns `LeaderboardEntry[]` JSON |
20
+ | `social-alpha` view | Leaderboard dashboard view — appears in the view manager when the plugin is enabled; requires a configured agent wallet |
29
21
 
30
- ```bash
31
- npm install @elizaos/plugin-marketplace-of-trust
32
- ```
22
+ No actions are added — recommendation capture is event-driven, not agent-initiated.
33
23
 
34
- ## Configuration
24
+ ## How to enable
35
25
 
36
- Add to your `.env` file:
37
-
38
- ```env
39
- # API Keys (at least one required)
40
- BIRDEYE_API_KEY=your_birdeye_api_key
41
- DEXSCREENER_API_KEY=your_dexscreener_api_key
42
-
43
- # Optional: Helius for token metadata
44
- HELIUS_API_KEY=your_helius_api_key
45
- ```
46
-
47
- ## Trust Score Algorithm
48
-
49
- The balanced trust score algorithm considers multiple factors:
26
+ Add the plugin to your agent's character definition:
50
27
 
51
28
  ```typescript
52
- score = profitComponent * profitWeight +
53
- winRateComponent * winRateWeight +
54
- sharpeComponent * sharpeWeight +
55
- alphaComponent * alphaWeight +
56
- consistencyComponent * consistencyWeight +
57
- qualityComponent * qualityWeight
58
- ```
59
-
60
- ### Components:
61
- - **Profit**: Average profit percentage across all calls
62
- - **Win Rate**: Percentage of profitable calls
63
- - **Sharpe Ratio**: Risk-adjusted returns
64
- - **Alpha**: Excess returns vs market
65
- - **Consistency**: Stability of returns
66
- - **Quality**: Penalty for rug pull promotions
29
+ import { socialAlphaPlugin } from "@elizaos/plugin-social-alpha";
67
30
 
68
- ### Default Weights:
69
- - Profit: 25%
70
- - Win Rate: 25%
71
- - Sharpe: 15%
72
- - Alpha: 10%
73
- - Consistency: 10%
74
- - Quality: 15%
75
-
76
- ## API Integration
31
+ export const character = {
32
+ name: "MyAgent",
33
+ plugins: [socialAlphaPlugin],
34
+ // ...
35
+ };
36
+ ```
77
37
 
78
- ### Using in Your Plugin
38
+ ## Required configuration
79
39
 
80
- ```typescript
81
- import { MarketplaceOfTrustService } from '@elizaos/plugin-marketplace-of-trust';
40
+ Set these in your agent's environment or character config:
82
41
 
83
- // In your plugin definition
84
- export const myPlugin: Plugin = {
85
- name: 'my-plugin',
86
- services: [MarketplaceOfTrustService],
87
- // ... other plugin config
88
- };
42
+ ```env
43
+ BIRDEYE_API_KEY= # Token price, security, and trade data (Solana)
44
+ DEXSCREENER_API_KEY= # DEX pair data and ticker resolution
45
+ HELIUS_API_KEY= # Solana holder list data (optional — service degrades gracefully without it)
89
46
  ```
90
47
 
91
- ### Accessing Trust Scores
48
+ The following are declared as required in `agentConfig` but are not actively used in current code paths:
92
49
 
93
- ```typescript
94
- // Get user trust score
95
- const trustProfile = await runtime.getComponent(
96
- userId,
97
- 'trust_profile',
98
- worldId
99
- );
100
-
101
- console.log(`Trust Score: ${trustProfile.data.trustScore}`);
102
- console.log(`Total Calls: ${trustProfile.data.totalCalls}`);
103
- console.log(`Win Rate: ${trustProfile.data.winRate}%`);
50
+ ```env
51
+ JUPITER_API_KEY=
52
+ COINGECKO_API_KEY=
53
+ MORALIS_API_KEY=
104
54
  ```
105
55
 
106
- ## Testing
56
+ ### Optional tuning
107
57
 
108
- Run the comprehensive test suite:
58
+ | Setting | Default | Description |
59
+ |---------|---------|-------------|
60
+ | `PROCESS_TRADE_DECISION_INTERVAL_HOURS` | `1` | How often queued trade decisions are evaluated |
61
+ | `METRIC_REFRESH_INTERVAL_HOURS` | `24` | How often recommender metrics are refreshed |
62
+ | `USER_TRADE_COOLDOWN_HOURS` | `12` | Minimum hours between decisions per user |
63
+ | `SCAM_PENALTY` | `-100` | Trust score penalty for promoting a rug/scam |
64
+ | `SCAM_CORRECT_CALL_BONUS` | `100` | Bonus for correctly calling out a scam |
65
+ | `MAX_RECOMMENDATIONS_IN_PROFILE` | `50` | Rolling window of recommendations kept per user |
109
66
 
110
- ```bash
111
- # Unit tests
112
- npm test
67
+ ## Trust score algorithm
113
68
 
114
- # E2E tests
115
- npm run test:e2e
69
+ The balanced trust score uses:
116
70
 
117
- # Test coverage
118
- npm run test:coverage
119
- ```
120
-
121
- ## Development
71
+ - **Profit** — average percentage gain across evaluated calls
72
+ - **Win rate** — proportion of calls that were profitable
73
+ - **Sharpe ratio** — risk-adjusted returns
74
+ - **Alpha** — excess returns vs market
75
+ - **Consistency** — stability of returns over time
76
+ - **Quality** — scam/rug penalty applied when a promoted token turns out fraudulent; bonus for correctly calling out scams before they dump
122
77
 
123
- ### Building
78
+ Weights are tunable via `src/services/trustScoreOptimizer.ts`.
124
79
 
125
- ```bash
126
- npm run build
127
- ```
80
+ ## Building the view
128
81
 
129
- ### Development Server
82
+ The leaderboard UI is a plugin view served at `/api/views/social-alpha/bundle.js`. Build it (react + `@elizaos/ui` stay externalised to the host shell):
130
83
 
131
84
  ```bash
132
- npm run dev
85
+ bun run --cwd plugins/plugin-social-alpha build
133
86
  ```
134
87
 
135
- ### Code Quality
88
+ ## Running tests
136
89
 
137
90
  ```bash
138
- npm run lint
139
- npm run format
140
- npm run typecheck
91
+ bun run --cwd plugins/plugin-social-alpha test
141
92
  ```
142
93
 
143
- ## Performance Considerations
144
-
145
- - **Caching**: The system caches simulation results and API responses to minimize redundant calls
146
- - **Rate Limiting**: Built-in rate limiting for API calls (100ms delay between requests)
147
- - **Batch Processing**: Processes data in configurable batches to manage memory usage
148
- - **Resume Support**: Price enrichment can be resumed if interrupted
149
-
150
- ## Troubleshooting
151
-
152
- ### Common Issues
153
-
154
- 1. **No API Keys**: Ensure at least one price data API key is configured
155
- 2. **Rate Limits**: If hitting API rate limits, reduce batch size or add delays
156
- 3. **Memory Issues**: For large datasets, reduce batch size or process in chunks
157
- 4. **TypeScript Errors**: Run `npm run typecheck` to identify type issues
158
-
159
- ## Contributing
160
-
161
- 1. Fork the repository
162
- 2. Create a feature branch
163
- 3. Make your changes
164
- 4. Add tests for new functionality
165
- 5. Ensure all tests pass
166
- 6. Submit a pull request
167
-
168
- ## License
169
-
170
- MIT
94
+ ## Supported chains
171
95
 
172
- ## Support
96
+ Primary support is Solana. Ethereum and Base are partially supported for ticker resolution via DexScreener.
173
97
 
174
- For issues and questions:
175
- - GitHub Issues: [elizaos/elizaos](https://github.com/elizaos/elizaos/issues)
176
- - Discord: [ElizaOS Community](https://discord.gg/elizaos)
Binary file
@@ -0,0 +1,70 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1024" height="1024" role="img" aria-label="Social Alpha">
2
+ <defs>
3
+ <linearGradient id="bg-social-alpha" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0" stop-color="#152818"/>
5
+ <stop offset="1" stop-color="#0b1910"/>
6
+ </linearGradient>
7
+ <radialGradient id="blobA-social-alpha" cx="0.5" cy="0.5" r="0.5">
8
+ <stop offset="0" stop-color="#2fda4b" stop-opacity="0.55"/>
9
+ <stop offset="1" stop-color="#2fda4b" stop-opacity="0"/>
10
+ </radialGradient>
11
+ <radialGradient id="blobB-social-alpha" cx="0.5" cy="0.5" r="0.5">
12
+ <stop offset="0" stop-color="#28c38a" stop-opacity="0.5"/>
13
+ <stop offset="1" stop-color="#28c38a" stop-opacity="0"/>
14
+ </radialGradient>
15
+ <radialGradient id="vig-social-alpha" cx="0.5" cy="0.42" r="0.75">
16
+ <stop offset="0" stop-color="#000000" stop-opacity="0"/>
17
+ <stop offset="0.72" stop-color="#000000" stop-opacity="0"/>
18
+ <stop offset="1" stop-color="#000000" stop-opacity="0.5"/>
19
+ </radialGradient>
20
+ <linearGradient id="label-social-alpha" x1="0" y1="0" x2="0" y2="1">
21
+ <stop offset="0" stop-color="#000000" stop-opacity="0"/>
22
+ <stop offset="1" stop-color="#000000" stop-opacity="0.55"/>
23
+ </linearGradient>
24
+ <filter id="soft-social-alpha" x="-30%" y="-30%" width="160%" height="160%">
25
+ <feGaussianBlur stdDeviation="46"/>
26
+ </filter>
27
+ <filter id="iglow-social-alpha" x="-40%" y="-40%" width="180%" height="180%">
28
+ <feDropShadow dx="0" dy="0" stdDeviation="14" flood-color="#45ed61" flood-opacity="0.45"/>
29
+ </filter>
30
+ </defs>
31
+
32
+ <rect width="1024" height="1024" fill="url(#bg-social-alpha)"/>
33
+
34
+ <g opacity="0.9">
35
+ <circle cx="232" cy="220" r="300" fill="url(#blobA-social-alpha)" filter="url(#soft-social-alpha)"/>
36
+ <circle cx="840" cy="800" r="340" fill="url(#blobB-social-alpha)" filter="url(#soft-social-alpha)"/>
37
+ </g>
38
+
39
+ <g stroke="#d7eada" stroke-width="1.4" opacity="0.06">
40
+ <line x1="0" y1="256" x2="1024" y2="256"/>
41
+ <line x1="0" y1="512" x2="1024" y2="512"/>
42
+ <line x1="0" y1="768" x2="1024" y2="768"/>
43
+ <line x1="256" y1="0" x2="256" y2="1024"/>
44
+ <line x1="512" y1="0" x2="512" y2="1024"/>
45
+ <line x1="768" y1="0" x2="768" y2="1024"/>
46
+ </g>
47
+
48
+ <g opacity="0.5">
49
+ <path d="M120 470 A 400 400 0 0 1 904 470" fill="none" stroke="#45ed61" stroke-width="3" opacity="0.35"/>
50
+ </g>
51
+
52
+ <g transform="translate(512 432)" filter="url(#iglow-social-alpha)"
53
+ color="#d7eada" stroke="#d7eada" stroke-width="20"
54
+ stroke-linecap="round" stroke-linejoin="round" fill="none">
55
+ <polyline points="-150,80 -54,-22 6,38 150,-110" fill="none"/>
56
+ <polyline points="92,-110 150,-110 150,-52" fill="none"/>
57
+ <circle cx="-110" cy="128" r="26"/>
58
+ <circle cx="0" cy="128" r="26"/>
59
+ <circle cx="110" cy="128" r="26"/>
60
+ </g>
61
+
62
+ <rect x="0" y="784" width="1024" height="240" fill="url(#label-social-alpha)"/>
63
+ <text x="512" y="892" text-anchor="middle"
64
+ font-family="system-ui, -apple-system, Segoe UI, Roboto, sans-serif"
65
+ font-size="76" font-weight="600" letter-spacing="0.5"
66
+ fill="#d7eada">Social Alpha</text>
67
+ <rect x="460" y="924" width="104" height="6" rx="3" fill="#45ed61"/>
68
+
69
+ <rect width="1024" height="1024" fill="url(#vig-social-alpha)"/>
70
+ </svg>
package/package.json CHANGED
@@ -1,33 +1,44 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-social-alpha",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.11-beta.7",
4
4
  "description": "Social Alpha Plugin — Tracks token recommendations (shills/FUD), builds trust scores based on P&L outcomes, and exposes a Social Alpha Provider with win rate, rank, and recommender analytics.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
+ "./package.json": "./package.json",
9
10
  ".": {
10
11
  "types": "./dist/index.d.ts",
12
+ "eliza-source": {
13
+ "types": "./src/index.ts",
14
+ "import": "./src/index.ts",
15
+ "default": "./src/index.ts"
16
+ },
11
17
  "import": "./dist/index.js",
12
18
  "default": "./dist/index.js"
13
19
  }
14
20
  },
15
21
  "files": [
22
+ "assets",
16
23
  "dist"
17
24
  ],
18
25
  "scripts": {
19
- "build": "bunx vite build",
20
- "dev": "vite",
26
+ "build": "bun run build:js && bun run build:views && bun run build:types",
21
27
  "test": "vitest run --passWithNoTests",
22
- "clean": "rm -rf dist .turbo",
23
- "lint": "echo \"Lint skipped for release\"",
28
+ "clean": "rm -rf dist .turbo node_modules",
29
+ "lint": "bunx @biomejs/biome check src",
24
30
  "lint:check": "bun run lint",
25
- "format": "echo \"Format skipped (source is gitignored vendor code)\"",
26
- "format:check": "echo \"Format check skipped (source is gitignored vendor code)\"",
27
- "typecheck": "echo \"Typecheck skipped for release\""
31
+ "format": "bunx @biomejs/biome format --write src",
32
+ "format:check": "bunx @biomejs/biome format src",
33
+ "typecheck": "tsc --noEmit -p tsconfig.build.json",
34
+ "build:js": "tsup --config ../tsup.plugin-packages.shared.ts",
35
+ "build:views": "bunx --bun vite build --config vite.config.views.ts",
36
+ "build:types": "tsc --noCheck -p tsconfig.build.json",
37
+ "lint:fix": "bunx @biomejs/biome check --write src"
28
38
  },
29
39
  "dependencies": {
30
- "@elizaos/core": "2.0.0-beta.1",
40
+ "@elizaos/core": "2.0.11-beta.7",
41
+ "@elizaos/ui": "2.0.11-beta.7",
31
42
  "bignumber.js": "^11.0.0",
32
43
  "class-variance-authority": "^0.7.1",
33
44
  "clsx": "^2.1.1",
@@ -39,32 +50,26 @@
39
50
  "zod": "^4.4.3"
40
51
  },
41
52
  "peerDependencies": {
42
- "@elizaos/core": "2.0.0-beta.1"
53
+ "@elizaos/core": "2.0.11-beta.7"
43
54
  },
44
55
  "devDependencies": {
45
56
  "@biomejs/biome": "^2.4.14",
46
57
  "@cypress/react": "^9.0.2",
47
58
  "@radix-ui/react-slot": "^1.0.0",
48
59
  "@radix-ui/react-tabs": "^1.0.0",
49
- "@tailwindcss/postcss": "4.2.4",
50
- "@tanstack/react-query": "^5.62.0",
51
60
  "@testing-library/cypress": "^10.0.0",
52
61
  "@types/react": "^19.0.0",
53
62
  "@types/react-dom": "^19.0.0",
54
- "@vitejs/plugin-react-swc": "^4.0.0",
55
- "autoprefixer": "^10.4.21",
56
63
  "cypress": "^15.14.2",
57
64
  "lucide-react": "^1.0.0",
58
- "postcss": "^8.5.4",
59
65
  "react": "^19.0.0",
60
66
  "react-dom": "^19.0.0",
61
67
  "tailwind-merge": "^3.4.0",
62
- "tailwindcss": "^4.0.0",
63
68
  "tsconfig-paths": "^4.2.0",
64
69
  "tsup": "^8.5.1",
65
70
  "tsx": "4.21.0",
66
71
  "typescript": "^6.0.3",
67
- "vite": "^6.0.0",
72
+ "vite": "^8.0.16",
68
73
  "vitest": "^4.0.0"
69
74
  },
70
75
  "publishConfig": {
@@ -116,5 +121,6 @@
116
121
  "sensitive": true
117
122
  }
118
123
  }
119
- }
124
+ },
125
+ "gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
120
126
  }