openclaw-overlay-plugin 0.8.14 → 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/index.ts +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +8 -8
- 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
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wallet setup commands: setup, identity, address.
|
|
3
|
-
*/
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import { NETWORK, WALLET_DIR, OVERLAY_URL, PATHS } from '../config.js';
|
|
6
|
-
import { ok, fail } from '../output.js';
|
|
7
|
-
import { loadWalletIdentity, deriveWalletAddress } from './identity.js';
|
|
8
|
-
import { BSVAgentWallet } from '../../core/index.js';
|
|
9
|
-
async function getBSVAgentWallet() {
|
|
10
|
-
return BSVAgentWallet;
|
|
11
|
-
}
|
|
12
|
-
// Dynamic import for @bsv/sdk
|
|
13
|
-
let _sdk = null;
|
|
14
|
-
async function getSdk() {
|
|
15
|
-
if (_sdk)
|
|
16
|
-
return _sdk;
|
|
17
|
-
try {
|
|
18
|
-
_sdk = await import('@bsv/sdk');
|
|
19
|
-
return _sdk;
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
const { fileURLToPath } = await import('node:url');
|
|
23
|
-
const path = await import('node:path');
|
|
24
|
-
const os = await import('node:os');
|
|
25
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
26
|
-
const candidates = [
|
|
27
|
-
path.resolve(__dirname, '..', '..', '..', 'node_modules', '@bsv', 'sdk', 'dist', 'esm', 'mod.js'),
|
|
28
|
-
path.resolve(__dirname, '..', '..', '..', '..', '..', 'a2a-bsv', 'packages', 'core', 'node_modules', '@bsv', 'sdk', 'dist', 'esm', 'mod.js'),
|
|
29
|
-
path.resolve(os.homedir(), 'a2a-bsv', 'packages', 'core', 'node_modules', '@bsv', 'sdk', 'dist', 'esm', 'mod.js'),
|
|
30
|
-
];
|
|
31
|
-
for (const p of candidates) {
|
|
32
|
-
try {
|
|
33
|
-
_sdk = await import(p);
|
|
34
|
-
return _sdk;
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
// Try next
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
throw new Error('Cannot find @bsv/sdk. Run setup.sh first.');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Setup command: create wallet and show identity.
|
|
45
|
-
*/
|
|
46
|
-
export async function cmdSetup() {
|
|
47
|
-
const BSVAgentWallet = await getBSVAgentWallet();
|
|
48
|
-
if (fs.existsSync(PATHS.walletIdentity)) {
|
|
49
|
-
const wallet = await BSVAgentWallet.load({ network: NETWORK, storageDir: WALLET_DIR });
|
|
50
|
-
const identityKey = await wallet.getIdentityKey();
|
|
51
|
-
await wallet.destroy();
|
|
52
|
-
return ok({
|
|
53
|
-
identityKey,
|
|
54
|
-
walletDir: WALLET_DIR,
|
|
55
|
-
network: NETWORK,
|
|
56
|
-
overlayUrl: OVERLAY_URL,
|
|
57
|
-
alreadyExisted: true,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
fs.mkdirSync(WALLET_DIR, { recursive: true });
|
|
61
|
-
const wallet = await BSVAgentWallet.load({ network: NETWORK, storageDir: WALLET_DIR });
|
|
62
|
-
const identityKey = await wallet.getIdentityKey();
|
|
63
|
-
await wallet.destroy();
|
|
64
|
-
// Restrict permissions on wallet-identity.json (contains private key)
|
|
65
|
-
if (fs.existsSync(PATHS.walletIdentity)) {
|
|
66
|
-
fs.chmodSync(PATHS.walletIdentity, 0o600);
|
|
67
|
-
}
|
|
68
|
-
return ok({
|
|
69
|
-
identityKey,
|
|
70
|
-
walletDir: WALLET_DIR,
|
|
71
|
-
network: NETWORK,
|
|
72
|
-
overlayUrl: OVERLAY_URL,
|
|
73
|
-
alreadyExisted: false,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Identity command: show identity public key.
|
|
78
|
-
*/
|
|
79
|
-
export async function cmdIdentity() {
|
|
80
|
-
const BSVAgentWallet = await getBSVAgentWallet();
|
|
81
|
-
const wallet = await BSVAgentWallet.load({ network: NETWORK, storageDir: WALLET_DIR });
|
|
82
|
-
const identityKey = await wallet.getIdentityKey();
|
|
83
|
-
await wallet.destroy();
|
|
84
|
-
return ok({ identityKey });
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Status command: show identity and balance.
|
|
88
|
-
*/
|
|
89
|
-
export async function cmdStatus() {
|
|
90
|
-
const BSVAgentWallet = await getBSVAgentWallet();
|
|
91
|
-
const wallet = await BSVAgentWallet.load({ network: NETWORK, storageDir: WALLET_DIR });
|
|
92
|
-
const identityKey = await wallet.getIdentityKey();
|
|
93
|
-
const total = await wallet.getBalance();
|
|
94
|
-
await wallet.destroy();
|
|
95
|
-
return ok({
|
|
96
|
-
identity: { identityKey, network: NETWORK },
|
|
97
|
-
balance: { walletBalance: total }
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Address command: show P2PKH receive address.
|
|
102
|
-
*/
|
|
103
|
-
export async function cmdAddress() {
|
|
104
|
-
if (!fs.existsSync(PATHS.walletIdentity)) {
|
|
105
|
-
return fail('Wallet not initialized. Run: setup');
|
|
106
|
-
}
|
|
107
|
-
const sdk = await getSdk();
|
|
108
|
-
const identity = loadWalletIdentity();
|
|
109
|
-
const privKey = sdk.PrivateKey.fromHex(identity.rootKeyHex);
|
|
110
|
-
const { address } = await deriveWalletAddress(privKey);
|
|
111
|
-
return ok({
|
|
112
|
-
address,
|
|
113
|
-
network: NETWORK,
|
|
114
|
-
identityKey: identity.identityKey,
|
|
115
|
-
note: NETWORK === 'mainnet'
|
|
116
|
-
? `Fund this address at an exchange — Explorer: https://whatsonchain.com/address/${address}`
|
|
117
|
-
: `Fund via faucet: https://witnessonchain.com/faucet/tbsv — Explorer: https://test.whatsonchain.com/address/${address}`,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* X (Twitter) verification commands.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Start X verification: generate a tweet with identity key and signature.
|
|
6
|
-
*/
|
|
7
|
-
export declare function cmdXVerifyStart(handleArg: string | undefined): Promise<any>;
|
|
8
|
-
/**
|
|
9
|
-
* Complete X verification by checking the posted tweet.
|
|
10
|
-
*/
|
|
11
|
-
export declare function cmdXVerifyComplete(tweetUrl: string | undefined): Promise<any>;
|
|
12
|
-
/**
|
|
13
|
-
* List verified X accounts (local cache).
|
|
14
|
-
*/
|
|
15
|
-
export declare function cmdXVerifications(): Promise<any>;
|
|
16
|
-
/**
|
|
17
|
-
* Lookup X verifications from the overlay network.
|
|
18
|
-
*/
|
|
19
|
-
export declare function cmdXLookup(query: string | undefined): Promise<any>;
|
|
20
|
-
/**
|
|
21
|
-
* List pending X engagement requests.
|
|
22
|
-
*/
|
|
23
|
-
export declare function cmdXEngagementQueue(): Promise<any>;
|
|
24
|
-
/**
|
|
25
|
-
* Mark an X engagement request as fulfilled.
|
|
26
|
-
*/
|
|
27
|
-
export declare function cmdXEngagementFulfill(requestId: string | undefined, proofUrl?: string): Promise<any>;
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* X (Twitter) verification commands.
|
|
3
|
-
*/
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import { PROTOCOL_ID, TOPICS, LOOKUP_SERVICES, PATHS } from '../config.js';
|
|
6
|
-
import { ok, fail } from '../output.js';
|
|
7
|
-
import { loadIdentity } from '../wallet/identity.js';
|
|
8
|
-
import { loadXVerifications, saveXVerifications, readJsonl, ensureStateDir } from '../utils/storage.js';
|
|
9
|
-
import { buildRealOverlayTransaction, lookupOverlay } from '../overlay/transaction.js';
|
|
10
|
-
// Dynamic import for @bsv/sdk
|
|
11
|
-
let _sdk = null;
|
|
12
|
-
async function getSdk() {
|
|
13
|
-
if (_sdk)
|
|
14
|
-
return _sdk;
|
|
15
|
-
try {
|
|
16
|
-
_sdk = await import('@bsv/sdk');
|
|
17
|
-
return _sdk;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
const { fileURLToPath } = await import('node:url');
|
|
21
|
-
const path = await import('node:path');
|
|
22
|
-
const os = await import('node:os');
|
|
23
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
-
const candidates = [
|
|
25
|
-
path.resolve(__dirname, '..', '..', '..', 'node_modules', '@bsv', 'sdk', 'dist', 'esm', 'mod.js'),
|
|
26
|
-
path.resolve(__dirname, '..', '..', '..', '..', '..', 'a2a-bsv', 'packages', 'core', 'node_modules', '@bsv', 'sdk', 'dist', 'esm', 'mod.js'),
|
|
27
|
-
path.resolve(os.homedir(), 'a2a-bsv', 'packages', 'core', 'node_modules', '@bsv', 'sdk', 'dist', 'esm', 'mod.js'),
|
|
28
|
-
];
|
|
29
|
-
for (const p of candidates) {
|
|
30
|
-
try {
|
|
31
|
-
_sdk = await import(p);
|
|
32
|
-
return _sdk;
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
// Try next
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
throw new Error('Cannot find @bsv/sdk. Run setup.sh first.');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Start X verification: generate a tweet with identity key and signature.
|
|
43
|
-
*/
|
|
44
|
-
export async function cmdXVerifyStart(handleArg) {
|
|
45
|
-
if (!handleArg) {
|
|
46
|
-
return fail('Usage: x-verify-start <@handle>');
|
|
47
|
-
}
|
|
48
|
-
const sdk = await getSdk();
|
|
49
|
-
const handle = handleArg.startsWith('@') ? handleArg : `@${handleArg}`;
|
|
50
|
-
const { identityKey, privKey } = await loadIdentity();
|
|
51
|
-
// Sign the verification message
|
|
52
|
-
const message = `Verify ${identityKey}`;
|
|
53
|
-
const msgHash = sdk.Hash.sha256(Array.from(new TextEncoder().encode(message)));
|
|
54
|
-
const sig = privKey.sign(msgHash);
|
|
55
|
-
const signatureHex = Array.from(sig.toDER()).map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
56
|
-
// Save pending verification
|
|
57
|
-
const pending = {
|
|
58
|
-
identityKey,
|
|
59
|
-
handle,
|
|
60
|
-
signature: signatureHex,
|
|
61
|
-
message,
|
|
62
|
-
createdAt: new Date().toISOString(),
|
|
63
|
-
};
|
|
64
|
-
ensureStateDir();
|
|
65
|
-
fs.writeFileSync(PATHS.pendingXVerification, JSON.stringify(pending, null, 2));
|
|
66
|
-
// Build tweet text (under 280 chars)
|
|
67
|
-
// Use shortened signature (first 40 chars) to fit in tweet
|
|
68
|
-
const tweetText = `BSV Agent Verify: ${identityKey.slice(0, 10)}...${identityKey.slice(-10)} sig:${signatureHex.slice(0, 40)}`;
|
|
69
|
-
return ok({
|
|
70
|
-
tweetText,
|
|
71
|
-
handle,
|
|
72
|
-
identityKey,
|
|
73
|
-
signature: signatureHex,
|
|
74
|
-
note: `Post the tweet above from ${handle}, then run: x-verify-complete <tweet_url>`,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Complete X verification by checking the posted tweet.
|
|
79
|
-
*/
|
|
80
|
-
export async function cmdXVerifyComplete(tweetUrl) {
|
|
81
|
-
if (!tweetUrl)
|
|
82
|
-
return fail('Usage: x-verify-complete <tweet-url>');
|
|
83
|
-
// Load pending verification
|
|
84
|
-
if (!fs.existsSync(PATHS.pendingXVerification)) {
|
|
85
|
-
return fail('No pending X verification. Run x-verify-start first.');
|
|
86
|
-
}
|
|
87
|
-
const pending = JSON.parse(fs.readFileSync(PATHS.pendingXVerification, 'utf-8'));
|
|
88
|
-
// Extract tweet ID from URL
|
|
89
|
-
const tweetIdMatch = tweetUrl.match(/status\/(\d+)/);
|
|
90
|
-
if (!tweetIdMatch)
|
|
91
|
-
return fail('Invalid tweet URL. Expected format: https://x.com/user/status/123456789');
|
|
92
|
-
const tweetId = tweetIdMatch[1];
|
|
93
|
-
// Fetch the tweet using bird CLI
|
|
94
|
-
let tweetData;
|
|
95
|
-
try {
|
|
96
|
-
const { execSync } = await import('child' + '_' + 'process');
|
|
97
|
-
const birdOutput = execSync(`bird read ${tweetUrl} --json 2>/dev/null`, {
|
|
98
|
-
encoding: 'utf-8',
|
|
99
|
-
timeout: 30000,
|
|
100
|
-
});
|
|
101
|
-
tweetData = JSON.parse(birdOutput);
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
return fail(`Failed to fetch tweet: ${err.message}. Make sure bird CLI is configured.`);
|
|
105
|
-
}
|
|
106
|
-
// Verify the tweet contains our identity key and partial signature
|
|
107
|
-
const tweetText = tweetData.text || tweetData.full_text || '';
|
|
108
|
-
if (!tweetText.includes(pending.identityKey.slice(0, 10))) {
|
|
109
|
-
return fail('Tweet does not contain the expected identity key.');
|
|
110
|
-
}
|
|
111
|
-
// Check for partial signature (first 40 chars)
|
|
112
|
-
if (!tweetText.includes(pending.signature.slice(0, 40))) {
|
|
113
|
-
return fail('Tweet does not contain the expected verification signature prefix.');
|
|
114
|
-
}
|
|
115
|
-
// Get the X user info from the tweet
|
|
116
|
-
const xUserId = tweetData.user?.id_str || tweetData.authorId || tweetData.author?.id || tweetData.user_id;
|
|
117
|
-
const xHandle = tweetData.user?.screen_name || tweetData.author?.username || tweetData.author?.name || pending.handle.replace('@', '');
|
|
118
|
-
if (!xUserId) {
|
|
119
|
-
return fail('Could not extract X user ID from tweet data.');
|
|
120
|
-
}
|
|
121
|
-
// Build on-chain verification record
|
|
122
|
-
const verificationPayload = {
|
|
123
|
-
protocol: PROTOCOL_ID,
|
|
124
|
-
type: 'x-verification',
|
|
125
|
-
identityKey: pending.identityKey,
|
|
126
|
-
xHandle: `@${xHandle}`,
|
|
127
|
-
xUserId,
|
|
128
|
-
tweetId,
|
|
129
|
-
tweetUrl,
|
|
130
|
-
signature: pending.signature,
|
|
131
|
-
verifiedAt: new Date().toISOString(),
|
|
132
|
-
};
|
|
133
|
-
// Submit to overlay (may fail if topic manager not deployed yet)
|
|
134
|
-
let result = { txid: null, funded: 'pending-server-support' };
|
|
135
|
-
let onChainStored = false;
|
|
136
|
-
try {
|
|
137
|
-
result = await buildRealOverlayTransaction(verificationPayload, TOPICS.X_VERIFICATION);
|
|
138
|
-
onChainStored = true;
|
|
139
|
-
}
|
|
140
|
-
catch (err) {
|
|
141
|
-
console.error(`[x-verify] On-chain storage failed: ${err.message}`);
|
|
142
|
-
console.error('[x-verify] Storing verification locally.');
|
|
143
|
-
}
|
|
144
|
-
// Save verification locally
|
|
145
|
-
const verifications = loadXVerifications();
|
|
146
|
-
verifications.push({
|
|
147
|
-
...verificationPayload,
|
|
148
|
-
txid: result.txid,
|
|
149
|
-
});
|
|
150
|
-
saveXVerifications(verifications);
|
|
151
|
-
// Clean up pending
|
|
152
|
-
fs.unlinkSync(PATHS.pendingXVerification);
|
|
153
|
-
return ok({
|
|
154
|
-
verified: true,
|
|
155
|
-
identityKey: pending.identityKey,
|
|
156
|
-
xHandle: `@${xHandle}`,
|
|
157
|
-
xUserId,
|
|
158
|
-
tweetId,
|
|
159
|
-
txid: result.txid,
|
|
160
|
-
funded: result.funded,
|
|
161
|
-
onChainStored,
|
|
162
|
-
note: onChainStored ? undefined : 'Stored locally. On-chain anchoring pending server topic manager deployment.',
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* List verified X accounts (local cache).
|
|
167
|
-
*/
|
|
168
|
-
export async function cmdXVerifications() {
|
|
169
|
-
const verifications = loadXVerifications();
|
|
170
|
-
return ok({ verifications, count: verifications.length });
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Lookup X verifications from the overlay network.
|
|
174
|
-
*/
|
|
175
|
-
export async function cmdXLookup(query) {
|
|
176
|
-
try {
|
|
177
|
-
const lookupQuery = query
|
|
178
|
-
? (query.startsWith('@') ? { xHandle: query } : { identityKey: query })
|
|
179
|
-
: { type: 'list' };
|
|
180
|
-
const response = await lookupOverlay(LOOKUP_SERVICES.X_VERIFICATIONS, lookupQuery);
|
|
181
|
-
return ok({ verifications: response.outputs || response || [], query: lookupQuery });
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
return ok({ verifications: [], query, note: 'X verification lookup service may not be deployed yet.' });
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* List pending X engagement requests.
|
|
189
|
-
*/
|
|
190
|
-
export async function cmdXEngagementQueue() {
|
|
191
|
-
if (!fs.existsSync(PATHS.xEngagementQueue)) {
|
|
192
|
-
return ok({ queue: [], count: 0 });
|
|
193
|
-
}
|
|
194
|
-
const queue = readJsonl(PATHS.xEngagementQueue).filter(e => e.status === 'pending');
|
|
195
|
-
return ok({ queue, count: queue.length });
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Mark an X engagement request as fulfilled.
|
|
199
|
-
*/
|
|
200
|
-
export async function cmdXEngagementFulfill(requestId, proofUrl) {
|
|
201
|
-
if (!requestId)
|
|
202
|
-
return fail('Usage: x-engagement-fulfill <requestId> [proofUrl]');
|
|
203
|
-
if (!fs.existsSync(PATHS.xEngagementQueue)) {
|
|
204
|
-
return fail('No engagement queue found.');
|
|
205
|
-
}
|
|
206
|
-
const queue = readJsonl(PATHS.xEngagementQueue);
|
|
207
|
-
const entryIndex = queue.findIndex(e => e.requestId === requestId);
|
|
208
|
-
if (entryIndex === -1) {
|
|
209
|
-
return fail(`Request ${requestId} not found in queue.`);
|
|
210
|
-
}
|
|
211
|
-
// Mark as fulfilled
|
|
212
|
-
queue[entryIndex].status = 'fulfilled';
|
|
213
|
-
queue[entryIndex].fulfilledAt = new Date().toISOString();
|
|
214
|
-
queue[entryIndex].proofUrl = proofUrl || null;
|
|
215
|
-
// Rewrite queue file
|
|
216
|
-
fs.writeFileSync(PATHS.xEngagementQueue, queue.map(e => JSON.stringify(e)).join('\n') + '\n');
|
|
217
|
-
return ok({
|
|
218
|
-
fulfilled: true,
|
|
219
|
-
requestId,
|
|
220
|
-
entry: queue[entryIndex],
|
|
221
|
-
});
|
|
222
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API Proxy service definition.
|
|
3
|
-
*/
|
|
4
|
-
import { ServiceCategory } from '../../types.js';
|
|
5
|
-
const apiProxyService = {
|
|
6
|
-
id: 'api-proxy',
|
|
7
|
-
name: 'API Proxy',
|
|
8
|
-
description: 'Proxy HTTP requests to external APIs. Input: {url, method, headers, body}.',
|
|
9
|
-
defaultPrice: 15,
|
|
10
|
-
category: ServiceCategory.UTILITY,
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
url: { type: 'string', description: 'Target API URL' },
|
|
15
|
-
method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE'], description: 'HTTP method' },
|
|
16
|
-
headers: { type: 'object', description: 'Request headers' },
|
|
17
|
-
body: { description: 'Request body' },
|
|
18
|
-
timeout: { type: 'number', description: 'Request timeout in ms' }
|
|
19
|
-
},
|
|
20
|
-
required: ['url']
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
export default apiProxyService;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Code Development service definition.
|
|
3
|
-
*/
|
|
4
|
-
import { ServiceCategory } from '../../types.js';
|
|
5
|
-
const codeDevelopService = {
|
|
6
|
-
id: 'code-develop',
|
|
7
|
-
name: 'Code Development',
|
|
8
|
-
description: 'Generate code from requirements. Specify language, task description, and constraints.',
|
|
9
|
-
defaultPrice: 100,
|
|
10
|
-
category: ServiceCategory.DEVELOPMENT,
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
requirements: { type: 'string', description: 'Detailed description of what code to generate' },
|
|
15
|
-
language: { type: 'string', description: 'Programming language (e.g., JavaScript, Python, Java)' },
|
|
16
|
-
constraints: { type: 'string', description: 'Any specific constraints or requirements' },
|
|
17
|
-
style: { type: 'string', description: 'Code style preferences' },
|
|
18
|
-
includeTests: { type: 'boolean', description: 'Whether to include unit tests' }
|
|
19
|
-
},
|
|
20
|
-
required: ['requirements', 'language']
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
export default codeDevelopService;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Code Review service definition.
|
|
3
|
-
*
|
|
4
|
-
* Provides thorough code review covering bugs, security issues, style,
|
|
5
|
-
* performance, and improvement suggestions. This is an agent-mode service
|
|
6
|
-
* that leverages the LLM's capabilities.
|
|
7
|
-
*/
|
|
8
|
-
import { ServiceDefinition } from '../../types.js';
|
|
9
|
-
declare const codeReviewService: ServiceDefinition;
|
|
10
|
-
export default codeReviewService;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Code Review service definition.
|
|
3
|
-
*
|
|
4
|
-
* Provides thorough code review covering bugs, security issues, style,
|
|
5
|
-
* performance, and improvement suggestions. This is an agent-mode service
|
|
6
|
-
* that leverages the LLM's capabilities.
|
|
7
|
-
*/
|
|
8
|
-
import { ServiceCategory } from '../../types.js';
|
|
9
|
-
const codeReviewService = {
|
|
10
|
-
id: 'code-review',
|
|
11
|
-
name: 'Code Review',
|
|
12
|
-
description: 'Thorough code review covering bugs, security issues, style, performance, and improvement suggestions.',
|
|
13
|
-
defaultPrice: 50,
|
|
14
|
-
category: ServiceCategory.DEVELOPMENT,
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
code: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'Code to review'
|
|
21
|
-
},
|
|
22
|
-
language: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
description: 'Programming language (auto-detected if not provided)'
|
|
25
|
-
},
|
|
26
|
-
prUrl: {
|
|
27
|
-
type: 'string',
|
|
28
|
-
description: 'GitHub/GitLab PR URL to review instead of direct code'
|
|
29
|
-
},
|
|
30
|
-
focusAreas: {
|
|
31
|
-
type: 'array',
|
|
32
|
-
items: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
enum: ['security', 'performance', 'style', 'bugs', 'maintainability', 'testing']
|
|
35
|
-
},
|
|
36
|
-
description: 'Specific areas to focus the review on'
|
|
37
|
-
},
|
|
38
|
-
severity: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
enum: ['basic', 'detailed', 'comprehensive'],
|
|
41
|
-
description: 'Depth of review (default: detailed)'
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
anyOf: [
|
|
45
|
-
{ required: ['code'] },
|
|
46
|
-
{ required: ['prUrl'] }
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
// No handler - this service uses agent mode for full LLM capabilities
|
|
50
|
-
};
|
|
51
|
-
export default codeReviewService;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Image Analysis service definition.
|
|
3
|
-
*/
|
|
4
|
-
import { ServiceCategory } from '../../types.js';
|
|
5
|
-
const imageAnalysisService = {
|
|
6
|
-
id: 'image-analysis',
|
|
7
|
-
name: 'Image Analysis',
|
|
8
|
-
description: 'Analyze and describe images. Identify objects, text, scenes, and more.',
|
|
9
|
-
defaultPrice: 30,
|
|
10
|
-
category: ServiceCategory.AI,
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
imageUrl: { type: 'string', description: 'URL of the image to analyze' },
|
|
15
|
-
imageData: { type: 'string', description: 'Base64 encoded image data' },
|
|
16
|
-
analysisType: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
enum: ['general', 'objects', 'text', 'faces', 'scenes'],
|
|
19
|
-
description: 'Type of analysis to perform'
|
|
20
|
-
},
|
|
21
|
-
detailLevel: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
enum: ['brief', 'detailed', 'comprehensive'],
|
|
24
|
-
description: 'Level of detail in analysis'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
oneOf: [
|
|
28
|
-
{ required: ['imageUrl'] },
|
|
29
|
-
{ required: ['imageData'] }
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export default imageAnalysisService;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Store service definition.
|
|
3
|
-
*/
|
|
4
|
-
import { ServiceCategory } from '../../types.js';
|
|
5
|
-
const memoryStoreService = {
|
|
6
|
-
id: 'memory-store',
|
|
7
|
-
name: 'Memory Store',
|
|
8
|
-
description: 'Persistent key-value storage for agents. Operations: set, get, delete, list.',
|
|
9
|
-
defaultPrice: 10,
|
|
10
|
-
category: ServiceCategory.UTILITY,
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
operation: { type: 'string', enum: ['set', 'get', 'delete', 'list'], description: 'Storage operation' },
|
|
15
|
-
key: { type: 'string', description: 'Storage key (required for set, get, delete)' },
|
|
16
|
-
value: { description: 'Value to store (required for set operation)' },
|
|
17
|
-
namespace: { type: 'string', description: 'Optional namespace for keys' }
|
|
18
|
-
},
|
|
19
|
-
required: ['operation']
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export default memoryStoreService;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Roulette service definition.
|
|
3
|
-
*/
|
|
4
|
-
import { ServiceCategory } from '../../types.js';
|
|
5
|
-
const rouletteService = {
|
|
6
|
-
id: 'roulette',
|
|
7
|
-
name: 'Roulette',
|
|
8
|
-
description: 'European roulette (single zero). Bet on: number 0-36, red/black, odd/even, high/low.',
|
|
9
|
-
defaultPrice: 10,
|
|
10
|
-
category: ServiceCategory.ENTERTAINMENT,
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
bet: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'Bet type: specific number (0-36), red, black, odd, even, high (19-36), low (1-18), or dozen (1st, 2nd, 3rd)'
|
|
17
|
-
},
|
|
18
|
-
amount: {
|
|
19
|
-
type: 'number',
|
|
20
|
-
description: 'Bet amount (optional, for display purposes)',
|
|
21
|
-
minimum: 1
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
required: ['bet']
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
export default rouletteService;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Summarize service definition.
|
|
3
|
-
*/
|
|
4
|
-
import { ServiceCategory } from '../../types.js';
|
|
5
|
-
const summarizeService = {
|
|
6
|
-
id: 'summarize',
|
|
7
|
-
name: 'Summarize',
|
|
8
|
-
description: 'Summarize long text, articles, or documents into concise bullet points.',
|
|
9
|
-
defaultPrice: 20,
|
|
10
|
-
category: ServiceCategory.AI,
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
text: { type: 'string', description: 'Text to summarize' },
|
|
15
|
-
maxLength: { type: 'number', description: 'Maximum length of summary' },
|
|
16
|
-
format: { type: 'string', enum: ['bullets', 'paragraph'], description: 'Output format' }
|
|
17
|
-
},
|
|
18
|
-
required: ['text']
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
export default summarizeService;
|