openclaw-overlay-plugin 0.8.15 → 0.8.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.js +6705 -326
- package/dist/index.js.map +7 -0
- package/dist/src/cli.js +7498 -11
- package/dist/src/cli.js.map +7 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -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/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/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.16",
|
|
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,21 @@
|
|
|
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
28
|
"postinstall": "node -e \"try{require('sqlite3')}catch{console.log('Note: 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
|
+
"knex": "^3.1.0",
|
|
34
|
+
"openclaw-plugin-core": "workspace:*",
|
|
33
35
|
"sqlite3": "^5.1.7",
|
|
34
|
-
"debug": "^4.4.0"
|
|
35
|
-
"dotenv": "^17.3.1",
|
|
36
|
-
"knex": "^3.1.0"
|
|
36
|
+
"debug": "^4.4.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@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;
|
|
@@ -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';
|
package/dist/src/core/index.js
DELETED
|
@@ -1,26 +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
|
-
// Main wallet class
|
|
21
|
-
export { BSVAgentWallet } from './wallet.js';
|
|
22
|
-
// Config helpers (for advanced use)
|
|
23
|
-
export { toChain, DEFAULT_TAAL_API_KEYS, DEFAULT_DB_NAME } from './config.js';
|
|
24
|
-
// Lower-level helpers (for advanced use)
|
|
25
|
-
export { buildPayment } from './payment.js';
|
|
26
|
-
export { verifyPayment, acceptPayment } from './verify.js';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Payment construction helpers.
|
|
3
|
-
*
|
|
4
|
-
* Uses BRC-29 key derivation so the recipient can internalize the payment
|
|
5
|
-
* without ever reusing an address.
|
|
6
|
-
*/
|
|
7
|
-
import type { SetupWallet } from '@bsv/wallet-toolbox';
|
|
8
|
-
import type { PaymentParams, PaymentResult } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Build a BRC-29 payment transaction using the wallet's createAction API.
|
|
11
|
-
*
|
|
12
|
-
* The transaction is created with `acceptDelayedBroadcast: false` — the sender
|
|
13
|
-
* broadcasts immediately. The resulting Atomic BEEF and derivation metadata are
|
|
14
|
-
* returned so the recipient can verify and internalize the payment on their side.
|
|
15
|
-
*/
|
|
16
|
-
export declare function buildPayment(setup: SetupWallet, params: PaymentParams): Promise<PaymentResult>;
|
package/dist/src/core/payment.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @a2a-bsv/core — Payment construction helpers.
|
|
3
|
-
*
|
|
4
|
-
* Uses BRC-29 key derivation so the recipient can internalize the payment
|
|
5
|
-
* without ever reusing an address.
|
|
6
|
-
*/
|
|
7
|
-
import { Beef, Utils } from '@bsv/sdk';
|
|
8
|
-
import { randomBytesBase64, ScriptTemplateBRC29 } from '@bsv/wallet-toolbox';
|
|
9
|
-
/**
|
|
10
|
-
* Build a BRC-29 payment transaction using the wallet's createAction API.
|
|
11
|
-
*
|
|
12
|
-
* The transaction is created with `acceptDelayedBroadcast: false` — the sender
|
|
13
|
-
* broadcasts immediately. The resulting Atomic BEEF and derivation metadata are
|
|
14
|
-
* returned so the recipient can verify and internalize the payment on their side.
|
|
15
|
-
*/
|
|
16
|
-
export async function buildPayment(setup, params) {
|
|
17
|
-
const { to, satoshis, description } = params;
|
|
18
|
-
const desc = normalizeDescription(description ?? 'agent payment');
|
|
19
|
-
// Generate unique BRC-29 derivation prefixes and suffixes
|
|
20
|
-
const derivationPrefix = randomBytesBase64(8);
|
|
21
|
-
const derivationSuffix = randomBytesBase64(8);
|
|
22
|
-
// Build BRC-29 locking script
|
|
23
|
-
const keyDeriver = setup.keyDeriver;
|
|
24
|
-
const t = new ScriptTemplateBRC29({
|
|
25
|
-
derivationPrefix,
|
|
26
|
-
derivationSuffix,
|
|
27
|
-
keyDeriver,
|
|
28
|
-
});
|
|
29
|
-
// Determine the recipient identity key.
|
|
30
|
-
// If `to` is a compressed public key hex (66 chars, starts with 02/03), use directly.
|
|
31
|
-
// Otherwise treat as an address — for BRC-29 we need a public key.
|
|
32
|
-
let recipientPubKey;
|
|
33
|
-
if (/^0[23][0-9a-fA-F]{64}$/.test(to)) {
|
|
34
|
-
recipientPubKey = to;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
// If it's an address, we can't do BRC-29 (needs pubkey). Throw a clear error.
|
|
38
|
-
throw new Error('PaymentParams.to must be a compressed public key (hex) for BRC-29 payments. ' +
|
|
39
|
-
'Raw BSV addresses are not supported — the recipient must share their identity key.');
|
|
40
|
-
}
|
|
41
|
-
const lockingScript = t.lock(setup.rootKey.toString(), recipientPubKey);
|
|
42
|
-
const label = 'a2a-payment';
|
|
43
|
-
const car = await setup.wallet.createAction({
|
|
44
|
-
outputs: [
|
|
45
|
-
{
|
|
46
|
-
lockingScript: lockingScript.toHex(),
|
|
47
|
-
satoshis,
|
|
48
|
-
outputDescription: desc,
|
|
49
|
-
tags: ['relinquish'],
|
|
50
|
-
customInstructions: JSON.stringify({
|
|
51
|
-
derivationPrefix,
|
|
52
|
-
derivationSuffix,
|
|
53
|
-
type: 'BRC29',
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
options: {
|
|
58
|
-
randomizeOutputs: false,
|
|
59
|
-
acceptDelayedBroadcast: false,
|
|
60
|
-
},
|
|
61
|
-
labels: [label],
|
|
62
|
-
description: desc,
|
|
63
|
-
});
|
|
64
|
-
// Extract the txid from the createAction result.
|
|
65
|
-
// The tx field is a number[] (AtomicBEEF binary). Parse it to get txid.
|
|
66
|
-
if (!car.tx) {
|
|
67
|
-
throw new Error('createAction did not return a transaction. Check wallet funding.');
|
|
68
|
-
}
|
|
69
|
-
const beef = Beef.fromBinary(car.tx);
|
|
70
|
-
// The last transaction in the beef is our new tx
|
|
71
|
-
const lastTx = beef.txs[beef.txs.length - 1];
|
|
72
|
-
const txid = lastTx.txid;
|
|
73
|
-
// Encode the atomic BEEF as base64
|
|
74
|
-
const atomicBinary = beef.toBinaryAtomic(txid);
|
|
75
|
-
const beefBase64 = Utils.toBase64(atomicBinary);
|
|
76
|
-
return {
|
|
77
|
-
beef: beefBase64,
|
|
78
|
-
txid,
|
|
79
|
-
satoshis,
|
|
80
|
-
derivationPrefix,
|
|
81
|
-
derivationSuffix,
|
|
82
|
-
senderIdentityKey: setup.identityKey,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Ensure description meets BRC-100's 5-50 character requirement.
|
|
87
|
-
*/
|
|
88
|
-
function normalizeDescription(desc) {
|
|
89
|
-
if (desc.length < 5)
|
|
90
|
-
return desc.padEnd(5, ' ');
|
|
91
|
-
if (desc.length > 50)
|
|
92
|
-
return desc.slice(0, 50);
|
|
93
|
-
return desc;
|
|
94
|
-
}
|