@involvex/super-agent-cli 0.0.48 → 0.0.49

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/dist/index.js CHANGED
@@ -146,21 +146,24 @@ class SettingsManager {
146
146
  this.saveUserSettings(settings);
147
147
  }
148
148
  }
149
- getAvailableModels() {
149
+ getAvailableModels(providerId) {
150
+ const activeProvider = providerId || this.getActiveProviderConfig()?.id || "grok";
151
+ let models = PROVIDER_MODELS[activeProvider];
152
+ if (!models) {
153
+ const config = this.getEffectiveSettings().providers[activeProvider];
154
+ if (config && PROVIDER_MODELS[config.provider]) {
155
+ models = PROVIDER_MODELS[config.provider];
156
+ }
157
+ }
158
+ if (models) {
159
+ return models;
160
+ }
150
161
  return [
151
162
  "grok-beta",
152
163
  "grok-vision-beta",
153
164
  "grok-2-vision-1212",
154
165
  "grok-2-1212",
155
- "grok-code-fast-1",
156
- "gpt-4o",
157
- "gpt-4o-mini",
158
- "o1-preview",
159
- "o1-mini",
160
- "gemini-3-pro-preview",
161
- "gemini-2.5-pro",
162
- "gemini-2.5-flash",
163
- "GLM-4.7"
166
+ "grok-code-fast-1"
164
167
  ];
165
168
  }
166
169
  getApiKey() {
@@ -181,8 +184,48 @@ class SettingsManager {
181
184
  function getSettingsManager() {
182
185
  return SettingsManager.getInstance();
183
186
  }
184
- var SETTINGS_VERSION = 2, DEFAULT_USER_SETTINGS, DEFAULT_PROJECT_SETTINGS;
187
+ var SETTINGS_VERSION = 2, PROVIDER_MODELS, DEFAULT_USER_SETTINGS, DEFAULT_PROJECT_SETTINGS;
185
188
  var init_settings_manager = __esm(() => {
189
+ PROVIDER_MODELS = {
190
+ grok: [
191
+ "grok-beta",
192
+ "grok-vision-beta",
193
+ "grok-2-vision-1212",
194
+ "grok-2-1212",
195
+ "grok-code-fast-1"
196
+ ],
197
+ openai: [
198
+ "gpt-4o",
199
+ "gpt-4o-mini",
200
+ "o1-preview",
201
+ "o1-mini",
202
+ "gpt-4-turbo",
203
+ "gpt-3.5-turbo"
204
+ ],
205
+ gemini: [
206
+ "gemini-2.0-flash",
207
+ "gemini-2.0-pro-exp-02-05",
208
+ "gemini-1.5-pro",
209
+ "gemini-1.5-flash"
210
+ ],
211
+ mistral: ["mistral-large-latest", "mistral-small-latest", "codestral-latest"],
212
+ openrouter: [
213
+ "anthropic/claude-3.5-sonnet",
214
+ "anthropic/claude-3-opus",
215
+ "meta-llama/llama-3.1-70b-instruct",
216
+ "mistralai/mistral-large",
217
+ "google/gemini-flash-1.5"
218
+ ],
219
+ minimax: ["abab6.5s-chat"],
220
+ groq: [
221
+ "llama-3.3-70b-versatile",
222
+ "llama-3.1-8b-instant",
223
+ "mixtral-8x7b-32768"
224
+ ],
225
+ deepseek: ["deepseek-chat", "deepseek-coder"],
226
+ ollama: ["llama3", "mistral", "codellama"],
227
+ "workers-ai": ["@cf/meta/llama-3.1-70b-instruct"]
228
+ };
186
229
  DEFAULT_USER_SETTINGS = {
187
230
  active_provider: "grok",
188
231
  providers: {
@@ -1288,9 +1331,12 @@ function useInputHandler({
1288
1331
  { command: "/commit-and-push", description: "AI commit & push to remote" },
1289
1332
  { command: "/exit", description: "Exit the application" }
1290
1333
  ];
1334
+ const [activeProvider, setActiveProvider] = useState3(() => {
1335
+ return getSettingsManager().loadUserSettings().active_provider;
1336
+ });
1291
1337
  const availableModels = useMemo2(() => {
1292
1338
  return loadModelConfig();
1293
- }, []);
1339
+ }, [activeProvider]);
1294
1340
  const handleDirectCommand = async (input2) => {
1295
1341
  const trimmedInput = input2.trim();
1296
1342
  if (trimmedInput === "/clear") {
@@ -1361,15 +1407,27 @@ Config Commands:
1361
1407
  const settings = manager.loadUserSettings();
1362
1408
  if (settings.providers && settings.providers[providerId]) {
1363
1409
  manager.updateUserSetting("active_provider", providerId);
1364
- setChatHistory((prev) => [
1365
- ...prev,
1366
- {
1367
- type: "assistant",
1368
- content: `✓ Switched active provider to: ${providerId}`,
1369
- timestamp: new Date
1370
- }
1371
- ]);
1372
- const newConfig = settings.providers[providerId];
1410
+ try {
1411
+ agent.setProvider(providerId);
1412
+ setActiveProvider(providerId);
1413
+ setChatHistory((prev) => [
1414
+ ...prev,
1415
+ {
1416
+ type: "assistant",
1417
+ content: `✓ Switched active provider to: ${providerId}`,
1418
+ timestamp: new Date
1419
+ }
1420
+ ]);
1421
+ } catch (error) {
1422
+ setChatHistory((prev) => [
1423
+ ...prev,
1424
+ {
1425
+ type: "assistant",
1426
+ content: `❌ Failed to switch provider: ${error.message}`,
1427
+ timestamp: new Date
1428
+ }
1429
+ ]);
1430
+ }
1373
1431
  } else {
1374
1432
  setChatHistory((prev) => [
1375
1433
  ...prev,
@@ -5770,6 +5828,30 @@ IMPORTANT RESPONSE GUIDELINES:
5770
5828
  Current working directory: ${process.cwd()}`
5771
5829
  });
5772
5830
  }
5831
+ setProvider(providerId) {
5832
+ const manager = getSettingsManager();
5833
+ const settings = manager.loadUserSettings();
5834
+ const activeProviderId = (providerId || "grok").toLowerCase();
5835
+ if (activeProviderId === "zai") {}
5836
+ const providerConfig = settings.providers[activeProviderId];
5837
+ if (!providerConfig) {
5838
+ throw new Error(`Provider '${activeProviderId}' not configured.`);
5839
+ }
5840
+ const providerType = providerConfig.provider || activeProviderId;
5841
+ const effectiveApiKey = providerConfig.api_key || "";
5842
+ const effectiveBaseURL = providerConfig.base_url || undefined;
5843
+ const effectiveModel = providerConfig.model || providerConfig.default_model || "grok-code-fast-1";
5844
+ if (providerType === "openai") {
5845
+ this.superAgentClient = new OpenAIProvider(effectiveApiKey, effectiveBaseURL, effectiveModel);
5846
+ } else if (providerType === "gemini" || providerType === "google") {
5847
+ this.superAgentClient = new GeminiProvider(effectiveApiKey, effectiveBaseURL, effectiveModel);
5848
+ } else if (providerType === "grok") {
5849
+ this.superAgentClient = new GrokProvider(effectiveApiKey, effectiveBaseURL, effectiveModel);
5850
+ } else {
5851
+ this.superAgentClient = new OpenAICompatibleProvider(effectiveApiKey, effectiveBaseURL || "", effectiveModel, activeProviderId);
5852
+ }
5853
+ this.tokenCounter = createTokenCounter(effectiveModel);
5854
+ }
5773
5855
  async initializeMCP() {
5774
5856
  Promise.resolve().then(async () => {
5775
5857
  try {
@@ -7211,7 +7293,7 @@ import { program } from "commander";
7211
7293
  // package.json
7212
7294
  var package_default = {
7213
7295
  name: "@involvex/super-agent-cli",
7214
- version: "0.0.48",
7296
+ version: "0.0.49",
7215
7297
  description: "An open-source AI agent that brings the power of Super Agent directly into your terminal.",
7216
7298
  keywords: [
7217
7299
  "cli",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@involvex/super-agent-cli",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "An open-source AI agent that brings the power of Super Agent directly into your terminal.",
5
5
  "keywords": [
6
6
  "cli",