feat: initial impl

- add GitHub Copilot model discovery (env token fallback, headers,
compat) plus fallback list and quoted provider keys in generated map
- surface Copilot provider end-to-end (KnownProvider/default, env+OAuth
token refresh/save, enterprise base URL swap, available only when
creds/env exist)
- tweak interactive OAuth UI to render instruction text and prompt
placeholders

gpt-5.2-high took about 35 minutes. It had a lot of trouble with `npm
check`  and went off on a "let's adjust every tsconfig" side quest.
Device code flow works, but the ai/scripts/generate-models.ts impl is
wrong as models from months ago are missing and only those deprecated
are accessible in the /models picker.
This commit is contained in:
cau1k 2025-12-14 17:18:13 -05:00
parent 0a7d1fa51e
commit ccae7a4e0e
No known key found for this signature in database
10 changed files with 727 additions and 101 deletions

View file

@ -1378,14 +1378,14 @@ export class InteractiveMode {
try {
await login(
providerId as SupportedOAuthProvider,
(url: string) => {
(info) => {
this.chatContainer.addChild(new Spacer(1));
this.chatContainer.addChild(new Text(theme.fg("accent", "Opening browser to:"), 1, 0));
this.chatContainer.addChild(new Text(theme.fg("accent", url), 1, 0));
this.chatContainer.addChild(new Spacer(1));
this.chatContainer.addChild(
new Text(theme.fg("warning", "Paste the authorization code below:"), 1, 0),
);
this.chatContainer.addChild(new Text(theme.fg("accent", info.url), 1, 0));
if (info.instructions) {
this.chatContainer.addChild(new Spacer(1));
this.chatContainer.addChild(new Text(theme.fg("warning", info.instructions), 1, 0));
}
this.ui.requestRender();
const openCmd =
@ -1394,9 +1394,16 @@ export class InteractiveMode {
: process.platform === "win32"
? "start"
: "xdg-open";
exec(`${openCmd} "${url}"`);
exec(`${openCmd} "${info.url}"`);
},
async () => {
async (prompt) => {
this.chatContainer.addChild(new Spacer(1));
this.chatContainer.addChild(new Text(theme.fg("warning", prompt.message), 1, 0));
if (prompt.placeholder) {
this.chatContainer.addChild(new Text(theme.fg("dim", prompt.placeholder), 1, 0));
}
this.ui.requestRender();
return new Promise<string>((resolve) => {
const codeInput = new Input();
codeInput.onSubmit = () => {