src/vs/platform/agentHost/common/agentHostClientProxyChannel.ts

83 LOC · 80 covered · 3 uncovered · 9 ranges · 11 concepts · 2 introducers · 6 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filesrc/vs/platform/agentHost/node/agentHostRequestService.ts · 197 LOCnode/agentHostRequestSer…src/vs/platform/agentHost/node/networkDiagnosticsService.ts · 194 LOCnode/networkDiagnosticsS…agentHostRequestService.ts ×2 · 7 introduced LOCagentHostRequestService.…agentHostRequestService.ts ×4 · 10 introduced LOCagentHostRequestService.…agentHostRequestService.ts ×6 · 32 introduced LOCagentHostRequestService.…agentHostRequestService.ts ×2 · 4 introduced LOCagentHostRequestService.…agentHostRequestService.ts ×1 · 2 introduced LOCagentHostRequestService.…agentHostRequestService.ts ×1 · 2 introduced LOCagentHostRequestService.…agentHostRequestService.ts ×5 · 8 introduced LOCagentHostRequestService.…agentHostRequestService.ts ×12 · 46 introduced LOCagentHostRequestService.…networkDiagnosticsService.ts ×11 · 83 introduced LOCnetworkDiagnosticsServic…agentHostClientProxyChannel.ts ×4 · 26 introduced LOCagentHostClientProxyChan…agentHostRequestService.ts ×11 · 179 introduced LOCagentHostRequestService.…agentHostRequestService.test|title=AgentHostRequestService does not retry non-idempotent requests|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/agentHostRequestService.test|title=AgentHostRequestService does not retry non-idempotent requests|occurrence=1agentHostRequestService.…agentHostRequestService.test|title=AgentHostRequestService forwards cancellation to resolver fetch|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/agentHostRequestService.test|title=AgentHostRequestService forwards cancellation to resolver fetch|occurrence=1agentHostRequestService.…agentHostRequestService.test|title=AgentHostRequestService forwards proxy and authorization lookups through the client channel|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/agentHostRequestService.test|title=AgentHostRequestService forwards proxy and authorization lookups through the client channel|occurrence=1agentHostRequestService.…agentHostRequestService.test|title=AgentHostRequestService retries idempotent requests on transient errors|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/agentHostRequestService.test|title=AgentHostRequestService retries idempotent requests on transient errors|occurrence=1agentHostRequestService.…agentHostRequestService.test|title=AgentHostRequestService uses resolver fetch and streams the response|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/agentHostRequestService.test|title=AgentHostRequestService uses resolver fetch and streams the response|occurrence=1agentHostRequestService.…agentHostRequestService.test|title=NetworkDiagnosticsService includes nested proxy response errors|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/agentHostRequestService.test|title=NetworkDiagnosticsService includes nested proxy response errors|occurrence=1agentHostRequestService.…Focused file · src/vs/platform/agentHost/common/agentHostClientProxyChannel.ts · 83 LOCcommon/agentHostClientPr…

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- agentHostRequestService.ts ×11
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { Event } from '../../../base/common/event.js';
7 > import { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';
8 > import { AuthInfo, Credentials, IRequestService } from '../../request/common/request.js';
9 >
10 > /**
11 > * IPC channel name used for in-process agent-host → renderer reverse proxy
12 > * resolution RPCs. The renderer registers a server channel under this name on
13 > * its `MessagePortClient`; the agent host reaches it via
14 > * `server.getChannel(name, c => c.ctx === clientId)` on its
15 > * `UtilityProcessServer`.
16 > *
17 > * Mirrors {@link AGENT_HOST_CLIENT_BYOK_LM_CHANNEL} for the reverse BYOK bridge.
18 > */
19 > export const AGENT_HOST_CLIENT_PROXY_CHANNEL = 'agentHostClientProxy';
20 >
21 > /**
22 > * Node end of the proxy-resolution bridge: `resolveProxy()` ships the target
23 > * URL to the renderer and resolves with the *raw* result of VS Code's
24 > * `IRequestService.resolveProxy` (the Electron session PAC-style string, e.g.
25 > * `PROXY host:port` / `DIRECT`). The node side feeds this into
26 > * `@vscode/proxy-agent`'s `resolveProxyURL` to derive the final proxy URL.
27 > */
28 > export interface IAgentHostClientProxyConnection {
29 > resolveProxy(url: string): Promise<string | undefined>;
30 > lookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined>;
31 > lookupKerberosAuthorization(url: string): Promise<string | undefined>;
32 > }
33 >
34 > /**
35 > * Wraps an {@link IChannel} (obtained from the agent host's
36 > * `UtilityProcessServer.getChannel`) into an {@link IAgentHostClientProxyConnection}.
37 > */
38 > export function createAgentHostClientProxyConnection(channel: IChannel): IAgentHostClientProxyConnection {
40 > resolveProxy: (url) => channel.call('resolveProxy', { url }) as Promise<string | undefined>,
41 > lookupAuthorization: authInfo => channel.call('lookupAuthorization', { authInfo }) as Promise<Credentials | undefined>,
42 > lookupKerberosAuthorization: url => channel.call('lookupKerberosAuthorization', { url }) as Promise<string | undefined>,
43 > };
44 > }
46 > /**
47 > * Server-side channel for in-process reverse proxy-resolution RPCs from the
48 > * local agent host. Thin adapter — forwards `resolveProxy` calls to the
49 > * renderer's {@link IRequestService}, which resolves the proxy through the
50 > * Electron session (system proxy settings, PAC scripts, etc.). The raw result
51 > * is returned verbatim; the node side derives the proxy URL from it.
52 > */
53 > export class AgentHostClientProxyChannel implements IServerChannel {
54 >
55 > constructor(
56 > @IRequestService private readonly _requestService: IRequestService, agentHostClientProxyChannel.ts ×4
57 > ) { }
59 > listen<T>(_ctx: unknown, event: string): Event<T> {
60 throw new Error(`No event '${event}' on AgentHostClientProxyChannel`);
61 }
63 > async call<T>(_ctx: unknown, command: string, arg?: unknown): Promise<T> {
64 > switch (command) { agentHostClientProxyChannel.ts ×4
65 > case 'resolveProxy': {
66 > const { url } = arg as { url: string };
67 > const proxy = await this._requestService.resolveProxy(url);
68 > return proxy as T;
69 > }
70 > case 'lookupAuthorization': {
71 > const { authInfo } = arg as { authInfo: AuthInfo };
72 > const credentials = await this._requestService.lookupAuthorization(authInfo);
73 > return credentials as T;
74 > }
75 > case 'lookupKerberosAuthorization': {
76 > const { url } = arg as { url: string };
77 > const authorization = await this._requestService.lookupKerberosAuthorization(url);
78 > return authorization as T;
79 > }
80 > }
81 throw new Error(`Unknown command '${command}' on AgentHostClientProxyChannel`);