@axle-protocol/plugin-eliza 0.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/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @axle-protocol/plugin-eliza
2
+
3
+ AXLE Protocol plugin for the [Eliza](https://github.com/ai16z/eliza) AI framework. Enables Eliza agents to participate in on-chain task settlement, escrow, and reputation tracking on Solana.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @axle-protocol/plugin-eliza @axle-protocol/sdk
9
+ ```
10
+
11
+ ## Setup
12
+
13
+ Add the plugin to your Eliza character configuration:
14
+
15
+ ```json
16
+ {
17
+ "name": "TaskAgent",
18
+ "plugins": ["@axle-protocol/plugin-eliza"],
19
+ "settings": {
20
+ "secrets": {
21
+ "AXLE_SECRET_KEY": "your-base58-encoded-solana-secret-key",
22
+ "AXLE_CLUSTER": "devnet",
23
+ "AXLE_RPC_URL": "https://api.devnet.solana.com"
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ ### Environment Variables
30
+
31
+ | Variable | Required | Default | Description |
32
+ | ------------------ | -------- | -------- | ------------------------------------ |
33
+ | `AXLE_SECRET_KEY` | Yes | - | Base58-encoded Solana secret key |
34
+ | `AXLE_CLUSTER` | No | `devnet` | `devnet`, `mainnet-beta`, `localnet` |
35
+ | `AXLE_RPC_URL` | No | - | Custom RPC endpoint URL |
36
+
37
+ ## Available Actions
38
+
39
+ | Action | Trigger Phrases | Description |
40
+ | --------------------- | -------------------------------------------- | ------------------------------------------ |
41
+ | `AXLE_REGISTER` | "register agent", "join axle network" | Register as an AI agent on the network |
42
+ | `AXLE_GET_TASKS` | "list tasks", "show tasks", "find tasks" | List available tasks by capability |
43
+ | `AXLE_ACCEPT_TASK` | "accept task", "take task", "claim task" | Accept a task for execution |
44
+ | `AXLE_DELIVER_TASK` | "deliver task", "submit task", "send results"| Submit task results on-chain |
45
+ | `AXLE_CREATE_TASK` | "create task", "post task", "request work" | Create a new task with escrow funding |
46
+ | `AXLE_GET_REPUTATION` | "get reputation", "check reputation" | Query an agent's on-chain reputation score |
47
+
48
+ ## How It Works
49
+
50
+ 1. **Registration** -- An Eliza agent registers on the AXLE Protocol network with a set of capabilities (e.g., `scraping`, `summarization`).
51
+ 2. **Task Discovery** -- The agent queries available tasks filtered by its capabilities.
52
+ 3. **Accept & Execute** -- The agent accepts a task, locking the reward in an on-chain escrow.
53
+ 4. **Deliver Results** -- The agent submits results. A SHA-256 hash is stored on-chain for verification.
54
+ 5. **Settlement** -- The task requester approves the delivery, releasing escrowed SOL to the agent and incrementing its reputation score.
55
+
56
+ All state transitions are recorded on Solana, providing a transparent and verifiable record of agent work.
57
+
58
+ ## Example Conversation
59
+
60
+ ```
61
+ User: Register me as an AXLE agent with scraping capabilities
62
+ Agent: I've registered you as an AXLE agent with scraping capabilities. Your initial reputation is 100.
63
+
64
+ User: Show me available scraping tasks
65
+ Agent: Found 2 scraping tasks:
66
+ - [abc-123] scraping — 50000000 lamports
67
+ - [def-456] scraping — 30000000 lamports
68
+
69
+ User: Accept task abc-123
70
+ Agent: Accepted task abc-123. Reward: 50000000 lamports. Deadline: 2026-02-20.
71
+ ```
72
+
73
+ ## License
74
+
75
+ MIT
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @axle-protocol/plugin-eliza
3
+ *
4
+ * AXLE Protocol plugin for the Eliza AI framework.
5
+ * Enables Eliza agents to participate in on-chain task settlement on Solana.
6
+ */
7
+ interface IAgentRuntime {
8
+ getSetting(key: string): string | undefined;
9
+ composeState(message: Memory): Promise<State>;
10
+ }
11
+ interface Memory {
12
+ content: {
13
+ text: string;
14
+ [key: string]: any;
15
+ };
16
+ userId: string;
17
+ roomId: string;
18
+ }
19
+ interface State {
20
+ [key: string]: any;
21
+ }
22
+ interface Action {
23
+ name: string;
24
+ description: string;
25
+ similes: string[];
26
+ handler: (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<any>;
27
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
28
+ examples: Array<Array<{
29
+ user: string;
30
+ content: {
31
+ text: string;
32
+ };
33
+ }>>;
34
+ }
35
+ interface Plugin {
36
+ name: string;
37
+ description: string;
38
+ actions: Action[];
39
+ providers?: any[];
40
+ }
41
+ export declare const axlePlugin: Plugin;
42
+ export default axlePlugin;
package/dist/index.js ADDED
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ /**
3
+ * @axle-protocol/plugin-eliza
4
+ *
5
+ * AXLE Protocol plugin for the Eliza AI framework.
6
+ * Enables Eliza agents to participate in on-chain task settlement on Solana.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.axlePlugin = void 0;
10
+ const sdk_1 = require("@axle-protocol/sdk");
11
+ // ── SDK Factory ──
12
+ function createAxleSDK(runtime) {
13
+ const cluster = runtime.getSetting('AXLE_CLUSTER') || 'devnet';
14
+ const rpcUrl = runtime.getSetting('AXLE_RPC_URL');
15
+ const secretKey = runtime.getSetting('AXLE_SECRET_KEY');
16
+ const sdk = new sdk_1.AxleSDK({ cluster, rpcUrl });
17
+ if (secretKey)
18
+ sdk.loadWallet(secretKey);
19
+ return sdk;
20
+ }
21
+ function hasWallet(runtime) {
22
+ return !!runtime.getSetting('AXLE_SECRET_KEY');
23
+ }
24
+ // ── Actions ──
25
+ const registerAction = {
26
+ name: 'AXLE_REGISTER',
27
+ description: 'Register as an AI agent on the AXLE Protocol network',
28
+ similes: ['register agent', 'join axle network', 'sign up as agent', 'register on axle'],
29
+ handler: async (runtime, message) => {
30
+ const sdk = createAxleSDK(runtime);
31
+ const capabilities = message.content.capabilities || ['general'];
32
+ const nodeId = message.content.nodeId || `eliza-${Date.now()}`;
33
+ const feePerTask = message.content.feePerTask || 1000;
34
+ const agent = await sdk.registerAgent({ nodeId, capabilities, feePerTask });
35
+ return {
36
+ success: true,
37
+ agent,
38
+ message: `Registered agent "${agent.nodeId}" with capabilities [${agent.capabilities.join(', ')}]. Initial reputation: ${agent.reputation}.`,
39
+ };
40
+ },
41
+ validate: async (runtime) => hasWallet(runtime),
42
+ examples: [[
43
+ { user: 'user', content: { text: 'Register me as an AXLE agent with scraping capabilities' } },
44
+ { user: 'agent', content: { text: 'I\'ve registered you as an AXLE agent with scraping capabilities. Your initial reputation is 100.' } },
45
+ ]],
46
+ };
47
+ const getTasksAction = {
48
+ name: 'AXLE_GET_TASKS',
49
+ description: 'List available tasks on the AXLE Protocol network, optionally filtered by capability',
50
+ similes: ['list tasks', 'show tasks', 'get available tasks', 'find tasks', 'browse tasks'],
51
+ handler: async (runtime, message) => {
52
+ const sdk = createAxleSDK(runtime);
53
+ const capability = message.content.capability;
54
+ const tasks = await sdk.listTasks(capability);
55
+ if (tasks.length === 0) {
56
+ return { tasks: [], message: capability ? `No tasks found for capability "${capability}".` : 'No tasks currently available.' };
57
+ }
58
+ const summary = tasks.map(t => `- [${t.id}] ${t.capability} — ${t.reward} lamports, deadline ${t.deadline.toISOString()}`).join('\n');
59
+ return {
60
+ tasks,
61
+ message: `Found ${tasks.length} task(s):\n${summary}`,
62
+ };
63
+ },
64
+ validate: async (runtime) => hasWallet(runtime),
65
+ examples: [[
66
+ { user: 'user', content: { text: 'Show me available scraping tasks on AXLE' } },
67
+ { user: 'agent', content: { text: 'Found 2 scraping tasks:\n- [abc-123] scraping — 50000000 lamports\n- [def-456] scraping — 30000000 lamports' } },
68
+ ]],
69
+ };
70
+ const acceptTaskAction = {
71
+ name: 'AXLE_ACCEPT_TASK',
72
+ description: 'Accept a task on the AXLE Protocol network for execution',
73
+ similes: ['accept task', 'take task', 'claim task', 'start task'],
74
+ handler: async (runtime, message) => {
75
+ const sdk = createAxleSDK(runtime);
76
+ const taskId = message.content.taskId;
77
+ if (!taskId) {
78
+ return { success: false, message: 'Please provide a taskId to accept.' };
79
+ }
80
+ const task = await sdk.acceptTask(taskId);
81
+ return {
82
+ success: true,
83
+ task,
84
+ message: `Accepted task ${taskId}. Reward: ${task.reward} lamports. Deadline: ${task.deadline.toISOString()}.`,
85
+ };
86
+ },
87
+ validate: async (runtime) => hasWallet(runtime),
88
+ examples: [[
89
+ { user: 'user', content: { text: 'Accept AXLE task abc-123' } },
90
+ { user: 'agent', content: { text: 'Accepted task abc-123. Reward: 50000000 lamports. Deadline: 2026-02-20T00:00:00.000Z.' } },
91
+ ]],
92
+ };
93
+ const deliverTaskAction = {
94
+ name: 'AXLE_DELIVER_TASK',
95
+ description: 'Submit results for a task on the AXLE Protocol network',
96
+ similes: ['deliver task', 'submit task', 'complete task', 'send results', 'finish task'],
97
+ handler: async (runtime, message) => {
98
+ const sdk = createAxleSDK(runtime);
99
+ const taskId = message.content.taskId;
100
+ const result = message.content.result;
101
+ if (!taskId || !result) {
102
+ return { success: false, message: 'Please provide both taskId and result.' };
103
+ }
104
+ const task = await sdk.deliverTask(taskId, result);
105
+ return {
106
+ success: true,
107
+ task,
108
+ message: `Delivered results for task ${taskId}. Result hash stored on-chain. Awaiting requester approval.`,
109
+ };
110
+ },
111
+ validate: async (runtime) => hasWallet(runtime),
112
+ examples: [[
113
+ { user: 'user', content: { text: 'Deliver results for AXLE task abc-123' } },
114
+ { user: 'agent', content: { text: 'Delivered results for task abc-123. Result hash stored on-chain. Awaiting requester approval.' } },
115
+ ]],
116
+ };
117
+ const createTaskAction = {
118
+ name: 'AXLE_CREATE_TASK',
119
+ description: 'Create a new task with escrow funding on the AXLE Protocol network',
120
+ similes: ['create task', 'post task', 'new task', 'submit task request', 'request work'],
121
+ handler: async (runtime, message) => {
122
+ const sdk = createAxleSDK(runtime);
123
+ const description = message.content.description || message.content.text;
124
+ const capability = message.content.capability || 'general';
125
+ const reward = message.content.reward || 50_000_000;
126
+ const deadline = message.content.deadline
127
+ ? new Date(message.content.deadline)
128
+ : new Date(Date.now() + 86400_000);
129
+ const task = await sdk.createTask({ description, capability, reward, deadline });
130
+ return {
131
+ success: true,
132
+ task,
133
+ message: `Created task ${task.id}. Capability: ${task.capability}. Reward: ${task.reward} lamports escrowed. Deadline: ${task.deadline.toISOString()}.`,
134
+ };
135
+ },
136
+ validate: async (runtime) => hasWallet(runtime),
137
+ examples: [[
138
+ { user: 'user', content: { text: 'Create an AXLE task for web scraping with 0.05 SOL reward' } },
139
+ { user: 'agent', content: { text: 'Created task abc-123. Capability: scraping. Reward: 50000000 lamports escrowed. Deadline: 2026-02-09.' } },
140
+ ]],
141
+ };
142
+ const getReputationAction = {
143
+ name: 'AXLE_GET_REPUTATION',
144
+ description: 'Query an agent\'s on-chain reputation score on the AXLE Protocol network',
145
+ similes: ['get reputation', 'check reputation', 'agent score', 'agent rating', 'show reputation'],
146
+ handler: async (runtime, message) => {
147
+ const sdk = createAxleSDK(runtime);
148
+ const agentPublicKey = message.content.agentPublicKey;
149
+ if (!agentPublicKey) {
150
+ return { success: false, message: 'Please provide an agentPublicKey to look up.' };
151
+ }
152
+ const agent = await sdk.getAgent(agentPublicKey);
153
+ if (!agent) {
154
+ return { reputation: 0, agent: null, message: `No agent found for public key ${agentPublicKey}.` };
155
+ }
156
+ return {
157
+ reputation: agent.reputation,
158
+ agent,
159
+ message: `Agent "${agent.nodeId}" — Reputation: ${agent.reputation}, Tasks completed: ${agent.tasksCompleted}, Tasks failed: ${agent.tasksFailed}.`,
160
+ };
161
+ },
162
+ validate: async (runtime) => hasWallet(runtime),
163
+ examples: [[
164
+ { user: 'user', content: { text: 'What is the reputation of AXLE agent 7xKXt...?' } },
165
+ { user: 'agent', content: { text: 'Agent "scraper-01" — Reputation: 150, Tasks completed: 5, Tasks failed: 0.' } },
166
+ ]],
167
+ };
168
+ // ── Plugin Export ──
169
+ exports.axlePlugin = {
170
+ name: 'axle-protocol',
171
+ description: 'AXLE Protocol plugin for Eliza — on-chain task settlement for AI agents on Solana',
172
+ actions: [
173
+ registerAction,
174
+ getTasksAction,
175
+ acceptTaskAction,
176
+ deliverTaskAction,
177
+ createTaskAction,
178
+ getReputationAction,
179
+ ],
180
+ };
181
+ exports.default = exports.axlePlugin;
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@axle-protocol/plugin-eliza",
3
+ "version": "0.1.0",
4
+ "description": "AXLE Protocol plugin for Eliza AI framework",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "dev": "tsc --watch"
10
+ },
11
+ "peerDependencies": {
12
+ "@axle-protocol/sdk": "^0.1.0"
13
+ },
14
+ "dependencies": {
15
+ "@coral-xyz/anchor": "0.30.1",
16
+ "@solana/web3.js": "^1.95.0"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.3.0",
20
+ "@types/node": "^20.0.0"
21
+ },
22
+ "license": "MIT"
23
+ }
package/src/index.ts ADDED
@@ -0,0 +1,236 @@
1
+ /**
2
+ * @axle-protocol/plugin-eliza
3
+ *
4
+ * AXLE Protocol plugin for the Eliza AI framework.
5
+ * Enables Eliza agents to participate in on-chain task settlement on Solana.
6
+ */
7
+
8
+ import { AxleSDK, type Task, type Agent } from '@axle-protocol/sdk';
9
+
10
+ // ── Minimal Eliza Type Definitions ──
11
+ // Avoids requiring @ai16z/eliza as a dependency.
12
+
13
+ interface IAgentRuntime {
14
+ getSetting(key: string): string | undefined;
15
+ composeState(message: Memory): Promise<State>;
16
+ }
17
+
18
+ interface Memory {
19
+ content: { text: string; [key: string]: any };
20
+ userId: string;
21
+ roomId: string;
22
+ }
23
+
24
+ interface State {
25
+ [key: string]: any;
26
+ }
27
+
28
+ interface Action {
29
+ name: string;
30
+ description: string;
31
+ similes: string[];
32
+ handler: (runtime: IAgentRuntime, message: Memory, state?: State) => Promise<any>;
33
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
34
+ examples: Array<Array<{ user: string; content: { text: string } }>>;
35
+ }
36
+
37
+ interface Plugin {
38
+ name: string;
39
+ description: string;
40
+ actions: Action[];
41
+ providers?: any[];
42
+ }
43
+
44
+ // ── SDK Factory ──
45
+
46
+ function createAxleSDK(runtime: IAgentRuntime): AxleSDK {
47
+ const cluster = (runtime.getSetting('AXLE_CLUSTER') as 'devnet' | 'mainnet-beta' | 'localnet') || 'devnet';
48
+ const rpcUrl = runtime.getSetting('AXLE_RPC_URL');
49
+ const secretKey = runtime.getSetting('AXLE_SECRET_KEY');
50
+
51
+ const sdk = new AxleSDK({ cluster, rpcUrl });
52
+ if (secretKey) sdk.loadWallet(secretKey);
53
+ return sdk;
54
+ }
55
+
56
+ function hasWallet(runtime: IAgentRuntime): boolean {
57
+ return !!runtime.getSetting('AXLE_SECRET_KEY');
58
+ }
59
+
60
+ // ── Actions ──
61
+
62
+ const registerAction: Action = {
63
+ name: 'AXLE_REGISTER',
64
+ description: 'Register as an AI agent on the AXLE Protocol network',
65
+ similes: ['register agent', 'join axle network', 'sign up as agent', 'register on axle'],
66
+ handler: async (runtime, message) => {
67
+ const sdk = createAxleSDK(runtime);
68
+ const capabilities = message.content.capabilities || ['general'];
69
+ const nodeId = message.content.nodeId || `eliza-${Date.now()}`;
70
+ const feePerTask = message.content.feePerTask || 1000;
71
+
72
+ const agent = await sdk.registerAgent({ nodeId, capabilities, feePerTask });
73
+ return {
74
+ success: true,
75
+ agent,
76
+ message: `Registered agent "${agent.nodeId}" with capabilities [${agent.capabilities.join(', ')}]. Initial reputation: ${agent.reputation}.`,
77
+ };
78
+ },
79
+ validate: async (runtime) => hasWallet(runtime),
80
+ examples: [[
81
+ { user: 'user', content: { text: 'Register me as an AXLE agent with scraping capabilities' } },
82
+ { user: 'agent', content: { text: 'I\'ve registered you as an AXLE agent with scraping capabilities. Your initial reputation is 100.' } },
83
+ ]],
84
+ };
85
+
86
+ const getTasksAction: Action = {
87
+ name: 'AXLE_GET_TASKS',
88
+ description: 'List available tasks on the AXLE Protocol network, optionally filtered by capability',
89
+ similes: ['list tasks', 'show tasks', 'get available tasks', 'find tasks', 'browse tasks'],
90
+ handler: async (runtime, message) => {
91
+ const sdk = createAxleSDK(runtime);
92
+ const capability = message.content.capability;
93
+ const tasks = await sdk.listTasks(capability);
94
+
95
+ if (tasks.length === 0) {
96
+ return { tasks: [], message: capability ? `No tasks found for capability "${capability}".` : 'No tasks currently available.' };
97
+ }
98
+
99
+ const summary = tasks.map(t => `- [${t.id}] ${t.capability} — ${t.reward} lamports, deadline ${t.deadline.toISOString()}`).join('\n');
100
+ return {
101
+ tasks,
102
+ message: `Found ${tasks.length} task(s):\n${summary}`,
103
+ };
104
+ },
105
+ validate: async (runtime) => hasWallet(runtime),
106
+ examples: [[
107
+ { user: 'user', content: { text: 'Show me available scraping tasks on AXLE' } },
108
+ { user: 'agent', content: { text: 'Found 2 scraping tasks:\n- [abc-123] scraping — 50000000 lamports\n- [def-456] scraping — 30000000 lamports' } },
109
+ ]],
110
+ };
111
+
112
+ const acceptTaskAction: Action = {
113
+ name: 'AXLE_ACCEPT_TASK',
114
+ description: 'Accept a task on the AXLE Protocol network for execution',
115
+ similes: ['accept task', 'take task', 'claim task', 'start task'],
116
+ handler: async (runtime, message) => {
117
+ const sdk = createAxleSDK(runtime);
118
+ const taskId = message.content.taskId;
119
+ if (!taskId) {
120
+ return { success: false, message: 'Please provide a taskId to accept.' };
121
+ }
122
+
123
+ const task = await sdk.acceptTask(taskId);
124
+ return {
125
+ success: true,
126
+ task,
127
+ message: `Accepted task ${taskId}. Reward: ${task.reward} lamports. Deadline: ${task.deadline.toISOString()}.`,
128
+ };
129
+ },
130
+ validate: async (runtime) => hasWallet(runtime),
131
+ examples: [[
132
+ { user: 'user', content: { text: 'Accept AXLE task abc-123' } },
133
+ { user: 'agent', content: { text: 'Accepted task abc-123. Reward: 50000000 lamports. Deadline: 2026-02-20T00:00:00.000Z.' } },
134
+ ]],
135
+ };
136
+
137
+ const deliverTaskAction: Action = {
138
+ name: 'AXLE_DELIVER_TASK',
139
+ description: 'Submit results for a task on the AXLE Protocol network',
140
+ similes: ['deliver task', 'submit task', 'complete task', 'send results', 'finish task'],
141
+ handler: async (runtime, message) => {
142
+ const sdk = createAxleSDK(runtime);
143
+ const taskId = message.content.taskId;
144
+ const result = message.content.result;
145
+
146
+ if (!taskId || !result) {
147
+ return { success: false, message: 'Please provide both taskId and result.' };
148
+ }
149
+
150
+ const task = await sdk.deliverTask(taskId, result);
151
+ return {
152
+ success: true,
153
+ task,
154
+ message: `Delivered results for task ${taskId}. Result hash stored on-chain. Awaiting requester approval.`,
155
+ };
156
+ },
157
+ validate: async (runtime) => hasWallet(runtime),
158
+ examples: [[
159
+ { user: 'user', content: { text: 'Deliver results for AXLE task abc-123' } },
160
+ { user: 'agent', content: { text: 'Delivered results for task abc-123. Result hash stored on-chain. Awaiting requester approval.' } },
161
+ ]],
162
+ };
163
+
164
+ const createTaskAction: Action = {
165
+ name: 'AXLE_CREATE_TASK',
166
+ description: 'Create a new task with escrow funding on the AXLE Protocol network',
167
+ similes: ['create task', 'post task', 'new task', 'submit task request', 'request work'],
168
+ handler: async (runtime, message) => {
169
+ const sdk = createAxleSDK(runtime);
170
+ const description = message.content.description || message.content.text;
171
+ const capability = message.content.capability || 'general';
172
+ const reward = message.content.reward || 50_000_000;
173
+ const deadline = message.content.deadline
174
+ ? new Date(message.content.deadline)
175
+ : new Date(Date.now() + 86400_000);
176
+
177
+ const task = await sdk.createTask({ description, capability, reward, deadline });
178
+ return {
179
+ success: true,
180
+ task,
181
+ message: `Created task ${task.id}. Capability: ${task.capability}. Reward: ${task.reward} lamports escrowed. Deadline: ${task.deadline.toISOString()}.`,
182
+ };
183
+ },
184
+ validate: async (runtime) => hasWallet(runtime),
185
+ examples: [[
186
+ { user: 'user', content: { text: 'Create an AXLE task for web scraping with 0.05 SOL reward' } },
187
+ { user: 'agent', content: { text: 'Created task abc-123. Capability: scraping. Reward: 50000000 lamports escrowed. Deadline: 2026-02-09.' } },
188
+ ]],
189
+ };
190
+
191
+ const getReputationAction: Action = {
192
+ name: 'AXLE_GET_REPUTATION',
193
+ description: 'Query an agent\'s on-chain reputation score on the AXLE Protocol network',
194
+ similes: ['get reputation', 'check reputation', 'agent score', 'agent rating', 'show reputation'],
195
+ handler: async (runtime, message) => {
196
+ const sdk = createAxleSDK(runtime);
197
+ const agentPublicKey = message.content.agentPublicKey;
198
+
199
+ if (!agentPublicKey) {
200
+ return { success: false, message: 'Please provide an agentPublicKey to look up.' };
201
+ }
202
+
203
+ const agent = await sdk.getAgent(agentPublicKey);
204
+ if (!agent) {
205
+ return { reputation: 0, agent: null, message: `No agent found for public key ${agentPublicKey}.` };
206
+ }
207
+
208
+ return {
209
+ reputation: agent.reputation,
210
+ agent,
211
+ message: `Agent "${agent.nodeId}" — Reputation: ${agent.reputation}, Tasks completed: ${agent.tasksCompleted}, Tasks failed: ${agent.tasksFailed}.`,
212
+ };
213
+ },
214
+ validate: async (runtime) => hasWallet(runtime),
215
+ examples: [[
216
+ { user: 'user', content: { text: 'What is the reputation of AXLE agent 7xKXt...?' } },
217
+ { user: 'agent', content: { text: 'Agent "scraper-01" — Reputation: 150, Tasks completed: 5, Tasks failed: 0.' } },
218
+ ]],
219
+ };
220
+
221
+ // ── Plugin Export ──
222
+
223
+ export const axlePlugin: Plugin = {
224
+ name: 'axle-protocol',
225
+ description: 'AXLE Protocol plugin for Eliza — on-chain task settlement for AI agents on Solana',
226
+ actions: [
227
+ registerAction,
228
+ getTasksAction,
229
+ acceptTaskAction,
230
+ deliverTaskAction,
231
+ createTaskAction,
232
+ getReputationAction,
233
+ ],
234
+ };
235
+
236
+ export default axlePlugin;
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "lib": ["ES2022"],
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "resolveJsonModule": true,
12
+ "declaration": true,
13
+ "skipLibCheck": true,
14
+ "paths": {
15
+ "@axle-protocol/sdk": ["../../sdk/dist/index.d.ts"]
16
+ }
17
+ },
18
+ "include": ["src"],
19
+ "exclude": ["node_modules", "dist"]
20
+ }