openclaw-overlay-plugin 0.8.18 โ†’ 0.8.19

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.
Files changed (80) hide show
  1. package/package.json +1 -3
  2. package/index.ts +0 -379
  3. package/src/ambient.d.ts +0 -1
  4. package/src/cli-main.ts +0 -240
  5. package/src/cli.ts +0 -16
  6. package/src/compatibility.test.ts +0 -46
  7. package/src/scripts/baemail/commands.ts +0 -311
  8. package/src/scripts/baemail/handler.ts +0 -338
  9. package/src/scripts/baemail/index.ts +0 -6
  10. package/src/scripts/config.ts +0 -89
  11. package/src/scripts/index.ts +0 -8
  12. package/src/scripts/messaging/connect.ts +0 -162
  13. package/src/scripts/messaging/handlers.ts +0 -394
  14. package/src/scripts/messaging/inbox.ts +0 -64
  15. package/src/scripts/messaging/index.ts +0 -9
  16. package/src/scripts/messaging/poll.ts +0 -59
  17. package/src/scripts/messaging/send.ts +0 -54
  18. package/src/scripts/output.ts +0 -30
  19. package/src/scripts/overlay/advertisement.ts +0 -138
  20. package/src/scripts/overlay/discover.ts +0 -83
  21. package/src/scripts/overlay/index.ts +0 -8
  22. package/src/scripts/overlay/registration.ts +0 -199
  23. package/src/scripts/overlay/services.ts +0 -199
  24. package/src/scripts/overlay/transaction.ts +0 -124
  25. package/src/scripts/payment/build.ts +0 -65
  26. package/src/scripts/payment/commands.ts +0 -92
  27. package/src/scripts/payment/index.ts +0 -7
  28. package/src/scripts/payment/types.ts +0 -62
  29. package/src/scripts/services/index.ts +0 -7
  30. package/src/scripts/services/queue.ts +0 -35
  31. package/src/scripts/services/request.ts +0 -98
  32. package/src/scripts/services/respond.ts +0 -149
  33. package/src/scripts/types.ts +0 -121
  34. package/src/scripts/utils/index.ts +0 -7
  35. package/src/scripts/utils/merkle.ts +0 -57
  36. package/src/scripts/utils/storage.ts +0 -231
  37. package/src/scripts/utils/woc.ts +0 -106
  38. package/src/scripts/wallet/balance.ts +0 -277
  39. package/src/scripts/wallet/identity.ts +0 -204
  40. package/src/scripts/wallet/index.ts +0 -7
  41. package/src/scripts/wallet/setup.ts +0 -137
  42. package/src/scripts/x-verification/commands.ts +0 -261
  43. package/src/scripts/x-verification/index.ts +0 -5
  44. package/src/services/built-in/api-proxy/index.ts +0 -26
  45. package/src/services/built-in/api-proxy/prompt.md +0 -26
  46. package/src/services/built-in/code-develop/index.ts +0 -26
  47. package/src/services/built-in/code-develop/prompt.md +0 -35
  48. package/src/services/built-in/code-review/index.ts +0 -54
  49. package/src/services/built-in/code-review/prompt.md +0 -105
  50. package/src/services/built-in/image-analysis/index.ts +0 -36
  51. package/src/services/built-in/image-analysis/prompt.md +0 -42
  52. package/src/services/built-in/memory-store/index.ts +0 -25
  53. package/src/services/built-in/memory-store/prompt.md +0 -45
  54. package/src/services/built-in/roulette/index.ts +0 -30
  55. package/src/services/built-in/roulette/prompt.md +0 -35
  56. package/src/services/built-in/summarize/index.ts +0 -24
  57. package/src/services/built-in/summarize/prompt.md +0 -27
  58. package/src/services/built-in/tell-joke/handler.ts +0 -134
  59. package/src/services/built-in/tell-joke/index.ts +0 -34
  60. package/src/services/built-in/tell-joke/prompt.md +0 -59
  61. package/src/services/built-in/translate/index.ts +0 -24
  62. package/src/services/built-in/translate/prompt.md +0 -23
  63. package/src/services/built-in/web-research/index.ts +0 -54
  64. package/src/services/built-in/web-research/prompt.md +0 -110
  65. package/src/services/index.ts +0 -16
  66. package/src/services/loader.ts +0 -344
  67. package/src/services/manager.ts +0 -304
  68. package/src/services/registry.ts +0 -246
  69. package/src/services/types.ts +0 -259
  70. package/src/test/cli.test.ts +0 -353
  71. package/src/test/comprehensive-overlay.test.ts +0 -729
  72. package/src/test/identity-consistency.test.ts +0 -68
  73. package/src/test/key-derivation.test.ts +0 -102
  74. package/src/test/network-address.test.ts +0 -46
  75. package/src/test/overlay-submit.test.ts +0 -570
  76. package/src/test/request-response-flow.test.ts +0 -253
  77. package/src/test/service-system.test.ts +0 -241
  78. package/src/test/taskflow.test.ts +0 -95
  79. package/src/test/utils/server-logic.ts +0 -368
  80. package/src/test/wallet.test.ts +0 -165
