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) {