import type { GameSyncPerceptionReport, GameSyncRuntimeReport } from './game-sync-protocol.js'; import type { BufferedRawWsLogOptions, RawWsLogStats } from './raw-ws-log.js'; import type { WsConnectionState } from '../sdk/types.js'; import type { GameSyncResumeState, WsCloseInfo, WsInputFrame, WsProtocolErrorInfo, WsRecoveryStartedInfo } from './ws-client.js'; export interface GameSyncIngressConfig { url: string; apiKey: string; resumeState?: GameSyncResumeState; reconnectMaxMs?: number; ackIntervalMs?: number; /** Credits for complete frames handed to Source, not a socket-disconnect threshold. */ maxInFlightFrames: number; maxPendingBytes: number; rawLog?: { path: string; options?: BufferedRawWsLogOptions }; } export type IngressCommand = | { type: 'consumed'; token: string } | { type: 'report'; perceptions: readonly GameSyncPerceptionReport[]; connectionId: string } | { type: 'runtime_report'; report: GameSyncRuntimeReport; connectionId: string } | { type: 'telemetry_ack' } | { type: 'stop' }; export type IngressEvent = | { type: 'frame'; frame: WsInputFrame } | { type: 'opened'; connectionId: string } | { type: 'state'; state: WsConnectionState } | { type: 'close'; connectionId: string; info: WsCloseInfo } | { type: 'protocol'; info: WsProtocolErrorInfo } | { type: 'recovery'; info: WsRecoveryStartedInfo } | { type: 'connected' } | { type: 'failed'; code: string } | { type: 'report_done' } | { type: 'telemetry'; attributes: Record } | { type: 'stopped'; rawStats?: RawWsLogStats };