mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 19:00:21 +00:00
perf(inbound): trim cold startup import graph (#52082)
* perf(inbound): trim cold startup import graph * chore(reply): drop redundant inline action type import * fix(inbound): restore warning and maintenance seams * fix(reply): restore type seam and secure forked transcripts
This commit is contained in:
@@ -1,12 +1,29 @@
|
||||
import { normalizeChatType } from "openclaw/plugin-sdk/account-resolution";
|
||||
import type { MsgContext } from "openclaw/plugin-sdk/reply-runtime";
|
||||
type DiscordSessionKeyContext = {
|
||||
ChatType?: string;
|
||||
From?: string;
|
||||
SenderId?: string;
|
||||
};
|
||||
|
||||
function normalizeDiscordChatType(raw?: string): "direct" | "group" | "channel" | undefined {
|
||||
const normalized = (raw ?? "").trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return undefined;
|
||||
}
|
||||
if (normalized === "dm") {
|
||||
return "direct";
|
||||
}
|
||||
if (normalized === "group" || normalized === "channel" || normalized === "direct") {
|
||||
return normalized;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function normalizeExplicitDiscordSessionKey(
|
||||
sessionKey: string,
|
||||
ctx: Pick<MsgContext, "ChatType" | "From" | "SenderId">,
|
||||
ctx: DiscordSessionKeyContext,
|
||||
): string {
|
||||
let normalized = sessionKey.trim().toLowerCase();
|
||||
if (normalizeChatType(ctx.ChatType) !== "direct") {
|
||||
if (normalizeDiscordChatType(ctx.ChatType) !== "direct") {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user