4235
}
4236
}
4238
>
type AgentHostInstructionsCollectedEvent = {
4239
>
provider: string;
4240
>
agentSessionId: string;
4241
>
isSubagentSession: boolean;
4242
>
totalInstructionsCount: number;
4243
>
agentInstructionsCount: number;
4244
>
applyingInstructionsCount: number;
4245
>
referencedInstructionsCount: number;
4246
>
claudeMdCount: number;
4247
>
};
4248
>
type AgentHostInstructionsCollectedClassification = {
4249
>
provider: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The Agent Host provider that emitted this event (e.g. copilotcli). Absent on local rows; use presence to distinguish AH from local.' };
4250
>
agentSessionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The Agent Host session identifier. Absent on local rows.' };
4251
>
isSubagentSession: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Whether the emission was from a subagent session.' };
4252
>
totalInstructionsCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Total number of instruction sources loaded by the Agent Host session.' };
4253
>
agentInstructionsCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of top-level agent instruction files (copilot-instructions.md, AGENTS.md, CLAUDE.md, GEMINI.md) among the loaded sources.' };
4254
>
applyingInstructionsCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of loaded instruction sources that carry an applyTo glob pattern. Semantic shift from the local field, which counts sources whose applyTo matched the current request context.' };
4255
>
referencedInstructionsCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of loaded instruction sources discovered transitively (child-instructions via subdirectory walk, or nested AGENTS.md). Semantic shift from the local field, which counts sources added via explicit <file> references in other instruction files.' };
4256
>
claudeMdCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of CLAUDE.md files among the loaded sources.' };
4257
>
owner: 'amunger';
4258
>
comment: 'Agent Host emission of agentHost.instructionsCollected. Carries the subset of the local shape that can be honestly (or close-analogously) computed from the SDK\'s InstructionSource list; other fields are intentionally omitted (see source comment).';
4259
>
};
4260
>
this._telemetryService.publicLog2<AgentHostInstructionsCollectedEvent, AgentHostInstructionsCollectedClassification>('agentHost.instructionsCollected', {
4261
>
provider: this.sessionUri.scheme,
4262
>
agentSessionId: AgentSession.id(this.sessionUri),
4263
>
isSubagentSession: isSubagentSession(this.sessionUri),
4264
>
totalInstructionsCount: sources.length,
4265
>
agentInstructionsCount,
4266
>
applyingInstructionsCount,
4267
>
referencedInstructionsCount,
4268
>
claudeMdCount,
4269
>
});
4270
})().catch(err => {
4271
this._logService.trace(`[Copilot:${sessionId}] instructionsCollected telemetry failed: ${getErrorMessage(err)}`);