Lets the bot quote-reply to a specific message via an optional replyTo
on sendSingleMessage, and reworks history serialization so the LLM can
address messages and stop confusing quoted content with the quoter.
- Serialize each history line with a short [n] id; consecutive messages
from the same sender continue under "[n] └". A per-subject ReplyIndex
maps [n] -> MessageRecord, kept alive with the context cache so ids
stay continuous across cached turns.
- Replace inlined quote text with a reference: "↩[k]" when the quoted
message is in-window, otherwise "↩(author:"snippet…")". This removes
the ambiguity where A quoting B looked like A's own speech.
- Collapse forwarded messages to "[转发消息·N条:title]".
- sendSingleMessage accepts replyTo (the [n]); it resolves the record via
MessageRecord.toMessageSource() and prepends a QuoteReply, falling back
to a plain send with a note if the source is gone. ids may be null, so
numbering still happens but such records can't be reply targets.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>