mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
* Add dismiss option for disconnected terminal dialog * Refine terminal connection dialog visuals * Polish terminal connection dialog layout * fix: PowerShell AI exec markers visible and results not captured PowerShell wrapped command was sent as 8 separate lines, causing: 1. Markers visible — PS echoes each line with prompt prefix, ^-anchored filter regexes couldn't match 2. Line-by-line input — 8 \r\n = 8 Enter keypresses displayed sequentially 3. AI couldn't get results — end marker Write-Output format mismatch between generation (format string) and filter (single-quote regex) Combine into 2 lines (like posix) and use inline regex matching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use whole-line deletion to strip PowerShell __NCMCP_ marker echoes PowerShell echoes each input line with the PS prompt prefix (e.g. `PS C:\...> Write-Output '__NCMCP_..._S'; $env:PAGER=...`), so the previous per-fragment substitutions left residual content visible in the terminal after partial replacement. Replace all PowerShell-specific fragment regexes with a single whole-line regex that deletes any line containing __NCMCP_, regardless of leading PS prompt or shell variant. * fix: apply whole-line deletion to stripMarkers in ptyExec for Catty Agent Same root cause as preload.cjs: PowerShell echoes the entire wrapper line with PS prompt prefix (e.g. `PS C:\...> $__NCMCP_rc = if ...`). The previous regex only stripped from __NCMCP_ onwards, leaving the PS prompt and partial variable name visible in the AI's stdout capture. Use the same ^[^\r\n]*__NCMCP_[^\r\n]* whole-line pattern so Catty Agent also receives clean output without PS wrapper residue. * fix: use compact if/elseif/else syntax in PowerShell wrapper to prevent >> continuation prompt PowerShell interactive PTY parses `if (cond) { } elseif ...` with spaces around braces as a multi-line block, causing >> continuation prompt after line 2 is submitted. Switch to compact no-space form `if(cond){...}elseif(...){...}else{...}` which PowerShell evaluates as a complete expression on a single line. Also remove the $global:LASTEXITCODE=0 reset on line 1 since it clobbers $? before line 2 runs, making the -not $? fallback unreliable. * fix: proper line-level buffering for PowerShell marker filter + remove >> trigger preload.cjs: - Replace chunk-based filterMcpMarkers with per-session filterMcpChunk that buffers trailing fragments across PTY data events. Previously, if __NCMCP_ was split across two IPC chunks (e.g. chunk1 ends with '__N', chunk2 starts with 'CMCP_...'), neither chunk matched the guard and both leaked to xterm.js. Now the tail of each chunk is held and prepended to the next chunk before line-level filtering. - Clean up per-session buffers on netcatty:exit to prevent memory leaks. ptyExec.cjs: - Replace if($LASTEXITCODE){...}elseif...else{...} with a brace-free arithmetic expression: [int](-not $?) -bor [Math]::Abs([int]$LASTEXITCODE) This eliminates the >> PowerShell continuation prompt that was triggered by the interactive parser treating the if-block as an incomplete statement. * fix: simplify PowerShell Line 2 to bare Write-Output to eliminate >> prompt Any expression with operators, method calls, or variable assignment can trigger PowerShell interactive continuation mode (>> prompt). Use the absolute minimum: just Write-Output with $LASTEXITCODE interpolated directly. This cannot trigger >>. Null $LASTEXITCODE is handled gracefully by the execViaPty receiver (defaults to exit code 0). --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>