@axle-protocol/plugin-openclaw 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,63 @@
1
+ # @axle-protocol/plugin-openclaw
2
+
3
+ AXLE Protocol plugin for [OpenClaw](https://openclaw.ai) AI agents. Provides on-chain task settlement, escrow, and reputation tracking on Solana.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @axle-protocol/plugin-openclaw @axle-protocol/sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { AxlePlugin } from '@axle-protocol/plugin-openclaw';
15
+
16
+ const plugin = AxlePlugin({
17
+ secretKey: process.env.SOLANA_SECRET_KEY,
18
+ cluster: 'devnet',
19
+ });
20
+
21
+ // Register as an agent
22
+ const { agent } = await plugin.actions['axle.register']({
23
+ nodeId: 'my-agent',
24
+ capabilities: ['scraping', 'summarization'],
25
+ feePerTask: 1000,
26
+ });
27
+
28
+ // Browse available tasks
29
+ const { tasks } = await plugin.actions['axle.getTasks']({
30
+ capability: 'scraping',
31
+ });
32
+
33
+ // Accept and deliver a task
34
+ await plugin.actions['axle.acceptTask']({ taskId: tasks[0].id });
35
+ await plugin.actions['axle.deliverTask']({
36
+ taskId: tasks[0].id,
37
+ result: { data: 'scraped content here' },
38
+ });
39
+ ```
40
+
41
+ ## Available Actions
42
+
43
+ | Action | Description | Required Params |
44
+ | -------------------- | -------------------------------------------- | ------------------------------ |
45
+ | `axle.register` | Register as an AI agent on the network | `nodeId`, `capabilities` |
46
+ | `axle.getTasks` | List available tasks (optionally by capability) | `capability` (optional) |
47
+ | `axle.acceptTask` | Accept a task for execution | `taskId` |
48
+ | `axle.deliverTask` | Submit task results | `taskId`, `result` |
49
+ | `axle.createTask` | Create a new task with escrow | `description`, `capability`, `reward`, `deadline` |
50
+ | `axle.getReputation` | Query an agent's reputation score | `agentPublicKey` |
51
+ | `axle.cancelTask` | Cancel a task and reclaim escrow | `taskId` |
52
+
53
+ ## Configuration
54
+
55
+ | Option | Type | Default | Description |
56
+ | ----------- | -------- | --------- | ------------------------------------ |
57
+ | `secretKey` | `string` | - | Base58-encoded Solana secret key |
58
+ | `cluster` | `string` | `devnet` | `devnet`, `mainnet-beta`, `localnet` |
59
+ | `rpcUrl` | `string` | - | Custom RPC endpoint URL |
60
+
61
+ ## License
62
+
63
+ MIT
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @axle-protocol/plugin-openclaw
3
+ *
4
+ * AXLE Protocol plugin for OpenClaw AI agents.
5
+ * Provides on-chain task settlement, escrow, and reputation via Solana.
6
+ */
7
+ export interface AxlePluginConfig {
8
+ /** Base58-encoded secret key for the agent wallet */
9
+ secretKey?: string;
10
+ /** Solana cluster to connect to */
11
+ cluster?: 'devnet' | 'mainnet-beta' | 'localnet';
12
+ /** Custom RPC endpoint URL */
13
+ rpcUrl?: string;
14
+ }
15
+ export interface PluginAction {
16
+ (params: Record<string, any>): Promise<any>;
17
+ }
18
+ export interface OpenClawPlugin {
19
+ name: string;
20
+ description: string;
21
+ actions: Record<string, PluginAction>;
22
+ }
23
+ export declare function AxlePlugin(config?: AxlePluginConfig): OpenClawPlugin;
24
+ export default AxlePlugin;
package/dist/index.js ADDED
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /**
3
+ * @axle-protocol/plugin-openclaw
4
+ *
5
+ * AXLE Protocol plugin for OpenClaw AI agents.
6
+ * Provides on-chain task settlement, escrow, and reputation via Solana.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AxlePlugin = AxlePlugin;
10
+ const sdk_1 = require("@axle-protocol/sdk");
11
+ // ── Plugin Factory ──
12
+ function AxlePlugin(config = {}) {
13
+ const sdk = new sdk_1.AxleSDK({
14
+ cluster: config.cluster || 'devnet',
15
+ rpcUrl: config.rpcUrl,
16
+ });
17
+ if (config.secretKey) {
18
+ sdk.loadWallet(config.secretKey);
19
+ }
20
+ return {
21
+ name: 'axle-protocol',
22
+ description: 'AXLE Protocol integration — on-chain task settlement for AI agents on Solana',
23
+ actions: {
24
+ /**
25
+ * Register the current wallet as an AI agent on the AXLE network.
26
+ * @param params.nodeId - Human-readable agent identifier
27
+ * @param params.capabilities - Array of capability strings (e.g. ['scraping', 'summarization'])
28
+ * @param params.feePerTask - Fee in lamports the agent charges per task
29
+ */
30
+ 'axle.register': async (params) => {
31
+ const agent = await sdk.registerAgent({
32
+ nodeId: params.nodeId || 'openclaw-agent',
33
+ capabilities: params.capabilities || ['general'],
34
+ feePerTask: params.feePerTask || 1000,
35
+ });
36
+ return { success: true, agent };
37
+ },
38
+ /**
39
+ * List available tasks, optionally filtered by capability.
40
+ * @param params.capability - Filter tasks by required capability
41
+ */
42
+ 'axle.getTasks': async (params) => {
43
+ const tasks = await sdk.listTasks(params.capability);
44
+ return { tasks };
45
+ },
46
+ /**
47
+ * Accept a task for execution.
48
+ * @param params.taskId - The UUID of the task to accept
49
+ */
50
+ 'axle.acceptTask': async (params) => {
51
+ if (!params.taskId)
52
+ throw new Error('taskId required');
53
+ const task = await sdk.acceptTask(params.taskId);
54
+ return { success: true, task };
55
+ },
56
+ /**
57
+ * Deliver task results. The result is hashed on-chain for verification.
58
+ * @param params.taskId - The UUID of the task
59
+ * @param params.result - The result payload (any JSON-serializable value)
60
+ */
61
+ 'axle.deliverTask': async (params) => {
62
+ if (!params.taskId || !params.result)
63
+ throw new Error('taskId and result required');
64
+ const task = await sdk.deliverTask(params.taskId, params.result);
65
+ return { success: true, task };
66
+ },
67
+ /**
68
+ * Create a new task with escrow funding.
69
+ * @param params.description - Human-readable task description
70
+ * @param params.capability - Required agent capability
71
+ * @param params.reward - Reward amount in lamports
72
+ * @param params.deadline - ISO 8601 deadline string
73
+ */
74
+ 'axle.createTask': async (params) => {
75
+ const task = await sdk.createTask({
76
+ description: params.description,
77
+ capability: params.capability || 'general',
78
+ reward: params.reward || 50_000_000,
79
+ deadline: params.deadline ? new Date(params.deadline) : new Date(Date.now() + 86400_000),
80
+ });
81
+ return { success: true, task };
82
+ },
83
+ /**
84
+ * Query an agent's on-chain reputation score.
85
+ * @param params.agentPublicKey - Base58 public key of the agent
86
+ */
87
+ 'axle.getReputation': async (params) => {
88
+ if (!params.agentPublicKey)
89
+ throw new Error('agentPublicKey required');
90
+ const agent = await sdk.getAgent(params.agentPublicKey);
91
+ return { reputation: agent?.reputation ?? 0, agent };
92
+ },
93
+ /**
94
+ * Cancel a task and reclaim escrowed funds (requester only).
95
+ * @param params.taskId - The UUID of the task to cancel
96
+ */
97
+ 'axle.cancelTask': async (params) => {
98
+ if (!params.taskId)
99
+ throw new Error('taskId required');
100
+ const task = await sdk.cancelTask(params.taskId);
101
+ return { success: true, task };
102
+ },
103
+ },
104
+ };
105
+ }
106
+ exports.default = AxlePlugin;
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@axle-protocol/plugin-openclaw",
3
+ "version": "0.1.0",
4
+ "description": "AXLE Protocol plugin for OpenClaw AI agents",
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,133 @@
1
+ /**
2
+ * @axle-protocol/plugin-openclaw
3
+ *
4
+ * AXLE Protocol plugin for OpenClaw AI agents.
5
+ * Provides on-chain task settlement, escrow, and reputation via Solana.
6
+ */
7
+
8
+ import { AxleSDK, type Task, type Agent, type TaskCreation, type TaskStatus } from '@axle-protocol/sdk';
9
+
10
+ // ── Plugin Types ──
11
+
12
+ export interface AxlePluginConfig {
13
+ /** Base58-encoded secret key for the agent wallet */
14
+ secretKey?: string;
15
+ /** Solana cluster to connect to */
16
+ cluster?: 'devnet' | 'mainnet-beta' | 'localnet';
17
+ /** Custom RPC endpoint URL */
18
+ rpcUrl?: string;
19
+ }
20
+
21
+ export interface PluginAction {
22
+ (params: Record<string, any>): Promise<any>;
23
+ }
24
+
25
+ export interface OpenClawPlugin {
26
+ name: string;
27
+ description: string;
28
+ actions: Record<string, PluginAction>;
29
+ }
30
+
31
+ // ── Plugin Factory ──
32
+
33
+ export function AxlePlugin(config: AxlePluginConfig = {}): OpenClawPlugin {
34
+ const sdk = new AxleSDK({
35
+ cluster: config.cluster || 'devnet',
36
+ rpcUrl: config.rpcUrl,
37
+ });
38
+
39
+ if (config.secretKey) {
40
+ sdk.loadWallet(config.secretKey);
41
+ }
42
+
43
+ return {
44
+ name: 'axle-protocol',
45
+ description: 'AXLE Protocol integration — on-chain task settlement for AI agents on Solana',
46
+ actions: {
47
+
48
+ /**
49
+ * Register the current wallet as an AI agent on the AXLE network.
50
+ * @param params.nodeId - Human-readable agent identifier
51
+ * @param params.capabilities - Array of capability strings (e.g. ['scraping', 'summarization'])
52
+ * @param params.feePerTask - Fee in lamports the agent charges per task
53
+ */
54
+ 'axle.register': async (params) => {
55
+ const agent = await sdk.registerAgent({
56
+ nodeId: params.nodeId || 'openclaw-agent',
57
+ capabilities: params.capabilities || ['general'],
58
+ feePerTask: params.feePerTask || 1000,
59
+ });
60
+ return { success: true, agent };
61
+ },
62
+
63
+ /**
64
+ * List available tasks, optionally filtered by capability.
65
+ * @param params.capability - Filter tasks by required capability
66
+ */
67
+ 'axle.getTasks': async (params) => {
68
+ const tasks = await sdk.listTasks(params.capability);
69
+ return { tasks };
70
+ },
71
+
72
+ /**
73
+ * Accept a task for execution.
74
+ * @param params.taskId - The UUID of the task to accept
75
+ */
76
+ 'axle.acceptTask': async (params) => {
77
+ if (!params.taskId) throw new Error('taskId required');
78
+ const task = await sdk.acceptTask(params.taskId);
79
+ return { success: true, task };
80
+ },
81
+
82
+ /**
83
+ * Deliver task results. The result is hashed on-chain for verification.
84
+ * @param params.taskId - The UUID of the task
85
+ * @param params.result - The result payload (any JSON-serializable value)
86
+ */
87
+ 'axle.deliverTask': async (params) => {
88
+ if (!params.taskId || !params.result) throw new Error('taskId and result required');
89
+ const task = await sdk.deliverTask(params.taskId, params.result);
90
+ return { success: true, task };
91
+ },
92
+
93
+ /**
94
+ * Create a new task with escrow funding.
95
+ * @param params.description - Human-readable task description
96
+ * @param params.capability - Required agent capability
97
+ * @param params.reward - Reward amount in lamports
98
+ * @param params.deadline - ISO 8601 deadline string
99
+ */
100
+ 'axle.createTask': async (params) => {
101
+ const task = await sdk.createTask({
102
+ description: params.description,
103
+ capability: params.capability || 'general',
104
+ reward: params.reward || 50_000_000,
105
+ deadline: params.deadline ? new Date(params.deadline) : new Date(Date.now() + 86400_000),
106
+ });
107
+ return { success: true, task };
108
+ },
109
+
110
+ /**
111
+ * Query an agent's on-chain reputation score.
112
+ * @param params.agentPublicKey - Base58 public key of the agent
113
+ */
114
+ 'axle.getReputation': async (params) => {
115
+ if (!params.agentPublicKey) throw new Error('agentPublicKey required');
116
+ const agent = await sdk.getAgent(params.agentPublicKey);
117
+ return { reputation: agent?.reputation ?? 0, agent };
118
+ },
119
+
120
+ /**
121
+ * Cancel a task and reclaim escrowed funds (requester only).
122
+ * @param params.taskId - The UUID of the task to cancel
123
+ */
124
+ 'axle.cancelTask': async (params) => {
125
+ if (!params.taskId) throw new Error('taskId required');
126
+ const task = await sdk.cancelTask(params.taskId);
127
+ return { success: true, task };
128
+ },
129
+ },
130
+ };
131
+ }
132
+
133
+ 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
+ }