Fix NATS silently dropping messages whose routing key has an empty token
bot.py joins shlex tokens with '.' and keeps any punctuation the body had,
so a message ending in a full stop ("<url> ... ich will das.") yields a
routing key ending in '.' - an empty trailing token. AMQP's topic exchange
routed that to '#' fine, but nats-server accepts the PUB without any error
while "classifier.>" never matches it, so the message vanished with nothing
logged on either side. Leading dots and a typed "..." (its own token) fail
the same way.
Collapse runs of dots and trim the ends in _sanitize_subject(), with a
fallback token for a key that reduces to nothing. Empty tokens carry no
information, and the binding keys plugins use still match the trimmed form.
Symptom that surfaced it: a posted YouTube URL followed by a sentence went
unanswered - and with URLResolver deliberately skipping youtube URLs, no
fallback title appeared either.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>