Feature: Let the client report structured failures for MCP tools
Four new client-to-server tokens carry a win32/LSTATUS code when a command fails instead of returning empty data: TOKEN_SERVICE_ERROR (170), TOKEN_FILE_LIST_ERROR (171), TOKEN_REG_ERROR (172) and TOKEN_DOWNLOAD_ERROR (173). They sit on byte values that were unused, so existing numbering is untouched. The three data paths that used to collapse "failed" and "empty" into the same packet now distinguish them: OpenSCManager failures, directory enumeration failures and RegOpenKeyEx failures all report the code that was actually returned, and UploadToRemoteV2 reports why it found no file to transfer before the transfer sub-connection is ever created. Every failure branch still sends the packet the old server expects (TOKEN_FILE_LIST, the empty TOKEN_REG_PATH/KEY pair, the ClientMsg popup), so a new client talking to an old server degrades to exactly today's behaviour instead of timing out. Success paths are byte-for- byte unchanged. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
eaa10cc7d3
commit
315a0855dc
8 files changed
+89
-13
No files matched your search
@@ -330,6 +330,13 @@ enum {
|
||||
COMMAND_REGEN_CLIENT_ID = 168, // 服务端 → 客户端:撞 ID 的克隆机重生成 client_id(掺随机 UUID)后重连
|
||||
COMMAND_SCREEN_KEYFRAME_REQ = 169, // 服务端 → 客户端:下一次屏幕编码强制输出 IDR(Web 屏幕墙恢复用)
|
||||
|
||||
// MCP 结构化失败回报(客户端 → 服务端,仅失败分支发送;成功路径报文不变)。
|
||||
// 170-198 是当前未占用的字节值,显式赋值避免后续插入重编号。
|
||||
TOKEN_SERVICE_ERROR = 170, // [token:1][win32err:4 LE] 服务枚举失败(典型:OpenSCManager 权限不足)
|
||||
TOKEN_FILE_LIST_ERROR = 171, // [token:1][win32err:4 LE] 文件列表失败(典型:路径不存在/非法)
|
||||
TOKEN_REG_ERROR = 172, // [token:1][lstatus:4 LE] 注册表打开失败(键不存在/拒绝访问)
|
||||
TOKEN_DOWNLOAD_ERROR = 173, // [token:1][win32err:4 LE] 下载请求无可用文件(路径全部不存在)
|
||||
|
||||
TOKEN_DECRYPT = 199,
|
||||
TOKEN_REGEDIT = 200, // 注册表
|
||||
COMMAND_REG_FIND, // 注册表 管理标识
|
||||
|
||||
Reference in new issue
Block a user