hedgequantx 2.6.121 → 2.6.123

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.6.121",
3
+ "version": "2.6.123",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -517,9 +517,10 @@ const submitCallback = async (callbackUrl, provider = 'anthropic') => {
517
517
 
518
518
  // Each provider has its own OAuth callback port and path in CLIProxyAPI
519
519
  // We need to submit the callback to the correct port
520
+ // Ports are determined by the redirect_uri in the OAuth URL from CLIProxyAPI
520
521
  const providerConfig = {
521
522
  anthropic: { port: 54545, path: '/callback' },
522
- openai: { port: 16168, path: '/callback' },
523
+ openai: { port: 1455, path: '/auth/callback' },
523
524
  gemini: { port: 8085, path: '/oauth2callback' },
524
525
  qwen: { port: 8087, path: '/oauth2callback' },
525
526
  iflow: { port: 8088, path: '/callback' }
@@ -563,6 +564,16 @@ const submitCallback = async (callbackUrl, provider = 'anthropic') => {
563
564
  });
564
565
  };
565
566
 
567
+ /**
568
+ * Poll OAuth authentication status
569
+ * @param {string} state - OAuth state
570
+ * @returns {Promise<{status: string, error?: string}>}
571
+ */
572
+ const pollAuthStatus = async (state) => {
573
+ const response = await managementRequest('GET', `/v0/management/get-auth-status?state=${state}`);
574
+ return response;
575
+ };
576
+
566
577
  /**
567
578
  * Wait for OAuth authentication to complete
568
579
  * @param {string} state - OAuth state
@@ -589,76 +600,6 @@ const waitForAuth = async (state, timeoutMs = 300000, onStatus = () => {}) => {
589
600
  throw new Error('Authentication timeout');
590
601
  };
591
602
 
592
- /**
593
- * Submit OAuth callback URL manually (for remote/VPS use)
594
- * Extracts code and state from callback URL and submits to proxy via main port
595
- * @param {string} callbackUrl - Full callback URL (http://localhost:54545/callback?code=xxx&state=yyy)
596
- * @param {string} provider - Provider ID (anthropic, openai, gemini, qwen, iflow)
597
- * @returns {Promise<boolean>}
598
- */
599
- const submitCallback = async (callbackUrl, provider = 'anthropic') => {
600
- // Parse the callback URL
601
- let url;
602
- try {
603
- url = new URL(callbackUrl);
604
- } catch (e) {
605
- throw new Error('Invalid callback URL format');
606
- }
607
-
608
- const code = url.searchParams.get('code');
609
- const state = url.searchParams.get('state');
610
-
611
- if (!code || !state) {
612
- throw new Error('Missing code or state in callback URL');
613
- }
614
-
615
- // Map provider to callback endpoint
616
- const callbackEndpoints = {
617
- anthropic: '/anthropic/callback',
618
- openai: '/codex/callback',
619
- gemini: '/gemini/callback',
620
- qwen: '/qwen/callback',
621
- iflow: '/iflow/callback'
622
- };
623
-
624
- const endpoint = callbackEndpoints[provider] || '/anthropic/callback';
625
-
626
- // Submit to proxy via main port (8317)
627
- return new Promise((resolve, reject) => {
628
- const callbackPath = `${endpoint}?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state)}`;
629
-
630
- const req = http.request({
631
- hostname: '127.0.0.1',
632
- port: PROXY_PORT,
633
- path: callbackPath,
634
- method: 'GET',
635
- timeout: 30000
636
- }, (res) => {
637
- let data = '';
638
- res.on('data', chunk => data += chunk);
639
- res.on('end', () => {
640
- // Success if we get a redirect or success page
641
- if (res.statusCode === 200 || res.statusCode === 302 || res.statusCode === 301) {
642
- resolve(true);
643
- } else {
644
- reject(new Error(`Callback failed with status ${res.statusCode}`));
645
- }
646
- });
647
- });
648
-
649
- req.on('error', (e) => {
650
- reject(new Error(`Failed to submit callback: ${e.message}`));
651
- });
652
-
653
- req.on('timeout', () => {
654
- req.destroy();
655
- reject(new Error('Callback request timeout'));
656
- });
657
-
658
- req.end();
659
- });
660
- };
661
-
662
603
  /**
663
604
  * Get available models from the proxy
664
605
  * @returns {Promise<Array<string>>}