






















@@ -5,6 +5,7 @@ import {
55} from "openclaw/plugin-sdk/context-visibility-runtime";
66import { hasFinalInboundReplyDispatch } from "openclaw/plugin-sdk/inbound-reply-dispatch";
77import type { GetReplyOptions } from "openclaw/plugin-sdk/reply-runtime";
8+import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
89import {
910loadSessionStore,
1011resolveSessionStoreEntry,
@@ -38,7 +39,7 @@ import { MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY } from "../send/types.js";
3839import { resolveMatrixStoredSessionMeta } from "../session-store-metadata.js";
3940import { resolveMatrixMonitorAccessState } from "./access-state.js";
4041import { resolveMatrixAckReactionConfig } from "./ack-config.js";
41-import { resolveMatrixAllowListMatch } from "./allowlist.js";
42+import { normalizeMatrixUserId, resolveMatrixAllowListMatch } from "./allowlist.js";
4243import {
4344resolveMatrixMonitorLiveUserAllowlist,
4445type MatrixResolvedAllowlistEntry,
@@ -1828,6 +1829,13 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
18281829onReplyStart: typingCallbacks.onReplyStart,
18291830onIdle: typingCallbacks.onIdle,
18301831});
1832+const pinnedMainDmOwner = isDirectMessage
1833+ ? resolvePinnedMainDmOwnerFromAllowlist({
1834+dmScope: cfg.session?.dmScope,
1835+allowFrom: liveDmAllowFrom,
1836+normalizeEntry: normalizeMatrixUserId,
1837+})
1838+ : null;
1831183918321840const turnResult = await core.channel.turn.run({
18331841channel: "matrix",
@@ -1855,6 +1863,23 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
18551863channel: "matrix",
18561864to: `room:${roomId}`,
18571865accountId: _route.accountId,
1866+mainDmOwnerPin: pinnedMainDmOwner
1867+ ? {
1868+ownerRecipient: pinnedMainDmOwner,
1869+senderRecipient: normalizeMatrixUserId(senderId),
1870+onSkip: ({
1871+ ownerRecipient,
1872+ senderRecipient,
1873+}: {
1874+ownerRecipient: string;
1875+senderRecipient: string;
1876+}) => {
1877+logVerboseMessage(
1878+`matrix: skip main-session last route for ${senderRecipient} (pinned owner ${ownerRecipient})`,
1879+);
1880+},
1881+}
1882+ : undefined,
18581883}
18591884 : undefined,
18601885onRecordError: (err) => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。