style: format with oxfmt

This commit is contained in:
Ryan Mac Mini
2026-02-18 14:32:11 -05:00
parent 0a05cc7f81
commit d988438c0d
2 changed files with 26 additions and 24 deletions

View File

@@ -63,8 +63,12 @@ export async function fetchBlueBubblesHistory(
for (const path of possiblePaths) {
try {
const url = buildBlueBubblesApiUrl({ baseUrl, path, password });
const res = await blueBubblesFetchWithTimeout(url, { method: "GET" }, opts.timeoutMs ?? 10000);
const res = await blueBubblesFetchWithTimeout(
url,
{ method: "GET" },
opts.timeoutMs ?? 10000,
);
if (!res.ok) {
continue; // Try next path
}
@@ -87,10 +91,10 @@ export async function fetchBlueBubblesHistory(
}
const historyEntries: BlueBubblesHistoryEntry[] = [];
for (const item of messages) {
const msg = item as BlueBubblesMessageData;
// Skip messages without text content
const text = msg.text?.trim();
if (!text) {
@@ -102,7 +106,8 @@ export async function fetchBlueBubblesHistory(
continue;
}
const sender = msg.sender?.display_name || msg.sender?.address || msg.handle_id || "Unknown";
const sender =
msg.sender?.display_name || msg.sender?.address || msg.handle_id || "Unknown";
const timestamp = msg.date_created || msg.date_delivered;
historyEntries.push({
@@ -142,4 +147,4 @@ export function buildInboundHistoryFromEntries(
body: entry.body,
timestamp: entry.timestamp,
}));
}
}

View File

@@ -10,6 +10,11 @@ import {
} from "openclaw/plugin-sdk";
import { downloadBlueBubblesAttachment } from "./attachments.js";
import { markBlueBubblesChatRead, sendBlueBubblesTyping } from "./chat.js";
import {
fetchBlueBubblesHistory,
buildInboundHistoryFromEntries,
type BlueBubblesHistoryEntry,
} from "./history.js";
import { sendBlueBubblesMedia } from "./media-send.js";
import {
buildMessagePlaceholder,
@@ -37,11 +42,6 @@ import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js";
import { normalizeBlueBubblesReactionInput, sendBlueBubblesReaction } from "./reactions.js";
import { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js";
import { formatBlueBubblesChatTarget, isAllowedBlueBubblesSender } from "./targets.js";
import {
fetchBlueBubblesHistory,
buildInboundHistoryFromEntries,
type BlueBubblesHistoryEntry,
} from "./history.js";
const DEFAULT_TEXT_LIMIT = 4000;
const invalidAckReactions = new Set<string>();
@@ -819,40 +819,37 @@ export async function processMessage(
};
// Fetch history for backfill (both groups and DMs)
const historyLimit = isGroup
const historyLimit = isGroup
? (account.config.historyLimit ?? 0)
: (account.config.dmHistoryLimit ?? 0);
let inboundHistory: Array<{ sender: string; body: string; timestamp?: number }> | undefined;
if (historyLimit > 0) {
// Determine chat identifier for history fetching
const historyIdentifier = chatGuid ||
chatIdentifier ||
const historyIdentifier =
chatGuid ||
chatIdentifier ||
(chatId ? String(chatId) : null) ||
(isGroup ? null : message.senderId);
if (historyIdentifier) {
try {
const historyEntries = await fetchBlueBubblesHistory(historyIdentifier, historyLimit, {
cfg: config,
accountId: account.accountId,
});
if (historyEntries.length > 0) {
inboundHistory = buildInboundHistoryFromEntries(historyEntries);
logVerbose(
core,
runtime,
`fetched ${historyEntries.length} history messages for ${isGroup ? 'group' : 'DM'}: ${historyIdentifier}`
`fetched ${historyEntries.length} history messages for ${isGroup ? "group" : "DM"}: ${historyIdentifier}`,
);
}
} catch (err) {
logVerbose(
core,
runtime,
`history fetch failed for ${historyIdentifier}: ${String(err)}`
);
logVerbose(core, runtime, `history fetch failed for ${historyIdentifier}: ${String(err)}`);
}
}
}