hedgequantx 2.7.37 → 2.7.39

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.7.37",
3
+ "version": "2.7.39",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -30,9 +30,9 @@ const dashboardMenu = async (service) => {
30
30
  return chalk.cyan('║') + content + ' '.repeat(Math.max(0, padding)) + chalk.cyan('║');
31
31
  };
32
32
 
33
- // Continue from banner (connected rectangle)
34
- console.log(chalk.cyan('' + '═'.repeat(W) + ''));
35
- console.log(makeLine(chalk.yellow.bold('Welcome, HQX Trader!'), 'center'));
33
+ // New rectangle (banner is always closed)
34
+ console.log(chalk.cyan('' + '═'.repeat(W) + ''));
35
+ console.log(makeLine(chalk.yellow.bold('WELCOME, HQX TRADER!'), 'center'));
36
36
  console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
37
37
 
38
38
  // Show connected propfirms
@@ -87,9 +87,9 @@ const dashboardMenu = async (service) => {
87
87
 
88
88
  // Find max width for alignment
89
89
  const menuItems = [
90
- { left: '[1] View Accounts', right: '[2] View Stats' },
91
- { left: '[+] Add Prop-Account', right: '[A] Algo-Trading' },
92
- { left: '[I] AI Agents', right: '[U] Update HQX' },
90
+ { left: '[1] VIEW ACCOUNTS', right: '[2] VIEW STATS' },
91
+ { left: '[+] ADD PROP-ACCOUNT', right: '[A] ALGO-TRADING' },
92
+ { left: '[I] AI AGENTS', right: '[U] UPDATE HQX' },
93
93
  ];
94
94
 
95
95
  const maxLeftLen = Math.max(...menuItems.map(m => m.left.length));
@@ -119,18 +119,18 @@ const dashboardMenu = async (service) => {
119
119
  );
120
120
  };
121
121
 
122
- menuRow('[1] View Accounts', '[2] View Stats', chalk.cyan, chalk.cyan);
123
- menuRow('[+] Add Prop-Account', '[A] Algo-Trading', chalk.cyan, chalk.magenta);
124
- menuRow('[I] AI Agents', '[U] Update HQX', chalk.green, chalk.yellow);
122
+ menuRow('[1] VIEW ACCOUNTS', '[2] VIEW STATS', chalk.cyan, chalk.cyan);
123
+ menuRow('[+] ADD PROP-ACCOUNT', '[A] ALGO-TRADING', chalk.cyan, chalk.magenta);
124
+ menuRow('[I] AI AGENTS', '[U] UPDATE HQX', chalk.green, chalk.yellow);
125
125
 
126
126
  // Separator and centered Disconnect button
127
127
  console.log(chalk.cyan('╠' + '─'.repeat(W) + '╣'));
128
- console.log(makeLine(chalk.red('[X] Disconnect'), 'center'));
128
+ console.log(makeLine(chalk.red('[X] DISCONNECT'), 'center'));
129
129
 
130
130
  console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
131
131
 
132
132
  // Simple input - no duplicate menu
133
- const input = await prompts.textInput(chalk.cyan('Select (1/2/+/A/I/U/X)'));
133
+ const input = await prompts.textInput(chalk.cyan('SELECT (1/2/+/A/I/U/X):'));
134
134
 
