Feature: Add remote_block_input to MCP remote control
A GUI automation run is interrupted the moment a person at the host touches the mouse, and locking the host's keyboard and mouse is the standard answer. The client already implements COMMAND_SCREEN_BLOCK_INPUT and the MFC screen window already sends it, so the tool needs no client change: it puts the same two-byte packet [COMMAND_SCREEN_BLOCK_INPUT][0|1] on the hidden screen sub-connection that remote_open established. The gate is remote_open's own - McpRemoteControl=1 and McpReadonly=0 - because the ability to lock someone out deserves exactly the same door as the ability to drive their desktop, and Linux and Android clients are refused with -32005: they have no branch for this packet at all and would silently ignore it. Locking a host out is only acceptable if every way back in is closed, so the session now carries its own lock state and three paths release it. block=false releases it directly. block=true always carries a deadline (max_block_ms, default 300000, clamped to 1000..3600000) and a watchdog thread started with the MCP server sweeps every 500ms for expired locks, sends the release and records it; the next remote_block_input reports it as auto_unblocked so the model learns that its lock lapsed instead of assuming it is still held. remote_close and the idle reclaim both send block=false before they tear the sub-connection down, because once that connection is gone the server has no channel left and a live client process stays blocked - all three release paths write an audit line, since none of them is something a person can see. The send happens outside the MCP lock, and the watchdog takes the session's busy flag while it releases, so it cannot interleave with an injection or race a close; a failed send keeps the lock marked and retries five seconds later rather than hammering a dead connection every tick, and a session that dies under the watchdog is erased the same way an injection would erase it. Verified against a real Windows client over MCP on a Debug x64 build: block then unblock, block with a 1.5-2s deadline left to expire and reported back as auto_unblocked with the watchdog audit entry at the expected second, block with a ten-minute deadline then remote_close with "(input lock forced off)" in the audit, and the five refusals (missing block, non-boolean block, max_block_ms out of range, unknown session, offline host). The smoke test gained [4d] for those refusals; 54 checks pass. Two limits are worth stating plainly. BlockInput only works when the calling process is elevated (or UIAccess), the client ignores the API's return value, so on an ordinary client the lock silently does nothing and the tool can only promise that the command was delivered - both the tool description and the server instructions say so. And the idle-reclaim release, like the two verified paths, is only exercised at a 300s idle timeout; it shares the same send helper and was reviewed rather than timed out live. Bin/settings.ini was restored byte-exact and the Release instance was left alone. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
27b5431130
commit
3d388f8e45
4 files changed
+406
-15
No files matched your search
@@ -370,7 +370,8 @@ struct ToolHints {
|
||||
bool openWorld; // false = 只读服务端本机状态(主机列表、审计日志),不触达外部主机
|
||||
};
|
||||
|
||||
// 54 个工具的语义登记表。新增工具必须在此登记(漏登记 → 走默认 destructiveHint=true)。
|
||||
// 工具的语义登记表(全部工具,含开关门控后才会出现的)。新增工具必须在此登记
|
||||
// (漏登记 → 走默认 destructiveHint=true)。
|
||||
const ToolHints kToolHints[] = {
|
||||
// --- 服务端本机只读 ---
|
||||
{ "list_online_hosts", true, false, true, false },
|
||||
@@ -421,6 +422,8 @@ const ToolHints kToolHints[] = {
|
||||
{ "remote_keyboard", false, false, false, true },
|
||||
{ "remote_mouse", false, false, false, true },
|
||||
{ "remote_clipboard", false, false, false, true }, // 覆盖对端剪贴板
|
||||
// 锁定对端键鼠:不破坏数据,但会把真人挡在电脑外,按「可破坏且非幂等」登记。
|
||||
{ "remote_block_input", false, true, false, true },
|
||||
// --- 文件传输 ---
|
||||
{ "upload_file", false, true, false, true }, // 覆盖/新增远端文件
|
||||
{ "copy_files_c2c", false, true, false, true }, // 覆盖/新增目标主机文件
|
||||
|
||||
Reference in new issue
Block a user