v0.12.9: Completion Gate 架构修复 + 工作空间文件夹选择 + 搜索/Plan 全链路加固

Fix:
- Completion Gate read_file 误报消除 — 缩窄匹配为仅明确工具声明 + 写后读豁免
- Gate 阻断重试消息重写 — 待办中与 Gate 拦截匹配时明确要求调工具而非模糊修正
- FileWriteDedupHook (pre_tool) + PlanAutoTrackHook (post_tool) — Harness 插件化
- 工作空间浏览按钮修复 — openFile→openDirectory,原生文件夹选择对话框
- pre_tool Hook 执行结果可阻断 — HookResult.passed=false 时拦截工具执行
- Plan 步骤上限 6 + 动词过滤 + 阶段标题过滤 — 适配不同模型格式
- Plan Mode 任务描述固化到系统提示词 — 压缩后不丢失任务目标
- 全部完成信号去重 — system 消息不重复注入
- handleReflecting 空响应 pop() 精确定位最后 assistant 消息

Refactor:
- agent-engine.ts 移除全部硬编码模块变量和函数 — 迁移到 Hook 系统
- extractPlanSteps 增加 ACTION_VERBS 动词过滤
- Plan rejection 不再重置 loopCount
This commit is contained in:
thzxx
2026-06-23 22:46:00 +08:00
parent 44cb5037ec
commit 2d3ea85255
12 changed files with 194 additions and 76 deletions
+8
View File
@@ -130,6 +130,14 @@ export async function setupIPC(): Promise<void> {
return result.filePath;
});
ipcMain.handle('dialog:openDirectory', async () => {
const result = await dialog.showOpenDialog(mainWindow!, {
properties: ['openDirectory']
});
if (result.canceled) return null;
return result.filePaths;
});
ipcMain.handle('fs:readFile', async (_, filePath: string) => {
try {
const check = checkPathAllowed(path.resolve(filePath), 'read');