@diogenesgateway/eliza-plugin-diogenes 0.0.0-stage → 1.1.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/LICENSE +21 -0
- package/README.md +73 -2
- package/dist/index.d.ts +87 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +222 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Diogenes Gateway
|
|
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,3 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Diogenes Plugin for ElizaOS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A drop-in **ElizaOS** plugin equipping autonomous Solana agents with:
|
|
4
|
+
- **SPL Token Risk Audits (`EVALUATE_SOLANA_TOKEN_RISK`)**: Verify freeze authority, mint authority, Token-2022 extensions, and honeypot transfer taxes before executing token swaps.
|
|
5
|
+
- **Smart Contract Honeypot Audits (`AUDIT_SMART_CONTRACT`)**: Audit Anchor and Solana Rust programs for backdoors, missing signer checks, and reentrancy bugs.
|
|
6
|
+
- **Pre-Execution Guardrails (`ENFORCE_GUARDRAIL`)**: Intercept user prompts and agent thoughts for prompt injection, key exfiltration, and wallet drains.
|
|
7
|
+
- **x402 Micropayments & Zero-Fee Demo Mode**: Instant testing with `demoMode: true`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🚀 Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install from npm
|
|
15
|
+
npm install @diogenesgateway/plugin-diogenes
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🛠️ Usage in ElizaOS Character
|
|
21
|
+
|
|
22
|
+
Add `diogenesPlugin` to your character's `plugins` array:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { diogenesPlugin } from "@diogenesgateway/plugin-diogenes";
|
|
26
|
+
|
|
27
|
+
export const character = {
|
|
28
|
+
name: "SolanaSecurityAgent",
|
|
29
|
+
plugins: [diogenesPlugin],
|
|
30
|
+
system: "You are an autonomous on-chain trader that verifies SPL token safety and audits contracts before executing transactions.",
|
|
31
|
+
// ...
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## ⚡ Actions Available
|
|
38
|
+
|
|
39
|
+
### 1. `EVALUATE_SOLANA_TOKEN_RISK`
|
|
40
|
+
Analyzes any SPL token mint address in real time:
|
|
41
|
+
```text
|
|
42
|
+
User: "Is mint 7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr safe to buy?"
|
|
43
|
+
Agent: "Auditing SPL token with Diogenes Risk Oracle...
|
|
44
|
+
Verdict: SAFE
|
|
45
|
+
Risk Score: Low
|
|
46
|
+
Standard: spl-token | Slot: 320184912
|
|
47
|
+
Freeze Authority: Disabled (Safe)
|
|
48
|
+
Reason Codes: CLEAN"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Similes / Aliases:
|
|
52
|
+
- `CHECK_SPL_TOKEN_RISK`
|
|
53
|
+
- `INSPECT_SOLANA_TOKEN`
|
|
54
|
+
- `AUDIT_SPL_TOKEN`
|
|
55
|
+
- `CHECK_FREEZE_AUTHORITY`
|
|
56
|
+
|
|
57
|
+
### 2. `AUDIT_SMART_CONTRACT`
|
|
58
|
+
Audits Anchor / Rust / Solidity code for backdoors and reentrancy bugs:
|
|
59
|
+
```text
|
|
60
|
+
User: "Can you review this Anchor program instruction for vulnerabilities?"
|
|
61
|
+
Agent: "Running contract audit...
|
|
62
|
+
Verdict: PASS
|
|
63
|
+
Vulnerabilities Found: 0"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 3. `ENFORCE_GUARDRAIL`
|
|
67
|
+
Pre-execution security barrier verifying that agent commands and prompts are free of prompt injection or destructive terminal instructions.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 🌐 Endpoints & Edge Infrastructure
|
|
72
|
+
- **Live Gateway**: [https://diogenesgateway.com](https://diogenesgateway.com)
|
|
73
|
+
- **MCP Catalog**: [https://diogenesgateway.com/.well-known/mcp.json](https://diogenesgateway.com/.well-known/mcp.json)
|
|
74
|
+
- **Solana x402 Treasury**: `3vuU9jvaohMG6oPY7NVrUggcSJ4CuhcByxoQk68EC6hj`
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diogenes Plugin for ElizaOS
|
|
3
|
+
* Provides autonomous Solana agents with real-time SPL token risk inspection,
|
|
4
|
+
* smart contract honeypot audits, pre-execution safety guardrails, and x402 micropayments.
|
|
5
|
+
*/
|
|
6
|
+
export interface DiogenesPluginConfig {
|
|
7
|
+
gatewayUrl?: string;
|
|
8
|
+
demoMode?: boolean;
|
|
9
|
+
solanaKeypairBase58?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class DiogenesClient {
|
|
12
|
+
private gatewayUrl;
|
|
13
|
+
private demoMode;
|
|
14
|
+
private keypairBase58?;
|
|
15
|
+
constructor(config?: DiogenesPluginConfig);
|
|
16
|
+
callEndpoint(endpoint: string, payload: Record<string, unknown>): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Evaluates SPL token mint address for active freeze authority, mint authority,
|
|
19
|
+
* honeypot transfer taxes, Token-2022 extensions, reason codes, and verified slot.
|
|
20
|
+
*/
|
|
21
|
+
checkSplTokenRisk(mintAddress: string, riskProfile?: string): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for checkSplTokenRisk matching the official ElizaOS Solana tool interface.
|
|
24
|
+
*/
|
|
25
|
+
evaluate_solana_token_risk(mintAddress: string, riskProfile?: string): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* Audits Anchor or Rust smart contract code before deployment or invocation.
|
|
28
|
+
*/
|
|
29
|
+
auditSolanaProgram(code: string): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Evaluates prompt or action text for prompt injection, key theft, or destructive commands.
|
|
32
|
+
*/
|
|
33
|
+
verifyGuardrail(input: string, context?: string): Promise<any>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* ElizaOS Plugin Definition
|
|
37
|
+
*/
|
|
38
|
+
export declare const diogenesPlugin: {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
actions: {
|
|
42
|
+
name: string;
|
|
43
|
+
similes: string[];
|
|
44
|
+
description: string;
|
|
45
|
+
examples: ({
|
|
46
|
+
user: string;
|
|
47
|
+
content: {
|
|
48
|
+
text: string;
|
|
49
|
+
action?: undefined;
|
|
50
|
+
};
|
|
51
|
+
} | {
|
|
52
|
+
user: string;
|
|
53
|
+
content: {
|
|
54
|
+
text: string;
|
|
55
|
+
action: string;
|
|
56
|
+
};
|
|
57
|
+
})[][];
|
|
58
|
+
validate: () => Promise<boolean>;
|
|
59
|
+
handler: (runtime: any, message: any, state: any, options: any, callback: any) => Promise<boolean>;
|
|
60
|
+
}[];
|
|
61
|
+
};
|
|
62
|
+
export declare const plugin: {
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
actions: {
|
|
66
|
+
name: string;
|
|
67
|
+
similes: string[];
|
|
68
|
+
description: string;
|
|
69
|
+
examples: ({
|
|
70
|
+
user: string;
|
|
71
|
+
content: {
|
|
72
|
+
text: string;
|
|
73
|
+
action?: undefined;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
user: string;
|
|
77
|
+
content: {
|
|
78
|
+
text: string;
|
|
79
|
+
action: string;
|
|
80
|
+
};
|
|
81
|
+
})[][];
|
|
82
|
+
validate: () => Promise<boolean>;
|
|
83
|
+
handler: (runtime: any, message: any, state: any, options: any, callback: any) => Promise<boolean>;
|
|
84
|
+
}[];
|
|
85
|
+
};
|
|
86
|
+
export default diogenesPlugin;
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAKD,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,aAAa,CAAC,CAAS;gBAEnB,MAAM,GAAE,oBAAyB;IAMvC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IA0BpF;;;OAGG;IACG,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,GAAE,MAAsC,GAAG,OAAO,CAAC,GAAG,CAAC;IAO/G;;OAEG;IACG,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,GAAE,MAAsC,GAAG,OAAO,CAAC,GAAG,CAAC;IAIxH;;OAEG;IACG,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAOpD;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAW,GAAG,OAAO,CAAC,GAAG,CAAC;CAMzE;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;2BA6CI,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,GAAG;;CAoGxF,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;2BAtGY,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,GAAG;;CAsGrD,CAAC;AACrC,eAAe,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diogenes Plugin for ElizaOS
|
|
3
|
+
* Provides autonomous Solana agents with real-time SPL token risk inspection,
|
|
4
|
+
* smart contract honeypot audits, pre-execution safety guardrails, and x402 micropayments.
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_GATEWAY_URL = "https://diogenesgateway.com";
|
|
7
|
+
const SOLANA_X402_WALLET = "3vuU9jvaohMG6oPY7NVrUggcSJ4CuhcByxoQk68EC6hj";
|
|
8
|
+
export class DiogenesClient {
|
|
9
|
+
gatewayUrl;
|
|
10
|
+
demoMode;
|
|
11
|
+
keypairBase58;
|
|
12
|
+
constructor(config = {}) {
|
|
13
|
+
this.gatewayUrl = (config.gatewayUrl || DEFAULT_GATEWAY_URL).replace(/\/$/, "");
|
|
14
|
+
this.demoMode = config.demoMode ?? true; // Default to demo mode for safety
|
|
15
|
+
this.keypairBase58 = config.solanaKeypairBase58;
|
|
16
|
+
}
|
|
17
|
+
async callEndpoint(endpoint, payload) {
|
|
18
|
+
let url = `${this.gatewayUrl}${endpoint}`;
|
|
19
|
+
if (this.demoMode && !url.includes("?demo=true")) {
|
|
20
|
+
url += "?demo=true";
|
|
21
|
+
}
|
|
22
|
+
const headers = {
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
"User-Agent": "ElizaOS-DiogenesPlugin/1.0",
|
|
25
|
+
};
|
|
26
|
+
const res = await fetch(url, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers,
|
|
29
|
+
body: JSON.stringify(payload),
|
|
30
|
+
});
|
|
31
|
+
if (res.status === 402 && !this.demoMode && this.keypairBase58) {
|
|
32
|
+
// In production x402 mode, client can sign transaction or pass signature
|
|
33
|
+
const challenge = await res.json();
|
|
34
|
+
throw new Error(`Payment Required: ${JSON.stringify(challenge)}`);
|
|
35
|
+
}
|
|
36
|
+
return await res.json();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Evaluates SPL token mint address for active freeze authority, mint authority,
|
|
40
|
+
* honeypot transfer taxes, Token-2022 extensions, reason codes, and verified slot.
|
|
41
|
+
*/
|
|
42
|
+
async checkSplTokenRisk(mintAddress, riskProfile = "allow_regulated_stablecoins") {
|
|
43
|
+
return this.callEndpoint("/api/v1/crypto/solana-risk", {
|
|
44
|
+
mint_address: mintAddress,
|
|
45
|
+
risk_profile: riskProfile,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Alias for checkSplTokenRisk matching the official ElizaOS Solana tool interface.
|
|
50
|
+
*/
|
|
51
|
+
async evaluate_solana_token_risk(mintAddress, riskProfile = "allow_regulated_stablecoins") {
|
|
52
|
+
return this.checkSplTokenRisk(mintAddress, riskProfile);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Audits Anchor or Rust smart contract code before deployment or invocation.
|
|
56
|
+
*/
|
|
57
|
+
async auditSolanaProgram(code) {
|
|
58
|
+
return this.callEndpoint("/api/v1/agent/contract-audit", {
|
|
59
|
+
contract_code: code,
|
|
60
|
+
language: "rust_anchor",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Evaluates prompt or action text for prompt injection, key theft, or destructive commands.
|
|
65
|
+
*/
|
|
66
|
+
async verifyGuardrail(input, context = "") {
|
|
67
|
+
return this.callEndpoint("/api/v1/agent/guardrail-verify", {
|
|
68
|
+
input,
|
|
69
|
+
context,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* ElizaOS Plugin Definition
|
|
75
|
+
*/
|
|
76
|
+
export const diogenesPlugin = {
|
|
77
|
+
name: "diogenes",
|
|
78
|
+
description: "Diogenes Autonomous Edge Microservices & Solana Security Plugin: SPL token risk audits, Anchor contract verifier, and agent guardrails",
|
|
79
|
+
actions: [
|
|
80
|
+
{
|
|
81
|
+
name: "EVALUATE_SOLANA_TOKEN_RISK",
|
|
82
|
+
similes: [
|
|
83
|
+
"CHECK_SPL_TOKEN_RISK",
|
|
84
|
+
"INSPECT_SOLANA_TOKEN",
|
|
85
|
+
"AUDIT_SPL_TOKEN",
|
|
86
|
+
"CHECK_FREEZE_AUTHORITY",
|
|
87
|
+
"EVALUATE_TOKEN_RISK",
|
|
88
|
+
"SOLANA_HONEYPOT_CHECK"
|
|
89
|
+
],
|
|
90
|
+
description: "Inspect a Solana SPL token mint address for freeze authority, mint authority, honeypot tax, and security risks before trading",
|
|
91
|
+
examples: [
|
|
92
|
+
[
|
|
93
|
+
{
|
|
94
|
+
user: "user",
|
|
95
|
+
content: { text: "Can you check if token mint 7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr is safe to buy?" },
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
user: "agent",
|
|
99
|
+
content: {
|
|
100
|
+
text: "I am auditing the Solana SPL token mint with Diogenes Risk Oracle...",
|
|
101
|
+
action: "EVALUATE_SOLANA_TOKEN_RISK",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
{
|
|
107
|
+
user: "user",
|
|
108
|
+
content: { text: "Audit token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
user: "agent",
|
|
112
|
+
content: {
|
|
113
|
+
text: "Evaluating Solana SPL token risk with Diogenes...",
|
|
114
|
+
action: "EVALUATE_SOLANA_TOKEN_RISK",
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
],
|
|
119
|
+
validate: async () => true,
|
|
120
|
+
handler: async (runtime, message, state, options, callback) => {
|
|
121
|
+
const client = new DiogenesClient({ demoMode: true });
|
|
122
|
+
const mint = message.content?.mintAddress || message.content?.text?.match(/[1-9A-HJ-NP-za-km-z]{32,44}/)?.[0];
|
|
123
|
+
if (!mint) {
|
|
124
|
+
callback?.({ text: "Please provide a valid Solana SPL token mint address to inspect." });
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
const result = await client.checkSplTokenRisk(mint);
|
|
129
|
+
const p = result.preview || {};
|
|
130
|
+
const reasonStr = Array.isArray(p.reason_codes) && p.reason_codes.length > 0 ? p.reason_codes.join(", ") : "CLEAN";
|
|
131
|
+
const standardStr = p.token_standard || "spl-token";
|
|
132
|
+
const slotStr = p.slot ? ` | Slot: ${p.slot}` : "";
|
|
133
|
+
callback?.({
|
|
134
|
+
text: `Token Audit for ${mint}:\nVerdict: ${p.should_transact ? "SAFE" : "CAUTION"}\nRisk Score: ${p.risk_score ?? "Low"}\nStandard: ${standardStr}${slotStr}\nFreeze Authority: ${p.has_freeze_authority ? "ACTIVE" : "Disabled"}\nReason Codes: ${reasonStr}`,
|
|
135
|
+
content: result,
|
|
136
|
+
});
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
callback?.({ text: `Failed to inspect token: ${err.message}` });
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "AUDIT_SMART_CONTRACT",
|
|
147
|
+
similes: [
|
|
148
|
+
"AUDIT_ANCHOR_PROGRAM",
|
|
149
|
+
"AUDIT_SOLANA_CONTRACT",
|
|
150
|
+
"VERIFY_SMART_CONTRACT"
|
|
151
|
+
],
|
|
152
|
+
description: "Audit Solana Anchor or EVM smart contract code for honeypot logic, reentrancy bugs, and missing signer checks",
|
|
153
|
+
examples: [
|
|
154
|
+
[
|
|
155
|
+
{
|
|
156
|
+
user: "user",
|
|
157
|
+
content: { text: "Can you audit this Solana program code for vulnerabilities?" },
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
user: "agent",
|
|
161
|
+
content: {
|
|
162
|
+
text: "Auditing program code with Diogenes Contract Audit Oracle...",
|
|
163
|
+
action: "AUDIT_SMART_CONTRACT",
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
],
|
|
168
|
+
validate: async () => true,
|
|
169
|
+
handler: async (runtime, message, state, options, callback) => {
|
|
170
|
+
const client = new DiogenesClient({ demoMode: true });
|
|
171
|
+
const code = message.content?.code || message.content?.text;
|
|
172
|
+
try {
|
|
173
|
+
const result = await client.auditSolanaProgram(code);
|
|
174
|
+
callback?.({
|
|
175
|
+
text: `Smart Contract Audit Result:\nVerdict: ${result.preview?.audit_passed ? "PASS" : "WARN"}\nVulnerabilities Found: ${result.preview?.vulnerabilities?.length ?? 0}`,
|
|
176
|
+
content: result,
|
|
177
|
+
});
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
callback?.({ text: `Audit error: ${err.message}` });
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "ENFORCE_GUARDRAIL",
|
|
188
|
+
similes: [
|
|
189
|
+
"VERIFY_GUARDRAIL",
|
|
190
|
+
"PRE_EXECUTION_SECURITY_CHECK",
|
|
191
|
+
"CHECK_PROMPT_INJECTION"
|
|
192
|
+
],
|
|
193
|
+
description: "Pre-execution security gate to prevent prompt injection and destructive shell commands",
|
|
194
|
+
examples: [
|
|
195
|
+
[
|
|
196
|
+
{
|
|
197
|
+
user: "user",
|
|
198
|
+
content: { text: "Verify this action input against security guardrails." },
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
user: "agent",
|
|
202
|
+
content: {
|
|
203
|
+
text: "Evaluating command against Diogenes Security Guardrail...",
|
|
204
|
+
action: "ENFORCE_GUARDRAIL",
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
],
|
|
209
|
+
validate: async () => true,
|
|
210
|
+
handler: async (runtime, message, state, options, callback) => {
|
|
211
|
+
const client = new DiogenesClient({ demoMode: true });
|
|
212
|
+
const input = message.content?.text || "";
|
|
213
|
+
const result = await client.verifyGuardrail(input);
|
|
214
|
+
callback?.({ text: `Guardrail evaluated: ${result.preview?.verdict || "OK"}`, content: result });
|
|
215
|
+
return true;
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
export const plugin = diogenesPlugin;
|
|
221
|
+
export default diogenesPlugin;
|
|
222
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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,OAAY,EAAE,KAAU,EAAE,OAAY,EAAE,QAAa,EAAE,EAAE;gBACrF,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBACtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;gBAC1C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACnD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,wBAAwB,MAAM,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;gBACjG,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAC;AACrC,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diogenesgateway/eliza-plugin-diogenes",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "ElizaOS plugin for Diogenes edge microservices: real-time Solana SPL token risk audits, Anchor contract verification, pre-execution guardrails, and x402 micropayments",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"elizaos",
|
|
14
|
+
"eliza",
|
|
15
|
+
"plugin",
|
|
16
|
+
"solana",
|
|
17
|
+
"ai-agent",
|
|
18
|
+
"x402",
|
|
19
|
+
"mcp",
|
|
20
|
+
"microservices",
|
|
21
|
+
"guardrails",
|
|
22
|
+
"spl-token",
|
|
23
|
+
"audit"
|
|
24
|
+
],
|
|
25
|
+
"author": "Diogenes Gateway",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@elizaos/core": ">=0.1.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"typescript": "^5.4.0"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/stand-out-of-my-sun/eliza-plugin-diogenes.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://diogenesgateway.com",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
]
|
|
43
|
+
}
|