@jhinresh/elizaos-plugin 0.8.0 → 0.9.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
@@ -10,7 +10,7 @@ export interface MaiatElizaConfig {
10
10
  export declare function maiatPlugin(config?: MaiatElizaConfig): {
11
11
  name: string;
12
12
  description: string;
13
- actions: {
13
+ actions: ({
14
14
  name: string;
15
15
  description: string;
16
16
  examples: string[];
@@ -22,7 +22,55 @@ export declare function maiatPlugin(config?: MaiatElizaConfig): {
22
22
  text: string;
23
23
  data: import("@jhinresh/maiat-sdk").AgentTrustResult;
24
24
  }>;
25
- }[];
25
+ } | {
26
+ name: string;
27
+ description: string;
28
+ examples: string[];
29
+ validate: (message: string) => Promise<boolean>;
30
+ handler: (message: string) => Promise<{
31
+ text: string;
32
+ data?: undefined;
33
+ } | {
34
+ text: string;
35
+ data: import("@jhinresh/maiat-sdk").TokenCheckResult;
36
+ }>;
37
+ } | {
38
+ name: string;
39
+ description: string;
40
+ examples: string[];
41
+ validate: (message: string) => Promise<boolean>;
42
+ handler: (message: string) => Promise<{
43
+ text: string;
44
+ data?: undefined;
45
+ } | {
46
+ text: string;
47
+ data: import("@jhinresh/maiat-sdk").TrustSwapResult;
48
+ }>;
49
+ } | {
50
+ name: string;
51
+ description: string;
52
+ examples: string[];
53
+ validate: (_message: string) => Promise<boolean>;
54
+ handler: (message: string) => Promise<{
55
+ text: string;
56
+ data?: undefined;
57
+ } | {
58
+ text: string;
59
+ data: import("@jhinresh/maiat-sdk").OutcomeResult;
60
+ }>;
61
+ } | {
62
+ name: string;
63
+ description: string;
64
+ examples: string[];
65
+ validate: (message: string) => Promise<boolean>;
66
+ handler: (message: string) => Promise<{
67
+ text: string;
68
+ data?: undefined;
69
+ } | {
70
+ text: string;
71
+ data: import("@jhinresh/maiat-sdk").DeepAnalysisResult;
72
+ }>;
73
+ })[];
26
74
  evaluators: {
27
75
  name: string;
28
76
  description: string;
@@ -31,13 +79,6 @@ export declare function maiatPlugin(config?: MaiatElizaConfig): {
31
79
  }) => Promise<{
32
80
  pass: boolean;
33
81
  reason: string;
34
- score?: undefined;
35
- verdict?: undefined;
36
- } | {
37
- pass: boolean;
38
- score: number;
39
- verdict: "proceed" | "caution" | "avoid";
40
- reason: string;
41
82
  }>;
42
83
  }[];
43
84
  providers: {
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ export function maiatPlugin(config = {}) {
12
12
  const minScore = config.minScore ?? 60; // SDK uses 0-100 scale
13
13
  return {
14
14
  name: "maiat-trust",
15
- description: "Trust scoring for on-chain addresses via Maiat Protocol",
15
+ description: "Trust scoring, token safety, swap verification & outcome reporting via Maiat Protocol",
16
16
  actions: [
17
17
  {
18
18
  name: "CHECK_TRUST",
@@ -45,6 +45,140 @@ export function maiatPlugin(config = {}) {
45
45
  }
46
46
  },
47
47
  },
48
+ {
49
+ name: "CHECK_TOKEN",
50
+ description: "Check if a token is safe (honeypot, rug pull, liquidity risks)",
51
+ examples: [
52
+ "Is this token safe? 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
53
+ "Check token 0xabcd...",
54
+ "Token safety check for 0x1234...",
55
+ ],
56
+ validate: async (message) => {
57
+ return /0x[a-fA-F0-9]{40}/.test(message);
58
+ },
59
+ handler: async (message) => {
60
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
61
+ if (!match)
62
+ return { text: "Please provide a valid token address (0x...)" };
63
+ try {
64
+ const result = await sdk.tokenCheck(match[0]);
65
+ const safe = result.verdict === "proceed";
66
+ const emoji = safe ? "🟢" : result.verdict === "avoid" ? "🔴" : "🟡";
67
+ return {
68
+ text: `${emoji} **Token Safety: ${result.trustScore}/100** (${result.verdict} verdict)\n\nAddress: \`${result.address}\`\nType: ${result.tokenType}\nRisk: ${result.riskSummary}\nFlags: ${result.riskFlags.length > 0 ? result.riskFlags.join(", ") : "None"}\n\n${safe ? "✅ Token appears safe." : "⚠️ Token has risk flags — proceed with caution."}`,
69
+ data: result,
70
+ };
71
+ }
72
+ catch (error) {
73
+ return {
74
+ text: `❌ Could not check token: ${error instanceof Error ? error.message : "Unknown error"}`,
75
+ };
76
+ }
77
+ },
78
+ },
79
+ {
80
+ name: "TRUST_SWAP",
81
+ description: "Get a trust-verified swap quote with safety checks on both tokens",
82
+ examples: [
83
+ "Get a trust-verified swap quote for 1 ETH to USDC",
84
+ "Trust swap 0x... to 0x... amount 1000000",
85
+ "Swap quote with trust verification",
86
+ ],
87
+ validate: async (message) => {
88
+ return /0x[a-fA-F0-9]{40}/.test(message);
89
+ },
90
+ handler: async (message) => {
91
+ const addresses = message.match(/0x[a-fA-F0-9]{40}/g);
92
+ if (!addresses || addresses.length < 2) {
93
+ return { text: "Please provide swapper address, tokenIn, and tokenOut addresses (0x...)" };
94
+ }
95
+ const amountMatch = message.match(/amount\s+(\d+)/i);
96
+ const amount = amountMatch ? amountMatch[1] : "1000000000000000000";
97
+ try {
98
+ const result = await sdk.trustSwap({
99
+ swapper: addresses[0],
100
+ tokenIn: addresses.length >= 3 ? addresses[1] : addresses[0],
101
+ tokenOut: addresses.length >= 3 ? addresses[2] : addresses[1],
102
+ amount,
103
+ });
104
+ const trustIn = result.trust.tokenIn;
105
+ const trustOut = result.trust.tokenOut;
106
+ return {
107
+ text: `🔄 **Trust-Verified Swap Quote**\n\nToken In Trust: ${trustIn ? `${trustIn.score}/100 (${trustIn.risk})` : "N/A"}\nToken Out Trust: ${trustOut ? `${trustOut.score}/100 (${trustOut.risk})` : "N/A"}\nCalldata: ${result.calldata ? "Ready" : "Not available"}\nTimestamp: ${result.timestamp}`,
108
+ data: result,
109
+ };
110
+ }
111
+ catch (error) {
112
+ return {
113
+ text: `❌ Swap quote failed: ${error instanceof Error ? error.message : "Unknown error"}`,
114
+ };
115
+ }
116
+ },
117
+ },
118
+ {
119
+ name: "REPORT_OUTCOME",
120
+ description: "Report the outcome of a job back to the Maiat trust oracle",
121
+ examples: [
122
+ "Report outcome for job abc-123 as success",
123
+ "Report job failure for xyz-456",
124
+ "Job abc completed successfully",
125
+ ],
126
+ validate: async (_message) => {
127
+ return true;
128
+ },
129
+ handler: async (message) => {
130
+ const jobMatch = message.match(/(?:job\s+)?([a-zA-Z0-9_-]+)/i);
131
+ if (!jobMatch)
132
+ return { text: "Please provide a job ID to report outcome for." };
133
+ const outcomeMatch = message.match(/\b(success|failure|partial|expired)\b/i);
134
+ const outcome = (outcomeMatch ? outcomeMatch[1].toLowerCase() : "success");
135
+ try {
136
+ const result = await sdk.reportOutcome({
137
+ jobId: jobMatch[1],
138
+ outcome,
139
+ });
140
+ return {
141
+ text: `📋 **Outcome Reported**\n\nJob: ${jobMatch[1]}\nOutcome: ${outcome}\nLogged: ${result.success ? "Yes" : "No"}${result.id ? `\nID: ${result.id}` : ""}`,
142
+ data: result,
143
+ };
144
+ }
145
+ catch (error) {
146
+ return {
147
+ text: `❌ Could not report outcome: ${error instanceof Error ? error.message : "Unknown error"}`,
148
+ };
149
+ }
150
+ },
151
+ },
152
+ {
153
+ name: "DEEP_ANALYSIS",
154
+ description: "Get deep analysis on an agent address with percentile ranking and risk signals",
155
+ examples: [
156
+ "Deep analysis on 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
157
+ "Analyze 0xabcd... in depth",
158
+ "Deep trust check for 0x1234...",
159
+ ],
160
+ validate: async (message) => {
161
+ return /0x[a-fA-F0-9]{40}/.test(message);
162
+ },
163
+ handler: async (message) => {
164
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
165
+ if (!match)
166
+ return { text: "Please provide a valid Ethereum address (0x...)" };
167
+ try {
168
+ const result = await sdk.deep(match[0]);
169
+ const emoji = result.verdict === "proceed" ? "🟢" : result.verdict === "avoid" ? "🔴" : "🟡";
170
+ return {
171
+ text: `${emoji} **Deep Analysis: ${result.trustScore}/100** (${result.verdict} verdict)\n\nAddress: \`${result.address}\`\nSignals: ${JSON.stringify(result.signals)}\nLast Updated: ${result.lastUpdated}`,
172
+ data: result,
173
+ };
174
+ }
175
+ catch (error) {
176
+ return {
177
+ text: `❌ Deep analysis failed: ${error instanceof Error ? error.message : "Unknown error"}`,
178
+ };
179
+ }
180
+ },
181
+ },
48
182
  ],
49
183
  evaluators: [
50
184
  {
@@ -70,6 +204,26 @@ export function maiatPlugin(config = {}) {
70
204
  }
71
205
  },
72
206
  },
207
+ {
208
+ name: "TOKEN_GATE",
209
+ description: "Evaluates if a token is safe to interact with",
210
+ handler: async (context) => {
211
+ if (!context.address)
212
+ return { pass: true, reason: "No token address to check" };
213
+ try {
214
+ const safe = await sdk.isTokenSafe(context.address);
215
+ return {
216
+ pass: safe,
217
+ reason: safe
218
+ ? `Token is safe to interact with`
219
+ : `Token failed safety check — blocking interaction`,
220
+ };
221
+ }
222
+ catch {
223
+ return { pass: false, reason: "Token safety check failed — blocking by default" };
224
+ }
225
+ },
226
+ },
73
227
  ],
74
228
  providers: [
75
229
  {
@@ -77,7 +231,7 @@ export function maiatPlugin(config = {}) {
77
231
  description: "Provides trust scoring context for agent reasoning",
78
232
  handler: async () => {
79
233
  return {
80
- 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 ${minScore}/100 should be avoided.`,
234
+ text: `You have access to Maiat trust scoring and token safety tools. Available actions:\n- CHECK_TRUST: Verify an agent's trust score before interacting\n- CHECK_TOKEN: Check if a token is safe (honeypot, rug pull detection)\n- TRUST_SWAP: Get trust-verified swap quotes with safety checks\n- DEEP_ANALYSIS: Get deep analysis with percentile ranking and risk signals\n- REPORT_OUTCOME: Report job outcomes to improve the trust oracle\n\nAddresses scoring below ${minScore}/100 should be avoided. Always check trust before transacting.`,
81
235
  };
82
236
  },
83
237
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jhinresh/elizaos-plugin",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -14,7 +14,7 @@
14
14
  "dev": "tsc --watch"
15
15
  },
16
16
  "dependencies": {
17
- "@jhinresh/maiat-sdk": "^0.7.3"
17
+ "@jhinresh/maiat-sdk": "^0.8.0"
18
18
  },
19
19
  "keywords": [
20
20
  "maiat",
package/src/index.ts CHANGED
@@ -22,7 +22,7 @@ export function maiatPlugin(config: MaiatElizaConfig = {}) {
22
22
 
23
23
  return {
24
24
  name: "maiat-trust",
25
- description: "Trust scoring for on-chain addresses via Maiat Protocol",
25
+ description: "Trust scoring, token safety, swap verification & outcome reporting via Maiat Protocol",
26
26
 
27
27
  actions: [
28
28
  {
@@ -56,6 +56,144 @@ export function maiatPlugin(config: MaiatElizaConfig = {}) {
56
56
  }
57
57
  },
58
58
  },
59
+ {
60
+ name: "CHECK_TOKEN",
61
+ description: "Check if a token is safe (honeypot, rug pull, liquidity risks)",
62
+ examples: [
63
+ "Is this token safe? 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
64
+ "Check token 0xabcd...",
65
+ "Token safety check for 0x1234...",
66
+ ],
67
+ validate: async (message: string) => {
68
+ return /0x[a-fA-F0-9]{40}/.test(message);
69
+ },
70
+ handler: async (message: string) => {
71
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
72
+ if (!match) return { text: "Please provide a valid token address (0x...)" };
73
+
74
+ try {
75
+ const result = await sdk.tokenCheck(match[0]);
76
+ const safe = result.verdict === "proceed";
77
+ const emoji = safe ? "🟢" : result.verdict === "avoid" ? "🔴" : "🟡";
78
+
79
+ return {
80
+ text: `${emoji} **Token Safety: ${result.trustScore}/100** (${result.verdict} verdict)\n\nAddress: \`${result.address}\`\nType: ${result.tokenType}\nRisk: ${result.riskSummary}\nFlags: ${result.riskFlags.length > 0 ? result.riskFlags.join(", ") : "None"}\n\n${safe ? "✅ Token appears safe." : "⚠️ Token has risk flags — proceed with caution."}`,
81
+ data: result,
82
+ };
83
+ } catch (error) {
84
+ return {
85
+ text: `❌ Could not check token: ${error instanceof Error ? error.message : "Unknown error"}`,
86
+ };
87
+ }
88
+ },
89
+ },
90
+ {
91
+ name: "TRUST_SWAP",
92
+ description: "Get a trust-verified swap quote with safety checks on both tokens",
93
+ examples: [
94
+ "Get a trust-verified swap quote for 1 ETH to USDC",
95
+ "Trust swap 0x... to 0x... amount 1000000",
96
+ "Swap quote with trust verification",
97
+ ],
98
+ validate: async (message: string) => {
99
+ return /0x[a-fA-F0-9]{40}/.test(message);
100
+ },
101
+ handler: async (message: string) => {
102
+ const addresses = message.match(/0x[a-fA-F0-9]{40}/g);
103
+ if (!addresses || addresses.length < 2) {
104
+ return { text: "Please provide swapper address, tokenIn, and tokenOut addresses (0x...)" };
105
+ }
106
+
107
+ const amountMatch = message.match(/amount\s+(\d+)/i);
108
+ const amount = amountMatch ? amountMatch[1] : "1000000000000000000";
109
+
110
+ try {
111
+ const result = await sdk.trustSwap({
112
+ swapper: addresses[0],
113
+ tokenIn: addresses.length >= 3 ? addresses[1] : addresses[0],
114
+ tokenOut: addresses.length >= 3 ? addresses[2] : addresses[1],
115
+ amount,
116
+ });
117
+
118
+ const trustIn = result.trust.tokenIn;
119
+ const trustOut = result.trust.tokenOut;
120
+
121
+ return {
122
+ text: `🔄 **Trust-Verified Swap Quote**\n\nToken In Trust: ${trustIn ? `${trustIn.score}/100 (${trustIn.risk})` : "N/A"}\nToken Out Trust: ${trustOut ? `${trustOut.score}/100 (${trustOut.risk})` : "N/A"}\nCalldata: ${result.calldata ? "Ready" : "Not available"}\nTimestamp: ${result.timestamp}`,
123
+ data: result,
124
+ };
125
+ } catch (error) {
126
+ return {
127
+ text: `❌ Swap quote failed: ${error instanceof Error ? error.message : "Unknown error"}`,
128
+ };
129
+ }
130
+ },
131
+ },
132
+ {
133
+ name: "REPORT_OUTCOME",
134
+ description: "Report the outcome of a job back to the Maiat trust oracle",
135
+ examples: [
136
+ "Report outcome for job abc-123 as success",
137
+ "Report job failure for xyz-456",
138
+ "Job abc completed successfully",
139
+ ],
140
+ validate: async (_message: string) => {
141
+ return true;
142
+ },
143
+ handler: async (message: string) => {
144
+ const jobMatch = message.match(/(?:job\s+)?([a-zA-Z0-9_-]+)/i);
145
+ if (!jobMatch) return { text: "Please provide a job ID to report outcome for." };
146
+
147
+ const outcomeMatch = message.match(/\b(success|failure|partial|expired)\b/i);
148
+ const outcome = (outcomeMatch ? outcomeMatch[1].toLowerCase() : "success") as "success" | "failure" | "partial" | "expired";
149
+
150
+ try {
151
+ const result = await sdk.reportOutcome({
152
+ jobId: jobMatch[1],
153
+ outcome,
154
+ });
155
+
156
+ return {
157
+ text: `📋 **Outcome Reported**\n\nJob: ${jobMatch[1]}\nOutcome: ${outcome}\nLogged: ${result.success ? "Yes" : "No"}${result.id ? `\nID: ${result.id}` : ""}`,
158
+ data: result,
159
+ };
160
+ } catch (error) {
161
+ return {
162
+ text: `❌ Could not report outcome: ${error instanceof Error ? error.message : "Unknown error"}`,
163
+ };
164
+ }
165
+ },
166
+ },
167
+ {
168
+ name: "DEEP_ANALYSIS",
169
+ description: "Get deep analysis on an agent address with percentile ranking and risk signals",
170
+ examples: [
171
+ "Deep analysis on 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
172
+ "Analyze 0xabcd... in depth",
173
+ "Deep trust check for 0x1234...",
174
+ ],
175
+ validate: async (message: string) => {
176
+ return /0x[a-fA-F0-9]{40}/.test(message);
177
+ },
178
+ handler: async (message: string) => {
179
+ const match = message.match(/0x[a-fA-F0-9]{40}/);
180
+ if (!match) return { text: "Please provide a valid Ethereum address (0x...)" };
181
+
182
+ try {
183
+ const result = await sdk.deep(match[0]);
184
+ const emoji = result.verdict === "proceed" ? "🟢" : result.verdict === "avoid" ? "🔴" : "🟡";
185
+
186
+ return {
187
+ text: `${emoji} **Deep Analysis: ${result.trustScore}/100** (${result.verdict} verdict)\n\nAddress: \`${result.address}\`\nSignals: ${JSON.stringify(result.signals)}\nLast Updated: ${result.lastUpdated}`,
188
+ data: result,
189
+ };
190
+ } catch (error) {
191
+ return {
192
+ text: `❌ Deep analysis failed: ${error instanceof Error ? error.message : "Unknown error"}`,
193
+ };
194
+ }
195
+ },
196
+ },
59
197
  ],
60
198
 
61
199
  evaluators: [
@@ -81,6 +219,25 @@ export function maiatPlugin(config: MaiatElizaConfig = {}) {
81
219
  }
82
220
  },
83
221
  },
222
+ {
223
+ name: "TOKEN_GATE",
224
+ description: "Evaluates if a token is safe to interact with",
225
+ handler: async (context: { address?: string }) => {
226
+ if (!context.address) return { pass: true, reason: "No token address to check" };
227
+
228
+ try {
229
+ const safe = await sdk.isTokenSafe(context.address);
230
+ return {
231
+ pass: safe,
232
+ reason: safe
233
+ ? `Token is safe to interact with`
234
+ : `Token failed safety check — blocking interaction`,
235
+ };
236
+ } catch {
237
+ return { pass: false, reason: "Token safety check failed — blocking by default" };
238
+ }
239
+ },
240
+ },
84
241
  ],
85
242
 
86
243
  providers: [
@@ -89,7 +246,7 @@ export function maiatPlugin(config: MaiatElizaConfig = {}) {
89
246
  description: "Provides trust scoring context for agent reasoning",
90
247
  handler: async () => {
91
248
  return {
92
- 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 ${minScore}/100 should be avoided.`,
249
+ text: `You have access to Maiat trust scoring and token safety tools. Available actions:\n- CHECK_TRUST: Verify an agent's trust score before interacting\n- CHECK_TOKEN: Check if a token is safe (honeypot, rug pull detection)\n- TRUST_SWAP: Get trust-verified swap quotes with safety checks\n- DEEP_ANALYSIS: Get deep analysis with percentile ranking and risk signals\n- REPORT_OUTCOME: Report job outcomes to improve the trust oracle\n\nAddresses scoring below ${minScore}/100 should be avoided. Always check trust before transacting.`,
93
250
  };
94
251
  },
95
252
  },
@@ -97,4 +254,12 @@ export function maiatPlugin(config: MaiatElizaConfig = {}) {
97
254
  };
98
255
  }
99
256
 
257
+ // Re-export ACP evaluator defaults
258
+ export {
259
+ MAIAT_EVALUATOR_ADDRESS,
260
+ MAIAT_ACP_HOOK_ADDRESS,
261
+ MAIAT_EVALUATOR_CLUSTER,
262
+ MAIAT_ACP_DEFAULTS,
263
+ } from "@jhinresh/maiat-sdk";
264
+
100
265
  export default maiatPlugin;