返回 oh-my-ppt
event-contract.ts
根目录 / src / main / ipc / runtime / event-contract.ts
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
19 lines TYPESCRIPT