Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ BootAgent does not redistribute Agent packages and does not bundle Node.js, Git,
| --- | --- |
| Agent is not listed | Refresh Environment overview, check that the command is on `PATH`, or use the Agent's documented manual install path. |
| Provider connection check fails | Confirm the endpoint and model match the Agent's protocol. Use Check model for a saved Profile; saving or applying a Profile does not automatically send a model request. |
| Codex reports `does not support endpoint: responses` | Codex is configured to use Responses. Select a model that supports it, or use the API protocol adapter with a working Chat Completions Profile and apply its generated Codex Profile. A model appearing in `/models` does not prove Responses support. |
| Codex reports `does not support endpoint: responses` | Codex is configured to use Responses. Select a model that supports it, or pick a working Chat Completions Profile on Codex's page and apply it with compatibility mode, which converts the requests on this computer. A model appearing in `/models` does not prove Responses support. |
| Windows detects a desktop app but its version is unavailable | BootAgent retries the registered package's metadata through Windows PackageManager. If the metadata remains inaccessible, launch is still available; this warning is separate from model API compatibility. |
| Marketplace looks incomplete | Check the source status and refresh. A bundled snapshot remains available when an online source is unavailable. |
| Import reports a conflict | Review the preview, choose skip or overwrite, and apply only after checking the affected resource names. |
Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ BootAgent 不重新分发 Agent 包,也不捆绑 Node.js、Git、WebView 或 A
| --- | --- |
| 找不到 Agent | 刷新“环境总览”,确认命令在 `PATH` 中,或按 Agent 官方指引手动安装后再次检测。 |
| Provider 连接检查失败 | 确认端点和模型与 Agent 使用的协议一致。对已保存的 Profile 使用“检测模型”;保存或应用 Profile 不会自动发送模型请求。 |
| Codex 报错 `does not support endpoint: responses` | Codex 的配置使用 Responses。选择支持它的模型,或在 API 协议适配中选择可用的 Chat Completions Profile,再应用生成的 Codex Profile。模型出现在 `/models` 中并不证明它支持 Responses。 |
| Codex 报错 `does not support endpoint: responses` | Codex 的配置使用 Responses。选择支持它的模型,或在 Codex 的配置页选一个可用的 Chat Completions 配置模版,用兼容模式应用,由 BootAgent 在本机转换。模型出现在 `/models` 中并不证明它支持 Responses。 |
| Windows 检测到桌面应用但版本不可用 | BootAgent 会通过 Windows PackageManager 重试读取已注册应用包的元数据。如果仍无法读取,仍可尝试启动;这个提示与模型 API 兼容性无关。 |
| 工具市场内容不完整 | 查看来源状态并点击刷新;在线来源不可用时仍会显示内置目录。 |
| 导入提示冲突 | 查看导入预览,选择跳过或覆盖,并确认受影响的资源名称。 |
Expand Down
2 changes: 1 addition & 1 deletion docs/ui-friendliness-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
| 2 | 配置向导(`setup/*`) | 每步一句说明;协议名移出默认视图 |
| 3 | 模型服务、配置模板 | 按用词表改字段名;示例占位;一条提示一句 |
| 4 | 多模态 | 账号行合并为一个状态徽标;安装弹窗压成「会使用你在 {服务} 的 Key,每次调用按价格计费」一句,其余进「了解详情」;Skill ID、环境变量、文件路径进「详情」 |
| 5 | 兼容模式(原协议适配) | 已扩大为动线改造(2026-10-12):在出问题的地方提出兼容模式——向导测试连接、Agent 页选模版、检测模型失败;命令行 Agent 一键开启(`ConfigureAgentWithConversion`);兼容模式页改为状态页;下拉框隐藏转换器条目并写明不可选原因 |
| 5 | 兼容模式(原协议适配) | 已扩大为动线改造(2026-10-12):在出问题的地方提出兼容模式——向导测试连接、Agent 页选模版、检测模型失败;命令行 Agent 一键开启(`ConfigureAgentWithConversion`);兼容模式页改为状态页;下拉框隐藏转换器条目并写明不可选原因。2026-11-20:兼容模式不再有自己的页面和侧边栏入口,它由 Agent 开启(同上三处),Agent 换回普通配置模版即退出,最后一个退出后适配器自动停止;总开关、监听地址、本地 Key 和模型别名收进「设置」(`CompatibilitySetting`),旧地址 `/conversion` 跳转到设置 |
| 6 | Skills、MCP | 同上规则;`Sparkles` 换为与 Skill 含义相符的图标 |
| 7 | Marketplace 详情 | 元信息分组,次要字段进「详情」 |
| 8 | 设置、导入导出 | 同上规则 |
Expand Down
68 changes: 52 additions & 16 deletions frontend/e2e/wails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,24 @@ test("Claude Desktop adapts a Chat Completions Profile after one confirmation",
await page.getByRole("textbox", { name: "模型", exact: true }).fill("bootagent-e2e-model");
await page.getByRole("button", { name: "保存配置模版" }).click();

// Only the port: there is no single model to choose here any more. The
// Compatibility mode has no page of its own: its old address lands on 设置,
// where the few things set by hand live. Only the port is changed here; the
// default 8787 may be taken on the machine running the tests.
await page.goto("/#/conversion");
await page.getByRole("button", { name: "高级设置" }).click();
await expect(page).toHaveURL(/#\/settings$/);
await expect(page.getByRole("link", { name: "兼容模式" })).toHaveCount(0);
await page.getByText("高级设置").click();
await page.getByLabel("监听地址").fill("127.0.0.1:34125");
await page.getByRole("button", { name: "保存更改" }).click();
// Nothing uses compatibility mode yet, so once the address is saved the
// primary action goes back to turning it on. The save button is only disabled
// while the request is in flight, which a fast save finishes before this runs.
await expect(page.getByRole("button", { name: "开启兼容模式" })).toBeDisabled();
// Read back from a fresh page: a receipt may be waiting behind the Profile's.
await expect(page.getByRole("button", { name: "保存更改" })).toBeDisabled();
await page.reload();
await page.getByText("高级设置").click();
await expect(page.getByLabel("监听地址")).toHaveValue("127.0.0.1:34125");
// Nothing uses it yet, so there is nothing to switch on by hand.
const compatibility = page.getByRole("switch", { name: "兼容模式" });
await expect(compatibility).not.toBeChecked();
await expect(compatibility).toBeDisabled();

await page.goto("/#/agents/claude-desktop");
await page.getByLabel("选择 Claude Desktop E2E Chat").check();
Expand Down Expand Up @@ -315,19 +323,47 @@ test("Codex and Claude Desktop use different models through compatibility mode",
await apply.click();
await expect(page).toHaveURL(/#\/overview$/);

await page.goto("/#/conversion");
const users = page.getByRole("region", { name: "正在使用的 Agent" });
const row = (name: string) => users.getByRole("listitem").filter({ has: page.getByText(name, { exact: true }) });
await expect(row("Codex")).toContainText("codex-e2e-model");
await expect(row("Claude Desktop")).toContainText("bootagent-e2e-model");
// ChatGPT Desktop shares Codex's settings, so it follows Codex's route.
await expect(row("ChatGPT Desktop")).toContainText("codex-e2e-model");

// Reopening Codex shows the model it uses, not the adapter.
await users.getByRole("button", { name: "为 Codex 更换模型" }).click();
// 设置 says who depends on it. ChatGPT Desktop shares Codex's settings, so
// it follows Codex.
await page.goto("/#/settings");
await expect(page.getByRole("switch", { name: "兼容模式" })).toBeChecked();
const users = page.getByText(/正在使用,使用期间需要保持 BootAgent 运行$/);
await expect(users).toContainText("Codex");
await expect(users).toContainText("Claude Desktop");
await expect(users).toContainText("ChatGPT Desktop");

// Each Agent's own page shows the model it uses, not the adapter.
// Each from the overview, as a user gets there.
await page.goto("/#/agents/claude-desktop");
await expect(page.getByLabel("选择 Claude Desktop E2E Chat")).toBeChecked();
await page.goto("/#/overview");
await page.goto("/#/agents/codex");
await expect(page.getByLabel("选择 Codex E2E Chat")).toBeChecked();
});

// Runs after the two cases above. Compatibility mode ends where it began, on
// the Agent: an ordinary Profile takes Codex out of it, and Claude Desktop,
// still on its own route, keeps it running.
test("an Agent given an ordinary Profile leaves compatibility mode", async ({ page }) => {
await page.goto("/#/profiles");
await page.getByRole("button", { name: "新增配置模版" }).click();
await page.getByLabel("配置模版 ID").fill("codex-e2e-native");
await page.getByLabel("名称").fill("Codex E2E Native");
await page.getByRole("combobox", { name: "API 类型" }).click();
await page.getByRole("option", { name: "OpenAI Responses" }).click();
await page.getByRole("textbox", { name: "模型", exact: true }).fill("codex-e2e-native-model");
await page.getByRole("button", { name: "保存配置模版" }).click();

await page.goto("/#/agents/codex");
await page.getByLabel("选择 Codex E2E Native").check();
await page.getByRole("button", { name: "应用", exact: true }).click();
await expect(page).toHaveURL(/#\/overview$/);

await page.goto("/#/settings");
await expect(page.getByRole("switch", { name: "兼容模式" })).toBeChecked();
await expect(page.getByText("Claude Desktop 正在使用,使用期间需要保持 BootAgent 运行", { exact: true })).toBeVisible();
});

test("Skills and MCP management lead to their marketplace categories", async ({ page }) => {
const browserProblems: string[] = [];
page.on("console", (message) => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { InstallTaskPage } from "./pages/InstallTaskPage";
import { AgentProfilePage } from "./pages/AgentProfilePage";
import { AgentSelectionPage } from "./pages/AgentSelectionPage";
import { EnvironmentOverviewPage } from "./pages/EnvironmentOverviewPage";
import { ConversionPage } from "./pages/ConversionPage";
import { ModelSelectionPage } from "./pages/ModelSelectionPage";
import { MCPPage } from "./pages/MCPPage";
import { MultimodalPage } from "./pages/MultimodalPage";
Expand Down Expand Up @@ -107,7 +106,8 @@ function WorkspaceRoutes() {
<Route path="/mcp" element={<MCPPage />} />
<Route path="/skills" element={<SkillsPage />} />
<Route path="/multimodal" element={<MultimodalPage />} />
<Route path="/conversion" element={<ConversionPage />} />
{/* Compatibility mode used to have a page; its settings are in 设置 now. */}
<Route path="/conversion" element={<Navigate to="/settings" replace />} />
<Route path="/marketplace" element={<MarketplacePage />} />
<Route path="/marketplace/recommendations/:historyId" element={<MarketplaceRecommendationDetailPage />} />
<Route path="/marketplace/:itemId" element={<MarketplaceDetailPage />} />
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/backend/failureCopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ export function failureCopyFor(code: string | null | undefined, status: number |
case "CONFIG_WRITE_FAILED":
return { message: t("无法写入配置文件"), hint: t("确认配置文件没有被其他程序占用,以及你对它有写入权限") };
case "CONVERSION_PORT_UNAVAILABLE":
return { message: t("兼容模式需要的本机端口被占用"), hint: t("关闭占用端口的程序,或在兼容模式的高级设置里换一个端口") };
return { message: t("兼容模式需要的本机端口被占用"), hint: t("关闭占用端口的程序,或在「设置」的兼容模式里换一个端口") };
case "CONVERSION_VERIFICATION_FAILED":
return { message: t("兼容模式没有通过测试"), hint: t("检查所选模型服务的余额和网络后重试") };
case "CONVERSION_ROLLBACK_FAILED":
return { message: t("兼容模式开启失败,原来的设置未能完整恢复"), hint: t("请保持 BootAgent 运行,并到兼容模式页面检查") };
return { message: t("兼容模式开启失败,原来的设置未能完整恢复"), hint: t("请保持 BootAgent 运行,并在「设置」里查看兼容模式") };
case "UPDATE_LOCATION_BLOCKED":
// Withheld at check time on purpose: the swap runs after the app exits, so
// this is the last moment anything can tell the user.
Expand Down
147 changes: 147 additions & 0 deletions frontend/src/components/CompatibilitySetting.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

import { api } from "../backend/api";
import { BootAgentApiError } from "../backend/errors";
import * as confirm from "../state/confirmDelete";
import { FeedbackProvider } from "../state/FeedbackContext";
import type { ConversionConfig, StatusResponse } from "../types/api";
import { CompatibilitySetting } from "./CompatibilitySetting";
import { FeedbackViewport } from "./FeedbackViewport";

const nobody = { providers: {}, catalog: [], agents: {}, desktopAgents: [], profiles: [], conversionRoutes: {} } as unknown as StatusResponse;
let mockStatus: StatusResponse | null = nobody;

vi.mock("../state/WizardContext", () => ({
useWizard: () => ({ state: { status: mockStatus }, refreshStatus: vi.fn() }),
}));

const stopped: ConversionConfig = {
enabled: false,
listen: "127.0.0.1:8787",
has_api_key: false,
target_profile: "",
routes: {},
anthropic_model: "claude-sonnet-5",
responses_model: "gpt-5.6-sol",
chat_model: "gpt-5.6-sol",
};

const codexInCompatibilityMode = {
providers: { ppio: { name: "PPIO" } },
catalog: [{ id: "codex", name: "Codex" }, { id: "claude-code", name: "Claude Code" }],
agents: { codex: { profileId: "bootagent-converter-for-codex" }, "claude-code": { profileId: "bootagent-converter-for-claude-code" } },
desktopAgents: [],
profiles: [{ id: "ppio-chat", label: "PPIO", provider: "ppio", model: "deepseek-v3", protocol: "openai" }],
conversionRoutes: { codex: "ppio-chat", "claude-code": "ppio-chat" },
} as unknown as StatusResponse;

beforeEach(() => {
localStorage.setItem("bootagent.locale", "zh-CN");
vi.spyOn(api, "getConversion").mockResolvedValue(stopped);
});

afterEach(() => {
localStorage.clear();
vi.restoreAllMocks();
mockStatus = nobody;
});

// PageScaffold normally draws the receipts; a bare component needs the viewport.
const renderSetting = () => render(<FeedbackProvider><FeedbackViewport /><CompatibilitySetting /></FeedbackProvider>);

describe("CompatibilitySetting", () => {
// Nothing to turn on by hand: an Agent switches it on when it needs it.
it("is off and cannot be switched on while no Agent uses it", async () => {
renderSetting();
expect(await screen.findByText("Agent 需要时会自动开启")).toBeTruthy();
const toggle = screen.getByRole("switch", { name: "兼容模式" });
expect(toggle).not.toBeChecked();
expect(toggle).toBeDisabled();
});

// Before the status has loaded it is not known who uses it, so the row does
// not claim that nobody does and cannot be stopped without the warning.
it("waits for the status before saying who uses it or letting it be stopped", async () => {
mockStatus = null;
vi.spyOn(api, "getConversion").mockResolvedValue({ ...stopped, enabled: true, has_api_key: true });
renderSetting();
const toggle = await screen.findByRole("switch", { name: "兼容模式" });
await waitFor(() => expect(toggle).toBeChecked());
expect(toggle).toBeDisabled();
expect(screen.queryByText("没有 Agent 在使用")).toBeNull();
expect(screen.getByText("正在读取环境状态")).toBeTruthy();
});

it("names the Agents using it while it runs", async () => {
mockStatus = codexInCompatibilityMode;
vi.spyOn(api, "getConversion").mockResolvedValue({ ...stopped, enabled: true, has_api_key: true });
renderSetting();
expect(await screen.findByText("Codex、Claude Code 正在使用,使用期间需要保持 BootAgent 运行")).toBeTruthy();
expect(screen.getByRole("switch", { name: "兼容模式" })).toBeChecked();
});

// Stopping breaks every Agent pointed at it, so it names them and asks.
it("asks before stopping it under the Agents that use it", async () => {
mockStatus = codexInCompatibilityMode;
vi.spyOn(api, "getConversion").mockResolvedValue({ ...stopped, enabled: true, has_api_key: true });
const save = vi.spyOn(api, "saveConversion").mockImplementation(async (config) => config);
const ask = vi.spyOn(confirm, "confirmAction").mockResolvedValueOnce(false).mockResolvedValueOnce(true);
renderSetting();
const toggle = await screen.findByRole("switch", { name: "兼容模式" });
await waitFor(() => expect(toggle).toBeChecked());

fireEvent.click(toggle);
await waitFor(() => expect(ask).toHaveBeenCalledWith(expect.objectContaining({ message: expect.stringContaining("Codex、Claude Code") })));
expect(save).not.toHaveBeenCalled();

fireEvent.click(toggle);
await waitFor(() => expect(save).toHaveBeenCalledWith(expect.objectContaining({ enabled: false })));
expect(await screen.findByText("兼容模式已停止")).toBeTruthy();
expect(screen.getByText("已停止,Codex、Claude Code 暂时无法使用")).toBeTruthy();
// With Agents waiting on it, it can be switched back on.
expect(toggle).toBeEnabled();
});

it("offers a retry when the settings cannot be read", async () => {
const load = vi.spyOn(api, "getConversion").mockRejectedValueOnce(new BootAgentApiError("boom", "INTERNAL_ERROR", true, 500));
renderSetting();
const receipt = await screen.findByRole("alert");
expect(receipt).toHaveTextContent("无法读取兼容模式设置");
expect(screen.getByRole("switch", { name: "兼容模式" })).toBeDisabled();
fireEvent.click(screen.getByRole("button", { name: "重试" }));
expect(await screen.findByText("高级设置")).toBeTruthy();
expect(load).toHaveBeenCalledTimes(2);
});

it("saves an advanced setting without turning compatibility mode on", async () => {
const save = vi.spyOn(api, "saveConversion").mockImplementation(async (config) => config);
renderSetting();
fireEvent.click(await screen.findByText("高级设置"));
const saveButton = screen.getByRole("button", { name: "保存更改" });
expect(saveButton).toBeDisabled();
fireEvent.change(screen.getByLabelText("监听地址"), { target: { value: "127.0.0.1:9797" } });
fireEvent.click(saveButton);
await waitFor(() => expect(save).toHaveBeenCalledWith(expect.objectContaining({ listen: "127.0.0.1:9797", enabled: false })));
expect(await screen.findByText("已保存兼容模式设置")).toBeTruthy();
});

// A half-typed address belongs to the save button, not to the switch.
it("does not save edited fields when only the switch is used", async () => {
mockStatus = codexInCompatibilityMode;
const save = vi.spyOn(api, "saveConversion").mockImplementation(async (config) => config);
renderSetting();
fireEvent.click(await screen.findByText("高级设置"));
fireEvent.change(screen.getByLabelText("监听地址"), { target: { value: "127.0.0.1:1" } });
fireEvent.click(screen.getByRole("switch", { name: "兼容模式" }));
await waitFor(() => expect(save).toHaveBeenCalledWith(expect.objectContaining({ enabled: true, listen: "127.0.0.1:8787" })));
});

it("keeps the details folded and never shows a local key", async () => {
renderSetting();
const fold = (await screen.findByText("高级设置")).closest("details");
expect(fold).not.toHaveAttribute("open");
expect(screen.queryByLabelText("本地 API Key")).toBeNull();
expect(screen.getByText("启动时自动生成")).toBeTruthy();
});
});
Loading
Loading