Files
hermes-agent/plugins
kshitijk4poor 8503ee4459 refactor(send): route WhatsApp mentions through the existing standalone chunker
Follow-up to the salvaged #92440 commit, shape-gate cleanup only; behaviour is unchanged
(one mention-bearing payload per logical send, captioned media keeps its caption).

- Fold `_send_whatsapp_with_mentions` into `_send_plugin_standalone` (it was a line-for-line
  copy of the caption split + `_send_chunks` loop); `mentions` is attached to the first
  payload only via a one-shot kwarg dict.
- Drop the `inspect.signature(sender)` probe: the only registered WhatsApp standalone sender
  is the in-tree `_standalone_send`, which gains `mentions` in the same change; a foreign
  sender already surfaces as a TypeError through `_handle_send`'s error path.
- Collapse `_normalize_outbound_mentions` to dedupe-only; its input is argparse `list[str]`
  already validated by the CLI.
- Revert the `\d` -> `[0-9]` edit to `_BARE_PHONE_RE` / `to_whatsapp_jid`: unrelated to the
  feature (`normalize_whatsapp_mention_jid` already rejects non-ASCII via `isascii()`) and it
  changed output for nine other `to_whatsapp_jid` callers.
- Split the single 137-line test into a `whatsapp_bridge` fixture + two invariants
  (rejections never reach the bridge; mentions ride the first payload only, stale bridge
  fails closed); drop the fabricated legacy-sender branch that only existed to cover the
  deleted probe. Mutation check: removing the first-payload gate turns the new test red.
2026-09-19 00:24:50 +05:30
..