chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -53,10 +53,7 @@ export async function processMessage(params: {
) => void;
echoHas: (key: string) => boolean;
echoForget: (key: string) => void;
buildCombinedEchoKey: (p: {
sessionKey: string;
combinedBody: string;
}) => string;
buildCombinedEchoKey: (p: { sessionKey: string; combinedBody: string }) => string;
maxMediaTextChunkLimit?: number;
groupHistory?: GroupHistoryEntry[];
suppressGroupHistoryClear?: boolean;
@@ -70,12 +67,8 @@ export async function processMessage(params: {
let shouldClearGroupHistory = false;
if (params.msg.chatType === "group") {
const history =
params.groupHistory ??
params.groupHistories.get(params.groupHistoryKey) ??
[];
const historyWithoutCurrent =
history.length > 0 ? history.slice(0, -1) : [];
const history = params.groupHistory ?? params.groupHistories.get(params.groupHistoryKey) ?? [];
const historyWithoutCurrent = history.length > 0 ? history.slice(0, -1) : [];
if (historyWithoutCurrent.length > 0) {
const lineBreak = "\\n";
const historyText = historyWithoutCurrent
@@ -142,8 +135,7 @@ export async function processMessage(params: {
"inbound web message",
);
const fromDisplay =
params.msg.chatType === "group" ? conversationId : params.msg.from;
const fromDisplay = params.msg.chatType === "group" ? conversationId : params.msg.from;
const kindLabel = params.msg.mediaType ? `, ${params.msg.mediaType}` : "";
whatsappInboundLog.info(
`Inbound message ${fromDisplay} -> ${params.msg.to} (${params.msg.chatType}${kindLabel}, ${combinedBody.length} chars)`,
@@ -173,9 +165,7 @@ export async function processMessage(params: {
}
}
const textLimit =
params.maxMediaTextChunkLimit ??
resolveTextChunkLimit(params.cfg, "whatsapp");
const textLimit = params.maxMediaTextChunkLimit ?? resolveTextChunkLimit(params.cfg, "whatsapp");
let didLogHeartbeatStrip = false;
let didSendReply = false;
const responsePrefix = resolveEffectiveMessagesConfig(
@@ -242,8 +232,7 @@ export async function processMessage(params: {
params.rememberSentText(payload.text, {});
return;
}
const shouldLog =
info.kind === "final" && payload.text ? true : undefined;
const shouldLog = info.kind === "final" && payload.text ? true : undefined;
params.rememberSentText(payload.text, {
combinedBody,
combinedBodySessionKey: params.route.sessionKey,
@@ -251,21 +240,12 @@ export async function processMessage(params: {
});
if (info.kind === "final") {
const fromDisplay =
params.msg.chatType === "group"
? conversationId
: (params.msg.from ?? "unknown");
const hasMedia = Boolean(
payload.mediaUrl || payload.mediaUrls?.length,
);
whatsappOutboundLog.info(
`Auto-replied to ${fromDisplay}${hasMedia ? " (media)" : ""}`,
);
params.msg.chatType === "group" ? conversationId : (params.msg.from ?? "unknown");
const hasMedia = Boolean(payload.mediaUrl || payload.mediaUrls?.length);
whatsappOutboundLog.info(`Auto-replied to ${fromDisplay}${hasMedia ? " (media)" : ""}`);
if (shouldLogVerbose()) {
const preview =
payload.text != null ? elide(payload.text, 400) : "<media>";
whatsappOutboundLog.debug(
`Reply body: ${preview}${hasMedia ? " (media)" : ""}`,
);
const preview = payload.text != null ? elide(payload.text, 400) : "<media>";
whatsappOutboundLog.debug(`Reply body: ${preview}${hasMedia ? " (media)" : ""}`);
}
}
},
@@ -294,9 +274,7 @@ export async function processMessage(params: {
if (shouldClearGroupHistory && didSendReply) {
params.groupHistories.set(params.groupHistoryKey, []);
}
logVerbose(
"Skipping auto-reply: silent token or no text/media returned from resolver",
);
logVerbose("Skipping auto-reply: silent token or no text/media returned from resolver");
return false;
}