Feat(client): complete the macOS feature set (phase 0 and 1)

Phase 0 makes implementations that already existed reachable. macOS now
declares TERMINAL, SCREEN_CLIPBOARD, PROCESS and C2C_RECV_ACK; PROCESS is a
new bit and Linux declares it too. SystemManager was dead code -- its
constructor took a second argument and it did not derive IOCPManager, so the
sub-connection skeleton could never instantiate it -- and now matches the
createHandler/OnReceive contract, so COMMAND_SYSTEM really spawns a
sub-connection (proc_listpids, SIGKILL). DataProcess always gets a NULL user,
so main.mm keeps a g_pMainClient handle and the V2 C2C receiver finally
answers TOKEN_C2C_RECV_RESULT. The server asks for SupportsTerminal() on MAC
for exec_command / terminal_* and for SupportsProcess() for kill_process, so
an old build gets "client is too old" instead of a command nobody answers;
kToolPlatforms and mcp/tools.json follow. http_probe stays win/lnx: the
terminal works on macOS, but the probe uses GNU-only base64 -w.

Phase 1 is POSIX parity. ScreenPreview captures through CGDisplayCreateImage,
scales and ships BGRX for the server to encode, and the capability is only
declared when preflight or a real capture says the display is readable.
ActivityHistory samples the frontmost layer-0 window once a second and prints
the same records as Windows and Linux. COMMAND_SCREEN_KEYFRAME_REQ is now
consumed by Linux (x264 IDR) and macOS (VideoToolbox force keyframe): the
receive thread raises a flag, the capture thread -- which owns the encoder --
consumes it and puts it back if the frame never went out. The macOS quality
level persists in NSUserDefaults because main.mm rewrites config.conf.

Linux client and Debug x64 server rebuild green; check_platform_table PASS.
Not built or run on a Mac.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-14 13:30:50 +01:00
1 parent c2b59f5d4a
commit 06b93f7bdb
19 files changed
+890 -121

No files matched your search

+6 -1
View File
@@ -165,12 +165,13 @@ public:
* @param outData Output: pointer to encoded H264 data
* @param outSize Output: size of encoded data
* @param direction 1 = normal, -1 = vertical flip
* @param forceKeyframe true = 本帧强制 IDR(服务端 COMMAND_SCREEN_KEYFRAME_REQ)
* @return 0 on success, negative on error
*/
int encode(uint8_t* bgra, uint8_t bpp, uint32_t stride,
uint32_t width, uint32_t height,
uint8_t** outData, uint32_t* outSize,
int direction = 1)
int direction = 1, bool forceKeyframe = false)
{
if (!m_encoder || !m_picIn || !fn_x264_encoder_encode) {
return -1;
@@ -197,9 +198,13 @@ public:
}
// Encode
// Web 端新加入/恢复时服务端会发 COMMAND_SCREEN_KEYFRAME_REQ:把本帧标成 IDR,
// 参考链立即重建,不必等 keyint_max(15 秒)后的下一个关键帧。
m_picIn->i_type = forceKeyframe ? X264_TYPE_IDR : X264_TYPE_AUTO;
x264_nal_t* pNal = nullptr;
int iNal = 0;
int encodeSize = fn_x264_encoder_encode(m_encoder, &pNal, &iNal, m_picIn, m_picOut);
m_picIn->i_type = X264_TYPE_AUTO; // 只对这一帧有效
if (encodeSize < 0) {
return -4;