@involvex/super-agent-cli 0.0.63 → 0.0.64
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 +188 -5
- package/dist/super-agent-cli.exe +0 -0
- package/package.json +1 -1
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.
|
|
981
|
+
version: "0.0.64",
|
|
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",
|
|
@@ -3123,9 +3123,31 @@ function useInputHandler({
|
|
|
3123
3123
|
const [activeProvider, setActiveProvider] = useState3(() => {
|
|
3124
3124
|
return getSettingsManager().loadUserSettings().active_provider;
|
|
3125
3125
|
});
|
|
3126
|
+
const [dynamicModels, setDynamicModels] = useState3([]);
|
|
3127
|
+
useEffect(() => {
|
|
3128
|
+
let mounted = true;
|
|
3129
|
+
const fetchModels = async () => {
|
|
3130
|
+
try {
|
|
3131
|
+
const models = await agent.listModels();
|
|
3132
|
+
if (mounted && models.length > 0) {
|
|
3133
|
+
setDynamicModels(models);
|
|
3134
|
+
}
|
|
3135
|
+
} catch (e) {}
|
|
3136
|
+
};
|
|
3137
|
+
fetchModels();
|
|
3138
|
+
return () => {
|
|
3139
|
+
mounted = false;
|
|
3140
|
+
};
|
|
3141
|
+
}, [activeProvider, agent]);
|
|
3126
3142
|
const availableModels = useMemo2(() => {
|
|
3127
|
-
|
|
3128
|
-
|
|
3143
|
+
const configModels = loadModelConfig(activeProvider);
|
|
3144
|
+
if (dynamicModels.length > 0) {
|
|
3145
|
+
const configModelNames = new Set(configModels.map((m) => m.model));
|
|
3146
|
+
const newModels = dynamicModels.filter((m) => !configModelNames.has(m)).map((m) => ({ model: m }));
|
|
3147
|
+
return [...configModels, ...newModels];
|
|
3148
|
+
}
|
|
3149
|
+
return configModels;
|
|
3150
|
+
}, [activeProvider, dynamicModels]);
|
|
3129
3151
|
const handleDirectCommand = async (input2) => {
|
|
3130
3152
|
const trimmedInput = input2.trim();
|
|
3131
3153
|
if (trimmedInput === "/clear") {
|
|
@@ -3179,6 +3201,73 @@ Config Commands:
|
|
|
3179
3201
|
if (trimmedInput === "/exit") {
|
|
3180
3202
|
process.exit(0);
|
|
3181
3203
|
}
|
|
3204
|
+
if (trimmedInput === "/doctor") {
|
|
3205
|
+
setIsProcessing(true);
|
|
3206
|
+
const manager = getSettingsManager();
|
|
3207
|
+
const settings = manager.loadUserSettings();
|
|
3208
|
+
const active = settings.active_provider;
|
|
3209
|
+
const config = settings.providers[active];
|
|
3210
|
+
let checks = `Super Agent Doctor \uD83E\uDE7A
|
|
3211
|
+
|
|
3212
|
+
`;
|
|
3213
|
+
checks += `✅ Active Provider: ${active}
|
|
3214
|
+
`;
|
|
3215
|
+
checks += config ? `✅ Configuration found
|
|
3216
|
+
` : `❌ Configuration MISSING
|
|
3217
|
+
`;
|
|
3218
|
+
checks += config?.api_key ? `✅ API Key set
|
|
3219
|
+
` : `❌ API Key MISSING
|
|
3220
|
+
`;
|
|
3221
|
+
if (active === "workers-ai") {
|
|
3222
|
+
checks += config?.account_id ? `✅ Account ID set
|
|
3223
|
+
` : `❌ Account ID MISSING (use /provider set-account)
|
|
3224
|
+
`;
|
|
3225
|
+
}
|
|
3226
|
+
try {
|
|
3227
|
+
const checkAgent = agent;
|
|
3228
|
+
const models = await checkAgent.listModels();
|
|
3229
|
+
checks += `✅ Connection check: OK (${models.length} models found)
|
|
3230
|
+
`;
|
|
3231
|
+
} catch (e) {
|
|
3232
|
+
checks += `❌ Connection check: FAILED (${e.message})
|
|
3233
|
+
`;
|
|
3234
|
+
}
|
|
3235
|
+
setChatHistory((prev) => [
|
|
3236
|
+
...prev,
|
|
3237
|
+
{
|
|
3238
|
+
type: "assistant",
|
|
3239
|
+
content: checks,
|
|
3240
|
+
timestamp: new Date
|
|
3241
|
+
}
|
|
3242
|
+
]);
|
|
3243
|
+
setIsProcessing(false);
|
|
3244
|
+
clearInput();
|
|
3245
|
+
return true;
|
|
3246
|
+
}
|
|
3247
|
+
if (trimmedInput === "/commands") {
|
|
3248
|
+
setChatHistory((prev) => [
|
|
3249
|
+
...prev,
|
|
3250
|
+
{
|
|
3251
|
+
type: "assistant",
|
|
3252
|
+
content: "Usage: /commands <add|remove|list> [name] [prompt]",
|
|
3253
|
+
timestamp: new Date
|
|
3254
|
+
}
|
|
3255
|
+
]);
|
|
3256
|
+
clearInput();
|
|
3257
|
+
return true;
|
|
3258
|
+
}
|
|
3259
|
+
if (trimmedInput.startsWith("/commands ")) {
|
|
3260
|
+
setChatHistory((prev) => [
|
|
3261
|
+
...prev,
|
|
3262
|
+
{
|
|
3263
|
+
type: "assistant",
|
|
3264
|
+
content: "\uD83D\uDEA7 Custom commands support implies storing them. Feature placeholder.",
|
|
3265
|
+
timestamp: new Date
|
|
3266
|
+
}
|
|
3267
|
+
]);
|
|
3268
|
+
clearInput();
|
|
3269
|
+
return true;
|
|
3270
|
+
}
|
|
3182
3271
|
if (trimmedInput === "/config") {
|
|
3183
3272
|
setShowConfigViewer(true);
|
|
3184
3273
|
clearInput();
|
|
@@ -3288,6 +3377,57 @@ Config Commands:
|
|
|
3288
3377
|
clearInput();
|
|
3289
3378
|
return true;
|
|
3290
3379
|
}
|
|
3380
|
+
if (trimmedInput.startsWith("/provider set-account ")) {
|
|
3381
|
+
const args = trimmedInput.replace("/provider set-account ", "").trim().split(" ");
|
|
3382
|
+
const providerId = args[0];
|
|
3383
|
+
const accountId = args[1];
|
|
3384
|
+
if (!providerId || !accountId) {
|
|
3385
|
+
setChatHistory((prev) => [
|
|
3386
|
+
...prev,
|
|
3387
|
+
{
|
|
3388
|
+
type: "assistant",
|
|
3389
|
+
content: "❌ Usage: /provider set-account <provider> <account_id>",
|
|
3390
|
+
timestamp: new Date
|
|
3391
|
+
}
|
|
3392
|
+
]);
|
|
3393
|
+
clearInput();
|
|
3394
|
+
return true;
|
|
3395
|
+
}
|
|
3396
|
+
const manager = getSettingsManager();
|
|
3397
|
+
const settings = manager.loadUserSettings();
|
|
3398
|
+
if (settings.providers && settings.providers[providerId]) {
|
|
3399
|
+
const newProviders = { ...settings.providers };
|
|
3400
|
+
newProviders[providerId] = {
|
|
3401
|
+
...newProviders[providerId],
|
|
3402
|
+
account_id: accountId
|
|
3403
|
+
};
|
|
3404
|
+
manager.updateUserSetting("providers", newProviders);
|
|
3405
|
+
setChatHistory((prev) => [
|
|
3406
|
+
...prev,
|
|
3407
|
+
{
|
|
3408
|
+
type: "assistant",
|
|
3409
|
+
content: `✅ Account ID for ${providerId} updated.`,
|
|
3410
|
+
timestamp: new Date
|
|
3411
|
+
}
|
|
3412
|
+
]);
|
|
3413
|
+
if (providerId === activeProvider) {
|
|
3414
|
+
try {
|
|
3415
|
+
agent.setProvider(providerId);
|
|
3416
|
+
} catch (e) {}
|
|
3417
|
+
}
|
|
3418
|
+
} else {
|
|
3419
|
+
setChatHistory((prev) => [
|
|
3420
|
+
...prev,
|
|
3421
|
+
{
|
|
3422
|
+
type: "assistant",
|
|
3423
|
+
content: `❌ Provider '${providerId}' not found.`,
|
|
3424
|
+
timestamp: new Date
|
|
3425
|
+
}
|
|
3426
|
+
]);
|
|
3427
|
+
}
|
|
3428
|
+
clearInput();
|
|
3429
|
+
return true;
|
|
3430
|
+
}
|
|
3291
3431
|
if (trimmedInput.startsWith("/model set ")) {
|
|
3292
3432
|
const modelId = trimmedInput.replace("/model set ", "").trim();
|
|
3293
3433
|
if (modelId) {
|
|
@@ -6951,6 +7091,14 @@ class OpenAICompatibleProvider {
|
|
|
6951
7091
|
throw new Error(`${this.name} API error: ${error.message}`);
|
|
6952
7092
|
}
|
|
6953
7093
|
}
|
|
7094
|
+
async listModels() {
|
|
7095
|
+
try {
|
|
7096
|
+
const response = await this.client.models.list();
|
|
7097
|
+
return response.data.map((m) => m.id);
|
|
7098
|
+
} catch (error) {
|
|
7099
|
+
return [];
|
|
7100
|
+
}
|
|
7101
|
+
}
|
|
6954
7102
|
}
|
|
6955
7103
|
|
|
6956
7104
|
// src/utils/custom-instructions.ts
|
|
@@ -7042,6 +7190,14 @@ class OpenAIProvider {
|
|
|
7042
7190
|
throw new Error(`OpenAI API error: ${error.message}`);
|
|
7043
7191
|
}
|
|
7044
7192
|
}
|
|
7193
|
+
async listModels() {
|
|
7194
|
+
try {
|
|
7195
|
+
const response = await this.client.models.list();
|
|
7196
|
+
return response.data.map((m) => m.id);
|
|
7197
|
+
} catch (error) {
|
|
7198
|
+
return [];
|
|
7199
|
+
}
|
|
7200
|
+
}
|
|
7045
7201
|
}
|
|
7046
7202
|
|
|
7047
7203
|
// src/core/providers/gemini.ts
|
|
@@ -7205,6 +7361,9 @@ class GeminiProvider {
|
|
|
7205
7361
|
throw new Error(`Gemini API error: ${error.message}`);
|
|
7206
7362
|
}
|
|
7207
7363
|
}
|
|
7364
|
+
async listModels() {
|
|
7365
|
+
return [];
|
|
7366
|
+
}
|
|
7208
7367
|
}
|
|
7209
7368
|
|
|
7210
7369
|
// src/core/providers/grok.ts
|
|
@@ -7276,6 +7435,14 @@ class GrokProvider {
|
|
|
7276
7435
|
throw new Error(`Grok API error: ${error.message}`);
|
|
7277
7436
|
}
|
|
7278
7437
|
}
|
|
7438
|
+
async listModels() {
|
|
7439
|
+
try {
|
|
7440
|
+
const response = await this.client.models.list();
|
|
7441
|
+
return response.data.map((m) => m.id);
|
|
7442
|
+
} catch (error) {
|
|
7443
|
+
return [];
|
|
7444
|
+
}
|
|
7445
|
+
}
|
|
7279
7446
|
}
|
|
7280
7447
|
|
|
7281
7448
|
// src/agent/super-agent.ts
|
|
@@ -7309,7 +7476,12 @@ class SuperAgent extends EventEmitter4 {
|
|
|
7309
7476
|
const providerConfig = settings.providers[activeProviderId];
|
|
7310
7477
|
const providerType = providerConfig?.provider || activeProviderId;
|
|
7311
7478
|
const effectiveApiKey = apiKey || providerConfig?.api_key || "";
|
|
7312
|
-
|
|
7479
|
+
let effectiveBaseURL = baseURL || (providerConfig?.base_url ? providerConfig.base_url : undefined);
|
|
7480
|
+
if (providerConfig?.provider === "workers-ai" && effectiveBaseURL?.includes("{ACCOUNT_ID}")) {
|
|
7481
|
+
if (providerConfig.account_id) {
|
|
7482
|
+
effectiveBaseURL = effectiveBaseURL.replace("{ACCOUNT_ID}", providerConfig.account_id);
|
|
7483
|
+
}
|
|
7484
|
+
}
|
|
7313
7485
|
const effectiveModel = model || providerConfig?.model || providerConfig?.default_model || "grok-code-fast-1";
|
|
7314
7486
|
this.maxToolRounds = maxToolRounds || 400;
|
|
7315
7487
|
if (providerType === "openai") {
|
|
@@ -7414,7 +7586,12 @@ Current working directory: ${process.cwd()}`
|
|
|
7414
7586
|
}
|
|
7415
7587
|
const providerType = providerConfig.provider || activeProviderId;
|
|
7416
7588
|
const effectiveApiKey = providerConfig.api_key || "";
|
|
7417
|
-
|
|
7589
|
+
let effectiveBaseURL = providerConfig.base_url || undefined;
|
|
7590
|
+
if (providerConfig.provider === "workers-ai" && effectiveBaseURL?.includes("{ACCOUNT_ID}")) {
|
|
7591
|
+
if (providerConfig.account_id) {
|
|
7592
|
+
effectiveBaseURL = effectiveBaseURL.replace("{ACCOUNT_ID}", providerConfig.account_id);
|
|
7593
|
+
}
|
|
7594
|
+
}
|
|
7418
7595
|
const effectiveModel = providerConfig.model || providerConfig.default_model || "grok-code-fast-1";
|
|
7419
7596
|
if (providerType === "openai") {
|
|
7420
7597
|
this.superAgentClient = new OpenAIProvider(effectiveApiKey, effectiveBaseURL, effectiveModel);
|
|
@@ -7427,6 +7604,12 @@ Current working directory: ${process.cwd()}`
|
|
|
7427
7604
|
}
|
|
7428
7605
|
this.tokenCounter = createTokenCounter(effectiveModel);
|
|
7429
7606
|
}
|
|
7607
|
+
async listModels() {
|
|
7608
|
+
if (this.superAgentClient.listModels) {
|
|
7609
|
+
return this.superAgentClient.listModels();
|
|
7610
|
+
}
|
|
7611
|
+
return [];
|
|
7612
|
+
}
|
|
7430
7613
|
async initializeMCP() {
|
|
7431
7614
|
Promise.resolve().then(async () => {
|
|
7432
7615
|
try {
|
package/dist/super-agent-cli.exe
CHANGED
|
Binary file
|