nyxora 26.6.13 → 26.6.14
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/launcher.js +11 -3
- package/dist/packages/core/src/config/parser.js +42 -3
- package/dist/packages/core/src/gateway/server.js +20 -0
- package/dist/packages/core/src/gateway/setup.js +1 -0
- package/launcher.ts +10 -3
- package/package.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/src/config/parser.ts +42 -3
- package/packages/core/src/gateway/server.ts +21 -1
- package/packages/core/src/gateway/setup.ts +2 -1
- package/packages/dashboard/dist/assets/{index-BhKhEfi_.js → index-BKkezv4e.js} +3 -3
- package/packages/dashboard/dist/index.html +1 -1
- package/packages/dashboard/package.json +1 -1
- package/packages/mcp-server/package.json +1 -1
- package/packages/policy/package.json +1 -1
- package/packages/signer/package.json +1 -1
package/dist/launcher.js
CHANGED
|
@@ -36,7 +36,15 @@ const spawnService = (name, command, args, env, inheritStdio = false) => {
|
|
|
36
36
|
child = (0, child_process_1.spawn)(command, args, { env, stdio: inheritStdio ? 'inherit' : 'pipe' });
|
|
37
37
|
if (!inheritStdio) {
|
|
38
38
|
child.stdout?.on('data', (data) => process.stdout.write(`[${name}] ${data}`));
|
|
39
|
-
child.stderr?.on('data', (data) =>
|
|
39
|
+
child.stderr?.on('data', (data) => {
|
|
40
|
+
const msg = data.toString();
|
|
41
|
+
if (msg.toLowerCase().includes('warn')) {
|
|
42
|
+
process.stderr.write(`[${name}] ${msg}`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
process.stderr.write(`[${name}] ERROR: ${msg}`);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
40
48
|
}
|
|
41
49
|
child.on('close', async (code) => {
|
|
42
50
|
console.log(`[${name}] Exited with code ${code}`);
|
|
@@ -101,8 +109,8 @@ if (fs_1.default.existsSync(socketPath)) {
|
|
|
101
109
|
const children = [];
|
|
102
110
|
const isCompiled = __filename.endsWith('.js');
|
|
103
111
|
const ext = isCompiled ? '.js' : '.ts';
|
|
104
|
-
const cmd = isCompiled ? 'node' : '
|
|
105
|
-
const baseArgs = isCompiled ? [] : ['
|
|
112
|
+
const cmd = isCompiled ? 'node' : path_1.default.join(__dirname, 'node_modules', '.bin', 'ts-node');
|
|
113
|
+
const baseArgs = isCompiled ? [] : ['-T'];
|
|
106
114
|
const signerPath = path_1.default.join(__dirname, `packages/signer/src/server${ext}`);
|
|
107
115
|
const signer = spawnService('Signer', cmd, [...baseArgs, signerPath], env);
|
|
108
116
|
children.push(signer);
|
|
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadRpcConfig = loadRpcConfig;
|
|
7
|
+
exports.saveRpcConfig = saveRpcConfig;
|
|
6
8
|
exports.loadApiKeys = loadApiKeys;
|
|
7
9
|
exports.saveApiKeys = saveApiKeys;
|
|
8
10
|
exports.loadConfig = loadConfig;
|
|
@@ -10,6 +12,27 @@ exports.saveConfig = saveConfig;
|
|
|
10
12
|
const fs_1 = __importDefault(require("fs"));
|
|
11
13
|
const yaml_1 = __importDefault(require("yaml"));
|
|
12
14
|
const paths_1 = require("./paths");
|
|
15
|
+
function loadRpcConfig() {
|
|
16
|
+
const rpcPath = (0, paths_1.getPath)('rpc_key.yaml');
|
|
17
|
+
if (fs_1.default.existsSync(rpcPath)) {
|
|
18
|
+
try {
|
|
19
|
+
return yaml_1.default.parse(fs_1.default.readFileSync(rpcPath, 'utf8')) || {};
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
console.error('[Config] Failed to parse rpc_key.yaml', e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
function saveRpcConfig(rpcUrls) {
|
|
28
|
+
const rpcPath = (0, paths_1.getPath)('rpc_key.yaml');
|
|
29
|
+
try {
|
|
30
|
+
fs_1.default.writeFileSync(rpcPath, yaml_1.default.stringify(rpcUrls), 'utf8');
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error('Failed to save rpc_key.yaml', error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
13
36
|
async function loadApiKeys() {
|
|
14
37
|
const config = loadConfig();
|
|
15
38
|
return config.credentials || {};
|
|
@@ -23,6 +46,8 @@ async function saveApiKeys(newKeys) {
|
|
|
23
46
|
}
|
|
24
47
|
function loadConfig() {
|
|
25
48
|
const configPath = (0, paths_1.getPath)('config.yaml');
|
|
49
|
+
const rpcPath = (0, paths_1.getPath)('rpc_key.yaml');
|
|
50
|
+
let rpcUrls = loadRpcConfig();
|
|
26
51
|
try {
|
|
27
52
|
const file = fs_1.default.readFileSync(configPath, 'utf8');
|
|
28
53
|
const parsed = yaml_1.default.parse(file);
|
|
@@ -41,6 +66,16 @@ function loadConfig() {
|
|
|
41
66
|
delete parsed.llm.credentials;
|
|
42
67
|
needsSave = true;
|
|
43
68
|
}
|
|
69
|
+
// Auto-migration logic: move web3.rpc_urls to rpc_key.yaml
|
|
70
|
+
if (parsed.web3 && parsed.web3.rpc_urls && Object.keys(parsed.web3.rpc_urls).length > 0) {
|
|
71
|
+
if (!fs_1.default.existsSync(rpcPath)) {
|
|
72
|
+
rpcUrls = parsed.web3.rpc_urls;
|
|
73
|
+
saveRpcConfig(rpcUrls);
|
|
74
|
+
console.log('[Config] Auto-migrated web3.rpc_urls to rpc_key.yaml.');
|
|
75
|
+
}
|
|
76
|
+
delete parsed.web3.rpc_urls;
|
|
77
|
+
needsSave = true;
|
|
78
|
+
}
|
|
44
79
|
if (needsSave) {
|
|
45
80
|
try {
|
|
46
81
|
const yamlStr = yaml_1.default.stringify(parsed);
|
|
@@ -65,7 +100,7 @@ function loadConfig() {
|
|
|
65
100
|
},
|
|
66
101
|
credentials: parsed.credentials || {},
|
|
67
102
|
memory: parsed.memory || { type: 'file', path: './memory.json' },
|
|
68
|
-
web3: parsed.web3
|
|
103
|
+
web3: { ...parsed.web3, rpc_urls: rpcUrls },
|
|
69
104
|
integrations: parsed.integrations || {
|
|
70
105
|
telegram: { enabled: false }
|
|
71
106
|
},
|
|
@@ -102,7 +137,7 @@ function loadConfig() {
|
|
|
102
137
|
},
|
|
103
138
|
credentials: {},
|
|
104
139
|
memory: { type: 'file', path: './memory.json' },
|
|
105
|
-
web3: { rpc_urls:
|
|
140
|
+
web3: { rpc_urls: rpcUrls },
|
|
106
141
|
integrations: {
|
|
107
142
|
telegram: { enabled: false }
|
|
108
143
|
},
|
|
@@ -116,7 +151,11 @@ function loadConfig() {
|
|
|
116
151
|
function saveConfig(newConfig) {
|
|
117
152
|
const configPath = (0, paths_1.getPath)('config.yaml');
|
|
118
153
|
try {
|
|
119
|
-
const
|
|
154
|
+
const configToSave = JSON.parse(JSON.stringify(newConfig));
|
|
155
|
+
if (configToSave.web3 && configToSave.web3.rpc_urls) {
|
|
156
|
+
delete configToSave.web3.rpc_urls;
|
|
157
|
+
}
|
|
158
|
+
const yamlStr = yaml_1.default.stringify(configToSave);
|
|
120
159
|
fs_1.default.writeFileSync(configPath, yamlStr, 'utf8');
|
|
121
160
|
}
|
|
122
161
|
catch (error) {
|
|
@@ -264,6 +264,26 @@ app.post('/api/config', (req, res) => {
|
|
|
264
264
|
res.status(500).json({ error: error.message });
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
|
+
app.get('/api/rpc', (req, res) => {
|
|
268
|
+
try {
|
|
269
|
+
const rpcConfig = (0, parser_1.loadRpcConfig)();
|
|
270
|
+
res.json(rpcConfig);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
res.status(500).json({ error: error.message });
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
app.post('/api/rpc', (req, res) => {
|
|
277
|
+
try {
|
|
278
|
+
const currentRpc = (0, parser_1.loadRpcConfig)();
|
|
279
|
+
const newRpc = { ...currentRpc, ...req.body };
|
|
280
|
+
(0, parser_1.saveRpcConfig)(newRpc);
|
|
281
|
+
res.json({ success: true });
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
res.status(500).json({ error: error.message });
|
|
285
|
+
}
|
|
286
|
+
});
|
|
267
287
|
app.get('/api/defi-keys', (req, res) => {
|
|
268
288
|
try {
|
|
269
289
|
const keys = (0, defiConfigManager_1.loadDefiKeys)();
|
|
@@ -424,6 +424,7 @@ Provider: ${config.llm.provider}`;
|
|
|
424
424
|
config.integrations.telegram.authorized_chat_id = authorizedChatId;
|
|
425
425
|
}
|
|
426
426
|
(0, parser_1.saveConfig)(config);
|
|
427
|
+
(0, parser_1.saveRpcConfig)({});
|
|
427
428
|
// Sync disabled_skills.json based on user selection
|
|
428
429
|
const allWeb3Skills = [
|
|
429
430
|
'transfer', 'swapToken', 'bridgeToken', 'customTx', 'mintNft',
|
package/launcher.ts
CHANGED
|
@@ -38,7 +38,14 @@ const spawnService = (name: string, command: string, args: string[], env: any, i
|
|
|
38
38
|
|
|
39
39
|
if (!inheritStdio) {
|
|
40
40
|
child.stdout?.on('data', (data) => process.stdout.write(`[${name}] ${data}`));
|
|
41
|
-
child.stderr?.on('data', (data) =>
|
|
41
|
+
child.stderr?.on('data', (data) => {
|
|
42
|
+
const msg = data.toString();
|
|
43
|
+
if (msg.toLowerCase().includes('warn')) {
|
|
44
|
+
process.stderr.write(`[${name}] ${msg}`);
|
|
45
|
+
} else {
|
|
46
|
+
process.stderr.write(`[${name}] ERROR: ${msg}`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
child.on('close', async (code) => {
|
|
@@ -111,8 +118,8 @@ const children: { kill: () => void }[] = [];
|
|
|
111
118
|
|
|
112
119
|
const isCompiled = __filename.endsWith('.js');
|
|
113
120
|
const ext = isCompiled ? '.js' : '.ts';
|
|
114
|
-
const cmd = isCompiled ? 'node' : '
|
|
115
|
-
const baseArgs = isCompiled ? [] : ['
|
|
121
|
+
const cmd = isCompiled ? 'node' : path.join(__dirname, 'node_modules', '.bin', 'ts-node');
|
|
122
|
+
const baseArgs = isCompiled ? [] : ['-T'];
|
|
116
123
|
|
|
117
124
|
const signerPath = path.join(__dirname, `packages/signer/src/server${ext}`);
|
|
118
125
|
const signer = spawnService('Signer', cmd, [...baseArgs, signerPath], env);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nyxora",
|
|
3
|
-
"version": "26.6.
|
|
3
|
+
"version": "26.6.14",
|
|
4
4
|
"description": "Your Personal Web3 Assistant",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web3",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"prepare": "npm run build --workspace=nyxora-dashboard || echo '⚠️ Build failed – dashboard UI may be missing'",
|
|
39
|
-
"dev": "concurrently -n \"BACKEND,FRONTEND\" -c \"blue,green\" \"
|
|
39
|
+
"dev": "concurrently -n \"BACKEND,FRONTEND\" -c \"blue,green\" \"./node_modules/.bin/ts-node -T launcher.ts\" \"npm run dev --workspace=nyxora-dashboard\"",
|
|
40
40
|
"start": "node ./bin/nyxora.mjs start",
|
|
41
41
|
"stop": "node ./bin/nyxora.mjs stop",
|
|
42
42
|
"restart": "node ./bin/nyxora.mjs restart",
|
|
@@ -3,6 +3,27 @@ import yaml from 'yaml';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { getPath } from './paths';
|
|
5
5
|
|
|
6
|
+
export function loadRpcConfig(): Record<string, string | string[]> {
|
|
7
|
+
const rpcPath = getPath('rpc_key.yaml');
|
|
8
|
+
if (fs.existsSync(rpcPath)) {
|
|
9
|
+
try {
|
|
10
|
+
return yaml.parse(fs.readFileSync(rpcPath, 'utf8')) || {};
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.error('[Config] Failed to parse rpc_key.yaml', e);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function saveRpcConfig(rpcUrls: Record<string, string | string[]>): void {
|
|
19
|
+
const rpcPath = getPath('rpc_key.yaml');
|
|
20
|
+
try {
|
|
21
|
+
fs.writeFileSync(rpcPath, yaml.stringify(rpcUrls), 'utf8');
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Failed to save rpc_key.yaml', error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
6
27
|
export async function loadApiKeys(): Promise<Record<string, string>> {
|
|
7
28
|
const config = loadConfig();
|
|
8
29
|
return config.credentials || {};
|
|
@@ -79,6 +100,9 @@ export interface NyxoraConfig {
|
|
|
79
100
|
|
|
80
101
|
export function loadConfig(): NyxoraConfig {
|
|
81
102
|
const configPath = getPath('config.yaml');
|
|
103
|
+
const rpcPath = getPath('rpc_key.yaml');
|
|
104
|
+
let rpcUrls = loadRpcConfig();
|
|
105
|
+
|
|
82
106
|
try {
|
|
83
107
|
const file = fs.readFileSync(configPath, 'utf8');
|
|
84
108
|
const parsed = yaml.parse(file) as Partial<NyxoraConfig>;
|
|
@@ -99,6 +123,17 @@ export function loadConfig(): NyxoraConfig {
|
|
|
99
123
|
needsSave = true;
|
|
100
124
|
}
|
|
101
125
|
|
|
126
|
+
// Auto-migration logic: move web3.rpc_urls to rpc_key.yaml
|
|
127
|
+
if (parsed.web3 && parsed.web3.rpc_urls && Object.keys(parsed.web3.rpc_urls).length > 0) {
|
|
128
|
+
if (!fs.existsSync(rpcPath)) {
|
|
129
|
+
rpcUrls = parsed.web3.rpc_urls;
|
|
130
|
+
saveRpcConfig(rpcUrls);
|
|
131
|
+
console.log('[Config] Auto-migrated web3.rpc_urls to rpc_key.yaml.');
|
|
132
|
+
}
|
|
133
|
+
delete parsed.web3.rpc_urls;
|
|
134
|
+
needsSave = true;
|
|
135
|
+
}
|
|
136
|
+
|
|
102
137
|
if (needsSave) {
|
|
103
138
|
try {
|
|
104
139
|
const yamlStr = yaml.stringify(parsed);
|
|
@@ -125,7 +160,7 @@ export function loadConfig(): NyxoraConfig {
|
|
|
125
160
|
},
|
|
126
161
|
credentials: parsed.credentials || {},
|
|
127
162
|
memory: parsed.memory || { type: 'file', path: './memory.json' },
|
|
128
|
-
web3: parsed.web3
|
|
163
|
+
web3: { ...parsed.web3, rpc_urls: rpcUrls },
|
|
129
164
|
integrations: parsed.integrations || {
|
|
130
165
|
telegram: { enabled: false }
|
|
131
166
|
},
|
|
@@ -160,7 +195,7 @@ export function loadConfig(): NyxoraConfig {
|
|
|
160
195
|
},
|
|
161
196
|
credentials: {},
|
|
162
197
|
memory: { type: 'file', path: './memory.json' },
|
|
163
|
-
web3: { rpc_urls:
|
|
198
|
+
web3: { rpc_urls: rpcUrls },
|
|
164
199
|
integrations: {
|
|
165
200
|
telegram: { enabled: false }
|
|
166
201
|
},
|
|
@@ -175,7 +210,11 @@ export function loadConfig(): NyxoraConfig {
|
|
|
175
210
|
export function saveConfig(newConfig: NyxoraConfig): void {
|
|
176
211
|
const configPath = getPath('config.yaml');
|
|
177
212
|
try {
|
|
178
|
-
const
|
|
213
|
+
const configToSave = JSON.parse(JSON.stringify(newConfig));
|
|
214
|
+
if (configToSave.web3 && configToSave.web3.rpc_urls) {
|
|
215
|
+
delete configToSave.web3.rpc_urls;
|
|
216
|
+
}
|
|
217
|
+
const yamlStr = yaml.stringify(configToSave);
|
|
179
218
|
fs.writeFileSync(configPath, yamlStr, 'utf8');
|
|
180
219
|
} catch (error) {
|
|
181
220
|
console.error('Failed to save config.yaml', error);
|
|
@@ -22,7 +22,7 @@ import { validateToken, getSessionToken } from '../utils/state';
|
|
|
22
22
|
|
|
23
23
|
import fs from 'fs';
|
|
24
24
|
import { processUserInput, logger } from '../agent/reasoning';
|
|
25
|
-
import { loadConfig, saveConfig } from '../config/parser';
|
|
25
|
+
import { loadConfig, saveConfig, loadRpcConfig, saveRpcConfig } from '../config/parser';
|
|
26
26
|
import { loadDefiKeys, saveDefiKeys } from '../config/defiConfigManager';
|
|
27
27
|
import { getPublicClient, SUPPORTED_CHAIN_NAMES, getAddress } from '../web3/config';
|
|
28
28
|
import { TOKEN_MAP, ERC20_ABI } from '../web3/utils/tokens';
|
|
@@ -287,6 +287,26 @@ app.post('/api/config', (req, res) => {
|
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
289
|
|
|
290
|
+
app.get('/api/rpc', (req, res) => {
|
|
291
|
+
try {
|
|
292
|
+
const rpcConfig = loadRpcConfig();
|
|
293
|
+
res.json(rpcConfig);
|
|
294
|
+
} catch (error: any) {
|
|
295
|
+
res.status(500).json({ error: error.message });
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
app.post('/api/rpc', (req, res) => {
|
|
300
|
+
try {
|
|
301
|
+
const currentRpc = loadRpcConfig();
|
|
302
|
+
const newRpc = { ...currentRpc, ...req.body };
|
|
303
|
+
saveRpcConfig(newRpc);
|
|
304
|
+
res.json({ success: true });
|
|
305
|
+
} catch (error: any) {
|
|
306
|
+
res.status(500).json({ error: error.message });
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
290
310
|
app.get('/api/defi-keys', (req, res) => {
|
|
291
311
|
try {
|
|
292
312
|
const keys = loadDefiKeys();
|
|
@@ -4,7 +4,7 @@ import pc from 'picocolors';
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { getAppDir, getPath } from '../config/paths';
|
|
7
|
-
import { loadConfig, saveConfig, saveApiKeys } from '../config/parser';
|
|
7
|
+
import { loadConfig, saveConfig, saveApiKeys, saveRpcConfig } from '../config/parser';
|
|
8
8
|
import crypto from 'crypto';
|
|
9
9
|
|
|
10
10
|
function encryptKey(privateKey: string, password: string) {
|
|
@@ -445,6 +445,7 @@ Provider: ${config.llm.provider}`;
|
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
saveConfig(config);
|
|
448
|
+
saveRpcConfig({});
|
|
448
449
|
|
|
449
450
|
// Sync disabled_skills.json based on user selection
|
|
450
451
|
const allWeb3Skills = [
|