feat(device): 文件通道 pull/push

core 与设备复用同一条 WS 搬文件:256KiB 分块、base64、50MiB 上限,
写盘先 .part 再校验 size/sha256 后 rename;device 工具新增 pull/push 两个动作。
This commit is contained in:
2026-11-19 19:01:34 +08:00
parent 4a36cc0266
commit 3c9f9d2bdb
7 changed files with 443 additions and 4 deletions
+12 -2
View File
@@ -436,7 +436,7 @@
"type": "function",
"function": {
"name": "device",
"description": "Operate the remote devices (other machines) connected to this server. Devices dial out to this server, so they need no inbound port; they stay connected until closed.\n\n- action=list: no other params. Returns every online device with os/arch/shell/root/health. Always call this first when you don't know device names.\n- action=health: requires device. Returns host uptime, load, memory, disk and temperature (fields the platform can't provide are -1).\n- action=exec: requires device and command. Runs the command through a shell on that device (sh -c on Unix, cmd /c on Windows) and returns stdout, stderr and the exit code. `cwd` must be inside that device's work root; omit it to use the root.\n\nUse it when the work has to happen on the user's own machine (laptop, box, Windows PC). For the machine running this server use `terminal` instead. If a device is offline, say so explicitly — do not silently run the command elsewhere.",
"description": "Operate the remote devices (other machines) connected to this server. Devices dial out to this server, so they need no inbound port; they stay connected until closed.\n\n- action=list: no other params. Returns every online device with os/arch/shell/root/health. Always call this first when you don't know device names.\n- action=health: requires device. Returns host uptime, load, memory, disk and temperature (fields the platform can't provide are -1).\n- action=exec: requires device and command. Runs the command through a shell on that device (sh -c on Unix, cmd /c on Windows) and returns stdout, stderr and the exit code. `cwd` must be inside that device's work root; omit it to use the root.\n\n- action=pull: requires device and remote_path; copies a file from the device into the session directory so read_file / skills can use it.\n- action=push: requires device, local_path and remote_path; sends a session file to the device.\n\nUse it when the work has to happen on the user's own machine (laptop, box, Windows PC). For the machine running this server use `terminal` instead. If a device is offline, say so explicitly — do not silently run the command elsewhere.",
"parameters": {
"type": "object",
"required": [
@@ -448,7 +448,9 @@
"enum": [
"list",
"health",
"exec"
"exec",
"pull",
"push"
],
"description": "Operation to perform."
},
@@ -467,6 +469,14 @@
"timeout_ms": {
"type": "integer",
"description": "Default 120000, max 600000 (action=exec)."
},
"remote_path": {
"type": "string",
"description": "设备上的绝对路径,必须在设备工作根内(pull/push)。"
},
"local_path": {
"type": "string",
"description": "会话目录内的相对路径。pull 省略则用远端文件名;push 必填(源文件)。"
}
}
}