Fixes#5472
When a skill running inside a Discord/Telegram/etc. session calls
send_message(target='discord'), the message is delivered to the
platform's home channel — not to the channel/thread where the
conversation is happening. This makes multi-message batch delivery
(e.g. a skill fetching 53 links in 5-link chunks) impossible.
Add a 'current' / '__session__' / 'session' sentinel to the target
resolution in _handle_send(). When specified, the tool reads
HERMES_SESSION_CHAT_ID and HERMES_SESSION_THREAD_ID via
gateway.session_context.get_session_env() (concurrency-safe
ContextVars with env var fallback) and routes the message there.
The resolver also rejects cross-platform sentinels (e.g. 'discord:current'
from a Telegram session) with a clear error instead of silently
falling through to the home channel — the LLM needs deterministic
behavior to rely on this primitive.
Tests
-----
Six new test cases under TestSendMessageCurrentSessionTarget covering:
- Session chat_id resolution with success note
- Thread_id preservation and mirror propagation
- 'current' / 'session' / '__session__' / case-insensitive aliases
- Missing HERMES_SESSION_CHAT_ID returns explicit error, no send attempt
- Platform mismatch returns clear error, no send attempt
- Sentinel path never calls config.get_home_channel (short-circuits the fallback)
All 61 tests in tests/tools/test_send_message_tool.py pass; the broader
80-test send_message suite is also green.
Schema
------
Updated SEND_MESSAGE_SCHEMA.target.description so the LLM discovers
the new 'platform:current' form and knows its constraint (only valid
from a messaging session).