feat(v10.1): CLI 常驻 daemon(nodeagentd)—— 连接池复用,批量调用提速
## 机制 - nodeagentd 常驻进程监听 UDS($TMPDIR/nodeagentd.sock),持有与被控端的 长连接池(autoReconnect,每设备一条,LRU 上限 8,空闲 5min 释放) - CLI withClient 检测 socket 存活 → 经 daemon JSON-lines 转发 invoke(虚拟 client); daemon 自身错误静默回退直连,业务错误原样透传 —— 零行为变化,纯加速层 - CLI 新命令: nodeagent daemon start|stop|status;打包新增 nodeagentd 产物 ## 实测(真机) - 轻调用(info): 752ms -> 527ms(省 TLS+hello/challenge/auth,约 30%) - 轻调用 5 连发(clip.get): 2.58s -> 2.41s - 重调用(ps 远端 CPU 采样 1.4s)提速不显著 —— 瓶颈在远端执行而非握手,符合预期 - unit 26/26、e2e 21/21 全绿
This commit is contained in:
1 parent
e50e805383
commit
fac51046cf
4 files changed
+322
-1
No files matched your search
@@ -26,7 +26,7 @@ fi
|
||||
echo "✓ Node.js v$VER"
|
||||
|
||||
# 2. 检查构建产物
|
||||
if [ ! -f "$SRC/nodeagent" ] || [ ! -f "$SRC/nodeagent-mcp" ]; then
|
||||
if [ ! -f "$SRC/nodeagent" ] || [ ! -f "$SRC/nodeagent-mcp" ] || [ ! -f "$SRC/nodeagentd" ]; then
|
||||
echo "✗ 未找到构建产物:$SRC" >&2
|
||||
echo " 请先在项目目录运行: pnpm pack:mac" >&2
|
||||
exit 1
|
||||
@@ -35,9 +35,11 @@ fi
|
||||
# 3. 安装(install 会设置 755 权限)
|
||||
mkdir -p "$BIN_DIR"
|
||||
install -m 755 "$SRC/nodeagent" "$BIN_DIR/nodeagent"
|
||||
install -m 755 "$SRC/nodeagentd" "$BIN_DIR/nodeagentd"
|
||||
install -m 755 "$SRC/nodeagent-mcp" "$BIN_DIR/nodeagent-mcp"
|
||||
echo "✓ 已安装到 $BIN_DIR"
|
||||
echo " - nodeagent 控制端 CLI"
|
||||
echo " - nodeagentd 常驻连接池 daemon(nodeagent daemon start 拉起)"
|
||||
echo " - nodeagent-mcp MCP server(供 WorkBuddy 调用)"
|
||||
|
||||
# 4. PATH 检查
|
||||
|
||||
@@ -58,6 +58,7 @@ console.log('\n=== ② 打包控制端 ===');
|
||||
rmSync(PKG_DIR, { recursive: true, force: true });
|
||||
mkdirSync(PKG_DIR, { recursive: true });
|
||||
bundle('apps/cli/dist/index.js', join(PKG_DIR, 'nodeagent'));
|
||||
bundle('apps/cli/dist/daemon.js', join(PKG_DIR, 'nodeagentd'));
|
||||
bundle('apps/mcp/dist/index.js', join(PKG_DIR, 'nodeagent-mcp'));
|
||||
|
||||
console.log(`\n✓ 完成: ${PKG_DIR}`);
|
||||
|
||||
Reference in new issue
Block a user