Feature: return web-console remarks from the Go MCP host tools

list_hosts and get_host_detail now include the remark an admin set in the
web console, and the name/query filters match it like the Win32 server
(name: hostname + remark; query: hostname + remark + IP). The text-only
host table gains a remark column, and the MCP instructions stop claiming
the Go server keeps no remarks.

The remark table is injected through a small Note() interface so the mcp
package still does not import web. An optional Notes() snapshot
capability is borrowed once per call, so a listing neither takes a read
lock per device nor mixes labels across a concurrent save. The design
docs are updated to match the new fields and table column.

Verified: go build ./..., go vet, gofmt and the full go test ./... pass;
new tests cover remark projection, both filters and the snapshot path.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-27 14:51:15 +01:00
1 parent 95d2bbc1b6
commit 5f764b2425
8 files changed
+136 -28

No files matched your search

+5 -4
View File
@@ -141,14 +141,15 @@
{ "hosts": [ /* ... */ ], "total": 7, "totalAll": 9, "limit": 100, "offset": 0, "hasMore": false }
```
`client_type/group/ip/os` 为大小写不敏感子串过滤;`name` 只匹配计算机名,`query` 同时匹配
`client_type/group/ip/os` 为大小写不敏感子串过滤;`name` 匹配计算机名与备注,`query` 匹配
计算机名、备注与 IP;`online=true`(默认)只列在线,`false` 只列历史中存在但当前离线的;
`include_offline=true` 时再合并 `devicehistory.Store.Offline(online)`。`total` 是过滤后命中数,
`totalAll` 是过滤前总数,`hasMore` 表示同一条件下还有下一页。
`hosts[]` 的字段按 `outputSchema`:`id/name/group/version/clientType/os/ip/rtt/activeWindow/
screen/online/last_seen`,以及 hub 或历史记录里确有的 `location/install_time`;两个服务端都
没有 `authStatus/tls/remark`,不输出。离线历史条目不存 `clientType`,也没有 `rtt/activeWindow`。
screen/online/last_seen`,以及 hub 或历史记录里确有的 `location/install_time`,和 Go 版
Web 控制台设置过的 `remark`(`device_notes.json`,未设置时省略);两个服务端都没有
`authStatus/tls`,不输出。离线历史条目不存 `clientType`,也没有 `rtt/activeWindow`。
#### `get_host_detail`
@@ -255,7 +256,7 @@ M5 之前传任一参数都返回 `-32005` 并在 message 里点名。细节见
| 工具 | 汇总行之后 |
|---|---|
| `list_hosts` | 表头 `id name ip group os online clientType last_seen`,随后每台一行 |
| `list_hosts` | 表头 `id name remark ip group os online clientType last_seen`,随后每台一行 |
| `get_host_detail` | 单台:主机 JSON(compact);批量:`id ok detail`,成功行是主机 JSON,失败行是错误信息 |
| `list_files` | 盘符 `drive typeName fileSystem totalMB freeMB`;目录 `name isDir size mtime` |
| `get_audit_log` | `time type msg`,`msg` 是去掉信封字段后的 compact JSON |