feat: add ttyd terminal support, parallel startup in frpc.js

Made-with: Cursor
This commit is contained in:
stswangzhiping
2026-03-15 21:39:05 +08:00
parent abf2cacac7
commit c0c445b61d
2 changed files with 76 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ const WebSocket = require('ws');
const config = require('./config');
const { getBoxId } = require('./fingerprint');
const { collect } = require('./metrics');
const { getDashboardInfo, FrpcManager } = require('./frpc');
const { getDashboardInfo, startTtyd, FrpcManager } = require('./frpc');
const MAX_BACKOFF_MS = 60_000;
@@ -22,7 +22,12 @@ class ClawClient {
async start() {
console.log(`[clawd] 启动中... 服务器 = ${this._cfg.server}`);
this._dashInfo = await getDashboardInfo();
// 并行:获取 openclaw dashboard 信息 + 启动 ttyd
const [dashInfo] = await Promise.all([
getDashboardInfo(),
startTtyd().catch(e => console.warn('[ttyd] 启动失败:', e.message)),
]);
this._dashInfo = dashInfo || {};
this._connect();
}