292c3191dc2c962df9340df412a58051c7d783ba
84
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
292c3191dc |
Fix(mcp): make declared schemas match what the handlers return
Several tool contracts disagreed with the runtime shape, which forces an
agent to guess instead of following outputSchema:
- get_server_status returned {"status": {...}} while outputSchema has the
fields at top level; return the status object directly.
- get_screenshot description claimed structuredContent.image carries the
base64 data; it only carries mimeType/width/height/bytes, the bytes are
in the content image block.
- host_control_service accepted service_name silently, but not in schema;
document the alias and add anyOf [{required:[name]},{required:[service_name]}]
so a call missing both fails at validation, not at execution.
- kill_network_connection dry_run invented dryRun/connection fields absent
from ActionOutputSchema; use the shared BuildDryRunResult shape.
- search_file outputSchema left files.items untyped; declare
path/name/modified/dir/size and the paging fields it already emits.
- chat_* id hints still named the removed list_online_hosts/search_hosts.
tools.json hunks keep the live-dump key order (alphabetical inside schemas),
tools_minimal.json is regenerated, and mcp_smoke.ps1 now reads the flat
structuredContent. Debug build green; check_platform_table, gen_go_tools
--check and go test ./... pass.
Co-Authored-By: deepseek-flash
|
||
|
|
5e012019ba |
Fix(mcp): list the whole directory before paging list_files
list_files stopped parsing at 500 entries, so a larger directory reported total=500 with hasMore=false and offsets past 500 returned nothing: the model was told a false limit and could not reach the tail. Parse the full TOKEN_FILE_LIST payload (100000 cap only to bound a pathological directory), page over it, and report truncated=true plus a summary note when the cap hits. Only an empty path now means list drives. Windows "." "/" "\" are normalized to empty in BuildListFiles, while Linux/macOS "/" is a real root directory and is listed; OnDriveList no longer keeps its own copy of the magic-path rule. The file-manager channel carries GBK both ways (Windows FindFirstFileA; common/FileManager.h runs gbkToUtf8 on incoming paths, utf8ToGbk on outgoing names). The old CP_UTF8 choice for LNX/MAC decoded GBK names wrongly and sent UTF-8 paths to a client that treats them as GBK. Paths now go out as GBK, or as raw UTF-8 when GBK cannot represent them (the client's iconv then passes the bytes through). Names decode GBK-first, UTF-8 on failure: UTF-8-first misreads ~18% of common hanzi whose GBK bytes are also valid UTF-8. Go's server gets the same contract: 100000 cap, truncated in structuredContent, and the cap check after a real record so an exact-cap listing with trailing padding is not called truncated. tools_minimal.json is regenerated; the Go truncation test and the design doc are updated. Debug server builds; check_platform_table, gen_go_tools --check and go test ./... pass. The Release instance was not rebuilt or restarted. Co-Authored-By: deepseek-flash |
||
|
|
3d18b2119a |
Fix(mcp): put listing rows and host ids into text blocks
MCP clients that surface only content[].text saw just count summaries from list_hosts and get_audit_log; the 64-bit host id lived only in structuredContent. Without the id, read_file, get_host_detail and terminal_exec cannot be addressed, so the tools were unusable from those clients. Append a tab-separated table after the summary for every list-shaped local tool: list_hosts (id first, then name/ip/group/os/online/clientType/ last_seen), get_audit_log (time/type/msg), list_files (drives and directory entries) and get_host_detail (compact host JSON; id/ok/detail rows for a batch call). Only the returned page is rendered, cells are flattened to one line, and the truncation note stays on its own line before the table. structuredContent is unchanged and remains the authoritative copy. Tests cover row contents, paging, escaping and truncation ordering; a live run against a Debug client confirmed the id is now visible in text. The MFC server needs no equivalent change: BuildResult already appends the full structuredContent as a second text item, so text-only clients there already receive host ids. Go's envelope emits a single text item, which is why the rows go into it. Co-Authored-By: deepseek-flash |
||
|
|
70556391dd |
Docs(mcp): record the Go MCP overall acceptance
Run the section 5 checklist end to end against the debug Go server and a Windows debug ghost: nine tools called, tools/list at 22578 B, twenty consecutive terminal_exec calls with zero failures, read_file SHA-256 matched, 30 audit entries with device/tool/code/ms, and --subset passing in both 9-tool and readonly 7-tool modes. Race tests stay clean. Two checklist items get corrected rather than ticked: hub did change (SendToConn in M6 and the terminal lease generation in M4a, both needed and unit tested), and the MFC regression has no target because the whole milestone range touches no C++ file. Note the running Release binary is an older build reporting the old tool names; it was left alone. Co-Authored-By: deepseek-flash |
||
|
|
d4f10db1f2 |
Feature(Go): verify_tools --subset and MCP deployment docs
Add a third mode to verify_tools.py that validates the Go server end to end: it fetches /mcp tools/list and requires the name set to equal the nine implemented tools exactly (seven in readonly mode), compares description / inputSchema / outputSchema field by field against mcp/tools.json, and also checks the published order. Unlike --live, extra or missing tools are failures, not notes. The field-comparison loop is factored into report_field_diffs so --offline / --live and --subset share one comparison, diff printer and FIELDS tuple. Document and deploy the endpoint: the systemd env example gains YAMA_MCP_TOKEN / READONLY / TERM_IDLE / MAX_CONCURRENCY / READ_MAX, the design doc moves to implemented and its section 10 now matches the code (embedded tools_minimal.json, the three packet dispatch groups). The tools README explains gen_go_tools.py --check and --subset. Verified against a freshly built debug Go server on 16543/18090: read-write mode passes with 9 tools, YAMA_MCP_READONLY=1 passes with 7, and both mismatch directions (extra tools, missing tools) fail with exit 1. gen_go_tools.py --check stays clean; no Go code changed. Co-Authored-By: deepseek-flash |
||
|
|
774c0d2545 |
Feature(Go): four local MCP read tools and a shared audit query package
Implement milestone M2 of the minimal MCP plan: the tools that answer from the server's own state instead of opening a device channel. - Extract the audit-log scanner from web into package auditquery so the admin page and get_audit_log share one implementation. The web handler keeps its 500-row cap, the MCP tool uses the protocol's 1000-row cap. Query gains json tags for the web snake_case wire format (device_id, warn_only) and reports TotalAll before filters. - Add package buildinfo and inject Version/Commit with -X from build.ps1 and the Makefile; go-winres refreshes Windows resources from the git tag when available. An unversioned build reports "", and only initialize substitutes "dev". - list_hosts: online/offline pools, include_offline merge, every documented filter, limit/offset paging with total/totalAll/hasMore, and schema-named host fields (authStatus/tls/remark are never fabricated). - get_host_detail: single id or a batch of up to 50, online lookup then the last history record, capabilities from protocol.SupportsCap plus the Windows/registry/virtual-desktop rules; v2 is not listed. - get_server_status: version, uptime, online/offline counts, port and bind. sessions stays absent until the MCP session table lands in M3. - get_audit_log: case-insensitive event substring, keyword, paging; hasMore turns false at the MaxOffset clamp so paging cannot loop. Wire hub, history, audit path and listen address through mcp.Config from cmd/main.go. Tests cover pools/filters/paging, capability bits, batch failures, audit paging and the unversioned build. Co-Authored-By: deepseek-flash |
||
|
|
3f1957a9c9 |
Feature(Go): MCP endpoint with bearer auth and tools/list
Add a stateless POST /mcp endpoint to the Go server, mounted by the web server and built from an environment-driven Config in cmd. The endpoint gates on YAMA_MCP_TOKEN: without it the route is not registered and /mcp 404s. Requests use a constant-time bearer compare, and transport failures stay transport failures (401 with a WWW-Authenticate challenge, 405 for anything but POST, 413 above 8 MiB, 204 for notifications). Everything after a parsed JSON-RPC request is HTTP 200, including -32600 for batch arrays and -32601 for unknown methods or tools. tools/list returns the nine minimal tools verbatim from an embedded copy of the canonical schemas. tools/mcp_tools/gen_go_tools.py extracts them from mcp/tools.json, preserving order and only the four published fields, and its --check mode detects drift. Readonly mode hides and refuses terminal_exec/terminal_close (-32006); tools that are listed but not implemented yet answer -32000 until their milestone lands. Also sync design §3.2 and the M2/M7/M8 plan text to tools.json, which is the sole schema contract: files not entries, line-based read_file, no since, camelCase capabilities, max_width [64,1920] defaulting to 1024, and outputSchema included in the M8 subset comparison. Co-Authored-By: deepseek-flash |
||
|
|
5f124fcb3a |
Docs(mcp): add Go minimal MCP design and implementation plan
Add the v1.0 design for the Go-side minimal MCP server (nine read-only tools over hub, audit log, terminal and file channels) and the staged plan that turns it into eight commits. Record the five decisions settled before construction: extract the audit query scanner into server/go/auditquery, inject version and commit via a buildinfo package plus go-winres, treat mcp/tools.json as the only tool schema contract, verify against a real client, and expose seven tools in readonly mode. Add the M0 findings: TestRun.exe cannot log in, because it needs ServerDll.dll loaded through MemoryDllRunner and the release build deletes itself when started outside its install path. A Debug ghost.exe came online against a local Go server in trial signer mode within ten seconds. Co-Authored-By: deepseek-flash |
||
|
|
5841f27df9 |
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 |
||
|
|
f5ac7ba45f |
Docs: revise MCP tool optimization plan against measured baseline
The v1 plan was written without measuring the live server. Re-measure and fix it against the code: - tools/list response is 193,008 B (tools array 136,692 B; description 31,874 / inputSchema 44,192 / outputSchema 49,320), not 103,158 B; the >=15% goal now refers to this baseline. - TermSession::sentPos is the sentinel offset, not a delivered cursor, so P0-2 introduces a real `delivered` cursor instead of reusing it. - The whitelist additions icacls / net user / net localgroup are writes under prefix matching; only sc qc / enumdepend / sdshow qualify. - "file too large" uses -32602, not the invented -32011 (destination write failure). - P0-3 gains four prerequisites (size pre-check, McpFileTransfer gate, RAII cleanup, sha256/lines_total semantics); P0-1 spells out the default-session slot hazard; the stage order is P0-4 first since it is the cheapest win. Appendix B records how the baseline was measured (verify_tools.py --live). Co-Authored-By: deepseek-flash |
||
|
|
4aedca8ee0 |
Feature: Support voice monitoring on Android hosts
The master's voice monitoring menu sends COMMAND_AUDIO; the client opens a ConnAuth sub-connection with TOKEN_AUDIO_START, the server opens CAudioDlg and answers COMMAND_NEXT, then audio flows both ways. The protocol matches the Windows client, so the server needs no changes. The server's ACM format was read from Audio.cpp and AudioDlg.cpp first: WAVE_FORMAT_GSM610, 8000 Hz mono, 65-byte blocks of 320 samples (40 ms), about 1625 B/s. libgsm 1.0.13 (AOSP external/libgsm mirror) is vendored under cpp/gsm and built with -DSASR -DWAV49 so its MS-GSM packing is byte-identical to ACM GSM610. Encode and decode use separate gsm states because frame_index/frame_chain live in the state. Uplink packets are always exactly 1000 bytes: CAudio::PlayBuffer copies 1000 bytes from the buffer start regardless of packet length, so a short packet would over-read. Since 1000 is not a multiple of 65, blocks straddle packets; the stream is continuous and codec state carries over. AudioMonitor.kt owns AudioRecord (8 kHz/16-bit/mono, 320 samples a read) and AudioTrack playback of decoded downlink PCM. RECORD_AUDIO is requested with POST_NOTIFICATIONS before the projection dialog, and CaptureService adds the microphone FGS type only when held, falling back on failure. An 8-second dialog wait or missing microphone reports a tip to the master instead of failing silently. Verified on an Android 15 emulator against the Debug server: dialog opened, uplink started, server receive counter grew at ~1.6 KB/s. Downlink playback was not exercised (the test machine has no recording device); that path is code-reviewed only. Co-Authored-By: deepseek-flash |
||
|
|
3ab5154db1 |
Feature: Honor remote desktop tuning commands on Android hosts
The Android client dropped CMD_QUALITY_LEVEL, CMD_FPS, CMD_QUALITY_PROFILES and CMD_SCREEN_TUNING as log lines, and hardcoded ScreenSettings.QualityLevel to Good. Because the server initializes adaptive quality from the client's reported level, that hardcoded value pinned every Android session to a fixed profile: adaptive quality could never start. ScreenTuning.kt now owns the state in SharedPreferences (level, max fps and the master's six-row profile table), and C++ only parses the wire format. The level is persisted when the master sets it explicitly, including -1 adaptive and -2 disabled, and is reported back in TOKEN_BITMAPINFO on the next screen session. A concrete level switch applies the profile bitrate at runtime via MediaCodec.setParameters(PARAMETER_KEY_VIDEO_BITRATE), which is smooth and needs no encoder rebuild. Frame rate is stored as-is (255 = unlimited, matching Windows) and only reaches KEY_FRAME_RATE at the next capture start, since surface encoders have no runtime fps cap. Ultra and High default to a zero bitrate because their Windows algorithms are DIFF/RGB565, so Android falls back to the previous 4000 kbps. CMD_SCREEN_TUNING stays log-only: all four flags belong to the Windows capture/x264 path and Android does not claim SCREEN_CAP_TUNING_FLAGS. CMD_SCREEN_SIZE is ignored; the server's pending resolution-change mark self-heals after one second. Verified on the emulator: a seeded Level 5 starts capture at 800 kbps/8 fps and the server title shows Minimal; a master-side switch to Good changes the live bitrate to 3000, and a restart picks up fps 30 from CMD_FPS. Co-Authored-By: deepseek-flash |
||
|
|
a801a2999a |
Feature: Support input blocking and privacy overlay on Android hosts
remote_block_input rejected anything but Windows because the Android client had no COMMAND_SCREEN_BLOCK_INPUT handler. This adds the overlay on the client and the server gating, and wires up COMMAND_SCREEN_BLANK. Client: the accessibility service hangs a full-screen TYPE_ACCESSIBILITY_OVERLAY on itself. block=true makes it transparent and touchable so it swallows physical taps; black=true paints it black. Both are absolute states, so repeated commands are idempotent, and the handler clears the overlay when the screen sub-connection dies (Android has no "released when the calling thread exits" fallback). During a remote gesture the overlay is flipped to FLAG_NOT_TOUCHABLE, mirroring Windows' BlockInput(false) wrap; the flag change and the injection must be separated by a short delay or the gesture is swallowed. Server: CLIENT_CAP_PRIVACY_OVERLAY distinguishes new APKs from old ones; Linux/macOS and old APKs still get -32005 up front. Tool masks, instructions and mcp/tools.json follow the change. COMMAND_SCREEN_BLANK is implemented but not exposed as a tool: MediaProjection captures the overlay, so blacking out the screen blinds the operator too and cannot emulate Windows' WDA_EXCLUDEFROMCAPTURE. Verified on the Android 15 emulator: blocked taps are swallowed while remote clicks still land, the block re-arms after each gesture, the watchdog auto-unblocks at the deadline, a dropped sub-connection clears the overlay, and a black overlay shows up in both screencap and get_screenshot. The committed ghost.apk is stale; rebuild before release. Co-Authored-By: deepseek-flash |
||
|
|
445bd8bbb9 |
Feature: Support the remote terminal on Android hosts
The terminal tools were Windows/Linux only because the Android client had no COMMAND_SHELL handler: the server opened a shell sub-connection and the command was silently dropped, leaving exec_command to time out. This adds the PTY path on the client and the matching server gating. Client: COMMAND_SHELL on the main connection spawns a terminal thread that opens an authenticated sub-connection, sends TOKEN_TERMINAL_START and keeps the PTY alive until the server closes it. common/PTYHandler.h is reused, with a minSdk-21 openpty built from posix_openpt/grantpt and /system/bin/sh (mksh) as the shell. A new CLIENT_CAP_TERMINAL bit lets the server reject old APKs up front with -32005. Server: the tool masks, instructions and docs matrix accept APK. While verifying, exec_command left a second echoed copy of the command line in stdout: mksh forks with ECHO still on, so input written before its line editor takes over is echoed by the line discipline in addition to the shell's own redraw. The server now waits for the shell's first output (the prompt) before sending the command and sentinel, which restores the single-echo assumption the cleaning step relies on. terminal_exec on a ready session is unaffected. Verified on the Android 15 emulator: exec_command returns clean stdout and real exit codes for id/uname/df/ls (including a failing command), and terminal_open keeps cwd across commands, pipes work and close is clean. The committed ghost.apk is stale and must be rebuilt before release; a rebuilt APK was used for this testing. Co-Authored-By: deepseek-flash |
||
|
|
915c587964 |
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 |
||
|
|
29d7ee1a18 |
Feature: Support host uninstall on Android and expose uninstall_host
The server's "uninstall host" action is the single-byte TOKEN_UNINSTALL on the main connection. Windows clients have handled it for a long time; the Android client ignored it, so the menu entry silently did nothing there. Handle it in the Android client the only way Android allows: ask the system to uninstall the package. The client first replies with COMMAND_BYE and drops the connection, then opens the package installer's confirmation dialog through the accessibility service, or posts a notification that resumes the dialog from MainActivity when accessibility is off. The user still has to confirm on the device; if they cancel, the client has already left the server and must be reopened by hand. The manifest gains REQUEST_DELETE_PACKAGES, without which the installer activity refuses the request outright. New APKs advertise CLIENT_CAP_UNINSTALL so the server can reject old clients instead of sending a command nobody handles. The new MCP tool uninstall_host is gated on McpManage and McpReadonly=0, rejects Linux and macOS hosts, and offers the same wait=true verification as power_action, reporting went_offline once the host disappears from the online list. Verified on the emulator end to end: the tool returned went_offline after 200 ms, the system dialog appeared, confirming it removed the package. Co-Authored-By: deepseek-flash |
||
|
|
fd1b085279 |
Feature: Add remote lock screen for Android hosts
Implement the Ctrl+Alt+Del path on Android as a system lock screen. Android has no secure attention sequence, so COMMAND_SCREEN_CTRL_ALT_DEL is mapped in the client to GLOBAL_ACTION_LOCK_SCREEN and the server exposes it as the new MCP tool remote_lock_screen. The Android client resolves ControlService.lockScreen()/canLockScreen() in nativeInit and dispatches the command from the screen sub-connection through the usual attach/detach JNI path. The lock action is posted to the accessibility service handler because performGlobalAction must not run on the receiver thread. Login advertises the new CLIENT_CAP_LOCK_SCREEN bit only when the accessibility service is bound and the API level is 28+, so the server can reject old APKs and Windows/Linux hosts up front instead of reporting a lock that never happened. There is no receipt: a successful call only means the command was delivered, and the tool description tells the caller to confirm with get_screenshot. Server side adds the schema and handler next to remote_clipboard, audits the call, and gates it on client type plus the capability bit. Since it is the only APK-only tool, check_platform_table.py gains a documented exemption from the Windows baseline invariant, and make_tools_json.py learns an APK-only platform set. tools.json is regenerated from the live server and the plan document now counts 62 tools. Co-Authored-By: deepseek-flash |
||
|
|
51747dc0ea |
Feature: Add on-demand TLS transport with hot-switch to the Android client
Reuse the Linux OpenSSL TlsChannel implementation (platform guard widened to __linux__); the trust anchor lives in the app-private filesDir, injected via TlsSetAnchorDir in nativeInit before the connection thread starts. COMMAND_TLS_ENABLE/DISABLE save/remove the anchor, hot-reload and reconnect only when the transport actually changes, so the master menu takes effect within seconds without restarting the app. Login reports RES_TLS, refreshed before each re-login. The reconnect flag is consumed before the drop check and cleared before reconnecting so a switch racing a disconnect cannot cause an extra reconnect/login cycle. Cross-compile OpenSSL 3.5.0 per ABI with build_openssl_android.sh (NDK clang + MSYS2 perl/make), integrated into build_android_libs.ps1 (-OpenSslOnly). Static libs and per-ABI headers are tracked like the existing libzstd/libsign prebuilts; --exclude-libs keeps OpenSSL symbols private to libyama.so, isolated from the Java-layer Conscrypt. Co-Authored-By: Qoder <noreply@qoder.com> |
||
|
|
cdd9c56b3d |
Feature: Add window/region capture targets to remote_open
Pass the target HWND through the COMMAND_SCREEN_SPY token and send COMMAND_SCREEN_ROI after session start, so MCP remote control can stream just the target window or region instead of the scaled virtual desktop. The session records the target kind, remote_mouse refuses a redundant window_hwnd basis, and the cached resolution is refreshed per action so resized windows keep mapping correctly. Cold starts now clear the stale resolution cache used by the region handshake. |
||
|
|
5501889d33 |
Feature: Add window-relative remote_mouse coords and PTY pipes in terminal_exec
New Windows clients append an optional 20-byte WINDOWINFO_MCP_DESKTOP block (virtual desktop rect, magic 'VDCP') after the window list, so the server can map window-relative coordinates into the capture frame. remote_mouse accepts an optional window_hwnd; x/y and drag x2/y2 are then normalized against the intersection of the window and the virtual desktop, which is exactly the source rect of get_screenshot mode=window. The target window must be foreground by default, and window_hwnd/expect_hwnd must agree when both are given. structuredContent gains coordinateWindow and resolved (frame coords plus the basis rect), so callers can verify the mapping. terminal_exec now allows pipes, && and || in PTY sessions (ConPTY on Windows, POSIX PTY on Linux) because the sentinel runs on its own line; legacy non-PTY sessions still reject & and |. A read-only PeekTermSession lets the server reject unsupported syntax before BeginTermCommand. POSIX still rejects bare background & (&&, &>, 2>&1 stay allowed). Docs: Mcp_Design.md sections 12.1/20.2/22 and Mcp_Terminal_Design.md 4.4/4.6 are synchronized with the protocol, the new validation order, and the basis rect semantics. Co-Authored-By: deepseek-flash |
||
|
|
235a8a622c |
Feature: Add native region, window and monitor capture to get_screenshot
New Windows clients advertise CLIENT_CAP_SCREEN_REGION and accept a 24-byte ScreenPreviewReqEx appended to the existing 8-byte preview request, so get_screenshot can capture a region, a window or a single monitor at 1:1 resolution instead of only the scaled virtual desktop. Successful v2 responses append an optional ScreenCaptureMeta block reporting the source rect and scale, letting callers map coordinates back for remote input. Old clients and old servers keep the v1 byte stream unchanged. The 8192 px per-side bound only applies to native (1:1) capture, where it guards bitmap memory; scaled captures are unaffected so ultra-wide virtual desktops (for example triple 4K) still produce thumbnails and previews. max_width is clamped to [64,1920] as before instead of rejected, matching the documented schema. Co-Authored-By: deepseek-flash |
||
|
|
b2c0d81396 |
Feature: Add window info RPC for foreground checks and window activation
Add a capability-gated main-connection RPC (COMMAND_MCP_WINDOW_INFO=179 / TOKEN_MCP_WINDOW_INFO=180) that returns visible top-level windows with UTF-8 titles, screen rectangles, foreground flag and z-order, so MCP can verify focus before injecting input. New tool get_foreground_window; host_list_windows switches to the richer fields; host_control_window and operate_window gain action=activate; remote_keyboard and remote_mouse gain expect_hwnd, require_foreground and report_foreground. Old clients keep the previous behavior: the RPC is refused up front via CLIENT_CAP_WINDOW_INFO. The client caps a response at 96 windows (about 101 KB, under MAX_SEND_BUFFER). Signal the cut-off in the mode byte (0x80) instead of silently dropping windows: host_list_windows now reports truncated=true and says the list is incomplete, and activate verification reports state=unknown with reason=list_truncated rather than claiming the window is gone. expect_hwnd is checked only after the session is validated, so an invalid session_id no longer burns a window RPC and no longer reports a window error for a session that does not exist. Nullable output fields (foreground, window) are declared as ["object","null"] so strict clients do not reject responses. Co-Authored-By: deepseek-flash |
||
|
|
f77b18aa68 |
Feature: run a test client inside the master from the Advanced menu
The Advanced menu now ends with Run Test Program. It copies the kernel payload that was already read into memory, points its CONNECT_ADDRESS at 127.0.0.1:<listen port>, and loads it with MemoryLoadLibrary inside the master process, so this machine comes online as a controlled host -- no second machine is needed to try remote desktop or file transfer. A worker thread waits for the client to exit, then frees the module and re-enables the item. Only one instance runs at a time: the item is grayed while it does, and stopping it means uninstalling the test host from the online list. The loaded copy carries LOCAL_TEST_CLIENT_MAGIC in szFuture. The client uses that mark to refuse the commands that would otherwise hit the host process or the whole machine: uninstall (no self_del), update, run as admin, ban, share/assign, and shutdown/reboot/logoff. It also skips auth-kernel detection, which GetModuleFileName(NULL) would misjudge inside the master. Renames szFututre to szFuture and documents that the first 16 bytes of the reserved tail are now claimed, with a static_assert so it cannot silently shrink below the magic. Translations for en_US, zh_TW and de_DE, plus the HIDE_MENU_RUN_TEST feature flag and its row in the limits dialog. Verified on a Debug master: the item is last and has its icon, one click brings the host online, a second click is refused, uninstall stops it in about a second and the master survives, re-run works, and exiting the master with a live test client takes 2.6s (3.0s baseline). Co-Authored-By: deepseek-flash |
||
|
|
c66f410831 |
Feature: Embed the server TLS certificate in delivered DLLs
Add a "高级 → DLL内嵌TLS证书" toggle (off by default, persisted as
[settings] EmbedTlsInDll). When it is on, ReadKernelDll patches the server's
current TLS anchor into the ServerDll and ShellCode payloads, so clients that
come online through the loaders start their own session over TLS without
waiting for an online push. The plaintext DLL loader in client/main.c is
untouched; only the DLL's fresh connection is protected. The write happens
after SetServer and before CalcMD5FromBytes, and the anchor records the host
part of the master address rather than "ip:port" because the client matches
the anchor against its configured address set. TinyRun has no anchor block and
keeps working as before.
Toggling the switch, and confirming the certificate dialog, rebuild the six
payloads in place, so no server restart is needed after a certificate change.
The payload pointers are replaced as a whole, and the network threads that read
them (SendServerDll and TOKEN_GETVERSION) now take a dedicated critical section
for the full duration of use.
COMMAND_UPDATE no longer clears the tls_disabled marker on the client. Now that
any delivered DLL may carry the anchor, "the payload has an anchor" no longer
means the operator opted this host into TLS, and clearing the marker would
silently flip a host that was explicitly set to plaintext onto TLS against a
plaintext path. Re-enabling TLS stays an explicit action through
COMMAND_TLS_ENABLE and COMMAND_SET_PROTO, which still clear the marker.
Menu and notice strings were added to en_US, zh_TW and de_DE, and the embedded
TLS design document records the new switch and the revised update semantics.
The new menu entry also takes a feature-limits slot so a subordinate master
can hide it like every other 高级 item (see
|
||
|
|
454d25d37f |
fix(share): carry the transport in the share and assign payloads
The share payload was host:port:shine and carried no transport at all, so a
shared client fell back to its baked-in protoType. Share instances also skip
ApplyProtoSwitch (ClientDll.cpp:810), so a client upgraded to WSS was shared
to a TLS front end as raw TCP and looped on HTTP/1.1 400.
Extend both payloads with an optional trailing transport field:
share : host:port:shine[:transport]
assign : host:port:days:shine[:transport]
The field is omitted when the source protocol is not TCP/WS/WSS, so HTTP/UDP/
KCP hosts keep their previous behaviour instead of being silently downgraded
to plain TCP.
- server: add SelectedShareTransport(), share it between OnOnlineShare and
OnOnlineAssignTo, and accept a tcp:// ws:// wss:// prefix in the address.
- client: parse the field on both paths and persist the assigned value to
settings/master_transport, clearing it when the field is absent.
- share_list: dedup on host:port instead of the whole record, so re-sharing
a host with a different transport replaces the stale entry.
- assign: guard bToken[_MAX_PATH] against the longer payload.
- lang: translate the reworded prompt and the three new messages in en_US,
zh_TW and de_DE.
Transport is pinned at share time and does not follow a later protocol switch
on the master link; the m_bShared gate stays as-is on purpose.
|
||
|
|
951b4072e5 |
Feature: Embed the master's TLS certificate in generated clients
When the server has TLS enabled, the builder can now bake its certificate into the client it produces, so a distributed client speaks TLS on its very first connection instead of waiting for the anchor to be pushed after a plaintext login. The dialog gets a checkbox (IDC_CHECK_TLS_ANCHOR) that is only enabled for payloads and protocols where an embedded anchor makes sense; the choice is remembered even when the control flips to disabled and back, so switching protocols cannot silently undo a deliberate opt-out. Every label variant stays short enough to fit the 196 DLU field, including the German ones. A template that predates the anchor block no longer aborts generation: it warns, clears the checkbox and produces a plain client, so a master upgraded without rebuilding the ghost/ServerDll resources does not block every build. The certificate lands in a fixed 4 KiB block (magic, version, length, FNV-1a hash, master address, PEM) carved out of the payload at build time. The client reads its trust anchor from four sources in order: the tls_disabled marker, the certificate the server pushed into the registry, a PEM file next to the executable, and finally the embedded block. The embedded block only applies to a connection whose target matches the master recorded at generation time, compared as an address set: an exact string match when only one address is configured, or an intersection of resolved IPv4 addresses otherwise. A transferred, shared or parallel instance falls back to the old plaintext first-connect path instead of pinning itself to a certificate it can never verify. That decision is made per connection, not per process: shared and parallel instances are threads inside a single client process, so a process-wide flag let whichever instance connected first decide for all of them, and the first load of the TLS state cached that answer for good. The TLS layer now keeps two cached states (embedded anchor allowed, and not allowed), picks one per handshake, and reports the anchor source of that handshake for the login capability bit. Matching by resolved address also keeps parallel mode working, where the connection goes to the single IP the domain pool selected while the configured master is a domain or a list. Server side, generated and updated payloads get the block written in place; the client reports the capability bit on login so the console can tell which hosts are already TLS-only on first connect. Loading the anchor decodes every PEM block in the chain rather than just the leaf, and an anchor that exists but fails to load keeps the old fail-closed behaviour. A pushed anchor only reconnects when the transport of the live connection actually changes, judged against that connection's own target rather than the process-wide switch. This was verified end to end against a freshly generated client with an empty registry: the first connection was a TLS 1.2 ClientHello 0.2 s after start, and a four-certificate fullchain loaded all four blocks. Re-verified after the per-connection rework with the anchor block patched into a debug client: with a matching master the first bytes are a ClientHello, with a foreign master the client logs the skip and sends plaintext, and a domain master resolves to the IP it connects to and still matches. A master domain that no longer resolves falls back to plaintext within a second and is not looked up again for a minute, instead of stalling every reconnect on a DNS timeout while holding the lock the certificate verification needs. Co-Authored-By: deepseek-flash |
||
|
|
46f4bf2dfb |
Fix: Make the WebSocket transport reachable and bounded on every platform
The POSIX clients were built without a connection config - Linux, macOS and Android all construct IOCPClient without the injected CONNECT_ADDRESS - so ConnectServer saw protoType -1 and quietly dialled the master port in plain TCP. Setting protoType to WS in their settings did nothing and logged nothing, and since CLIENT_CAP_PROTO_SWITCH is Windows-only the server could not move them either. Give the client a SetDefaultProto() for that construction path and call it from all three mains before the reconnect loop, with a one-shot log when neither a conn nor a default protocol is available so the silent fallback becomes visible next time. Bound what a peer can make the client read. ReadHeader accepted the 8-byte extended length and rejected only the sign bit, so a frame length of nearly 2^63 kept the connection streaming into a frame that would never end - alive but never delivering another packet. Cap single frames at 256 MB, the same value ServerWsSession already applies to client frames, and drop the connection past it; real traffic is far below that. Stop Reset() from writing the receive thread's frame state. Disconnect() can run from the heartbeat or command thread, not just the receive thread, so Reset() now only flips the atomic ready flag and a new ResetFrames() clears m_remaining, m_masked and m_maskPos from Handshake() alone, before the receive thread starts reading the socket. Those fields keep a single owner without adding a lock to the receive hot path. Finish a dead WS session instead of leaving it to the keepalive timer. When the session had closed but wsState was still WS_Ready, sends were dropped and nothing woke the pending recv, so a peer that closed and then went quiet held the context for the 3-minute keepalive. shutdown() the socket there so the recv returns zero bytes and the normal -2 teardown runs; RemoveStaleContext would deadlock against the caller's own IoRefCount and can hand back a reused context. That shutdown only finishes the connection if a zero-byte read still tears it down, and on the plain path it no longer did. DispatchPlain answers an empty buffer with "handled", so a peer's FIN left the connection in CLOSE_WAIT until keepalive - holding an IOCP context, a pending WSARecv and a rate-limit slot - where the pre-WS code called ParseReceivedData and tore down at once. Restore that teardown on the TLS_Plain branch, matching the other two. Checked against a Debug server: a plain socket that half-closes used to sit in CLOSE_WAIT with the peer's recv timing out, and now disappears immediately with recv returning zero. Two smaller cleanups from the same review. Give the WS upgrade its own prefix buffer (wsPreClassify) instead of borrowing the TLS sniffer's, which was serially reused for two state machines and read as if it were one. And stop deriving the build dialog's protoType from the combo box index: items now carry the protocol value as item data, keyed off the index AddString returns, so inserting an option in the middle can no longer write the wrong number into the generated client without any error. ApplyProtoSwitch loses its bool return, which contradicted its own side effects and was ignored by every caller. Co-Authored-By: deepseek-flash |
||
|
|
50a489e316 |
Fix: Close the gaps the WebSocket transport review found
Three of the findings only bite in deployment. First, the client's TLS and WebSocket handshakes run synchronously on the reconnect thread with no socket timeout, so a peer that accepts TCP and then goes quiet (black-holed proxy upstream, middlebox that only receives) blocks recv() forever and stalls the reconnect loop until the process is restarted. Set a 15 s SO_RCVTIMEO and SO_SNDTIMEO for the handshake window - the same value both server handshake threads use - and clear them once the connection is up so the worker thread's select plus blocking recv keeps working as before. Second, per-IP rate limiting counted the getpeername address before the real device was known. Behind a same-host reverse proxy that address is loopback, which IPWhitelist always trusts, so WS traffic was neither counted nor banned; behind a remote proxy every device shares one bucket, and tripping the threshold disconnected all of them. Count and ban by the forwarded device IP once the upgrade resolves it, mirroring the Go server's limitDirectPeer and handleConnection split. Direct connections keep their accept-time count and are not counted twice. Third, the protocol switch disarmed its five-minute auto-revert as soon as the new entry connected, which only proves TCP/TLS/WS handshaking finished. If login is never accepted there (wrong backend, reverse proxy pointing at some other WS service), the revert could never fire and the client would keep retrying a dead entry. Disarm on the first CMD_MASTERSETTING instead, which the server only sends after adding the host to its online list, and re-check it on every heartbeat so a late one still counts. The smaller items came along: free the handshake parameter when CreateThread fails in both handshake starters, move the WS_Handshaking fail-closed guard ahead of the TLS branch so it also covers WSS (where tlsState is already TLS_Ready), generate the frame mask from a per-channel PRNG inside the send lock instead of an unseeded global rand(), make the transport flags and the WS session's ready flag atomic, drop rather than send unframed application bytes when a WS session has closed, and abort a protocol switch whose PEM fails to load instead of moving to an entry that cannot connect. The Go server now bounds the upgrade sniff even when ReadTimeout is zero, and the design doc records the two-stage limiter, the login-based disarm and the review items that stay as known limits. The protocol switch's input prompt is cut down to "reverse-proxy entry (host:port)" - the label static is only 81 dialog units wide, and the old sentence ran to roughly three times that. The three language files follow: en_US and zh_TW gain the shortened prompt and drop the long key it replaced, the German file gains the protocol-switch block it never had, and its WebSocket tip key is corrected - it had picked up a Go-server clause the source string never carried, so the tip was never translated at all. Co-Authored-By: deepseek-flash |
||
|
|
99db28e2e2 | Feature: Let the operator switch a live client's transport from the online list | ||
|
|
cc891e3670 | Feature: Sniff WebSocket upgrades on the MFC server's device port | ||
|
|
d4f312c9d8 | Feature: Tunnel the device protocol through a reverse proxy over WebSocket | ||
|
|
1d875ddbd1 |
Feature: Add a "Copy Name" item to the online host context menu
The online list already lets an operator copy everything about a host through "Copy Client Info", but there was no quick way to grab just the names, which is what people actually paste into a chat or a ticket. The new menu item sits directly below "Edit Group" and copies the names of all selected hosts to the clipboard, separated by semicolons. "Name" means what the first column of the list shows: the remark when one has been set, otherwise the computer name. The column text is CP_ACP, so the handler decodes it the same way OnGetdispinfo does; that keeps the copied text identical to what is on screen, including for Chinese remarks. Clipboard writing reuses the existing UTF-8 based SetClipboardText helper instead of growing a third copy of the same CF_UNICODETEXT code. The item also gets its own 16x16 icon (two stacked cards with text bars, drawn on the usual 240,240,240 background) loaded into a newly added m_bmOnline[75] slot, and translations were added for English, German and Traditional Chinese so the item does not fall back to simplified Chinese when another UI language is active. The user manual and the resource README were updated to match. Co-Authored-By: deepseek-flash |
||
|
|
dcb5ae25c6 |
Fix: Paginate get_activity_history results
The tool was the only list-type tool without pagination. The client keeps ACTIVITY_HISTORY_MAX=500 records and Dump() prepends the in-progress window, so a single call returned up to 501 lines of "[time] [title] duration" -- enough to blow up the caller's context, especially since titles carry personal browsing history. Records come back newest-first (m_records uses push_front and the current window is prepended), so the standard limit/offset window applies directly: offset=0 is the most recent page, no need to read total first and count backwards. That ordering is now stated in the tool description so the model can rely on it. - inputSchema: BuildGetHostDetailInputSchema -> BuildPagedHostListInputSchema (adds limit, default 100 / max 1000, and offset) - outputSchema: append AppendPageOutputProps plus truncated - implementation: rename the full split to `all`, slice via ResolvePageWindow and ApplyPageWindow, write back with WritePageFields - activityHistory is rebuilt from the window instead of returning the whole Dump() text -- otherwise the raw copy would bypass pagination entirely - 64 KB byte budget (same as get_client_log), trimmed from the end so the newest records survive; hasMore is computed as offset+kept < total rather than hardcoded true, since a single oversized tail record must not claim there is another page Batch calls need no extra work: the tool is already in IsBatchReadOnlyTool, and BuildBatchCall forwards limit/offset to each host, so ids + limit means "the latest N records of every host". Compiles clean; not yet exercised against a running server (the exe was locked by the live instance). Verification cases are listed in docs/Mcp_Test_Report_2026-10-29.md section 8. |
||
|
|
56a937fabb |
Fix: Three blocking defects found by the MCP tool survey
The survey in docs/Mcp_Test_Report_2026-10-29.md turned up three P0s, each
of which stopped a whole capability rather than degrading it. Two of them
were the same mistake: the input schema promised something the output
schema then rejected. The third was an output with no size limit, plus a
client that never implemented the command at all.
Batch calls could never succeed. A call carrying ids[] goes through
BuildBatchCall, which returns {tool, total, succeeded, failed, skipped,
results[]}; every tool declares only the single-host shape. The client
validates structuredContent against that declaration, so any batch call
failed with -32602: data must have required property 'host' - the input
schema advertises ids, the output schema kills it. Tools/call cannot fix
this one call at a time, so ApplyBatchOutputSchema runs at the end of
tools/list, next to ApplyToolAnnotations, and rewrites the schema of every
tool in the batch list to {type: object, anyOf: [single, batch]}. Placing
it at the end is what makes it cover all three registration points
(inline, McpMachine, McpChat) and any tool added later. IsBatchReadOnlyTool
moved from McpServer.cpp to McpInternal.cpp for the same reason: the list
is now read by tools/call and tools/list, and the two must not drift.
list_registry failed whenever path was omitted. The root-key branch
returns keys only, while the output schema listed values in required as
well, so the first usage the documentation describes - omit path, get the
five root keys - could not work. values is no longer required and the
schema says it is absent in that branch. The root branch also returns
path: "" now, so both branches carry the same field set and callers need
not branch.
get_client_log was unusable on both platforms, for two unrelated reasons.
Windows returned the whole 1000-line ring buffer, 90,473 characters, over
the client's result limit: fetched, then not deliverable. Linux and macOS
timed out because their clients never handled COMMAND_QUERY_LOG at all -
only client/ClientLogManager.cpp does - so TOKEN_REPORT_LOG never arrived.
Adding a limit alone would have left Linux broken; fixing the client alone
would have left Windows over the limit.
The server now takes limit (default 200, max 2000) and filter, and reads
backwards from the end: troubleshooting wants the last thing that happened,
not the first line after boot. A 64 KB byte budget sits under the line
count, because one line can be a stack dump; when the final line alone
exceeds it, the tail is returned and truncated says so. Responses carry
lines_total, lines_matched, lines_returned and truncated. The timeout
message now names the likely cause and two ways around it instead of
saying only "Timeout waiting for client log".
The POSIX clients get common/ClientLogHandler.h, a counterpart to the
Windows CClientLogManager, and one line each in linux/main.cpp and
macos/main.mm. It must open a sub-connection: MessageHandle's
TOKEN_REPORT_LOG branch takes the first packet and then calls CancelIO on
that connection, so answering on the main connection would close the main
connection and drop the client offline.
Verified against a server built at 21:17:21 with both clients rebuilt. A
batch get_host_detail over the two A6 records returns succeeded=2 with
per-host data; host_list_processes with ids returns 2 of 2, which exercises
the McpMachine registration point rather than the inline one; a mixed
Windows/Linux batch of get_client_log returns 2 of 2. list_registry with
no path returns the five root keys and path ""; with a path it still
returns its values. get_client_log on Windows goes from 1000 lines to 200
with truncated=true, and limit=3 with filter=ConnAuth yields 28 matched and
3 returned. On Ubuntu 24.04 it returns logs at all, and the client's own
log shows Enter ClientLogThread, TOKEN_REPORT_LOG, then Leave about a
second later when the server cancels the connection - paired, no leak.
The connector still caches an old input schema for get_client_log, so
limit and filter are rejected locally until it reconnects; the defaults
already cover the P0, and this is the same cache problem as the
copy_files_c2c.overwrite entry in the report's P1 list.
docs/Mcp_Design.md section 18 records the implementation and the reasoning;
section 7 of the test report carries the verification table.
Co-Authored-By: deepseek-flash
|
||
|
|
dc4fd792f6 |
Feature: Implement the Linux screen preview response
The Linux client now answers COMMAND_SCREEN_PREVIEW_REQ, so a host with an X11 desktop gets a thumbnail when it is double-clicked in the online list, a frame in the list's Preview column, and an image from the MCP get_screenshot tool. Previously only Windows clients advertised the capability and Linux hosts showed "预览不可用" after a four second wait. The client does not encode JPEG. Stock desktops ship libjpeg.so.8 whose struct layout is the distribution's ABI (JPEG_LIB_VERSION 80), while the in-tree jpeglib.h is libjpeg-turbo 3.1.1 (62), and libturbojpeg is not installed by default; dlopening the system library against that header fails with "Wrong JPEG library version: library is 80, caller expects 62". Instead the client sends raw pixels in a new screen preview format, SCREEN_PREVIEW_FMT_BGRX: top-down rows of B,G,R,X with no row padding, already scaled to the requested width. The server re-encodes to JPEG at the single ingress point, so the preview popup, the list thumbnail cache and the MCP tool keep consuming JPEG only. Capture follows the path ScreenHandler already uses: root window copied into an offscreen pixmap with an IncludeInferiors GC, then XGetImage, which avoids BadMatch under compositing window managers. The X11 type declarations and the dlopen loader moved out of ScreenHandler.h into linux/X11Loader.h so both users share one dlsym table. The full-size image is never materialized: a box filter reads straight from the XImage rows (honouring bytes_per_line) into the output buffer, scales to maxWidth without upscaling, and clamps the height to 1080 so a portrait 4K desktop cannot produce a 26 MB packet. Rows and columns come out even, which they are for JPEG anyway. The capability bit is now honest about the runtime. LOGIN_INFOR grows DefaultCaps()/SetCaps(), and the client recomputes the bits before every login and re-login: CLIENT_CAP_SCREEN_PREVIEW is set only when DISPLAY is present and the X server actually opens. A headless host therefore gets -32005 "Host does not support screen preview" from MCP instead of a timeout, and a host whose session appears after boot picks it up on the next reconnect. Requests are handled on a detached worker thread behind a single-flight guard (matching the Windows client), so a slow XGetImage never stalls the receive thread and a burst of requests degrades to "no preview" rather than queueing. If the worker thread cannot be created, the guard is released again, so one failure cannot leave every later request rejected as busy until the client restarts. The MCP design note claimed the capability was declared by Windows only, and the get_screenshot tool description said the same; both now say what the code does (Windows always, Linux when a display is reachable). Server side, NormalizeScreenPreviewPacket runs in MessageHandle before the MCP handoff and the PostMessage to the UI thread. It validates that width/height are within the values the server itself can ask for and that bytes equals width*height*4, converts with a stack Gdiplus::Bitmap over the packet's own pixels (no copy, and no DEBUG_NEW trouble), and rewrites the header to JPEG. The encoder output is read back by seeking the stream rather than GlobalSize, so the packet carries no heap-block padding after the EOI marker. Malformed packets are dropped; failure statuses pass through untouched so the existing code can report them. Tested against a Debug server with the WSL Ubuntu 24.04 build as the client. get_screenshot returned valid JPEGs at max_width 480 (480x142, 1.7 KB) and 1920 (1920x570, 17.9 KB), repeatably; the list showed a thumbnail for the GUI client and N/A for a second copy started without DISPLAY, which also answered -32005. The box filter and the BGRX to JPEG conversion were checked separately with quadrant fixtures: the browser over the synthetic B,G,R,X buffer recovers red/green/blue/white in the right channels and the downscale averages, handles non-integer ratios and row padding, and rejects 24bpp and upscaling. The captured frames come out black under WSLg because Xwayland keeps no root pixmap there; that is the compositor, not this code, and Xorg sessions capture normally. Co-Authored-By: deepseek-flash |
||
|
|
13c02fe50b |
Feature: Skip already-present targets in copy_files_c2c
The destination writes every chunk unconditionally, so a second call with the same arguments re-sent the whole file and returned exactly the same result as the first. Measured on an 11 MB log: the target's mtime moved and the entry count did not, and the caller had no way to tell a real transfer from a repeat. upload_file and download_file already answer this with overwrite/skipped; copy_files_c2c was the one that did not. The skip decision has to be made on the server, because the receiving end does not check whether the file exists. Before opening the transfer, a default call now lists one level of dst_dir through ListRemoteTopLevelNames - the helper upload_file already uses - and drops the paths whose basename is already there. If everything is dropped the call returns success without creating a transfer id at all, so no host is occupied and nothing is sent. overwrite=true restores the old unconditional behaviour. Name comparison follows the destination filesystem: folded on Windows, exact on POSIX. That needed a foldCase parameter on the helper, defaulted to true so upload_file keeps its behaviour. dst_dir is handed to the listing without its trailing separator, because the client concatenates "%s\*.*" and a trailing one produces "C://*.*", which FindFirstFile rejects. search_file hit the same thing. No protocol change and no client change: the packet layout, the receiver and both client platforms are untouched. Verified against a real server (build 2026-10-29 14:34:33) with a Windows 11 source and both an Ubuntu 24.04 and a Windows 11 destination. A second default call returns file_count=0, skipped=1, an empty transfer_id and skip_check_failed=false with the target's mtime unchanged; overwrite=true advances the mtime (1793276909 -> 1793281657) and reports skipped=0; a call into a non-existent directory creates it and lands the file flat; a Windows destination folds case, so a placeholder SETTINGS.INI makes a later settings.ini skip, while a POSIX destination leaves both files side by side. One documented case does not hold, and the expectation was mine rather than the code's. "Destination occupied by another tool" was supposed to fail the pre-check and still transfer with skip_check_failed=true, but BeginC2CTransfer consults the same m_Pending registry for src_id and dst_id, so the transfer is refused with -32003 before the fallback can carry it. The other door - a directory that can be written but not listed - showed the pre-check succeeding instead of failing: the Linux client reports EACCES as an empty directory rather than TOKEN_FILE_LIST_ERROR, so the call goes on to overwrite. skip_check_failed is therefore a timeout backstop that is hard to reach deliberately; the field stays, and 14.9.2 no longer claims that a busy host reaches the fallback. Section 14.9 of the design doc records the contract, those results, and one wrong turn worth keeping: an earlier round concluded that single-file C2C nested the whole absolute path under dst_dir, and added receiver-side hardening for it. The nesting came from the ad-hoc JSON-RPC test harness, which passed JSON on the command line where the shell folded \\ into \/ before Python parsed it, so the source client received a path with no backslashes left and its basename fallback - which looks for a backslash - returned the whole path. The same file sent through the real MCP client produces a clean basename. That hardening has been reverted; the defect was in the test, not the product. Co-Authored-By: deepseek-flash |
||
|
|
cd10d0cc1b |
Docs: Bring the MCP plan up to date after P10 and P11
The plan was written when the server had 54 tools in eight families, and every batch since then changed the facts it states: P10-B added the three file-write tools, P10-C the input lock, P11 the two session tools and the protocol work. Read as-is, the plan would send the next person looking for work that is already done, so the numbers, the family table and the batch table now describe the 60 tools that actually exist. The family table was rebuilt from the registration sites rather than from the previous table: nine families, and the gating column now separates "appears in tools/list" from "callable", which the old table conflated. That distinction also fixes the default-config figure - 19 tools, not the 20 stated earlier: get_keylog needs McpKeylog, download_file needs McpFileTransfer, and list_network_connections lives in the McpMachine family, so with a default of read-only and every switch off only the nine server-local read tools, eight read tools on the host and the two remark/watch tools remain. Section 5.10's field list for mcp_list_sessions was a guess written before the tool existed; it now carries the eight fields that D.5 actually returns, with the original guess kept so the change is visible. The two stale rows in 5.14 and the outdated header comment in 5.13 are marked done against the commits that did them - |
||
|
|
1c832ff7f2 |
Feature: Add MCP cancellation, progress notifications and dry runs
P11 closes the plan's last batch, entirely on the server side: no client change is required for any of it. Long-running tools now expose a cancellation flag that every wait loop checks in 500 ms slices. A cancelled tool returns through the cleanup branch it already had (late first packets still get absorbed, sub connections still get closed, pending entries still get deleted), so there is no second cleanup path to keep in sync, and the host is released within a second. Three sources set the flag: notifications/cancelled (matched on the exact JSON-RPC id, with a fallback to the display form so a request_id copied out of the session list round-trips), mcp_cancel_session (by request_id, host id or session id), and a failed SSE write when the client has gone away. The dispatcher rewrites a cancel-induced failure to -32800 so callers do not mistake it for a host fault. tools/call requests carrying _meta.progressToken are answered as text/event-stream on the same POST: the tool runs on its own thread and both the notifications/progress events and the final JSON-RPC response go out through one chunked provider. Requests without a token are unchanged. download_file reports files done vs. expected, upload_file reports bytes sent vs. total. Two new local-only tools, mcp_list_sessions and mcp_cancel_session, list and cancel in-flight sessions (calls, pending one-shots, terminal, remote control, file transfer, chat). They are deliberately not gated by the feature switches or readonly mode, since that is the only way out of a stuck request. The -32003 busy message now names the occupier: "Device busy: ... (tool=download_file, elapsed=12s)". power_action gains wait/wait_ms to verify the result against the main connection's presence (went_offline, came_back, elapsed_ms); not seeing the transition is reported as ok, not as a failure. kill_process, operate_window and the four host_control_* tools accept dry_run, which validates the target against one fresh snapshot and returns what would be affected without sending anything. Validation rejections now use -32012; -32008 stays as documented historical alias. One implementation note worth recording: the per-thread call context uses FLS, not thread_local. Any static thread_local in this server crashes the process about a second after start, because some threads come from shellcode/MemoryModule images that never ran PE TLS initialisation. Verified against a real Debug server and a real Windows client over MCP: the smoke test now passes 104 checks with 0 failures, including cancellation releasing the host in under a second, the cancelled request returning -32800, notifications/cancelled returning 202, 63 progress events with exact byte counts for a 64 MB upload, and a cleanly terminated SSE stream. Not exercised in this pass: power_action's wait=true path (it would take the test host down) and the -32006 readonly/switch-off section (every switch was on during the run). Co-Authored-By: deepseek-flash |
||
|
|
4a3cded174 |
Docs: Plan the next MCP phase, with its claims checked against the code
Mcp_Next_Plan.md lays out what the MCP surface can still gain and how the
existing tools can be improved: a full client-command coverage matrix, a
file-system write batch, a remote-control gap, and a list of protocol-level
blanks. Every conclusion is tied to a file and line so the next step can be
implemented without re-deriving the analysis.
The first draft was written from a read of the code but not verified against
it. Auditing it turned up four claims that would have sent the work in the
wrong direction, and they are corrected here rather than left to be discovered
during implementation:
- The draft wanted a mode=offline for get_keylog because "the tool only sees a
1-15s live window". That premise is false. CKeyboardManager1 builds its
CircularBuffer from the on-disk record file, and SendData replays the whole
buffer from position zero on every (re)connect, so the existing tool already
returns the persisted history whenever kbrecord=Yes. What is actually missing
is only the on/off switch, the clear command, and reporting the state the
client already sends in TOKEN_KEYBOARD_START byte 1.
- Unlike P7, the file-write tools do not plug into OnSystemReady: their ready
packet is TOKEN_DRIVE_LIST, which lands in OnDriveList, where an empty path
is currently read as "list drives" and consumed. Worse, the three finish
tokens have no case at all in the top-level dispatch, so on the MCP path
(hDlg == NULL) they fall into default: and the sub-connection is never
closed. Appendix C now spells out the three wiring layers that every
sub-connection write tool has to touch.
- -32008 carries two meanings, not four: both remaining sites are argument
validation, and the multi-monitor rejection was already moved to -32005.
Dropping the proposed -32013 removes a whole error-code split.
- The draft put server gate state into get_host_detail, duplicating the
switches object that get_server_status already returns; monitors and most
per-host facts are already there too, so capabilities shrinks to the
client's own ability bits.
It also records what the audit added: delete_path inherits the client's
unbounded wsprintf when recursing (the search path got a length guard in
|
||
|
|
6bfa4294cc |
Feature: Switch a Linux client's transport TLS at runtime
The server's TLS menu already wrote the trust anchor into the Windows client's registry and expected a restart. The Linux client grew the same command handling (166/167) but, like Windows, only read the anchor once at startup, so enabling or disabling TLS still meant restarting it. Both handlers now take effect immediately. TlsChannelLinux.cpp no longer initialises through std::call_once. The process-level state (context, enabled, load error) lives behind a mutex and TlsReload() rebuilds it from whatever anchor file is on disk, so TlsEnabled() reflects the new transport as soon as the anchor is written or removed. In-flight sessions survive the swap because SSL_new increments the SSL_CTX reference count; the unit test pins that down by keeping an established TLS connection open across a reload that frees the old context. A reload that hits a bad anchor keeps the previous state and only logs: one bad push should not brick a working client, and the next start is still fail-closed. The pushed PEM is parsed before it is written for the same reason -- a corrupt anchor on disk would lock the client out of the server with no way to correct it remotely. Only a real transport flip (plaintext <-> TLS) asks for a reconnect. An anchor swap alone, as in a certificate rotation, leaves the current session alone and applies to the next connection. The receive thread never closes the socket itself; it sets g_needReconnect and the main heartbeat loop disconnects so the outer reconnect loop can re-handshake, matching how the heartbeat timeout path already works. IOCPClient now latches the transport per connection (m_useTls) at handshake time instead of consulting TlsEnabled() on every send and receive. Without the latch, the second or so between the reload and the reconnect would push plaintext into an established TLS session, or the reverse, producing protocol errors for no reason. RES_TLS (szReserved[19]) is refreshed right before each login, including the resend after a group change, so the TLS column on the server flips with the transport instead of showing the value from process start. The confirmation dialogs now say what each platform does, with translations in en_US, zh_TW and de_DE; the keys carry the literal \n escape the INI parser understands. Ending a sub-connection is not an error. OpenSSL 3 classifies a peer that closes without close_notify as an unexpected-EOF protocol error, so every terminal or file transfer session logged an SSL_read failure on the real servers even though Recv promises 0 for a plain close and neither side sends close_notify. SSL_OP_IGNORE_UNEXPECTED_EOF restores the intended semantics. Verified with the reload unit test (RELOAD-OK, covering the in-flight connection across a context swap, garbage payload rejection and a broken anchor keeping TLS alive), an abrupt-close test (recv now returns 0 instead of SOCKET_ERROR) and end to end against a protocol-faithful fake server that signs MasterSettings with libsign: plaintext login, 166, TLS reconnect with RES_TLS=1, 167, plaintext reconnect with RES_TLS=0. The Linux client, the Debug Windows client and the Debug MFC server all build. The cost is inherent to taking effect immediately: a remote session in progress is dropped when the transport changes, and the MFC server briefly shows the client as a duplicate login until the old connection is reaped and the standby entry is promoted. Co-Authored-By: deepseek-flash Co-Authored-By: Claude Code <noreply@anthropic.com> |
||
|
|
4d2abf34d0 |
Feature: Support the Tier 1 MCP tools on Linux clients
All of these tools already had a working wire protocol on the Linux
client (SystemManager.h, common/PTYHandler.h, ScreenHandler.h); only the
server-side client-type gates rejected LNX hosts. kill_process,
exec_command, terminal_open/exec/close and remote_open/close/mouse/
keyboard/clipboard now accept LNX and reject only MAC (plus APK where it
applied). No client change, no capability bit.
exec_command and terminal_exec needed platform-aware plumbing because a
POSIX shell understands none of the Windows constructs: the sentinel is
now "PS1=" / the command / "echo __MCP_DONE_<nonce>__$?" over the Linux
PTY, with output decoded as UTF-8. The PS1= line exists because
interactive bash prints its prompt after every line it reads, which
otherwise leaks into stdout; its echo sits ahead of the command echo and
is removed together with it. The Windows ConPTY and legacy non-PTY forms
are unchanged.
The default command whitelist is now platform-specific: identically named
POSIX commands can write files or change system state (find -exec,
sort -o, hostname), so kDefaultCmdWhitelistPosix only lists commands that
stay read-only even with arguments. env is deliberately excluded, since
"env <program>" runs arbitrary programs and would defeat the whitelist
entirely. An explicit McpCmdWhitelist still overrides both platforms. The
forbidden metacharacter set is split the same way: on Linux it covers
& | < > ; backtick and $( / ${ / !, where ! triggers history expansion in
interactive bash. ^ is not a POSIX metacharacter, so read-only commands
like "grep -v ^# /etc/hosts" are accepted on Linux while Windows keeps
rejecting them.
Input injection had to be sent one MSG64 per COMMAND_SCREEN_CONTROL
packet. The protocol allows batching and the Windows client handles it,
but linux/ScreenHandler.h only processes the first message of a packet,
so a batch left key_press stuck down (X11 autorepeat), click
half-pressed and type emitting only its first character. Splitting the
packets is equivalent for Windows, which processes one message at a time
anyway, and keeps already-deployed Linux clients working without an
upgrade.
Verified on a Debug server against a WSL Ubuntu 24.04 client and a
Windows client: exec_command returned real exit codes (0/1/2) with clean
output, -32007/-32008 negatives, and the POSIX-only ^ allowance;
persistent terminals kept cwd and environment, returned 1 for false and
the last exit code for ";" chains, and closed idempotently; kill_process
killed a test process, returned an empty remaining list and skipped
pid 1; remote_open reported 3840x1140, remote_mouse mapped (0.5,0.5) to
(1920,570), xev showed balanced press/release pairs for keys and buttons,
and a Chinese clipboard round-trip came back as UTF-8. The Windows
regression of the same tools was unchanged, including the multi-monitor
gate on remote_open.
Co-Authored-By: deepseek-flash
|
||
|
|
3a158a241c |
Feature: Support upload_file and download_file on Linux and macOS hosts
Both tools used to reject LNX/MAC targets outright. The server now gates on the target client type instead: a POSIX target must pass an absolute POSIX remote path without a backslash or a ".." segment (-32602 otherwise), while Windows targets keep their exact previous behaviour. upload_file needed no new client command; the POSIX receiver already handles COMMAND_SEND_FILE_V2 and derives the destination from the packet name. It now also reports a real receiver_ack: the upload session records dstClientID/transferID, and OnC2CRecvResult matches the 176 acknowledgement from Linux targets, so a destination write failure becomes -32011 and a missing ack (with bytes in flight) becomes -32001. download_file needed two pieces on the POSIX side, both shared by Linux and macOS through common/FileTransferV2.h: a FileCompletePacketV2 per file with a streaming SHA-256 (new self-contained common/sha256_posix.h, since BCrypt is Windows-only) so the server can count completed files and verify digests, and a TOKEN_DOWNLOAD_ERROR reply when the requested paths do not exist or are denied, which the server maps to -32009/-32010 within milliseconds instead of waiting for the stall watchdog. Zero-byte files were lost when uploading to POSIX targets because the worker sends no data chunk for them and the complete packet carries no path, so the receiver had nothing to create. The server now injects a zero-length final chunk for each empty file, only for POSIX targets; Windows targets keep their existing behaviour. Also fixes a download completion edge case found while testing: the client decides entry order, so a directory may arrive after all files (an empty subdirectory, for example), and the directory branch only completed when the directory count alone covered totalFiles. The check is now filesDone + directoryCount >= totalFiles. Verified end to end against a WSL Linux client and a Windows client: upload and download of a tree with a 3 MB binary, a Chinese filename, an empty file and an empty subdirectory all round-trip with matching SHA-256; the documented error paths (-32602, -32009, -32011, -32001) and the Windows upload/download/C2C regressions were exercised as well. Co-Authored-By: deepseek-flash |
||
|
|
4146c73657 |
Feature: Make Linux a copy_files_c2c destination
The C2C file transfer tool required both ends to be Windows clients. A Linux client can already land the files: the Windows source worker builds every entry name by plain string concatenation of dst_dir and the relative path, so a POSIX dst_dir such as /tmp/recv arrives as "/tmp/recv\sub\file", which the POSIX receiver normalizes to "/" and writes below an absolute path. What was missing was the server gate and any way to tell whether the writes succeeded. The server now accepts LNX/MAC destinations instead of rejecting them, and validates dst_dir by destination type: an absolute Windows path for Windows targets, an absolute POSIX path without backslashes for POSIX targets. The paths and dst_dir arguments also reject embedded NULs, and a POSIX dst_dir is converted to CP936 exactly so unencodable characters fail loudly instead of silently becoming '?'. To make receiver_ack meaningful, a Linux client that receives a C2C transfer now reports what it wrote. It tracks the outcome per transferID, counting a directory entry, the last chunk of a file and the completion packet of an empty file as the three ways an item is settled, with done sets so that source retries and the trailing completion packet never double count. When every item is settled it sends one C2CSendResultPacket back on its main connection under the new TOKEN_C2C_RECV_RESULT (176), with the first errno in the win32err field and the mapped FEV2_* status. A dedicated token is used instead of reusing 175 because a host can be the destination of one transfer while being the source of another, and a destination result must never latch the source side's done flag. The server waits up to five seconds for that acknowledgement after the source reports success, and only for destinations advertising the new CLIENT_CAP_C2C_RECV_ACK capability bit (Linux only, macOS reports nothing). A failed acknowledgement becomes -32011 with the status, errno and received file count; a missing acknowledgement stays an error only for transfers that actually moved bytes, since a transfer of empty files alone gives the receiver nothing to learn totalFiles from. Windows destinations are unchanged and skip the wait entirely. Verified on the debug instance: Windows to Linux (WSL Ubuntu 24.04) with subdirectories, an empty directory, a Chinese file name and a 3 MB binary lands with matching SHA-256 and receiver_ack true; a Windows-style dst_dir returns -32602; an unwritable POSIX destination returns -32011; the existing Windows to Windows cases still pass with receiver_ack false and the same latency. Co-Authored-By: deepseek-flash |
||
|
|
c271911fcb |
Feature: Add copy_files_c2c to transfer files between clients directly
Adds the 54th MCP tool, copy_files_c2c, which asks the source client to push a set of files straight to another online client. Previously the only way to move files between two clients was to download them to the server machine and upload them again, so the data crossed the wire twice and needed free disk on the server. With C2C the server only relays packets and never parses or stores the payload. Protocol. Two new ids in common/commands.h: COMMAND_C2C_SEND_FILES (174), carrying the destination directory followed by a NUL-separated path list, and TOKEN_C2C_SEND_RESULT (175), a fixed 45-byte result packet sent back over the same sub-connection the transfer used. Clients advertise support with the LOGIN_INFOR capability bit CLIENT_CAP_C2C_PATHS (0x0008), exposed server side as Context::SupportsC2CPaths(). File transfer V2 already knew how to push to dstClientID, so the destination side needed no change at all; existing V2 receive paths keep working, and older clients simply do not advertise the bit and are rejected with a clear error instead of hanging. Client. OnC2CSendFiles expands environment variables, collects directories recursively, opens its own sub-connection (with sub-connection auth), and runs FileBatchTransferWorkerV2 in a detached thread, then reports the result on that same connection. Every early exit now reports a structured failure rather than staying silent. The worker needs the process-level InitFileUpload call that the receive path performs lazily, and a source client may never have opened a file manager or received an upload, so the initialization is factored into EnsureV2TransferInited() and called from both paths. Server. copy_files_c2c mirrors the existing upload tool: gates, id parsing, capability checks, path validation, then a session keyed on the source host that WaitC2CDone polls until the result packet arrives. The C2C relay branch used to attach a CDlgFileSend progress dialog to the source's sub-connection; NotifyProc then routed every later packet on that connection to the dialog, which parsed the result packet as a V1 file chunk and dropped it, so the tool always timed out even though the files had arrived. IsC2CTransferPending() now suppresses dialog creation for MCP-driven transfers only, leaving manual Ctrl+V transfers untouched. Errors map to -32001 for a source-side transfer failure, -32010 for access denied, -32009 for a missing path and -32002 for an offline destination. Both hosts must be Windows: the destination is restricted too, because the source embeds dst_dir in each V2 chunk name as an absolute Windows path and only the Windows receiver applies it literally. A Linux or macOS receiver never gets a target directory here (the clipboard flow sets one with COMMAND_C2C_PREPARE, which this path does not send), so it would strip the drive letter and write under / instead. Supporting that needs a prepare packet carrying an explicit path plus an upgrade of those clients, so for now the tool rejects them with -32005 rather than writing somewhere wrong. Verified end to end on the Debug build: three files including a non-ASCII name, an empty directory and a 3 MB binary arrived with matching SHA-256 in 3.2 s, a non-existent destination directory was created, and the negative cases returned the documented codes. mcp_smoke.ps1 passes 41/41 with two new assertions and 27/27 in -SkipHost mode. Design notes, error table and limitations are in docs/Mcp_FileTransfer_Design.md section 14 and docs/Mcp_Design.md section 15. Co-Authored-By: deepseek-flash |
||
|
|
27d40f5678 |
Fix: Expose tool payloads in the content text block
List and query tools put only a human summary in content and kept the real payload in structuredContent. Clients that hand just content to the model (WorkBuddy does) therefore never saw a host id: search_hosts answered "1 host matched" and every follow-up tool was out of reach, and guessed ids 1-3100 could never work because host ids are 64-bit snowflake values. BuildResult now appends the serialized structuredContent as a second text block, as the MCP spec recommends for tools with structured output. The append sits in the single result choke point, so every tool in McpServer, McpMachine and McpChat gains it, including future ones; empty action results such as remote_mouse keep their bare "ok". Tools whose text already carries the payload expose only the difference: exec_command and terminal_exec add exit_code, get_keylog adds counters, get_activity_history exposes records without the duplicated raw dump, and the hosts file reader drops its copy of the content. The override rides in a $ key that BuildResult consumes and removes, so responses change only by the extra block. Verified on a Debug instance: list_all_hosts, search_hosts, get_server_status and list_registry return parseable JSON in content[1] with ids intact, and tools/mcp_smoke.ps1 -SkipHost passes 27/27 with four new assertions. Co-Authored-By: deepseek-flash |
||
|
|
a7dd86ff0f |
Feature: Terminate TLS for the MCP endpoint inside YAMA
MCP was served by a plain httplib::Server, so remote clients could only use cleartext HTTP. YAMA now terminates TLS itself: a small front-end owns the MCP port, sniffs the first byte and either runs a Schannel handshake and forwards the decrypted bytes or passes plaintext through, with httplib moving to a loopback-only internal port. No OpenSSL, no frp change, existing local HTTP clients keep working, and an unusable certificate fails closed instead of falling back to cleartext. The identity loader grew the two things a public certificate needs. ECDSA (P-256/P-384/P-521) keys are persisted by importing PKCS#8 with an NCRYPTBUFFER_PKCS_KEY_NAME parameter, the only route MS Software KSP supports for Schannel; RSA keeps its old export-and-repersist path. Fullchains are accepted, and the intermediates are added to the current user's CA store so Schannel, which builds chains only from system stores, actually sends them. The shared handshake also now buffers a full TLS record before the first AcceptSecurityContext, which a partial ClientHello would otherwise poison (SEC_E_UNKNOWN_CREDENTIALS). Session resumption exposed a second trap: when a client resumes a session, ChangeCipherSpec, Finished and the first application record arrive in one segment and AcceptSecurityContext leaves the application record pending in the session. Nothing drained it, because both callers only decrypt when new ciphertext arrives, so the request waited until the peer gave up (the MCP front-end saw no request at all and the client reported "fetch failed (other side closed)"; the device port had the same hole behind its occasional login timeouts). Decrypt now drains pending data on len == 0, and both the front-end and the device port's handshake thread use it before entering their receive loops. Configuration is McpHttps, McpCertPath, McpKeyPath and McpInternalPort, the first three editable in the MCP settings dialog (the certificate rows stay greyed out until HTTPS is enabled and saving rejects missing files). Verified with a real Let's Encrypt ECDSA fullchain (53 tools over TLS, 401 with no or bad token), a local three-level chain whose intermediate was absent from the store, Node 24's fetch on a resumed session (initialize, notifications/initialized and tools/list all complete), and the device port's RSA handshake as a regression check. Details in docs/Mcp_Design.md section 13. Co-Authored-By: deepseek-flash |
||
|
|
b4cb34fea9 |
Fix: Stop MCP tool timeouts from popping MFC dialogs
A sub-connection's first packet doubles as the readiness packet: the file, service, registry, process, log and terminal tools all get answered that way. Once a tool has given up (timeout or failure) its pending entry is gone, so if the client only gets around to sending that first packet afterwards, MessageHandle cannot tell it apart from a human click and opens the matching modeless dialog - a File Manager window appeared while timeouts were being exercised on this machine. The wait paths now record, per device, which first-packet token the abandoned tool would have sent (MarkLateFirstPacketForTool from WaitPending, WaitPendingRegistry, WaitPendingWrite, WaitFileTransferDone and WaitTerminalReady), and every dialog-opening case consumes that marker before falling back to the MFC path. The marker is one-shot, expires after five minutes and is never set on the success path, so normal use is unaffected; the worst case is that a single manual open on a host that just had an MCP timeout is swallowed. ClientMsg packets are dropped with a log line while a tool is pending for that host: new clients still send the legacy popup message alongside the structured failure token, which would otherwise put a modal box on the server UI during an MCP call. Co-Authored-By: deepseek-flash |
||
|
|
1456882f16 |
Docs: Record the structured failure protocol and -32010
Spell out the new token layout and who sends it, add -32010 to the error table, and narrow -32008 to parameter validation now that capability limits report -32005. Document McpToolTimeoutMs as an ini-only key and correct the note about where the list_files 500-entry cap is applied. Update the remote-control design and the test report so P2, P6 and P8 show as fixed with the measured evidence. Co-Authored-By: deepseek-flash |
||
|
|
eaa10cc7d3 |
Fix: Make the MCP command sentinel robust and fail stalled downloads fast
Re-verified every finding of the 2026-10-25 MCP test report against the source and then end-to-end on the Debug instance, and fixed the ones that live on the server. P1/P3/P4 share one root cause: the sentinel was appended to the command line, so any command that swallows the rest of its line (rem, cmd /c, if, for) swallowed the sentinel too and the call always timed out. On ConPTY clients the command and the sentinel are now sent as two lines, the sentinel prints %errorlevel% (whose echoed text is a literal template, not digits) so folding echo can no longer be mistaken for the sentinel, and FindSentinel returns the real exit code (9009, 1, 0, ...) instead of 0/1. Old non-PTY clients keep the single-line form, since their echo skipping depends on the write length. ConPTY also returns a rendered screen stream rather than a byte stream, so stripped VT sequences leave duplicate text behind; output cleaning now cuts through the echoed command line, strips the echoed sentinel line and erases any leftover sentinel text by its per-command nonce. StripAnsi no longer leaves the backslash of an OSC terminated by ST. A terminal session destroyed by a timeout used to report the same "not found" text as a typo in the session id; a 600s tombstone now says what happened instead. download_file gets a stall watchdog: no data for 60s fails with a clear message and releases the host, where a missing remote path used to hold the whole host for the full 600s default timeout. Also corrects the get_activity_history annotation (it does reach the remote host), completes the -32007/-32008/-32009 error table, documents the sentinel design in Mcp_Design.md 12.1, and corrects the report's claim that the tools blocked during a transfer are local DB reads -- they are remote machine-manager fetches, and purely server-local tools are unaffected. Co-Authored-By: deepseek-flash |
||
|
|
1c5fab1645 |
Fix: Stop the client dropping chat messages that begin with e
CChatManager::OnReceive opened with the same heartbeat guard the other managers use, `if (szBuffer[0] == TOKEN_HEARTBEAT) return;`, before it looked at the length. TOKEN_HEARTBEAT is 101, which is also the letter e, and this channel carries free text rather than command bytes, so every message starting with e -- "echo", "error", anything -- was silently discarded. The sender never learned: the server's chat dialog had already written the text into its own log, so the two sides disagreed about what was said. The guard is dead code here. Heartbeats travel on the main connection only, as a multi-byte [101][Heartbeat] packet consumed by the main dispatcher; the server never sends one on a chat sub-connection. Delete it and keep the length check that follows. The server keeps prepending a space when the GBK payload starts with 101, because already-deployed clients still carry the guard and losing the message outright is worse than an invisible leading space. Note the same guard, harmless today, still sits in the machine, file, proxy and screen-hide managers. Verified with the Debug instance and a local Debug client: with the server's space temporarily disabled, chat_send "echo test" and "second line" both showed up verbatim in the client dialog (read back with WM_GETTEXT); with the space restored the first arrives as " echo test". Details in docs/Mcp_Chat_Design.md section 5. Co-Authored-By: deepseek-flash |