hedgequantx 2.7.26 → 2.7.28

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.26",
3
+ "version": "2.7.28",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
package/src/app.js CHANGED
@@ -161,19 +161,21 @@ const getMobileLogo = () => [
161
161
  const run = async () => {
162
162
  try {
163
163
  log.info('Starting HQX CLI');
164
- await bannerClosed();
165
-
166
- // Restore session
167
- const spinner = ora({ text: 'Restoring session...', color: 'yellow' }).start();
164
+
165
+ // First launch - show banner with loading spinner
166
+ await banner();
167
+ const boxWidth = getLogoWidth();
168
+ const innerWidth = boxWidth - 2;
169
+ console.log(chalk.cyan('╠' + '═'.repeat(innerWidth) + '╣'));
170
+
171
+ const spinner = ora({ text: ' Loading...', color: 'yellow' }).start();
168
172
  const restored = await connections.restoreFromStorage();
169
173
 
170
174
  if (restored) {
171
- spinner.succeed('Session restored');
172
175
  currentService = connections.getAll()[0].service;
173
176
  await refreshStats();
174
- } else {
175
- spinner.info('No active session');
176
177
  }
178
+ spinner.stop();
177
179
 
178
180
  // Main loop
179
181
  while (true) {
@@ -23,6 +23,9 @@ const {
23
23
  getLoginUrl
24
24
  } = manager;
25
25
 
26
+ // Internal API key (must match config.yaml)
27
+ const API_KEY = 'hqx-internal-key';
28
+
26
29
  /**
27
30
  * Make HTTP request to local CLIProxyAPI
28
31
  * @param {string} path - API path
@@ -34,11 +37,14 @@ const {
34
37
  const fetchLocal = (path, method = 'GET', body = null, timeout = 60000) => {
35
38
  return new Promise((resolve) => {
36
39
  const options = {
37
- hostname: 'localhost',
40
+ hostname: '127.0.0.1',
38
41
  port: DEFAULT_PORT,
39
42
  path,
40
43
  method,
41
- headers: { 'Content-Type': 'application/json' },
44
+ headers: {
45
+ 'Content-Type': 'application/json',
46
+ 'Authorization': `Bearer ${API_KEY}`
47
+ },
42
48
  timeout
43
49
  };
44
50
 
@@ -243,10 +243,11 @@ const isRunning = async () => {
243
243
  }
244
244
  }
245
245
 
246
- // Also check by trying to connect
246
+ // Also check by trying to connect (accept 200, 401, 403 as "running")
247
247
  return new Promise((resolve) => {
248
- const req = http.get(`http://localhost:${DEFAULT_PORT}/v1/models`, (res) => {
249
- resolve({ running: res.statusCode === 200, pid: null });
248
+ const req = http.get(`http://127.0.0.1:${DEFAULT_PORT}/v1/models`, (res) => {
249
+ const running = res.statusCode === 200 || res.statusCode === 401 || res.statusCode === 403;
250
+ resolve({ running, pid: null });
250
251
  });
251
252
  req.on('error', () => resolve({ running: false, pid: null }));
252
253
  req.setTimeout(2000, () => {