refactor: remove unused internal helpers and state (#5667)

* refactor: remove unused internal helpers and state

* test(tui): await deferred submissions before reconnect attach
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-05 22:09:12 +08:00
1 parent f37ba60ed4
commit 63cc5f270d
11 files changed
+12 -118

No files matched your search

-25
View File
@@ -57,7 +57,6 @@ import {
updateMcpServerTools,
updateNetworkSafetySettings,
updateProviderSettings,
updateSettings,
updateSkillEnabled,
updateWebSearchSettings,
validateChannel,
@@ -402,30 +401,6 @@ describe("webui API helpers", () => {
);
});
it("serializes settings updates as a narrow mutation payload", async () => {
await updateSettings(mutationTransport, {
modelPreset: "default",
model: "openrouter/test",
provider: "openrouter",
contextWindowTokens: 262144,
timezone: "Asia/Shanghai",
toolHintMaxLength: 120,
});
expect(requestMutation).toHaveBeenCalledWith(
"settings.agent.update",
{
model_preset: "default",
model: "openrouter/test",
provider: "openrouter",
context_window_tokens: 262144,
timezone: "Asia/Shanghai",
tool_hint_max_length: 120,
},
20_000,
);
});
it("fetches token usage through the lightweight settings endpoint", async () => {
await fetchSettingsUsage("tok");
+3 -5
View File
@@ -2,13 +2,12 @@ import { describe, expect, it } from "vitest";
import {
formatCompactWebUrl,
parsePublicHttpUrl,
parseSafeActivityHttpUrl,
} from "@/components/thread/activity/web-url";
describe("activity web URLs", () => {
it("keeps public HTTP URLs and removes query noise from their label", () => {
const url = parsePublicHttpUrl("https://www.example.com/docs/?token=private#section");
const url = parseSafeActivityHttpUrl("https://www.example.com/docs/?token=private#section");
expect(url).not.toBeNull();
expect(formatCompactWebUrl(url!)).toBe("example.com/docs");
});
@@ -24,9 +23,8 @@ describe("activity web URLs", () => {
"http://192.168.1.1",
"http://[::1]",
"http://[::ffff:127.0.0.1]",
"https://user:password@example.com",
])("rejects private or credential-bearing target %s", (value) => {
expect(parsePublicHttpUrl(value)).toBeNull();
])("rejects private target %s", (value) => {
expect(parseSafeActivityHttpUrl(value)).toBeNull();
});
it("normalizes credential-bearing public URLs for safe activity display", () => {