@@ -1,68 +0,0 @@
1
- /**
2
- * Identity Consistency tests
3
- *
4
- * Verifies that all plugins produce the exact same identityKey from the same root secret.
5
- */
6
-
7
- import { BSVAgentWallet } from 'openclaw-plugin-core';
8
- import * as fs from 'node:fs';
9
- import * as path from 'node:path';
10
- import * as os from 'node:os';
11
-
12
- // Simple test runner
13
- let passed = 0;
14
- let failed = 0;
15
-
16
- async function test(name: string, fn: () => void | Promise<void>) {
17
- try {
18
- await fn();
19
- console.log(` โœ“ ${name}`);
20
- passed++;
21
- } catch (err: unknown) {
22
- console.log(` โœ— ${name}`);
23
- console.log(err);
24
- failed++;
25
- }
26
- }
27
-
28
- function assert(condition: boolean, message: string) {
29
- if (!condition) throw new Error(`Assertion failed: ${message}`);
30
- }
31
-
32
- async function run() {
33
- console.log('Identity Consistency tests\n');
34
-
35
- const SHARED_ROOT_KEY = '0000000000000000000000000000000000000000000000000000000000000001';
36
- const EXPECTED_IDENTITY = '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798';
37
-
38
- await test('Overlay plugin derives correct compressed pubkey', async () => {
39
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'identity-test-'));
40
- try {
41
- const wallet = await BSVAgentWallet.load({
42
- network: 'mainnet',
43
- storageDir: tmpDir,
44
- rootKeyHex: SHARED_ROOT_KEY,
45
- enableMonitor: false
46
- } as any);
47
-
48
- const identity = await wallet.getIdentityKey();
49
- assert(identity === EXPECTED_IDENTITY, `Should match expected identity. Got: ${identity}`);
50
- assert(identity.length === 66, `Should be 66 chars (compressed hex). Got: ${identity.length}`);
51
-
52
- await wallet.destroy();
53
- } finally {
54
- fs.rmSync(tmpDir, { recursive: true, force: true });
55
- }
56
- });
57
-
58
- // Since both use the same core logic (copied or shared), we verify the logic here
59
- // against the known secp256k1 base point G (compressed).
60
-
61
- console.log(`\n${passed} passed, ${failed} failed`);
62
- if (failed > 0) process.exit(1);
63
- }
64
-
65
- run().catch(err => {
66
- console.error(err);
67
- process.exit(1);
68
- });
@@ -1,102 +0,0 @@
1
- /**
2
- * Unit tests for key derivation consistency.
3
- *
4
- * CRITICAL: These tests ensure that transaction signing uses the correct
5
- * child private key that matches the derived address.
6
- *
7
- * Bug history: Initially, code was deriving a child address using BRC-29
8
- * but signing with the root private key, causing OP_EQUALVERIFY failures.
9
- *
10
- * Run: node dist/test/key-derivation.test.js
11
- */
12
-
13
- import { PrivateKey, Transaction, P2PKH, CachedKeyDeriver, Utils } from '@bsv/sdk';
14
- import { brc29ProtocolID } from '@bsv/wallet-toolbox';
15
-
16
- async function assert(condition: boolean, message: string) {
17
- if (!condition) {
18
- throw new Error(`Assertion failed: ${message}`);
19
- }
20
- }
21
-
22
- async function runTests() {
23
- console.log('๐Ÿงช Running Key Derivation Tests...\n');
24
-
25
- // Test setup
26
- const rootPrivKey = PrivateKey.fromRandom();
27
- const keyDeriver = new CachedKeyDeriver(rootPrivKey);
28
- const derivationPrefix = Utils.toBase64(Array.from(Utils.toArray('import', 'utf8')));
29
- const derivationSuffix = Utils.toBase64(Array.from(Utils.toArray('now', 'utf8')));
30
- const keyString = `${derivationPrefix} ${derivationSuffix}`;
31
-
32
- const childPrivKey = keyDeriver.derivePrivateKey(brc29ProtocolID, keyString, 'self');
33
- const pubKey = keyDeriver.derivePublicKey(brc29ProtocolID, keyString, 'self', true);
34
- const derivedAddress = pubKey.toAddress();
35
- const hashResult = pubKey.toHash();
36
- const derivedHash160 = typeof hashResult === 'string'
37
- ? new Uint8Array(hashResult.match(/.{2}/g)!.map(h => parseInt(h, 16)))
38
- : new Uint8Array(hashResult);
39
-
40
- // Test 1: Consistency
41
- console.log('โœ“ Test 1: Derived keys are consistent');
42
- const keyDeriver2 = new CachedKeyDeriver(rootPrivKey);
43
- const childPrivKey2 = keyDeriver2.derivePrivateKey(brc29ProtocolID, keyString, 'self');
44
- await assert(childPrivKey.toHex() === childPrivKey2.toHex(), 'Child keys should be identical');
45
-
46
- // Test 2: Child key matches derived address
47
- console.log('โœ“ Test 2: Child private key matches derived address');
48
- const childPubKey = childPrivKey.toPublicKey();
49
- const childAddress = childPubKey.toAddress();
50
- await assert(childAddress === derivedAddress, 'Child key address should match derived address');
51
-
52
- // Test 3: Root key does NOT match (critical!)
53
- console.log('โœ“ Test 3: CRITICAL - Root key does NOT match derived address');
54
- const rootAddress = rootPrivKey.toPublicKey().toAddress();
55
- await assert(rootAddress !== derivedAddress, 'Root address must differ from derived address');
56
-
57
- // Test 4: Transaction with child key succeeds
58
- console.log('โœ“ Test 4: CRITICAL - Transaction signed with child key validates');
59
- const fundingTx = new Transaction();
60
- fundingTx.addOutput({
61
- lockingScript: new P2PKH().lock(Array.from(derivedHash160)),
62
- satoshis: 1000,
63
- });
64
-
65
- const spendingTx = new Transaction();
66
- spendingTx.addInput({
67
- sourceTransaction: fundingTx,
68
- sourceOutputIndex: 0,
69
- unlockingScriptTemplate: new P2PKH().unlock(childPrivKey),
70
- });
71
- spendingTx.addOutput({
72
- lockingScript: new P2PKH().lock(Array.from(derivedHash160)),
73
- satoshis: 900,
74
- });
75
-
76
- await spendingTx.sign();
77
- const inputScript = spendingTx.inputs[0].unlockingScript;
78
- await assert(!!inputScript, 'Unlocking script should be present');
79
- await assert(Array.from(inputScript!.toBinary()).length > 0, 'Script should have content');
80
-
81
- // Test 5: Different paths produce different addresses
82
- console.log('โœ“ Test 5: Different derivation paths produce different addresses');
83
- const path1 = Utils.toBase64(Array.from(Utils.toArray('import', 'utf8'))) + ' ' + Utils.toBase64(Array.from(Utils.toArray('now', 'utf8')));
84
- const path2 = Utils.toBase64(Array.from(Utils.toArray('import', 'utf8'))) + ' ' + Utils.toBase64(Array.from(Utils.toArray('later', 'utf8')));
85
-
86
- const pubKey1 = keyDeriver.derivePublicKey(brc29ProtocolID, path1, 'self', true);
87
- const pubKey2 = keyDeriver.derivePublicKey(brc29ProtocolID, path2, 'self', true);
88
-
89
- await assert(pubKey1.toAddress() !== pubKey2.toAddress(), 'Different paths should produce different addresses');
90
-
91
- console.log('\nโœ… All tests passed!\n');
92
- console.log('Key derivation is working correctly:');
93
- console.log(` Root address: ${rootAddress}`);
94
- console.log(` Derived address: ${derivedAddress}`);
95
- console.log(` Child key works: YES`);
96
- console.log(` Root key works: NO (correctly rejected)\n`);
97
- }
98
-
99
- runTests().catch((err) => {
100
- console.error('\nโŒ Tests failed:', err.message);
101
- process.exit(1);
102
- });
@@ -1,46 +0,0 @@
1
- /**
2
- * Unit tests for network-specific address generation.
3
- *
4
- * These tests verify that address generation correctly uses the specified
5
- * network prefix (mainnet vs testnet).
6
- *
7
- * Run: npx tsx src/test/network-address.test.ts
8
- */
9
-
10
- import { PrivateKey } from '@bsv/sdk';
11
- import { deriveWalletAddress } from '../scripts/wallet/identity.js';
12
-
13
- async function assert(condition: boolean, message: string) {
14
- if (!condition) {
15
- throw new Error(`Assertion failed: ${message}`);
16
- }
17
- }
18
-
19
- async function runTests() {
20
- console.log('๐Ÿงช Running Network Address Generation Tests...\n');
21
-
22
- const privKey = PrivateKey.fromRandom();
23
-
24
- // Test 1: Mainnet Address Generation
25
- console.log('โœ“ Test 1: Mainnet address starts with 1');
26
- const mainnet = await deriveWalletAddress(privKey, 'mainnet');
27
- console.log(` Mainnet: ${mainnet.address}`);
28
- await assert(mainnet.address.startsWith('1'), 'Mainnet address should start with 1');
29
-
30
- // Test 2: Testnet Address Generation
31
- console.log('โœ“ Test 2: Testnet address starts with m or n');
32
- const testnet = await deriveWalletAddress(privKey, 'testnet');
33
- console.log(` Testnet: ${testnet.address}`);
34
- await assert(testnet.address.startsWith('m') || testnet.address.startsWith('n'), 'Testnet address should start with m or n');
35
-
36
- // Test 3: Addresses are different
37
- console.log('โœ“ Test 3: Mainnet and testnet addresses for same key are different');
38
- await assert(mainnet.address !== testnet.address, 'Addresses should be different across networks');
39
-
40
- console.log('\nโœ… All network address tests passed!\n');
41
- }
42
-
43
- runTests().catch((err) => {
44
- console.error('\nโŒ Tests failed:', err.message);
45
- process.exit(1);
46
- });