























@@ -1,6 +1,13 @@
11import { collectConfiguredAgentHarnessRuntimes } from "../agents/harness-runtimes.js";
22import { normalizeProviderId } from "../agents/provider-id.js";
3-import { listPotentialConfiguredChannelPresenceSignals } from "../channels/config-presence.js";
3+import {
4+listPotentialConfiguredChannelPresenceSignals,
5+type ChannelPresenceSignalSource,
6+} from "../channels/config-presence.js";
7+import {
8+hasBundledChannelConfiguredState,
9+listBundledChannelIdsWithConfiguredState,
10+} from "../channels/plugins/configured-state.js";
411import { getChatChannelMeta, normalizeChatChannelId } from "../channels/registry.js";
512import { getCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js";
613import {
@@ -253,11 +260,45 @@ function collectPluginIdsForConfiguredChannel(
253260}
254261255262function collectConfiguredChannelIds(cfg: OpenClawConfig, env: NodeJS.ProcessEnv): string[] {
263+const configuredStateChannelIds = new Set(listBundledChannelIdsWithConfiguredState());
256264return listPotentialConfiguredChannelPresenceSignals(cfg, env, {
257265includePersistedAuthState: false,
258266})
259-.map((signal) => normalizeChatChannelId(signal.channelId) ?? signal.channelId)
260-.filter((channelId) => isChannelConfigured(cfg, channelId, env));
267+.map((signal) => ({
268+source: signal.source,
269+channelId: normalizeChatChannelId(signal.channelId) ?? signal.channelId,
270+}))
271+.filter(({ channelId, source }) =>
272+isAutoEnableConfiguredChannelSignal({
273+ cfg,
274+ env,
275+ channelId,
276+ source,
277+ configuredStateChannelIds,
278+}),
279+)
280+.map(({ channelId }) => channelId);
281+}
282+283+function isAutoEnableConfiguredChannelSignal(params: {
284+cfg: OpenClawConfig;
285+env: NodeJS.ProcessEnv;
286+channelId: string;
287+source: ChannelPresenceSignalSource;
288+configuredStateChannelIds: ReadonlySet<string>;
289+}): boolean {
290+if (
291+params.source === "env" &&
292+params.configuredStateChannelIds.has(params.channelId) &&
293+!hasBundledChannelConfiguredState({
294+channelId: params.channelId,
295+cfg: params.cfg,
296+env: params.env,
297+})
298+) {
299+return false;
300+}
301+return isChannelConfigured(params.cfg, params.channelId, params.env);
261302}
262303263304function hasConfiguredWebSearchPluginEntry(cfg: OpenClawConfig): boolean {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。