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:
@@ -144,9 +144,9 @@ const toolHallucinationCheck: CompletionCheck = {
|
||||
{ patterns: [/已写入文件/, /已创建文件/, /文件已生成/, /已保存到/, /已成功创建/, /成功写入/,
|
||||
/文件.*已.*创建/, /文件.*已.*写入/, /生成.*文件/, /写入.*工作空间/],
|
||||
requiredTools: ['write_file'], label: '写入/创建文件' },
|
||||
// 文件读取
|
||||
{ patterns: [/已读取文件/, /文件内容显示/, /读取了.*文件/, /文件.*内容.*如下/,
|
||||
/查看.*文件.*内容/, /打开文件.*看到/],
|
||||
// 文件读取(仅匹配明确声称调用了 read_file 工具的场景)
|
||||
{ patterns: [/用read_file读取了/, /调用read_file.*读取/, /通过read_file工具/,
|
||||
/使用read_file.*查看了/, /read_file.*工具.*读取了/],
|
||||
requiredTools: ['read_file', 'read_multiple_files'], label: '读取文件' },
|
||||
// 文件编辑
|
||||
{ patterns: [/已修改文件/, /已编辑文件/, /文件已更新/, /已替换.*内容/,
|
||||
@@ -208,6 +208,10 @@ const toolHallucinationCheck: CompletionCheck = {
|
||||
if (pattern.test(content)) {
|
||||
const anyCalled = rule.requiredTools.some(t => calledTools.has(t));
|
||||
if (!anyCalled) {
|
||||
// 写后读豁免:write_file 已调用时,read_file 的声称通常是读取写入结果的自然表述,不阻断
|
||||
if (rule.label === '读取文件' && calledTools.has('write_file')) {
|
||||
return { passed: true, reason: '' };
|
||||
}
|
||||
const toolList = rule.requiredTools.join(' / ');
|
||||
return {
|
||||
passed: false,
|
||||
|
||||
Reference in New Issue
Block a user