copilotApiService.ts ×5

Frontier kind: Code frontier

unlabeled · c_078aa1c3bce0

75 tests · 20143 LOC · 84 files · introduces 0 tests · 41 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges41 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1591 ranges20143 lines · 84 files · Browse complete extent
All tests (intent)
75 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

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 native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 41 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/copilotApiService.ts 41 introduced LOC · 5 ranges

Open complete file

589 ): Promise<Anthropic.Message>;
590 messages(
591 > githubToken: string, copilotApiService.ts
592 > request: Anthropic.MessageCreateParams,
593 > options?: ICopilotApiServiceRequestOptions,
594 > ): AsyncGenerator<Anthropic.MessageStreamEvent> | Promise<Anthropic.Message> {
595 > if (request.stream) {
596 return this._messagesStreaming(githubToken, request, options);
597 }
598 return this._messagesNonStreaming(githubToken, request, options);
600
601 async countTokens(
816
817 private async _sendRequest(
818 > githubToken: string, copilotApiService.ts
819 > request: Anthropic.MessageCreateParams,
820 > stream: boolean,
821 > options?: ICopilotApiServiceRequestOptions,
822 > ): Promise<Response> {
823 > const capiClient = await this._getClientForToken(githubToken);
824 const requestId = generateUuid();
825
834 ? { system: typeof system === 'string' ? [{ type: 'text', text: system }] : system }
835 : {}),
837 >
838 > const response = await capiClient.makeRequest<Response>(
839 > {
840 > method: 'POST',
841 > headers: {
842 > ...options?.headers,
843 > 'Content-Type': 'application/json',
844 > 'Authorization': `Bearer ${githubToken}`,
845 > 'X-Request-Id': requestId,
846 > 'X-GitHub-Api-Version': '2026-01-09',
847 > // Should these be parameterized?
848 > 'OpenAI-Intent': 'messages-proxy',
849 > 'X-Interaction-Type': 'messages-proxy',
850 > // `X-Initiator` (user|agent) is intentionally omitted: the
851 > // user-vs-agent turn origin known to `ClaudeAgentSession` is not
852 > // plumbed across the SDK subprocess to this proxy, so a hardcoded
853 > // value would mislabel most agent-loop traffic. CAPI accepts the
854 > // request without it (the `responses()` and `utilityChatCompletion()`
855 > // paths already omit it). Thread a real per-turn initiator here if
856 > // that signal ever becomes available at the proxy boundary.
857 > },
858 > suppressIntegrationId: options?.suppressIntegrationId,
859 > body,
860 > signal: options?.signal,
861 > },
862 > { type: RequestType.ChatMessages },
863 > );
864 if (!response.ok) {
865 if (response.status === 401 || response.status === 403) {