copilotAgentSession.ts ×5

Frontier kind: Joint frontier

unlabeled · c_ce535b70453b

2 tests · 43768 LOC · 243 files · introduces 1 test · 38 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges38 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
4005 ranges43768 lines · 243 files · Browse complete extent
All tests (intent)
2 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.

1 test introduced at this concept.

Introduced code

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

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

src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts 38 introduced LOC · 5 ranges

Open complete file

3147
3148 this._register(wrapper.onMessage(e => {
3149 > this._logService.info(`[Copilot:${sessionId}] Full message received: ${e.data.content.length} chars`); copilotAgentSession.ts
3150 > // Report the enhanced GH `request.options.tools` event for this model call — parity with
3151 > // the Copilot extension, which emits it per LLM request. `assistant.message` is the
3152 > // agent-host's per-model-call boundary; we correlate on its `x-copilot-service-request-id`.
3153 > // Main agent only: `_appliedSnapshot.tools` is the session's tool set, which does not
3154 > // describe a subagent's model call, so subagent messages (mapped or dropped) are skipped.
3155 > if (!e.agentId) {
3156 > this._telemetryReporter.assistantMessageReceived(this.sessionUri.toString(), e.data.serviceRequestId, this._appliedSnapshot.tools);
3157 > // Restricted `conversation.messageText` (source=model): the model's raw response text.
3158 > this._telemetryReporter.modelMessageText(this.sessionUri.toString(), e.data.content, this._turnOrdinal, e.data.serviceRequestId);
3159 > // Accumulate the per-turn tool-call aggregate for the restricted `toolCallDetails` event.
3160 > // Every main-agent `assistant.message` is one model-call round (matches the extension's
3161 > // `numRequests = toolCallRounds.length`, which counts the final tool-free response round
3162 > // too); the tool-count stats only apply to rounds that carried tool requests.
3163 > const turn = this._currentTurn;
3164 > if (turn) {
3165 turn.toolCallRounds++;
3166 if (e.data.model) {
3179 }
3180 }
3182 > // The SDK fires a `message` event with the full assembled content after
3183 > // streaming deltas. If deltas already created a markdown part for this
3184 > // turn, the live state is up to date and we skip. Only emit a fresh
3185 > // part when no deltas preceded the message (e.g. text after tool calls
3186 > // where the SDK delivered the full message at once).
3187 > //
3188 > // Other fields (toolRequests, reasoningText, encryptedContent) are
3189 > // only used for history reconstruction and live tool calls fire their
3190 > // own tool_start events, so we can safely drop them here.
3191 > if (!e.data.content) {
3192 return;
3193 }
3194 > if (this._shouldDropUnmappedSubagentEvent(e, 'assistant.message')) { copilotAgentSession.ts
3195 return;
3196 }
3197 > const parentToolCallId = this._parentToolCallIdForSubagentEvent(e); copilotAgentSession.ts
3198 > const markdownScope = parentToolCallId ?? '';
3199 > if (this._currentTurn?.markdownPartIds.has(markdownScope)) {
3200 return;
3201 }
3202 > const partId = generateUuid(); copilotAgentSession.ts
3203 > this._currentTurn?.markdownPartIds.set(markdownScope, partId);
3204 > this._emitAction({
3205 > type: ActionType.ChatResponsePart,
3206 > turnId: this._turnId,
3207 > part: { kind: ResponsePartKind.Markdown, id: partId, content: e.data.content },
3208 > }, parentToolCallId);
3209 }));
3210