swarm-code 0.1.10 → 0.1.12
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/interactive-swarm.js +37 -2
- package/package.json +1 -1
|
@@ -546,7 +546,12 @@ async function cmdConfigure(config, resolved, rl) {
|
|
|
546
546
|
out.write(` ${dim(symbols.horizontal.repeat(40))}\n\n`);
|
|
547
547
|
out.write(` ${dim("Current settings:")}\n`);
|
|
548
548
|
out.write(` ${cyan("1")} Agent ${bold(config.default_agent)}\n`);
|
|
549
|
-
|
|
549
|
+
const displayModel = resolved.provider === "ollama"
|
|
550
|
+
? `ollama/${resolved.model.id}`
|
|
551
|
+
: resolved.provider === "openrouter"
|
|
552
|
+
? `openrouter/${resolved.model.id}`
|
|
553
|
+
: resolved.model.id;
|
|
554
|
+
out.write(` ${cyan("2")} Model ${bold(displayModel)}${displayModel !== config.default_model ? dim(` (config: ${config.default_model})`) : ""}\n`);
|
|
550
555
|
out.write(` ${cyan("3")} Max threads ${bold(String(config.max_threads))}\n`);
|
|
551
556
|
out.write(` ${cyan("4")} Auto routing ${bold(config.auto_model_selection ? "on" : "off")}\n`);
|
|
552
557
|
out.write(` ${cyan("5")} Session budget ${bold(`$${config.max_session_budget_usd.toFixed(2)}`)}\n`);
|
|
@@ -574,8 +579,38 @@ async function cmdConfigure(config, resolved, rl) {
|
|
|
574
579
|
}
|
|
575
580
|
case "2": {
|
|
576
581
|
out.write(`\n ${dim("Enter model ID (e.g. ollama/deepseek-coder-v2, anthropic/claude-sonnet-4-6, openrouter/auto)")}\n`);
|
|
577
|
-
const val = await ask(` ${coral(symbols.arrow)} New model [${
|
|
582
|
+
const val = await ask(` ${coral(symbols.arrow)} New model [${displayModel}]: `);
|
|
578
583
|
if (val) {
|
|
584
|
+
// Check for required API keys
|
|
585
|
+
const keyChecks = {
|
|
586
|
+
openrouter: { env: "OPENROUTER_API_KEY", url: "https://openrouter.ai/keys" },
|
|
587
|
+
openai: { env: "OPENAI_API_KEY", url: "https://platform.openai.com/api-keys" },
|
|
588
|
+
anthropic: { env: "ANTHROPIC_API_KEY", url: "https://console.anthropic.com/settings/keys" },
|
|
589
|
+
google: { env: "GEMINI_API_KEY", url: "https://aistudio.google.com/apikey" },
|
|
590
|
+
};
|
|
591
|
+
// Determine which provider the model needs
|
|
592
|
+
let requiredProvider = "";
|
|
593
|
+
if (val.startsWith("openrouter/"))
|
|
594
|
+
requiredProvider = "openrouter";
|
|
595
|
+
else if (val.startsWith("anthropic/") || val.startsWith("claude"))
|
|
596
|
+
requiredProvider = "anthropic";
|
|
597
|
+
else if (val.startsWith("openai/") || val.startsWith("gpt") || val.startsWith("o3") || val.startsWith("o4"))
|
|
598
|
+
requiredProvider = "openai";
|
|
599
|
+
else if (val.startsWith("google/") || val.startsWith("gemini"))
|
|
600
|
+
requiredProvider = "google";
|
|
601
|
+
const check = requiredProvider ? keyChecks[requiredProvider] : undefined;
|
|
602
|
+
if (check && !process.env[check.env]) {
|
|
603
|
+
out.write(`\n ${dim(`${requiredProvider} requires an API key (${check.url})`)}\n`);
|
|
604
|
+
const key = await ask(` ${coral(symbols.arrow)} ${check.env}: `);
|
|
605
|
+
if (key) {
|
|
606
|
+
process.env[check.env] = key;
|
|
607
|
+
logSuccess(`${check.env} set for this session`);
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
logWarn(`No API key provided — cannot use ${requiredProvider}`);
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
579
614
|
const lookupId = val.startsWith("ollama/") || val.startsWith("openrouter/")
|
|
580
615
|
? val
|
|
581
616
|
: val.replace(/^(anthropic|openai|google)\//, "");
|
package/package.json
CHANGED