






















@@ -1,5 +1,6 @@
11import fs from "node:fs";
22import { createSubsystemLogger } from "../../logging/subsystem.js";
3+import type { ChannelRouteRef } from "../../plugin-sdk/channel-route.js";
34import { isPluginJsonValue, type PluginJsonValue } from "../../plugins/host-hook-json.js";
45import { normalizeSessionEntrySlotKey } from "../../plugins/session-entry-slot-keys.js";
56import {
@@ -248,6 +249,22 @@ function normalizePluginExtensionSlotKeys(entry: SessionEntry): SessionEntry {
248249return next;
249250}
250251252+function sameDeliveryChannelRoute(
253+left: ChannelRouteRef | undefined,
254+right: ChannelRouteRef | undefined,
255+): boolean {
256+return (
257+(left?.channel ?? undefined) === (right?.channel ?? undefined) &&
258+(left?.accountId ?? undefined) === (right?.accountId ?? undefined) &&
259+(left?.target?.to ?? undefined) === (right?.target?.to ?? undefined) &&
260+(left?.target?.rawTo ?? undefined) === (right?.target?.rawTo ?? undefined) &&
261+(left?.target?.chatType ?? undefined) === (right?.target?.chatType ?? undefined) &&
262+(left?.thread?.id ?? undefined) === (right?.thread?.id ?? undefined) &&
263+(left?.thread?.kind ?? undefined) === (right?.thread?.kind ?? undefined) &&
264+(left?.thread?.source ?? undefined) === (right?.thread?.source ?? undefined)
265+);
266+}
267+251268function normalizeSessionEntryDelivery(entry: SessionEntry): SessionEntry {
252269const entryRoute = normalizeDeliveryChannelRoute(entry.route);
253270const normalized = normalizeSessionDeliveryFields({
@@ -266,7 +283,7 @@ function normalizeSessionEntryDelivery(entry: SessionEntry): SessionEntry {
266283(entry.deliveryContext?.accountId ?? undefined) === nextDelivery?.accountId &&
267284(entry.deliveryContext?.threadId ?? undefined) === nextDelivery?.threadId;
268285const sameLast =
269-JSON.stringify(entryRoute) === JSON.stringify(normalized.route) &&
286+sameDeliveryChannelRoute(entryRoute, normalized.route) &&
270287entry.lastChannel === normalized.lastChannel &&
271288entry.lastTo === normalized.lastTo &&
272289entry.lastAccountId === normalized.lastAccountId &&
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。