Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 72 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ async function main() {
plugins,
entryPoints: ["extension.ts"],
outfile: "dist/extension.js",
external: ["vscode", "esbuild"],
// global-agent must be external because it dynamically patches Node.js http/https modules
// which breaks when bundled. It needs access to the actual Node.js module instances.
external: ["vscode", "esbuild", "global-agent", "undici"],
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { customToolRegistry } from "@roo-code/core"

import "./utils/path" // Necessary to have access to String.prototype.toPosix.
import { createOutputChannelLogger, createDualLogger } from "./utils/outputChannelLogger"
import { initializeNetworkProxy } from "./utils/networkProxy"

import { Package } from "./shared/package"
import { formatLanguage } from "./shared/language"
Expand Down Expand Up @@ -68,6 +69,11 @@ export async function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(outputChannel)
outputChannel.appendLine(`${Package.name} extension activated - ${JSON.stringify(Package)}`)

// Initialize network proxy configuration early, before any network requests.
// When proxyUrl is configured, all HTTP/HTTPS traffic will be routed through it.
// In debug mode, TLS verification is disabled to allow MITM proxy inspection.
initializeNetworkProxy(context, outputChannel)

// Set extension path for custom tool registry to find bundled esbuild
customToolRegistry.setExtensionPath(context.extensionPath)

Expand Down
7 changes: 7 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@
"type": "boolean",
"default": false,
"description": "%settings.debug.description%"
},
"roo-cline.proxyUrl": {
"type": "string",
"default": "",
"description": "%settings.proxyUrl.description%"
}
}
}
Expand Down Expand Up @@ -461,6 +466,7 @@
"fastest-levenshtein": "^1.0.16",
"fzf": "^0.5.2",
"get-folder-size": "^5.0.0",
"global-agent": "^3.0.0",
"google-auth-library": "^9.15.1",
"gray-matter": "^4.0.3",
"i18next": "^25.0.0",
Expand Down Expand Up @@ -503,6 +509,7 @@
"tmp": "^0.2.3",
"tree-sitter-wasms": "^0.1.12",
"turndown": "^7.2.0",
"undici": "^6.21.3",
"uuid": "^11.1.0",
"vscode-material-icons": "^0.1.1",
"web-tree-sitter": "^0.25.6",
Expand Down
3 changes: 2 additions & 1 deletion src/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
"settings.apiRequestTimeout.description": "Maximum time in seconds to wait for API responses (0 = no timeout, 1-3600s, default: 600s). Higher values are recommended for local providers like LM Studio and Ollama that may need more processing time.",
"settings.newTaskRequireTodos.description": "Require todos parameter when creating new tasks with the new_task tool",
"settings.codeIndex.embeddingBatchSize.description": "The batch size for embedding operations during code indexing. Adjust this based on your API provider's limits. Default is 60.",
"settings.debug.description": "Enable debug mode to show additional buttons for viewing API conversation history and UI messages as prettified JSON in temporary files."
"settings.debug.description": "Enable debug mode to show additional buttons for viewing API conversation history and UI messages as prettified JSON in temporary files.",
"settings.proxyUrl.description": "HTTP(S) proxy URL for all outbound network requests. When running in debug mode (F5), TLS certificate verification is bypassed to allow MITM proxy inspection. Leave empty to disable proxy. Example: http://localhost:8080"
}
47 changes: 47 additions & 0 deletions src/types/global-agent.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Type declarations for global-agent package.
*
* global-agent is a library that creates a global HTTP/HTTPS agent
* that routes all traffic through a specified proxy.
*
* @see https://github.com/gajus/global-agent
*/

declare module "global-agent" {
/**
* Bootstrap global-agent to intercept all HTTP/HTTPS requests.
*
* After calling this function, all outgoing HTTP/HTTPS requests
* from the Node.js process will be routed through the proxy
* specified by the GLOBAL_AGENT_HTTP_PROXY and GLOBAL_AGENT_HTTPS_PROXY
* environment variables.
*
* @returns void
*/
export function bootstrap(): void

/**
* Create a global agent with custom configuration.
*
* @param options Configuration options for the global agent
* @returns void
*/
export function createGlobalProxyAgent(options?: {
/**
* Environment variable namespace prefix.
* Default: "GLOBAL_AGENT_"
*/
environmentVariableNamespace?: string

/**
* Force global agent to be used for all HTTP/HTTPS requests.
* Default: true
*/
forceGlobalAgent?: boolean

/**
* Socket connection timeout in milliseconds.
*/
socketConnectionTimeout?: number
}): void
}
Loading
Loading