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:
Vincent Koc
2026-03-21 22:32:21 -07:00
committed by GitHub
parent c96a12aeb9
commit 041f0b87ec
30 changed files with 643 additions and 397 deletions

View File

@@ -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;
}