Commit Graph

9 Commits

Author SHA1 Message Date
claude-code-best
e1e2378795 feat: fork-agent-redesign — 新增 AgentTool fork 参数与 spec 设计文档
为 AgentTool 引入 fork 布尔参数,支持子代理从父对话上下文中 fork 出独立分支,
继承完整历史、系统提示和模型配置。重构 inputSchema 条件逻辑以适配 fork 模式。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 13:01:20 +08:00
claude-code-best
db84f971b4 perf: 优化内存与遥测管理,启用 Vite minify
- 禁用 HISTORY_SNIP feature flag 并新增 proactiveTruncate 防止无 compact_boundary 时内存无限增长
- 跳过未启用 telemetry 时的 OTel 初始化,防止长会话 PerformanceMeasure 堆积
- OTel 导出遇 401/403 自动关闭 reader,防止 handle 泄漏
- Vite 构建启用 minify

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 11:03:27 +08:00
James Feng
cdd62520eb feat(upstream): sync b1c4f40f ACP fix + WorkflowTool top-level require()
Codex cherry-pick:
- b1c4f40f: fix ACP extended thinking + tool_use 连续 user 消息导致 400
  → src/utils/messages.ts: ensureToolResultPairing 检查连续 user 消息
  → src/utils/tests/messages.test.ts: 新增测试(冲突手动解决)

James 兜底:
- tools.ts: WorkflowTool lazy getter → top-level require (MonitorTool 模式)
  移除 initBundledWorkflows() 调用(经确认是 no-op)
  原因: lazy getter 在 splitting:true 下运行时触发 chunk load 死锁

审核结论:
- 上游 a91653a0/6dd378bf/efc218d8 已存在(之前已合入)
- 上游 9d17597e autofix-pr 回流跳过(大规模改动,stub 无基础)
- WORKFLOW_SCRIPTS 仍禁用: top-level require 在 splitting:true 下
  触发 WorkflowTool chunk 循环死锁(非加载模式问题,是 chunk 依赖图过深)

当前 splitting:true 启用状态:
  MONITOR_TOOL  | WORKFLOW_SCRIPTS  | 其他 features 

验证: --version / -p / --print / 源码模式 全部通过
2026-06-02 14:45:21 +08:00
James Feng
21f126b76a 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 / 源码模式 全部通过
2026-06-02 14:22:42 +08:00
James Feng
98bb25636b refactor(tools): static import → require() 迁移 + 兜底修复
Codex 完成:
- tools.ts: 7 个 static import (指向空壳 stub) → require("@claude-code-best/builtin-tools/...")
  涉及: SleepTool, CronTools, RemoteTriggerTool, MonitorTool, SendUserFileTool,
  PushNotificationTool, TeamCreateTool, TeamDeleteTool, SendMessageTool, WorkflowTool
- PermissionRequest.tsx: MonitorTool require() 指向 builtin-tools
- TeamCreateTool/DeleteTool/SendMessageTool 用 lazy require() 打破循环依赖

兜底修复:
- defines.ts: 保持 MONITOR_TOOL + WORKFLOW_SCRIPTS 禁用
  原因: builtin-tools 里的真工具 import "src/..." 产生跨包循环引用
  在 splitting:true 下触发 chunk 间死锁,在 splitting:false 下触发 ESM 初始化死锁
  这是逆向工程的结构性限制,非简单修复能解决

验证: --version / -p / --print / 源码模式 全部通过
2026-06-02 13:41:47 +08:00
James Feng
0e9d6955f0 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 三种模式全部通过
2026-06-02 12:55:30 +08:00
James Feng
e26d4e61a3 feat: enable PROACTIVE feature flag in default build
Add 'PROACTIVE' to DEFAULT_BUILD_FEATURES in scripts/defines.ts.
The proactive state machine (src/proactive/index.ts) and SleepTool
were already fully recovered; only the glue function
notifyAutomationStateChanged was missing — restored in d1d74d4a.

With PROACTIVE enabled, the autonomous agent can use SleepTool to
pause/resume its own tick cycle, saving tokens during idle periods.
2026-06-02 01:45:42 +08:00
James Feng
39ba9a56fd feat: pull in Vite build system + complete packages/builtin-tools/
- Add Vite as alternative build (vite.config.ts, scripts/vite-plugin-*)
- Add dab04af7 RSS fix (distRoot, ripgrep path, post-build)
- Pull in packages/builtin-tools/ (+354 files)
- Pull in packages/agent-tools/, mcp-client/, acp-link/, weixin/
- Copy defines.ts from upstream for Vite compatibility
- Update package.json with Vite scripts and deps
2026-06-01 18:18:03 +08:00
claude-code-best
28e40ddc67 refactor: 用 Bun 原生 define 替换 cli.tsx 中的 globalThis 注入
- 删除 cli.tsx 顶部的 globalThis.MACRO / BUILD_* / feature polyfill
- 新增 scripts/defines.ts 作为 MACRO define 映射的单一来源
- 新增 scripts/dev.ts,通过 bun run -d 在转译时注入 MACRO 常量
- build.ts 引用 getMacroDefines() 实现构建时内联
- 清理 global.d.ts (移除 BUILD_*, MACRO 函数声明)
- 55 个 MACRO 消费文件零改动

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 09:51:48 +08:00