


























@@ -2,6 +2,7 @@ import { resolveAgentConfig, resolveDefaultAgentId } from "../../../agents/agent
22import { pickSandboxToolPolicy } from "../../../agents/sandbox-tool-policy.js";
33import { isToolAllowedByPolicies } from "../../../agents/tool-policy-match.js";
44import { mergeAlsoAllowPolicy, resolveToolProfilePolicy } from "../../../agents/tool-policy.js";
5+import { normalizeChatChannelId } from "../../../channels/ids.js";
56import { listRouteBindings } from "../../../config/bindings.js";
67import type { AgentRouteBinding } from "../../../config/types.agents.js";
78import type { OpenClawConfig } from "../../../config/types.openclaw.js";
@@ -12,6 +13,7 @@ import {
1213normalizeAgentId,
1314} from "../../../routing/session-key.js";
1415import { createLazyImportLoader } from "../../../shared/lazy-promise.js";
16+import { normalizeLowercaseStringOrEmpty } from "../../../shared/string-coerce.js";
15171618type ChannelDoctorModule = typeof import("./channel-doctor.js");
1719@@ -37,6 +39,10 @@ function hasChannels(cfg: OpenClawConfig): boolean {
3739return hasRecord(cfg.channels);
3840}
394142+function normalizeChannelKey(raw?: string | null): string {
43+return normalizeChatChannelId(raw) ?? normalizeLowercaseStringOrEmpty(raw);
44+}
45+4046function listConfiguredChannelIds(cfg: OpenClawConfig): string[] {
4147if (!hasRecord(cfg.channels)) {
4248return [];
@@ -48,15 +54,18 @@ function listConfiguredChannelIds(cfg: OpenClawConfig): string[] {
4854}
4955return !(hasRecord(value) && value.enabled === false);
5056})
51-.map(([id]) => id)
57+.map(([id]) => normalizeChannelKey(id))
58+.filter(Boolean)
5259.toSorted();
5360}
54615562function listConfiguredChannelAccountIds(cfg: OpenClawConfig, channelId: string): string[] {
5663if (!hasRecord(cfg.channels)) {
5764return [];
5865}
59-const channel = cfg.channels[channelId];
66+const channel = Object.entries(cfg.channels).find(
67+([id]) => normalizeChannelKey(id) === channelId,
68+)?.[1];
6069if (!hasRecord(channel) || !hasRecord(channel.accounts)) {
6170return [];
6271}
@@ -286,7 +295,7 @@ function collectBoundChannelTargets(cfg: OpenClawConfig): Array<{
286295const fullyCoveredChannels = new Set<string>();
287296const coveredAccountsByChannel = new Map<string, Set<string>>();
288297for (const binding of routeBindings) {
289-const channel = binding.match.channel.trim();
298+const channel = normalizeChannelKey(binding.match.channel);
290299add(binding.agentId, channel);
291300if (!channel) {
292301continue;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。