Commit Graph
7 Commits
Author SHA1 Message Date
thzxx 058ee2de36 feat: 升级至 v0.3.12 — 文件与代码类工具全面优化(16 项)
【阶段一 · 紧急修复 F1】
- F1-1 file_editor regex 计数 bug:强制 g 标志 + 同一 RegExp 实例做 match+replace
- F1-2 code_search 统一 safeResolvePath(含路径遍历 + MEMORY.md 拦截)
- F1-3 git_commit amend 模式:message 可选 + --no-edit 防止编辑器 hang
- F1-4 write_file append 模式原子化:显式 open(O_APPEND)+write+fsync+close

【阶段二 · 增强现有工具 F2】
- F2-1 read_file 智能编码检测:BOM(UTF-8/UTF-16 LE/BE) + GBK 降级
- F2-2 read_file 支持 tail 模式(读取末尾 N 行,适用日志)
- F2-3 search_files 二进制过滤 + 智能编码检测
- F2-4 search_files 多 glob 匹配(逗号分隔,如 *.ts,*.js)
- F2-5 file_editor 新增 find_replace 操作(字面量替换,规避正则歧义)
- F2-6 file_editor regex 支持跨行匹配(multiline 参数)
- F2-7 file_editor 新增 backup 参数(编辑前 .bak 备份)

【阶段三 · 新增工具 F3】
- F3-1 file_move:双路径校验 + overwrite + 自动建父目录 + rename 原子
- F3-2 file_info:大小/时间/类型/编码/二进制/权限位

【阶段四 · 优化 F4】
- F4-1 diff_viewer Uint32Array→Uint16Array(省一半内存)+ safeResolvePath + 智能编码
- F4-2 错误处理统一:diff-viewer/file-editor/code-search catch 块改用 extractErrorMessage

【阶段五 · 验证 F5】
- tsc --noEmit 类型检查通过
- 人工审查通过:路径校验/错误处理/原子性/资源释放/权限策略/导出注册

工具数量:13 → 15(新增 file_move / file_info)
2026-07-21 16:08:39 +08:00
thzxx 8973ea6d47 feat: 升级至 v0.3.11 — 流式输出性能优化 12 项,解决长内容卡死
针对 AI 流式输出长内容时应用卡死问题,实施 12 项性能优化:

渲染层优化(F1/F3/F7):
- F1: React.memo 包裹 MessageItem/AssistantMessage,跳过历史消息重渲染
- F3: 流式时用纯文本渲染,避免 ReactMarkdown 全量重解析 O(n²)
- F7: useMemo 缓存 ReactMarkdown 元素,非流式时复用实例

滚动与布局(F2/F4/F10/F12):
- F2: 滚动节流 rAF + 100ms throttle + trailing 兜底,避免高频布局
- F4: CSS content-visibility 准虚拟滚动,跳过不可见区域布局
- F10: CSS contain 隔离 markdown 布局计算
- F12: 滚动容器 transform: translateZ(0) GPU 加速

状态与 IPC 批处理(F5/F8/F9):
- F5: 渲染进程 text_delta rAF 批处理,合并多次 store 写入
- F8: 主进程 text_delta 32ms 节流合并,降低 IPC 频率
- F9: reasoning_delta traceSteps thought 走 rAF 批处理

代码清理(F11):
- F11: 移除 rehypeRaw,节省 raw HTML 解析开销 + 防 AI 输出注入

验证:tsc --noEmit 通过,flush 逻辑在 done/error/cleanup 三处正确执行。
2026-07-21 14:38:27 +08:00
thzxx cd681b949a feat: 升级至 v0.3.10 — LLM 配置批量保存 + workspace.path 失败感知 + provider 切换防御性修复
- 新增 config:setBatch IPC:批量写入 8 个 LLM 字段后统一 reloadAdapter,
  解决设置页串行 config:set 在中间态触发"LLM 配置不完整"错误的问题
- SettingsModal.handleSave 和 OnboardingWizard.handleNext 改用 setBatch
- workspace.path 写入独立文件失败时返回 success:false(config:set 和 setBatch 一致),
  避免用户误以为保存成功但下次启动仍使用旧路径
- setBatch 将 provider 切换清空 apiKey 的逻辑移到循环前执行,
  消除对 entries 中 llm.provider 必须出现在 llm.apiKey 之前的隐含顺序依赖