135
135
  const actionMap = {
136
136
  '1': 'accounts',
@@ -159,8 +159,8 @@ const handleUpdate = async () => {
159
159
  currentVersion = require('../../package.json').version || 'unknown';
160
160
  } catch (e) {}
161
161
 
162
- console.log(chalk.cyan(`\n Current version: v${currentVersion}`));
163
- spinner = ora({ text: 'Checking for updates...', color: 'yellow' }).start();
162
+ console.log(chalk.cyan(`\n CURRENT VERSION: V${currentVersion}`));
163
+ spinner = ora({ text: 'CHECKING FOR UPDATES...', color: 'yellow' }).start();
164
164
 
165
165
  let latestVersion;
166
166
  try {
@@ -174,23 +174,23 @@ const handleUpdate = async () => {
174
174
  throw new Error('Invalid version format');
175
175
  }
176
176
  } catch (e) {
177
- spinner.fail('Cannot reach npm registry');
178
- console.log(chalk.gray(` Error: ${e.message}`));
179
- console.log(chalk.yellow(' Try manually: npm install -g hedgequantx@latest'));
177
+ spinner.fail('CANNOT REACH NPM REGISTRY');
178
+ console.log(chalk.gray(` ERROR: ${e.message.toUpperCase()}`));
179
+ console.log(chalk.yellow(' TRY MANUALLY: npm install -g hedgequantx@latest'));
180
180
  await prompts.waitForEnter();
181
181
  return;
182
182
  }
183
183
 
184
- spinner.succeed(`Latest version: v${latestVersion}`);
184
+ spinner.succeed(`LATEST VERSION: V${latestVersion}`);
185
185
 
186
186
  if (currentVersion === latestVersion) {
187
- console.log(chalk.green(' Already up to date!'));
187
+ console.log(chalk.green(' ALREADY UP TO DATE!'));
188
188
  await prompts.waitForEnter();
189
189
  return;
190
190
  }
191
191
 
192
- console.log(chalk.yellow(` Update available: v${currentVersion} → v${latestVersion}`));
193
- spinner = ora({ text: 'Installing update...', color: 'yellow' }).start();
192
+ console.log(chalk.yellow(` UPDATE AVAILABLE: V${currentVersion} → V${latestVersion}`));
193
+ spinner = ora({ text: 'INSTALLING UPDATE...', color: 'yellow' }).start();
194
194
 
195
195
  try {
196
196
  // Try with sudo first on Unix systems
@@ -205,16 +205,16 @@ const handleUpdate = async () => {
205
205
  encoding: 'utf8'
206
206
  });
207
207
  } catch (e) {
208
- spinner.fail('Update failed - permission denied?');
209
- console.log(chalk.gray(` Error: ${e.message}`));
210
- console.log(chalk.yellow(' Try manually with sudo:'));
208
+ spinner.fail('UPDATE FAILED - PERMISSION DENIED?');
209
+ console.log(chalk.gray(` ERROR: ${e.message.toUpperCase()}`));
210
+ console.log(chalk.yellow(' TRY MANUALLY WITH SUDO:'));
211
211
  console.log(chalk.white(' sudo npm install -g hedgequantx@latest'));
212
212
  await prompts.waitForEnter();
213
213
  return;
214
214
  }
215
215
 
216
- spinner.succeed(`Updated to v${latestVersion}!`);
217
- console.log(chalk.cyan(' Restarting HQX...'));
216
+ spinner.succeed(`UPDATED TO V${latestVersion}!`);
217
+ console.log(chalk.cyan(' RESTARTING HQX...'));
218
218
 
219
219
  await new Promise(r => setTimeout(r, 1500));
220
220
 
@@ -227,15 +227,15 @@ const handleUpdate = async () => {
227
227
  child.unref();
228
228
  process.exit(0);
229
229
  } catch (e) {
230
- console.log(chalk.yellow('\n Please restart HQX manually:'));
230
+ console.log(chalk.yellow('\n PLEASE RESTART HQX MANUALLY:'));
231
231
  console.log(chalk.white(' hqx'));
232
232
  await prompts.waitForEnter();
233
233
  }
234
234
 
235
235
  } catch (error) {
236
- if (spinner) spinner.fail('Update error');
237
- console.log(chalk.gray(` Error: ${error.message}`));
238
- console.log(chalk.yellow(' Try manually: npm install -g hedgequantx@latest'));
236
+ if (spinner) spinner.fail('UPDATE ERROR');
237
+ console.log(chalk.gray(` ERROR: ${error.message.toUpperCase()}`));
238
+ console.log(chalk.yellow(' TRY MANUALLY: npm install -g hedgequantx@latest'));
239
239
  await prompts.waitForEnter();
240
240
  }
241
241
  };
