@jhinresh/elizaos-plugin 0.1.2 → 0.2.0

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/dist/index.d.ts CHANGED
@@ -3,10 +3,13 @@
3
3
  *
4
4
  * Maiat Trust Score plugin for ElizaOS (ai16z agent framework).
5
5
  *
6
- * Adds trust checking capabilities to any ElizaOS agent:
7
- * - "Is this address safe?" → trust score lookup
8
- * - Auto-gate transactions before execution
9
- * - Report transaction outcomes back to Maiat
6
+ * V0.2.0 Cold-start update:
7
+ * - CHECK_TRUST: Trust score lookup (existing)
8
+ * - SUBMIT_REVIEW: Submit reviews with Scarab staking
9
+ * - GET_INTERACTIONS: Discover wallet contract interactions
10
+ * - GET_PASSPORT: Reputation passport
11
+ * - DEFI_INFO: Query DeFi protocols
12
+ * - AGENT_INFO: Query AI agents
10
13
  *
11
14
  * @example
12
15
  * ```typescript
@@ -23,21 +26,13 @@ export interface MaiatElizaConfig {
23
26
  chain?: string;
24
27
  minScore?: number;
25
28
  }
26
- interface TrustResult {
27
- address: string;
28
- score: number;
29
- risk: string;
30
- type: string;
31
- flags: string[];
32
- safe: boolean;
33
- }
34
29
  /**
35
30
  * ElizaOS plugin definition following the standard plugin interface.
36
31
  *
37
32
  * Registers:
38
- * - Action: CHECK_TRUST responds to "is 0x... safe?" type queries
39
- * - Evaluator: TRUST_GATE — evaluates if an address should be interacted with
40
- * - Provider: TRUST_DATA — provides trust context for agent reasoning
33
+ * - Actions: CHECK_TRUST, SUBMIT_REVIEW, GET_INTERACTIONS, GET_PASSPORT, DEFI_INFO, AGENT_INFO
34
+ * - Evaluator: TRUST_GATE
35
+ * - Provider: TRUST_DATA
41
36
  */
42
37
  export declare function maiatPlugin(config?: MaiatElizaConfig): {
43
38
  name: string;
@@ -52,7 +47,7 @@ export declare function maiatPlugin(config?: MaiatElizaConfig): {
52
47
  data?: undefined;
53
48
  } | {
54
49
  text: string;
55
- data: TrustResult;
50
+ data: any;
56
51
  }>;
57
52
  }[];
58
53
  evaluators: {
package/dist/index.js CHANGED
@@ -3,10 +3,13 @@
3
3
  *
4
4
  * Maiat Trust Score plugin for ElizaOS (ai16z agent framework).
5
5
  *
6
- * Adds trust checking capabilities to any ElizaOS agent:
7
- * - "Is this address safe?" → trust score lookup
8
- * - Auto-gate transactions before execution
9
- * - Report transaction outcomes back to Maiat
6
+ * V0.2.0 Cold-start update:
7
+ * - CHECK_TRUST: Trust score lookup (existing)
8
+ * - SUBMIT_REVIEW: Submit reviews with Scarab staking
9
+ * - GET_INTERACTIONS: Discover wallet contract interactions
10
+ * - GET_PASSPORT: Reputation passport
11
+ * - DEFI_INFO: Query DeFi protocols
12
+ * - AGENT_INFO: Query AI agents
10
13
  *
11
14
  * @example
12
15
  * ```typescript
@@ -20,16 +23,25 @@
20
23
  // ═══════════════════════════════════════════
21
24
  // API Client (lightweight)
22
25
  // ═══════════════════════════════════════════
