refactor(channels): route registry lookups through runtime

This commit is contained in:
Vincent Koc 2026-03-24 11:01:37 -07:00
parent 7fab2c2897
commit e16f0cf908
1 changed files with 2 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import { getActivePluginRegistry } from "../plugins/runtime.js";
import { CHANNEL_IDS, CHAT_CHANNEL_ORDER, type ChatChannelId } from "./ids.js";
import type { ChannelMeta } from "./plugins/types.js";
import type { ChannelId } from "./plugins/types.js";
@ -7,7 +8,6 @@ export type { ChatChannelId } from "./ids.js";
export type ChatChannelMeta = ChannelMeta;
const WEBSITE_URL = "https://openclaw.ai";
const REGISTRY_STATE = Symbol.for("openclaw.pluginRegistryState");
type RegisteredChannelPluginEntry = {
plugin: {
@ -17,10 +17,7 @@ type RegisteredChannelPluginEntry = {
};
function listRegisteredChannelPluginEntries(): RegisteredChannelPluginEntry[] {
const globalState = globalThis as typeof globalThis & {
[REGISTRY_STATE]?: { registry?: { channels?: RegisteredChannelPluginEntry[] | null } | null };
};
return globalState[REGISTRY_STATE]?.registry?.channels ?? [];
return getActivePluginRegistry()?.channels ?? [];
}
function findRegisteredChannelPluginEntry(