import type { ChannelConnectorDescriptor, ChannelStatus } from '@/types'; const CONNECTOR_CARD_KINDS = ['weixin', 'feishu', 'terminal']; export function connectorChannelForKind(kind: string, channels: ChannelStatus[]): ChannelStatus | undefined { const matches = channels.filter((channel) => channel.kind === kind); return ( matches.find((channel) => channel.state === 'running') || matches.find((channel) => channel.enabled && channel.state !== 'disabled' && channel.state !== 'stopped') ); } export function visibleConnectorCards(connectors: ChannelConnectorDescriptor[]): ChannelConnectorDescriptor[] { const byKind = new Map(); connectors.forEach((connector) => { if (CONNECTOR_CARD_KINDS.includes(connector.kind) && !byKind.has(connector.kind)) { byKind.set(connector.kind, connector); } }); return CONNECTOR_CARD_KINDS.map((kind) => byKind.get(kind) || { kind }); } export function runtimeBridgeEnabledForPath(_pathname: string): boolean { return true; }