hedgequantx 2.6.121 → 2.6.122

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.122",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -563,6 +563,16 @@ const submitCallback = async (callbackUrl, provider = 'anthropic') => {
563
563
  });
564
564
  };
565
565
 
566
+ /**
567
+ * Poll OAuth authentication status
568
+ * @param {string} state - OAuth state
569
+ * @returns {Promise<{status: string, error?: string}>}
570
+ */
571
+ const pollAuthStatus = async (state) => {
572
+ const response = await managementRequest('GET', `/v0/management/get-auth-status?state=${state}`);
573
+ return response;
574
+ };
575
+
566
576
  /**
567
577
  * Wait for OAuth authentication to complete
568
578
  * @param {string} state - OAuth state
@@ -589,76 +599,6 @@ const waitForAuth = async (state, timeoutMs = 300000, onStatus = () => {}) => {
589
599
  throw new Error('Authentication timeout');
590
600
  };
591
601
 
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
602
  /**
663
603
  * Get available models from the proxy
664
604
  * @returns {Promise<Array<string>>}