Files
clawdbot/src/infra/channels-status-issues.ts
Peter Steinberger c379191f80 chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
2026-01-14 15:02:19 +00:00

17 lines
704 B
TypeScript

import { listChannelPlugins } from "../channels/plugins/index.js";
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "../channels/plugins/types.js";
export function collectChannelStatusIssues(payload: Record<string, unknown>): ChannelStatusIssue[] {
const issues: ChannelStatusIssue[] = [];
const accountsByChannel = payload.channelAccounts as Record<string, unknown> | undefined;
for (const plugin of listChannelPlugins()) {
const collect = plugin.status?.collectStatusIssues;
if (!collect) continue;
const raw = accountsByChannel?.[plugin.id];
if (!Array.isArray(raw)) continue;
issues.push(...collect(raw as ChannelAccountSnapshot[]));
}
return issues;
}