From dffb64dd06d6d08c8c0f101c43317faeae1a34a0 Mon Sep 17 00:00:00 2001 From: helpfulcraft Date: Wed, 20 May 2026 11:22:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=80=82=E9=85=8D=20Antigravity=20IDE=202.?= =?UTF-8?q?0=20=E4=B8=BB=E8=BF=9B=E7=A8=8B=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Antigravity IDE 升级至 2.0 后,主进程的可执行文件名由 Antigravity.exe 变更为 Antigravity IDE.exe,导致代理 DLL 无法正确识别主进程,网络请求拦截失效。 修改内容: 1. src/hooks/Hooks.cpp:IsCurrentAntigravityMainProcess() 增加对 antigravity ide.exe 的匹配,向下兼容旧版 antigravity.exe 2. build.ps1:默认 config.json 的 target_processes 增补 Antigravity IDE.exe,确保新装用户开箱即用 3. resources/config-web/index.html:同步更新配置工具中的默认值,保持一致性 已在 Windows x64 本地编译并部署,实测 Antigravity IDE 2.0 网络请求可正常被代理拦截。 --- build.ps1 | 6 +++--- resources/config-web/index.html | 2 +- src/hooks/Hooks.cpp | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.ps1 b/build.ps1 index 3100e65..7128828 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,4 +1,4 @@ -# ============================================================ +# ============================================================ # Antigravity-Proxy 编译脚本 # PowerShell Build Script for Windows # ============================================================ @@ -323,7 +323,7 @@ $configJson = @{ # 子进程注入排除列表(大小写不敏感,支持子串匹配) child_injection_exclude = @() # 目标进程列表(空数组=注入所有子进程) - target_processes = @("language_server_windows", "Antigravity.exe", "node.exe") + target_processes = @("language_server_windows", "Antigravity.exe", "Antigravity IDE.exe", "node.exe") proxy_rules = @{ # 端口白名单: 仅代理 HTTP(80) 和 HTTPS(443),空数组=代理所有端口 allowed_ports = @(80, 443) @@ -507,7 +507,7 @@ Test-NetConnection -ComputerName 127.0.0.1 -Port 7890 ### 配置示例 ```json { - "target_processes": ["language_server_windows", "Antigravity.exe", "node.exe"], + "target_processes": ["language_server_windows", "Antigravity.exe", "Antigravity IDE.exe", "node.exe"], "child_injection_mode": "filtered", "child_injection_exclude": ["unwanted_process.exe"] } diff --git a/resources/config-web/index.html b/resources/config-web/index.html index b5b2d53..324a75d 100644 --- a/resources/config-web/index.html +++ b/resources/config-web/index.html @@ -1426,7 +1426,7 @@

进程注入

