import { mapAllowFromEntries } from "openclaw/plugin-sdk/channel-config-helpers"; import { normalizeChatType, type ChatType } from "../../channels/chat-type.js"; import type { ChannelOutboundTargetMode } from "../../channels/plugins/types.core.js"; import type { SessionEntry } from "../../config/sessions.js"; import type { AgentDefaultsConfig } from "../../config/types.agent-defaults.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; import { normalizeAccountId } from "../../routing/session-key.js"; import {
deliveryContextFromSession,
mergeDeliveryContext,
} from "../../utils/delivery-context.shared.js"; import type { DeliveryContext } from "../../utils/delivery-context.types.js"; import type {
DeliverableMessageChannel,
GatewayMessageChannel,
} from "../../utils/message-channel.js"; import {
INTERNAL_MESSAGE_CHANNEL,
isDeliverableMessageChannel,
} from "../../utils/message-channel.js"; import {
normalizeDeliverableOutboundChannel,
resolveOutboundChannelPlugin,
} from "./channel-resolution.js"; import {
resolveOutboundTargetWithPlugin,
type OutboundTargetResolution,
} from "./targets-resolve-shared.js";
export type OutboundChannel = DeliverableMessageChannel;
export type { OutboundTargetResolution } from "./targets-resolve-shared.js";
export { resolveSessionDeliveryTarget, type SessionDeliveryTarget } from "./targets-session.js"; import { resolveSessionDeliveryTarget, type SessionDeliveryTarget } from "./targets-session.js";
const resolvedTarget = resolveSessionDeliveryTarget({
entry,
requestedChannel: target === "last" ? "last" : target,
explicitTo: heartbeat?.to,
mode: "heartbeat",
turnSourceChannel:
resolvedTurnSource?.channel && isDeliverableMessageChannel(resolvedTurnSource.channel)
? resolvedTurnSource.channel
: undefined,
turnSourceTo: resolvedTurnSource?.to,
turnSourceAccountId: resolvedTurnSource?.accountId, // Only pass threadId from an explicit turn source (e.g., restart sentinel's // delivery context). Do NOT fall back to session-stored threadId here — // heartbeat mode intentionally drops inherited thread IDs to avoid replying // in stale threads (e.g., Slack thread_ts). The sentinel's delivery context // carries the correct topic/thread ID when present.
turnSourceThreadId: params.turnSource?.threadId,
});
const heartbeatAccountId = heartbeat?.accountId?.trim(); // Use explicit accountId from heartbeat config if provided, otherwise fall back to session
let effectiveAccountId = heartbeatAccountId || resolvedTarget.accountId;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.