Skip to content

Commit 62e5d44

Browse files
authored
refactor(ui): remove unused module exports (#101262)
1 parent b2baf79 commit 62e5d44

11 files changed

Lines changed: 30 additions & 52 deletions

ui/config/control-ui-chunking.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export function normalizeModuleId(id: string): string {
33
return id.replace(/\\/g, "/");
44
}
55

6-
export function moduleIdIncludesPackage(id: string, packageName: string): boolean {
6+
function moduleIdIncludesPackage(id: string, packageName: string): boolean {
77
const normalized = normalizeModuleId(id);
88
return (
99
normalized.includes(`/node_modules/${packageName}/`) ||

ui/src/app/exec-approval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export function parsePluginApprovalRequested(payload: unknown): ExecApprovalRequ
200200
};
201201
}
202202

203-
export function pruneExecApprovalQueue(queue: ExecApprovalRequest[]): ExecApprovalRequest[] {
203+
function pruneExecApprovalQueue(queue: ExecApprovalRequest[]): ExecApprovalRequest[] {
204204
const now = Date.now();
205205
return queue.filter((entry) => entry.expiresAtMs > now);
206206
}

ui/src/components/config-form.render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { normalizeLowercaseStringOrEmpty } from "../lib/string-coerce.ts";
66
import { matchesNodeSearch, parseConfigSearchQuery, renderNode } from "./config-form.node.ts";
77
import { hintForPath, humanize, schemaType, type JsonSchema } from "./config-form.shared.ts";
88

9-
export type ConfigFormProps = {
9+
type ConfigFormProps = {
1010
schema: JsonSchema | null;
1111
uiHints: ConfigUiHints;
1212
value: Record<string, unknown> | null;

ui/src/components/config-form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Control UI view renders config form screen content.
2-
export { renderConfigForm, type ConfigFormProps, SECTION_META } from "./config-form.render.ts";
2+
export { renderConfigForm, SECTION_META } from "./config-form.render.ts";
33
export { analyzeConfigSchema, type ConfigSchemaAnalysis } from "./config-form.analyze.ts";
44
export { renderNode } from "./config-form.node.ts";
55
export { schemaType, type JsonSchema } from "./config-form.shared.ts";

ui/src/lib/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function formatUnknownText(
3838
return Object.prototype.toString.call(value);
3939
}
4040

41-
export type UiTimeFormatPreference = "auto" | "12" | "24";
41+
type UiTimeFormatPreference = "auto" | "12" | "24";
4242

4343
// Resolved `agents.defaults.timeFormat`, threaded in once at bootstrap. "auto"
4444
// (or unset) keeps the browser locale default so existing deployments render

ui/src/lib/overview-hints.node.test.ts

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
resolveAuthHintKind,
88
resolvePairingHint,
99
shouldShowInsecureContextHint,
10-
shouldShowPairingHint,
1110
} from "./overview-hints.ts";
1211

1312
afterEach(() => {
@@ -74,43 +73,31 @@ describe("resolveGatewayTokenForUrlEdit", () => {
7473
});
7574
});
7675

77-
describe("shouldShowPairingHint", () => {
78-
it("returns true for 'pairing required' close reason", () => {
79-
expect(shouldShowPairingHint(false, "disconnected (1008): pairing required")).toBe(true);
80-
});
81-
82-
it("matches case-insensitively", () => {
83-
expect(shouldShowPairingHint(false, "Pairing Required")).toBe(true);
84-
});
85-
86-
it("returns false when connected", () => {
87-
expect(shouldShowPairingHint(true, "disconnected (1008): pairing required")).toBe(false);
88-
});
89-
90-
it("returns false when lastError is null", () => {
91-
expect(shouldShowPairingHint(false, null)).toBe(false);
92-
});
93-
94-
it("returns false for unrelated errors", () => {
95-
expect(shouldShowPairingHint(false, "disconnected (1006): no reason")).toBe(false);
96-
});
97-
98-
it("returns false for auth errors", () => {
99-
expect(shouldShowPairingHint(false, "disconnected (4008): unauthorized")).toBe(false);
76+
describe("resolvePairingHint", () => {
77+
it.each([
78+
["close reason", "disconnected (1008): pairing required", undefined],
79+
["case-insensitive close reason", "Pairing Required", undefined],
80+
[
81+
"structured pairing code",
82+
"disconnected (4008): connect failed",
83+
ConnectErrorDetailCodes.PAIRING_REQUIRED,
84+
],
85+
])("detects pairing required from %s", (_name, lastError, lastErrorCode) => {
86+
expect(resolvePairingHint(false, lastError, lastErrorCode)).toEqual({
87+
kind: "pairing-required",
88+
requestId: null,
89+
});
10090
});
10191

102-
it("returns true for structured pairing code", () => {
103-
expect(
104-
shouldShowPairingHint(
105-
false,
106-
"disconnected (4008): connect failed",
107-
ConnectErrorDetailCodes.PAIRING_REQUIRED,
108-
),
109-
).toBe(true);
92+
it.each([
93+
["connected clients", true, "disconnected (1008): pairing required"],
94+
["missing errors", false, null],
95+
["unrelated errors", false, "disconnected (1006): no reason"],
96+
["auth errors", false, "disconnected (4008): unauthorized"],
97+
])("ignores %s", (_name, connected, lastError) => {
98+
expect(resolvePairingHint(connected, lastError)).toBeNull();
11099
});
111-
});
112100

113-
describe("resolvePairingHint", () => {
114101
it("detects scope-upgrade pending approval and keeps the request id", () => {
115102
expect(
116103
resolvePairingHint(

ui/src/lib/overview-hints.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ export function resolvePairingHint(
7474
return null;
7575
}
7676

77-
/** Whether the overview should show device-pairing guidance for this error. */
78-
export function shouldShowPairingHint(
79-
connected: boolean,
80-
lastError: string | null,
81-
lastErrorCode?: string | null,
82-
): boolean {
83-
return resolvePairingHint(connected, lastError, lastErrorCode) !== null;
84-
}
85-
8677
/**
8778
* Return the overview auth hint to show, if any.
8879
*

ui/src/lib/sessions/custom-groups.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getSafeLocalStorage } from "../../local-storage.ts";
33
import type { SessionCapability } from "./index.ts";
44
import { parseAgentSessionKey } from "./session-key.ts";
55

6-
export const SESSION_CUSTOM_GROUPS_STORAGE_KEY = "openclaw:sessions:custom-groups";
6+
const SESSION_CUSTOM_GROUPS_STORAGE_KEY = "openclaw:sessions:custom-groups";
77

88
export function loadStoredSessionCustomGroups(): string[] {
99
try {

ui/src/lib/sessions/session-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type SessionAgentOptionsState = {
2323
sessionKey: string;
2424
};
2525

26-
export type SessionAgentFilterOption = {
26+
type SessionAgentFilterOption = {
2727
id: string;
2828
label: string;
2929
};

ui/src/pages/chat/chat-queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function readChatQueueForSession(
8080
: (host.chatQueueBySession?.[sessionKey] ?? []);
8181
}
8282

83-
export function writeChatQueueForSession(
83+
function writeChatQueueForSession(
8484
host: ChatQueueSessionHost,
8585
sessionKey: string,
8686
queue: ChatQueueItem[],

0 commit comments

Comments
 (0)