feat: send text to named sessions with draft protection and listener isolation
- chat send and listener-smoke accept --session; defaults remain File Transfer Assistant. - Reject existing drafts, reacquire the send control after input changes, and require a fresh message fingerprint for confirmation without retrying failed sends. - Test-NamedTextSend sends the same text twice and verifies distinct confirmed fingerprints; Test-NamedListeners -SendMarkers verifies per-window own events exactly once with zero cross-session events. Note export now requires a unique fresh owned note window and keeps repeated paragraphs. 97 Core tests pass; real-machine validated.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
namespace WxAgent.Core;
|
||||
|
||||
public sealed record WechatNoteWindowCandidate(long Handle, int ProcessId, string Title, bool IsVisible, bool HasChatSurface);
|
||||
|
||||
public static class WechatNoteWindow
|
||||
{
|
||||
public static long? FindOpened(IEnumerable<WechatNoteWindowCandidate> windows, int processId, IReadOnlySet<long> previousHandles)
|
||||
{
|
||||
var candidates = windows.Where(window => window.Handle != 0 && window.ProcessId == processId
|
||||
&& !previousHandles.Contains(window.Handle) && window.IsVisible && !window.HasChatSurface
|
||||
&& window.Title.Contains("笔记", StringComparison.Ordinal)).ToArray();
|
||||
if (candidates.Length > 1)
|
||||
throw new WxAgentException(WxAgentErrorCode.UiStructureChanged, "Multiple new note windows appeared; refusing ambiguous content.");
|
||||
return candidates.Length == 1 ? candidates[0].Handle : null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user