feat(desktop): add Wenxin monitoring adapter and surface platform risk control

Introduces the Wenxin (文心一言) monitoring adapter and registers it in
the runtime controller and adapter index. Adds a new risk_control
failure classification with custom classifiers for Doubao and Wenxin
that recognize rate-limit, 频控 and 访问环境异常 signals, and propagates
this state through account-health, runtime activity alerts, and the
renderer views so users see "触发风控" instead of a generic challenge
message on the Home, Accounts, and AI Platforms screens.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 15:26:24 +08:00
parent bd4ee8feef
commit ca40657c5a
12 changed files with 2552 additions and 21 deletions
@@ -0,0 +1,24 @@
import { beforeAll, describe, expect, it, vi } from "vitest";
vi.mock("./account-binder", () => ({
probePublishAccountSession: vi.fn(),
silentRefreshPublishAccountSession: vi.fn(),
}));
let getPlatformAdapter: typeof import("./platform-auth-adapters").getPlatformAdapter;
beforeAll(async () => {
({ getPlatformAdapter } = await import("./platform-auth-adapters"));
});
describe("platform auth adapters", () => {
it("classifies Wenxin environment abnormal messages as risk control", () => {
const adapter = getPlatformAdapter("wenxin");
expect(
adapter.classifyFailure({
message: "当前访问环境存在异常,请更换浏览器再尝试提问",
}),
).toBe("risk_control");
});
});