refactor: prune legacy group prefixes

This commit is contained in:
Peter Steinberger
2026-01-17 08:46:19 +00:00
parent ab49fe0e92
commit 13b931c006
44 changed files with 160 additions and 179 deletions

View File

@@ -309,7 +309,6 @@ export function createSessionStatusTool(opts?: {
const isGroup =
resolved.entry.chatType === "group" ||
resolved.entry.chatType === "channel" ||
resolved.key.startsWith("group:") ||
resolved.key.includes(":group:") ||
resolved.key.includes(":channel:");
const groupActivation = isGroup

View File

@@ -68,7 +68,7 @@ export function classifySessionKind(params: {
if (key.startsWith("hook:")) return "hook";
if (key.startsWith("node-") || key.startsWith("node:")) return "node";
if (params.gatewayKind === "group") return "group";
if (key.startsWith("group:") || key.includes(":group:") || key.includes(":channel:")) {
if (key.includes(":group:") || key.includes(":channel:")) {
return "group";
}
return "other";

View File

@@ -23,11 +23,13 @@ export function resolveAnnounceTargetFromKey(sessionKey: string): AnnounceTarget
if (!channelRaw) return null;
const normalizedChannel = normalizeChannelId(channelRaw);
const channel = normalizedChannel ?? channelRaw.toLowerCase();
const kindTarget = normalizedChannel
? kind === "channel"
? `channel:${id}`
: `group:${id}`
: id;
const kindTarget = (() => {
if (!normalizedChannel) return id;
if (normalizedChannel === "discord" || normalizedChannel === "slack") {
return `channel:${id}`;
}
return kind === "channel" ? `channel:${id}` : `group:${id}`;
})();
const normalized = normalizedChannel
? getChannelPlugin(normalizedChannel)?.messaging?.normalizeTarget?.(kindTarget)
: undefined;