hedgequantx 2.6.74 → 2.6.75

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.74",
3
+ "version": "2.6.75",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -901,7 +901,7 @@ const setupBrowserOAuth = async (provider, config) => {
901
901
  return await selectProviderOption(provider);
902
902
  }
903
903
 
904
- spinner.succeed('AUTHENTICATION SUCCESSFUL');
904
+ spinner.text = 'FETCHING AVAILABLE MODELS...';
905
905
 
906
906
  // Store OAuth credentials
907
907
  const credentials = {
@@ -919,15 +919,35 @@ const setupBrowserOAuth = async (provider, config) => {
919
919
  credentials.apiKey = result.apiKey;
920
920
  }
921
921
 
922
- // Use default model for OAuth providers (they typically have limited model access)
922
+ // Fetch available models for the provider
923
+ let models = [];
924
+ try {
925
+ const { fetchModelsWithOAuth } = require('../services/ai/client');
926
+ models = await fetchModelsWithOAuth(provider.id, result.access);
927
+ } catch (e) {
928
+ // Fallback to default models if fetch fails
929
+ }
930
+
931
+ // Fallback default models if API doesn't return list
923
932
  const defaultModels = {
924
- anthropic: 'claude-sonnet-4-20250514',
925
- openai: 'gpt-4o',
926
- gemini: 'gemini-2.5-pro',
927
- iflow: 'deepseek-v3'
933
+ anthropic: ['claude-sonnet-4-20250514', 'claude-opus-4-20250514', 'claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022'],
934
+ openai: ['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'o1', 'o1-mini', 'o3-mini'],
935
+ gemini: ['gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.0-flash', 'gemini-1.5-pro'],
936
+ iflow: ['deepseek-v3', 'deepseek-chat', 'kimi', 'glm-4']
928
937
  };
929
938
 
930
- const selectedModel = defaultModels[provider.id] || 'default';
939
+ if (!models || models.length === 0) {
940
+ models = defaultModels[provider.id] || ['default'];
941
+ spinner.warn('USING DEFAULT MODEL LIST');
942
+ } else {
943
+ spinner.succeed(`FOUND ${models.length} MODELS`);
944
+ }
945
+
946
+ // Let user select model
947
+ const selectedModel = await selectModelFromList(models, config.name);
948
+ if (!selectedModel) {
949
+ return await selectProviderOption(provider);
950
+ }
931
951
 
932
952
  // Add agent with OAuth credentials
933
953
  try {
@@ -1040,7 +1060,7 @@ const setupDeviceFlowOAuth = async (provider, config) => {
1040
1060
  return await selectProviderOption(provider);
1041
1061
  }
1042
1062
 
1043
- pollSpinner.succeed('AUTHENTICATION SUCCESSFUL');
1063
+ pollSpinner.text = 'FETCHING AVAILABLE MODELS...';
1044
1064
 
1045
1065
  // Store OAuth credentials
1046
1066
  const credentials = {
@@ -1052,7 +1072,16 @@ const setupDeviceFlowOAuth = async (provider, config) => {
1052
1072
  }
1053
1073
  };
1054
1074
 
1055
- const selectedModel = 'qwen3-coder-plus';
1075
+ // Default models for Qwen
1076
+ const defaultModels = ['qwen3-coder-plus', 'qwen3-235b', 'qwen-max', 'qwen-plus', 'qwen-turbo'];
1077
+
1078
+ pollSpinner.succeed('AUTHENTICATION SUCCESSFUL');
1079
+
1080
+ // Let user select model
1081
+ const selectedModel = await selectModelFromList(defaultModels, config.name);
1082
+ if (!selectedModel) {
1083
+ return await selectProviderOption(provider);
1084
+ }
1056
1085
 
1057
1086
  // Add agent with OAuth credentials
1058
1087
  try {
@@ -565,6 +565,47 @@ const fetchOpenAIModels = async (endpoint, apiKey) => {
565
565
  }
566
566
  };
567
567
 
568
+ /**
569
+ * Fetch available models for OAuth-authenticated providers
570
+ * @param {string} providerId - Provider ID (anthropic, openai, gemini, etc.)
571
+ * @param {string} accessToken - OAuth access token
572
+ * @returns {Promise<Array|null>} Array of model IDs or null on error
573
+ */
574
+ const fetchModelsWithOAuth = async (providerId, accessToken) => {
575
+ if (!accessToken) return null;
576
+
577
+ try {
578
+ switch (providerId) {
579
+ case 'anthropic':
580
+ return await fetchAnthropicModelsOAuth(accessToken);
581
+
582
+ case 'openai':
583
+ // OpenAI OAuth uses the same endpoint as API key
584
+ return await fetchOpenAIModels('https://api.openai.com/v1', accessToken);
585
+
586
+ case 'gemini':
587
+ // Gemini OAuth - try to fetch from API
588
+ const geminiUrl = 'https://generativelanguage.googleapis.com/v1/models';
589
+ const geminiHeaders = {
590
+ 'Authorization': `Bearer ${accessToken}`
591
+ };
592
+ const geminiResponse = await makeRequest(geminiUrl, { method: 'GET', headers: geminiHeaders, timeout: 10000 });
593
+ if (geminiResponse.models && Array.isArray(geminiResponse.models)) {
594
+ return geminiResponse.models
595
+ .filter(m => m.supportedGenerationMethods?.includes('generateContent'))
596
+ .map(m => m.name.replace('models/', ''))
597
+ .filter(Boolean);
598
+ }
599
+ return null;
600
+
601
+ default:
602
+ return null;
603
+ }
604
+ } catch (error) {
605
+ return null;
606
+ }
607
+ };
608
+
568
609
  module.exports = {
569
610
  callAI,
570
611
  analyzeTrading,
@@ -577,5 +618,6 @@ module.exports = {
577
618
  fetchAnthropicModelsOAuth,
578
619
  fetchGeminiModels,
579
620
  fetchOpenAIModels,
621
+ fetchModelsWithOAuth,
580
622
  getValidOAuthToken
581
623
  };