26
+ function getHeaders(config) {
27
+ const h = {
28
+ "Content-Type": "application/json",
29
+ "User-Agent": "maiat-elizaos-plugin/0.2.0",
30
+ };
31
+ if (config.apiKey)
32
+ h["Authorization"] = `Bearer ${config.apiKey}`;
33
+ return h;
34
+ }
35
+ function getApiUrl(config) {
36
+ return config.apiUrl || "https://maiat-protocol.vercel.app";
37
+ }
23
38
  async function queryMaiat(address, config) {
24
- const apiUrl = config.apiUrl || "https://maiat-protocol.vercel.app";
39
+ const apiUrl = getApiUrl(config);
25
40
  const chain = config.chain || "base";
26
41
  const minScore = config.minScore ?? 3.0;
27
- const headers = {
28
- "User-Agent": "maiat-elizaos-plugin/0.1.0",
29
- };
30
- if (config.apiKey)
31
- headers["Authorization"] = `Bearer ${config.apiKey}`;
32
- const res = await fetch(`${apiUrl}/api/v1/score/${address}?chain=${chain}`, { headers });
42
+ const res = await fetch(`${apiUrl}/api/v1/score/${address}?chain=${chain}`, {
43
+ headers: getHeaders(config),
44
+ });
33
45
  if (!res.ok) {
34
46
  throw new Error(`Maiat API error: ${res.status}`);
35
47
  }
@@ -50,15 +62,18 @@ async function queryMaiat(address, config) {
50
62
  * ElizaOS plugin definition following the standard plugin interface.
51
63
  *
52
64
  * Registers:
53
- * - Action: CHECK_TRUST responds to "is 0x... safe?" type queries
54
- * - Evaluator: TRUST_GATE — evaluates if an address should be interacted with
55
- * - Provider: TRUST_DATA — provides trust context for agent reasoning
65
+ * - Actions: CHECK_TRUST, SUBMIT_REVIEW, GET_INTERACTIONS, GET_PASSPORT, DEFI_INFO, AGENT_INFO
66
+ * - Evaluator: TRUST_GATE
67
+ * - Provider: TRUST_DATA
56
68
  */
57
69
  export function maiatPlugin(config = {}) {
70
+ const apiUrl = getApiUrl(config);
71
+ const headers = getHeaders(config);
58
72
  return {
59
73
  name: "maiat-trust",
60
74
  description: "Trust scoring for on-chain addresses via Maiat Protocol",
61
75
  actions: [
76
+ // --- Existing: CHECK_TRUST ---
62
77
  {
63
78
  name: "CHECK_TRUST",
64
79
  description: "Check the trust score of an on-chain address",
@@ -89,6 +104,167 @@ export function maiatPlugin(config = {}) {
89
104
  }
90
105
  },
91
106
  },
107
+ // --- NEW: SUBMIT_REVIEW ---
108
+ {
109
+ name: "SUBMIT_REVIEW",
110
+ description: "Submit a trust review for a contract. Costs 2 Scarab, earn 3-10 for quality.",
111
+ examples: [
112
+ "Review 0x833589... — rating 8, great stablecoin",
113
+ "Submit review: address 0xabc, rating 3, seems risky",
114
+ ],
115
+ validate: async (message) => /0x[a-fA-F0-9]{40}/.test(message) && /\d/.test(message),
116
+ handler: async (message) => {
117
+ const addrMatch = message.match(/0x[a-fA-F0-9]{40}/);
118
+ const ratingMatch = message.match(/rating\s*:?\s*(\d+)/i) || message.match(/(\d+)\s*\/\s*10/);
119
+ if (!addrMatch)
120
+ return { text: "Please provide a contract address (0x...)" };
121
+ const rating = ratingMatch ? Math.min(10, Math.max(1, parseInt(ratingMatch[1]))) : 5;
122
+ try {
123
+ const res = await fetch(`${apiUrl}/api/v1/review`, {
124
+ method: "POST",
125
+ headers,
126
+ body: JSON.stringify({
127
+ address: addrMatch[0],
128
+ rating,
129
+ comment: message,
130
+ reviewer: "eliza-agent",
131
+ }),
132
+ });
133
+ const data = await res.json();
134
+ if (!res.ok)
135
+ throw new Error(data.error || `HTTP ${res.status}`);
136
+ return {
137
+ text: `✅ Review submitted!\n\n- Address: \`${addrMatch[0]}\`\n- Rating: ${rating}/10\n- Scarab earned: ${data.meta?.scarabReward || 0} 🪲`,
138
+ data,
139
+ };
140
+ }
141
+ catch (error) {
142
+ return { text: `❌ Review failed: ${error instanceof Error ? error.message : "Unknown error"}` };
143
+ }
144
+ },
145
+ },
146
+ // --- NEW: GET_INTERACTIONS ---
147
+ {
148
+ name: "GET_INTERACTIONS",
149
+ description: "Discover which contracts a wallet has interacted with",
150
+ examples: [
151
+ "What contracts has 0x1234... interacted with?",
152
+ "Show interactions for 0xabcd...",
153
+ ],
154
+ validate: async (message) => /0x[a-fA-F0-9]{40}/.test(message),
155
+ handler: async (message) => {
156
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
157
+ if (!match)
158
+ return { text: "Please provide a wallet address." };
159
+ try {
160
+ const res = await fetch(`${apiUrl}/api/v1/wallet/${match[0]}/interactions`, { headers });
161
+ if (!res.ok)
162
+ throw new Error(`HTTP ${res.status}`);
163
+ const data = await res.json();
164
+ const list = data.interacted?.map((c) => ` • ${c.name} (${c.category}) — ${c.txCount} txs`).join("\n") || "None found";
165
+ return {
166
+ text: `📋 Wallet Interactions (${data.interactedCount} contracts):\n\n${list}`,
167
+ data,
168
+ };
169
+ }
170
+ catch (error) {
171
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
172
+ }
173
+ },
174
+ },
175
+ // --- NEW: GET_PASSPORT ---
176
+ {
177
+ name: "GET_PASSPORT",
178
+ description: "Get a wallet's reputation passport",
179
+ examples: [
180
+ "Show passport for 0x1234...",
181
+ "What's my reputation level?",
182
+ ],
183
+ validate: async (message) => /0x[a-fA-F0-9]{40}/.test(message),
184
+ handler: async (message) => {
185
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
186
+ if (!match)
187
+ return { text: "Please provide a wallet address." };
188
+ try {
189
+ const res = await fetch(`${apiUrl}/api/v1/wallet/${match[0]}/passport`, { headers });
190
+ if (!res.ok)
191
+ throw new Error(`HTTP ${res.status}`);
192
+ const data = await res.json();
193
+ const p = data.passport;
194
+ return {
195
+ text: `🛡️ Reputation Passport\n\n- Trust Level: ${p.trustLevel.toUpperCase()}\n- Reputation: ${p.reputationScore}\n- Reviews: ${p.totalReviews}\n- Scarab: ${data.scarab?.balance || 0} 🪲\n- Fee Tier: ${p.feeTier.discount}`,
196
+ data,
197
+ };
198
+ }
199
+ catch (error) {
200
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
201
+ }
202
+ },
203
+ },
204
+ // --- NEW: DEFI_INFO ---
205
+ {
206
+ name: "DEFI_INFO",
207
+ description: "Look up a DeFi protocol by name or address",
208
+ examples: [
209
+ "Tell me about USDC",
210
+ "What's the trust score for Aerodrome?",
211
+ "Look up 0x833589...",
212
+ ],
213
+ validate: async (message) => true,
214
+ handler: async (message) => {
215
+ const addrMatch = message.match(/0x[a-fA-F0-9]{40}/);
216
+ const slugMatch = message.match(/\b(usdc|weth|dai|aerodrome|aave|compound|morpho|uniswap|chainlink|stargate)\b/i);
217
+ const query = addrMatch?.[0] || slugMatch?.[0]?.toLowerCase();
218
+ if (!query)
219
+ return { text: "Please specify a DeFi protocol name (e.g. USDC, Aave) or address." };
220
+ try {
221
+ const res = await fetch(`${apiUrl}/api/v1/defi/${query}`, { headers });
222
+ if (!res.ok)
223
+ throw new Error(res.status === 404 ? `"${query}" not found` : `HTTP ${res.status}`);
224
+ const data = await res.json();
225
+ const e = data.entity;
226
+ return {
227
+ text: `📊 ${e.name}\n\n- Address: \`${e.address}\`\n- Category: ${e.category}\n- Trust: ${data.trust?.score ?? "N/A"}/10\n- Reviews: ${data.reviews?.total || 0}`,
228
+ data,
229
+ };
230
+ }
231
+ catch (error) {
232
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
233
+ }
234
+ },
235
+ },
236
+ // --- NEW: AGENT_INFO ---
237
+ {
238
+ name: "AGENT_INFO",
239
+ description: "Look up an AI agent by name or address",
240
+ examples: [
241
+ "Tell me about AIXBT",
242
+ "What's Virtuals trust score?",
243
+ "Look up agent 0x4f9fd6...",
244
+ ],
245
+ validate: async (message) => true,
246
+ handler: async (message) => {
247
+ const addrMatch = message.match(/0x[a-fA-F0-9]{40}/);
248
+ const slugMatch = message.match(/\b(aixbt|virtuals|luna|vaderai|freysa|sekoia)\b/i);
249
+ const query = addrMatch?.[0] || slugMatch?.[0]?.toLowerCase();
250
+ if (!query)
251
+ return { text: "Please specify an agent name (e.g. AIXBT, Virtuals) or address." };
252
+ try {
253
+ const res = await fetch(`${apiUrl}/api/v1/agent/${query}`, { headers });
254
+ if (!res.ok)
255
+ throw new Error(res.status === 404 ? `"${query}" not found` : `HTTP ${res.status}`);
256
+ const data = await res.json();
257
+ const e = data.entity;
258
+ return {
259
+ text: `🤖 ${e.name}\n\n- Address: \`${e.address}\`\n- Category: ${e.category}\n- Trust: ${data.trust?.score ?? "N/A"}/10\n- Reviews: ${data.reviews?.total || 0}`,
260
+ data,
261
+ };
262
+ }
263
+ catch (error) {
264
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
265
+ }
266
+ },
267
+ },
92
268
  ],
93
269
  evaluators: [
94
270
  {
@@ -120,7 +296,7 @@ export function maiatPlugin(config = {}) {
120
296
  description: "Provides trust scoring context for agent reasoning",
121
297
  handler: async () => {
122
298
  return {
123
- text: "You have access to Maiat trust scoring. Before interacting with any unknown on-chain address, use CHECK_TRUST to verify it's safe. Addresses scoring below 3.0/10 should be avoided.",
299
+ text: "You have Maiat trust scoring. Use CHECK_TRUST for address safety, SUBMIT_REVIEW to review contracts, GET_INTERACTIONS to discover wallet activity, GET_PASSPORT for reputation, DEFI_INFO/AGENT_INFO to look up protocols and agents.",
124
300
  };
125
301
  },
126
302
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jhinresh/elizaos-plugin",
3
- "version": "0.1.2",
4
- "description": "Maiat Trust Score plugin for ElizaOS — verify trust before your agent swaps or transacts",
3
+ "version": "0.2.0",
4
+ "description": "Maiat Trust Score plugin for ElizaOS — trust-gated agent interactions",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -10,23 +10,14 @@
10
10
  "build": "tsc",
11
11
  "dev": "tsc --watch"
12
12
  },
13
+ "devDependencies": {
14
+ "typescript": "^5.5.0"
15
+ },
13
16
  "keywords": [
14
17
  "maiat",
15
18
  "elizaos",
16
- "eliza",
17
19
  "ai16z",
18
20
  "trust-score",
19
- "ai-agent",
20
- "web3",
21
- "defi",
22
- "base"
23
- ],
24
- "repository": {
25
- "type": "git",
26
- "url": "https://github.com/JhiNResH/elizaos-plugin-maiat.git"
27
- },
28
- "homepage": "https://maiat-protocol.vercel.app",
29
- "devDependencies": {
30
- "typescript": "^5.5.0"
31
- }
21
+ "ai-agent"
22
+ ]
32
23
  }
package/src/index.ts CHANGED
@@ -3,10 +3,13 @@
3
3
  *
4
4
  * Maiat Trust Score plugin for ElizaOS (ai16z agent framework).
5
5
  *
6
- * Adds trust checking capabilities to any ElizaOS agent:
7
- * - "Is this address safe?" → trust score lookup
8
- * - Auto-gate transactions before execution
9
- * - Report transaction outcomes back to Maiat
6
+ * V0.2.0 Cold-start update:
7
+ * - CHECK_TRUST: Trust score lookup (existing)
8
+ * - SUBMIT_REVIEW: Submit reviews with Scarab staking
9
+ * - GET_INTERACTIONS: Discover wallet contract interactions
10
+ * - GET_PASSPORT: Reputation passport
11
+ * - DEFI_INFO: Query DeFi protocols
12
+ * - AGENT_INFO: Query AI agents
10
13
  *
11
14
  * @example
12
15
  * ```typescript
@@ -42,20 +45,30 @@ interface TrustResult {
42
45
  // API Client (lightweight)
43
46
  // ═══════════════════════════════════════════
44
47
 
48
+ function getHeaders(config: MaiatElizaConfig): Record<string, string> {
49
+ const h: Record<string, string> = {
50
+ "Content-Type": "application/json",
51
+ "User-Agent": "maiat-elizaos-plugin/0.2.0",
52
+ };
53
+ if (config.apiKey) h["Authorization"] = `Bearer ${config.apiKey}`;
54
+ return h;
55
+ }
56
+
57
+ function getApiUrl(config: MaiatElizaConfig): string {
58
+ return config.apiUrl || "https://maiat-protocol.vercel.app";
59
+ }
60
+
45
61
  async function queryMaiat(
46
62
  address: string,
47
63
  config: MaiatElizaConfig
48
64
  ): Promise<TrustResult> {
49
- const apiUrl = config.apiUrl || "https://maiat-protocol.vercel.app";
65
+ const apiUrl = getApiUrl(config);
50
66
  const chain = config.chain || "base";
51
67
  const minScore = config.minScore ?? 3.0;
52
68
 
53
- const headers: Record<string, string> = {
54
- "User-Agent": "maiat-elizaos-plugin/0.1.0",
55
- };
56
- if (config.apiKey) headers["Authorization"] = `Bearer ${config.apiKey}`;
57
-
58
- const res = await fetch(`${apiUrl}/api/v1/score/${address}?chain=${chain}`, { headers });
69
+ const res = await fetch(`${apiUrl}/api/v1/score/${address}?chain=${chain}`, {
70
+ headers: getHeaders(config),
71
+ });
59
72
 
60
73
  if (!res.ok) {
61
74
  throw new Error(`Maiat API error: ${res.status}`);
@@ -80,16 +93,20 @@ async function queryMaiat(
80
93
  * ElizaOS plugin definition following the standard plugin interface.
81
94
  *
82
95
  * Registers:
83
- * - Action: CHECK_TRUST responds to "is 0x... safe?" type queries
84
- * - Evaluator: TRUST_GATE — evaluates if an address should be interacted with
85
- * - Provider: TRUST_DATA — provides trust context for agent reasoning
96
+ * - Actions: CHECK_TRUST, SUBMIT_REVIEW, GET_INTERACTIONS, GET_PASSPORT, DEFI_INFO, AGENT_INFO
97
+ * - Evaluator: TRUST_GATE
98
+ * - Provider: TRUST_DATA
86
99
  */
87
100
  export function maiatPlugin(config: MaiatElizaConfig = {}) {
101
+ const apiUrl = getApiUrl(config);
102
+ const headers = getHeaders(config);
103
+
88
104
  return {
89
105
  name: "maiat-trust",
90
106
  description: "Trust scoring for on-chain addresses via Maiat Protocol",
91
107
 
92
108
  actions: [
109
+ // --- Existing: CHECK_TRUST ---
93
110
  {
94
111
  name: "CHECK_TRUST",
95
112
  description: "Check the trust score of an on-chain address",
@@ -120,6 +137,165 @@ export function maiatPlugin(config: MaiatElizaConfig = {}) {
120
137
  }
121
138
  },
122
139
  },
140
+ // --- NEW: SUBMIT_REVIEW ---
141
+ {
142
+ name: "SUBMIT_REVIEW",
143
+ description: "Submit a trust review for a contract. Costs 2 Scarab, earn 3-10 for quality.",
144
+ examples: [
145
+ "Review 0x833589... — rating 8, great stablecoin",
146
+ "Submit review: address 0xabc, rating 3, seems risky",
147
+ ],
148
+ validate: async (message: string) => /0x[a-fA-F0-9]{40}/.test(message) && /\d/.test(message),
149
+ handler: async (message: string) => {
150
+ const addrMatch = message.match(/0x[a-fA-F0-9]{40}/);
151
+ const ratingMatch = message.match(/rating\s*:?\s*(\d+)/i) || message.match(/(\d+)\s*\/\s*10/);
152
+ if (!addrMatch) return { text: "Please provide a contract address (0x...)" };
153
+ const rating = ratingMatch ? Math.min(10, Math.max(1, parseInt(ratingMatch[1]))) : 5;
154
+
155
+ try {
156
+ const res = await fetch(`${apiUrl}/api/v1/review`, {
157
+ method: "POST",
158
+ headers,
159
+ body: JSON.stringify({
160
+ address: addrMatch[0],
161
+ rating,
162
+ comment: message,
163
+ reviewer: "eliza-agent",
164
+ }),
165
+ });
166
+ const data = await res.json();
167
+ if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
168
+
169
+ return {
170
+ text: `✅ Review submitted!\n\n- Address: \`${addrMatch[0]}\`\n- Rating: ${rating}/10\n- Scarab earned: ${data.meta?.scarabReward || 0} 🪲`,
171
+ data,
172
+ };
173
+ } catch (error) {
174
+ return { text: `❌ Review failed: ${error instanceof Error ? error.message : "Unknown error"}` };
175
+ }
176
+ },
177
+ },
178
+ // --- NEW: GET_INTERACTIONS ---
179
+ {
180
+ name: "GET_INTERACTIONS",
181
+ description: "Discover which contracts a wallet has interacted with",
182
+ examples: [
183
+ "What contracts has 0x1234... interacted with?",
184
+ "Show interactions for 0xabcd...",
185
+ ],
186
+ validate: async (message: string) => /0x[a-fA-F0-9]{40}/.test(message),
187
+ handler: async (message: string) => {
188
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
189
+ if (!match) return { text: "Please provide a wallet address." };
190
+
191
+ try {
192
+ const res = await fetch(`${apiUrl}/api/v1/wallet/${match[0]}/interactions`, { headers });
193
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
194
+ const data = await res.json();
195
+
196
+ const list = data.interacted?.map((c: { name: string; category: string; txCount: number }) =>
197
+ ` • ${c.name} (${c.category}) — ${c.txCount} txs`
198
+ ).join("\n") || "None found";
199
+
200
+ return {
201
+ text: `📋 Wallet Interactions (${data.interactedCount} contracts):\n\n${list}`,
202
+ data,
203
+ };
204
+ } catch (error) {
205
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
206
+ }
207
+ },
208
+ },
209
+ // --- NEW: GET_PASSPORT ---
210
+ {
211
+ name: "GET_PASSPORT",
212
+ description: "Get a wallet's reputation passport",
213
+ examples: [
214
+ "Show passport for 0x1234...",
215
+ "What's my reputation level?",
216
+ ],
217
+ validate: async (message: string) => /0x[a-fA-F0-9]{40}/.test(message),
218
+ handler: async (message: string) => {
219
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
220
+ if (!match) return { text: "Please provide a wallet address." };
221
+
222
+ try {
223
+ const res = await fetch(`${apiUrl}/api/v1/wallet/${match[0]}/passport`, { headers });
224
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
225
+ const data = await res.json();
226
+
227
+ const p = data.passport;
228
+ return {
229
+ text: `🛡️ Reputation Passport\n\n- Trust Level: ${p.trustLevel.toUpperCase()}\n- Reputation: ${p.reputationScore}\n- Reviews: ${p.totalReviews}\n- Scarab: ${data.scarab?.balance || 0} 🪲\n- Fee Tier: ${p.feeTier.discount}`,
230
+ data,
231
+ };
232
+ } catch (error) {
233
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
234
+ }
235
+ },
236
+ },
237
+ // --- NEW: DEFI_INFO ---
238
+ {
239
+ name: "DEFI_INFO",
240
+ description: "Look up a DeFi protocol by name or address",
241
+ examples: [
242
+ "Tell me about USDC",
243
+ "What's the trust score for Aerodrome?",
244
+ "Look up 0x833589...",
245
+ ],
246
+ validate: async (message: string) => true,
247
+ handler: async (message: string) => {
248
+ const addrMatch = message.match(/0x[a-fA-F0-9]{40}/);
249
+ const slugMatch = message.match(/\b(usdc|weth|dai|aerodrome|aave|compound|morpho|uniswap|chainlink|stargate)\b/i);
250
+ const query = addrMatch?.[0] || slugMatch?.[0]?.toLowerCase();
251
+ if (!query) return { text: "Please specify a DeFi protocol name (e.g. USDC, Aave) or address." };
252
+
253
+ try {
254
+ const res = await fetch(`${apiUrl}/api/v1/defi/${query}`, { headers });
255
+ if (!res.ok) throw new Error(res.status === 404 ? `"${query}" not found` : `HTTP ${res.status}`);
256
+ const data = await res.json();
257
+ const e = data.entity;
258
+
259
+ return {
260
+ text: `📊 ${e.name}\n\n- Address: \`${e.address}\`\n- Category: ${e.category}\n- Trust: ${data.trust?.score ?? "N/A"}/10\n- Reviews: ${data.reviews?.total || 0}`,
261
+ data,
262
+ };
263
+ } catch (error) {
264
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
265
+ }
266
+ },
267
+ },
268
+ // --- NEW: AGENT_INFO ---
269
+ {
270
+ name: "AGENT_INFO",
271
+ description: "Look up an AI agent by name or address",
272
+ examples: [
273
+ "Tell me about AIXBT",
274
+ "What's Virtuals trust score?",
275
+ "Look up agent 0x4f9fd6...",
276
+ ],
277
+ validate: async (message: string) => true,
278
+ handler: async (message: string) => {
279
+ const addrMatch = message.match(/0x[a-fA-F0-9]{40}/);
280
+ const slugMatch = message.match(/\b(aixbt|virtuals|luna|vaderai|freysa|sekoia)\b/i);
281
+ const query = addrMatch?.[0] || slugMatch?.[0]?.toLowerCase();
282
+ if (!query) return { text: "Please specify an agent name (e.g. AIXBT, Virtuals) or address." };
283
+
284
+ try {
285
+ const res = await fetch(`${apiUrl}/api/v1/agent/${query}`, { headers });
286
+ if (!res.ok) throw new Error(res.status === 404 ? `"${query}" not found` : `HTTP ${res.status}`);
287
+ const data = await res.json();
288
+ const e = data.entity;
289
+
290
+ return {
291
+ text: `🤖 ${e.name}\n\n- Address: \`${e.address}\`\n- Category: ${e.category}\n- Trust: ${data.trust?.score ?? "N/A"}/10\n- Reviews: ${data.reviews?.total || 0}`,
292
+ data,
293
+ };
294
+ } catch (error) {
295
+ return { text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}` };
296
+ }
297
+ },
298
+ },
123
299
  ],
124
300
 
125
301
  evaluators: [
@@ -152,7 +328,7 @@ export function maiatPlugin(config: MaiatElizaConfig = {}) {
152
328
  description: "Provides trust scoring context for agent reasoning",
153
329
  handler: async () => {
154
330
  return {
155
- text: "You have access to Maiat trust scoring. Before interacting with any unknown on-chain address, use CHECK_TRUST to verify it's safe. Addresses scoring below 3.0/10 should be avoided.",
331
+ text: "You have Maiat trust scoring. Use CHECK_TRUST for address safety, SUBMIT_REVIEW to review contracts, GET_INTERACTIONS to discover wallet activity, GET_PASSPORT for reputation, DEFI_INFO/AGENT_INFO to look up protocols and agents.",
156
332
  };
157
333
  },
158
334
  },
package/README.md DELETED
@@ -1,66 +0,0 @@
1
- # @jhinresh/elizaos-plugin
2
-
3
- > Maiat Trust Score plugin for ElizaOS — verify trust before your agent swaps or transacts.
4
-
5
- Adds trust-checking actions and evaluators to any ElizaOS agent so it can **refuse to interact with low-trust addresses** before executing swaps, transfers, or on-chain actions.
6
-
7
- Powered by [Maiat Protocol](https://maiat-protocol.vercel.app) — on-chain verified trust scores for tokens, DeFi protocols, and AI agents on Base.
8
-
9
- ## Install
10
-
11
- ```bash
12
- npm install @jhinresh/elizaos-plugin
13
- ```
14
-
15
- ## Usage
16
-
17
- ```typescript
18
- import { maiatPlugin } from "@jhinresh/elizaos-plugin";
19
-
20
- const agent = new ElizaAgent({
21
- plugins: [
22
- maiatPlugin({
23
- minScore: 3.0, // reject addresses with score < 3.0/10
24
- chain: "base",
25
- }),
26
- ],
27
- });
28
- ```
29
-
30
- ## What it does
31
-
32
- | Component | Type | Behaviour |
33
- |-----------|------|-----------|
34
- | `CHECK_TRUST` | Action | Agent can ask "is 0x... safe?" and get a trust score |
35
- | `TRUST_GATE` | Evaluator | Runs before any swap/transfer — rejects low-trust addresses |
36
- | `TRUST_DATA` | Provider | Injects trust context into agent's world state |
37
-
38
- ## Trust Score Scale
39
-
40
- | Score | Risk | Action |
41
- |-------|------|--------|
42
- | 7–10 | 🟢 Low | Allow |
43
- | 4–6.9 | 🟡 Medium | Warn |
44
- | 0–3.9 | 🔴 High | **Block** |
45
-
46
- ## Config
47
-
48
- ```typescript
49
- maiatPlugin({
50
- apiUrl: "https://maiat-protocol.vercel.app", // default
51
- apiKey: "your-key", // optional — free tier: 100 req/day
52
- minScore: 3.0, // 0–10 scale
53
- chain: "base", // base | bnb | solana
54
- })
55
- ```
56
-
57
- ## Links
58
-
59
- - 🌐 [Live app](https://maiat-protocol.vercel.app)
60
- - 📖 [API docs](https://maiat-protocol.vercel.app/docs)
61
- - 🔗 [GitHub](https://github.com/JhiNResH/maiat-protocol)
62
- - 📦 [npm](https://www.npmjs.com/package/@jhinresh/elizaos-plugin)
63
-
64
- ## License
65
-
66
- MIT