nyxora 1.7.0 → 1.7.1
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/CHANGELOG.md +16 -0
- package/bin/nyxora.mjs +8 -0
- package/package.json +1 -2
- package/packages/core/package.json +1 -1
- package/packages/core/src/agent/limitOrderManager.ts +2 -2
- package/packages/core/src/agent/reasoning.ts +12 -10
- package/packages/core/src/config/parser.ts +99 -9
- package/packages/core/src/gateway/cli.ts +28 -2
- package/packages/core/src/gateway/setup.ts +44 -9
- package/packages/core/src/gateway/telegram.ts +3 -1
- package/packages/core/src/system/skills/searchWeb.ts +187 -21
- package/packages/core/src/web3/config.ts +7 -1
- package/packages/core/src/web3/skills/bridgeToken.ts +4 -3
- package/packages/core/src/web3/skills/checkAddress.ts +2 -2
- package/packages/core/src/web3/skills/checkPortfolio.ts +2 -2
- package/packages/core/src/web3/skills/checkSecurity.ts +3 -2
- package/packages/core/src/web3/skills/customTx.ts +2 -2
- package/packages/core/src/web3/skills/getBalance.ts +3 -3
- package/packages/core/src/web3/skills/marketAnalysis.ts +2 -2
- package/packages/core/src/web3/skills/mintNft.ts +2 -2
- package/packages/core/src/web3/skills/swapToken.ts +4 -3
- package/packages/core/src/web3/skills/transfer.ts +2 -2
- package/packages/core/src/web3/utils/tokens.ts +8 -0
- package/packages/dashboard/dist/assets/{index-24OeXn-k.css → index-BSk4CLkG.css} +1 -1
- package/packages/dashboard/dist/assets/{index-DQtaOlOl.js → index-Dc3Tu0Te.js} +20 -20
- package/packages/dashboard/dist/index.html +2 -2
- 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/packages/dashboard/public/favicon.svg +0 -10
- package/packages/dashboard/public/icons.svg +0 -24
- package/packages/dashboard/src/App.css +0 -184
- package/packages/dashboard/src/App.tsx +0 -585
- package/packages/dashboard/src/BalanceWidget.tsx +0 -65
- package/packages/dashboard/src/MarketWidget.tsx +0 -73
- package/packages/dashboard/src/NetworkSelector.tsx +0 -64
- package/packages/dashboard/src/NyxoraLogo.tsx +0 -25
- package/packages/dashboard/src/OsSkills.tsx +0 -352
- package/packages/dashboard/src/Overview.tsx +0 -157
- package/packages/dashboard/src/PendingTransactions.tsx +0 -75
- package/packages/dashboard/src/Settings.tsx +0 -338
- package/packages/dashboard/src/Skills.tsx +0 -200
- package/packages/dashboard/src/SwapWidget.tsx +0 -141
- package/packages/dashboard/src/TransactionWidget.tsx +0 -95
- package/packages/dashboard/src/assets/hero.png +0 -0
- package/packages/dashboard/src/assets/react.svg +0 -1
- package/packages/dashboard/src/assets/vite.svg +0 -1
- package/packages/dashboard/src/components/PillSelect.tsx +0 -65
- package/packages/dashboard/src/index.css +0 -807
- package/packages/dashboard/src/main.tsx +0 -10
- package/packages/dashboard/src/overview.css +0 -304
- package/packages/dashboard/src/utils/api.ts +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.7.1]
|
|
9
|
+
|
|
10
|
+
### CLI Enhancements
|
|
11
|
+
- **Global Version Checker**: Implemented native version checking for the global CLI manager. Users can now run `nyxora -v`, `nyxora --version`, or `nyxora version` to instantly check their installed daemon version without starting the application.
|
|
12
|
+
- **Smart Web Search Setup Wizard**: The `nyxora setup` command now includes an interactive prompt allowing users to choose their preferred Web Search Engine (Tavily, Brave, or Decentralized Mesh) and configure their API keys.
|
|
13
|
+
- **Fast CLI Shortcuts**: Added the `nyxora set-key <provider> <key>` global command shortcut allowing developers to quickly inject or override any API Key (OpenAI, Gemini, OpenRouter, Tavily, Brave) directly into the secure vault without traversing the wizard.
|
|
14
|
+
|
|
15
|
+
### AI Engine Optimizations
|
|
16
|
+
- **Hybrid API Vault (Security)**: API Keys are no longer stored in plain text inside `config.yaml`. Nyxora now encrypts and stores them via `@napi-rs/keyring` utilizing OS-native credential management. For Headless/VPS Linux environments lacking DBUS/Secret Service, it automatically falls back to an isolated `api_vault.key` with strict `0600` permissions.
|
|
17
|
+
- **Root-Level Config Auto-Migration**: Restructured `config.yaml` to move all API keys out of the nested `llm.credentials` into a logical, root-level `credentials` object. Implemented a silent auto-migration routine in `parser.ts` that safely upgrades legacy config files on boot without breaking existing setups.
|
|
18
|
+
- **Web Search Smart Memory Cache**: Embedded a local Memory Cache (`Map`) into the `searchWeb` skill with a 5-minute (300,000ms) TTL. Exact duplicate queries now execute in 0ms and consume 0 API quota, dramatically improving conversation flow.
|
|
19
|
+
- **Deep Research Mode**: The `search_web` tool definition now accepts a dynamic `depth` parameter (1 to 3). If users instruct the AI to conduct comprehensive research, Nyxora will automatically trigger `advanced` API payloads and extract up to 15 top web snippets simultaneously.
|
|
20
|
+
- **Strict Skill Prioritization**: Added CRITICAL RULE 7 to the core NLP System Prompt. The AI is now hard-coded to prioritize native Web3 Skills (e.g. `get_price`, `analyze_market`, `check_security`) for all crypto-related queries, using `search_web` exclusively as a fallback mechanism.
|
|
21
|
+
- **Dual-Engine Web Search (L3 Failover)**: Completely removed the fragile `duck-duck-scrape` dependency. The `search_web` skill is now powered by a robust L3 Auto-Failover architecture. Users can configure enterprise-grade search providers (Tavily or Brave). If the primary provider hits a rate limit (429) or invalid key (401/403), Nyxora seamlessly falls back to the secondary provider, and ultimately to a Decentralized SearXNG Mesh as a final safety net, guaranteeing 100% uptime.
|
|
22
|
+
|
|
23
|
+
|
|
8
24
|
## [1.7.0]
|
|
9
25
|
|
|
10
26
|
### Bug Fixes & Optimizations
|
package/bin/nyxora.mjs
CHANGED
|
@@ -217,6 +217,14 @@ async function main() {
|
|
|
217
217
|
case 'dashboard': await dashboard(); break;
|
|
218
218
|
case 'clean-logs': await cleanLogs(); break;
|
|
219
219
|
case 'autostart': await autostart(process.argv[3]); break;
|
|
220
|
+
case '-v':
|
|
221
|
+
case '--v':
|
|
222
|
+
case '--version':
|
|
223
|
+
case 'version':
|
|
224
|
+
const pkgPath = path.join(projectRoot, 'package.json');
|
|
225
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
226
|
+
console.log(`Nyxora v${pkg.version}`);
|
|
227
|
+
break;
|
|
220
228
|
default:
|
|
221
229
|
console.log(`
|
|
222
230
|
Nyxora CLI Manager
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nyxora",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"packages/*"
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"concurrently": "^9.2.1",
|
|
27
27
|
"cors": "^2.8.6",
|
|
28
28
|
"dotenv": "^17.4.2",
|
|
29
|
-
"duck-duck-scrape": "^2.2.7",
|
|
30
29
|
"express": "^5.2.1",
|
|
31
30
|
"express-rate-limit": "^7.5.0",
|
|
32
31
|
"helmet": "^8.0.0",
|
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { loadConfig } from '../config/parser';
|
|
4
4
|
import { getPath } from '../config/paths';
|
|
5
|
-
import { ChainName } from '../web3/config';
|
|
5
|
+
import { ChainName, SUPPORTED_CHAIN_NAMES } from '../web3/config';
|
|
6
6
|
import { resolveToken } from '../web3/utils/tokens';
|
|
7
7
|
import { prepareSwapToken, executeSwap } from '../web3/skills/swapToken';
|
|
8
8
|
import { txManager } from './transactionManager';
|
|
@@ -158,7 +158,7 @@ export const createLimitOrderToolDefinition = {
|
|
|
158
158
|
parameters: {
|
|
159
159
|
type: "object",
|
|
160
160
|
properties: {
|
|
161
|
-
chainName: { type: "string", enum:
|
|
161
|
+
chainName: { type: "string", enum: SUPPORTED_CHAIN_NAMES },
|
|
162
162
|
fromToken: { type: "string", description: "Token to sell" },
|
|
163
163
|
toToken: { type: "string", description: "Token to buy" },
|
|
164
164
|
amountStr: { type: "string", description: "Amount to sell" },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { OpenAI } from 'openai';
|
|
4
|
-
import { loadConfig } from '../config/parser';
|
|
4
|
+
import { loadConfig, loadApiKeys } from '../config/parser';
|
|
5
5
|
import { Logger } from '../memory/logger';
|
|
6
6
|
import { Tracker } from '../gateway/tracker';
|
|
7
7
|
import { getBalanceToolDefinition, getBalance } from '../web3/skills/getBalance';
|
|
@@ -48,8 +48,9 @@ export const logger = new Logger();
|
|
|
48
48
|
|
|
49
49
|
let currentKeyIndex = 0;
|
|
50
50
|
|
|
51
|
-
function getOpenAI(): OpenAI {
|
|
51
|
+
async function getOpenAI(): Promise<OpenAI> {
|
|
52
52
|
const config = loadConfig();
|
|
53
|
+
const vaultKeys = await loadApiKeys();
|
|
53
54
|
|
|
54
55
|
if (config.llm.provider === 'ollama') {
|
|
55
56
|
return new OpenAI({
|
|
@@ -80,16 +81,16 @@ function getOpenAI(): OpenAI {
|
|
|
80
81
|
// Fallbacks if no valid keys found in config.llm.api_keys
|
|
81
82
|
if (!apiKey) {
|
|
82
83
|
if (config.llm.provider === 'gemini') {
|
|
83
|
-
apiKey = config.
|
|
84
|
+
apiKey = vaultKeys.gemini_key || config.credentials?.gemini_key || '';
|
|
84
85
|
} else if (config.llm.provider === 'openrouter') {
|
|
85
|
-
apiKey = config.
|
|
86
|
+
apiKey = vaultKeys.openrouter_key || config.credentials?.openrouter_key || '';
|
|
86
87
|
} else {
|
|
87
|
-
apiKey = config.
|
|
88
|
+
apiKey = vaultKeys.openai_key || config.credentials?.openai_key || '';
|
|
88
89
|
}
|
|
89
90
|
if (!apiKey) {
|
|
90
|
-
throw new Error(`No API Key found for ${config.llm.provider}
|
|
91
|
+
throw new Error(`No API Key found for ${config.llm.provider}. Please run 'nyxora setup' to configure it.`);
|
|
91
92
|
}
|
|
92
|
-
console.log(`[LLM] Using
|
|
93
|
+
console.log(`[LLM] Using API Key from secure vault`);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
if (config.llm.provider === 'gemini') {
|
|
@@ -117,7 +118,7 @@ async function executeWithRetry(
|
|
|
117
118
|
|
|
118
119
|
while (retries <= maxRetries) {
|
|
119
120
|
try {
|
|
120
|
-
const client = getOpenAI();
|
|
121
|
+
const client = await getOpenAI();
|
|
121
122
|
return await requestBuilder(client);
|
|
122
123
|
} catch (error: any) {
|
|
123
124
|
const status = error?.status || error?.response?.status;
|
|
@@ -166,7 +167,8 @@ CRITICAL RULE 3: FORMATTING & CONCISENESS.
|
|
|
166
167
|
- When displaying a list of assets, tokens, portfolio, or transaction history, YOU MUST USE MARKDOWN TABLES. Do not use bullet points for financial data.
|
|
167
168
|
CRITICAL RULE 4: When the user asks to check "my balance", "saldo saya", or anything about their own wallet generally, ALWAYS use the check_portfolio tool to show all assets on the chain that have a USD value greater than 0. LEAVE THE ADDRESS PARAMETER EMPTY. Do NOT use get_balance unless the user explicitly asks for the balance of ONE specific token.
|
|
168
169
|
CRITICAL RULE 5: If the user doesn't specify a chain, default to: ${config.agent.default_chain}. If the user mentions a specific chain (e.g., "on BNB", "di Base"), you MUST override the default and execute the tool on that specific chain.
|
|
169
|
-
CRITICAL RULE 6: If you use the default chain because the user forgot to specify one, you MUST politely confirm which chain you checked in your response (e.g., "I checked your balance on the ${config.agent.default_chain} network..."). Do not issue scary warnings
|
|
170
|
+
CRITICAL RULE 6: If you use the default chain because the user forgot to specify one, you MUST politely confirm which chain you checked in your response (e.g., "I checked your balance on the ${config.agent.default_chain} network..."). Do not issue scary warnings.
|
|
171
|
+
CRITICAL RULE 7: TOOL PRIORITIZATION. When the user asks about crypto prices, market analysis, token security, or blockchain data, YOU MUST prioritize using the dedicated Web3 skills (e.g., get_price, analyze_market, check_security) FIRST. Only if those tools fail or cannot provide the requested information, you may fallback to using search_web.`;
|
|
170
172
|
|
|
171
173
|
// Read IDENTITY.md for core AI persona
|
|
172
174
|
try {
|
|
@@ -426,7 +428,7 @@ export async function processUserInput(input: string, role: 'user' | 'system' =
|
|
|
426
428
|
break;
|
|
427
429
|
}
|
|
428
430
|
case 'search_web': {
|
|
429
|
-
result = await searchWeb(args.query);
|
|
431
|
+
result = await searchWeb(args.query, args.depth);
|
|
430
432
|
break;
|
|
431
433
|
}
|
|
432
434
|
case 'install_external_skill': {
|
|
@@ -3,6 +3,39 @@ import yaml from 'yaml';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { getPath } from './paths';
|
|
5
5
|
|
|
6
|
+
export async function loadApiKeys(): Promise<Record<string, string>> {
|
|
7
|
+
const vaultPath = getPath('api_vault.key');
|
|
8
|
+
try {
|
|
9
|
+
const { Entry } = require('@napi-rs/keyring');
|
|
10
|
+
const entry = new Entry('nyxora', 'api_keys');
|
|
11
|
+
const data = await entry.getPassword();
|
|
12
|
+
if (data) return JSON.parse(data);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
if (fs.existsSync(vaultPath)) {
|
|
15
|
+
try {
|
|
16
|
+
const file = fs.readFileSync(vaultPath, 'utf8');
|
|
17
|
+
return JSON.parse(file);
|
|
18
|
+
} catch (err) {}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function saveApiKeys(newKeys: Record<string, string>): Promise<void> {
|
|
25
|
+
const vaultPath = getPath('api_vault.key');
|
|
26
|
+
const currentKeys = await loadApiKeys();
|
|
27
|
+
const mergedKeys = { ...currentKeys, ...newKeys };
|
|
28
|
+
const dataString = JSON.stringify(mergedKeys);
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const { Entry } = require('@napi-rs/keyring');
|
|
32
|
+
const entry = new Entry('nyxora', 'api_keys');
|
|
33
|
+
await entry.setPassword(dataString);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
fs.writeFileSync(vaultPath, dataString, { mode: 0o600 });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
6
39
|
export interface NyxoraConfig {
|
|
7
40
|
agent: {
|
|
8
41
|
name: string;
|
|
@@ -13,11 +46,19 @@ export interface NyxoraConfig {
|
|
|
13
46
|
model: string;
|
|
14
47
|
temperature: number;
|
|
15
48
|
api_keys?: string[];
|
|
16
|
-
credentials?:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
49
|
+
credentials?: any; // Deprecated, kept for parsing during migration
|
|
50
|
+
};
|
|
51
|
+
web_search?: {
|
|
52
|
+
provider: 'tavily' | 'brave' | 'mesh';
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
};
|
|
55
|
+
credentials?: {
|
|
56
|
+
openai_key?: string;
|
|
57
|
+
gemini_key?: string;
|
|
58
|
+
openrouter_key?: string;
|
|
59
|
+
tavily_key?: string;
|
|
60
|
+
brave_key?: string;
|
|
61
|
+
[key: string]: string | undefined;
|
|
21
62
|
};
|
|
22
63
|
memory: {
|
|
23
64
|
type: string;
|
|
@@ -52,6 +93,47 @@ export function loadConfig(): NyxoraConfig {
|
|
|
52
93
|
const file = fs.readFileSync(configPath, 'utf8');
|
|
53
94
|
const parsed = yaml.parse(file) as Partial<NyxoraConfig>;
|
|
54
95
|
|
|
96
|
+
// Auto-migration logic: move llm.credentials to root credentials
|
|
97
|
+
let needsSave = false;
|
|
98
|
+
if (parsed.llm && (parsed.llm as any).credentials) {
|
|
99
|
+
if (!parsed.credentials) {
|
|
100
|
+
parsed.credentials = {};
|
|
101
|
+
}
|
|
102
|
+
const oldCreds = (parsed.llm as any).credentials;
|
|
103
|
+
Object.keys(oldCreds).forEach(key => {
|
|
104
|
+
if (oldCreds[key] && !parsed.credentials![key]) {
|
|
105
|
+
parsed.credentials![key] = oldCreds[key];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
delete (parsed.llm as any).credentials;
|
|
109
|
+
needsSave = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (needsSave) {
|
|
113
|
+
try {
|
|
114
|
+
const yamlStr = yaml.stringify(parsed);
|
|
115
|
+
fs.writeFileSync(configPath, yamlStr, 'utf8');
|
|
116
|
+
console.log('[Config] Auto-migrated llm.credentials to root credentials.');
|
|
117
|
+
} catch (e) {
|
|
118
|
+
console.error('[Config] Failed to auto-migrate config file', e);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Auto-migrate from config.yaml to Keyring/Vault
|
|
123
|
+
if (parsed.credentials && Object.keys(parsed.credentials).length > 0) {
|
|
124
|
+
const credsToMigrate = { ...parsed.credentials };
|
|
125
|
+
saveApiKeys(credsToMigrate).then(() => {
|
|
126
|
+
console.log('[Config] Auto-migrated API keys to secure vault.');
|
|
127
|
+
delete parsed.credentials;
|
|
128
|
+
try {
|
|
129
|
+
const yamlStr = yaml.stringify(parsed);
|
|
130
|
+
fs.writeFileSync(configPath, yamlStr, 'utf8');
|
|
131
|
+
} catch (e) {}
|
|
132
|
+
}).catch(e => {
|
|
133
|
+
console.error('[Config] Failed to migrate API keys to secure vault', e);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
55
137
|
// Merge with defaults
|
|
56
138
|
return {
|
|
57
139
|
agent: parsed.agent || { name: 'Nyxora-Default', default_chain: 'base' },
|
|
@@ -59,9 +141,13 @@ export function loadConfig(): NyxoraConfig {
|
|
|
59
141
|
provider: 'openai',
|
|
60
142
|
model: 'gpt-4o-mini',
|
|
61
143
|
temperature: 0.2,
|
|
62
|
-
api_keys: []
|
|
63
|
-
credentials: {}
|
|
144
|
+
api_keys: []
|
|
64
145
|
},
|
|
146
|
+
web_search: parsed.web_search || {
|
|
147
|
+
provider: 'mesh',
|
|
148
|
+
enabled: true
|
|
149
|
+
},
|
|
150
|
+
credentials: parsed.credentials || {},
|
|
65
151
|
memory: parsed.memory || { type: 'file', path: './memory.json' },
|
|
66
152
|
web3: parsed.web3 || { rpc_urls: {} },
|
|
67
153
|
integrations: parsed.integrations || {
|
|
@@ -80,9 +166,13 @@ export function loadConfig(): NyxoraConfig {
|
|
|
80
166
|
provider: 'openai',
|
|
81
167
|
model: 'gpt-4o-mini',
|
|
82
168
|
temperature: 0.2,
|
|
83
|
-
api_keys: []
|
|
84
|
-
|
|
169
|
+
api_keys: []
|
|
170
|
+
},
|
|
171
|
+
web_search: {
|
|
172
|
+
provider: 'mesh',
|
|
173
|
+
enabled: true
|
|
85
174
|
},
|
|
175
|
+
credentials: {},
|
|
86
176
|
memory: { type: 'file', path: './memory.json' },
|
|
87
177
|
web3: { rpc_urls: {} },
|
|
88
178
|
integrations: {
|
|
@@ -13,6 +13,7 @@ import { runSetupWizard } from './setup';
|
|
|
13
13
|
import { password, isCancel } from '@clack/prompts';
|
|
14
14
|
import { getSessionToken } from '../utils/state';
|
|
15
15
|
import pc from 'picocolors';
|
|
16
|
+
import { saveApiKeys } from '../config/parser';
|
|
16
17
|
|
|
17
18
|
async function main() {
|
|
18
19
|
// 1. Determine configuration directory
|
|
@@ -30,6 +31,33 @@ console.log(`================================`);
|
|
|
30
31
|
process.exit(0);
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
// Check for set-key shortcut
|
|
35
|
+
if (process.argv.includes('set-key')) {
|
|
36
|
+
const setKeyIndex = process.argv.indexOf('set-key');
|
|
37
|
+
const provider = process.argv[setKeyIndex + 1];
|
|
38
|
+
const key = process.argv[setKeyIndex + 2];
|
|
39
|
+
|
|
40
|
+
if (!provider || !key) {
|
|
41
|
+
console.error(pc.red('Usage: nyxora set-key <provider> <api_key>'));
|
|
42
|
+
console.error(pc.gray('Example: nyxora set-key tavily tvly-xxx'));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const keyMap: Record<string, string> = {
|
|
47
|
+
'openai': 'openai_key',
|
|
48
|
+
'gemini': 'gemini_key',
|
|
49
|
+
'openrouter': 'openrouter_key',
|
|
50
|
+
'tavily': 'tavily_key',
|
|
51
|
+
'brave': 'brave_key'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const mappedKey = keyMap[provider.toLowerCase()] || `${provider.toLowerCase()}_key`;
|
|
55
|
+
|
|
56
|
+
await saveApiKeys({ [mappedKey]: key });
|
|
57
|
+
console.log(pc.green(`✅ API Key for ${provider} saved securely to vault.`));
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
33
61
|
// 2. Setup boilerplate files if in global mode and they don't exist
|
|
34
62
|
let isFirstBoot = false;
|
|
35
63
|
if (isGlobalMode) {
|
|
@@ -65,8 +93,6 @@ console.log(`================================`);
|
|
|
65
93
|
// 4. Start the Express API Server (which also serves the static dashboard and Telegram bot)
|
|
66
94
|
startServer();
|
|
67
95
|
const token = getSessionToken(); // Initialize token file
|
|
68
|
-
console.log(`🌐 Nyxora API Server running on port ${process.env.PORT || 3000}`);
|
|
69
|
-
|
|
70
96
|
setTimeout(() => {
|
|
71
97
|
console.log(pc.cyan(`\n✨ Dashboard URL: http://localhost:3000/?token=${token}`));
|
|
72
98
|
console.log(pc.gray(` (Developers: Vite hot-reload available at http://localhost:5173/?token=${token})\n`));
|
|
@@ -3,7 +3,7 @@ import pc from 'picocolors';
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { getAppDir } from '../config/paths';
|
|
6
|
-
import { loadConfig, saveConfig } from '../config/parser';
|
|
6
|
+
import { loadConfig, saveConfig, saveApiKeys } from '../config/parser';
|
|
7
7
|
import crypto from 'crypto';
|
|
8
8
|
|
|
9
9
|
function encryptKey(privateKey: string, password: string) {
|
|
@@ -161,6 +161,25 @@ Provider: ${config.llm.provider}`;
|
|
|
161
161
|
if (isCancel(apiKey)) return process.exit(0);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
// 3.5. Smart Web Search Setup
|
|
165
|
+
const searchProvider = await select({
|
|
166
|
+
message: 'Enable Smart Web Search for Nyxora AI?',
|
|
167
|
+
options: [
|
|
168
|
+
{ value: 'skip', label: 'Skip (Use basic decentralized mesh)' },
|
|
169
|
+
{ value: 'tavily', label: 'Tavily Search (Built for AI - 1000 free/mo)' },
|
|
170
|
+
{ value: 'brave', label: 'Brave Search (Privacy focused - 2000 free/mo)' },
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
if (isCancel(searchProvider)) return process.exit(0);
|
|
174
|
+
|
|
175
|
+
let searchApiKey = '';
|
|
176
|
+
if (searchProvider !== 'skip') {
|
|
177
|
+
searchApiKey = (await password({
|
|
178
|
+
message: `Enter API Key for ${searchProvider} (Get it free at ${searchProvider === 'tavily' ? 'tavily.com' : 'search.brave.com'}):`,
|
|
179
|
+
})) as string;
|
|
180
|
+
if (isCancel(searchApiKey)) return process.exit(0);
|
|
181
|
+
}
|
|
182
|
+
|
|
164
183
|
// 4. Default Chain
|
|
165
184
|
const defaultChain = await select({
|
|
166
185
|
message: 'Select Default Chain:',
|
|
@@ -169,8 +188,9 @@ Provider: ${config.llm.provider}`;
|
|
|
169
188
|
{ value: 'ethereum', label: 'Ethereum Mainnet' },
|
|
170
189
|
{ value: 'bsc', label: 'BSC' },
|
|
171
190
|
{ value: 'base', label: 'Base' },
|
|
172
|
-
{ value: '
|
|
173
|
-
{ value: '
|
|
191
|
+
{ value: 'arbitrum', label: 'Arbitrum One' },
|
|
192
|
+
{ value: 'optimism', label: 'OP Mainnet' },
|
|
193
|
+
{ value: 'polygon', label: 'Polygon (Matic)' },
|
|
174
194
|
{ value: 'sepolia', label: 'Sepolia (Testnet)' },
|
|
175
195
|
],
|
|
176
196
|
});
|
|
@@ -233,8 +253,8 @@ Provider: ${config.llm.provider}`;
|
|
|
233
253
|
message: 'Web3 Wallet Setup:',
|
|
234
254
|
options: [
|
|
235
255
|
{ value: 'skip', label: 'Skip for now (No Web3 execution)' },
|
|
236
|
-
{ value: 'generate', label: 'Auto-Generate New Wallet
|
|
237
|
-
{ value: 'manual', label: 'Input
|
|
256
|
+
{ value: 'generate', label: 'Auto-Generate New Wallet' },
|
|
257
|
+
{ value: 'manual', label: 'Manual Input (Existing Private Key)' },
|
|
238
258
|
],
|
|
239
259
|
});
|
|
240
260
|
if (isCancel(walletSetupType)) return process.exit(0);
|
|
@@ -260,11 +280,26 @@ Provider: ${config.llm.provider}`;
|
|
|
260
280
|
config.llm.model = model as string;
|
|
261
281
|
config.agent.default_chain = defaultChain as string;
|
|
262
282
|
|
|
263
|
-
|
|
283
|
+
const newApiKeys: Record<string, string> = {};
|
|
264
284
|
if (apiKey) {
|
|
265
|
-
if (provider === 'openai')
|
|
266
|
-
if (provider === 'gemini')
|
|
267
|
-
if (provider === 'openrouter')
|
|
285
|
+
if (provider === 'openai') newApiKeys.openai_key = apiKey;
|
|
286
|
+
if (provider === 'gemini') newApiKeys.gemini_key = apiKey;
|
|
287
|
+
if (provider === 'openrouter') newApiKeys.openrouter_key = apiKey;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (!config.web_search) config.web_search = { provider: 'mesh', enabled: true };
|
|
291
|
+
if (searchProvider !== 'skip') {
|
|
292
|
+
config.web_search.provider = searchProvider as any;
|
|
293
|
+
if (searchApiKey) {
|
|
294
|
+
if (searchProvider === 'tavily') newApiKeys.tavily_key = searchApiKey;
|
|
295
|
+
if (searchProvider === 'brave') newApiKeys.brave_key = searchApiKey;
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
config.web_search.provider = 'mesh';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (Object.keys(newApiKeys).length > 0) {
|
|
302
|
+
await saveApiKeys(newApiKeys);
|
|
268
303
|
}
|
|
269
304
|
|
|
270
305
|
if (!config.integrations) config.integrations = {};
|
|
@@ -238,7 +238,9 @@ export function startTelegramBot() {
|
|
|
238
238
|
console.error('[Telegram] Telegraf error:', err);
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
-
bot.launch()
|
|
241
|
+
bot.launch().catch(err => {
|
|
242
|
+
console.error('[Telegram] Connection failed (likely blocked by ISP or timeout):', err.message);
|
|
243
|
+
});
|
|
242
244
|
|
|
243
245
|
if (isPaired) {
|
|
244
246
|
console.log('🤖 Telegram Bot is running and securely listening for your messages...');
|