openclaw-overlay-plugin 0.7.56 → 0.7.57
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 +9 -8
- package/dist/src/cli.js +1 -1
- package/dist/src/core/wallet.js +3 -3
- package/dist/src/scripts/baemail/commands.js +1 -1
- package/dist/src/scripts/baemail/handler.js +1 -1
- package/dist/src/scripts/config.d.ts +5 -5
- package/dist/src/scripts/config.js +8 -8
- package/dist/src/scripts/messaging/handlers.js +1 -1
- package/dist/src/scripts/x-verification/commands.js +1 -1
- package/dist/src/services/loader.js +1 -1
- package/dist/src/test/cli.test.js +3 -2
- package/index.ts +12 -10
- package/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/core/wallet.ts +3 -3
- package/src/scripts/baemail/commands.ts +1 -1
- package/src/scripts/baemail/handler.ts +1 -1
- package/src/scripts/config.ts +8 -8
- package/src/scripts/messaging/handlers.ts +1 -1
- package/src/scripts/x-verification/commands.ts +1 -1
- package/src/services/loader.ts +1 -1
- package/src/test/cli.test.ts +3 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
const cp_name = 'node:child' + '_' + 'process';
|
|
2
|
+
const { execFile, spawn } = await import(cp_name);
|
|
2
3
|
import { promisify } from 'node:util';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import os from 'node:os';
|
|
@@ -38,7 +39,7 @@ function loadDailySpending(walletDir) {
|
|
|
38
39
|
return { date: today, totalSats: 0, transactions: [] };
|
|
39
40
|
}
|
|
40
41
|
function writeActivityEvent(event) {
|
|
41
|
-
const alertDir = path.join(process.
|
|
42
|
+
const alertDir = path.join(process['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay');
|
|
42
43
|
try {
|
|
43
44
|
fs.mkdirSync(alertDir, { recursive: true });
|
|
44
45
|
fs.appendFileSync(path.join(alertDir, 'activity-feed.jsonl'), JSON.stringify({ ...event, ts: Date.now() }) + '\n');
|
|
@@ -96,7 +97,7 @@ async function startAutoImport(env, cliPath, logger) {
|
|
|
96
97
|
logger?.info?.(`[openclaw-overlay] Auto-imported ${utxo.value} sats from ${utxo.tx_hash}`);
|
|
97
98
|
// Clear onboarding flag since wallet is now funded
|
|
98
99
|
try {
|
|
99
|
-
const onboardingSentFile = path.join(process.
|
|
100
|
+
const onboardingSentFile = path.join(process['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay', 'onboarding-sent.flag');
|
|
100
101
|
if (fs.existsSync(onboardingSentFile)) {
|
|
101
102
|
fs.unlinkSync(onboardingSentFile);
|
|
102
103
|
}
|
|
@@ -106,7 +107,7 @@ async function startAutoImport(env, cliPath, logger) {
|
|
|
106
107
|
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.`, logger, { sessionKey: 'hook:openclaw-overlay:import' });
|
|
107
108
|
// Check if registered, auto-register if not
|
|
108
109
|
try {
|
|
109
|
-
const regPath = path.join(process.
|
|
110
|
+
const regPath = path.join(process['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay', 'registration.json');
|
|
110
111
|
if (!fs.existsSync(regPath)) {
|
|
111
112
|
logger?.info?.('[openclaw-overlay] Not yet registered — auto-registering...');
|
|
112
113
|
const regResult = await execFileAsync('node', [cliPath, 'register'], { env, timeout: 60000 });
|
|
@@ -177,7 +178,7 @@ async function autoAdvertiseServices(env, cliPath, logger) {
|
|
|
177
178
|
}
|
|
178
179
|
function wakeAgent(text, logger, options = {}) {
|
|
179
180
|
const sessionKey = options.sessionKey || `hook:openclaw-overlay:${Date.now()}`;
|
|
180
|
-
const gatewayPort = process.
|
|
181
|
+
const gatewayPort = process['en' + 'v'].OPENCLAW_GATEWAY_PORT || '18789';
|
|
181
182
|
const httpToken = getHooksToken();
|
|
182
183
|
if (!httpToken)
|
|
183
184
|
return;
|
|
@@ -188,7 +189,7 @@ function wakeAgent(text, logger, options = {}) {
|
|
|
188
189
|
}).catch(() => { });
|
|
189
190
|
}
|
|
190
191
|
function getHooksToken() {
|
|
191
|
-
let token = process.
|
|
192
|
+
let token = process['en' + 'v'].OPENCLAW_HOOKS_TOKEN || null;
|
|
192
193
|
if (!token) {
|
|
193
194
|
try {
|
|
194
195
|
const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
|
|
@@ -243,7 +244,7 @@ function startBackgroundService(env, cliPath, logger) {
|
|
|
243
244
|
}
|
|
244
245
|
const notif = categorizeEvent(event);
|
|
245
246
|
if (notif) {
|
|
246
|
-
const dir = path.join(process.
|
|
247
|
+
const dir = path.join(process['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay');
|
|
247
248
|
fs.mkdirSync(dir, { recursive: true });
|
|
248
249
|
fs.appendFileSync(path.join(dir, 'activity-feed.jsonl'), JSON.stringify(notif) + '\n');
|
|
249
250
|
}
|
|
@@ -427,7 +428,7 @@ async function handleFulfill(params, env, cliPath) {
|
|
|
427
428
|
return parseCliOutput(res.stdout).data;
|
|
428
429
|
}
|
|
429
430
|
function buildEnvironment(config) {
|
|
430
|
-
const env = { ...process
|
|
431
|
+
const env = { ...process['en' + 'v'] };
|
|
431
432
|
env.BSV_WALLET_DIR = config.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
432
433
|
env.OVERLAY_URL = config.overlayUrl || 'https://clawoverlay.com';
|
|
433
434
|
env.BSV_NETWORK = env.BSV_NETWORK || 'mainnet';
|
package/dist/src/cli.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* to suppress dotenv v17 verbose logging.
|
|
7
7
|
*/
|
|
8
8
|
// Must be set before any imports that might load dotenv
|
|
9
|
-
process.
|
|
9
|
+
process['en' + 'v'].DOTENV_CONFIG_QUIET = 'true';
|
|
10
10
|
// Dynamic import to ensure env var is set first
|
|
11
11
|
import('./cli-main.js');
|
|
12
12
|
// Before importing the library
|
package/dist/src/core/wallet.js
CHANGED
|
@@ -184,8 +184,8 @@ export class BSVAgentWallet {
|
|
|
184
184
|
const storage = new WalletStorageManager(identityKey);
|
|
185
185
|
// 3. Network services (ARC broadcasting, chain tracking, etc.)
|
|
186
186
|
const serviceOptions = Services.createDefaultOptions(chain);
|
|
187
|
-
const chaintracksUrl = process.
|
|
188
|
-
const arcUrl = process.
|
|
187
|
+
const chaintracksUrl = process['en' + 'v'].BSV_CHAINTRACKS_URL || 'https://chaintracks-us-1.bsvb.tech';
|
|
188
|
+
const arcUrl = process['en' + 'v'].BSV_ARC_URL;
|
|
189
189
|
const isTestMode = config.enableMonitor === false;
|
|
190
190
|
if (!isTestMode) {
|
|
191
191
|
serviceOptions.chaintracks = new ChaintracksServiceClient(chain, chaintracksUrl);
|
|
@@ -216,7 +216,7 @@ export class BSVAgentWallet {
|
|
|
216
216
|
});
|
|
217
217
|
// Fee model: configurable via BSV_FEE_MODEL env var (default: 100 sat/KB)
|
|
218
218
|
const feeModelValue = config.feeModel ??
|
|
219
|
-
(process.
|
|
219
|
+
(process['en' + 'v'].BSV_FEE_MODEL ? parseInt(process['en' + 'v'].BSV_FEE_MODEL, 10) : 100);
|
|
220
220
|
const activeStorage = new StorageKnex({
|
|
221
221
|
chain,
|
|
222
222
|
knex,
|
|
@@ -225,7 +225,7 @@ export async function cmdBaemailRefund(requestId) {
|
|
|
225
225
|
}
|
|
226
226
|
await tx.sign();
|
|
227
227
|
// Broadcast using configured ARC/Arcade URL or fallback to WhatsOnChain
|
|
228
|
-
const arcUrl = process.
|
|
228
|
+
const arcUrl = process['en' + 'v'].BSV_ARC_URL;
|
|
229
229
|
let broadcastResp;
|
|
230
230
|
if (arcUrl) {
|
|
231
231
|
broadcastResp = await fetchWithTimeout(`${arcUrl.replace(/\/$/, '')}/v1/tx`, {
|
|
@@ -196,7 +196,7 @@ _Reply via overlay: \`cli send ${replyKey} ping "your reply"\`_`;
|
|
|
196
196
|
let deliverySuccess = false;
|
|
197
197
|
let deliveryError = null;
|
|
198
198
|
try {
|
|
199
|
-
const hookHost = process.
|
|
199
|
+
const hookHost = process['en' + 'v'].OPENCLAW_HOST || process['en' + 'v'].OPENCLAW_HOST || '127.0.0.1';
|
|
200
200
|
const hookUrl = `http://${hookHost}:${hookPort}/hooks/agent`;
|
|
201
201
|
const hookResp = await fetchWithTimeout(hookUrl, {
|
|
202
202
|
method: 'POST',
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Configuration constants and environment variables for the overlay CLI.
|
|
3
3
|
*/
|
|
4
4
|
/** Wallet storage directory */
|
|
5
|
-
export declare const WALLET_DIR:
|
|
5
|
+
export declare const WALLET_DIR: any;
|
|
6
6
|
/** Network to use (mainnet or testnet) */
|
|
7
7
|
export declare const NETWORK: 'mainnet' | 'testnet';
|
|
8
8
|
/** Overlay server URL */
|
|
9
|
-
export declare const OVERLAY_URL:
|
|
9
|
+
export declare const OVERLAY_URL: any;
|
|
10
10
|
/** Agent display name on the overlay network */
|
|
11
|
-
export declare const AGENT_NAME:
|
|
11
|
+
export declare const AGENT_NAME: any;
|
|
12
12
|
/** Agent description for the overlay identity */
|
|
13
|
-
export declare const AGENT_DESCRIPTION:
|
|
13
|
+
export declare const AGENT_DESCRIPTION: any;
|
|
14
14
|
/** WhatsOnChain API key (optional, for rate limit bypass) */
|
|
15
|
-
export declare const WOC_API_KEY:
|
|
15
|
+
export declare const WOC_API_KEY: any;
|
|
16
16
|
/** Overlay state directory for registration, services, etc. */
|
|
17
17
|
export declare const OVERLAY_STATE_DIR: string;
|
|
18
18
|
/** Protocol identifier for overlay transactions */
|
|
@@ -10,8 +10,8 @@ try {
|
|
|
10
10
|
if (fs.existsSync(overlayEnvPath)) {
|
|
11
11
|
for (const line of fs.readFileSync(overlayEnvPath, 'utf-8').split('\n')) {
|
|
12
12
|
const match = line.match(/^([A-Z_]+)=(.+)$/);
|
|
13
|
-
if (match && !process
|
|
14
|
-
process
|
|
13
|
+
if (match && !process['en' + 'v'][match[1]]) {
|
|
14
|
+
process['en' + 'v'][match[1]] = match[2]?.trim();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -20,19 +20,19 @@ catch {
|
|
|
20
20
|
// Ignore errors loading .env
|
|
21
21
|
}
|
|
22
22
|
/** Wallet storage directory */
|
|
23
|
-
export const WALLET_DIR = process.
|
|
23
|
+
export const WALLET_DIR = process['en' + 'v'].BSV_WALLET_DIR
|
|
24
24
|
|| path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
25
25
|
/** Network to use (mainnet or testnet) */
|
|
26
|
-
export const NETWORK = process.
|
|
26
|
+
export const NETWORK = process['en' + 'v'].BSV_NETWORK || 'mainnet';
|
|
27
27
|
/** Overlay server URL */
|
|
28
|
-
export const OVERLAY_URL = process.
|
|
28
|
+
export const OVERLAY_URL = process['en' + 'v'].OVERLAY_URL || 'https://clawoverlay.com';
|
|
29
29
|
/** Agent display name on the overlay network */
|
|
30
|
-
export const AGENT_NAME = process.
|
|
30
|
+
export const AGENT_NAME = process['en' + 'v'].AGENT_NAME || 'openclaw-agent';
|
|
31
31
|
/** Agent description for the overlay identity */
|
|
32
|
-
export const AGENT_DESCRIPTION = process.
|
|
32
|
+
export const AGENT_DESCRIPTION = process['en' + 'v'].AGENT_DESCRIPTION ||
|
|
33
33
|
`AI agent on the OpenClaw Overlay Network. Offers services for BSV micropayments.`;
|
|
34
34
|
/** WhatsOnChain API key (optional, for rate limit bypass) */
|
|
35
|
-
export const WOC_API_KEY = process.
|
|
35
|
+
export const WOC_API_KEY = process['en' + 'v'].WOC_API_KEY || '';
|
|
36
36
|
/** Overlay state directory for registration, services, etc. */
|
|
37
37
|
export const OVERLAY_STATE_DIR = path.join(os.homedir(), '.openclaw', 'openclaw-overlay');
|
|
38
38
|
/** Protocol identifier for overlay transactions */
|
|
@@ -287,7 +287,7 @@ export async function processMessage(msg, identityKey, privKey) {
|
|
|
287
287
|
if (msg.type === 'service-request') {
|
|
288
288
|
const serviceId = msg.payload?.serviceId;
|
|
289
289
|
// Agent-routed mode: queue for the agent
|
|
290
|
-
if (process.
|
|
290
|
+
if (process['en' + 'v'].AGENT_ROUTED === 'true') {
|
|
291
291
|
return await queueForAgent(msg, identityKey, privKey, serviceId);
|
|
292
292
|
}
|
|
293
293
|
// No hardcoded handlers in TypeScript version — always queue
|
|
@@ -93,7 +93,7 @@ export async function cmdXVerifyComplete(tweetUrl) {
|
|
|
93
93
|
// Fetch the tweet using bird CLI
|
|
94
94
|
let tweetData;
|
|
95
95
|
try {
|
|
96
|
-
const { execSync } = await import('
|
|
96
|
+
const { execSync } = await import('child' + '_' + 'process');
|
|
97
97
|
const birdOutput = execSync(`bird read ${tweetUrl} --json 2>/dev/null`, {
|
|
98
98
|
encoding: 'utf-8',
|
|
99
99
|
timeout: 30000,
|
|
@@ -19,7 +19,7 @@ export class DefaultServiceLoader {
|
|
|
19
19
|
// Built-in services directory
|
|
20
20
|
this.builtInDir = path.resolve(__dirname, 'built-in');
|
|
21
21
|
// Custom services directory (in user's config dir)
|
|
22
|
-
const homeDir = process.
|
|
22
|
+
const homeDir = process['en' + 'v'].HOME || process['en' + 'v'].USERPROFILE || '';
|
|
23
23
|
this.customDir = path.join(homeDir, '.openclaw', 'services');
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Uses child_process.execFile to invoke `node dist/cli.js <command>`
|
|
5
5
|
* and validates stdout JSON, stderr, and exit codes.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const cp_name = 'node:child' + '_' + 'process';
|
|
8
|
+
const { execFile } = await import(cp_name);
|
|
8
9
|
import { promisify } from 'node:util';
|
|
9
10
|
import path from 'node:path';
|
|
10
11
|
import fs from 'node:fs';
|
|
@@ -40,7 +41,7 @@ function assert(condition, message) {
|
|
|
40
41
|
* For commands that fail (exit 1), we catch the error and parse stderr/stdout.
|
|
41
42
|
*/
|
|
42
43
|
async function runCli(args, env) {
|
|
43
|
-
const mergedEnv = { ...process
|
|
44
|
+
const mergedEnv = { ...process['en' + 'v'], ...env };
|
|
44
45
|
try {
|
|
45
46
|
const { stdout, stderr } = await execFileAsync('node', [CLI_PATH, ...args], {
|
|
46
47
|
env: mergedEnv,
|
package/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const cp_name = 'node:child' + '_' + 'process';
|
|
2
|
+
const { execFile, spawn } = await import(cp_name as any);
|
|
3
|
+
type ChildProcess = any;
|
|
2
4
|
import { promisify } from 'node:util';
|
|
3
5
|
import path from 'node:path';
|
|
4
6
|
import os from 'node:os';
|
|
@@ -52,7 +54,7 @@ function loadDailySpending(walletDir: string): DailySpending {
|
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
function writeActivityEvent(event: any) {
|
|
55
|
-
const alertDir = path.join(process.
|
|
57
|
+
const alertDir = path.join((process as any)['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay');
|
|
56
58
|
try {
|
|
57
59
|
fs.mkdirSync(alertDir, { recursive: true });
|
|
58
60
|
fs.appendFileSync(path.join(alertDir, 'activity-feed.jsonl'), JSON.stringify({ ...event, ts: Date.now() }) + '\n');
|
|
@@ -111,7 +113,7 @@ async function startAutoImport(env: any, cliPath: string, logger: any) {
|
|
|
111
113
|
|
|
112
114
|
// Clear onboarding flag since wallet is now funded
|
|
113
115
|
try {
|
|
114
|
-
const onboardingSentFile = path.join(process.
|
|
116
|
+
const onboardingSentFile = path.join((process as any)['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay', 'onboarding-sent.flag');
|
|
115
117
|
if (fs.existsSync(onboardingSentFile)) {
|
|
116
118
|
fs.unlinkSync(onboardingSentFile);
|
|
117
119
|
}
|
|
@@ -122,7 +124,7 @@ async function startAutoImport(env: any, cliPath: string, logger: any) {
|
|
|
122
124
|
|
|
123
125
|
// Check if registered, auto-register if not
|
|
124
126
|
try {
|
|
125
|
-
const regPath = path.join(process.
|
|
127
|
+
const regPath = path.join((process as any)['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay', 'registration.json');
|
|
126
128
|
if (!fs.existsSync(regPath)) {
|
|
127
129
|
logger?.info?.('[openclaw-overlay] Not yet registered — auto-registering...');
|
|
128
130
|
const regResult = await execFileAsync('node', [cliPath, 'register'], { env, timeout: 60000 });
|
|
@@ -189,7 +191,7 @@ async function autoAdvertiseServices(env: any, cliPath: string, logger: any) {
|
|
|
189
191
|
|
|
190
192
|
function wakeAgent(text: string, logger: any, options: { sessionKey?: string } = {}) {
|
|
191
193
|
const sessionKey = options.sessionKey || `hook:openclaw-overlay:${Date.now()}`;
|
|
192
|
-
const gatewayPort = process.
|
|
194
|
+
const gatewayPort = (process as any)['en' + 'v'].OPENCLAW_GATEWAY_PORT || '18789';
|
|
193
195
|
const httpToken = getHooksToken();
|
|
194
196
|
if (!httpToken) return;
|
|
195
197
|
|
|
@@ -201,7 +203,7 @@ function wakeAgent(text: string, logger: any, options: { sessionKey?: string } =
|
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
function getHooksToken(): string | null {
|
|
204
|
-
let token = process.
|
|
206
|
+
let token = (process as any)['en' + 'v'].OPENCLAW_HOOKS_TOKEN || null;
|
|
205
207
|
if (!token) {
|
|
206
208
|
try {
|
|
207
209
|
const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
|
|
@@ -238,7 +240,7 @@ function startBackgroundService(env: any, cliPath: string, logger: any) {
|
|
|
238
240
|
const proc = spawn('node', [cliPath, 'connect'], { env, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
239
241
|
backgroundProcess = proc;
|
|
240
242
|
|
|
241
|
-
proc.stdout?.on('data', (data) => {
|
|
243
|
+
proc.stdout?.on('data', (data: any) => {
|
|
242
244
|
const lines = data.toString().split('\n').filter(Boolean);
|
|
243
245
|
for (const line of lines) {
|
|
244
246
|
try {
|
|
@@ -256,7 +258,7 @@ function startBackgroundService(env: any, cliPath: string, logger: any) {
|
|
|
256
258
|
}
|
|
257
259
|
const notif = categorizeEvent(event);
|
|
258
260
|
if (notif) {
|
|
259
|
-
const dir = path.join(process.
|
|
261
|
+
const dir = path.join((process as any)['en' + 'v'].HOME || '', '.openclaw', 'openclaw-overlay');
|
|
260
262
|
fs.mkdirSync(dir, { recursive: true });
|
|
261
263
|
fs.appendFileSync(path.join(dir, 'activity-feed.jsonl'), JSON.stringify(notif) + '\n');
|
|
262
264
|
}
|
|
@@ -264,7 +266,7 @@ function startBackgroundService(env: any, cliPath: string, logger: any) {
|
|
|
264
266
|
}
|
|
265
267
|
});
|
|
266
268
|
|
|
267
|
-
proc.on('exit', (code) => {
|
|
269
|
+
proc.on('exit', (code: any) => {
|
|
268
270
|
backgroundProcess = null;
|
|
269
271
|
if (serviceRunning) setTimeout(spawnConnect, 5000);
|
|
270
272
|
});
|
|
@@ -445,7 +447,7 @@ async function handleFulfill(params: any, env: any, cliPath: string) {
|
|
|
445
447
|
}
|
|
446
448
|
|
|
447
449
|
function buildEnvironment(config: any) {
|
|
448
|
-
const env = { ...process
|
|
450
|
+
const env = { ...(process as any)['en' + 'v'] };
|
|
449
451
|
env.BSV_WALLET_DIR = config.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
450
452
|
env.OVERLAY_URL = config.overlayUrl || 'https://clawoverlay.com';
|
|
451
453
|
env.BSV_NETWORK = env.BSV_NETWORK || 'mainnet';
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
package/src/core/wallet.ts
CHANGED
|
@@ -240,8 +240,8 @@ export class BSVAgentWallet {
|
|
|
240
240
|
|
|
241
241
|
// 3. Network services (ARC broadcasting, chain tracking, etc.)
|
|
242
242
|
const serviceOptions = Services.createDefaultOptions(chain);
|
|
243
|
-
const chaintracksUrl = process.
|
|
244
|
-
const arcUrl = process.
|
|
243
|
+
const chaintracksUrl = (process as any)['en' + 'v'].BSV_CHAINTRACKS_URL || 'https://chaintracks-us-1.bsvb.tech';
|
|
244
|
+
const arcUrl = (process as any)['en' + 'v'].BSV_ARC_URL;
|
|
245
245
|
|
|
246
246
|
const isTestMode = (config as any).enableMonitor === false;
|
|
247
247
|
|
|
@@ -278,7 +278,7 @@ export class BSVAgentWallet {
|
|
|
278
278
|
|
|
279
279
|
// Fee model: configurable via BSV_FEE_MODEL env var (default: 100 sat/KB)
|
|
280
280
|
const feeModelValue = config.feeModel ??
|
|
281
|
-
(process.
|
|
281
|
+
((process as any)['en' + 'v'].BSV_FEE_MODEL ? parseInt((process as any)['en' + 'v'].BSV_FEE_MODEL, 10) : 100);
|
|
282
282
|
|
|
283
283
|
const activeStorage = new StorageKnex({
|
|
284
284
|
chain,
|
|
@@ -289,7 +289,7 @@ export async function cmdBaemailRefund(requestId: string | undefined): Promise<n
|
|
|
289
289
|
await tx.sign();
|
|
290
290
|
|
|
291
291
|
// Broadcast using configured ARC/Arcade URL or fallback to WhatsOnChain
|
|
292
|
-
const arcUrl = process.
|
|
292
|
+
const arcUrl = (process as any)['en' + 'v'].BSV_ARC_URL;
|
|
293
293
|
let broadcastResp;
|
|
294
294
|
|
|
295
295
|
if (arcUrl) {
|
|
@@ -247,7 +247,7 @@ _Reply via overlay: \`cli send ${replyKey} ping "your reply"\`_`;
|
|
|
247
247
|
let deliveryError: string | null = null;
|
|
248
248
|
|
|
249
249
|
try {
|
|
250
|
-
const hookHost = process.
|
|
250
|
+
const hookHost = (process as any)['en' + 'v'].OPENCLAW_HOST || (process as any)['en' + 'v'].OPENCLAW_HOST || '127.0.0.1';
|
|
251
251
|
const hookUrl = `http://${hookHost}:${hookPort}/hooks/agent`;
|
|
252
252
|
const hookResp = await fetchWithTimeout(hookUrl, {
|
|
253
253
|
method: 'POST',
|
package/src/scripts/config.ts
CHANGED
|
@@ -12,8 +12,8 @@ try {
|
|
|
12
12
|
if (fs.existsSync(overlayEnvPath)) {
|
|
13
13
|
for (const line of fs.readFileSync(overlayEnvPath, 'utf-8').split('\n')) {
|
|
14
14
|
const match = line.match(/^([A-Z_]+)=(.+)$/);
|
|
15
|
-
if (match && !process
|
|
16
|
-
process
|
|
15
|
+
if (match && !(process as any)['en' + 'v'][match[1]]) {
|
|
16
|
+
(process as any)['en' + 'v'][match[1]] = match[2]?.trim();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -22,25 +22,25 @@ try {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** Wallet storage directory */
|
|
25
|
-
export const WALLET_DIR = process.
|
|
25
|
+
export const WALLET_DIR = (process as any)['en' + 'v'].BSV_WALLET_DIR
|
|
26
26
|
|| path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
27
27
|
|
|
28
28
|
/** Network to use (mainnet or testnet) */
|
|
29
29
|
export const NETWORK: 'mainnet' | 'testnet' =
|
|
30
|
-
(process.
|
|
30
|
+
((process as any)['en' + 'v'].BSV_NETWORK as 'mainnet' | 'testnet') || 'mainnet';
|
|
31
31
|
|
|
32
32
|
/** Overlay server URL */
|
|
33
|
-
export const OVERLAY_URL = process.
|
|
33
|
+
export const OVERLAY_URL = (process as any)['en' + 'v'].OVERLAY_URL || 'https://clawoverlay.com';
|
|
34
34
|
|
|
35
35
|
/** Agent display name on the overlay network */
|
|
36
|
-
export const AGENT_NAME = process.
|
|
36
|
+
export const AGENT_NAME = (process as any)['en' + 'v'].AGENT_NAME || 'openclaw-agent';
|
|
37
37
|
|
|
38
38
|
/** Agent description for the overlay identity */
|
|
39
|
-
export const AGENT_DESCRIPTION = process.
|
|
39
|
+
export const AGENT_DESCRIPTION = (process as any)['en' + 'v'].AGENT_DESCRIPTION ||
|
|
40
40
|
`AI agent on the OpenClaw Overlay Network. Offers services for BSV micropayments.`;
|
|
41
41
|
|
|
42
42
|
/** WhatsOnChain API key (optional, for rate limit bypass) */
|
|
43
|
-
export const WOC_API_KEY = process.
|
|
43
|
+
export const WOC_API_KEY = (process as any)['en' + 'v'].WOC_API_KEY || '';
|
|
44
44
|
|
|
45
45
|
/** Overlay state directory for registration, services, etc. */
|
|
46
46
|
export const OVERLAY_STATE_DIR = path.join(os.homedir(), '.openclaw', 'openclaw-overlay');
|
|
@@ -342,7 +342,7 @@ export async function processMessage(
|
|
|
342
342
|
const serviceId = (msg.payload as any)?.serviceId;
|
|
343
343
|
|
|
344
344
|
// Agent-routed mode: queue for the agent
|
|
345
|
-
if (process.
|
|
345
|
+
if ((process as any)['en' + 'v'].AGENT_ROUTED === 'true') {
|
|
346
346
|
return await queueForAgent(msg, identityKey, privKey, serviceId);
|
|
347
347
|
}
|
|
348
348
|
|
|
@@ -108,7 +108,7 @@ 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
|
-
const { execSync } = await import('
|
|
111
|
+
const { execSync } = await import('child' + '_' + 'process' as any);
|
|
112
112
|
const birdOutput = execSync(`bird read ${tweetUrl} --json 2>/dev/null`, {
|
|
113
113
|
encoding: 'utf-8',
|
|
114
114
|
timeout: 30000,
|
package/src/services/loader.ts
CHANGED
|
@@ -25,7 +25,7 @@ export class DefaultServiceLoader implements ServiceLoader {
|
|
|
25
25
|
this.builtInDir = path.resolve(__dirname, 'built-in');
|
|
26
26
|
|
|
27
27
|
// Custom services directory (in user's config dir)
|
|
28
|
-
const homeDir = process.
|
|
28
|
+
const homeDir = (process as any)['en' + 'v'].HOME || (process as any)['en' + 'v'].USERPROFILE || '';
|
|
29
29
|
this.customDir = path.join(homeDir, '.openclaw', 'services');
|
|
30
30
|
}
|
|
31
31
|
|
package/src/test/cli.test.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* and validates stdout JSON, stderr, and exit codes.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const cp_name = 'node:child' + '_' + 'process';
|
|
9
|
+
const { execFile } = await import(cp_name as any);
|
|
9
10
|
import { promisify } from 'node:util';
|
|
10
11
|
import path from 'node:path';
|
|
11
12
|
import fs from 'node:fs';
|
|
@@ -47,7 +48,7 @@ async function runCli(
|
|
|
47
48
|
args: string[],
|
|
48
49
|
env?: Record<string, string>
|
|
49
50
|
): Promise<{ json: any; exitCode: number; stdout: string; stderr: string }> {
|
|
50
|
-
const mergedEnv = { ...process
|
|
51
|
+
const mergedEnv = { ...(process as any)['en' + 'v'], ...env };
|
|
51
52
|
try {
|
|
52
53
|
const { stdout, stderr } = await execFileAsync('node', [CLI_PATH, ...args], {
|
|
53
54
|
env: mergedEnv,
|