From f2dd5142b36c053d799a1a1328cb888ce309d756 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Fri, 24 Apr 2026 10:01:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=A7=A3=E8=80=A6=20BRIDGE=5FMODE?= =?UTF-8?q?=20=E4=B8=8E=20DAEMON=EF=BC=8C=E7=A6=81=E7=94=A8=20DAEMON=20?= =?UTF-8?q?=E9=99=8D=E4=BD=8E=E5=86=85=E5=AD=98=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 从 DEFAULT_BUILD_FEATURES 注释掉 DAEMON(内存占用过高) - remoteControlServer 命令门控从 feature('DAEMON') && feature('BRIDGE_MODE') 改为仅 feature('BRIDGE_MODE'),bridge 不再依赖 daemon - --daemon-worker 快速路径改为运行时检测,未启用时输出明确错误提示 Co-Authored-By: Claude Opus 4.7 --- scripts/defines.ts | 2 +- src/commands.ts | 2 +- src/commands/remoteControlServer/index.ts | 7 ++++++- src/entrypoints/cli.tsx | 7 ++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/defines.ts b/scripts/defines.ts index 388616597..804935419 100644 --- a/scripts/defines.ts +++ b/scripts/defines.ts @@ -46,7 +46,7 @@ export const DEFAULT_BUILD_FEATURES = [ 'KAIROS_BRIEF', // Kairos 定时摘要(定时汇报当前状态) 'AWAY_SUMMARY', // 离线摘要(用户离开后生成总结) 'ULTRAPLAN', // 超级规划模式,深度分析后生成实施计划 - 'DAEMON', // 守护进程模式,长驻 supervisor 管理后台 worker + // 'DAEMON', // 守护进程模式,长驻 supervisor 管理后台 worker(已禁用:内存占用过高) 'ACP', // ACP 代理协议,支持外部 agent 接入 'WORKFLOW_SCRIPTS', // 工作流脚本(.claude/workflows/ 中的 YAML/MD) 'HISTORY_SNIP', // 历史消息裁剪,压缩上下文窗口 diff --git a/src/commands.ts b/src/commands.ts index c3ea1804a..d4396b364 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -75,7 +75,7 @@ const bridge = feature('BRIDGE_MODE') ? require('./commands/bridge/index.js').default : null const remoteControlServerCommand = - feature('DAEMON') && feature('BRIDGE_MODE') + feature('BRIDGE_MODE') ? require('./commands/remoteControlServer/index.js').default : null const voiceCommand = feature('VOICE_MODE') diff --git a/src/commands/remoteControlServer/index.ts b/src/commands/remoteControlServer/index.ts index 6c78d7ef3..5ec6652d9 100644 --- a/src/commands/remoteControlServer/index.ts +++ b/src/commands/remoteControlServer/index.ts @@ -3,9 +3,14 @@ import { isBridgeEnabled } from '../../bridge/bridgeEnabled.js' import type { Command } from '../../commands.js' function isEnabled(): boolean { - if (!feature('DAEMON') || !feature('BRIDGE_MODE')) { + if (!feature('BRIDGE_MODE')) { return false } + if (feature('DAEMON')) { + return isBridgeEnabled() + } + // DAEMON feature disabled — still allow the command but warn at runtime + // that headless/daemon worker mode is unavailable. return isBridgeEnabled() } diff --git a/src/entrypoints/cli.tsx b/src/entrypoints/cli.tsx index c519e6572..2ea7f3a70 100644 --- a/src/entrypoints/cli.tsx +++ b/src/entrypoints/cli.tsx @@ -170,7 +170,12 @@ async function main(): Promise { // perf-sensitive. No enableConfigs(), no analytics sinks at this layer — // workers are lean. If a worker kind needs configs/auth (assistant will), // it calls them inside its run() fn. - if (feature('DAEMON') && (args[0] === '--daemon-worker' || args[0]?.startsWith('--daemon-worker='))) { + if (args[0] === '--daemon-worker' || args[0]?.startsWith('--daemon-worker=')) { + if (!feature('DAEMON')) { + console.error('Error: --daemon-worker requires DAEMON feature to be enabled. Set FEATURE_DAEMON=1 or add DAEMON to DEFAULT_BUILD_FEATURES.') + process.exitCode = 1 + return + } const kind = args[0] === '--daemon-worker' ? args[1] : args[0].split('=')[1] const { runDaemonWorker } = await import('../daemon/workerRegistry.js') await runDaemonWorker(kind)