`ChannelOutboundContext.forceDocument` and the agent `message`-tool
`asDocument` alias were documented as cross-channel knobs to "send
image/GIF as document to avoid channel compression", but on the
WhatsApp side the flag was silently dropped between the outbound
context and the Baileys payload selector. Telegram honored the same
flag through its own outbound, so any agent that asked for an
uncompressed image hand-off worked on Telegram and got a compressed
JPEG on WhatsApp instead.
This change wires the flag through the existing layers without
introducing a new contract:
* extensions/whatsapp/src/outbound-base.ts: destructure forceDocument
from ChannelOutboundContext.sendMedia and forward it to send().
* extensions/whatsapp/src/send.ts: sendMessageWhatsApp options gain
forceDocument; documentFileName is set regardless of media.kind
when the flag is true; sendOptions exposes asDocument so the
inbound send-api layer can pick the document payload shape.
* extensions/whatsapp/src/inbound/types.ts: ActiveWebSendOptions
gains asDocument so the payload selector can short-circuit on
the flag instead of inferring intent from fileName alone.
* extensions/whatsapp/src/inbound/send-api.ts: payload-shape
selector guards `asDocument === true` ahead of MIME branches and
builds the document content with caller-supplied filename and
mimetype, falling back to "file" only when nothing is supplied.
* extensions/whatsapp/src/outbound-media-contract.ts: preserve
caller-supplied fileName on canonical media for non-document
kinds. Without this, an image+forceDocument hand-off lost the
filename inside normalizeWhatsAppLoadedMedia before send.ts
could promote it.
* src/channels/plugins/outbound.types.ts and
src/agents/tools/message-tool.ts: drop the now-misleading
"Telegram only" qualifier from the public JSDoc and the agent
schema descriptions for forceDocument and asDocument so the
surface stops lying about WhatsApp support.
Tests: extensions/whatsapp/src/send.test.ts gains
"forces document branch when forceDocument is true with image media"
and "falls back to a default filename when forceDocument media has
no fileName"; extensions/whatsapp/src/inbound/send-api.test.ts gains
"sends as document when sendOptions.asDocument is true regardless of
MIME". Existing 48 cases in those two files unchanged.
Changelog: single-line Channels/whatsapp Fixes entry under the
Unreleased section.