import { EventCatalog } from './event-catalog.js'; import { EventIngress } from './event-ingress.js'; import type { EventRepository } from './event-repository.js'; export const TEST_TIME = '2026-07-15T00:00:00.000Z'; export function seedScope( repository: EventRepository, input: { sessionId?: string; segmentId?: string; adapterId?: string; accountId?: string; sequence?: number; mode?: string; } = {}, ): { sessionId: string; segmentId: string } { const sessionId = input.sessionId ?? 'session-1'; const segmentId = input.segmentId ?? 'segment-1'; repository.saveSession({ sessionId, adapterId: input.adapterId ?? 'test-game', accountId: input.accountId ?? 'account-1', resumeKey: `resume:${sessionId}`, mode: input.mode, status: 'open', isCurrent: true, openedAt: TEST_TIME, }); repository.saveSegment({ segmentId, sessionId, sequence: input.sequence ?? 1, kind: 'connection', scopeRef: `scope:${segmentId}`, status: 'open', isCurrent: true, openedAt: TEST_TIME, }); return { sessionId, segmentId }; } export function testCatalog(): EventCatalog { return new EventCatalog([ { type: 'speech', producer: 'backend_push', deliveryClass: 'monitor_and_events' }, { type: 'vote', producer: 'backend_push', deliveryClass: 'monitor_and_events', wakeAgent: false }, { type: 'client_notice', producer: 'local_synth', deliveryClass: 'monitor_and_events' }, ]); } export async function publishText( ingress: EventIngress, input: { eventId: string; sessionId?: string; segmentId?: string; type?: 'speech' | 'vote'; text?: string; occurredAt?: string; sourceId?: string; sequence?: number; }, ): Promise { await ingress.publish({ eventId: input.eventId, type: input.type ?? 'speech', producer: 'backend_push', sessionId: input.sessionId ?? 'session-1', segmentId: input.segmentId ?? 'segment-1', occurredAt: input.occurredAt ?? TEST_TIME, payload: { text: input.text ?? input.eventId }, source: { sourceId: input.sourceId ?? 'ws:test', eventId: `remote:${input.eventId}`, sequence: input.sequence, }, }); }