diff --git a/build.ts b/build.ts index 5a2ad896e..745866950 100644 --- a/build.ts +++ b/build.ts @@ -1,6 +1,6 @@ import { readdir, readFile, writeFile, cp, unlink, mkdir } from 'fs/promises' import { join } from 'path' -import { getMacroDefines } from './scripts/defines.ts' +import { getMacroDefines, DEFAULT_BUILD_FEATURES } from './scripts/defines.ts' const outdir = 'dist' @@ -23,44 +23,8 @@ if (process.env.SKIP_REVIEW_BUILTIN) { } } -// Default features that match the official CLI build. +// Feature flags imported from defines.ts (single source of truth). // Additional features can be enabled via FEATURE_=1 env vars. -const DEFAULT_BUILD_FEATURES = [ - 'AGENT_TRIGGERS_REMOTE', - 'CHICAGO_MCP', - 'VOICE_MODE', - 'SHOT_STATS', - 'PROMPT_CACHE_BREAK_DETECTION', - 'TOKEN_BUDGET', - // P0: local features - 'AGENT_TRIGGERS', - 'ULTRATHINK', - 'BUILTIN_EXPLORE_PLAN_AGENTS', - 'LODESTONE', - // P1: API-dependent features - 'EXTRACT_MEMORIES', - 'VERIFICATION_AGENT', - 'KAIROS_BRIEF', - 'AWAY_SUMMARY', - 'ULTRAPLAN', - // P2: daemon + remote control server - 'DAEMON', - // PR-package restored features - 'WORKFLOW_SCRIPTS', - 'HISTORY_SNIP', - 'CONTEXT_COLLAPSE', - 'MONITOR_TOOL', - 'FORK_SUBAGENT', -// 'UDS_INBOX', - 'KAIROS', - 'COORDINATOR_MODE', - 'LAN_PIPES', - // 'REVIEW_ARTIFACT', // API 请求无响应,需进一步排查 schema 兼容性 - // P3: poor mode (disable extract_memories + prompt_suggestion) - 'POOR', - // P3: serve mode (HTTP API server) - 'DIRECT_CONNECT', -] // Collect FEATURE_* env vars → Bun.build features const envFeatures = Object.keys(process.env) diff --git a/scripts/defines.ts b/scripts/defines.ts index c03657405..aaea5f6db 100644 --- a/scripts/defines.ts +++ b/scripts/defines.ts @@ -58,7 +58,7 @@ export const DEFAULT_BUILD_FEATURES = [ 'ACP', // ACP 代理协议,支持外部 agent 接入 'WORKFLOW_SCRIPTS', // 工作流脚本(.claude/workflows/ 中的 YAML/MD) 'HISTORY_SNIP', // 历史消息裁剪,压缩上下文窗口 - 'CONTEXT_COLLAPSE', // 上下文折叠,自动压缩旧消息 + // 'CONTEXT_COLLAPSE', // 已禁用:实现是空壳 stub,启用后会抑制 auto compact 导致上下文管理完全失效 'MONITOR_TOOL', // Monitor 工具,流式监控后台进程输出 // 'FORK_SUBAGENT', // Fork 子代理,显式 `fork: true` 参数触发,不影响 run_in_background 行为 // 'UDS_INBOX', // inbox 数组只增不减(非 GB 级主因) diff --git a/scripts/dev.ts b/scripts/dev.ts index 39d258284..7a54af2ba 100644 --- a/scripts/dev.ts +++ b/scripts/dev.ts @@ -6,7 +6,7 @@ */ import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; -import { getMacroDefines } from "./defines.ts"; +import { getMacroDefines, DEFAULT_BUILD_FEATURES as DEFAULT_FEATURES } from "./defines.ts"; // Resolve project root from this script's location const __filename = fileURLToPath(import.meta.url); @@ -22,37 +22,7 @@ const defineArgs = Object.entries(defines).flatMap(([k, v]) => [ ]); // Bun --feature flags: enable feature() gates at runtime. -// Default features enabled in dev mode. -const DEFAULT_FEATURES = [ - "BUDDY", "TRANSCRIPT_CLASSIFIER", "BRIDGE_MODE", - "AGENT_TRIGGERS_REMOTE", "CHICAGO_MCP", "VOICE_MODE", - "SHOT_STATS", "PROMPT_CACHE_BREAK_DETECTION", "TOKEN_BUDGET", - // P0: local features - "AGENT_TRIGGERS", - "ULTRATHINK", - "BUILTIN_EXPLORE_PLAN_AGENTS", - "LODESTONE", - // P1: API-dependent features - "EXTRACT_MEMORIES", "VERIFICATION_AGENT", - "KAIROS_BRIEF", "AWAY_SUMMARY", "ULTRAPLAN", - // P2: daemon + remote control server - "DAEMON", - // PR-package restored features - "WORKFLOW_SCRIPTS", - "HISTORY_SNIP", - "CONTEXT_COLLAPSE", - "MONITOR_TOOL", - "FORK_SUBAGENT", - "UDS_INBOX", - "KAIROS", - "COORDINATOR_MODE", - "LAN_PIPES", - // "REVIEW_ARTIFACT", // API 请求无响应,需进一步排查 schema 兼容性 - // P3: poor mode (disable extract_memories + prompt_suggestion) - "POOR", - // P3: serve mode (HTTP API server) - "DIRECT_CONNECT", -]; +// Default features imported from defines.ts (single source of truth). // Any env var matching FEATURE_=1 will also enable that feature. // e.g. FEATURE_PROACTIVE=1 bun run dev