hedgequantx 2.7.26 → 2.7.27

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.27",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -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, () => {