fix(discord): honor agent media roots in replies

This commit is contained in:
Shadow
2026-03-03 11:10:26 -06:00
parent 548b15d8e0
commit 0eef7a367d
5 changed files with 52 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ import type { DiscordAccountConfig } from "../../config/types.discord.js";
import { logVerbose } from "../../globals.js";
import { enqueueSystemEvent } from "../../infra/system-events.js";
import { logDebug, logError } from "../../logger.js";
import { getAgentScopedMediaLocalRoots } from "../../media/local-roots.js";
import { buildPairingReply } from "../../pairing/pairing-messages.js";
import { upsertChannelPairingRequest } from "../../pairing/pairing-store.js";
import { resolveAgentRoute } from "../../routing/resolve-route.js";
@@ -976,6 +977,7 @@ async function dispatchDiscordComponentEvent(params: {
fallbackLimit: 2000,
});
const token = ctx.token ?? "";
const mediaLocalRoots = getAgentScopedMediaLocalRoots(ctx.cfg, agentId);
const replyToMode =
ctx.discordConfig?.replyToMode ?? ctx.cfg.channels?.discord?.replyToMode ?? "off";
const replyReference = createReplyReferencePlanner({
@@ -1005,6 +1007,7 @@ async function dispatchDiscordComponentEvent(params: {
maxLinesPerMessage: ctx.discordConfig?.maxLinesPerMessage,
tableMode,
chunkMode: resolveChunkMode(ctx.cfg, "discord", accountId),
mediaLocalRoots,
});
replyReference.markSent();
},