feat: add bounded session and history navigation

Add session scrolling, latest-message navigation and fingerprint location under the shared UI gate; reuse navigation in history reads and provide read-only smoke. Navigation index snapshot passed 124 tests and a full build. Windows 4.1.13.63 read-only validation passed 10/10, including two-scroll history location; no sends. Record scope limits, including next-unread navigation not yet implemented.
This commit is contained in:
2026-09-06 20:09:00 +08:00
parent c49f6a10b2
commit e5548bd471
13 changed files with 563 additions and 24 deletions
+27
View File
@@ -0,0 +1,27 @@
namespace WxAgent.Core;
public enum WechatScrollDirection { Up, Down }
public sealed record WechatSessionScrollResult(
int Scrolls, bool ViewportChanged, IReadOnlyList<WechatSessionSnapshot> Sessions);
public sealed record WechatMessagePosition(ChatMessageSnapshot Message, int Scrolls);
public static class WechatNavigationRules
{
public static void ValidateScrollLimit(int pages)
{
if (pages is < 1 or > 100)
throw new WxAgentException(WxAgentErrorCode.InvalidArgument, "Scroll limit must be between 1 and 100.");
}
public static ChatMessageSnapshot? FindMessage(IReadOnlyList<ChatMessageSnapshot> messages, string fingerprint)
{
if (fingerprint.Length != 64 || !fingerprint.All(char.IsAsciiHexDigit))
throw new WxAgentException(WxAgentErrorCode.InvalidArgument, "A 64-character visible-message fingerprint is required.");
var matches = messages.Where(message => string.Equals(message.Fingerprint, fingerprint, StringComparison.OrdinalIgnoreCase)).Take(2).ToArray();
if (matches.Length > 1)
throw new WxAgentException(WxAgentErrorCode.InvalidOperationState, "More than one visible message matches the fingerprint.");
return matches.SingleOrDefault();
}
}