fix: restore implicit providers + copilot auth choice
This commit is contained in:
@@ -21,6 +21,7 @@ import { loadModelCatalog } from "../agents/model-catalog.js";
|
||||
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import { upsertSharedEnvVar } from "../infra/env-file.js";
|
||||
import { githubCopilotLoginCommand } from "../providers/github-copilot-auth.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import type { WizardPrompter } from "../wizard/prompts.js";
|
||||
import {
|
||||
@@ -931,6 +932,61 @@ export async function applyAuthChoice(params: {
|
||||
agentModelOverride = modelRef;
|
||||
await noteAgentModel(modelRef);
|
||||
}
|
||||
} else if (params.authChoice === "github-copilot") {
|
||||
await params.prompter.note(
|
||||
[
|
||||
"This will open a GitHub device login to authorize Copilot.",
|
||||
"Requires an active GitHub Copilot subscription.",
|
||||
].join("\n"),
|
||||
"GitHub Copilot",
|
||||
);
|
||||
|
||||
if (!process.stdin.isTTY) {
|
||||
await params.prompter.note(
|
||||
"GitHub Copilot login requires an interactive TTY.",
|
||||
"GitHub Copilot",
|
||||
);
|
||||
return { config: nextConfig, agentModelOverride };
|
||||
}
|
||||
|
||||
try {
|
||||
await githubCopilotLoginCommand({ yes: true }, params.runtime);
|
||||
} catch (err) {
|
||||
await params.prompter.note(
|
||||
`GitHub Copilot login failed: ${String(err)}`,
|
||||
"GitHub Copilot",
|
||||
);
|
||||
return { config: nextConfig, agentModelOverride };
|
||||
}
|
||||
|
||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||
profileId: "github-copilot:github",
|
||||
provider: "github-copilot",
|
||||
mode: "token",
|
||||
});
|
||||
|
||||
if (params.setDefaultModel) {
|
||||
const model = "github-copilot/gpt-4o";
|
||||
nextConfig = {
|
||||
...nextConfig,
|
||||
agents: {
|
||||
...nextConfig.agents,
|
||||
defaults: {
|
||||
...nextConfig.agents?.defaults,
|
||||
model: {
|
||||
...(typeof nextConfig.agents?.defaults?.model === "object"
|
||||
? nextConfig.agents.defaults.model
|
||||
: undefined),
|
||||
primary: model,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
await params.prompter.note(
|
||||
`Default model set to ${model}`,
|
||||
"Model configured",
|
||||
);
|
||||
}
|
||||
} else if (params.authChoice === "minimax") {
|
||||
if (params.setDefaultModel) {
|
||||
nextConfig = applyMinimaxConfig(nextConfig);
|
||||
@@ -1018,6 +1074,8 @@ export function resolvePreferredProviderForAuthChoice(
|
||||
return "google-antigravity";
|
||||
case "synthetic-api-key":
|
||||
return "synthetic";
|
||||
case "github-copilot":
|
||||
return "github-copilot";
|
||||
case "minimax-cloud":
|
||||
case "minimax-api":
|
||||
case "minimax-api-lightning":
|
||||
|
||||
Reference in New Issue
Block a user