| 1 | import type { RuntimeEventEnvelope } from '../../agent-runtime' |
| 2 | |
| 3 | export type LegacyRuntimeEventMessage = { |
| 4 | channel: string |
| 5 | payload: unknown |
| 6 | } |
| 7 | |
| 8 | /** |
| 9 | * Baseline-A compatibility table. Only generation historically had a push |
| 10 | * channel; image generation returns from its invoke handler and exposes |
| 11 | * images:getState for recovery, so it intentionally has no invented channel. |
| 12 | */ |
| 13 | export const translateLegacyRuntimeEvent = ( |
| 14 | event: RuntimeEventEnvelope |
| 15 | ): LegacyRuntimeEventMessage | null => |
| 16 | event.type === 'generation.chunk' |
| 17 | ? { channel: 'generate:chunk', payload: event.payload } |
| 18 | : null |
| 19 |