Feature: Add window-relative remote_mouse coords and PTY pipes in terminal_exec

New Windows clients append an optional 20-byte WINDOWINFO_MCP_DESKTOP block
(virtual desktop rect, magic 'VDCP') after the window list, so the server can
map window-relative coordinates into the capture frame. remote_mouse accepts
an optional window_hwnd; x/y and drag x2/y2 are then normalized against the
intersection of the window and the virtual desktop, which is exactly the
source rect of get_screenshot mode=window. The target window must be foreground
by default, and window_hwnd/expect_hwnd must agree when both are given.
structuredContent gains coordinateWindow and resolved (frame coords plus the
basis rect), so callers can verify the mapping.

terminal_exec now allows pipes, && and || in PTY sessions (ConPTY on Windows,
POSIX PTY on Linux) because the sentinel runs on its own line; legacy non-PTY
sessions still reject & and |. A read-only PeekTermSession lets the server
reject unsupported syntax before BeginTermCommand. POSIX still rejects bare
background & (&&, &>, 2>&1 stay allowed).

Docs: Mcp_Design.md sections 12.1/20.2/22 and Mcp_Terminal_Design.md 4.4/4.6
are synchronized with the protocol, the new validation order, and the basis
rect semantics.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-10 18:03:25 +01:00
1 parent 235a8a622c
commit 5501889d33
10 files changed
+383 -60

No files matched your search

+15
View File
@@ -768,6 +768,21 @@ struct WINDOWINFO_MCP {
static_assert(sizeof(WINDOWINFO_MCP) == 1056, "WINDOWINFO_MCP must be exactly 1056 bytes");
// COMMAND_MCP_WINDOW_INFO 响应尾块(可选):虚拟桌面矩形(虚拟桌面坐标)。
// 新客户端在窗口记录之后追加,服务端按包长判定是否存在;老服务端只读 count 条记录、
// 自动忽略尾部。remote_mouse 的 window_hwnd 相对坐标靠它把窗口矩形换算成发送帧归一化坐标。
#define WINDOWINFO_DESKTOP_MAGIC 0x56444350u // 'VDCP'
#pragma pack(push, 1)
struct WINDOWINFO_MCP_DESKTOP {
uint32_t magic;
int32_t left;
int32_t top;
int32_t width;
int32_t height;
};
#pragma pack(pop)
static_assert(sizeof(WINDOWINFO_MCP_DESKTOP) == 20, "WINDOWINFO_MCP_DESKTOP must be exactly 20 bytes");
// 远程交谈
enum ChatManager {
COMMAND_NEXT_CHAT,