refactor: centralize outbound policy + target schema

This commit is contained in:
Peter Steinberger
2026-01-17 03:33:32 +00:00
parent 3af391eec7
commit 09bed2ccde
10 changed files with 310 additions and 180 deletions

View File

@@ -0,0 +1,24 @@
import type { ChannelId } from "../../channels/plugins/types.js";
export type ChannelMessageAdapter = {
supportsEmbeds: boolean;
buildCrossContextEmbeds?: (originLabel: string) => unknown[];
};
const DEFAULT_ADAPTER: ChannelMessageAdapter = {
supportsEmbeds: false,
};
const DISCORD_ADAPTER: ChannelMessageAdapter = {
supportsEmbeds: true,
buildCrossContextEmbeds: (originLabel: string) => [
{
description: `From ${originLabel}`,
},
],
};
export function getChannelMessageAdapter(channel: ChannelId): ChannelMessageAdapter {
if (channel === "discord") return DISCORD_ADAPTER;
return DEFAULT_ADAPTER;
}