Skip to content

Commit 41e5ed2

Browse files
committed
feat: v3.1.0 — 文件编辑引擎重构 + Diff 渲染 + OpenViking 上下文增强
🔧 文件编辑引擎重构: - 修复 AI 调用文件编辑工具后连接直接终止的致命 bug - 三 Provider (OpenAI/Anthropic/Google) 全部重构为循环模式 - 拦截工具本地执行 → 结果回传 AI → 继续生成,最多 25 轮 - save-file 对已有文件直接 REJECT,强制使用 str-replace-editor - save-file 对新文件本地执行(含递归建目录) - 系统提示词注入 <file_editing_rules> 引导精确编辑 📊 Diff 渲染: - 拦截的文件编辑在聊天中实时渲染行级 diff - renderDiffText() 统一渲染函数,三 Provider 共用 - 支持行级 diff / 大文件摘要 / 新建文件预览 🔍 OpenViking 上下文增强: - Viking L0/L1/L2 分层上下文按需加载 - 向量初筛 → 目录聚合 → 递归下钻 - 对弱模型代码理解能力提升显著
1 parent a195146 commit 41e5ed2

7 files changed

Lines changed: 511 additions & 403 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "augment-proxy-manager",
33
"displayName": "Augment Proxy Manager",
44
"description": "管理 Augment API 代理服务器,支持自定义 API 端点和多种 AI 供应商",
5-
"version": "3.0.1",
5+
"version": "3.1.0",
66
"publisher": "legna",
77
"repository": {
88
"type": "git",

readme.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
零注入 · 零登录 · 零配置
1010

11-
[![Version](https://img.shields.io/badge/version-3.0.1-blue.svg)](https://github.com/LegnaOS/VSC-Augment-Proxy-Manager)
11+
[![Version](https://img.shields.io/badge/version-3.1.0-blue.svg)](https://github.com/LegnaOS/VSC-Augment-Proxy-Manager)
1212
[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-lightgrey.svg)]()
1313

1414
</div>
@@ -157,6 +157,28 @@ src/
157157

158158
## 更新日志
159159

160+
### v3.1.0 — 文件编辑引擎重构 + Diff 渲染
161+
162+
**🔧 文件编辑引擎重构(核心改进)**
163+
- **修复文件编辑终止 bug** — AI 调用 apply_patch / str-replace-editor / save-file 后不再直接断开连接,工具执行结果正确回传给 AI 继续生成
164+
- **三 Provider 循环架构** — OpenAI / Anthropic / Google 三个 Provider 全部重构为循环模式:拦截工具 → 本地执行 → 结果回传 AI → 继续生成,最多 25 轮迭代
165+
- **强制精确编辑** — save-file 对已有文件直接拒绝(REJECTED),强制 AI 使用 str-replace-editor / apply_patch 做精确编辑,杜绝全量覆盖
166+
- **新文件本地创建** — save-file 对新文件直接本地执行(含递归建目录),apply_patch 的 `*** Create File:` 子操作也正确执行
167+
- **系统提示词注入** — 自动注入 `<file_editing_rules>` 规则块,从提示词层面引导 AI 使用正确的编辑工具
168+
169+
**📊 Diff 渲染(流式输出)**
170+
- 拦截的文件编辑操作在聊天中实时渲染 diff,而不是只显示 `✅ apply_patch`
171+
- 行级 diff(≤50 行):显示 `- 删除行` / `+ 新增行`,最多各展示 12 行
172+
- 大文件覆盖(>50 行):显示行数变化摘要 `(1200 → 1250 lines)`
173+
- 新建文件:显示前 15 行预览
174+
- `renderDiffText()` 统一渲染函数,三个 Provider 共用
175+
176+
**🔍 OpenViking 上下文增强**
177+
- 借鉴 [OpenViking](https://github.com/volcengine/OpenViking) 文件系统范式的 Viking 分层上下文系统
178+
- L0 摘要 / L1 结构 / L2 全文三级按需加载,精准控制注入 token 量
179+
- 向量初筛 → 目录聚合 → Top 目录递归下钻,用结构化信号弥补向量精度不足
180+
- 对弱模型(GLM-5 等)的代码理解能力提升尤为显著
181+
160182
### v3.0.1 — 稳定性修复
161183

162184
**🛡️ 崩溃防护**

src/messages.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ ${wsInfo.join('\n')}
7575
${pathGuidance}
7676
</workspace_context>`);
7777
}
78+
// 文件编辑工具使用规则 — 强制精确编辑
79+
parts.push(`<file_editing_rules>
80+
CRITICAL FILE EDITING RULES — VIOLATION WILL CAUSE ERRORS:
81+
1. To MODIFY an existing file: ALWAYS use str-replace-editor (with command="str_replace", old_str, new_str) or apply_patch. These tools make precise, targeted edits.
82+
2. To CREATE a new file that does not exist: Use save-file.
83+
3. NEVER use save-file on a file that already exists — the operation WILL BE REJECTED with an error.
84+
4. When editing, provide the SMALLEST possible old_str that uniquely identifies the location. Do NOT regenerate the entire file content.
85+
5. If you need to make multiple changes to one file, use str-replace-editor with multiple replacement entries (old_str_1/new_str_1, old_str_2/new_str_2, etc.) in a single call.
86+
6. Before editing, use the view tool to read the current file content so your old_str matches exactly.
87+
</file_editing_rules>`);
88+
7889
if (req.user_guidelines) {
7990
parts.push(`# User Guidelines\n${req.user_guidelines}`);
8091
}

0 commit comments

Comments
 (0)