Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]
import { getChannelPlugin, getLoadedChannelPlugin } from "../../channels/plugins/index.js";
import type { ChannelPlugin } from "../../channels/plugins/types.plugin.js";
import type { OpenClawConfig } from "../../config/types.openclaw.js";
import { getActivePluginRegistry } from "../../plugins/runtime.js";
import {
isDeliverableMessageChannel,
normalizeMessageChannel,
type DeliverableMessageChannel,
} from "../../utils/message-channel.js";
import {
bootstrapOutboundChannelPlugin,
resetOutboundChannelBootstrapStateForTests,
} from "./channel-bootstrap.runtime.js";
export function resetOutboundChannelResolutionStateForTest(): void {
resetOutboundChannelBootstrapStateForTests();
}
export function normalizeDeliverableOutboundChannel(
raw?: string | null,
): DeliverableMessageChannel | undefined {
const normalized = normalizeMessageChannel(raw);
if (!normalized || !isDeliverableMessageChannel(normalized)) {
return undefined;
}
return normalized;
}
function maybeBootstrapChannelPlugin(params: {
channel: DeliverableMessageChannel;
cfg?: OpenClawConfig;
}): void {
bootstrapOutboundChannelPlugin(params);
}
function resolveDirectFromActiveRegistry(
channel: DeliverableMessageChannel,
): ChannelPlugin | undefined {
const activeRegistry = getActivePluginRegistry();
if (!activeRegistry) {
return undefined;
}
for (const entry of activeRegistry.channels) {
const plugin = entry?.plugin;
if (plugin?.id === channel) {
return plugin;
}
}
return undefined;
}
export function resolveOutboundChannelPlugin(params: {
channel: string;
cfg?: OpenClawConfig;
}): ChannelPlugin | undefined {
const normalized = normalizeDeliverableOutboundChannel(params.channel);
if (!normalized) {
return undefined;
}
const resolveLoaded = () => getLoadedChannelPlugin(normalized);
const resolve = () => getChannelPlugin(normalized);
const current = resolveLoaded();
if (current) {
return current;
}
const directCurrent = resolveDirectFromActiveRegistry(normalized);
if (directCurrent) {
return directCurrent;
}
maybeBootstrapChannelPlugin({ channel: normalized, cfg: params.cfg });
return resolveLoaded() ?? resolveDirectFromActiveRegistry(normalized) ?? resolve();
}
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet am 2026-04-27)
¤
*© Formatika GbR, Deutschland