From 2f8f93676ef5ffe432dbc6fc2f8f3a00f16b9bee Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 18 Jun 2026 11:09:14 +0800 Subject: [PATCH] refactor(extensions): remove unused utility helpers --- extensions/google/gemini-cli-auth-home.ts | 11 --------- extensions/irc/src/normalize.ts | 4 ---- extensions/mattermost/src/mattermost/send.ts | 12 ---------- extensions/tlon/src/monitor/approval.ts | 25 -------------------- 4 files changed, 52 deletions(-) diff --git a/extensions/google/gemini-cli-auth-home.ts b/extensions/google/gemini-cli-auth-home.ts index c336028fc37..5edbf64bd6c 100644 --- a/extensions/google/gemini-cli-auth-home.ts +++ b/extensions/google/gemini-cli-auth-home.ts @@ -2,19 +2,8 @@ import crypto from "node:crypto"; import path from "node:path"; export const GOOGLE_GEMINI_CLI_PROVIDER_ID = "google-gemini-cli"; -export const GEMINI_CLI_OAUTH_CREDS_RELATIVE_PATH = ".gemini/oauth_creds.json"; export function resolveGeminiCliProfileHome(agentDir: string, profileId: string): string { const profileHash = crypto.createHash("sha256").update(profileId).digest("hex").slice(0, 24); return path.join(agentDir, `${GOOGLE_GEMINI_CLI_PROVIDER_ID}-home`, "profiles", profileHash); } - -export function resolveGeminiCliProfileCredentialsPath( - agentDir: string, - profileId: string, -): string { - return path.join( - resolveGeminiCliProfileHome(agentDir, profileId), - GEMINI_CLI_OAUTH_CREDS_RELATIVE_PATH, - ); -} diff --git a/extensions/irc/src/normalize.ts b/extensions/irc/src/normalize.ts index 780bd907127..f20c8bdd694 100644 --- a/extensions/irc/src/normalize.ts +++ b/extensions/irc/src/normalize.ts @@ -63,10 +63,6 @@ export function normalizeIrcAllowEntry(raw: string): string { return value.trim(); } -export function normalizeIrcAllowlist(entries?: Array): string[] { - return (entries ?? []).map((entry) => normalizeIrcAllowEntry(String(entry))).filter(Boolean); -} - export function buildIrcAllowlistCandidates( message: IrcInboundMessage, params?: { allowNameMatching?: boolean }, diff --git a/extensions/mattermost/src/mattermost/send.ts b/extensions/mattermost/src/mattermost/send.ts index 1ea64db680c..0377907e6e5 100644 --- a/extensions/mattermost/src/mattermost/send.ts +++ b/extensions/mattermost/src/mattermost/send.ts @@ -31,7 +31,6 @@ import { buildButtonProps, resolveInteractionCallbackUrl, setInteractionSecret, - type MattermostInteractiveButtonInput, } from "./interactions.js"; import { loadOutboundMediaFromUrl, type OpenClawConfig } from "./runtime-api.js"; import { isMattermostId, resolveMattermostOpaqueTarget } from "./target-resolution.js"; @@ -63,10 +62,6 @@ export type MattermostSendResult = { receipt: MessageReceipt; }; -export type MattermostReplyButtons = Array< - MattermostInteractiveButtonInput | MattermostInteractiveButtonInput[] ->; - type MattermostTarget = | { kind: "channel"; id: string } | { kind: "channel-name"; name: string } @@ -435,13 +430,6 @@ async function resolveMattermostSendContext( }; } -export async function resolveMattermostSendChannelId( - to: string, - opts: MattermostSendOpts, -): Promise { - return (await resolveMattermostSendContext(to, opts)).channelId; -} - export async function sendMessageMattermost( to: string, text: string, diff --git a/extensions/tlon/src/monitor/approval.ts b/extensions/tlon/src/monitor/approval.ts index d5207674131..81d68437750 100644 --- a/extensions/tlon/src/monitor/approval.ts +++ b/extensions/tlon/src/monitor/approval.ts @@ -145,31 +145,6 @@ export function findPendingApproval( return pendingApprovals[pendingApprovals.length - 1]; } -/** - * Check if there's already a pending approval for the same ship/channel/group combo. - * Used to avoid sending duplicate notifications. - */ -export function hasDuplicatePending( - pendingApprovals: PendingApproval[], - type: ApprovalType, - requestingShip: string, - channelNest?: string, - groupFlag?: string, -): boolean { - return pendingApprovals.some((approval) => { - if (approval.type !== type || approval.requestingShip !== requestingShip) { - return false; - } - if (type === "channel" && approval.channelNest !== channelNest) { - return false; - } - if (type === "group" && approval.groupFlag !== groupFlag) { - return false; - } - return true; - }); -} - /** * Remove a pending approval from the list by ID. */