mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 04:01:05 +00:00
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { getBootstrapChannelPlugin } from "../channels/plugins/bootstrap-registry.js";
|
|
import { hasBundledChannelConfiguredState } from "../channels/plugins/configured-state.js";
|
|
import { hasBundledChannelPersistedAuthState } from "../channels/plugins/persisted-auth-state.js";
|
|
import {
|
|
hasMeaningfulChannelConfigShallow,
|
|
resolveChannelConfigRecord,
|
|
} from "./channel-configured-shared.js";
|
|
import type { OpenClawConfig } from "./config.js";
|
|
|
|
export function isChannelConfigured(
|
|
cfg: OpenClawConfig,
|
|
channelId: string,
|
|
env: NodeJS.ProcessEnv = process.env,
|
|
): boolean {
|
|
if (hasBundledChannelConfiguredState({ channelId, cfg, env })) {
|
|
return true;
|
|
}
|
|
const pluginPersistedAuthState = hasBundledChannelPersistedAuthState({ channelId, cfg, env });
|
|
if (pluginPersistedAuthState) {
|
|
return true;
|
|
}
|
|
if (hasMeaningfulChannelConfigShallow(resolveChannelConfigRecord(cfg, channelId))) {
|
|
return true;
|
|
}
|
|
const plugin = getBootstrapChannelPlugin(channelId);
|
|
return Boolean(plugin?.config?.hasConfiguredState?.({ cfg, env }));
|
|
}
|