Discord: allow disabling thread starter context

This commit is contained in:
Josh Palmer
2026-02-04 13:25:28 -08:00
parent 5d82c82313
commit bebf323775
5 changed files with 133 additions and 15 deletions

View File

@@ -209,22 +209,25 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
let threadLabel: string | undefined;
let parentSessionKey: string | undefined;
if (threadChannel) {
const starter = await resolveDiscordThreadStarter({
channel: threadChannel,
client,
parentId: threadParentId,
parentType: threadParentType,
resolveTimestampMs,
});
if (starter?.text) {
const starterEnvelope = formatThreadStarterEnvelope({
channel: "Discord",
author: starter.author,
timestamp: starter.timestamp,
body: starter.text,
envelope: envelopeOptions,
const includeThreadStarter = channelConfig?.includeThreadStarter !== false;
if (includeThreadStarter) {
const starter = await resolveDiscordThreadStarter({
channel: threadChannel,
client,
parentId: threadParentId,
parentType: threadParentType,
resolveTimestampMs,
});
threadStarterBody = starterEnvelope;
if (starter?.text) {
const starterEnvelope = formatThreadStarterEnvelope({
channel: "Discord",
author: starter.author,
timestamp: starter.timestamp,
body: starter.text,
envelope: envelopeOptions,
});
threadStarterBody = starterEnvelope;
}
}
const parentName = threadParentName ?? "parent";
threadLabel = threadName