@@ -243,48 +243,30 @@ const handleCliProxyConnection = async (provider, config, boxWidth) => {
243
243
  // Restart CLIProxyAPI to load new tokens
244
244
  const restartSpinner = ora({ text: 'RESTARTING CLIPROXYAPI...', color: 'yellow' }).start();
245
245
  await cliproxy.stop();
246
- await new Promise(r => setTimeout(r, 1500));
246
+ await new Promise(r => setTimeout(r, 2000));
247
247
  await cliproxy.start();
248
248
 
249
- // Wait for CLIProxyAPI to be fully ready (check health)
250
- restartSpinner.text = 'WAITING FOR CLIPROXYAPI TO BE READY...';
251
- let ready = false;
252
- for (let i = 0; i < 10; i++) {
253
- await new Promise(r => setTimeout(r, 1000));
249
+ // Wait for CLIProxyAPI to be fully ready with models loaded
250
+ restartSpinner.text = 'WAITING FOR CLIPROXYAPI TO LOAD TOKENS...';
251
+ let modelsResult = { success: false, models: [] };
252
+
253
+ for (let i = 0; i < 15; i++) {
254
+ await new Promise(r => setTimeout(r, 2000));
255
+ restartSpinner.text = `LOADING MODELS (${i + 1}/15)...`;
256
+
254
257
  const status = await cliproxy.isRunning();
255
258
  if (status.running) {
256
- // Try a simple fetch to verify it's responding
257
- const test = await cliproxy.fetchModels();
258
- if (test.success) {
259
- ready = true;
259
+ // Check if models are available (tokens loaded)
260
+ modelsResult = await cliproxy.fetchProviderModels(provider.id);
261
+ if (modelsResult.success && modelsResult.models.length > 0) {
262
+ restartSpinner.succeed(`CLIPROXYAPI READY - ${modelsResult.models.length} MODELS FOUND`);
260
263
  break;
261
264
  }
262
265
  }
263
- restartSpinner.text = `WAITING FOR CLIPROXYAPI (${i + 1}/10)...`;
264
- }
265
-
266
- if (!ready) {
267
- restartSpinner.warn('CLIPROXYAPI SLOW TO START - CONTINUING...');
268
- } else {
269
- restartSpinner.succeed('CLIPROXYAPI READY');
270
- }
271
-
272
- // Fetch models (with retry for provider-specific)
273
- const modelSpinner = ora({ text: 'FETCHING AVAILABLE MODELS...', color: 'yellow' }).start();
274
-
275
- let modelsResult = { success: false, models: [] };
276
- for (let attempt = 1; attempt <= 5; attempt++) {
277
- modelsResult = await cliproxy.fetchProviderModels(provider.id);
278
- if (modelsResult.success && modelsResult.models.length > 0) break;
279
- if (attempt < 5) {
280
- modelSpinner.text = `FETCHING MODELS (ATTEMPT ${attempt + 1}/5)...`;
281
- await new Promise(r => setTimeout(r, 1500));
282
- }
283
266
  }
284
267
 
268
+ // Show model selection or fallback to auto
285
269
  if (modelsResult.success && modelsResult.models.length > 0) {
286
- modelSpinner.succeed(`FOUND ${modelsResult.models.length} MODELS`);
287
-
288
270
  const selectedModel = await selectModelFromList(provider, modelsResult.models, boxWidth);
289
271
  if (selectedModel) {
290
272
  activateProvider(config, provider.id, {
@@ -298,7 +280,6 @@ const handleCliProxyConnection = async (provider, config, boxWidth) => {
298
280
  }
299
281
  }
300
282
  } else {
301
- modelSpinner.warn('NO MODELS FOUND - USING AUTO MODE');
302
283
  // No models but auth might have worked
303
284
  activateProvider(config, provider.id, {
304
285
  connectionType: 'cliproxy',
@@ -306,7 +287,7 @@ const handleCliProxyConnection = async (provider, config, boxWidth) => {
306
287
  modelName: 'AUTO'
307
288
  });
308
289
  if (saveConfig(config)) {
309
- console.log(chalk.green(`\n ✓ ${provider.name.toUpperCase()} CONNECTED VIA PAID PLAN`));
290
+ console.log(chalk.green(`\n ✓ ${provider.name.toUpperCase()} CONNECTED VIA PAID PLAN (AUTO MODE)`));
310
291
  }
311
292
  }
312
293