From ed463f6de021f278a720fa9aa5b635019ce108f5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 18 Apr 2026 21:16:06 +0100 Subject: [PATCH] chore: remove unused flow and daemon helpers --- src/daemon/constants.ts | 2 -- src/daemon/launchd.ts | 68 -------------------------------------- src/flows/provider-flow.ts | 9 ----- src/flows/types.ts | 16 --------- 4 files changed, 95 deletions(-) diff --git a/src/daemon/constants.ts b/src/daemon/constants.ts index be5455460f0..2c51532ad66 100644 --- a/src/daemon/constants.ts +++ b/src/daemon/constants.ts @@ -12,9 +12,7 @@ export const NODE_WINDOWS_TASK_NAME = "OpenClaw Node"; export const NODE_SERVICE_MARKER = "openclaw"; export const NODE_SERVICE_KIND = "node"; export const NODE_WINDOWS_TASK_SCRIPT_NAME = "node.cmd"; -export const LEGACY_GATEWAY_LAUNCH_AGENT_LABELS: string[] = []; export const LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES: string[] = ["clawdbot-gateway"]; -export const LEGACY_GATEWAY_WINDOWS_TASK_NAMES: string[] = []; export function normalizeGatewayProfile(profile?: string): string | null { const trimmed = profile?.trim(); diff --git a/src/daemon/launchd.ts b/src/daemon/launchd.ts index 1b6909b710f..2d87a584aff 100644 --- a/src/daemon/launchd.ts +++ b/src/daemon/launchd.ts @@ -345,74 +345,6 @@ export async function repairLaunchAgentBootstrap(args: { return { ok: true, status: repairStatus }; } -export type LegacyLaunchAgent = { - label: string; - plistPath: string; - loaded: boolean; - exists: boolean; -}; - -export async function findLegacyLaunchAgents(env: GatewayServiceEnv): Promise { - const domain = resolveGuiDomain(); - const results: LegacyLaunchAgent[] = []; - for (const label of resolveLegacyGatewayLaunchAgentLabels(env.OPENCLAW_PROFILE)) { - const plistPath = resolveLaunchAgentPlistPathForLabel(env, label); - const res = await execLaunchctl(["print", `${domain}/${label}`]); - const loaded = res.code === 0; - let exists = false; - try { - await fs.access(plistPath); - exists = true; - } catch { - // ignore - } - if (loaded || exists) { - results.push({ label, plistPath, loaded, exists }); - } - } - return results; -} - -export async function uninstallLegacyLaunchAgents({ - env, - stdout, -}: GatewayServiceManageArgs): Promise { - const domain = resolveGuiDomain(); - const agents = await findLegacyLaunchAgents(env); - if (agents.length === 0) { - return agents; - } - - const home = toPosixPath(resolveHomeDir(env)); - const trashDir = path.posix.join(home, ".Trash"); - try { - await fs.mkdir(trashDir, { recursive: true }); - } catch { - // ignore - } - - for (const agent of agents) { - await execLaunchctl(["bootout", domain, agent.plistPath]); - await execLaunchctl(["unload", agent.plistPath]); - - try { - await fs.access(agent.plistPath); - } catch { - continue; - } - - const dest = path.join(trashDir, `${agent.label}.plist`); - try { - await fs.rename(agent.plistPath, dest); - stdout.write(`${formatLine("Moved legacy LaunchAgent to Trash", dest)}\n`); - } catch { - stdout.write(`Legacy LaunchAgent remains at ${agent.plistPath} (could not move)\n`); - } - } - - return agents; -} - export async function uninstallLaunchAgent({ env, stdout, diff --git a/src/flows/provider-flow.ts b/src/flows/provider-flow.ts index 06c9cb10bed..bb69b5816ab 100644 --- a/src/flows/provider-flow.ts +++ b/src/flows/provider-flow.ts @@ -63,15 +63,6 @@ function resolveProviderDocsById(params?: { ); } -export function resolveProviderSetupFlowOptions(params?: { - config?: OpenClawConfig; - workspaceDir?: string; - env?: NodeJS.ProcessEnv; - scope?: ProviderFlowScope; -}): ProviderSetupFlowOption[] { - return resolveProviderSetupFlowContributions(params).map((contribution) => contribution.option); -} - export function resolveProviderSetupFlowContributions(params?: { config?: OpenClawConfig; workspaceDir?: string; diff --git a/src/flows/types.ts b/src/flows/types.ts index 30f373a0aad..7c782e47faa 100644 --- a/src/flows/types.ts +++ b/src/flows/types.ts @@ -31,22 +31,6 @@ export type FlowContribution = { source?: string; }; -export function mergeFlowContributions(params: { - primary: readonly T[]; - fallbacks?: readonly T[]; -}): T[] { - const contributionByValue = new Map(); - for (const contribution of params.primary) { - contributionByValue.set(contribution.option.value, contribution); - } - for (const contribution of params.fallbacks ?? []) { - if (!contributionByValue.has(contribution.option.value)) { - contributionByValue.set(contribution.option.value, contribution); - } - } - return [...contributionByValue.values()]; -} - export function sortFlowContributionsByLabel( contributions: readonly T[], ): T[] {