hedgequantx 2.5.26 → 2.5.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.5.26",
3
+ "version": "2.5.27",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -1042,7 +1042,7 @@ const selectModel = async (agent) => {
1042
1042
  drawBoxFooter(boxWidth);
1043
1043
 
1044
1044
  // Fetch models from real API
1045
- const { fetchAnthropicModels, fetchAnthropicModelsOAuth, fetchOpenAIModels } = require('../services/ai/client');
1045
+ const { fetchAnthropicModels, fetchAnthropicModelsOAuth, fetchGeminiModels, fetchOpenAIModels } = require('../services/ai/client');
1046
1046
 
1047
1047
  let models = null;
1048
1048
  const agentCredentials = aiService.getAgentCredentials(agent.id);
@@ -1060,6 +1060,9 @@ const selectModel = async (agent) => {
1060
1060
  // Standard API key
1061
1061
  models = await fetchAnthropicModels(token);
1062
1062
  }
1063
+ } else if (agent.providerId === 'gemini') {
1064
+ // Google Gemini API
1065
+ models = await fetchGeminiModels(agentCredentials?.apiKey);
1063
1066
  } else {
1064
1067
  // OpenAI-compatible providers
1065
1068
  const endpoint = agentCredentials?.endpoint || agent.provider?.endpoint;
@@ -367,6 +367,33 @@ const fetchAnthropicModelsOAuth = async (accessToken) => {
367
367
  }
368
368
  };
369
369
 
370
+ /**
371
+ * Fetch available models from Google Gemini API
372
+ * @param {string} apiKey - API key
373
+ * @returns {Promise<Array|null>} Array of model IDs or null on error
374
+ *
375
+ * Data source: https://generativelanguage.googleapis.com/v1/models (GET)
376
+ */
377
+ const fetchGeminiModels = async (apiKey) => {
378
+ if (!apiKey) return null;
379
+
380
+ const url = `https://generativelanguage.googleapis.com/v1/models?key=${apiKey}`;
381
+
382
+ try {
383
+ const response = await makeRequest(url, { method: 'GET', timeout: 10000 });
384
+ if (response.models && Array.isArray(response.models)) {
385
+ // Filter only generative models and extract the model name
386
+ return response.models
387
+ .filter(m => m.supportedGenerationMethods?.includes('generateContent'))
388
+ .map(m => m.name.replace('models/', ''))
389
+ .filter(Boolean);
390
+ }
391
+ return null;
392
+ } catch (error) {
393
+ return null;
394
+ }
395
+ };
396
+
370
397
  /**
371
398
  * Fetch available models from OpenAI-compatible API
372
399
  * @param {string} endpoint - API endpoint
@@ -407,6 +434,7 @@ module.exports = {
407
434
  callGemini,
408
435
  fetchAnthropicModels,
409
436
  fetchAnthropicModelsOAuth,
437
+ fetchGeminiModels,
410
438
  fetchOpenAIModels,
411
439
  getValidOAuthToken
412
440
  };
@@ -88,8 +88,8 @@ const PROVIDERS = {
88
88
  name: 'GEMINI (GOOGLE)',
89
89
  description: 'Direct connection to Gemini',
90
90
  category: 'direct',
91
- models: ['gemini-1.5-pro', 'gemini-1.5-flash', 'gemini-pro'],
92
- defaultModel: 'gemini-1.5-flash',
91
+ models: [], // Fetched from API at runtime
92
+ defaultModel: null, // Will use first model from API
93
93
  options: [
94
94
  {
95
95
  id: 'api_key',