From d42c050e3645b4eb4635dd5a73ae12107adca701 Mon Sep 17 00:00:00 2001
From: dipfocus <dipfocus@gmail.com>
Date: Fri, 13 Jun 2025 09:23:54 +0800
Subject: [PATCH 1/2] feat: add proxy support for ripgrep download

---
 binary/package-lock.json | 19 ++++++++++++++++---
 binary/package.json      |  1 +
 binary/utils/ripgrep.js  |  6 ++++++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/binary/package-lock.json b/binary/package-lock.json
index abb11ce8efb..ead2d8b830e 100644
--- a/binary/package-lock.json
+++ b/binary/package-lock.json
@@ -20,6 +20,7 @@
         "posthog-node": "^3.6.3",
         "system-ca": "^1.0.2",
         "tar": "^7.4.3",
+        "undici": "^7.10.0",
         "uuid": "^9.0.1",
         "vectordb": "^0.4.20",
         "win-ca": "^3.5.1"
@@ -52,9 +53,9 @@
         "@aws-sdk/credential-providers": "^3.778.0",
         "@continuedev/config-types": "^1.0.13",
         "@continuedev/config-yaml": "file:../packages/config-yaml",
-        "@continuedev/fetch": "^1.0.10",
+        "@continuedev/fetch": "^1.0.13",
         "@continuedev/llm-info": "^1.0.8",
-        "@continuedev/openai-adapters": "^1.0.25",
+        "@continuedev/openai-adapters": "^1.0.32",
         "@modelcontextprotocol/sdk": "^1.12.0",
         "@mozilla/readability": "^0.5.0",
         "@octokit/rest": "^20.1.1",
@@ -105,6 +106,7 @@
         "sqlite3": "^5.1.7",
         "system-ca": "^1.0.3",
         "tar": "^7.4.3",
+        "tree-sitter-structured-text": "^0.0.1",
         "tree-sitter-wasms": "^0.1.11",
         "uuid": "^9.0.1",
         "vectordb": "^0.4.20",
@@ -143,8 +145,10 @@
         "myers-diff": "^2.1.0",
         "onnxruntime-common": "1.14.0",
         "onnxruntime-web": "1.14.0",
+        "tree-sitter-cli": "^0.22.5",
         "ts-jest": "^29.1.1",
-        "typescript": "^5.6.3"
+        "typescript": "^5.6.3",
+        "vitest": "^3.1.4"
       },
       "engines": {
         "node": ">=20.19.0"
@@ -6773,6 +6777,15 @@
         "node": ">=8"
       }
     },
+    "node_modules/undici": {
+      "version": "7.10.0",
+      "resolved": "https://registry.npmmirror.com/undici/-/undici-7.10.0.tgz",
+      "integrity": "sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=20.18.1"
+      }
+    },
     "node_modules/universal-user-agent": {
       "version": "6.0.1",
       "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
diff --git a/binary/package.json b/binary/package.json
index 0e8949aa6ba..11161d67ee3 100644
--- a/binary/package.json
+++ b/binary/package.json
@@ -53,6 +53,7 @@
     "posthog-node": "^3.6.3",
     "system-ca": "^1.0.2",
     "tar": "^7.4.3",
+    "undici": "^7.10.0",
     "uuid": "^9.0.1",
     "vectordb": "^0.4.20",
     "win-ca": "^3.5.1"
diff --git a/binary/utils/ripgrep.js b/binary/utils/ripgrep.js
index 9a26ebe26e0..267dd00cb2a 100644
--- a/binary/utils/ripgrep.js
+++ b/binary/utils/ripgrep.js
@@ -4,6 +4,7 @@ const { rimrafSync } = require("rimraf");
 const tar = require("tar");
 const { RIPGREP_VERSION, TARGET_TO_RIPGREP_RELEASE } = require("./targets");
 const AdmZip = require("adm-zip");
+const { ProxyAgent } = require('undici');
 
 const RIPGREP_BASE_URL = `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}`;
 
@@ -16,8 +17,13 @@ const RIPGREP_BASE_URL = `https://github.com/BurntSushi/ripgrep/releases/downloa
  */
 async function downloadFile(url, destPath) {
   // Use the built-in fetch API instead of node-fetch
+  // Use proxy if set in environment variables
+  const proxy = process.env.https_proxy || process.env.HTTPS_PROXY;
+  const agent = proxy ? new ProxyAgent(proxy) : undefined;
+
   const response = await fetch(url, {
     redirect: "follow", // Automatically follow redirects
+    dispatcher: agent,
   });
 
   if (!response.ok) {

From 1188688764dec2cb62e1e08a24a7f6b46675744d Mon Sep 17 00:00:00 2001
From: dipfocus <dipfocus@gmail.com>
Date: Wed, 18 Jun 2025 08:53:40 +0800
Subject: [PATCH 2/2] style: fix code formatting with prettier

---
 binary/utils/ripgrep.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/binary/utils/ripgrep.js b/binary/utils/ripgrep.js
index 267dd00cb2a..725c4d8fe0c 100644
--- a/binary/utils/ripgrep.js
+++ b/binary/utils/ripgrep.js
@@ -4,7 +4,7 @@ const { rimrafSync } = require("rimraf");
 const tar = require("tar");
 const { RIPGREP_VERSION, TARGET_TO_RIPGREP_RELEASE } = require("./targets");
 const AdmZip = require("adm-zip");
-const { ProxyAgent } = require('undici');
+const { ProxyAgent } = require("undici");
 
 const RIPGREP_BASE_URL = `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}`;