Files
rogee ad22a89185 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.
2026-09-06 14:35:55 +08:00

24 lines
1.2 KiB
PowerShell

param(
[Parameter(Mandatory=$true)][string]$Executable,
[Parameter(Mandatory=$true)][string]$OutputDirectory,
[string]$Session='消息测试专用群组'
)
$ErrorActionPreference='Stop'
$exe=(Resolve-Path $Executable).Path
if(Test-Path $OutputDirectory){throw 'Use a fresh evidence directory.'}
$directory=(New-Item -ItemType Directory $OutputDirectory).FullName
$marker='wx-agent-repeat-'+[Guid]::NewGuid().ToString('N')
$results=@()
for($i=0;$i -lt 2;$i++){
$result=(& $exe chat send --session $Session --text $marker --timeout 30 | Out-String) | ConvertFrom-Json
$exitCode=$LASTEXITCODE
$results+=@{ExitCode=$exitCode;Fingerprint=$result.Fingerprint;Error=$result.error;Message=$result.message}
if($exitCode -ne 0){break} # Never retry a failed send.
}
$success=($results.Count -eq 2 -and $results[0].ExitCode -eq 0 -and $results[1].ExitCode -eq 0 -and
$null -ne $results[0].Fingerprint -and $null -ne $results[1].Fingerprint -and
$results[0].Fingerprint -ne $results[1].Fingerprint)
@{Success=$success;Results=$results;AttemptedSends=$results.Count;BinarySha256=(Get-FileHash $exe -Algorithm SHA256).Hash} |
ConvertTo-Json -Depth 5 | Set-Content "$directory\summary.json" -Encoding UTF8
if(!$success){exit 1}