hedgequantx 2.9.14 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.14",
3
+ "version": "2.9.15",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -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
- const loadingText = ' Testing connections... Please wait';
343
- console.log(chalk.cyan('║') + chalk.yellow(loadingText) + ' '.repeat(W - loadingText.length) + chalk.cyan('║'));
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
- const parsed = JSON.parse(data);
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,