feat(build): splitting:true + MONITOR_TOOL 恢复 + WorkflowTool lazy getter
Codex 完成: - build.ts: splitting: false → true (562 files code-split 构建) - defines.ts: MONITOR_TOOL 重新启用(require() 迁移后无死锁) - 验证 splitting:true 产物 -p/--print 全部正常 James 兜底: - tools.ts: WorkflowTool IIFE → lazy getter (getWorkflowTool) 避免模块初始化时的 chunk 加载死锁,但 WORKFLOW_SCRIPTS 仍因 更深的 chunk 依赖图问题 hang,暂时保持禁用 - getAllBaseTools() 中 WorkflowTool 引用改为 lazy getter 状态: | splitting:true | 562 files ✅ | | MONITOR_TOOL | enabled ✅ | | WORKFLOW_SCRIPTS | disabled (lazy getter 不足) | 验证: --version / -p / --print / 源码模式 全部通过
This commit is contained in:
parent
98bb25636b
commit
21f126b76a
2
build.ts
2
build.ts
|
|
@ -20,7 +20,7 @@ const result = await Bun.build({
|
|||
entrypoints: ['src/entrypoints/cli.tsx'],
|
||||
outdir,
|
||||
target: 'bun',
|
||||
splitting: false,
|
||||
splitting: true,
|
||||
define: getMacroDefines(),
|
||||
features,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -59,10 +59,10 @@ export const DEFAULT_BUILD_FEATURES = [
|
|||
'PROACTIVE', // 主动自主代理模式(SleepTool 控制 tick 节奏,省 token)
|
||||
'DAEMON', // 守护进程模式,长驻 supervisor 管理后台 worker(非 GB 级主因)
|
||||
'ACP', // ACP 代理协议,支持外部 agent 接入
|
||||
// 'WORKFLOW_SCRIPTS', // 已禁用:stub 空壳 + builtin-tools 跨包 import 'src/...' → __esm() 循环初始化死锁
|
||||
// 'WORKFLOW_SCRIPTS', // 已禁用:lazy getter 在 splitting:true 下仍触发 chunk 死锁,待进一步排查
|
||||
// 'HISTORY_SNIP', // 已禁用:snip 功能暂时关闭
|
||||
// 'CONTEXT_COLLAPSE', // 已禁用:实现是空壳 stub,启用后会抑制 auto compact 导致上下文管理完全失效
|
||||
// 'MONITOR_TOOL', // 已禁用:stub 空壳 + builtin-tools 跨包 import 'src/...' → __esm() 循环初始化死锁
|
||||
'MONITOR_TOOL', // 已修复:require() 迁移后 splitting:true 不再触发 __esm() 死锁
|
||||
// 'FORK_SUBAGENT', // 已禁用:通过 Agent tool 的特殊方式实现了等效功能,无需再开
|
||||
'KAIROS', // Kairos 定时任务系统核心
|
||||
'COORDINATOR_MODE', // 多 worker 编排模式(AgentSummary 泄露已在 52b61c2c 修复)
|
||||
|
|
|
|||
16
src/tools.ts
16
src/tools.ts
|
|
@ -132,13 +132,13 @@ const SnipTool = feature('HISTORY_SNIP')
|
|||
const ListPeersTool = feature('UDS_INBOX')
|
||||
? require('./tools/ListPeersTool/ListPeersTool.js').ListPeersTool
|
||||
: null
|
||||
const WorkflowTool = feature('WORKFLOW_SCRIPTS')
|
||||
? (() => {
|
||||
require('@claude-code-best/builtin-tools/tools/WorkflowTool/bundled/index.js').initBundledWorkflows()
|
||||
return require('@claude-code-best/builtin-tools/tools/WorkflowTool/WorkflowTool.js')
|
||||
.WorkflowTool
|
||||
})()
|
||||
: null
|
||||
// Lazy getter to defer chunk loading — IIFE causes code-split deadlock
|
||||
const getWorkflowTool = () => {
|
||||
if (!feature('WORKFLOW_SCRIPTS')) return null
|
||||
require('@claude-code-best/builtin-tools/tools/WorkflowTool/bundled/index.js').initBundledWorkflows()
|
||||
return require('@claude-code-best/builtin-tools/tools/WorkflowTool/WorkflowTool.js')
|
||||
.WorkflowTool
|
||||
}
|
||||
/* eslint-enable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
||||
import type { ToolPermissionContext } from './Tool.js'
|
||||
import { getDenyRuleForTool } from './utils/permissions/permissions.js'
|
||||
|
|
@ -237,7 +237,7 @@ export function getAllBaseTools(): Tools {
|
|||
: []),
|
||||
...(VerifyPlanExecutionTool ? [VerifyPlanExecutionTool] : []),
|
||||
...(process.env.USER_TYPE === 'ant' && REPLTool ? [REPLTool] : []),
|
||||
...(WorkflowTool ? [WorkflowTool] : []),
|
||||
...(() => { const w = getWorkflowTool(); return w ? [w] : [] })(),
|
||||
...(SleepTool ? [SleepTool] : []),
|
||||
...cronTools,
|
||||
...(RemoteTriggerTool ? [RemoteTriggerTool] : []),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user