feat(companion): add event surface snapshot helper

This commit is contained in:
William Valentin
2026-02-16 22:22:18 -08:00
parent a6e9daaaef
commit 29523bcdac
7 changed files with 86 additions and 2 deletions
+14
View File
@@ -53,6 +53,12 @@ export interface PendingWorkSnapshot {
hasPendingWork: boolean;
}
export interface EventSurfaceSnapshot {
knownEventNames: CompanionEventName[];
eventSubscriptionCount: number;
pendingEventWaitCount: number;
}
export type CompanionEventHandler = (event: string, data: unknown) => void;
export type CompanionTypedEventHandler<TData = unknown> = (data: TData) => void;
export type CompanionEventPredicate<TData = unknown> = (data: TData) => boolean;
@@ -338,6 +344,14 @@ export class CompanionRuntimeClient {
};
}
getEventSurfaceSnapshot(): EventSurfaceSnapshot {
return {
knownEventNames: this.listKnownEventNames(),
eventSubscriptionCount: this.eventSubscriptionCount,
pendingEventWaitCount: this.pendingEventWaitCount,
};
}
async connect(): Promise<void> {
if (this.connected) {
return;