child_injection: true, child_injection_mode: "filtered", child_injection_exclude: [], - target_processes: ["language_server_windows", "Antigravity.exe", "node.exe"], + target_processes: ["language_server_windows", "Antigravity.exe", "Antigravity IDE.exe", "node.exe"], proxy_rules: { allowed_ports: [80, 443], dns_mode: "direct", diff --git a/src/hooks/Hooks.cpp b/src/hooks/Hooks.cpp index cffd369..2c828a9 100644 --- a/src/hooks/Hooks.cpp +++ b/src/hooks/Hooks.cpp @@ -319,7 +319,8 @@ struct AntLocationEvidence { }; static bool IsCurrentAntigravityMainProcess() { - return ToLowerAsciiCopy(GetCurrentProcessBaseName()) == "antigravity.exe"; + std::string procName = ToLowerAsciiCopy(GetCurrentProcessBaseName()); + return procName == "antigravity.exe" || procName == "antigravity ide.exe"; } static void CloseSocketCompat(SOCKET s) { From 5844afb6abaf0bccf388cf263e438b1167e64fe5 Mon Sep 17 00:00:00 2001 From: helpfulcraft Date: Sat, 23 May 2026 15:30:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(build):=20=E4=BF=AE=E5=A4=8D=20build.ps?= =?UTF-8?q?1=20=E7=BC=96=E7=A0=81=E5=B9=B6=E4=BC=98=E5=8C=96=20DLL=20?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=EF=BC=9Bfeat:=20=E5=85=BC=E5=AE=B9=20Antigra?= =?UTF-8?q?vity=202.0=20=E5=90=8E=E7=AB=AF=E8=BF=9B=E7=A8=8B=20(language?= =?UTF-8?q?=5Fserver)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.ps1 | 12 ++++++++---- resources/config-web/index.html | 2 +- src/hooks/Hooks.cpp | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build.ps1 b/build.ps1 index 7128828..cfe9318 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,4 +1,4 @@ -# ============================================================ +# ============================================================ # Antigravity-Proxy 编译脚本 # PowerShell Build Script for Windows # ============================================================ @@ -264,7 +264,11 @@ if ($SkipTests) { Write-Step "查找编译产物..." $dllPattern = if ($Config -eq "Debug") { "version*.dll" } else { "version.dll" } -$dllPath = Get-ChildItem -Path $BuildDir -Recurse -Filter $dllPattern | Select-Object -First 1 +# 优先查找配置子目录(Visual Studio 产物路径),若无则在根目录查找(Ninja/Make 产物路径) +$dllPath = Get-ChildItem -Path (Join-Path $BuildDir $Config) -Filter $dllPattern -ErrorAction SilentlyContinue | Select-Object -First 1 +if (-not $dllPath) { + $dllPath = Get-ChildItem -Path $BuildDir -Filter $dllPattern -ErrorAction SilentlyContinue | Select-Object -First 1 +} if (-not $dllPath) { Write-Error "未找到编译产物 DLL" @@ -323,7 +327,7 @@ $configJson = @{ # 子进程注入排除列表(大小写不敏感,支持子串匹配) child_injection_exclude = @() # 目标进程列表(空数组=注入所有子进程) - target_processes = @("language_server_windows", "Antigravity.exe", "Antigravity IDE.exe", "node.exe") + target_processes = @("language_server", "Antigravity.exe", "Antigravity IDE.exe", "node.exe") proxy_rules = @{ # 端口白名单: 仅代理 HTTP(80) 和 HTTPS(443),空数组=代理所有端口 allowed_ports = @(80, 443) @@ -507,7 +511,7 @@ Test-NetConnection -ComputerName 127.0.0.1 -Port 7890 ### 配置示例 ```json { - "target_processes": ["language_server_windows", "Antigravity.exe", "Antigravity IDE.exe", "node.exe"], + "target_processes": ["language_server", "Antigravity.exe", "Antigravity IDE.exe", "node.exe"], "child_injection_mode": "filtered", "child_injection_exclude": ["unwanted_process.exe"] } diff --git a/resources/config-web/index.html b/resources/config-web/index.html index 324a75d..e533cf8 100644 --- a/resources/config-web/index.html +++ b/resources/config-web/index.html @@ -1426,7 +1426,7 @@

进程注入

child_injection: true, child_injection_mode: "filtered", child_injection_exclude: [], - target_processes: ["language_server_windows", "Antigravity.exe", "Antigravity IDE.exe", "node.exe"], + target_processes: ["language_server", "Antigravity.exe", "Antigravity IDE.exe", "node.exe"], proxy_rules: { allowed_ports: [80, 443], dns_mode: "direct", diff --git a/src/hooks/Hooks.cpp b/src/hooks/Hooks.cpp index 2c828a9..78099cb 100644 --- a/src/hooks/Hooks.cpp +++ b/src/hooks/Hooks.cpp @@ -643,14 +643,14 @@ static bool ShouldAutoInjectLanguageServerNodeChild(const Core::Config& config, if (lowerChild != "node.exe" && lowerChild != "node") return false; const std::string lowerCurrent = ToLowerAsciiCopy(GetCurrentProcessBaseName()); - return lowerCurrent.find("language_server_windows") != std::string::npos; + return lowerCurrent.find("language_server") != std::string::npos; } static void LogLanguageServerNodeCompatInjectOnce(const std::string& childProcessName) { std::call_once(g_languageServerNodeCompatLogOnce, [&childProcessName]() { const std::string currentProcessName = GetCurrentProcessBaseName(); Core::Logger::Warn( - "[兼容] 检测到 " + (currentProcessName.empty() ? std::string("language_server_windows 子进程") : currentProcessName) + + "[兼容] 检测到 " + (currentProcessName.empty() ? std::string("language_server 子进程") : currentProcessName) + " 派生了关键子进程 " + childProcessName + ";为兼容新版 Antigravity 对话链路,filtered 模式下将自动继承注入。" " 如需关闭该行为,请将 node.exe 加入 child_injection_exclude。");