/**
 * 实时教练 provider 抽象 —— Qwen-Omni-Realtime 与 Gemini Live 两套不同协议,
 * 对网关暴露同一个 open() 接口:喂音频 → 回吐文字提示。
 */

export type RealtimeProviderKey = 'qwen' | 'gemini';

export interface CoachProxyHandle {
  /** 灌一帧 base64 PCM16 16k 音频(provider 内部按"患者停顿"切轮触发) */
  appendAudio(base64Frame: string): void;
  close(): void;
}

export interface ProxyHandlers {
  onDelta: (text: string) => void; // 流式增量提示
  onDone: (full: string) => void; // 一句完成
  onError: (msg: string) => void;
}

export interface RealtimeProvider {
  /** 开一条实时会话(instructions=教练 system + 患者上下文);resolve 时已就绪可灌音频 */
  open(instructions: string, handlers: ProxyHandlers): Promise<CoachProxyHandle>;
}
