diff --git a/crates/ide-agent/src/catalogs.rs b/crates/ide-agent/src/catalogs.rs index 2015ca5832..0ce0e08602 100644 --- a/crates/ide-agent/src/catalogs.rs +++ b/crates/ide-agent/src/catalogs.rs @@ -627,6 +627,40 @@ impl crate::AgentManager { let spec = self.shared.spec(provider).ok_or_else(|| IdeError::invalid(format!("unknown agent {provider}")))?; Ok(self.shared.paths.catalogs.request(&self.shared, spec, force, model).0) } + + /// Probes Copilot's model catalog for a staged `account` selection (`""` = Copilot CLI + /// default) without mutating `models.json` or broadcasting to active sessions before Apply. + pub async fn preview_copilot_models(&self, account: &str, model: Option<&str>) -> IdeResult { + let mut spec = provider::load(self.shared.paths.custom_agents_dir.as_deref(), self.shared.env_secrets()) + .into_iter() + .find(|p| p.id == "copilot") + .ok_or_else(|| IdeError::not_found("unknown agent 'copilot'"))?; + spec.env.retain(|(name, _)| name != provider::COPILOT_GITHUB_ACCOUNT_ENV); + let account = account.trim(); + if !account.is_empty() { + spec.env.push((provider::COPILOT_GITHUB_ACCOUNT_ENV.into(), account.to_owned())); + } + match discover(&self.shared, spec, model).await { + Ok(found) => Ok(AgentModelCatalog { + provider: "copilot".into(), + config: self.shared.config_for_new_task(found.config, "copilot"), + thought_levels: self.shared.thought_levels_for_new_task(found.levels, "copilot"), + refreshing: false, + refreshed_at_ms: Some(self.shared.paths.catalogs.epoch_ms()), + retry_at_ms: None, + error: None, + }), + Err(error) => Ok(AgentModelCatalog { + provider: "copilot".into(), + config: Vec::new(), + thought_levels: BTreeMap::new(), + refreshing: false, + refreshed_at_ms: None, + retry_at_ms: None, + error: Some(error), + }), + } + } } async fn discover( diff --git a/crates/ide-agent/src/provider.rs b/crates/ide-agent/src/provider.rs index ea00616616..3285e9e99e 100644 --- a/crates/ide-agent/src/provider.rs +++ b/crates/ide-agent/src/provider.rs @@ -289,7 +289,18 @@ fn find_gh_executable() -> Option { ide_core::tool_path::find_gh_executable() } +fn is_valid_github_login(account: &str) -> bool { + let bytes = account.as_bytes(); + !bytes.is_empty() + && bytes.len() <= 39 + && bytes[0].is_ascii_alphanumeric() + && bytes.iter().all(|b| b.is_ascii_alphanumeric() || *b == b'-' || *b == b'_') +} + fn github_token_for_account(account: &str) -> Result { + if !is_valid_github_login(account) { + return Err(format!("Invalid GitHub account login: {account}")); + } let program = find_gh_executable() .ok_or_else(|| "GitHub CLI (`gh`) is required to select a Copilot GitHub account".to_owned())?; let mut command = std::process::Command::new(program); diff --git a/crates/ide-host/src/ops/agent.rs b/crates/ide-host/src/ops/agent.rs index 26cad2a04e..1db21362e6 100644 --- a/crates/ide-host/src/ops/agent.rs +++ b/crates/ide-host/src/ops/agent.rs @@ -80,6 +80,19 @@ pub fn agent_refresh_models( host.project(window)?.agents.refresh_models(&provider, force, model.as_deref()) } +/// Probes Copilot's model catalog for a staged GitHub account without persisting until Apply. +#[command(trust = trusted)] +pub async fn agent_preview_copilot_models( + host: &Host, + window: &str, + account: String, + model: Option, +) -> IdeResult { + host.require_trust(window)?; + let agents = host.project(window)?.agents.clone(); + agents.preview_copilot_models(&account, model.as_deref()).await +} + /// Overrides built-in agent `id`'s command with `command` (its agent file keeps the /// built-in's driver and arguments), or returns it to auto-detection with `None`. #[command(trust = trusted)] @@ -1584,6 +1597,7 @@ ide_command::domain!( agent_mcp_save_json, agent_mcp_set_enabled, agent_mcp_test, + agent_preview_copilot_models, agent_probe, agent_prompt, agent_providers, diff --git a/docs/en/guide/agents.mdx b/docs/en/guide/agents.mdx index 0f203c4a18..ac5419e7e2 100644 --- a/docs/en/guide/agents.mdx +++ b/docs/en/guide/agents.mdx @@ -132,7 +132,7 @@ Tasks are saved per project and survive restarts. When the agent supports resumi For a built-in ACP agent launched directly, such as OMP, **Launch › Additional arguments** appends arguments to its existing launch command. Separate arguments with spaces and quote values that contain spaces. **Apply** saves the arguments for the next process launch; the command preview shows the saved result. **Reset additional arguments** clears just this field, leaving the executable, environment and any hand-written `args` in the agent file alone. -For **GitHub Copilot**, **Sign In › GitHub account** selects which GitHub account's Copilot subscription is used for AI model requests—either Copilot CLI's own default login (**Sign In…**) or any account signed into GitHub CLI (**Add account…**). **New Tasks** model options are loaded for the authenticated account after sign-in or **Apply**. +For **GitHub Copilot**, **Sign In › GitHub account** selects which GitHub account's Copilot subscription is used for AI model requests—either Copilot CLI's own default login (**Sign In…**) or any account signed into GitHub CLI (**Add account…**). **New Tasks** model options load automatically for the selected authenticated account, and **Apply** / **OK** saves the selection for new sessions. **Settings › Agents › Chat** chooses what the task header shows: **Context window usage**, **Time spent on the task**, **Usage limits** (when the agent reports them, such as Claude Code) and **Session cost**. diff --git a/docs/zh/guide/agents.mdx b/docs/zh/guide/agents.mdx index 32dd7223ba..cf5691f689 100644 --- a/docs/zh/guide/agents.mdx +++ b/docs/zh/guide/agents.mdx @@ -132,7 +132,7 @@ agent 运行过一个任务后,新任务会以它自动批准所有操作的 对于直接启动的内置 ACP agent(例如 OMP),**启动 › 附加实参**会追加到现有启动命令末尾。用空格分隔参数,含空格的值请加引号。点击**应用**保存,下一次启动进程时生效;命令预览显示已保存的结果。**重置附加参数**只清除此字段,不会改动可执行文件、环境变量或配置文件中手写的 `args`。 -对于 **GitHub Copilot**,**登录 › GitHub 账号**选择用于 AI 模型请求的 Copilot 订阅所属 GitHub 账号——既可使用 Copilot CLI 自身的默认登录(**登录…**),也可选择已在 GitHub CLI 中登录的任意账号(**添加账户…**)。完成登录或点击**应用**后,**新任务**会加载该已验证账号对应的可用模型列表。 +对于 **GitHub Copilot**,**登录 › GitHub 账号**选择用于 AI 模型请求的 Copilot 订阅所属 GitHub 账号——既可使用 Copilot CLI 自身的默认登录(**登录…**),也可选择已在 GitHub CLI 中登录的任意账号(**添加账户…**)。选择已验证的账号后,**新任务**会自动加载该账号对应的可用模型列表,点击**应用**或**确定**保存以供新会话使用。 **设置 › 智能体 › 聊天** 决定任务标题栏显示哪些信息:**上下文窗口用量**、**任务耗时**、**用量限额**(agent 报告时,例如 Claude Code)和 **会话花费**。 diff --git a/e2e/agentCopilotAuth.spec.ts b/e2e/agentCopilotAuth.spec.ts index b9d3998422..efeb20a0fc 100644 --- a/e2e/agentCopilotAuth.spec.ts +++ b/e2e/agentCopilotAuth.spec.ts @@ -91,6 +91,15 @@ test("unifies Copilot sign-in, gates per-account models on auth, and supports in retryAtMs: null, error: null, }), + agent_preview_copilot_models: ({ account }: { account: string }) => ({ + provider: "copilot", + config: [account === "alice-work" ? workModel : personalModel], + thoughtLevels: {}, + refreshing: false, + refreshedAtMs: Date.now(), + retryAtMs: null, + error: null, + }), agent_set_env: ({ env }: { env: Record }) => { savedAccount = env.OPENIDEA_COPILOT_GITHUB_ACCOUNT ?? ""; return null; @@ -142,14 +151,14 @@ test("unifies Copilot sign-in, gates per-account models on auth, and supports in await expect(accountSelect).toContainText("Copilot CLI default (alice)"); await expect(newTasks.getByRole("button", { name: "Model" })).toContainText("Agent's default (Claude Sonnet 4.5)"); - // Add account runs gh auth login in-IDE, auto-selects alice-work, and gates models on Apply. + // Add account runs gh auth login in-IDE, auto-selects alice-work, and immediately previews its models before Apply. await signIn.getByRole("button", { name: "Add account…" }).click(); await expect(page.getByRole("dialog", { name: "Sign In to GitHub CLI" })).toHaveCount(0); await expect(accountSelect).toContainText("alice-work"); - await expect(newTasks.getByText("Click Apply to load the models available for the selected account.")).toBeVisible(); - await expect(newTasks.getByRole("button", { name: "Model" })).toHaveCount(0); + await expect(newTasks.getByRole("button", { name: "Model" })).toContainText("Agent's default (Gemini 4 Neon)"); + expect(await ipcCalls(page, "agent_set_env")).toEqual([]); - // Applying loads the new account's subscription models. + // Applying saves the staged account selection. await dialog.getByRole("button", { name: "Apply", exact: true }).click(); await expect(newTasks.getByRole("button", { name: "Model" })).toContainText("Agent's default (Gemini 4 Neon)"); expect(await ipcCalls(page, "agent_set_env")).toEqual([ diff --git a/src-tauri/tests/commands.snap b/src-tauri/tests/commands.snap index 43b9860571..d6973b0529 100644 --- a/src-tauri/tests/commands.snap +++ b/src-tauri/tests/commands.snap @@ -34,6 +34,7 @@ agent_mcp_save always project_host bin agent_mcp_save_json always project_host bindings sync agent_mcp_set_enabled always project_host bindings sync agent_mcp_test trusted project_host bindings async +agent_preview_copilot_models trusted project_host bindings async agent_probe trusted project_host bindings async agent_prompt trusted project_host bindings async agent_providers trusted project_host bindings async diff --git a/src/bindings.ts b/src/bindings.ts index df86e2bccb..0d5da20cf0 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -105,6 +105,8 @@ export const commands = { agentMcpSetEnabled: (id: string, enabled: boolean) => typedError(__TAURI_INVOKE("agent_mcp_set_enabled", { id, enabled })), /** Tests an MCP server by connecting (`initialize`) and listing its tools (`tools/list`). */ agentMcpTest: (id: string) => typedError(__TAURI_INVOKE("agent_mcp_test", { id })), + /** Probes Copilot's model catalog for a staged GitHub account without persisting until Apply. */ + agentPreviewCopilotModels: (account: string, model: string | null) => typedError(__TAURI_INVOKE("agent_preview_copilot_models", { account, model })), /** * What the agent reports about itself when it starts (no session: no MCP servers, hooks * or sign-in run). Remembered until `refresh`. diff --git a/src/features/agents/AgentList.tsx b/src/features/agents/AgentList.tsx index caa8692f12..e1524f1d2b 100644 --- a/src/features/agents/AgentList.tsx +++ b/src/features/agents/AgentList.tsx @@ -863,6 +863,18 @@ function ProviderSettings({ if (value) next[COPILOT_GITHUB_ACCOUNT_ENV] = value; else delete next[COPILOT_GITHUB_ACCOUNT_ENV]; await backend.setEnv(agent.id, next); + if (backend.refreshModels) { + void backend + .refreshModels(agent.id, null, true) + .then((cat) => { + useAgents.setState((s) => { + const modelCatalogs = new Map(s.modelCatalogs); + modelCatalogs.set(agent.id, cat); + return { modelCatalogs }; + }); + }) + .catch(() => {}); + } await refresh(); onChanged?.(); return value; @@ -966,12 +978,11 @@ function ProviderSettings({ ? "checking" : !copilotSelectedSignedIn ? "unauthenticated" - : account.value !== account.current - ? "pendingApply" - : "ready"; + : "ready"; + const previewGithubAccount = agent.id === "copilot" && account.value !== account.current ? account.value : undefined; const accountScope = agent.id === "copilot" - ? `${account.current || `default:${activeCopilotStatus?.login ?? ""}`}:${authRevision}` + ? `${account.value || `default:${activeCopilotStatus?.login ?? ""}`}:${authRevision}` : "default"; return ( <> @@ -1073,7 +1084,13 @@ function ProviderSettings({ ) )}
- +
@@ -1185,9 +1202,11 @@ function ProviderSettings({ const prev = pendingAddAccountPrevLogins.current; pendingAddAccountPrevLogins.current = null; void reloadCopilotStatus().then((fresh) => { - if (!prev || !fresh) return; - const added = fresh.ghAccounts.find((entry) => !prev.has(entry.login)); - if (added) account.set(added.login); + if (prev && fresh) { + const added = fresh.ghAccounts.find((entry) => !prev.has(entry.login)); + if (added) account.set(added.login); + } + setAuthRevision((n) => n + 1); }); return; } @@ -1296,7 +1315,7 @@ export function defaultOptions( } const MODEL_SETTINGS_POLL_MS = 600; -type DefaultsAuthGate = "checking" | "unauthenticated" | "pendingApply" | "ready"; +type DefaultsAuthGate = "checking" | "unauthenticated" | "ready"; const isCatalogAuthError = (message: string | null | undefined): boolean => !!message && /sign in required|authentication|not authenticated|unauthorized|not logged in/i.test(message); @@ -1306,41 +1325,56 @@ function AgentDefaults({ backend, authGate, accountScope, + previewGithubAccount, }: { agent: AgentProvider; backend: CommandsBackend; authGate: DefaultsAuthGate; accountScope: string; + previewGithubAccount?: string; }) { const form = useSettingsForm(); const all = (form.useValue("agents.defaults") ?? {}) as Record>; const newTaskApprovals = (form.useValue("agents.newTaskApprovals") as "bypass" | "ask" | undefined) ?? "bypass"; const chosen = all[agent.id] ?? {}; const refreshModels = backend.refreshModels; - const needsAccountCatalog = agent.id === "copilot" && agent.installed && !!refreshModels; + const previewCopilotModels = backend.previewCopilotModels; + const needsAccountCatalog = agent.id === "copilot" && agent.installed && !!(refreshModels || previewCopilotModels); const scopeKey = `${agent.id}:${accountScope}`; const storeCatalog = useAgents((s) => s.modelCatalogs.get(agent.id)); - const [accountCatalog, setAccountCatalog] = useState<{ scopeKey: string; catalog: AgentModelCatalog } | null>(null); - const [fetchedCatalog, setFetchedCatalog] = useState<{ scopeKey: string; catalog: AgentModelCatalog } | null>(null); + const [catalogByScope, setCatalogByScope] = useState>({}); + const [fetchedByScope, setFetchedByScope] = useState>({}); + const scopedAccountCatalog = catalogByScope[scopeKey] ?? null; + const scopedAccountSettled = + scopedAccountCatalog !== null && + !scopedAccountCatalog.refreshing && + (scopedAccountCatalog.refreshedAtMs !== null || scopedAccountCatalog.error !== null); useEffect(() => { - if (!needsAccountCatalog || authGate !== "ready" || !refreshModels) return; + if (!needsAccountCatalog || authGate !== "ready" || scopedAccountSettled) return; + const load = + previewGithubAccount !== undefined && previewCopilotModels + ? () => previewCopilotModels(previewGithubAccount, null) + : refreshModels + ? () => refreshModels(agent.id, null) + : null; + if (!load) return; let live = true; let timer: ReturnType | null = null; const poll = async () => { try { - const next = await refreshModels(agent.id, null); + const next = await load(); if (!live) return; - setAccountCatalog({ scopeKey, catalog: next }); + setCatalogByScope((prev) => ({ ...prev, [scopeKey]: next })); if (next.refreshing) { timer = setTimeout(() => void poll(), MODEL_SETTINGS_POLL_MS); } } catch (e) { if (!live) return; - setAccountCatalog({ - scopeKey, - catalog: { + setCatalogByScope((prev) => ({ + ...prev, + [scopeKey]: { provider: agent.id, config: [], thoughtLevels: {}, @@ -1349,7 +1383,7 @@ function AgentDefaults({ retryAtMs: null, error: errorText(e), }, - }); + })); } }; void poll(); @@ -1357,10 +1391,18 @@ function AgentDefaults({ live = false; if (timer) clearTimeout(timer); }; - }, [agent.id, authGate, needsAccountCatalog, refreshModels, scopeKey]); + }, [ + agent.id, + authGate, + needsAccountCatalog, + previewCopilotModels, + previewGithubAccount, + refreshModels, + scopeKey, + scopedAccountSettled, + ]); - const scopedAccountCatalog = accountCatalog?.scopeKey === scopeKey ? accountCatalog.catalog : null; - const scopedFetchedCatalog = fetchedCatalog?.scopeKey === scopeKey ? fetchedCatalog.catalog : null; + const scopedFetchedCatalog = fetchedByScope[scopeKey] ?? null; const catalog = scopedFetchedCatalog ?? scopedAccountCatalog ?? (needsAccountCatalog ? undefined : storeCatalog); const effectiveAgent = useMemo(() => { if (needsAccountCatalog) { @@ -1383,26 +1425,35 @@ function AgentDefaults({ const options = defaultOptions(effectiveAgent, chosen, newTaskApprovals); const modelOption = options.find((o) => o.category === "model"); const selectedModel = (modelOption && chosen[modelOption.id]) || modelOption?.current || null; + const canLoadModelSettings = + previewGithubAccount !== undefined ? !!(previewCopilotModels || refreshModels) : !!refreshModels; const unknownModelSettings = !!selectedModel && !!modelOption?.values.some((v) => v.value === selectedModel) && !Object.hasOwn(effectiveAgent.thoughtLevels ?? {}, selectedModel); const fetchKey = - authGate === "ready" && agent.installed && refreshModels && selectedModel && unknownModelSettings + authGate === "ready" && agent.installed && canLoadModelSettings && selectedModel && unknownModelSettings ? `${scopeKey}:${selectedModel}` : null; const [settledKey, setSettledKey] = useState(null); const loadingModel = fetchKey !== null && settledKey !== fetchKey; useEffect(() => { - if (!fetchKey || !refreshModels || !selectedModel) return; + if (!fetchKey || !selectedModel) return; + const loadModel = + previewGithubAccount !== undefined && previewCopilotModels + ? () => previewCopilotModels(previewGithubAccount, selectedModel) + : refreshModels + ? () => refreshModels(agent.id, selectedModel) + : null; + if (!loadModel) return; let live = true; let timer: ReturnType | null = null; const poll = async () => { try { - const next = await refreshModels(agent.id, selectedModel); + const next = await loadModel(); if (!live) return; - setFetchedCatalog({ scopeKey, catalog: next }); + setFetchedByScope((prev) => ({ ...prev, [scopeKey]: next })); if (next.refreshing && !Object.hasOwn(next.thoughtLevels ?? {}, selectedModel)) { timer = setTimeout(() => void poll(), MODEL_SETTINGS_POLL_MS); } else { @@ -1417,7 +1468,7 @@ function AgentDefaults({ live = false; if (timer) clearTimeout(timer); }; - }, [agent.id, fetchKey, refreshModels, scopeKey, selectedModel]); + }, [agent.id, fetchKey, previewCopilotModels, previewGithubAccount, refreshModels, scopeKey, selectedModel]); if (authGate === "checking") { return ( @@ -1433,13 +1484,6 @@ function AgentDefaults({

); } - if (authGate === "pendingApply") { - return ( -

- Click Apply to load the models available for the selected account. -

- ); - } if ( needsAccountCatalog && (!scopedAccountCatalog || (scopedAccountCatalog.refreshing && scopedAccountCatalog.refreshedAtMs == null)) diff --git a/src/features/agents/agentRegistry.test.tsx b/src/features/agents/agentRegistry.test.tsx index e69641b8de..d1bb715a83 100644 --- a/src/features/agents/agentRegistry.test.tsx +++ b/src/features/agents/agentRegistry.test.tsx @@ -425,6 +425,7 @@ class FakeCommands implements CommandsBackend { loginSpawn?: CommandsBackend["loginSpawn"]; ghLoginSpawn?: CommandsBackend["ghLoginSpawn"]; refreshModels?: CommandsBackend["refreshModels"]; + previewCopilotModels?: CommandsBackend["previewCopilotModels"]; chooseExecutable = vi.fn(async () => "/chosen/agent"); saveCustom = vi.fn(async () => {}); setAdditionalArgs = vi.fn(); @@ -648,7 +649,8 @@ describe("Built-in executable overrides", () => { fireEvent.click(account); fireEvent.click(await screen.findByRole("option", { name: "alice-work" })); expect(account).toHaveTextContent("alice-work"); - expect(screen.getByText("Click Apply to load the models available for the selected account.")).toBeInTheDocument(); + expect(commands.savedEnv).toEqual([]); + expect(apply()).toBeEnabled(); await act(async () => fireEvent.click(apply())); @@ -664,7 +666,7 @@ describe("Built-in executable overrides", () => { expect(JSON.stringify(commands.savedEnv)).not.toMatch(/gho_|ghp_|token/i); }); - it("hides stale Copilot models until authenticated and reloads per-account models after Apply", async () => { + it("hides stale Copilot models until authenticated and previews per-account models immediately on switch", async () => { const staleModel: AgentProvider["config"][number] = { id: "model", name: "Model", @@ -713,6 +715,15 @@ describe("Built-in executable overrides", () => { error: null, }; }); + commands.previewCopilotModels = vi.fn(async (account) => ({ + provider: "copilot", + config: [account === "alice-work" ? staleModel : personalModel], + thoughtLevels: {}, + refreshing: false, + refreshedAtMs: Date.now(), + retryAtMs: null, + error: null, + })); commands.list = [ { ...claudeProvider("copilot"), @@ -732,24 +743,29 @@ describe("Built-in executable overrides", () => { await screen.findByText("Sign in above to view and choose models available for this account."); expect(screen.queryByRole("button", { name: "Model" })).toBeNull(); - // Selecting `alice` stages the switch and asks for Apply before showing models. + // Selecting `alice` immediately previews `alice`'s subscription models before Apply, while keeping Apply enabled. const account = screen.getByRole("button", { name: "GitHub account" }); fireEvent.click(account); fireEvent.click(await screen.findByRole("option", { name: "alice" })); - expect(screen.getByText("Click Apply to load the models available for the selected account.")).toBeInTheDocument(); - expect(screen.queryByRole("button", { name: "Model" })).toBeNull(); - - // Applying loads `alice`'s subscription models. - await act(async () => fireEvent.click(apply())); const modelButton = await screen.findByRole("button", { name: "Model" }); expect(modelButton).toHaveTextContent("Agent's default (Claude Sonnet 4.5)"); + expect(commands.previewCopilotModels).toHaveBeenCalledWith("alice", null); + expect(commands.savedEnv).toEqual([]); + expect(apply()).toBeEnabled(); - // Switching to `alice-work` and applying loads its own subscription models. + // Switching to `alice-work` immediately previews `alice-work`'s subscription models too. fireEvent.click(screen.getByRole("button", { name: "GitHub account" })); fireEvent.click(await screen.findByRole("option", { name: "alice-work" })); - expect(screen.queryByRole("button", { name: "Model" })).toBeNull(); + await waitFor(() => + expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Agent's default (Gemini 4 Neon)"), + ); + expect(commands.previewCopilotModels).toHaveBeenCalledWith("alice-work", null); + expect(commands.savedEnv).toEqual([]); + + // Applying saves the staged account without losing the loaded models. await act(async () => fireEvent.click(apply())); - expect(await screen.findByRole("button", { name: "Model" })).toHaveTextContent("Agent's default (Gemini 4 Neon)"); + expect(commands.savedEnv).toEqual([["copilot", { OPENIDEA_COPILOT_GITHUB_ACCOUNT: "alice-work" }]]); + expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Agent's default (Gemini 4 Neon)"); }); it("runs in-IDE Sign In and Add account PTY dialogs and selects the newly added gh account", async () => { diff --git a/src/features/agents/registry.ts b/src/features/agents/registry.ts index 8d902042f9..9120f8da42 100644 --- a/src/features/agents/registry.ts +++ b/src/features/agents/registry.ts @@ -39,6 +39,7 @@ export interface CommandsBackend { loginSpawn?(id: string, cols: number, rows: number, onEvent: (e: AgentLoginEvent) => void): Promise; ghLoginSpawn?(cols: number, rows: number, onEvent: (e: AgentLoginEvent) => void): Promise; refreshModels?(id: string, model: string | null, force?: boolean): Promise; + previewCopilotModels?(account: string, model: string | null): Promise; set(id: string, command: string | null): Promise; setAdditionalArgs(id: string, args: string[]): Promise; setEnv(id: string, env: Record): Promise; @@ -81,6 +82,7 @@ export const tauriCommands: CommandsBackend = { return info.id; }, refreshModels: (id, model, force = false) => call(commands.agentRefreshModels(id, force, model)), + previewCopilotModels: (account, model) => call(commands.agentPreviewCopilotModels(account, model)), chooseExecutable: async (title, current, location) => { if (location !== "desktop") return choosePath({ title, defaultPath: current, directory: false }); const picked = await open({ title, defaultPath: current || undefined, directory: false, multiple: false }); diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index 0b9fac4b7b..f6176f15dd 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -4235,7 +4235,6 @@ "Download GitHub CLI…": "Download GitHub CLI…", "Checking sign-in status…": "Checking sign-in status…", "Sign in above to view and choose models available for this account.": "Sign in above to view and choose models available for this account.", - "Click Apply to load the models available for the selected account.": "Click Apply to load the models available for the selected account.", "Loading models for this account…": "Loading models for this account…", "Account": "Account", "Automatic ({activeLogin})": "Automatic ({activeLogin})", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index 0fbb627f38..37e79fac38 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -10696,7 +10696,6 @@ "Download GitHub CLI…": "下载 GitHub CLI…", "Checking sign-in status…": "正在检查登录状态…", "Sign in above to view and choose models available for this account.": "请在上方登录以查看并选择此账户可用的模型。", - "Click Apply to load the models available for the selected account.": "点击“应用”以加载所选账户可用的模型。", "Loading models for this account…": "正在加载此账户的模型…", "Account": "账户", "Automatic ({activeLogin})": "自动({activeLogin})",