Feature: Add window/region capture targets to remote_open
Pass the target HWND through the COMMAND_SCREEN_SPY token and send COMMAND_SCREEN_ROI after session start, so MCP remote control can stream just the target window or region instead of the scaled virtual desktop. The session records the target kind, remote_mouse refuses a redundant window_hwnd basis, and the cached resolution is refreshed per action so resized windows keep mapping correctly. Cold starts now clear the stale resolution cache used by the region handshake.
This commit is contained in:
1 parent
5501889d33
commit
cdd9c56b3d
7 files changed
+445
-39
No files matched your search
+64
-4
@@ -2324,7 +2324,7 @@
|
||||
},
|
||||
{
|
||||
"name": "remote_open",
|
||||
"description": "在指定在线 Windows 或 Linux 主机上建立远程控制会话(隐藏屏幕子连接)并返回 session_id 与抓屏帧尺寸(screen_w/screen_h,可能是等比缩放后的整屏/整虚拟桌面像素)。后续 remote_mouse/remote_keyboard 用归一化坐标(0..1)注入输入,用毕须 remote_close。Linux 需要 X11/Xorg(或 XWayland)桌面,纯 Wayland 会话无法抓屏/注入;Windows 多显示器需要新版客户端(整虚拟桌面抓屏),老客户端会被拒绝(Linux 截屏/注入天然使用整个 X root,不受此限)。",
|
||||
"description": "在指定在线 Windows 或 Linux 主机上建立远程控制会话(隐藏屏幕子连接)并返回 session_id、抓屏帧尺寸(screen_w/screen_h)与目标(target)。默认推整屏/整虚拟桌面(可能等比缩放);可用 window_hwnd 只推一个窗口,或用 region 只推一个矩形区域,带宽、延迟和点击精度都更好,此时归一化坐标 0..1 相对该目标帧。后续 remote_mouse/remote_keyboard 用归一化坐标(0..1)注入输入,用毕须 remote_close。Linux 需要 X11/Xorg(或 XWayland)桌面,纯 Wayland 会话无法抓屏/注入;window_hwnd/region 仅支持声明 CLIENT_CAP_WINDOW_INFO 的新 Windows 客户端。Windows 多显示器下整屏目标需要新版客户端(整虚拟桌面抓屏),老客户端会被拒绝;window 目标不依赖虚拟桌面抓屏,不受此限。",
|
||||
"gate": "remote_control",
|
||||
"write": true,
|
||||
"platforms": [
|
||||
@@ -2338,9 +2338,42 @@
|
||||
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
|
||||
"type": "string"
|
||||
},
|
||||
"region": {
|
||||
"description": "可选:只推该矩形区域(虚拟桌面物理像素,超出部分自动裁剪;裁剪后为空返回 -32009)。与 window_hwnd 互斥。region 内的归一化坐标 0..1 相对该矩形。要求新 Windows 客户端(窗口信息响应带虚拟桌面矩形),否则返回 -32005。",
|
||||
"properties": {
|
||||
"height": {
|
||||
"description": "矩形高度(像素,1~8192)",
|
||||
"type": "integer"
|
||||
},
|
||||
"width": {
|
||||
"description": "矩形宽度(像素,1~8192)",
|
||||
"type": "integer"
|
||||
},
|
||||
"x": {
|
||||
"description": "矩形左上角 X(虚拟桌面绝对坐标,可为负;省略按 0)",
|
||||
"type": "integer"
|
||||
},
|
||||
"y": {
|
||||
"description": "矩形左上角 Y(虚拟桌面绝对坐标,可为负;省略按 0)",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"width",
|
||||
"height"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"timeout_ms": {
|
||||
"description": "等待屏幕子连接建立 + 分辨率到达的超时毫秒数(可选,默认 20000,上限 600000)",
|
||||
"type": "integer"
|
||||
},
|
||||
"window_hwnd": {
|
||||
"description": "可选:只推该窗口(DWM 可见边框,含标题栏),帧尺寸与归一化坐标都相对该窗口,带宽和点击精度都优于整屏。取 host_list_windows / get_foreground_window 返回的 hwnd(整数或 0x 前缀字符串);最小化窗口会被拒绝(-32009)。与 region 互斥。要求客户端能力位 CLIENT_CAP_WINDOW_INFO(新 Windows 客户端),老客户端返回 -32005。",
|
||||
"type": [
|
||||
"integer",
|
||||
"string"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -2350,21 +2383,48 @@
|
||||
},
|
||||
"outputSchema": {
|
||||
"properties": {
|
||||
"region": {
|
||||
"description": "region 目标时实际生效的矩形(虚拟桌面坐标,已裁剪;width/height 为物理像素)",
|
||||
"properties": {
|
||||
"height": {
|
||||
"type": "integer"
|
||||
},
|
||||
"width": {
|
||||
"type": "integer"
|
||||
},
|
||||
"x": {
|
||||
"type": "integer"
|
||||
},
|
||||
"y": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"screen_h": {
|
||||
"description": "抓屏帧高度(发送帧像素)",
|
||||
"type": "integer"
|
||||
},
|
||||
"screen_w": {
|
||||
"description": "抓屏帧宽度(发送帧像素:整屏或整虚拟桌面,可能已等比缩放),用于把归一化坐标 0..1 映射为像素",
|
||||
"description": "抓屏帧宽度(发送帧像素:整屏/整虚拟桌面/目标窗口/区域,可能已等比缩放),用于把归一化坐标 0..1 映射为像素",
|
||||
"type": "integer"
|
||||
},
|
||||
"session_id": {
|
||||
"description": "控制会话 token,后续 remote_mouse / remote_keyboard / remote_close 用",
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"description": "抓屏帧目标:screen=整屏/整虚拟桌面;window=目标窗口;region=指定区域",
|
||||
"type": "string"
|
||||
},
|
||||
"window_hwnd": {
|
||||
"description": "window 目标时的窗口句柄;其他目标不返回",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"session_id",
|
||||
"target",
|
||||
"screen_w",
|
||||
"screen_h"
|
||||
],
|
||||
@@ -2496,7 +2556,7 @@
|
||||
},
|
||||
{
|
||||
"name": "remote_mouse",
|
||||
"description": "向已建立的远程控制会话注入鼠标事件。action 可选 move / down / up / click / right_click / middle_click / drag / scroll;坐标 x/y(及 drag 的 x2/y2)为归一化 0..1 浮点,默认相对整屏/整虚拟桌面。给 window_hwnd 时改为相对「该窗口与虚拟桌面的交集」(窗口完整可见时即窗口本身;0=左/上边缘,1=右/下边缘),可直接照 get_screenshot mode=window 的图量比例:服务端用该交集与虚拟桌面矩形换算成屏幕坐标,并默认要求该窗口在前台(require_foreground=false 可显式关闭;与 expect_hwnd 同时给出时须指向同一窗口)。button 可选 left/middle/right(默认 left);click 的 clicks 可选 1/2/3(默认 1);scroll 的 delta 正=向下滚、负=向上滚。可选 expect_hwnd / require_foreground / report_foreground 与 remote_keyboard 同义(新 Windows 客户端),可用它确认点击确实落在目标窗口。",
|
||||
"description": "向已建立的远程控制会话注入鼠标事件。action 可选 move / down / up / click / right_click / middle_click / drag / scroll;坐标 x/y(及 drag 的 x2/y2)为归一化 0..1 浮点,默认相对整屏/整虚拟桌面(remote_open 用 window_hwnd/region 时相对该目标帧)。给 window_hwnd 时改为相对「该窗口与虚拟桌面的交集」(窗口完整可见时即窗口本身;0=左/上边缘,1=右/下边缘),可直接照 get_screenshot mode=window 的图量比例:服务端用该交集与虚拟桌面矩形换算成屏幕坐标,并默认要求该窗口在前台(require_foreground=false 可显式关闭;与 expect_hwnd 同时给出时须指向同一窗口);会话本身已锁定窗口/区域时不要再传 window_hwnd。button 可选 left/middle/right(默认 left);click 的 clicks 可选 1/2/3(默认 1);scroll 的 delta 正=向下滚、负=向上滚。可选 expect_hwnd / require_foreground / report_foreground 与 remote_keyboard 同义(新 Windows 客户端),可用它确认点击确实落在目标窗口。",
|
||||
"gate": "remote_control",
|
||||
"write": true,
|
||||
"platforms": [
|
||||
@@ -2581,7 +2641,7 @@
|
||||
"integer",
|
||||
"string"
|
||||
],
|
||||
"description": "可选:以该窗口为坐标基准(整数或 0x 前缀字符串)。给定后 x/y(及 drag 的 x2/y2)变为相对「窗口与虚拟桌面的交集」的归一化坐标(窗口完整可见时即窗口本身),服务端用该交集与虚拟桌面矩形换算成屏幕坐标,可直接用 get_screenshot mode=window 图上的比例点。默认要求该窗口是前台(可用 require_foreground=false 显式关闭;与 expect_hwnd 同时给出时须指向同一窗口);窗口不存在/最小化/完全移出虚拟桌面时报错。仅新 Windows 客户端支持(窗口信息 RPC 需带虚拟桌面矩形),否则 -32005。"
|
||||
"description": "可选:以该窗口为坐标基准(整数或 0x 前缀字符串)。给定后 x/y(及 drag 的 x2/y2)变为相对「窗口与虚拟桌面的交集」的归一化坐标(窗口完整可见时即窗口本身),服务端用该交集与虚拟桌面矩形换算成屏幕坐标,可直接用 get_screenshot mode=window 图上的比例点。默认要求该窗口是前台(可用 require_foreground=false 显式关闭;与 expect_hwnd 同时给出时须指向同一窗口);窗口不存在/最小化/完全移出虚拟桌面时报错。仅新 Windows 客户端支持(窗口信息 RPC 需带虚拟桌面矩形),否则 -32005。会话本身已只推窗口/区域(remote_open 的 window_hwnd/region)时不要再传:坐标本来就相对目标帧。"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
Reference in new issue
Block a user