2026-07-21 13:14:42 +08:00
thzxx 64af91bde9 feat: 升级至 v0.3.9 — 工具批量审批 + run_command 频率限制优化 + Toast 规范
1. 工具批量审批:解决并行工具审批弹框覆盖问题,新增批量 IPC 通道和列表 UI,支持同工具多次调用分组展示;2. 审批弹框健壮性:超时 toast 防风暴、agent 状态同步清空、ErrorBoundary 防白屏;3. run_command maxFrequency 从 3 调整为 10;4. 开发规范新增 Toast 通知铁律(必须使用 MeToast)
2026-07-21 11:43:41 +08:00
thzxx 76bd72b702 fix(trace): TraceViewer 出现滚动条时自动滚到底部
新增 scrollContainerRef + useEffect,监听 traceSteps / agentStatus /
groups.length 变化时自动滚到底部,与 MessageList 同款 throttle 80ms 模式,
避免流式事件高频触发导致滚动卡顿。
2026-07-20 22:08:14 +08:00
thzxx 5ec32f33da fix(trace): Trace Viewer 改为按 runId 分组渲染,显示所有轮次
修复 v0.3.8 引入的"覆盖"问题:sendMessage 清空 traceSteps 导致
前一条消息的 trace 被永久丢失。

方案 A+ — 既不叠加也不覆盖,按 runId 分组展示所有轮次:
- agent-store.ts: 回退 sendMessage 的 traceSteps: [] 清空(保留历史)
  保留 tokenUsage 重置(当前 run 统计应该重置)
- TraceViewer.tsx: 重写渲染逻辑
  - 新增 groupByRun 工具函数,按 runId 分组 + 计算轮次序号
  - 每个 run 独立 section,带"第 N 轮"标题 + 状态徽标(进行中/已完成)+ 步数
  - 当前 run 高亮(primary 边框 + 浅色背景 + MessageSquare 图标)
  - 历史 run 弱化(divider 边框 + 透明背景 + 0.85 透明度)
  - 顶部统计"共 N 轮"
  - isCurrent 判定改为"当前 run 的最后一个 step"(之前是"全局最后一个")

useAgentStream 的 runId 隔离逻辑(v0.3.8 已加)无需改动,
正好支撑多 run 共存设计:isSameIteration 校验 runId,跨 run 孤立
TERMINATED 跳过不创建 step。

冒烟测试场景:
- 多轮对话 → 每轮独立显示,不再叠加
- 历史 trace 不丢失 → 切换会话回来仍可见所有轮次
- 当前 run 高亮 → 视觉聚焦"正在进行的活动"
2026-07-20 21:57:03 +08:00
thzxx dde21f0b3f feat: 升级至 v0.3.8 — Trace Viewer 叠加修复 + LLM 配置校验改造 + toast 反馈统一
- Trace Viewer 叠加渲染修复
  - sendMessage 补 traceSteps/tokenUsage 重置(止血)
  - TraceStep 加 runId 字段,useAgentStream 按 runId 判定同迭代(稳健改造)

- LLM 配置校验中等改造(SettingsModal LLMSettings)
  - 取消 onChange 实时落库,改为本地 state + Save 按钮统一提交
  - 字段级 inline error:Base URL http(s):// 正则、Model 空格校验、contextWindow ≥ 4096
  - Provider 切换清空 Model(之前只清 apiKey)
  - 保存结果改用 metona-toast(不再用 Alert)

- toast 反馈机制全面统一(15 处问题修复)
  - ContextMenu: 原生 confirm/prompt 改 MUI Dialog(新增 useDialogStore + ContextMenuDialogHost)
  - ContextMenu: 抽 copyWithToast helper 替代散落 7 处静默失败
  - OnboardingWizard: 配置保存失败静默改 toast.error
  - useKeyboardShortcuts: Ctrl+N / Ctrl+Shift+C 失败补 toast
  - SettingsModal: inheritFiles 失败 toast.warning、handleApply 失败 toast.error
  - LogsSettings: resultAlert Alert 改 toast(保留 Dialog 确认)
  - MemoryViewer: 删除失败改 toast(加载/搜索保留 Alert)
  - TaskList: create/update/delete/无会话改 toast
  - agent-store: sendMessage/session 失败补 toast(保留 system message)

- 删除当前会话同步清空 ChatPanel/DetailPanel
  - Sidebar confirmDelete + ContextMenu delete 均补 agent-store 重置
  - 修复 useSessionStore.removeSession 不触发 agent-store 同步的遗漏
2026-07-20 21:22:20 +08:00