Feature(mcp): unify window and service controls behind one name per state

operate_window / host_control_window and control_service / host_control_service were two
implementations of the same intent. tools/list now exposes exactly one of each pair,
chosen by McpMachine: the host_control_* names when host management is enabled, the
main-connection names when it is not.

The advertised tool accepts the union of actions. host_control_window routes close/show
to the main-connection implementation, which stays the only path with close/show
semantics and requires McpManage; the machine path keeps its post-action verification
for restore/hide/maximize/minimize/activate. host_control_service routes
set_auto/set_manual the same way and rejects dry_run for them instead of pretending to
run one. Both old names remain callable aliases, and service_name is accepted as an
alias for the machine tool's name parameter.

The manifest generator treats the two main-connection tools as !machine entries, so the
two-capture union still covers both states. tools/list is 49 entries when everything is
on (was 51) and 47 when host management is off; the response shrinks from 193,008 B to
168,634 B (-12.6%), short of the 15% estimate because state-conditional tools must stay
in the manifest. The plan document records that measurement and the reason.

Verified with a dedicated two-state test: visibility matrix, close/show and
set_auto/set_manual routing through dry_run and validation paths, alias dispatch, and
-32006 for host_* names when host management is off. Step 8a/8b regressions and
verify_tools --live still pass.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-12 17:40:51 +01:00
1 parent c73db530f4
commit 5841f27df9
5 files changed
+218 -141

No files matched your search

+10 -1
View File
@@ -462,6 +462,14 @@ host_inspect(id, aspects[]) // processes|windows|network|software|browser_hist
outputSchema 占 49,320 B 且合并后要保留,被删掉的主要是 17 个工具的 description +
inputSchema,乐观估计降 25–35KB(**约 −15%**)。实际值以改动后用附录 B 的方法重测为准。
**实测结果(2026-11-12,P2-1/2 落地后)**:开启全部开关时 `tools/list` 响应
**168,634 B / 49 个工具**,较基线降 24,374 B(**−12.6%**),未达到 15%。原因是清单
必须同时描述两种开关状态:`list_processes` / `list_windows` / `list_services` /
`operate_window` / `control_service` 在 McpMachine=0 时是唯一可用路径,因此以
`gate: "!machine"` 留在清单里(见 P2-4),所有状态下的实际列表都是 49 或 47 个,
到不了估算里的 46。若还要再降,只有两条路:删掉降级路径(关掉主机管理就失去列进程/
窗口/服务的能力)或压缩 description/outputSchema 正文——两者都不建议为凑 15% 去做。
### P2-4 别名/合并的同步项(v2 新增)
「旧名保留为别名、`tools/list` 只暴露新名」听起来只是一张别名表,但工具名在服务端还有
@@ -535,7 +543,8 @@ inputSchema,乐观估计降 25–35KB(**约 −15%**)。实际值以改动
- `timeout_ms` 手工覆盖次数从 41 降到 **10 以内**
- 零 `-32002`(会话被销毁);超时后能轮询续取
- `tools/list` 响应体积**较实测基线 193,008 B 下降 ≥15%**(≈ ≤164KB)。不要沿用
「80KB」:按本次合并范围做不到,见 P2-3
「80KB」:按本次合并范围做不到,见 P2-3。**实测 168,634 B(−12.6%)**,未达标,
原因见 P2-3 的实测结果段
---