fix(core): unify session-key normalization and plugin boundary checks

This commit is contained in:
Peter Steinberger
2026-02-26 12:40:57 +00:00
parent e3385a6578
commit 4b71de384c
13 changed files with 182 additions and 34 deletions

View File

@@ -5,10 +5,14 @@ export type ParsedAgentSessionKey = {
export type SessionKeyChatType = "direct" | "group" | "channel" | "unknown";
/**
* Parse agent-scoped session keys in a canonical, case-insensitive way.
* Returned values are normalized to lowercase for stable comparisons/routing.
*/
export function parseAgentSessionKey(
sessionKey: string | undefined | null,
): ParsedAgentSessionKey | null {
const raw = (sessionKey ?? "").trim();
const raw = (sessionKey ?? "").trim().toLowerCase();
if (!raw) {
return null;
}