refactor: extract iMessage echo cache and unify suppression guards

This commit is contained in:
Peter Steinberger
2026-02-25 00:53:39 +00:00
parent 196a7dbd24
commit 5c6b2cbc8e
9 changed files with 116 additions and 104 deletions

View File

@@ -15,6 +15,7 @@ import { INTERNAL_MESSAGE_CHANNEL, normalizeMessageChannel } from "../../utils/m
import type { OriginatingChannelType } from "../templating.js";
import type { ReplyPayload } from "../types.js";
import { normalizeReplyPayload } from "./normalize-reply.js";
import { shouldSuppressReasoningPayload } from "./reply-payloads.js";
export type RouteReplyParams = {
/** The reply payload to send. */
@@ -56,7 +57,7 @@ export type RouteReplyResult = {
*/
export async function routeReply(params: RouteReplyParams): Promise<RouteReplyResult> {
const { payload, channel, to, accountId, threadId, cfg, abortSignal } = params;
if (payload.isReasoning) {
if (shouldSuppressReasoningPayload(payload)) {
return { ok: true };
}
const normalizedChannel = normalizeMessageChannel(channel);