fix(build): 修复构建产物 hang 死 + 空 tool name (4 stub NAME="")

Root cause: Bun code splitting + MONITOR_TOOL/WORKFLOW_SCRIPTS stub 触发循环 ESM 死锁;
4 个 prompt.ts stub 的 NAME 常量为空字符串导致 API 400 error.

Fix:
- build.ts: splitting: false
- defines.ts: 禁用 MONITOR_TOOL, WORKFLOW_SCRIPTS
- 4 个 prompt.ts: 补全正确 tool name

验证: --version / -p / --print 三种模式全部通过
This commit is contained in:
James Feng 2026-06-02 12:55:30 +08:00
parent 27682acf63
commit 0e9d6955f0
6 changed files with 11 additions and 11 deletions

View File

@ -20,7 +20,7 @@ const result = await Bun.build({
entrypoints: ['src/entrypoints/cli.tsx'],
outdir,
target: 'bun',
splitting: true,
splitting: false,
define: getMacroDefines(),
features,
})

View File

@ -59,10 +59,10 @@ export const DEFAULT_BUILD_FEATURES = [
'PROACTIVE', // 主动自主代理模式SleepTool 控制 tick 节奏,省 token
'DAEMON', // 守护进程模式,长驻 supervisor 管理后台 worker非 GB 级主因)
'ACP', // ACP 代理协议,支持外部 agent 接入
'WORKFLOW_SCRIPTS', // 工作流脚本(.claude/workflows/ 中的 YAML/MD
// 'WORKFLOW_SCRIPTS', // 已禁用stub 空壳,启用后 __esm() 循环初始化导致构建产物 hang
// 'HISTORY_SNIP', // 已禁用snip 功能暂时关闭
// 'CONTEXT_COLLAPSE', // 已禁用:实现是空壳 stub启用后会抑制 auto compact 导致上下文管理完全失效
'MONITOR_TOOL', // Monitor 工具,流式监控后台进程输出
// 'MONITOR_TOOL', // 已禁用stub 空壳,启用后 __esm() 循环初始化导致构建产物 hang
// 'FORK_SUBAGENT', // 已禁用:通过 Agent tool 的特殊方式实现了等效功能,无需再开
'KAIROS', // Kairos 定时任务系统核心
'COORDINATOR_MODE', // 多 worker 编排模式AgentSummary 泄露已在 52b61c2c 修复)

View File

@ -1,3 +1,3 @@
// Auto-generated stub — replace with real implementation
// Stub — DiscoverSkills tool name
export {};
export const DISCOVER_SKILLS_TOOL_NAME: string = '';
export const DISCOVER_SKILLS_TOOL_NAME: string = 'DiscoverSkills';

View File

@ -1,3 +1,3 @@
// Auto-generated stub — replace with real implementation
// Stub — SendUserFile tool name (KAIROS assistant mode)
export {};
export const SEND_USER_FILE_TOOL_NAME: string = '';
export const SEND_USER_FILE_TOOL_NAME: string = 'SendUserFile';

View File

@ -1,3 +1,3 @@
// Auto-generated stub — replace with real implementation
// Stub — Snip tool name
export {};
export const SNIP_TOOL_NAME: string = '';
export const SNIP_TOOL_NAME: string = 'Snip';

View File

@ -1,3 +1,3 @@
// Auto-generated stub — replace with real implementation
// Stub — TerminalCapture tool name
export {};
export const TERMINAL_CAPTURE_TOOL_NAME: string = '';
export const TERMINAL_CAPTURE_TOOL_NAME: string = 'TerminalCapture';