Skip to content

Commit bf8325c

Browse files
committed
fix: v3.1.1 — Windows 兼容性修复
🪟 Windows 平台兼容: - proxy.localhost → 127.0.0.1 (Windows 不支持 *.localhost 子域名 DNS 解析) - ONNX Runtime native DLL 失败自动回退 WASM backend 🛠️ 技术细节: - proxy.ts: completionURL 改用 127.0.0.1,跳过 DNS 解析 - embeddings.ts: 检测 DLL 初始化失败后用 device: 'wasm' 重试 - WASM backend 性能略低于 native,但确保功能可用
1 parent 41e5ed2 commit bf8325c

4 files changed

Lines changed: 47 additions & 11 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.1.0",
5+
"version": "3.1.1",
66
"publisher": "legna",
77
"repository": {
88
"type": "git",

readme.md

Lines changed: 22 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.1.0-blue.svg)](https://github.com/LegnaOS/VSC-Augment-Proxy-Manager)
11+
[![Version](https://img.shields.io/badge/version-3.1.1-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>
@@ -230,6 +230,27 @@ src/
230230
- 远程 API 失败自动回退本地模型
231231
- 远程/本地独立缓存,维度不冲突
232232

233+
### v3.1.1
234+
- 🪟 **Windows 兼容性修复**`proxy.localhost` DNS 解析失败改用 `127.0.0.1`,全平台通用
235+
- 🧠 **ONNX Runtime WASM 回退** — Windows 上 native DLL 加载失败时自动回退 WASM backend,确保 Embedding 功能可用
236+
237+
### v3.1.0
238+
- 🔧 **文件编辑引擎重构** — 修复 AI 调用文件编辑工具后连接终止的致命 bug,三 Provider 全部重构为循环架构
239+
- 📊 **Diff 渲染** — 拦截的文件编辑操作实时渲染 diff 到聊天界面
240+
- 🎯 **强制精确编辑**`save-file` 对已有文件直接拒绝,强制 AI 使用 `str-replace-editor`
241+
- 🔍 **OpenViking 上下文增强** — Viking L0/L1/L2 分层上下文,向量初筛 + 目录聚合 + 递归下钻
242+
243+
### v3.0.1
244+
- 🛡️ **崩溃防护** — 修复 extension host 崩溃循环,OOM 防护,智能缓存检测
245+
- 🪞 **HuggingFace 镜像** — 支持镜像加速下载
246+
- 🎨 **UI 优化** — 侧边栏本地模型与远程 API 分区显示
247+
248+
### v3.0.0
249+
- 🧠 **Viking 分层上下文** — L0 摘要 / L1 结构化 / L2 全文,三级按需加载
250+
- 🧬 **Session Memory** — 长期记忆,自动提取偏好和经验
251+
- 🌐 **远程 Embedding API** — 支持 GLM/OpenAI/自定义 API
252+
- 📦 **7 种本地模型** — MiniLM-L6/L12, BGE-Small/Base, E5-Multi-Small 等
253+
233254
### v2.1.5
234255
- 🚀 **OMC 编排增强** — 集成 oh-my-claudecode,6 种编排模式
235256
- 🔮 **魔法关键词** — ultrawork/search/analyze/ultrathink 自动增强

src/proxy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,11 +617,12 @@ export async function startProxy(extensionContext: vscode.ExtensionContext) {
617617
// 零注入登录绕过:自动配置 Augment 扩展使用代理
618618
// 原理:设置 apiToken + completionURL 后 useOAuth 返回 false
619619
// QIe.requestAuthToken 直接返回 { token, tenantId, tenantUrl, expiresAt }
620-
// NJe() 从 proxy.localhost 提取 "proxy" 作为 tenant ID
620+
// NJe() 从 hostname 提取 tenant ID(proxy 模式下无关紧要)
621+
// 用 127.0.0.1 而非 proxy.localhost — Windows 不支持 *.localhost 子域名 DNS 解析(ENOTFOUND)
621622
// 扩展的 config change listener 检测到变化后自动 reload
622623
// 零注入登录绕过:写入 augment.advanced 对象(VSCode 不支持点号路径写入嵌套 object 属性)
623624
try {
624-
const proxyUrl = `http://proxy.localhost:${state.currentConfig.port}`;
625+
const proxyUrl = `http://127.0.0.1:${state.currentConfig.port}`;
625626
const augmentConfig = vscode.workspace.getConfiguration('augment');
626627
const currentAdvanced = augmentConfig.get<any>('advanced', {}) || {};
627628
const currentToken = currentAdvanced.apiToken || '';

src/rag/embeddings.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,16 @@ export class SemanticEmbeddings {
239239
}
240240

241241
// v2.1.0: 加载本地模型(可独立调用,支持切换模型)
242-
async loadLocalModel(_retried = false): Promise<void> {
242+
// v3.1.1: _wasmFallback — DLL/native binding 失败后自动回退 WASM backend
243+
async loadLocalModel(_retried = false, _wasmFallback = false): Promise<void> {
243244
const modelInfo = LOCAL_MODELS.find(m => m.id === this.localModelId) || LOCAL_MODELS[0];
244245
this.modelLoading = true;
245246
this._cancelRequested = false;
246247
this.downloadProgress = 0;
247248
this.downloadFile = '';
248249
this.lastError = '';
249250
this.notifyStatus();
250-
this.onProgress?.(`[RAG] 🧠 Loading transformers.js...`);
251+
this.onProgress?.(`[RAG] 🧠 Loading transformers.js${_wasmFallback ? ' (WASM fallback)' : ''}...`);
251252

252253
try {
253254
const { pipeline: tfPipeline, env } = await import('@huggingface/transformers');
@@ -274,7 +275,8 @@ export class SemanticEmbeddings {
274275
this.onProgress?.(`[RAG] 📥 首次下载模型: ${modelInfo.name} (~${modelInfo.sizeMB}MB)...`);
275276
}
276277

277-
this.pipeline = await tfPipeline('feature-extraction', this.localModelId, {
278+
// v3.1.1: WASM fallback — native DLL 失败时用 WASM backend
279+
const pipelineOptions: any = {
278280
progress_callback: isCached ? undefined : (progress: any) => {
279281
// v3.0.0: 检查取消请求
280282
if (this._cancelRequested) {
@@ -305,15 +307,21 @@ export class SemanticEmbeddings {
305307
this.notifyStatus();
306308
}
307309
}
308-
});
310+
};
311+
if (_wasmFallback) {
312+
pipelineOptions.device = 'wasm';
313+
}
314+
315+
this.pipeline = await tfPipeline('feature-extraction', this.localModelId, pipelineOptions);
309316

310317
this.localDimensions = modelInfo.dimensions;
311318
this.modelReady = true;
312319
this.modelLoading = false;
313320
this.downloadProgress = 100;
314321
await this.loadCache();
315322
this.initialized = true;
316-
this.onProgress?.(`[RAG] 🧠 Semantic engine ready: ${modelInfo.name} (${modelInfo.dimensions}d)`);
323+
const backendLabel = _wasmFallback ? 'WASM' : 'native';
324+
this.onProgress?.(`[RAG] 🧠 Semantic engine ready: ${modelInfo.name} (${modelInfo.dimensions}d, ${backendLabel})`);
317325
this.notifyStatus();
318326
} catch (err: any) {
319327
const cancelled = this._cancelRequested || (err.message && err.message.includes('DOWNLOAD_CANCELLED'));
@@ -329,8 +337,14 @@ export class SemanticEmbeddings {
329337
this.notifyStatus();
330338
return; // 取消不抛异常
331339
}
332-
// v3.0.0: 检测缓存损坏(Protobuf parsing failed / failed to load 等),自动清理并重试一次
333340
const errMsg = err.message || '';
341+
// v3.1.1: 检测 native DLL 加载失败 — 自动回退 WASM backend
342+
const isDllFailure = /DLL initialization|onnxruntime_binding|native.*failed|\.node/i.test(errMsg);
343+
if (isDllFailure && !_wasmFallback) {
344+
this.onProgress?.(`[RAG] ⚠️ Native ONNX runtime failed, falling back to WASM backend...`);
345+
return this.loadLocalModel(_retried, true);
346+
}
347+
// v3.0.0: 检测缓存损坏(Protobuf parsing failed / failed to load 等),自动清理并重试一次
334348
const isCorrupted = /protobuf parsing failed|failed to load.*onnx|invalid model|corrupted/i.test(errMsg);
335349
if (isCorrupted && !_retried) {
336350
this.onProgress?.(`[RAG] ⚠️ Model cache corrupted, cleaning and retrying...`);
@@ -345,7 +359,7 @@ export class SemanticEmbeddings {
345359
this.onProgress?.(`[RAG] ⚠️ Cache cleanup failed: ${cleanErr.message}`);
346360
}
347361
// 重试一次
348-
return this.loadLocalModel(true);
362+
return this.loadLocalModel(true, _wasmFallback);
349363
}
350364
this.lastError = errMsg || 'Failed to load model';
351365
this.onProgress?.(`[RAG] ❌ Model load failed: ${this.lastError}`);

0 commit comments

Comments
 (0)