function handleEvent(event: QueryRouterEventUnion) {
switch (event.type) {
case 'classify:start':
console.log(`Classifying: ${event.query}`);
break;
case 'retrieve:vector':
console.log(`Vector search returned ${event.chunkCount} chunks`);
break;
case 'capabilities:activate':
console.log(`Activating ${event.skills.length} skills, ${event.tools.length} tools`);
break;
case 'route:complete':
console.log(`Done in ${event.durationMs}ms`);
break;
}
}
Discriminated union of all QueryRouter lifecycle events. The
typefield serves as the discriminant for exhaustive matching.