feat(gateway): add interrupt preemption telemetry and requester notice

This commit is contained in:
William Valentin
2026-02-19 11:48:41 -08:00
parent 6b56d9e223
commit 01cd726d7c
8 changed files with 82 additions and 11 deletions
+6
View File
@@ -19,6 +19,7 @@ import type {
SessionCheckpointEvent,
SessionAutoCompactEvent,
UserActionEvent,
QueuePreemptEvent,
BackendRouteEvent,
BackendFallbackEvent,
CronTriggerEvent,
@@ -194,6 +195,11 @@ export class AuditLogger {
this.write({ level: 'info', event_type: 'user.action', event: event as unknown as Record<string, unknown> });
}
queuePreempt(event: QueuePreemptEvent): void {
if (!this.shouldLog('sessions', 'info')) {return;}
this.write({ level: 'info', event_type: 'queue.preempt', event: event as unknown as Record<string, unknown> });
}
backendRoute(event: BackendRouteEvent): void {
if (!this.shouldLog('sessions', 'info')) {return;}
this.write({ level: 'info', event_type: 'backend.route', event: event as unknown as Record<string, unknown> });
+11
View File
@@ -11,6 +11,7 @@ export type AuditEventType =
| 'skills.installer.execution_blocked' | 'skills.installer.command_result' | 'skills.registry_install'
// Session lifecycle
| 'session.create' | 'session.message' | 'session.delete' | 'session.transfer' | 'session.compact' | 'session.checkpoint' | 'session.auto_compact' | 'user.action'
| 'queue.preempt'
| 'backend.route' | 'backend.fallback'
// Automation - Cron
| 'cron.trigger' | 'cron.sent' | 'cron.add' | 'cron.remove'
@@ -210,6 +211,16 @@ export interface UserActionEvent {
command?: string;
}
export interface QueuePreemptEvent {
session_id: string;
channel: string;
sender: string;
lane_id: string;
request_id: string;
mode: 'interrupt';
cancelled_active_run: boolean;
}
export interface BackendRouteEvent {
session_id: string;
channel: string;