mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-22 13:38:07 +00:00
refactor(extensions): remove unused utility helpers
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,10 +63,6 @@ export function normalizeIrcAllowEntry(raw: string): string {
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
export function normalizeIrcAllowlist(entries?: Array<string | number>): string[] {
|
||||
return (entries ?? []).map((entry) => normalizeIrcAllowEntry(String(entry))).filter(Boolean);
|
||||
}
|
||||
|
||||
export function buildIrcAllowlistCandidates(
|
||||
message: IrcInboundMessage,
|
||||
params?: { allowNameMatching?: boolean },
|
||||
|
||||
@@ -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<string> {
|
||||
return (await resolveMattermostSendContext(to, opts)).channelId;
|
||||
}
|
||||
|
||||
export async function sendMessageMattermost(
|
||||
to: string,
|
||||
text: string,
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user