fix(extensions): synthesize mediaLocalRoots propagation across sendMedia adapters

Restore deterministic mediaLocalRoots propagation through extension sendMedia adapters and add coverage for local/remote media handling in Google Chat.

Synthesis of #33581, #33545, #33540, #33536, #33528.

Co-authored-by: bmendonca3 <bmendonca3@users.noreply.github.com>
This commit is contained in:
Tak Hoffman
2026-03-03 21:30:41 -06:00
committed by GitHub
parent 9889c6da53
commit 87e6ce7c3a
11 changed files with 342 additions and 9 deletions

View File

@@ -108,6 +108,33 @@ describe("slackPlugin outbound", () => {
);
expect(result).toEqual({ channel: "slack", messageId: "m-media" });
});
it("forwards mediaLocalRoots for sendMedia", async () => {
const sendSlack = vi.fn().mockResolvedValue({ messageId: "m-media-local" });
const sendMedia = slackPlugin.outbound?.sendMedia;
expect(sendMedia).toBeDefined();
const mediaLocalRoots = ["/tmp/workspace"];
const result = await sendMedia!({
cfg,
to: "C999",
text: "caption",
mediaUrl: "/tmp/workspace/image.png",
mediaLocalRoots,
accountId: "default",
deps: { sendSlack },
});
expect(sendSlack).toHaveBeenCalledWith(
"C999",
"caption",
expect.objectContaining({
mediaUrl: "/tmp/workspace/image.png",
mediaLocalRoots,
}),
);
expect(result).toEqual({ channel: "slack", messageId: "m-media-local" });
});
});
describe("slackPlugin config", () => {

View File

@@ -371,7 +371,17 @@ export const slackPlugin: ChannelPlugin<ResolvedSlackAccount> = {
});
return { channel: "slack", ...result };
},
sendMedia: async ({ to, text, mediaUrl, accountId, deps, replyToId, threadId, cfg }) => {
sendMedia: async ({
to,
text,
mediaUrl,
mediaLocalRoots,
accountId,
deps,
replyToId,
threadId,
cfg,
}) => {
const { send, threadTsValue, tokenOverride } = resolveSlackSendContext({
cfg,
accountId: accountId ?? undefined,
@@ -381,6 +391,7 @@ export const slackPlugin: ChannelPlugin<ResolvedSlackAccount> = {
});
const result = await send(to, text, {
mediaUrl,
mediaLocalRoots,
threadTs: threadTsValue != null ? String(threadTsValue) : undefined,
accountId: accountId ?? undefined,
...(tokenOverride ? { token: tokenOverride } : {}),