hedgequantx 2.9.13 → 2.9.15
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/menus/dashboard.js
CHANGED
|
@@ -10,6 +10,7 @@ const { connections } = require('../services');
|
|
|
10
10
|
const { getLogoWidth, centerText, prepareStdin, displayBanner, clearScreen } = require('../ui');
|
|
11
11
|
const { getCachedStats } = require('../services/stats-cache');
|
|
12
12
|
const { prompts } = require('../utils');
|
|
13
|
+
const { getActiveAgentCount } = require('../pages/ai-agents');
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Dashboard menu after login
|
|
@@ -61,8 +62,8 @@ const dashboardMenu = async (service) => {
|
|
|
61
62
|
const balStr = statsInfo.balance !== null ? `$${statsInfo.balance.toLocaleString()}` : '--';
|
|
62
63
|
const balColor = statsInfo.balance !== null ? chalk.green : chalk.gray;
|
|
63
64
|
|
|
64
|
-
// AI Agents status
|
|
65
|
-
const agentCount =
|
|
65
|
+
// AI Agents status - get fresh count, not from cache
|
|
66
|
+
const agentCount = getActiveAgentCount();
|
|
66
67
|
const agentDisplay = agentCount > 0 ? 'ON' : 'OFF';
|
|
67
68
|
const agentColor = agentCount > 0 ? chalk.green : chalk.red;
|
|
68
69
|
|
|
@@ -242,11 +243,11 @@ const handleUpdate = async () => {
|
|
|
242
243
|
|
|
243
244
|
spinner.succeed(`UPDATED TO V${latestVersion}!`);
|
|
244
245
|
console.log(chalk.green('\n ✓ UPDATE SUCCESSFUL!'));
|
|
245
|
-
console.log(chalk.yellow('\n
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
console.log(chalk.yellow('\n Restarting HQX...'));
|
|
247
|
+
|
|
248
|
+
// Small delay then exit - the user will run hqx again
|
|
249
|
+
await new Promise(r => setTimeout(r, 1500));
|
|
250
|
+
process.exit(0);
|
|
250
251
|
|
|
251
252
|
} catch (error) {
|
|
252
253
|
if (spinner) spinner.fail('UPDATE ERROR');
|
|
@@ -334,13 +334,13 @@ const drawConnectionTest = async (agents, boxWidth, clearWithBanner) => {
|
|
|
334
334
|
|
|
335
335
|
const W = boxWidth - 2;
|
|
336
336
|
|
|
337
|
-
// Show loading state with complete box
|
|
337
|
+
// Show loading state with complete box (centered vertically and horizontally)
|
|
338
338
|
clearWithBanner();
|
|
339
339
|
console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
|
|
340
340
|
console.log(chalk.cyan('║') + chalk.yellow.bold(centerText('AI AGENTS CONNECTION TEST', W)) + chalk.cyan('║'));
|
|
341
341
|
console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
|
|
342
|
-
|
|
343
|
-
console.log(chalk.cyan('║') + chalk.yellow(
|
|
342
|
+
console.log(chalk.cyan('║') + ' '.repeat(W) + chalk.cyan('║'));
|
|
343
|
+
console.log(chalk.cyan('║') + chalk.yellow(centerText('Testing connections... Please wait', W)) + chalk.cyan('║'));
|
|
344
344
|
console.log(chalk.cyan('║') + ' '.repeat(W) + chalk.cyan('║'));
|
|
345
345
|
console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
|
|
346
346
|
|
|
@@ -92,9 +92,19 @@ const testApiKeyConnection = (agent) => {
|
|
|
92
92
|
res.on('end', () => {
|
|
93
93
|
const latency = Date.now() - startTime;
|
|
94
94
|
try {
|
|
95
|
-
|
|
95
|
+
// Handle potential SSE format (data: {...}\n\ndata: {...})
|
|
96
|
+
let jsonData = data.trim();
|
|
97
|
+
if (jsonData.startsWith('data:')) {
|
|
98
|
+
// SSE format - extract last complete JSON
|
|
99
|
+
const lines = jsonData.split('\n').filter(l => l.startsWith('data:'));
|
|
100
|
+
const lastData = lines.filter(l => l !== 'data: [DONE]').pop();
|
|
101
|
+
if (lastData) jsonData = lastData.replace('data: ', '');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const parsed = JSON.parse(jsonData);
|
|
96
105
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
97
|
-
const content = parsed.choices?.[0]?.message?.content ||
|
|
106
|
+
const content = parsed.choices?.[0]?.message?.content ||
|
|
107
|
+
parsed.choices?.[0]?.delta?.content || '';
|
|
98
108
|
const formatResult = validateResponseFormat(content);
|
|
99
109
|
resolve({
|
|
100
110
|
success: formatResult.valid,
|