@involvex/super-agent-cli 0.0.63 → 0.0.66

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
@@ -978,7 +978,7 @@ var init_session_manager = __esm(() => {
978
978
  var require_package = __commonJS((exports, module) => {
979
979
  module.exports = {
980
980
  name: "@involvex/super-agent-cli",
981
- version: "0.0.63",
981
+ version: "0.0.66",
982
982
  description: "An open-source AI agent that brings the power of Super Agent directly into your terminal.",
983
983
  keywords: [
984
984
  "cli",
@@ -3098,13 +3098,19 @@ function useInputHandler({
3098
3098
  const commandSuggestions = [
3099
3099
  { command: "/help", description: "Show help information" },
3100
3100
  { command: "/clear", description: "Clear chat history" },
3101
+ { command: "/doctor", description: "Check status & connection" },
3101
3102
  { command: "/models", description: "Switch Super Agent Model" },
3102
3103
  { command: "/config", description: "View or edit configuration" },
3104
+ { command: "/commands", description: "Manage custom commands" },
3103
3105
  { command: "/provider", description: "Manage AI providers" },
3104
3106
  { command: "/chat save <name>", description: "Save current chat" },
3105
3107
  { command: "/chat load <name>", description: "Load a saved chat" },
3106
3108
  { command: "/chat list", description: "List saved chats" },
3107
3109
  { command: "/chat delete <name>", description: "Delete a saved chat" },
3110
+ { command: "/skills", description: "Manage AI skills" },
3111
+ { command: "/agents", description: "Manage AI agents" },
3112
+ { command: "/import", description: "Import from other AI assistants" },
3113
+ { command: "/index", description: "Index current directory" },
3108
3114
  {
3109
3115
  command: "/mcp <action>",
3110
3116
  description: "Manage MCP servers"
@@ -3123,9 +3129,31 @@ function useInputHandler({
3123
3129
  const [activeProvider, setActiveProvider] = useState3(() => {
3124
3130
  return getSettingsManager().loadUserSettings().active_provider;
3125
3131
  });
3132
+ const [dynamicModels, setDynamicModels] = useState3([]);
3133
+ useEffect(() => {
3134
+ let mounted = true;
3135
+ const fetchModels = async () => {
3136
+ try {
3137
+ const models = await agent.listModels();
3138
+ if (mounted && models.length > 0) {
3139
+ setDynamicModels(models);
3140
+ }
3141
+ } catch (e) {}
3142
+ };
3143
+ fetchModels();
3144
+ return () => {
3145
+ mounted = false;
3146
+ };
3147
+ }, [activeProvider, agent]);
3126
3148
  const availableModels = useMemo2(() => {
3127
- return loadModelConfig(activeProvider);
3128
- }, [activeProvider]);
3149
+ const configModels = loadModelConfig(activeProvider);
3150
+ if (dynamicModels.length > 0) {
3151
+ const configModelNames = new Set(configModels.map((m) => m.model));
3152
+ const newModels = dynamicModels.filter((m) => !configModelNames.has(m)).map((m) => ({ model: m }));
3153
+ return [...configModels, ...newModels];
3154
+ }
3155
+ return configModels;
3156
+ }, [activeProvider, dynamicModels]);
3129
3157
  const handleDirectCommand = async (input2) => {
3130
3158
  const trimmedInput = input2.trim();
3131
3159
  if (trimmedInput === "/clear") {
@@ -3149,9 +3177,11 @@ function useInputHandler({
3149
3177
  Built-in Commands:
3150
3178
  /clear - Clear chat history
3151
3179
  /help - Show this help
3180
+ /doctor - Check system health & connection
3152
3181
  /models - Switch between available models
3153
3182
  /config - View current configuration
3154
3183
  /provider - List or switch AI providers
3184
+ /commands - Manage custom slash commands
3155
3185
  /exit - Exit application
3156
3186
  exit, quit - Exit application
3157
3187
 
@@ -3168,6 +3198,7 @@ Config Commands:
3168
3198
  /config - View current active configuration
3169
3199
  /provider - List configured providers
3170
3200
  /provider use <id> - Switch active AI provider
3201
+ /provider set-account <id> <acc_id> - Set account ID (e.g. workers-ai)
3171
3202
  /model set <id> - Set active model for current provider
3172
3203
  `,
3173
3204
  timestamp: new Date
@@ -3179,6 +3210,154 @@ Config Commands:
3179
3210
  if (trimmedInput === "/exit") {
3180
3211
  process.exit(0);
3181
3212
  }
3213
+ if (trimmedInput === "/doctor") {
3214
+ setIsProcessing(true);
3215
+ const manager = getSettingsManager();
3216
+ const settings = manager.loadUserSettings();
3217
+ const active = settings.active_provider;
3218
+ const config = settings.providers[active];
3219
+ let checks = `Super Agent Doctor \uD83E\uDE7A
3220
+
3221
+ `;
3222
+ checks += `✅ Active Provider: ${active}
3223
+ `;
3224
+ checks += config ? `✅ Configuration found
3225
+ ` : `❌ Configuration MISSING
3226
+ `;
3227
+ checks += config?.api_key ? `✅ API Key set
3228
+ ` : `❌ API Key MISSING
3229
+ `;
3230
+ if (active === "workers-ai") {
3231
+ checks += config?.account_id ? `✅ Account ID set
3232
+ ` : `❌ Account ID MISSING (use /provider set-account)
3233
+ `;
3234
+ }
3235
+ try {
3236
+ const checkAgent = agent;
3237
+ const models = await checkAgent.listModels();
3238
+ checks += `✅ Connection check: OK (${models.length} models found)
3239
+ `;
3240
+ } catch (e) {
3241
+ checks += `❌ Connection check: FAILED (${e.message})
3242
+ `;
3243
+ }
3244
+ setChatHistory((prev) => [
3245
+ ...prev,
3246
+ {
3247
+ type: "assistant",
3248
+ content: checks,
3249
+ timestamp: new Date
3250
+ }
3251
+ ]);
3252
+ setIsProcessing(false);
3253
+ clearInput();
3254
+ return true;
3255
+ }
3256
+ if (trimmedInput === "/commands") {
3257
+ setChatHistory((prev) => [
3258
+ ...prev,
3259
+ {
3260
+ type: "assistant",
3261
+ content: "Usage: /commands <add|remove|list> [name] [prompt]",
3262
+ timestamp: new Date
3263
+ }
3264
+ ]);
3265
+ clearInput();
3266
+ return true;
3267
+ }
3268
+ if (trimmedInput.startsWith("/commands ")) {
3269
+ const args = trimmedInput.split(" ");
3270
+ const action = args[1];
3271
+ const manager = getSettingsManager();
3272
+ const settings = manager.loadUserSettings();
3273
+ const customCommands = settings.custom_commands || {};
3274
+ if (action === "add") {
3275
+ const name = args[2];
3276
+ const prompt = args.slice(3).join(" ");
3277
+ if (!name || !prompt) {
3278
+ setChatHistory((prev) => [
3279
+ ...prev,
3280
+ {
3281
+ type: "assistant",
3282
+ content: "❌ Usage: /commands add <name> <prompt>",
3283
+ timestamp: new Date
3284
+ }
3285
+ ]);
3286
+ clearInput();
3287
+ return true;
3288
+ }
3289
+ const newCommands = { ...customCommands, [name]: prompt };
3290
+ manager.updateUserSetting("custom_commands", newCommands);
3291
+ setChatHistory((prev) => [
3292
+ ...prev,
3293
+ {
3294
+ type: "assistant",
3295
+ content: `✅ Custom command '/${name}' created.`,
3296
+ timestamp: new Date
3297
+ }
3298
+ ]);
3299
+ } else if (action === "remove") {
3300
+ const name = args[2];
3301
+ if (!name || !customCommands[name]) {
3302
+ setChatHistory((prev) => [
3303
+ ...prev,
3304
+ {
3305
+ type: "assistant",
3306
+ content: `❌ Command '/${name}' not found.`,
3307
+ timestamp: new Date
3308
+ }
3309
+ ]);
3310
+ clearInput();
3311
+ return true;
3312
+ }
3313
+ const newCommands = { ...customCommands };
3314
+ delete newCommands[name];
3315
+ manager.updateUserSetting("custom_commands", newCommands);
3316
+ setChatHistory((prev) => [
3317
+ ...prev,
3318
+ {
3319
+ type: "assistant",
3320
+ content: `✅ Custom command '/${name}' removed.`,
3321
+ timestamp: new Date
3322
+ }
3323
+ ]);
3324
+ } else if (action === "list") {
3325
+ const commandList = Object.keys(customCommands);
3326
+ if (commandList.length === 0) {
3327
+ setChatHistory((prev) => [
3328
+ ...prev,
3329
+ {
3330
+ type: "assistant",
3331
+ content: "No custom commands defined. Use /commands add to create one.",
3332
+ timestamp: new Date
3333
+ }
3334
+ ]);
3335
+ } else {
3336
+ const list = commandList.map((name) => ` /${name} - ${customCommands[name]}`).join(`
3337
+ `);
3338
+ setChatHistory((prev) => [
3339
+ ...prev,
3340
+ {
3341
+ type: "assistant",
3342
+ content: `Custom Commands:
3343
+ ${list}`,
3344
+ timestamp: new Date
3345
+ }
3346
+ ]);
3347
+ }
3348
+ } else {
3349
+ setChatHistory((prev) => [
3350
+ ...prev,
3351
+ {
3352
+ type: "assistant",
3353
+ content: "❌ Usage: /commands <add|remove|list> [name] [prompt]",
3354
+ timestamp: new Date
3355
+ }
3356
+ ]);
3357
+ }
3358
+ clearInput();
3359
+ return true;
3360
+ }
3182
3361
  if (trimmedInput === "/config") {
3183
3362
  setShowConfigViewer(true);
3184
3363
  clearInput();
@@ -3288,6 +3467,57 @@ Config Commands:
3288
3467
  clearInput();
3289
3468
  return true;
3290
3469
  }
3470
+ if (trimmedInput.startsWith("/provider set-account ")) {
3471
+ const args = trimmedInput.replace("/provider set-account ", "").trim().split(" ");
3472
+ const providerId = args[0];
3473
+ const accountId = args[1];
3474
+ if (!providerId || !accountId) {
3475
+ setChatHistory((prev) => [
3476
+ ...prev,
3477
+ {
3478
+ type: "assistant",
3479
+ content: "❌ Usage: /provider set-account <provider> <account_id>",
3480
+ timestamp: new Date
3481
+ }
3482
+ ]);
3483
+ clearInput();
3484
+ return true;
3485
+ }
3486
+ const manager = getSettingsManager();
3487
+ const settings = manager.loadUserSettings();
3488
+ if (settings.providers && settings.providers[providerId]) {
3489
+ const newProviders = { ...settings.providers };
3490
+ newProviders[providerId] = {
3491
+ ...newProviders[providerId],
3492
+ account_id: accountId
3493
+ };
3494
+ manager.updateUserSetting("providers", newProviders);
3495
+ setChatHistory((prev) => [
3496
+ ...prev,
3497
+ {
3498
+ type: "assistant",
3499
+ content: `✅ Account ID for ${providerId} updated.`,
3500
+ timestamp: new Date
3501
+ }
3502
+ ]);
3503
+ if (providerId === activeProvider) {
3504
+ try {
3505
+ agent.setProvider(providerId);
3506
+ } catch (e) {}
3507
+ }
3508
+ } else {
3509
+ setChatHistory((prev) => [
3510
+ ...prev,
3511
+ {
3512
+ type: "assistant",
3513
+ content: `❌ Provider '${providerId}' not found.`,
3514
+ timestamp: new Date
3515
+ }
3516
+ ]);
3517
+ }
3518
+ clearInput();
3519
+ return true;
3520
+ }
3291
3521
  if (trimmedInput.startsWith("/model set ")) {
3292
3522
  const modelId = trimmedInput.replace("/model set ", "").trim();
3293
3523
  if (modelId) {
@@ -4005,6 +4235,19 @@ ${structure}
4005
4235
  } catch (e) {}
4006
4236
  }
4007
4237
  }
4238
+ if (userInput.startsWith("/")) {
4239
+ const commandName = userInput.split(" ")[0].slice(1);
4240
+ const manager = getSettingsManager();
4241
+ const settings = manager.loadUserSettings();
4242
+ const customCommands = settings.custom_commands || {};
4243
+ if (customCommands[commandName]) {
4244
+ const args = userInput.split(" ").slice(1);
4245
+ resolvedInput = customCommands[commandName];
4246
+ if (args.length > 0) {
4247
+ resolvedInput += " " + args.join(" ");
4248
+ }
4249
+ }
4250
+ }
4008
4251
  if (agentMode === "plan") {
4009
4252
  resolvedInput = `[MODE: PLAN] ${resolvedInput}`;
4010
4253
  } else if (agentMode === "debug") {
@@ -6951,6 +7194,14 @@ class OpenAICompatibleProvider {
6951
7194
  throw new Error(`${this.name} API error: ${error.message}`);
6952
7195
  }
6953
7196
  }
7197
+ async listModels() {
7198
+ try {
7199
+ const response = await this.client.models.list();
7200
+ return response.data.map((m) => m.id);
7201
+ } catch (error) {
7202
+ return [];
7203
+ }
7204
+ }
6954
7205
  }
6955
7206
 
6956
7207
  // src/utils/custom-instructions.ts
@@ -7042,6 +7293,14 @@ class OpenAIProvider {
7042
7293
  throw new Error(`OpenAI API error: ${error.message}`);
7043
7294
  }
7044
7295
  }
7296
+ async listModels() {
7297
+ try {
7298
+ const response = await this.client.models.list();
7299
+ return response.data.map((m) => m.id);
7300
+ } catch (error) {
7301
+ return [];
7302
+ }
7303
+ }
7045
7304
  }
7046
7305
 
7047
7306
  // src/core/providers/gemini.ts
@@ -7205,6 +7464,9 @@ class GeminiProvider {
7205
7464
  throw new Error(`Gemini API error: ${error.message}`);
7206
7465
  }
7207
7466
  }
7467
+ async listModels() {
7468
+ return [];
7469
+ }
7208
7470
  }
7209
7471
 
7210
7472
  // src/core/providers/grok.ts
@@ -7276,6 +7538,14 @@ class GrokProvider {
7276
7538
  throw new Error(`Grok API error: ${error.message}`);
7277
7539
  }
7278
7540
  }
7541
+ async listModels() {
7542
+ try {
7543
+ const response = await this.client.models.list();
7544
+ return response.data.map((m) => m.id);
7545
+ } catch (error) {
7546
+ return [];
7547
+ }
7548
+ }
7279
7549
  }
7280
7550
 
7281
7551
  // src/agent/super-agent.ts
@@ -7309,7 +7579,12 @@ class SuperAgent extends EventEmitter4 {
7309
7579
  const providerConfig = settings.providers[activeProviderId];
7310
7580
  const providerType = providerConfig?.provider || activeProviderId;
7311
7581
  const effectiveApiKey = apiKey || providerConfig?.api_key || "";
7312
- const effectiveBaseURL = baseURL || (providerConfig?.base_url ? providerConfig.base_url : undefined);
7582
+ let effectiveBaseURL = baseURL || (providerConfig?.base_url ? providerConfig.base_url : undefined);
7583
+ if (providerConfig?.provider === "workers-ai" && effectiveBaseURL?.includes("{ACCOUNT_ID}")) {
7584
+ if (providerConfig.account_id) {
7585
+ effectiveBaseURL = effectiveBaseURL.replace("{ACCOUNT_ID}", providerConfig.account_id);
7586
+ }
7587
+ }
7313
7588
  const effectiveModel = model || providerConfig?.model || providerConfig?.default_model || "grok-code-fast-1";
7314
7589
  this.maxToolRounds = maxToolRounds || 400;
7315
7590
  if (providerType === "openai") {
@@ -7414,7 +7689,12 @@ Current working directory: ${process.cwd()}`
7414
7689
  }
7415
7690
  const providerType = providerConfig.provider || activeProviderId;
7416
7691
  const effectiveApiKey = providerConfig.api_key || "";
7417
- const effectiveBaseURL = providerConfig.base_url || undefined;
7692
+ let effectiveBaseURL = providerConfig.base_url || undefined;
7693
+ if (providerConfig.provider === "workers-ai" && effectiveBaseURL?.includes("{ACCOUNT_ID}")) {
7694
+ if (providerConfig.account_id) {
7695
+ effectiveBaseURL = effectiveBaseURL.replace("{ACCOUNT_ID}", providerConfig.account_id);
7696
+ }
7697
+ }
7418
7698
  const effectiveModel = providerConfig.model || providerConfig.default_model || "grok-code-fast-1";
7419
7699
  if (providerType === "openai") {
7420
7700
  this.superAgentClient = new OpenAIProvider(effectiveApiKey, effectiveBaseURL, effectiveModel);
@@ -7427,6 +7707,12 @@ Current working directory: ${process.cwd()}`
7427
7707
  }
7428
7708
  this.tokenCounter = createTokenCounter(effectiveModel);
7429
7709
  }
7710
+ async listModels() {
7711
+ if (this.superAgentClient.listModels) {
7712
+ return this.superAgentClient.listModels();
7713
+ }
7714
+ return [];
7715
+ }
7430
7716
  async initializeMCP() {
7431
7717
  Promise.resolve().then(async () => {
7432
7718
  try {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@involvex/super-agent-cli",
3
- "version": "0.0.63",
3
+ "version": "0.0.66",
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",