133
134
private async _logSkillLoadedTelemetry(skills: readonly IAgentSkill[]): Promise<void> {
136
>
skillNameHash: string;
137
>
skillStorage: string;
138
>
extensionIdHash: string;
139
>
extensionVersion: string;
140
>
pluginNameHash: string;
141
>
pluginVersion: string;
142
>
};
143
>
144
>
type SkillLoadedIntoContextClassification = {
145
>
skillNameHash: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Hash of the skill name loaded into the agent context.' };
146
>
skillStorage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The storage source of the skill (local, user, extension, plugin, internal).' };
147
>
extensionIdHash: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Hash of the contributing extension identifier, empty if none.' };
148
>
extensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Semver version of the contributing extension, empty if none.' };
149
>
pluginNameHash: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Hash of the plugin display name, empty if not from a plugin.' };
150
>
pluginVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Semver version of the plugin, empty if unavailable.' };
151
>
owner: 'manishj, dbreshears';
152
>
comment: 'Tracks individual skill loading into agent context with provenance metadata.';
153
>
};
154
>
155
>
try {
156
>
// Build map of plugin URI to plugin metadata for provenance
157
>
const pluginByUri = new ResourceMap<IAgentPlugin>();
158
>
const allPlugins = this._agentPluginService.plugins.get();
159
>
for (const plugin of allPlugins) {
160
pluginByUri.set(plugin.uri, plugin);
161
}
163
>
const hashOrEmpty = (value: string | undefined) => {
164
>
return value !== undefined ? String(hash(value)) : '';
165
>
};
166
>
167
>
for (const skill of skills) {
168
>
const skillPlugin = skill.pluginUri ? pluginByUri.get(skill.pluginUri) : undefined;
169
>
this._telemetryService.publicLog2<SkillLoadedIntoContextEvent, SkillLoadedIntoContextClassification>('skillLoadedIntoContext', {
170
>
skillNameHash: hashOrEmpty(skill.name),
171
>
skillStorage: skill.storage,
172
>
extensionIdHash: hashOrEmpty(skill.extension?.identifier.value),
173
>
extensionVersion: skill.extension?.version ?? '',
174
>
pluginNameHash: hashOrEmpty(skillPlugin?.label),
175
>
pluginVersion: skillPlugin?.fromMarketplace?.version ?? '',
176
>
});
177
>
}
178
>
} catch (err) {
179
this._logService.error('[InstructionsContextComputer] Failed to log skill telemetry', err);
180
}
182
183
/** public for testing */