Файли
openidea/src/settingsWindowBoot.ts
T
Deng Liuтаdengliu 4b5745c1b6 feat(agents): sign in to coding agents in an IDE terminal (#6263)
Agents can be signed in from the IDE: Sign In... in Settings > Agents > Agent
Setup and on a sign-in error in the chat opens a dialog running the agent's own
login flow (copilot login, codex login, claude, an ACP terminal-auth method) in
an IDE-managed PTY with the real program and arguments, no shell quoting. The
Settings window's boot provides the embedded terminal, so the dialog works there
without importing the terminal feature. Sign-in clears a failed model-catalog
cooldown and refreshes the agent's models. Copilot's login runs with ambient
GitHub token variables cleared, and copied login hints quote paths with spaces.
A test pins that every built-in login hint yields the arguments Sign In runs.

Co-authored-by: dengliu <[email protected]>
2026-11-27 06:36:26 +08:00

50 рядки
2.3 KiB
TypeScript

import type { ComponentType } from "react";
import { activateSettingsPages as agentsPages } from "./features/agents/settingsPages";
import { installLocaleSync } from "./features/app/locale";
import { activateSettingsPages as databasePages } from "./features/database/settingsPages";
import { activateSettingsPages as githubPages } from "./features/github/settingsPages";
import { activateSettingsPages as pluginsPages } from "./features/plugins/settingsPages";
import { activate as projectTrust } from "./features/project-trust";
import { activateSettingsWindow } from "./features/settings/settingsWindow";
import { SettingsWindow } from "./features/settings/window/SettingsWindow";
import { activateSettingsPages as templatesPages } from "./features/templates/settingsPages";
import { activateSettingsPages as todoPages } from "./features/todo/settingsPages";
import { activateSettingsPages as toolsPages } from "./features/tools/settingsPages";
import { activateSettingsPages as vcsPages } from "./features/vcs/settingsPages";
import { activateSettingsPages as vimPages } from "./features/vim/settingsPages";
import { activateList } from "./windowBoot";
import { provideEmbeddedTerminal } from "./workbench/contributions";
/** The embedded terminal of the agents' Sign In dialog, loaded on first use. */
function embeddedTerminal(): () => void {
provideEmbeddedTerminal(async (host, options) =>
(await import("./features/terminal/loader"))
.loadTerminalRuntime()
.then((rt) => rt.createEmbeddedTerminal(host, options)),
);
return () => provideEmbeddedTerminal(undefined);
}
/**
* Native Settings window of project window `parent`: only the settings pages
* (no workbench, project services, CodeMirror editors or tool windows).
*/
export function bootSettingsWindow(parent: string): ComponentType {
activateList("settings pages", [
["project-trust", projectTrust],
["locale", installLocaleSync],
["settings", () => activateSettingsWindow(parent)],
["templates", templatesPages],
["todo", todoPages],
["plugins", pluginsPages],
["tools", toolsPages],
["agents", agentsPages],
["terminal", embeddedTerminal],
["vim", vimPages],
["vcs", vcsPages],
["github", githubPages],
["database", databasePages],
]);
return SettingsWindow;
}