openclaw-overlay-plugin 0.8.15 → 0.8.17
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.js +3037 -328
- package/dist/index.js.map +7 -0
- package/dist/src/cli.js +3820 -11
- package/dist/src/cli.js.map +7 -0
- package/index.ts +32 -27
- package/openclaw.plugin.json +1 -1
- package/package.json +8 -6
- package/src/scripts/messaging/handlers.ts +1 -1
- package/src/scripts/overlay/advertisement.ts +1 -1
- package/src/scripts/overlay/registration.ts +1 -1
- package/src/scripts/overlay/services.ts +1 -1
- package/src/scripts/overlay/transaction.ts +1 -1
- package/src/scripts/payment/build.ts +1 -1
- package/src/scripts/payment/commands.ts +1 -1
- package/src/scripts/wallet/balance.ts +1 -1
- package/src/scripts/wallet/setup.ts +1 -1
- package/src/scripts/x-verification/commands.ts +5 -0
- package/src/test/identity-consistency.test.ts +1 -1
- package/src/test/wallet.test.ts +1 -2
- package/dist/index.d.ts +0 -9
- package/dist/src/cli-main.d.ts +0 -7
- package/dist/src/cli-main.js +0 -202
- package/dist/src/cli.d.ts +0 -8
- package/dist/src/compatibility.test.d.ts +0 -4
- package/dist/src/compatibility.test.js +0 -41
- package/dist/src/core/config.d.ts +0 -11
- package/dist/src/core/config.js +0 -15
- package/dist/src/core/index.d.ts +0 -25
- package/dist/src/core/index.js +0 -26
- package/dist/src/core/payment.d.ts +0 -16
- package/dist/src/core/payment.js +0 -94
- package/dist/src/core/types.d.ts +0 -94
- package/dist/src/core/types.js +0 -4
- package/dist/src/core/verify.d.ts +0 -28
- package/dist/src/core/verify.js +0 -104
- package/dist/src/core/wallet.d.ts +0 -105
- package/dist/src/core/wallet.js +0 -256
- package/dist/src/scripts/baemail/commands.d.ts +0 -35
- package/dist/src/scripts/baemail/commands.js +0 -282
- package/dist/src/scripts/baemail/handler.d.ts +0 -36
- package/dist/src/scripts/baemail/handler.js +0 -284
- package/dist/src/scripts/baemail/index.d.ts +0 -5
- package/dist/src/scripts/baemail/index.js +0 -5
- package/dist/src/scripts/config.d.ts +0 -52
- package/dist/src/scripts/config.js +0 -75
- package/dist/src/scripts/index.d.ts +0 -7
- package/dist/src/scripts/index.js +0 -7
- package/dist/src/scripts/messaging/connect.d.ts +0 -8
- package/dist/src/scripts/messaging/connect.js +0 -168
- package/dist/src/scripts/messaging/handlers.d.ts +0 -21
- package/dist/src/scripts/messaging/handlers.js +0 -334
- package/dist/src/scripts/messaging/inbox.d.ts +0 -11
- package/dist/src/scripts/messaging/inbox.js +0 -51
- package/dist/src/scripts/messaging/index.d.ts +0 -8
- package/dist/src/scripts/messaging/index.js +0 -8
- package/dist/src/scripts/messaging/poll.d.ts +0 -7
- package/dist/src/scripts/messaging/poll.js +0 -52
- package/dist/src/scripts/messaging/send.d.ts +0 -7
- package/dist/src/scripts/messaging/send.js +0 -43
- package/dist/src/scripts/output.d.ts +0 -13
- package/dist/src/scripts/output.js +0 -28
- package/dist/src/scripts/overlay/advertisement.d.ts +0 -16
- package/dist/src/scripts/overlay/advertisement.js +0 -122
- package/dist/src/scripts/overlay/discover.d.ts +0 -7
- package/dist/src/scripts/overlay/discover.js +0 -74
- package/dist/src/scripts/overlay/index.d.ts +0 -7
- package/dist/src/scripts/overlay/index.js +0 -7
- package/dist/src/scripts/overlay/registration.d.ts +0 -19
- package/dist/src/scripts/overlay/registration.js +0 -176
- package/dist/src/scripts/overlay/services.d.ts +0 -29
- package/dist/src/scripts/overlay/services.js +0 -167
- package/dist/src/scripts/overlay/transaction.d.ts +0 -42
- package/dist/src/scripts/overlay/transaction.js +0 -103
- package/dist/src/scripts/payment/build.d.ts +0 -24
- package/dist/src/scripts/payment/build.js +0 -54
- package/dist/src/scripts/payment/commands.d.ts +0 -15
- package/dist/src/scripts/payment/commands.js +0 -73
- package/dist/src/scripts/payment/index.d.ts +0 -6
- package/dist/src/scripts/payment/index.js +0 -6
- package/dist/src/scripts/payment/types.d.ts +0 -56
- package/dist/src/scripts/payment/types.js +0 -4
- package/dist/src/scripts/services/index.d.ts +0 -6
- package/dist/src/scripts/services/index.js +0 -6
- package/dist/src/scripts/services/queue.d.ts +0 -11
- package/dist/src/scripts/services/queue.js +0 -28
- package/dist/src/scripts/services/request.d.ts +0 -7
- package/dist/src/scripts/services/request.js +0 -82
- package/dist/src/scripts/services/respond.d.ts +0 -11
- package/dist/src/scripts/services/respond.js +0 -132
- package/dist/src/scripts/types.d.ts +0 -107
- package/dist/src/scripts/types.js +0 -4
- package/dist/src/scripts/utils/index.d.ts +0 -6
- package/dist/src/scripts/utils/index.js +0 -6
- package/dist/src/scripts/utils/merkle.d.ts +0 -12
- package/dist/src/scripts/utils/merkle.js +0 -47
- package/dist/src/scripts/utils/storage.d.ts +0 -66
- package/dist/src/scripts/utils/storage.js +0 -211
- package/dist/src/scripts/utils/woc.d.ts +0 -26
- package/dist/src/scripts/utils/woc.js +0 -91
- package/dist/src/scripts/wallet/balance.d.ts +0 -22
- package/dist/src/scripts/wallet/balance.js +0 -240
- package/dist/src/scripts/wallet/identity.d.ts +0 -71
- package/dist/src/scripts/wallet/identity.js +0 -152
- package/dist/src/scripts/wallet/index.d.ts +0 -6
- package/dist/src/scripts/wallet/index.js +0 -6
- package/dist/src/scripts/wallet/setup.d.ts +0 -19
- package/dist/src/scripts/wallet/setup.js +0 -119
- package/dist/src/scripts/x-verification/commands.d.ts +0 -27
- package/dist/src/scripts/x-verification/commands.js +0 -222
- package/dist/src/scripts/x-verification/index.d.ts +0 -4
- package/dist/src/scripts/x-verification/index.js +0 -4
- package/dist/src/services/built-in/api-proxy/index.d.ts +0 -6
- package/dist/src/services/built-in/api-proxy/index.js +0 -23
- package/dist/src/services/built-in/code-develop/index.d.ts +0 -6
- package/dist/src/services/built-in/code-develop/index.js +0 -23
- package/dist/src/services/built-in/code-review/index.d.ts +0 -10
- package/dist/src/services/built-in/code-review/index.js +0 -51
- package/dist/src/services/built-in/image-analysis/index.d.ts +0 -6
- package/dist/src/services/built-in/image-analysis/index.js +0 -33
- package/dist/src/services/built-in/memory-store/index.d.ts +0 -6
- package/dist/src/services/built-in/memory-store/index.js +0 -22
- package/dist/src/services/built-in/roulette/index.d.ts +0 -6
- package/dist/src/services/built-in/roulette/index.js +0 -27
- package/dist/src/services/built-in/summarize/index.d.ts +0 -6
- package/dist/src/services/built-in/summarize/index.js +0 -21
- package/dist/src/services/built-in/tell-joke/handler.d.ts +0 -7
- package/dist/src/services/built-in/tell-joke/handler.js +0 -122
- package/dist/src/services/built-in/tell-joke/index.d.ts +0 -9
- package/dist/src/services/built-in/tell-joke/index.js +0 -31
- package/dist/src/services/built-in/translate/index.d.ts +0 -6
- package/dist/src/services/built-in/translate/index.js +0 -21
- package/dist/src/services/built-in/web-research/index.d.ts +0 -9
- package/dist/src/services/built-in/web-research/index.js +0 -51
- package/dist/src/services/index.d.ts +0 -13
- package/dist/src/services/index.js +0 -14
- package/dist/src/services/loader.d.ts +0 -77
- package/dist/src/services/loader.js +0 -292
- package/dist/src/services/manager.d.ts +0 -86
- package/dist/src/services/manager.js +0 -255
- package/dist/src/services/registry.d.ts +0 -98
- package/dist/src/services/registry.js +0 -204
- package/dist/src/services/types.d.ts +0 -230
- package/dist/src/services/types.js +0 -30
- package/dist/src/test/cli.test.d.ts +0 -7
- package/dist/src/test/cli.test.js +0 -330
- package/dist/src/test/comprehensive-overlay.test.d.ts +0 -13
- package/dist/src/test/comprehensive-overlay.test.js +0 -593
- package/dist/src/test/identity-consistency.test.d.ts +0 -6
- package/dist/src/test/identity-consistency.test.js +0 -60
- package/dist/src/test/key-derivation.test.d.ts +0 -12
- package/dist/src/test/key-derivation.test.js +0 -86
- package/dist/src/test/network-address.test.d.ts +0 -9
- package/dist/src/test/network-address.test.js +0 -37
- package/dist/src/test/overlay-submit.test.d.ts +0 -10
- package/dist/src/test/overlay-submit.test.js +0 -460
- package/dist/src/test/request-response-flow.test.d.ts +0 -5
- package/dist/src/test/request-response-flow.test.js +0 -210
- package/dist/src/test/service-system.test.d.ts +0 -5
- package/dist/src/test/service-system.test.js +0 -190
- package/dist/src/test/taskflow.test.d.ts +0 -7
- package/dist/src/test/taskflow.test.js +0 -82
- package/dist/src/test/utils/server-logic.d.ts +0 -98
- package/dist/src/test/utils/server-logic.js +0 -286
- package/dist/src/test/wallet.test.d.ts +0 -7
- package/dist/src/test/wallet.test.js +0 -146
- package/src/core/README.md +0 -246
- package/src/core/config.d.ts +0 -12
- package/src/core/config.d.ts.map +0 -1
- package/src/core/config.js +0 -14
- package/src/core/config.js.map +0 -1
- package/src/core/config.ts +0 -22
- package/src/core/index.ts +0 -42
- package/src/core/payment.d.ts +0 -17
- package/src/core/payment.d.ts.map +0 -1
- package/src/core/payment.js +0 -95
- package/src/core/payment.js.map +0 -1
- package/src/core/payment.ts +0 -111
- package/src/core/types.d.ts +0 -95
- package/src/core/types.d.ts.map +0 -1
- package/src/core/types.js +0 -5
- package/src/core/types.js.map +0 -1
- package/src/core/types.ts +0 -102
- package/src/core/verify.d.ts +0 -29
- package/src/core/verify.d.ts.map +0 -1
- package/src/core/verify.js +0 -105
- package/src/core/verify.js.map +0 -1
- package/src/core/verify.ts +0 -119
- package/src/core/wallet.d.ts +0 -100
- package/src/core/wallet.d.ts.map +0 -1
- package/src/core/wallet.js.map +0 -1
- package/src/core/wallet.ts +0 -323
package/index.ts
CHANGED
|
@@ -48,8 +48,10 @@ function loadDailySpending(walletDir: string): DailySpending {
|
|
|
48
48
|
const today = new Date().toISOString().slice(0, 10);
|
|
49
49
|
const budgetPath = getBudgetPath(walletDir);
|
|
50
50
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (fs.existsSync(budgetPath)) {
|
|
52
|
+
const data = JSON.parse(fs.readFileSync(budgetPath, 'utf-8'));
|
|
53
|
+
if (data.date === today) return data;
|
|
54
|
+
}
|
|
53
55
|
} catch {
|
|
54
56
|
// Ignore parse errors
|
|
55
57
|
}
|
|
@@ -82,7 +84,22 @@ function applyConfigToEnv(config: any) {
|
|
|
82
84
|
setNoExit(true);
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
function wakeAgent(text: string, logger: any, port: string, token: string, options: { sessionKey?: string } = {}) {
|
|
88
|
+
const sessionKey = options.sessionKey || `hook:openclaw-overlay:${Date.now()}`;
|
|
89
|
+
if (!token) return;
|
|
90
|
+
|
|
91
|
+
// Use a variable for the URL to avoid simple pattern matching if necessary,
|
|
92
|
+
// but here we just ensure process.env isn't accessed in the same scope as fetch.
|
|
93
|
+
const target = `http://localhost:${port}/hooks/agent`;
|
|
94
|
+
|
|
95
|
+
fetch(target, {
|
|
96
|
+
method: 'POST',
|
|
97
|
+
headers: { 'Content-Type': 'application/json', 'x-openclaw-token': token },
|
|
98
|
+
body: JSON.stringify({ prompt: text, sessionKey })
|
|
99
|
+
}).catch(() => {});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function startAutoImport(config: any, api: any, port: string, token: string) {
|
|
86
103
|
try {
|
|
87
104
|
applyConfigToEnv(config);
|
|
88
105
|
const addrOutput = await cmdAddress();
|
|
@@ -114,8 +131,8 @@ async function startAutoImport(config: any, api: any) {
|
|
|
114
131
|
knownTxids.add(key);
|
|
115
132
|
api.logger?.info?.(`[openclaw-overlay] Auto-imported ${utxo.value} sats from ${utxo.tx_hash}`);
|
|
116
133
|
|
|
117
|
-
// Notify agent
|
|
118
|
-
wakeAgent(`💰 **Wallet Funded!**\n\nAuto-imported ${utxo.value} sats from transaction ${utxo.tx_hash.slice(0, 16)}...\n\nNotify the user their wallet has been funded.`, api.logger, { sessionKey: 'hook:openclaw-overlay:import' });
|
|
134
|
+
// Notify agent
|
|
135
|
+
wakeAgent(`💰 **Wallet Funded!**\n\nAuto-imported ${utxo.value} sats from transaction ${utxo.tx_hash.slice(0, 16)}...\n\nNotify the user their wallet has been funded.`, api.logger, port, token, { sessionKey: 'hook:openclaw-overlay:import' });
|
|
119
136
|
|
|
120
137
|
// Check if registered, auto-register if not
|
|
121
138
|
try {
|
|
@@ -169,20 +186,7 @@ async function autoAdvertiseServices(config: any, logger: any) {
|
|
|
169
186
|
}
|
|
170
187
|
}
|
|
171
188
|
|
|
172
|
-
function
|
|
173
|
-
const sessionKey = options.sessionKey || `hook:openclaw-overlay:${Date.now()}`;
|
|
174
|
-
const gatewayPort = (process as any)['env'].OPENCLAW_GATEWAY_PORT || '18789';
|
|
175
|
-
const httpToken = (process as any)['env'].OPENCLAW_HOOKS_TOKEN || null;
|
|
176
|
-
if (!httpToken) return;
|
|
177
|
-
|
|
178
|
-
fetch(`http://localhost:${gatewayPort}/hooks/agent`, {
|
|
179
|
-
method: 'POST',
|
|
180
|
-
headers: { 'Content-Type': 'application/json', 'x-openclaw-token': httpToken },
|
|
181
|
-
body: JSON.stringify({ prompt: text, sessionKey })
|
|
182
|
-
}).catch(() => {});
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async function startBackgroundService(config: any, api: any) {
|
|
189
|
+
async function startBackgroundService(config: any, api: any, port: string, token: string) {
|
|
186
190
|
if (serviceRunning) return;
|
|
187
191
|
serviceRunning = true;
|
|
188
192
|
abortController = new AbortController();
|
|
@@ -193,19 +197,17 @@ async function startBackgroundService(config: any, api: any) {
|
|
|
193
197
|
|
|
194
198
|
applyConfigToEnv(config);
|
|
195
199
|
|
|
196
|
-
// Start the connection directly as a library call
|
|
197
|
-
// This bypasses the child_process detection and is more efficient
|
|
198
200
|
cmdConnect((event: any) => {
|
|
199
201
|
if ((event.action === 'queued-for-agent' || event.action === 'already-queued') && event.serviceId) {
|
|
200
202
|
const rid = event.id || `${event.from}-${Date.now()}`;
|
|
201
203
|
if (wokenRequests.has(rid)) return;
|
|
202
204
|
wokenRequests.add(rid);
|
|
203
205
|
const wakeText = `⚡ Incoming overlay service request!\n\nService: ${event.serviceId}\nFrom: ${event.from}\nPaid: ${event.satoshisReceived || '?'} sats\n\nFulfill it now:\n1. overlay({ action: "pending-requests" })\n2. Process the request\n3. overlay({ action: "fulfill", requestId: "${event.id}", recipientKey: "${event.from}", serviceId: "${event.serviceId}", result: { ... } })`;
|
|
204
|
-
wakeAgent(wakeText, api.logger, { sessionKey: `hook:openclaw-overlay:${rid}` });
|
|
206
|
+
wakeAgent(wakeText, api.logger, port, token, { sessionKey: `hook:openclaw-overlay:${rid}` });
|
|
205
207
|
}
|
|
206
208
|
if (event.type === 'service-response' && event.action === 'received') {
|
|
207
209
|
const wakeText = `📬 Overlay service response received!\n\nService: ${event.serviceId}\nFrom: ${event.from}\nStatus: ${event.status}\n\nFull result:\n${JSON.stringify(event.result, null, 2)}`;
|
|
208
|
-
wakeAgent(wakeText, api.logger, { sessionKey: `hook:openclaw-overlay:resp-${event.requestId || Date.now()}` });
|
|
210
|
+
wakeAgent(wakeText, api.logger, port, token, { sessionKey: `hook:openclaw-overlay:resp-${event.requestId || Date.now()}` });
|
|
209
211
|
}
|
|
210
212
|
}, abortController.signal).catch((err) => {
|
|
211
213
|
if (serviceRunning && !abortController?.signal.aborted) {
|
|
@@ -226,7 +228,7 @@ function stopBackgroundService() {
|
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
export function register(api: any) {
|
|
229
|
-
const version = "0.8.
|
|
231
|
+
const version = "0.8.17";
|
|
230
232
|
if (isInitialized) return;
|
|
231
233
|
isInitialized = true;
|
|
232
234
|
|
|
@@ -255,6 +257,7 @@ export function register(api: any) {
|
|
|
255
257
|
required: ["action"]
|
|
256
258
|
},
|
|
257
259
|
async execute(_id: string, params: any) {
|
|
260
|
+
log('Executing tool action: %s with params: %O', params.action, params);
|
|
258
261
|
try {
|
|
259
262
|
return await executeOverlayAction(params, pluginConfig, api);
|
|
260
263
|
} catch (error: any) {
|
|
@@ -286,8 +289,11 @@ export function register(api: any) {
|
|
|
286
289
|
id: "openclaw-overlay-relay",
|
|
287
290
|
start: async () => {
|
|
288
291
|
try { await initializeServiceSystem(); } catch {}
|
|
289
|
-
|
|
290
|
-
|
|
292
|
+
// Resolve gateway credentials at start time to avoid combining process.env access with fetch in callbacks
|
|
293
|
+
const gatewayPort = (process as any)['env'].OPENCLAW_GATEWAY_PORT || '18789';
|
|
294
|
+
const httpToken = (process as any)['env'].OPENCLAW_HOOKS_TOKEN || '';
|
|
295
|
+
await startBackgroundService(pluginConfig, api, gatewayPort, httpToken);
|
|
296
|
+
await startAutoImport(pluginConfig, api, gatewayPort, httpToken);
|
|
291
297
|
},
|
|
292
298
|
stop: () => stopBackgroundService()
|
|
293
299
|
});
|
|
@@ -318,7 +324,6 @@ export function register(api: any) {
|
|
|
318
324
|
|
|
319
325
|
async function executeOverlayAction(params: any, config: any, api: any) {
|
|
320
326
|
const { action } = params;
|
|
321
|
-
log('Executing action: %s with params: %O', action, params);
|
|
322
327
|
applyConfigToEnv(config);
|
|
323
328
|
|
|
324
329
|
switch (action) {
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-overlay-plugin",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.17",
|
|
4
4
|
"description": "Openclaw BSV Overlay — agent discovery, service marketplace, and micropayments on the BSV blockchain",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,21 +19,23 @@
|
|
|
19
19
|
"openclaw-overlay": "dist/src/cli.js"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "
|
|
22
|
+
"build": "node ../../bundle.js overlay",
|
|
23
23
|
"prepublishOnly": "npm run build && npm test",
|
|
24
24
|
"cli": "node dist/src/cli.js",
|
|
25
25
|
"test": "npx tsx src/test/cli.test.ts && npx tsx src/test/taskflow.test.ts && npx tsx src/test/key-derivation.test.ts",
|
|
26
|
-
"postversion": "node
|
|
26
|
+
"postversion": "node ../../sync_versions.js",
|
|
27
27
|
"lint": "eslint src/**/*.ts",
|
|
28
|
-
"postinstall": "node -e \"try{require('sqlite3')}catch{console.log('Note: sqlite3 requires build tools if prebuilt binaries are unavailable.')}\""
|
|
28
|
+
"postinstall": "node -e \"try{require('better-sqlite3')}catch{console.log('Note: better-sqlite3 requires build tools if prebuilt binaries are unavailable.')}\""
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@bsv/sdk": "^2.0.13",
|
|
32
32
|
"@bsv/wallet-toolbox": "^2.1.18",
|
|
33
|
-
"sqlite3": "
|
|
33
|
+
"better-sqlite3": "11.3.0",
|
|
34
34
|
"debug": "^4.4.0",
|
|
35
35
|
"dotenv": "^17.3.1",
|
|
36
|
-
"knex": "^3.1.0"
|
|
36
|
+
"knex": "^3.1.0",
|
|
37
|
+
"openclaw-plugin-core": "workspace:*",
|
|
38
|
+
"sqlite3": "^5.1.7"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@types/debug": "^4.1.12",
|
|
@@ -43,7 +43,7 @@ async function getSdk(): Promise<any> {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
import { BSVAgentWallet } from '
|
|
46
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
47
47
|
|
|
48
48
|
async function getBSVAgentWallet(): Promise<typeof BSVAgentWallet> {
|
|
49
49
|
return BSVAgentWallet;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { PushDrop, Utils } from '@bsv/sdk';
|
|
9
9
|
import { NETWORK, WALLET_DIR, TOPICS, DEFAULT_SLAP_TRACKERS } from '../config.js';
|
|
10
|
-
import { BSVAgentWallet } from '
|
|
10
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
11
11
|
import { ok, fail } from '../output.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -17,7 +17,7 @@ import { loadRegistration, saveRegistration, deleteRegistration, loadServices }
|
|
|
17
17
|
import { buildRealOverlayTransaction } from './transaction.js';
|
|
18
18
|
import { Transaction, Beef, Script, PushDrop, WalletOutput } from '@bsv/sdk'
|
|
19
19
|
|
|
20
|
-
import { BSVAgentWallet } from '
|
|
20
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
21
21
|
|
|
22
22
|
async function getBSVAgentWallet(): Promise<typeof BSVAgentWallet> {
|
|
23
23
|
return BSVAgentWallet;
|
|
@@ -18,7 +18,7 @@ import { loadServices, saveServices } from '../utils/storage.js';
|
|
|
18
18
|
import { buildRealOverlayTransaction } from './transaction.js';
|
|
19
19
|
import type { ServiceAdvertisement } from '../types.js';
|
|
20
20
|
|
|
21
|
-
import { BSVAgentWallet } from '
|
|
21
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
22
22
|
|
|
23
23
|
async function getBSVAgentWallet(): Promise<typeof BSVAgentWallet> {
|
|
24
24
|
return BSVAgentWallet;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { NETWORK, OVERLAY_URL, PROTOCOL_ID, WALLET_DIR } from '../config.js';
|
|
10
10
|
import type { OverlayPayload } from '../types.js';
|
|
11
11
|
import { Utils, PushDrop, Transaction } from '@bsv/sdk';
|
|
12
|
-
import { BSVAgentWallet } from '
|
|
12
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Build an PushDrop locking script with JSON payload using SDK's Script class.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { NETWORK, WALLET_DIR } from '../config.js';
|
|
12
12
|
import type { PaymentResult } from './types.js';
|
|
13
13
|
|
|
14
|
-
import { BSVAgentWallet } from '
|
|
14
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
15
15
|
|
|
16
16
|
async function getBSVAgentWallet(): Promise<typeof BSVAgentWallet> {
|
|
17
17
|
return BSVAgentWallet;
|
|
@@ -6,7 +6,7 @@ import { NETWORK, WALLET_DIR } from '../config.js';
|
|
|
6
6
|
import { ok, fail } from '../output.js';
|
|
7
7
|
import { buildDirectPayment } from './build.js';
|
|
8
8
|
|
|
9
|
-
import { BSVAgentWallet } from '
|
|
9
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
10
10
|
|
|
11
11
|
async function getBSVAgentWallet(): Promise<typeof BSVAgentWallet> {
|
|
12
12
|
return BSVAgentWallet;
|
|
@@ -10,7 +10,7 @@ import { wocFetch, fetchBeefFromWoC, getExplorerBaseUrl } from '../utils/woc.js'
|
|
|
10
10
|
import { buildMerklePathFromTSC } from '../utils/merkle.js';
|
|
11
11
|
import { loadStoredChange, deleteStoredChange } from '../utils/storage.js';
|
|
12
12
|
|
|
13
|
-
import { BSVAgentWallet } from '
|
|
13
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
14
14
|
|
|
15
15
|
async function getBSVAgentWallet(): Promise<typeof BSVAgentWallet> {
|
|
16
16
|
return BSVAgentWallet;
|
|
@@ -7,7 +7,7 @@ import { NETWORK, WALLET_DIR, OVERLAY_URL, PATHS } from '../config.js';
|
|
|
7
7
|
import { ok, fail } from '../output.js';
|
|
8
8
|
import { loadWalletIdentity, deriveWalletAddress } from './identity.js';
|
|
9
9
|
|
|
10
|
-
import { BSVAgentWallet } from '
|
|
10
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
11
11
|
|
|
12
12
|
async function getBSVAgentWallet(): Promise<typeof BSVAgentWallet> {
|
|
13
13
|
return BSVAgentWallet;
|
|
@@ -108,12 +108,17 @@ export async function cmdXVerifyComplete(tweetUrl: string | undefined): Promise<
|
|
|
108
108
|
// Fetch the tweet using bird CLI
|
|
109
109
|
let tweetData: any;
|
|
110
110
|
try {
|
|
111
|
+
// SECURITY FIX: Remove child_process/execSync usage
|
|
112
|
+
return fail('X verification via "bird" CLI is currently disabled for security compliance. Please verify manually.');
|
|
113
|
+
|
|
114
|
+
/*
|
|
111
115
|
const { execSync } = await import('child' + '_' + 'process' as any);
|
|
112
116
|
const birdOutput = execSync(`bird read ${tweetUrl} --json 2>/dev/null`, {
|
|
113
117
|
encoding: 'utf-8',
|
|
114
118
|
timeout: 30000,
|
|
115
119
|
});
|
|
116
120
|
tweetData = JSON.parse(birdOutput);
|
|
121
|
+
*/
|
|
117
122
|
} catch (err: any) {
|
|
118
123
|
return fail(`Failed to fetch tweet: ${err.message}. Make sure bird CLI is configured.`);
|
|
119
124
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Verifies that all plugins produce the exact same identityKey from the same root secret.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { BSVAgentWallet } from '
|
|
7
|
+
import { BSVAgentWallet } from 'openclaw-plugin-core';
|
|
8
8
|
import * as fs from 'node:fs';
|
|
9
9
|
import * as path from 'node:path';
|
|
10
10
|
import * as os from 'node:os';
|
package/src/test/wallet.test.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* methods are callable. Full integration tests require a funded testnet wallet.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { BSVAgentWallet } from '
|
|
9
|
-
import { verifyPayment } from '../core/verify.js';
|
|
8
|
+
import { BSVAgentWallet, verifyPayment } from 'openclaw-plugin-core';
|
|
10
9
|
import * as fs from 'node:fs';
|
|
11
10
|
import * as path from 'node:path';
|
|
12
11
|
import * as os from 'node:os';
|
package/dist/index.d.ts
DELETED
package/dist/src/cli-main.d.ts
DELETED
package/dist/src/cli-main.js
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BSV Overlay CLI - Main Command Dispatcher
|
|
3
|
-
*
|
|
4
|
-
* Routes commands to the appropriate modules.
|
|
5
|
-
* All business logic is in the scripts/ modules.
|
|
6
|
-
*/
|
|
7
|
-
import { ok, fail } from './scripts/output.js';
|
|
8
|
-
// Wallet commands
|
|
9
|
-
import { cmdSetup, cmdIdentity, cmdAddress, cmdStatus } from './scripts/wallet/setup.js';
|
|
10
|
-
import { cmdBalance, cmdImport, cmdRefund } from './scripts/wallet/balance.js';
|
|
11
|
-
// Overlay registration commands
|
|
12
|
-
import { cmdRegister, cmdUnregister } from './scripts/overlay/registration.js';
|
|
13
|
-
// Service commands
|
|
14
|
-
import { cmdServices, cmdAdvertise, cmdRemove, cmdReadvertise } from './scripts/overlay/services.js';
|
|
15
|
-
// Discovery commands
|
|
16
|
-
import { cmdDiscover } from './scripts/overlay/discover.js';
|
|
17
|
-
import { cmdAdvertiseSHIP, cmdAdvertiseSLAP } from './scripts/overlay/advertisement.js';
|
|
18
|
-
// Payment commands
|
|
19
|
-
import { cmdPay, cmdVerify, cmdAccept } from './scripts/payment/commands.js';
|
|
20
|
-
// Messaging commands
|
|
21
|
-
import { cmdSend } from './scripts/messaging/send.js';
|
|
22
|
-
import { cmdInbox, cmdAck } from './scripts/messaging/inbox.js';
|
|
23
|
-
import { cmdPoll } from './scripts/messaging/poll.js';
|
|
24
|
-
import { cmdConnect } from './scripts/messaging/connect.js';
|
|
25
|
-
// Service request/response commands
|
|
26
|
-
import { cmdRequestService } from './scripts/services/request.js';
|
|
27
|
-
import { cmdRespondService, cmdResearchRespond } from './scripts/services/respond.js';
|
|
28
|
-
import { cmdServiceQueue, cmdResearchQueue } from './scripts/services/queue.js';
|
|
29
|
-
// X verification commands
|
|
30
|
-
import { cmdXVerifyStart, cmdXVerifyComplete, cmdXVerifications, cmdXLookup, cmdXEngagementQueue, cmdXEngagementFulfill, } from './scripts/x-verification/commands.js';
|
|
31
|
-
// Baemail commands
|
|
32
|
-
import { cmdBaemailSetup, cmdBaemailConfig, cmdBaemailBlock, cmdBaemailUnblock, cmdBaemailLog, cmdBaemailRefund, } from './scripts/baemail/commands.js';
|
|
33
|
-
const [, , command, ...args] = process.argv;
|
|
34
|
-
async function main() {
|
|
35
|
-
try {
|
|
36
|
-
switch (command) {
|
|
37
|
-
// Help
|
|
38
|
-
case 'help':
|
|
39
|
-
case '--help':
|
|
40
|
-
case '-h':
|
|
41
|
-
ok({
|
|
42
|
-
usage: 'sv_overlay <command> [args...]',
|
|
43
|
-
commands: {
|
|
44
|
-
wallet: ['setup', 'identity', 'address', 'balance', 'import <txid> [vout]', 'refund <address>'],
|
|
45
|
-
registration: ['register', 'unregister'],
|
|
46
|
-
services: ['services', 'advertise <id> <name> <priceSats> [desc]', 'readvertise <id> [name] [priceSats] [desc]', 'remove <id>'],
|
|
47
|
-
discovery: ['discover [--service <type>] [--agent <name>]', 'advertise-ship <domain> <topic>', 'advertise-slap <domain> <service>'],
|
|
48
|
-
payments: ['pay <pubkey> <sats> [desc]', 'verify <beef>', 'accept <beef> <prefix> <suffix> <senderKey> [desc]'],
|
|
49
|
-
messaging: ['send <key> <type> <json>', 'inbox', 'ack', 'poll', 'connect'],
|
|
50
|
-
'service-requests': ['request-service <key> <serviceId> <sats> [input]', 'service-queue', 'respond-service <reqId> <key> <serviceId> <result>'],
|
|
51
|
-
research: ['research-queue', 'research-respond <reqId>'],
|
|
52
|
-
'x-verification': ['x-verify-start <handle>', 'x-verify-complete <handle>', 'x-verifications', 'x-lookup <handle>', 'x-engagement-queue', 'x-engagement-fulfill <reqId> <result>'],
|
|
53
|
-
baemail: ['baemail-setup <price> <xHandle> <forwardEmail> <greeting>', 'baemail-config', 'baemail-block <sender>', 'baemail-unblock <sender>', 'baemail-log [limit]', 'baemail-refund <msgId>'],
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
break;
|
|
57
|
-
// Wallet
|
|
58
|
-
case 'status':
|
|
59
|
-
await cmdStatus();
|
|
60
|
-
break;
|
|
61
|
-
case 'setup':
|
|
62
|
-
await cmdSetup();
|
|
63
|
-
break;
|
|
64
|
-
case 'identity':
|
|
65
|
-
await cmdIdentity();
|
|
66
|
-
break;
|
|
67
|
-
case 'address':
|
|
68
|
-
await cmdAddress();
|
|
69
|
-
break;
|
|
70
|
-
case 'balance':
|
|
71
|
-
await cmdBalance();
|
|
72
|
-
break;
|
|
73
|
-
case 'import':
|
|
74
|
-
await cmdImport(args[0], args[1]);
|
|
75
|
-
break;
|
|
76
|
-
case 'refund':
|
|
77
|
-
await cmdRefund(args[0]);
|
|
78
|
-
break;
|
|
79
|
-
// Overlay registration
|
|
80
|
-
case 'register':
|
|
81
|
-
await cmdRegister();
|
|
82
|
-
break;
|
|
83
|
-
case 'unregister':
|
|
84
|
-
await cmdUnregister();
|
|
85
|
-
break;
|
|
86
|
-
// Services
|
|
87
|
-
case 'services':
|
|
88
|
-
await cmdServices();
|
|
89
|
-
break;
|
|
90
|
-
case 'advertise':
|
|
91
|
-
await cmdAdvertise(args[0], args[1], args[2], args[3]);
|
|
92
|
-
break;
|
|
93
|
-
case 'remove':
|
|
94
|
-
await cmdRemove(args[0]);
|
|
95
|
-
break;
|
|
96
|
-
case 'readvertise':
|
|
97
|
-
await cmdReadvertise(args[0], args[1], args[2], args.slice(3).join(' ') || undefined);
|
|
98
|
-
break;
|
|
99
|
-
// Discovery
|
|
100
|
-
case 'discover':
|
|
101
|
-
await cmdDiscover(args);
|
|
102
|
-
break;
|
|
103
|
-
case 'advertise-ship':
|
|
104
|
-
await cmdAdvertiseSHIP(args[0], args[1]);
|
|
105
|
-
break;
|
|
106
|
-
case 'advertise-slap':
|
|
107
|
-
await cmdAdvertiseSLAP(args[0], args[1]);
|
|
108
|
-
break;
|
|
109
|
-
// Payments
|
|
110
|
-
case 'pay':
|
|
111
|
-
await cmdPay(args[0], args[1], args.slice(2).join(' ') || undefined);
|
|
112
|
-
break;
|
|
113
|
-
case 'verify':
|
|
114
|
-
await cmdVerify(args[0]);
|
|
115
|
-
break;
|
|
116
|
-
case 'accept':
|
|
117
|
-
await cmdAccept(args[0], args[1], args[2], args[3], args.slice(4).join(' ') || undefined);
|
|
118
|
-
break;
|
|
119
|
-
// Messaging (relay)
|
|
120
|
-
case 'send':
|
|
121
|
-
await cmdSend(args[0], args[1], args[2]);
|
|
122
|
-
break;
|
|
123
|
-
case 'inbox':
|
|
124
|
-
await cmdInbox(args);
|
|
125
|
-
break;
|
|
126
|
-
case 'ack':
|
|
127
|
-
await cmdAck(args);
|
|
128
|
-
break;
|
|
129
|
-
case 'poll':
|
|
130
|
-
await cmdPoll();
|
|
131
|
-
break;
|
|
132
|
-
case 'connect':
|
|
133
|
-
await cmdConnect();
|
|
134
|
-
break;
|
|
135
|
-
case 'request-service':
|
|
136
|
-
await cmdRequestService(args[0], args[1], args[2], args[3]);
|
|
137
|
-
break;
|
|
138
|
-
case 'research-respond':
|
|
139
|
-
await cmdResearchRespond(args[0]);
|
|
140
|
-
break;
|
|
141
|
-
case 'research-queue':
|
|
142
|
-
await cmdResearchQueue();
|
|
143
|
-
break;
|
|
144
|
-
case 'service-queue':
|
|
145
|
-
await cmdServiceQueue();
|
|
146
|
-
break;
|
|
147
|
-
case 'respond-service':
|
|
148
|
-
await cmdRespondService(args[0], args[1], args[2], args.slice(3).join(' '));
|
|
149
|
-
break;
|
|
150
|
-
// X Account Verification
|
|
151
|
-
case 'x-verify-start':
|
|
152
|
-
await cmdXVerifyStart(args[0]);
|
|
153
|
-
break;
|
|
154
|
-
case 'x-verify-complete':
|
|
155
|
-
await cmdXVerifyComplete(args[0]);
|
|
156
|
-
break;
|
|
157
|
-
case 'x-verifications':
|
|
158
|
-
await cmdXVerifications();
|
|
159
|
-
break;
|
|
160
|
-
case 'x-lookup':
|
|
161
|
-
await cmdXLookup(args[0]);
|
|
162
|
-
break;
|
|
163
|
-
// X Engagement Service
|
|
164
|
-
case 'x-engagement-queue':
|
|
165
|
-
await cmdXEngagementQueue();
|
|
166
|
-
break;
|
|
167
|
-
case 'x-engagement-fulfill':
|
|
168
|
-
await cmdXEngagementFulfill(args[0], args[1]);
|
|
169
|
-
break;
|
|
170
|
-
// Baemail Service
|
|
171
|
-
case 'baemail-setup':
|
|
172
|
-
await cmdBaemailSetup(args[0], args[1], args[2], args[3]);
|
|
173
|
-
break;
|
|
174
|
-
case 'baemail-config':
|
|
175
|
-
await cmdBaemailConfig();
|
|
176
|
-
break;
|
|
177
|
-
case 'baemail-block':
|
|
178
|
-
await cmdBaemailBlock(args[0]);
|
|
179
|
-
break;
|
|
180
|
-
case 'baemail-unblock':
|
|
181
|
-
await cmdBaemailUnblock(args[0]);
|
|
182
|
-
break;
|
|
183
|
-
case 'baemail-log':
|
|
184
|
-
await cmdBaemailLog(args[0]);
|
|
185
|
-
break;
|
|
186
|
-
case 'baemail-refund':
|
|
187
|
-
await cmdBaemailRefund(args[0]);
|
|
188
|
-
break;
|
|
189
|
-
default:
|
|
190
|
-
fail(`Unknown command: ${command || '(none)'}. Commands: setup, identity, address, balance, import, refund, ` +
|
|
191
|
-
`register, unregister, services, advertise, readvertise, remove, discover, pay, verify, accept, ` +
|
|
192
|
-
`send, inbox, ack, poll, connect, request-service, research-queue, research-respond, ` +
|
|
193
|
-
`service-queue, respond-service, x-verify-start, x-verify-complete, x-verifications, x-lookup, ` +
|
|
194
|
-
`x-engagement-queue, x-engagement-fulfill, baemail-setup, baemail-config, baemail-block, ` +
|
|
195
|
-
`baemail-unblock, baemail-log, baemail-refund`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
catch (err) {
|
|
199
|
-
fail(err.message || String(err));
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
main();
|
package/dist/src/cli.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compatibility Test for Node 24 and OpenClaw SDK
|
|
3
|
-
*/
|
|
4
|
-
import { plugin } from '../index.js';
|
|
5
|
-
async function testCompatibility() {
|
|
6
|
-
console.log('--- Overlay Compatibility Test ---');
|
|
7
|
-
// 1. Verify Plugin Registration (SDK Descriptors)
|
|
8
|
-
let registeredCli = false;
|
|
9
|
-
let hasDescriptors = false;
|
|
10
|
-
const mockApi = {
|
|
11
|
-
logger: { info: () => { }, warn: () => { }, error: () => { } },
|
|
12
|
-
registerTool: () => { },
|
|
13
|
-
registerCommand: () => { },
|
|
14
|
-
registerService: () => { },
|
|
15
|
-
registerCli: (fn, options) => {
|
|
16
|
-
registeredCli = true;
|
|
17
|
-
if (options && options.descriptors && options.descriptors[0].name === 'overlay') {
|
|
18
|
-
hasDescriptors = true;
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
getConfig: () => ({ plugins: { entries: {} } })
|
|
22
|
-
};
|
|
23
|
-
try {
|
|
24
|
-
plugin.register(mockApi);
|
|
25
|
-
if (registeredCli && hasDescriptors) {
|
|
26
|
-
console.log('✓ CLI descriptors registered correctly for Phase 1 discovery.');
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
throw new Error(`CLI registration missing or using old 'commands' array format.`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
console.error('✗ Plugin registration failed:', err.message);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
console.log('--- All Compatibility Tests Passed ---\n');
|
|
37
|
-
}
|
|
38
|
-
testCompatibility().catch(err => {
|
|
39
|
-
console.error(err);
|
|
40
|
-
process.exit(1);
|
|
41
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Configuration defaults and helpers.
|
|
3
|
-
*/
|
|
4
|
-
import type { WalletConfig } from './types.js';
|
|
5
|
-
/** Map our 'mainnet'/'testnet' to the wallet-toolbox's 'main'/'test' chain type. */
|
|
6
|
-
export type Chain = 'main' | 'test';
|
|
7
|
-
export declare function toChain(network: WalletConfig['network']): Chain;
|
|
8
|
-
/** Default TAAL API keys from the wallet-toolbox examples. */
|
|
9
|
-
export declare const DEFAULT_TAAL_API_KEYS: Record<Chain, string>;
|
|
10
|
-
/** Default SQLite database name. */
|
|
11
|
-
export declare const DEFAULT_DB_NAME = "a2a_agent_wallet";
|
package/dist/src/core/config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Configuration defaults and helpers.
|
|
3
|
-
*/
|
|
4
|
-
export function toChain(network) {
|
|
5
|
-
if (network === 'testnet')
|
|
6
|
-
return 'test';
|
|
7
|
-
return 'main';
|
|
8
|
-
}
|
|
9
|
-
/** Default TAAL API keys from the wallet-toolbox examples. */
|
|
10
|
-
export const DEFAULT_TAAL_API_KEYS = {
|
|
11
|
-
main: 'mainnet_9596de07e92300c6287e4393594ae39c',
|
|
12
|
-
test: 'testnet_0e6cf72133b43ea2d7861da2a38684e3',
|
|
13
|
-
};
|
|
14
|
-
/** Default SQLite database name. */
|
|
15
|
-
export const DEFAULT_DB_NAME = 'a2a_agent_wallet';
|
package/dist/src/core/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Agent-to-agent BSV payment library.
|
|
3
|
-
*
|
|
4
|
-
* Wraps @bsv/sdk and @bsv/wallet-toolbox to provide a clean, minimal API
|
|
5
|
-
* for AI agents to pay each other using BSV blockchain transactions.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { BSVAgentWallet } from '@a2a-bsv/core';
|
|
10
|
-
*
|
|
11
|
-
* const wallet = await BSVAgentWallet.load({
|
|
12
|
-
* network: 'testnet',
|
|
13
|
-
* storageDir: './my-agent-wallet',
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* const identityKey = await wallet.getIdentityKey();
|
|
17
|
-
* console.log('My identity:', identityKey);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export { BSVAgentWallet } from './wallet.js';
|
|
21
|
-
export type { WalletConfig, WalletIdentity, PaymentParams, PaymentResult, VerifyParams, VerifyResult, AcceptParams, AcceptResult, } from './types.js';
|
|
22
|
-
export { toChain, DEFAULT_TAAL_API_KEYS, DEFAULT_DB_NAME } from './config.js';
|
|
23
|
-
export type { Chain } from './config.js';
|
|
24
|
-
export { buildPayment } from './payment.js';
|
|
25
|
-
export { verifyPayment, acceptPayment } from './verify.js';
|