Appearance
Protocol: Envelope
iframe 通信基础结构。所有 host ↔ iframe 消息都包裹在 Envelope 里。
Schema
ts
interface Envelope<T = unknown> {
version: string // CONTRACT_VERSION,如 '1.0.0'
id: string // 唯一 ID(用于 request-response 关联)
timestamp: number // Unix ms
type: 'command' | 'event' | 'response' | 'error'
payload: T
}详细说明
见 packages/protocol/src/envelope.ts 的 Zod schema。
见 ARCHITECTURE.md § 8.1。