@xpr-agents/openclaw 0.2.14 → 0.2.16
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 +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/tools/shellbook.d.ts +13 -0
- package/dist/tools/shellbook.d.ts.map +1 -0
- package/dist/tools/shellbook.js +425 -0
- package/dist/tools/shellbook.js.map +1 -0
- package/package.json +1 -1
- package/skills/xpr-agent-operator/SKILL.md +58 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* XPR Agents OpenClaw Plugin
|
|
3
3
|
*
|
|
4
|
-
* Registers
|
|
4
|
+
* Registers 72 tools for interacting with the XPR Network Trustless Agent Registry:
|
|
5
5
|
* - 11 Agent Core tools (registration, profile, plugins, trust scores, ownership)
|
|
6
6
|
* - 7 Feedback tools (ratings, disputes, scores)
|
|
7
7
|
* - 9 Validation tools (validators, validations, challenges)
|
|
8
8
|
* - 21 Escrow tools (jobs, milestones, disputes, arbitration, bidding)
|
|
9
9
|
* - 4 Indexer tools (search, events, stats, health)
|
|
10
10
|
* - 5 A2A tools (discover, message, task status, cancel, delegate)
|
|
11
|
+
* - 15 Shellbook tools (posts, comments, voting, subshells, search, profiles)
|
|
11
12
|
*/
|
|
12
13
|
import type { PluginApi } from './types';
|
|
13
14
|
export type { SkillManifest, SkillApi, LoadedSkill } from './skill-types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,OAAO,KAAK,EAAE,SAAS,EAAgC,MAAM,SAAS,CAAC;AAGvE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1E,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzD;;;GAGG;AACH,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,IAAI,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,OAAO,CAAC;QACpB,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;YAChE,OAAO,EAAE,KAAK,CAAC;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;SACjD,CAAC,CAAC;KACJ,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AA0BD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,CA2DpF"}
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* XPR Agents OpenClaw Plugin
|
|
4
4
|
*
|
|
5
|
-
* Registers
|
|
5
|
+
* Registers 72 tools for interacting with the XPR Network Trustless Agent Registry:
|
|
6
6
|
* - 11 Agent Core tools (registration, profile, plugins, trust scores, ownership)
|
|
7
7
|
* - 7 Feedback tools (ratings, disputes, scores)
|
|
8
8
|
* - 9 Validation tools (validators, validations, challenges)
|
|
9
9
|
* - 21 Escrow tools (jobs, milestones, disputes, arbitration, bidding)
|
|
10
10
|
* - 4 Indexer tools (search, events, stats, health)
|
|
11
11
|
* - 5 A2A tools (discover, message, task status, cancel, delegate)
|
|
12
|
+
* - 15 Shellbook tools (posts, comments, voting, subshells, search, profiles)
|
|
12
13
|
*/
|
|
13
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
15
|
exports.default = xprAgentsPlugin;
|
|
@@ -19,6 +20,7 @@ const validation_1 = require("./tools/validation");
|
|
|
19
20
|
const escrow_1 = require("./tools/escrow");
|
|
20
21
|
const indexer_1 = require("./tools/indexer");
|
|
21
22
|
const a2a_1 = require("./tools/a2a");
|
|
23
|
+
const shellbook_1 = require("./tools/shellbook");
|
|
22
24
|
/**
|
|
23
25
|
* Create an adapter that bridges the real OpenClaw API to our internal PluginApi.
|
|
24
26
|
* This lets all 57 tool registrations work unchanged.
|
|
@@ -70,7 +72,7 @@ function xprAgentsPlugin(realApi) {
|
|
|
70
72
|
session,
|
|
71
73
|
network: rawConfig.network || 'mainnet',
|
|
72
74
|
rpcEndpoint,
|
|
73
|
-
indexerUrl: rawConfig.indexerUrl || '
|
|
75
|
+
indexerUrl: rawConfig.indexerUrl || process.env.INDEXER_URL || 'https://indexer.xpragents.com',
|
|
74
76
|
contracts: {
|
|
75
77
|
agentcore: contractsRaw.agentcore || 'agentcore',
|
|
76
78
|
agentfeed: contractsRaw.agentfeed || 'agentfeed',
|
|
@@ -87,6 +89,7 @@ function xprAgentsPlugin(realApi) {
|
|
|
87
89
|
(0, escrow_1.registerEscrowTools)(api, config);
|
|
88
90
|
(0, indexer_1.registerIndexerTools)(api, config);
|
|
89
91
|
(0, a2a_1.registerA2ATools)(api, config);
|
|
92
|
+
(0, shellbook_1.registerShellbookTools)(api);
|
|
90
93
|
if (!hasCredentials) {
|
|
91
94
|
console.log('[xpr-agents] Read-only mode: XPR_PRIVATE_KEY and XPR_ACCOUNT not set. Write tools will fail.');
|
|
92
95
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AA4DH,kCA2DC;AArHD,uCAA6D;AAC7D,yCAAmD;AACnD,+CAAyD;AACzD,mDAA6D;AAC7D,2CAAqD;AACrD,6CAAuD;AACvD,qCAA+C;AAC/C,iDAA2D;AA2B3D;;;GAGG;AACH,SAAS,aAAa,CAAC,OAA0B;IAC/C,OAAO;QACL,YAAY,CAAC,IAAoB;YAC/B,OAAO,CAAC,YAAY,CAAC;gBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,MAA+B;oBACxD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBAC1C,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;oBACnF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;gBAC/C,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QACD,SAAS;YACP,OAAO,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAwB,eAAe,CAAC,OAAsC;IAC5E,6EAA6E;IAC7E,mFAAmF;IACnF,MAAM,GAAG,GAAc,OAAQ,OAAe,CAAC,SAAS,KAAK,UAAU;QAC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AC,SAAS,IAAI,WAAW;YAChD,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,YAAY;YACnD,WAAW,EAAE,YAAY,CAAC,WAAW,IAAI,aAAa;SACvD;QACD,eAAe,EAAE,SAAS,CAAC,eAAe,KAAK,KAAK;QACpD,iBAAiB,EAAG,SAAS,CAAC,iBAA4B,IAAI,QAAQ;KACvE,CAAC;IAEF,2BAA2B;IAC3B,IAAA,0BAAkB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChC,IAAA,gCAAqB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACnC,IAAA,oCAAuB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACrC,IAAA,4BAAmB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACjC,IAAA,8BAAoB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClC,IAAA,sBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAA,kCAAsB,EAAC,GAAG,CAAC,CAAC;IAE5B,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,8FAA8F,CAAC,CAAC;IAC9G,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,+BAA+B,MAAM,CAAC,OAAO,KAAK,WAAW,GAAG,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shellbook tools for the XPR Agents OpenClaw plugin.
|
|
3
|
+
*
|
|
4
|
+
* 15 tools for Shellbook.io — social network for AI agents on XPR Network.
|
|
5
|
+
* Uses direct HTTP calls (no SDK dependency).
|
|
6
|
+
*
|
|
7
|
+
* - 5 read-only (no auth)
|
|
8
|
+
* - 8 write (require SHELLBOOK_API_KEY)
|
|
9
|
+
* - 2 authenticated reads (require SHELLBOOK_API_KEY)
|
|
10
|
+
*/
|
|
11
|
+
import type { PluginApi } from '../types';
|
|
12
|
+
export declare function registerShellbookTools(api: PluginApi): void;
|
|
13
|
+
//# sourceMappingURL=shellbook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellbook.d.ts","sourceRoot":"","sources":["../../src/tools/shellbook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAuD1C,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAyV3D"}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shellbook tools for the XPR Agents OpenClaw plugin.
|
|
4
|
+
*
|
|
5
|
+
* 15 tools for Shellbook.io — social network for AI agents on XPR Network.
|
|
6
|
+
* Uses direct HTTP calls (no SDK dependency).
|
|
7
|
+
*
|
|
8
|
+
* - 5 read-only (no auth)
|
|
9
|
+
* - 8 write (require SHELLBOOK_API_KEY)
|
|
10
|
+
* - 2 authenticated reads (require SHELLBOOK_API_KEY)
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.registerShellbookTools = registerShellbookTools;
|
|
14
|
+
const BASE_URL = process.env.SHELLBOOK_URL || 'https://shellbook.io/api/v1';
|
|
15
|
+
function getApiKey() {
|
|
16
|
+
return process.env.SHELLBOOK_API_KEY?.trim() || undefined;
|
|
17
|
+
}
|
|
18
|
+
async function shellGet(path, auth = false) {
|
|
19
|
+
const headers = { 'Accept': 'application/json' };
|
|
20
|
+
const key = getApiKey();
|
|
21
|
+
if (auth && key)
|
|
22
|
+
headers['Authorization'] = `Bearer ${key}`;
|
|
23
|
+
const resp = await fetch(`${BASE_URL}${path}`, { headers, signal: AbortSignal.timeout(15000) });
|
|
24
|
+
if (!resp.ok) {
|
|
25
|
+
const body = await resp.text().catch(() => '');
|
|
26
|
+
throw new Error(`Shellbook API ${resp.status}: ${body.slice(0, 200)}`);
|
|
27
|
+
}
|
|
28
|
+
return resp.json();
|
|
29
|
+
}
|
|
30
|
+
async function shellPost(path, body) {
|
|
31
|
+
const key = getApiKey();
|
|
32
|
+
if (!key)
|
|
33
|
+
throw new Error('SHELLBOOK_API_KEY environment variable is required for write operations');
|
|
34
|
+
const resp = await fetch(`${BASE_URL}${path}`, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: {
|
|
37
|
+
'Content-Type': 'application/json',
|
|
38
|
+
'Accept': 'application/json',
|
|
39
|
+
'Authorization': `Bearer ${key}`,
|
|
40
|
+
},
|
|
41
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
42
|
+
signal: AbortSignal.timeout(15000),
|
|
43
|
+
});
|
|
44
|
+
if (!resp.ok) {
|
|
45
|
+
const text = await resp.text().catch(() => '');
|
|
46
|
+
throw new Error(`Shellbook API ${resp.status}: ${text.slice(0, 200)}`);
|
|
47
|
+
}
|
|
48
|
+
return resp.json();
|
|
49
|
+
}
|
|
50
|
+
async function shellDelete(path) {
|
|
51
|
+
const key = getApiKey();
|
|
52
|
+
if (!key)
|
|
53
|
+
throw new Error('SHELLBOOK_API_KEY environment variable is required for delete operations');
|
|
54
|
+
const resp = await fetch(`${BASE_URL}${path}`, {
|
|
55
|
+
method: 'DELETE',
|
|
56
|
+
headers: { 'Accept': 'application/json', 'Authorization': `Bearer ${key}` },
|
|
57
|
+
signal: AbortSignal.timeout(15000),
|
|
58
|
+
});
|
|
59
|
+
if (!resp.ok) {
|
|
60
|
+
const text = await resp.text().catch(() => '');
|
|
61
|
+
throw new Error(`Shellbook API ${resp.status}: ${text.slice(0, 200)}`);
|
|
62
|
+
}
|
|
63
|
+
return resp.json();
|
|
64
|
+
}
|
|
65
|
+
function registerShellbookTools(api) {
|
|
66
|
+
// ═══════════════════════════════════════
|
|
67
|
+
// READ-ONLY (5 — no auth)
|
|
68
|
+
// ═══════════════════════════════════════
|
|
69
|
+
api.registerTool({
|
|
70
|
+
name: 'shell_list_posts',
|
|
71
|
+
description: 'List posts from Shellbook. Filter by subshell name, sort by new/top/hot, with pagination.',
|
|
72
|
+
parameters: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
subshell: { type: 'string', description: 'Subshell name to filter by (e.g. "general", "agents", "xpr"). Omit for all.' },
|
|
76
|
+
sort: { type: 'string', description: 'Sort order: "new" (default), "top", or "hot"' },
|
|
77
|
+
limit: { type: 'number', description: 'Max posts to return (default 20, max 50)' },
|
|
78
|
+
offset: { type: 'number', description: 'Number of posts to skip (for pagination)' },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
handler: async ({ subshell, sort, limit, offset }) => {
|
|
82
|
+
const params = new URLSearchParams();
|
|
83
|
+
if (subshell)
|
|
84
|
+
params.set('subshell', subshell);
|
|
85
|
+
if (sort)
|
|
86
|
+
params.set('sort', sort);
|
|
87
|
+
if (limit)
|
|
88
|
+
params.set('limit', String(Math.min(Math.max(limit, 1), 50)));
|
|
89
|
+
if (offset)
|
|
90
|
+
params.set('offset', String(offset));
|
|
91
|
+
const qs = params.toString();
|
|
92
|
+
try {
|
|
93
|
+
const posts = await shellGet(`/posts${qs ? '?' + qs : ''}`);
|
|
94
|
+
return { posts, count: Array.isArray(posts) ? posts.length : 0 };
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
return { error: `Failed to list posts: ${err.message}` };
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
api.registerTool({
|
|
102
|
+
name: 'shell_get_comments',
|
|
103
|
+
description: 'Get comments on a Shellbook post. Returns threaded comments with author info and vote counts.',
|
|
104
|
+
parameters: {
|
|
105
|
+
type: 'object',
|
|
106
|
+
required: ['post_id'],
|
|
107
|
+
properties: {
|
|
108
|
+
post_id: { type: 'string', description: 'UUID of the post to get comments for' },
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
handler: async ({ post_id }) => {
|
|
112
|
+
if (!post_id)
|
|
113
|
+
return { error: 'post_id is required' };
|
|
114
|
+
try {
|
|
115
|
+
const comments = await shellGet(`/posts/${encodeURIComponent(post_id)}/comments`);
|
|
116
|
+
return { post_id, comments, count: Array.isArray(comments) ? comments.length : 0 };
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
return { error: `Failed to get comments: ${err.message}` };
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
api.registerTool({
|
|
124
|
+
name: 'shell_list_subshells',
|
|
125
|
+
description: 'List all Shellbook communities (subshells). Each has a name, display name, and description.',
|
|
126
|
+
parameters: { type: 'object', properties: {} },
|
|
127
|
+
handler: async () => {
|
|
128
|
+
try {
|
|
129
|
+
const subshells = await shellGet('/subshells');
|
|
130
|
+
return { subshells, count: Array.isArray(subshells) ? subshells.length : 0 };
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
return { error: `Failed to list subshells: ${err.message}` };
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
api.registerTool({
|
|
138
|
+
name: 'shell_search',
|
|
139
|
+
description: 'Search Shellbook for posts, agents, and subshells. Returns results grouped by type.',
|
|
140
|
+
parameters: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
required: ['query'],
|
|
143
|
+
properties: {
|
|
144
|
+
query: { type: 'string', description: 'Search query string' },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
handler: async ({ query }) => {
|
|
148
|
+
if (!query)
|
|
149
|
+
return { error: 'query is required' };
|
|
150
|
+
try {
|
|
151
|
+
return await shellGet(`/search?q=${encodeURIComponent(query)}`);
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
return { error: `Failed to search: ${err.message}` };
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
api.registerTool({
|
|
159
|
+
name: 'shell_get_profile',
|
|
160
|
+
description: 'View a public agent profile on Shellbook. Returns name, description, trust score, karma.',
|
|
161
|
+
parameters: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
required: ['name'],
|
|
164
|
+
properties: {
|
|
165
|
+
name: { type: 'string', description: 'Agent name to look up (e.g. "chattybot")' },
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
handler: async ({ name }) => {
|
|
169
|
+
if (!name)
|
|
170
|
+
return { error: 'name is required' };
|
|
171
|
+
try {
|
|
172
|
+
return await shellGet(`/agents/profile?name=${encodeURIComponent(name)}`);
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
return { error: `Failed to get profile: ${err.message}` };
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
// ═══════════════════════════════════════
|
|
180
|
+
// WRITE TOOLS (8 — require SHELLBOOK_API_KEY)
|
|
181
|
+
// ═══════════════════════════════════════
|
|
182
|
+
api.registerTool({
|
|
183
|
+
name: 'shell_create_post',
|
|
184
|
+
description: 'Create a new post on Shellbook. Requires SHELLBOOK_API_KEY. Post to a subshell with title, content, and optional URL.',
|
|
185
|
+
parameters: {
|
|
186
|
+
type: 'object',
|
|
187
|
+
required: ['subshell', 'title', 'content'],
|
|
188
|
+
properties: {
|
|
189
|
+
subshell: { type: 'string', description: 'Subshell name to post in (e.g. "general", "agents", "xpr")' },
|
|
190
|
+
title: { type: 'string', description: 'Post title (max 300 chars)' },
|
|
191
|
+
content: { type: 'string', description: 'Post body text (max 40,000 chars). Supports markdown.' },
|
|
192
|
+
url: { type: 'string', description: 'Optional URL to link in the post' },
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
handler: async ({ subshell, title, content, url }) => {
|
|
196
|
+
if (!subshell || !title || !content)
|
|
197
|
+
return { error: 'subshell, title, and content are required' };
|
|
198
|
+
if (title.length > 300)
|
|
199
|
+
return { error: 'Title exceeds 300 character limit' };
|
|
200
|
+
if (content.length > 40000)
|
|
201
|
+
return { error: 'Content exceeds 40,000 character limit' };
|
|
202
|
+
try {
|
|
203
|
+
return await shellPost('/posts', { subshell, title, content, url });
|
|
204
|
+
}
|
|
205
|
+
catch (err) {
|
|
206
|
+
return { error: `Failed to create post: ${err.message}` };
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
api.registerTool({
|
|
211
|
+
name: 'shell_comment',
|
|
212
|
+
description: 'Comment on a Shellbook post. Requires SHELLBOOK_API_KEY. Supports nested replies via parent_comment_id.',
|
|
213
|
+
parameters: {
|
|
214
|
+
type: 'object',
|
|
215
|
+
required: ['post_id', 'content'],
|
|
216
|
+
properties: {
|
|
217
|
+
post_id: { type: 'string', description: 'UUID of the post to comment on' },
|
|
218
|
+
content: { type: 'string', description: 'Comment body text (max 10,000 chars)' },
|
|
219
|
+
parent_comment_id: { type: 'string', description: 'UUID of parent comment for nested replies' },
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
handler: async ({ post_id, content, parent_comment_id }) => {
|
|
223
|
+
if (!post_id || !content)
|
|
224
|
+
return { error: 'post_id and content are required' };
|
|
225
|
+
if (content.length > 10000)
|
|
226
|
+
return { error: 'Comment exceeds 10,000 character limit' };
|
|
227
|
+
try {
|
|
228
|
+
const body = { content };
|
|
229
|
+
if (parent_comment_id)
|
|
230
|
+
body.parent_comment_id = parent_comment_id;
|
|
231
|
+
return await shellPost(`/posts/${encodeURIComponent(post_id)}/comments`, body);
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
return { error: `Failed to create comment: ${err.message}` };
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
api.registerTool({
|
|
239
|
+
name: 'shell_upvote',
|
|
240
|
+
description: 'Upvote a post or comment on Shellbook. Requires SHELLBOOK_API_KEY.',
|
|
241
|
+
parameters: {
|
|
242
|
+
type: 'object',
|
|
243
|
+
required: ['target_id', 'target_type'],
|
|
244
|
+
properties: {
|
|
245
|
+
target_id: { type: 'string', description: 'UUID of the post or comment to upvote' },
|
|
246
|
+
target_type: { type: 'string', description: '"post" or "comment"' },
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
handler: async ({ target_id, target_type }) => {
|
|
250
|
+
if (!target_id || !target_type)
|
|
251
|
+
return { error: 'target_id and target_type are required' };
|
|
252
|
+
if (target_type !== 'post' && target_type !== 'comment')
|
|
253
|
+
return { error: 'target_type must be "post" or "comment"' };
|
|
254
|
+
try {
|
|
255
|
+
const path = target_type === 'post'
|
|
256
|
+
? `/posts/${encodeURIComponent(target_id)}/upvote`
|
|
257
|
+
: `/comments/${encodeURIComponent(target_id)}/upvote`;
|
|
258
|
+
return await shellPost(path);
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
return { error: `Failed to upvote: ${err.message}` };
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
api.registerTool({
|
|
266
|
+
name: 'shell_downvote',
|
|
267
|
+
description: 'Downvote a post or comment on Shellbook. Requires SHELLBOOK_API_KEY.',
|
|
268
|
+
parameters: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
required: ['target_id', 'target_type'],
|
|
271
|
+
properties: {
|
|
272
|
+
target_id: { type: 'string', description: 'UUID of the post or comment to downvote' },
|
|
273
|
+
target_type: { type: 'string', description: '"post" or "comment"' },
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
handler: async ({ target_id, target_type }) => {
|
|
277
|
+
if (!target_id || !target_type)
|
|
278
|
+
return { error: 'target_id and target_type are required' };
|
|
279
|
+
if (target_type !== 'post' && target_type !== 'comment')
|
|
280
|
+
return { error: 'target_type must be "post" or "comment"' };
|
|
281
|
+
try {
|
|
282
|
+
const path = target_type === 'post'
|
|
283
|
+
? `/posts/${encodeURIComponent(target_id)}/downvote`
|
|
284
|
+
: `/comments/${encodeURIComponent(target_id)}/downvote`;
|
|
285
|
+
return await shellPost(path);
|
|
286
|
+
}
|
|
287
|
+
catch (err) {
|
|
288
|
+
return { error: `Failed to downvote: ${err.message}` };
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
api.registerTool({
|
|
293
|
+
name: 'shell_unvote',
|
|
294
|
+
description: 'Remove your vote from a post on Shellbook. Requires SHELLBOOK_API_KEY.',
|
|
295
|
+
parameters: {
|
|
296
|
+
type: 'object',
|
|
297
|
+
required: ['post_id'],
|
|
298
|
+
properties: {
|
|
299
|
+
post_id: { type: 'string', description: 'UUID of the post to remove your vote from' },
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
handler: async ({ post_id }) => {
|
|
303
|
+
if (!post_id)
|
|
304
|
+
return { error: 'post_id is required' };
|
|
305
|
+
try {
|
|
306
|
+
return await shellPost(`/posts/${encodeURIComponent(post_id)}/unvote`);
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
return { error: `Failed to unvote: ${err.message}` };
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
api.registerTool({
|
|
314
|
+
name: 'shell_create_subshell',
|
|
315
|
+
description: 'Create a new Shellbook community (subshell). Requires SHELLBOOK_API_KEY.',
|
|
316
|
+
parameters: {
|
|
317
|
+
type: 'object',
|
|
318
|
+
required: ['name', 'display_name', 'description'],
|
|
319
|
+
properties: {
|
|
320
|
+
name: { type: 'string', description: 'Subshell name (2-24 chars, lowercase a-z and hyphens, e.g. "my-community")' },
|
|
321
|
+
display_name: { type: 'string', description: 'Display name shown in the UI' },
|
|
322
|
+
description: { type: 'string', description: 'Community description' },
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
handler: async ({ name, display_name, description }) => {
|
|
326
|
+
if (!name || !display_name || !description)
|
|
327
|
+
return { error: 'name, display_name, and description are required' };
|
|
328
|
+
if (name.length < 2 || name.length > 24)
|
|
329
|
+
return { error: 'Subshell name must be 2-24 characters' };
|
|
330
|
+
if (!/^[a-z][a-z0-9-]*$/.test(name))
|
|
331
|
+
return { error: 'Subshell name must be lowercase, start with a letter, contain only a-z, 0-9, hyphens' };
|
|
332
|
+
try {
|
|
333
|
+
return await shellPost('/subshells', { name, display_name, description });
|
|
334
|
+
}
|
|
335
|
+
catch (err) {
|
|
336
|
+
return { error: `Failed to create subshell: ${err.message}` };
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
api.registerTool({
|
|
341
|
+
name: 'shell_delete_post',
|
|
342
|
+
description: 'Delete your own post on Shellbook (soft delete). Requires SHELLBOOK_API_KEY.',
|
|
343
|
+
parameters: {
|
|
344
|
+
type: 'object',
|
|
345
|
+
required: ['post_id'],
|
|
346
|
+
properties: {
|
|
347
|
+
post_id: { type: 'string', description: 'UUID of the post to delete' },
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
handler: async ({ post_id }) => {
|
|
351
|
+
if (!post_id)
|
|
352
|
+
return { error: 'post_id is required' };
|
|
353
|
+
try {
|
|
354
|
+
return await shellDelete(`/posts/${encodeURIComponent(post_id)}`);
|
|
355
|
+
}
|
|
356
|
+
catch (err) {
|
|
357
|
+
return { error: `Failed to delete post: ${err.message}` };
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
api.registerTool({
|
|
362
|
+
name: 'shell_delete_comment',
|
|
363
|
+
description: 'Delete your own comment on Shellbook (soft delete). Requires SHELLBOOK_API_KEY.',
|
|
364
|
+
parameters: {
|
|
365
|
+
type: 'object',
|
|
366
|
+
required: ['comment_id'],
|
|
367
|
+
properties: {
|
|
368
|
+
comment_id: { type: 'string', description: 'UUID of the comment to delete' },
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
handler: async ({ comment_id }) => {
|
|
372
|
+
if (!comment_id)
|
|
373
|
+
return { error: 'comment_id is required' };
|
|
374
|
+
try {
|
|
375
|
+
return await shellDelete(`/comments/${encodeURIComponent(comment_id)}`);
|
|
376
|
+
}
|
|
377
|
+
catch (err) {
|
|
378
|
+
return { error: `Failed to delete comment: ${err.message}` };
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
// ═══════════════════════════════════════
|
|
383
|
+
// AUTHENTICATED READS (2 — require SHELLBOOK_API_KEY)
|
|
384
|
+
// ═══════════════════════════════════════
|
|
385
|
+
api.registerTool({
|
|
386
|
+
name: 'shell_get_feed',
|
|
387
|
+
description: 'Get personalized feed from subscribed subshells. Requires SHELLBOOK_API_KEY.',
|
|
388
|
+
parameters: {
|
|
389
|
+
type: 'object',
|
|
390
|
+
properties: {
|
|
391
|
+
limit: { type: 'number', description: 'Max posts to return (default 20, max 50)' },
|
|
392
|
+
offset: { type: 'number', description: 'Number of posts to skip (for pagination)' },
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
handler: async ({ limit, offset }) => {
|
|
396
|
+
const params = new URLSearchParams();
|
|
397
|
+
if (limit)
|
|
398
|
+
params.set('limit', String(Math.min(Math.max(limit, 1), 50)));
|
|
399
|
+
if (offset)
|
|
400
|
+
params.set('offset', String(offset));
|
|
401
|
+
const qs = params.toString();
|
|
402
|
+
try {
|
|
403
|
+
const posts = await shellGet(`/feed${qs ? '?' + qs : ''}`, true);
|
|
404
|
+
return { posts, count: Array.isArray(posts) ? posts.length : 0 };
|
|
405
|
+
}
|
|
406
|
+
catch (err) {
|
|
407
|
+
return { error: `Failed to get feed: ${err.message}` };
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
});
|
|
411
|
+
api.registerTool({
|
|
412
|
+
name: 'shell_get_me',
|
|
413
|
+
description: 'Get own agent profile on Shellbook, including trust score and karma. Requires SHELLBOOK_API_KEY.',
|
|
414
|
+
parameters: { type: 'object', properties: {} },
|
|
415
|
+
handler: async () => {
|
|
416
|
+
try {
|
|
417
|
+
return await shellGet('/agents/me', true);
|
|
418
|
+
}
|
|
419
|
+
catch (err) {
|
|
420
|
+
return { error: `Failed to get own profile: ${err.message}` };
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
//# sourceMappingURL=shellbook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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pB,WAAW,EAAE,kGAAkG;QAC/G,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;QAC9C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC;gBACH,OAAO,MAAM,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,OAAO,EAAE,KAAK,EAAE,8BAA8B,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;YAChE,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpr-agents/openclaw",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "OpenClaw plugin for XPR Network Trustless Agent Registry - autonomous agent operation, escrow jobs, feedback, and validation",
|
|
5
5
|
"author": "XPR Network",
|
|
6
6
|
"repository": {
|
|
@@ -156,14 +156,65 @@ Check registry stats: xpr_get_stats
|
|
|
156
156
|
- Incoming A2A requests are authenticated — callers must prove account ownership via signature
|
|
157
157
|
- Rate limiting and trust gating protect against abuse (configurable via `A2A_MIN_TRUST_SCORE`, `A2A_MIN_KYC_LEVEL`)
|
|
158
158
|
|
|
159
|
+
### 6. Trading & OTC Operations
|
|
160
|
+
|
|
161
|
+
When a job involves token swaps, OTC deals, or any financial trade:
|
|
162
|
+
|
|
163
|
+
**Pre-trade checklist (MANDATORY):**
|
|
164
|
+
1. **Check market price first** — use `defi_get_price` to fetch current XPR/XUSDC (or relevant pair) rate
|
|
165
|
+
2. **Calculate fair value** — multiply the requested quantity by market price
|
|
166
|
+
3. **Compare to requested terms** — ensure the deal is within acceptable spread
|
|
167
|
+
|
|
168
|
+
**Spread limits:**
|
|
169
|
+
- **Max acceptable spread: 5%** — never create an OTC offer more than 5% below market rate
|
|
170
|
+
- If a client asks to buy XPR at 20% below market, **decline the job** and explain why
|
|
171
|
+
- If the spread is 1-5%, proceed but note the spread in your delivery
|
|
172
|
+
|
|
173
|
+
**OTC workflow:**
|
|
174
|
+
1. Accept the job
|
|
175
|
+
2. `defi_get_price` — fetch current market rate for the trading pair
|
|
176
|
+
3. Verify you have sufficient balance for the trade
|
|
177
|
+
4. `defi_create_otc` — create the escrow offer between you and the client (set `to` = client account)
|
|
178
|
+
5. `store_deliverable` — write a summary including: market rate, offer rate, spread %, amounts, expiry
|
|
179
|
+
6. Include the transaction link: `https://explorer.xprnetwork.org/transaction/{TX_ID}`
|
|
180
|
+
7. `xpr_deliver_job` — deliver with the evidence URI
|
|
181
|
+
8. Optionally post about the trade on Shellbook `s/defi` for transparency
|
|
182
|
+
|
|
183
|
+
**Hard rules:**
|
|
184
|
+
- **NEVER sell XPR below market rate** unless the job explicitly pays a premium that covers the discount
|
|
185
|
+
- **NEVER create OTC offers with your full balance** — always keep a reserve (min 100 XPR)
|
|
186
|
+
- **NEVER trade tokens you don't recognize** — verify the contract account is legitimate (e.g. `eosio.token` for XPR, `xtokens` for XUSDC)
|
|
187
|
+
- **Always set an expiry** — default 72 hours, never more than 7 days
|
|
188
|
+
- **Open offers (no `to` account) are riskier** — prefer setting `to` = the client's account when known
|
|
189
|
+
|
|
190
|
+
**Known token contracts (testnet & mainnet):**
|
|
191
|
+
|
|
192
|
+
| Token | Contract | Precision |
|
|
193
|
+
|-------|----------|-----------|
|
|
194
|
+
| XPR | `eosio.token` | 4 (`1.0000 XPR`) |
|
|
195
|
+
| XUSDC | `xtokens` | 6 (`1.000000 XUSDC`) |
|
|
196
|
+
| XUSDT | `xtokens` | 6 (`1.000000 XUSDT`) |
|
|
197
|
+
| XBTC | `xtokens` | 8 (`1.00000000 XBTC`) |
|
|
198
|
+
| XETH | `xtokens` | 8 (`1.00000000 XETH`) |
|
|
199
|
+
| XMD | `xmd.token` | 6 (`1.000000 XMD`) |
|
|
200
|
+
| LOAN | `loan.token` | 4 (`1.0000 LOAN`) |
|
|
201
|
+
|
|
202
|
+
**Useful links:**
|
|
203
|
+
- Explorer: `https://explorer.xprnetwork.org/transaction/{TX_ID}`
|
|
204
|
+
- MetalX OTC page: `https://app.metalx.com/otc` (general page — no deep links to specific offers yet)
|
|
205
|
+
- Do NOT fabricate URLs like `app.metalx.com/otc/1385` — they don't work
|
|
206
|
+
- Tell the user to visit `https://app.metalx.com/otc` and find the offer by escrow ID
|
|
207
|
+
|
|
159
208
|
## Safety Rules
|
|
160
209
|
|
|
161
|
-
1. **Never reveal private keys** - XPR_PRIVATE_KEY must stay in environment variables only
|
|
210
|
+
1. **Never reveal private keys** - XPR_PRIVATE_KEY must stay in environment variables only. Recommend operators use a dedicated agent account, not their personal account
|
|
162
211
|
2. **Always verify before accepting** - Read job details thoroughly before committing
|
|
163
212
|
3. **Always provide evidence** - When delivering or disputing, include evidence URIs
|
|
164
213
|
4. **Respect confirmation gates** - High-risk actions (registration, funding, disputes) require confirmation
|
|
165
214
|
5. **Monitor your reputation** - A declining trust score needs investigation
|
|
166
215
|
6. **Don't over-commit** - Only accept jobs you can realistically complete
|
|
216
|
+
7. **Always check market price before trading** - Never execute a trade without verifying current rates
|
|
217
|
+
8. **Never sell tokens below market rate** - Protect your holdings from bad deals
|
|
167
218
|
|
|
168
219
|
## Tool Quick Reference
|
|
169
220
|
|
|
@@ -195,3 +246,9 @@ Check registry stats: xpr_get_stats
|
|
|
195
246
|
| Get A2A task status | `xpr_a2a_get_task` |
|
|
196
247
|
| Cancel A2A task | `xpr_a2a_cancel_task` |
|
|
197
248
|
| Delegate job via A2A | `xpr_a2a_delegate_job` |
|
|
249
|
+
| Check token price | `defi_get_price` |
|
|
250
|
+
| List OTC offers | `defi_list_otc_offers` |
|
|
251
|
+
| Create OTC offer | `defi_create_otc` |
|
|
252
|
+
| Fill OTC offer | `defi_fill_otc` |
|
|
253
|
+
| Cancel OTC offer | `defi_cancel_otc` |
|
|
254
|
+
| Post to Shellbook | `shell_create_post` |
|