mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 20:51:10 +00:00
fix(config): apply filtered doctor compat at read time
This commit is contained in:
@@ -1,9 +1,27 @@
|
||||
import type { LegacyConfigRule } from "../../config/legacy.shared.js";
|
||||
import { iterateBootstrapChannelPlugins } from "./bootstrap-registry.js";
|
||||
import { getBootstrapChannelPlugin } from "./bootstrap-registry.js";
|
||||
import type { ChannelId } from "./types.js";
|
||||
|
||||
export function collectChannelLegacyConfigRules(): LegacyConfigRule[] {
|
||||
function collectConfiguredChannelIds(raw: unknown): ChannelId[] {
|
||||
if (!raw || typeof raw !== "object") {
|
||||
return [];
|
||||
}
|
||||
const channels = (raw as { channels?: unknown }).channels;
|
||||
if (!channels || typeof channels !== "object" || Array.isArray(channels)) {
|
||||
return [];
|
||||
}
|
||||
return Object.keys(channels)
|
||||
.filter((channelId) => channelId !== "defaults")
|
||||
.map((channelId) => channelId as ChannelId);
|
||||
}
|
||||
|
||||
export function collectChannelLegacyConfigRules(raw?: unknown): LegacyConfigRule[] {
|
||||
const rules: LegacyConfigRule[] = [];
|
||||
for (const plugin of iterateBootstrapChannelPlugins()) {
|
||||
for (const channelId of collectConfiguredChannelIds(raw)) {
|
||||
const plugin = getBootstrapChannelPlugin(channelId);
|
||||
if (!plugin) {
|
||||
continue;
|
||||
}
|
||||
rules.push(...(plugin.doctor?.legacyConfigRules ?? []));
|
||||
}
|
||||
return rules;
|
||||
|
||||
Reference in New Issue
Block a user