Files
hermes-agent/tui_gateway
teknium1 27e30a28d5 fix(bot-mode): a remote default is addressable by its title slug and signs relayed DMs reply-safely
Every gateway's `default` profile is `@hermes`, so a remote default titled
"CoS Bot" was unreachable by any bare form: `resolve_remote_target` matched
handle/profile only, the prompt roster offered it as `@hermes` (which local
resolution routes to THIS gateway's default), and the DM it sent arrived
stamped `(@hermes)` so a reply hit the recipient's own default.

- `tools/bot_relay.py`: `_target_aliases` adds the Bot Mode title's mention
  slugs; `resolve_remote_target` accepts them (exact handle/profile keeps
  precedence over a colliding title); `remote_target_forms` picks the shortest
  form no LOCAL profile and no other remote row answers to — bare handle,
  title slug, then `handle@connection` — independent of roster order;
  `qualify_sender_stamp` rewrites a relayed `Message from 🤖 … (@handle):`
  to that form.
- `tools/bot_mode_probe.py::local_taken_forms` feeds the local handles and
  friendly-name slugs into the roster paragraph; `bot_mode_dm` lists ambiguous
  candidates with the same forms.
- `tui_gateway/methods_bot_relay.py::bot_relay.deliver` re-stamps the sender
  before the transport branch (the recipient knows `from_connection`; the
  sender does not know its own Desktop id).

Slim redo of #103767's Python half (@fangliquanflq): that PR always
qualified every remote form with its connection id and reworked the Desktop
mention Map; this keeps bare forms where they are unambiguous and leaves the
Desktop picker untouched.

Part of #103731
Salvages #103767
Co-authored-by: fangliquanflq <fangliquanflq@users.noreply.github.com>
2026-09-20 10:31:16 -07:00
..
…
…
…
…