test: avoid channel catalog import in logger setup

This commit is contained in:
Shakker
2026-05-09 23:21:37 +01:00
parent 0fb84a9bcd
commit 9ec2831c20

View File

@@ -1,6 +1,5 @@
import { Chalk } from "chalk";
import type { Logger as TsLogger } from "tslog";
import { normalizeChatChannelId } from "../channels/ids.js";
import { isVerbose } from "../global-state.js";
import { defaultRuntime, type OutputRuntimeEnv, type RuntimeEnv } from "../runtime.js";
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
@@ -114,13 +113,41 @@ const SUBSYSTEM_COLOR_OVERRIDES: Record<string, (typeof SUBSYSTEM_COLORS)[number
};
const SUBSYSTEM_PREFIXES_TO_DROP = ["gateway", "channels", "providers"] as const;
const SUBSYSTEM_MAX_SEGMENTS = 2;
const CHANNEL_SUBSYSTEM_PREFIXES = new Set([
"clickclack",
"discord",
"feishu",
"googlechat",
"imessage",
"irc",
"line",
"matrix",
"mattermost",
"msteams",
"nextcloud-talk",
"nostr",
"openclaw-weixin",
"qqbot",
"signal",
"slack",
"synology-chat",
"telegram",
"tlon",
"twitch",
"webchat",
"wecom",
"whatsapp",
"yuanbao",
"zalo",
"zalouser",
]);
function isChannelSubsystemPrefix(value: string): boolean {
const normalized = normalizeLowercaseStringOrEmpty(value);
if (!normalized) {
return false;
}
return normalizeChatChannelId(normalized) === normalized || normalized === "webchat";
return CHANNEL_SUBSYSTEM_PREFIXES.has(normalized);
}
function pickSubsystemColor(color: ChalkInstance, subsystem: string): ChalkInstance {