feat: proxy CutOS agent console
This commit is contained in:
+13
-2
@@ -7,6 +7,7 @@ const path = require('path');
|
||||
const https = require('https');
|
||||
const log = require('./logger');
|
||||
const { Watchdog } = require('./watchdog');
|
||||
const { CUTOS_AGENT } = require('./agent-type');
|
||||
|
||||
const CONFIG_DIR = process.env.CLAWD_CONFIG_DIR
|
||||
|| (process.getuid && process.getuid() === 0 ? '/etc/clawd' : path.join(os.homedir(), '.clawd'));
|
||||
@@ -15,6 +16,7 @@ const FRPC_CONFIG = path.join(CONFIG_DIR, 'frpc.toml');
|
||||
|
||||
const FRP_VERSION = '0.62.0';
|
||||
const TTYD_PORT = 7681;
|
||||
const CUTOS_DASHBOARD_PORT = 30141;
|
||||
|
||||
function findTtydBin() {
|
||||
const candidates = ['/usr/bin/ttyd', '/usr/local/bin/ttyd', path.join(CONFIG_DIR, 'ttyd')];
|
||||
@@ -49,7 +51,10 @@ function resolveOpenclawConfigFile() {
|
||||
* 直接读取比执行命令更可靠(不依赖 PATH、不需要进程启动等待)。
|
||||
* systemd 服务的 ProtectHome=read-only 允许读取 /home 下的文件。
|
||||
*/
|
||||
function getDashboardInfo() {
|
||||
function getDashboardInfo(agentType) {
|
||||
if (agentType === CUTOS_AGENT) {
|
||||
return Promise.resolve({ dashboard_port: CUTOS_DASHBOARD_PORT });
|
||||
}
|
||||
for (const cfgPath of OPENCLAW_JSON_CANDIDATES) {
|
||||
try {
|
||||
const raw = fs.readFileSync(cfgPath, 'utf8');
|
||||
@@ -226,4 +231,10 @@ class FrpcManager {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { getDashboardInfo, resolveOpenclawConfigFile, startTtyd, FrpcManager };
|
||||
module.exports = {
|
||||
CUTOS_DASHBOARD_PORT,
|
||||
getDashboardInfo,
|
||||
resolveOpenclawConfigFile,
|
||||
startTtyd,
|
||||
FrpcManager,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user