Feature(Go): terminal_exec with sentinel cleaning and polling
Implement M4b of the Go MCP minimal plan: terminal_exec runs one command in a device's persistent shell and polls the rest of a timed-out command. Wire format follows the Win32 server: ConPTY sends "@echo off & <cmd>" plus a sentinel line carrying %errorlevel%; POSIX PTY clears PS1 and uses $?. Output cleaning is a byte-faithful port of the MFC stages (ANSI, CRLF, echoed input, sentinel remnants) and is shared by commands and polls. A timed-out call leaves the session and the command running; the next call with only session_id delivers from the cursor it left. Per-window output is bounded by max_output_bytes, truncated on a line boundary, and ring evictions are reported as dropped_bytes. When the shell dies mid-command the session stays reachable until its buffered tail has been polled, then is released without touching the hub, which may already belong to a new viewer. Adds ClientCapTerminal (0x8000) for the Android gate; older APKs, macOS and legacy non-PTY shells are refused with -32005. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
12b1bd4786
commit
599c891c00
9 files changed
+1728
-20
No files matched your search
@@ -76,6 +76,10 @@ const (
|
||||
ClientCapVirtualDesktop uint32 = 0x0080 // CLIENT_CAP_VIRTUAL_DESKTOP — whole virtual desktop capture
|
||||
ClientCapWindowInfo uint32 = 0x0100 // CLIENT_CAP_WINDOW_INFO — window enumeration / rects
|
||||
ClientCapScreenRegion uint32 = 0x0200 // CLIENT_CAP_SCREEN_REGION — region/window/monitor capture
|
||||
// CLIENT_CAP_TERMINAL is only declared by recent Android builds: Windows
|
||||
// and Linux always had COMMAND_SHELL but never advertise it, so this bit
|
||||
// must only gate the APK path (common/commands.h:151).
|
||||
ClientCapTerminal uint32 = 0x8000 // CLIENT_CAP_TERMINAL — PTY shell sub-connection
|
||||
)
|
||||
|
||||
// SupportsCap returns true when the client's reported capability hex string
|
||||
|
||||
Reference in new issue
Block a user