Skip to content

Commit f565138

Browse files
authored
refactor(deadcode): localize core helpers (#101869)
1 parent 75e3aa2 commit f565138

79 files changed

Lines changed: 99 additions & 109 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/agents/bash-tools.exec-host-shared.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export function createExecApprovalPendingState(params: {
147147
}
148148

149149
/** Builds pending approval state plus rounded notice duration. */
150-
export function createExecApprovalRequestState(params: {
150+
function createExecApprovalRequestState(params: {
151151
warnings: string[];
152152
timeoutMs: number;
153153
approvalRunningNoticeMs: number;
@@ -163,7 +163,7 @@ export function createExecApprovalRequestState(params: {
163163
}
164164

165165
/** Creates a fresh approval id/slug/context key for a pending request. */
166-
export function createExecApprovalRequestContext(params: {
166+
function createExecApprovalRequestContext(params: {
167167
warnings: string[];
168168
timeoutMs: number;
169169
approvalRunningNoticeMs: number;
@@ -188,7 +188,7 @@ export function createExecApprovalRequestContext(params: {
188188
}
189189

190190
/** Creates a pending approval context using the default approval timeout. */
191-
export function createDefaultExecApprovalRequestContext(params: {
191+
function createDefaultExecApprovalRequestContext(params: {
192192
warnings: string[];
193193
approvalRunningNoticeMs: number;
194194
createApprovalSlug: (approvalId: string) => string;

src/cli/hooks-cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ export function formatHooksCheck(report: HookStatusReport, opts: HooksCheckOptio
440440
return lines.join("\n");
441441
}
442442

443-
export async function enableHook(hookName: string): Promise<void> {
443+
async function enableHook(hookName: string): Promise<void> {
444444
const snapshot = await readConfigFileSnapshot();
445445
const config = (snapshot.sourceConfig ?? snapshot.config) as OpenClawConfig;
446446
const hook = resolveHookForToggle(buildHooksReport(config), hookName, { requireEligible: true });
@@ -460,7 +460,7 @@ export async function enableHook(hookName: string): Promise<void> {
460460
);
461461
}
462462

463-
export async function disableHook(hookName: string): Promise<void> {
463+
async function disableHook(hookName: string): Promise<void> {
464464
const snapshot = await readConfigFileSnapshot();
465465
const config = (snapshot.sourceConfig ?? snapshot.config) as OpenClawConfig;
466466
const hook = resolveHookForToggle(buildHooksReport(config), hookName);

src/cli/update-cli/plugin-payload-validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ async function validatePackagePayload(params: {
244244
return failures;
245245
}
246246

247-
export function isBundleInstallRecord(record: PluginInstallRecord): boolean {
247+
function isBundleInstallRecord(record: PluginInstallRecord): boolean {
248248
return (
249249
(record as { format?: unknown }).format === "bundle" || record.clawhubFamily === "bundle-plugin"
250250
);

src/commands/doctor-plugin-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export function maybeRepairStaleManagedNpmBundledPlugins(
321321
}
322322

323323
/** Removes local install records that shadow current bundled plugin sources. */
324-
export async function maybeRepairStaleLocalBundledPluginInstallRecords(
324+
async function maybeRepairStaleLocalBundledPluginInstallRecords(
325325
params: PluginRegistryDoctorRepairParams,
326326
): Promise<string[]> {
327327
const stale = await listStaleLocalBundledPluginInstallRecordShadows(params);

src/commands/onboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const CONVERSATIONAL_SAFE_ONBOARD_KEYS = new Set([
4141
"classic",
4242
]);
4343

44-
export function wantsClassicInteractiveSetup(opts: OnboardOptions): boolean {
44+
function wantsClassicInteractiveSetup(opts: OnboardOptions): boolean {
4545
if (opts.classic === true) {
4646
return true;
4747
}

src/commands/runtime-plugin-install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function isInstalledRecordPresentOnDisk(
6969
}
7070

7171
/** Ensures the runtime plugin required by the selected model is installed and enabled. */
72-
export async function ensureRuntimePluginForModelSelection(params: {
72+
async function ensureRuntimePluginForModelSelection(params: {
7373
cfg: OpenClawConfig;
7474
model?: string;
7575
prompter: WizardPrompter;
@@ -140,7 +140,7 @@ export async function ensureRuntimePluginForModelSelection(params: {
140140
}
141141

142142
/** Repairs missing install records for runtime plugins required by model selection. */
143-
export async function repairRuntimePluginInstallForModelSelection(params: {
143+
async function repairRuntimePluginInstallForModelSelection(params: {
144144
cfg: OpenClawConfig;
145145
model?: string;
146146
env?: NodeJS.ProcessEnv;

src/config/codex-plugin-diagnostics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function openAiDefaultRouteKeepsCodexUnavailable(cfg: OpenClawConfig): boolean {
185185
* Route-specific Codex selections still win; this only answers the missing-plugin
186186
* diagnostic question for OpenAI defaults and OpenAI-compatible proxy configs.
187187
*/
188-
export function configExplicitlyKeepsCodexUnavailableForOpenAi(cfg: OpenClawConfig): boolean {
188+
function configExplicitlyKeepsCodexUnavailableForOpenAi(cfg: OpenClawConfig): boolean {
189189
if (openAiHasCodexDefaultRuntimePolicy(cfg)) {
190190
return false;
191191
}

src/config/nix-mode-write-guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class NixModeConfigMutationError extends Error {
1717
}
1818

1919
/** Build the operator-facing immutable-config message for Nix-managed installs. */
20-
export function formatNixModeConfigMutationMessage(params: { configPath?: string } = {}): string {
20+
function formatNixModeConfigMutationMessage(params: { configPath?: string } = {}): string {
2121
return [
2222
"Config is managed by Nix (`OPENCLAW_NIX_MODE=1`), so OpenClaw treats openclaw.json as immutable.",
2323
"This usually means nix-openclaw, the first-party Nix distribution, or another Nix-managed package set this mode.",

src/config/sessions/store-cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function internSessionEntryLargeStrings(entry: SessionEntry): void {
119119
snapshot.prompt = internLargeSessionStoreString(snapshot.prompt);
120120
}
121121

122-
export function internSessionStoreLargeStrings(store: Record<string, SessionEntry>): void {
122+
function internSessionStoreLargeStrings(store: Record<string, SessionEntry>): void {
123123
for (const entry of Object.values(store)) {
124124
internSessionEntryLargeStrings(entry);
125125
}
@@ -252,7 +252,7 @@ export function cloneSessionStoreSnapshotEntry(entry: SessionEntry): SessionStor
252252
return deepFreeze(cloneSessionStoreRecord({ entry }).entry);
253253
}
254254

255-
export function getSessionStoreTtl(): number {
255+
function getSessionStoreTtl(): number {
256256
return resolveCacheTtlMs({
257257
envValue: process.env.OPENCLAW_SESSION_CACHE_TTL_MS,
258258
defaultTtlMs: DEFAULT_SESSION_STORE_TTL_MS,

src/config/sessions/transcript-jsonl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function serializeJsonlLine(entry: unknown): string {
2828
return serialized;
2929
}
3030

31-
export function serializeJsonlEntries(entries: readonly unknown[]): string {
31+
function serializeJsonlEntries(entries: readonly unknown[]): string {
3232
return serializeJsonlLines(entries.map(serializeJsonlLine));
3333
}
3434

0 commit comments

Comments
 (0)