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
+18
View File
@@ -703,6 +703,24 @@ describe('CompanionRuntimeClient', () => {
});
});
it('returns event surface snapshot', async () => {
const client = new CompanionRuntimeClient({
url: 'ws://127.0.0.1:1',
});
const pendingWait = client.waitForEvent('agent.stream', { timeoutMs: 10_000 }).catch(() => undefined);
const unsubscribe = client.subscribeEvents(() => undefined);
expect(client.getEventSurfaceSnapshot()).toEqual({
knownEventNames: ['agent.stream', 'agent.typing', 'context_warning'],
eventSubscriptionCount: 2,
pendingEventWaitCount: 1,
});
unsubscribe();
client.clearEventSubscriptions();
await pendingWait;
});
it('waitForIdle resolves immediately when no work is pending', async () => {
const client = new CompanionRuntimeClient({
url: 'ws://127.0.0.1:1',