Feature: Support remote chat on Android hosts
The chat tools were Windows-only because the Android client had no COMMAND_CHAT handler: the server asked for a chat sub-connection and the command was silently dropped, leaving chat_open to time out. This adds the full path on the client and the matching server gating. Client: COMMAND_CHAT on the main connection spawns a chat thread that opens an authenticated sub-connection, sends TOKEN_CHAT_START and waits for the server to bind it. Incoming GBK lines are decoded and dispatched to ChatSession, which drives an in-app chat activity; when accessibility is available the activity is pulled to the front, otherwise a tappable notification is posted. Outgoing text is strictly GBK encoded so emoji and unmappable characters are rejected instead of becoming '?'. When the server ends the session the activity closes itself, matching the Windows client's DestroyWindow, and a new session starts from an empty log. Server: a new CLIENT_CAP_REMOTE_CHAT bit lets the server tell new APKs from old ones. ResolveHost now accepts Windows and Android hosts and rejects older APKs up front with -32005 rather than waiting for the command to expire. Tool platform masks, instructions, the docs matrix and mcp/tools.json follow the same change. Verified end to end on the Android 15 emulator: chat_open pops the activity, Chinese text from the server renders, a device reply reaches chat_wait, and ending the session from the master closes the activity instead of leaving a dead window. The committed ghost.apk is stale and must be rebuilt before release. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
f33a205fd9
commit
915c587964
14 files changed
+695
-29
No files matched your search
+10
-6
@@ -6066,10 +6066,11 @@
|
||||
},
|
||||
{
|
||||
"name": "chat_open",
|
||||
"description": "在指定在线 Windows 主机上弹出「远程交谈」窗口,建立一次多轮文字对话。返回 session_id,后续 chat_send / chat_wait / chat_close 都要带上。客户端使用者会直接看到聊天窗口(无确认框)。同一主机同一时刻只允许一个会话;会话在客户端断开或空闲 10 分钟后自动失效。会话建立后应先用 chat_send 发送问候,再用 chat_wait 等待对方回复。",
|
||||
"description": "在指定在线 Windows / Android 主机上弹出「远程交谈」窗口,建立一次多轮文字对话。返回 session_id,后续 chat_send / chat_wait / chat_close 都要带上。客户端使用者会直接看到聊天窗口(无确认框;Android 上是应用内聊天界面,无障碍服务可用时会自动拉到前台,否则发一条可点开的通知)。同一主机同一时刻只允许一个会话;会话在客户端断开或空闲 10 分钟后自动失效。会话建立后应先用 chat_send 发送问候,再用 chat_wait 等待对方回复。",
|
||||
"gate": "chat",
|
||||
"platforms": [
|
||||
"win"
|
||||
"win",
|
||||
"apk"
|
||||
],
|
||||
"impl": "mfc",
|
||||
"inputSchema": {
|
||||
@@ -6110,10 +6111,11 @@
|
||||
},
|
||||
{
|
||||
"name": "chat_send",
|
||||
"description": "向会话对端发送一条文本。消息以客户端本地代码页(简体中文为 GBK/CP936)显示;客户端不保证非中文系统能正确显示。发送成功只代表已写入子连接,不代表对方已读。请勿在同一条消息里塞入多段对话;需要等待回复时调用 chat_wait。",
|
||||
"description": "向会话对端发送一条文本。消息以客户端本地代码页(简体中文为 GBK/CP936)显示(Windows 客户端按 UTF-16 渲染,Android 客户端按 GBK 解码);客户端不保证非中文系统能正确显示。发送成功只代表已写入子连接,不代表对方已读。请勿在同一条消息里塞入多段对话;需要等待回复时调用 chat_wait。",
|
||||
"gate": "chat",
|
||||
"platforms": [
|
||||
"win"
|
||||
"win",
|
||||
"apk"
|
||||
],
|
||||
"impl": "mfc",
|
||||
"inputSchema": {
|
||||
@@ -6166,7 +6168,8 @@
|
||||
"description": "等待客户端使用者发来的消息。有消息立即返回;没有消息则阻塞到 timeout_ms 或会话关闭。返回 messages(按时间顺序,text 为 UTF-8)、timed_out、closed、dropped(因缓冲区溢出丢弃的最旧消息数)。timed_out=true 只表示这段时间对方没说话,会话仍然有效;closed=true 表示客户端已断开,需要重新 chat_open。一般回复后立刻调用 chat_wait 形成对话循环。",
|
||||
"gate": "chat",
|
||||
"platforms": [
|
||||
"win"
|
||||
"win",
|
||||
"apk"
|
||||
],
|
||||
"impl": "mfc",
|
||||
"inputSchema": {
|
||||
@@ -6243,7 +6246,8 @@
|
||||
"description": "结束会话并关闭客户端上的聊天窗口。主机在线且会话已不存在时按幂等处理为成功;主机已离线时返回 -32002(此时会话已随断线失效)。关闭后旧的 session_id 不能再用;可立即重新 chat_open。",
|
||||
"gate": "chat",
|
||||
"platforms": [
|
||||
"win"
|
||||
"win",
|
||||
"apk"
|
||||
],
|
||||
"impl": "mfc",
|
||||
"inputSchema": {
|
||||
|
||||
Reference in new issue
Block a user