hedgequantx 2.9.4 → 2.9.5
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/package.json
CHANGED
package/src/pages/ai-agents.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** AI Agents Configuration Page -
|
|
1
|
+
/** AI Agents Configuration Page - HQX Connector (OAuth) + API Key */
|
|
2
2
|
|
|
3
3
|
const chalk = require('chalk');
|
|
4
4
|
const os = require('os');
|
|
@@ -23,8 +23,8 @@ const CONFIG_DIR = path.join(os.homedir(), '.hqx');
|
|
|
23
23
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'ai-config.json');
|
|
24
24
|
|
|
25
25
|
// AI Providers list with OAuth (paid plan) and API Key support
|
|
26
|
-
//
|
|
27
|
-
//
|
|
26
|
+
// HQX Connector (port 8317): OAuth for Anthropic, OpenAI, Google, Qwen, iFlow
|
|
27
|
+
// Direct API Key: For MiniMax, DeepSeek, Mistral, xAI, OpenRouter
|
|
28
28
|
const AI_PROVIDERS = [
|
|
29
29
|
// OAuth + API Key supported (can use paid plan OR API key)
|
|
30
30
|
{ id: 'anthropic', name: 'Anthropic (Claude)', color: 'magenta', supportsOAuth: true, supportsApiKey: true },
|
|
@@ -116,33 +116,33 @@ const waitForProcessExit = (cp, timeoutMs = 15000, intervalMs = 500) => new Prom
|
|
|
116
116
|
}, intervalMs);
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
/** Handle
|
|
119
|
+
/** Handle HQX Connector connection (with auto-install) */
|
|
120
120
|
const handleCliProxyConnection = async (provider, config, boxWidth) => {
|
|
121
121
|
console.log();
|
|
122
|
-
// Check/install
|
|
122
|
+
// Check/install HQX Connector
|
|
123
123
|
if (!cliproxy.isInstalled()) {
|
|
124
|
-
console.log(chalk.yellow('
|
|
124
|
+
console.log(chalk.yellow(' HQX CONNECTOR NOT INSTALLED. INSTALLING...'));
|
|
125
125
|
const spinner = ora({ text: 'DOWNLOADING...', color: 'yellow' }).start();
|
|
126
126
|
const installResult = await cliproxy.install((msg, percent) => { spinner.text = `${msg.toUpperCase()} ${percent}%`; });
|
|
127
127
|
if (!installResult.success) { spinner.fail(`INSTALL FAILED: ${installResult.error}`); await prompts.waitForEnter(); return false; }
|
|
128
|
-
spinner.succeed('
|
|
128
|
+
spinner.succeed('HQX CONNECTOR INSTALLED');
|
|
129
129
|
}
|
|
130
|
-
// Check/start
|
|
130
|
+
// Check/start HQX Connector
|
|
131
131
|
let status = await cliproxy.isRunning();
|
|
132
132
|
if (!status.running) {
|
|
133
|
-
const spinner = ora({ text: 'STARTING
|
|
133
|
+
const spinner = ora({ text: 'STARTING HQX CONNECTOR...', color: 'yellow' }).start();
|
|
134
134
|
const startResult = await cliproxy.start();
|
|
135
135
|
if (!startResult.success) { spinner.fail(`START FAILED: ${startResult.error}`); await prompts.waitForEnter(); return false; }
|
|
136
|
-
spinner.succeed('
|
|
136
|
+
spinner.succeed('HQX CONNECTOR STARTED');
|
|
137
137
|
} else {
|
|
138
138
|
const cfgPath = path.join(os.homedir(), '.hqx', 'cliproxy', 'config.yaml');
|
|
139
139
|
if (!fs.existsSync(cfgPath)) {
|
|
140
|
-
console.log(chalk.yellow(' RESTARTING
|
|
140
|
+
console.log(chalk.yellow(' RESTARTING HQX CONNECTOR...'));
|
|
141
141
|
await cliproxy.stop();
|
|
142
142
|
const res = await cliproxy.start();
|
|
143
143
|
if (!res.success) { console.log(chalk.red(` RESTART FAILED: ${res.error}`)); await prompts.waitForEnter(); return false; }
|
|
144
144
|
console.log(chalk.green(' ✓ RESTARTED'));
|
|
145
|
-
} else console.log(chalk.green(' ✓
|
|
145
|
+
} else console.log(chalk.green(' ✓ HQX CONNECTOR RUNNING'));
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// First, check if models are already available (existing auth)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* before allowing algo trading with AI supervision.
|
|
6
6
|
*
|
|
7
7
|
* Supports both connection types:
|
|
8
|
-
* -
|
|
8
|
+
* - HQX Connector (OAuth) for Anthropic, OpenAI, Google, Qwen, iFlow
|
|
9
9
|
* - Direct API Key for MiniMax, DeepSeek, Mistral, xAI, OpenRouter
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -34,7 +34,7 @@ const checkCliproxyRunning = async () => {
|
|
|
34
34
|
return { success: true, latency, error: null };
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
return { success: false, latency, error: '
|
|
37
|
+
return { success: false, latency, error: 'HQX Connector not running' };
|
|
38
38
|
} catch (error) {
|
|
39
39
|
return { success: false, latency: Date.now() - startTime, error: error.message };
|
|
40
40
|
}
|
|
@@ -275,7 +275,7 @@ const runPreflightCheck = async (agents) => {
|
|
|
275
275
|
success: false,
|
|
276
276
|
latency: 0,
|
|
277
277
|
formatValid: false,
|
|
278
|
-
error: '
|
|
278
|
+
error: 'HQX Connector not running'
|
|
279
279
|
});
|
|
280
280
|
results.summary.failed++;
|
|
281
281
|
continue;
|
|
@@ -327,9 +327,9 @@ const formatPreflightResults = (results, boxWidth) => {
|
|
|
327
327
|
// CLIProxy status (only show if needed)
|
|
328
328
|
if (results.needsCliproxy) {
|
|
329
329
|
if (results.cliproxy.success) {
|
|
330
|
-
lines.push(dottedLine('
|
|
330
|
+
lines.push(dottedLine('HQX Connector', chalk.green('✓ RUNNING')));
|
|
331
331
|
} else {
|
|
332
|
-
lines.push(dottedLine('
|
|
332
|
+
lines.push(dottedLine('HQX Connector', chalk.red('✗ NOT RUNNING')));
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -371,7 +371,7 @@ const getPreflightSummary = (results) => {
|
|
|
371
371
|
// Only show CLIProxy error if it was needed and failed
|
|
372
372
|
if (results.needsCliproxy && !results.cliproxy.success) {
|
|
373
373
|
return {
|
|
374
|
-
text: chalk.red('✗
|
|
374
|
+
text: chalk.red('✗ HQX Connector not running - some agents cannot be verified'),
|
|
375
375
|
success: false
|
|
376
376
|
};
|
|
377
377
|
}
|
|
@@ -97,9 +97,9 @@ const install = async (onProgress = null) => {
|
|
|
97
97
|
const archivePath = path.join(INSTALL_DIR, download.filename);
|
|
98
98
|
|
|
99
99
|
// Download
|
|
100
|
-
if (onProgress) onProgress('Downloading
|
|
100
|
+
if (onProgress) onProgress('Downloading HQX Connector...', 0);
|
|
101
101
|
await downloadFile(download.url, archivePath, (percent) => {
|
|
102
|
-
if (onProgress) onProgress('Downloading
|
|
102
|
+
if (onProgress) onProgress('Downloading HQX Connector...', percent);
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
// Extract
|
|
@@ -165,7 +165,7 @@ api-keys:
|
|
|
165
165
|
/** Start CLIProxyAPI */
|
|
166
166
|
const start = async () => {
|
|
167
167
|
if (!isInstalled()) {
|
|
168
|
-
return { success: false, error: '
|
|
168
|
+
return { success: false, error: 'HQX Connector not installed', pid: null };
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
const status = await isRunning();
|
|
@@ -204,7 +204,7 @@ const start = async () => {
|
|
|
204
204
|
return { success: true, error: null, pid: child.pid };
|
|
205
205
|
} else {
|
|
206
206
|
// Read log for error details
|
|
207
|
-
let errorDetail = 'Failed to start
|
|
207
|
+
let errorDetail = 'Failed to start HQX Connector';
|
|
208
208
|
if (fs.existsSync(logPath)) {
|
|
209
209
|
const log = fs.readFileSync(logPath, 'utf8').slice(-500);
|
|
210
210
|
if (log) errorDetail += `: ${log.split('\n').pop()}`;
|
|
@@ -274,13 +274,13 @@ const stop = async () => {
|
|
|
274
274
|
/** Ensure CLIProxyAPI is installed and running */
|
|
275
275
|
const ensureRunning = async (onProgress = null) => {
|
|
276
276
|
if (!isInstalled()) {
|
|
277
|
-
if (onProgress) onProgress('Installing
|
|
277
|
+
if (onProgress) onProgress('Installing HQX Connector...', 0);
|
|
278
278
|
const installResult = await install(onProgress);
|
|
279
279
|
if (!installResult.success) return installResult;
|
|
280
280
|
}
|
|
281
281
|
const status = await isRunning();
|
|
282
282
|
if (status.running) return { success: true, error: null };
|
|
283
|
-
if (onProgress) onProgress('Starting
|
|
283
|
+
if (onProgress) onProgress('Starting HQX Connector...', 100);
|
|
284
284
|
return start();
|
|
285
285
|
};
|
|
286
286
|
|