82 lines
1.5 KiB
TypeScript
82 lines
1.5 KiB
TypeScript
// WebSocket Protocol Types (Gateway <-> Bot)
|
|
|
|
export interface PlayAudioMessage {
|
|
type: 'playAudio';
|
|
sessionId: string;
|
|
audio: {
|
|
format: 'mp3' | 'pcm' | 'wav';
|
|
data: string; // base64 encoded
|
|
};
|
|
}
|
|
|
|
export interface TranscriptMessage {
|
|
type: 'transcript';
|
|
sessionId: string;
|
|
transcript: {
|
|
speaker: string;
|
|
text: string;
|
|
timestamp: string;
|
|
isFinal: boolean;
|
|
};
|
|
}
|
|
|
|
export interface StatusMessage {
|
|
type: 'status';
|
|
sessionId: string;
|
|
status: 'connecting' | 'in_lobby' | 'joined' | 'left' | 'error';
|
|
message?: string;
|
|
}
|
|
|
|
export interface JoinMeetingMessage {
|
|
type: 'joinMeeting';
|
|
sessionId: string;
|
|
meetingUrl: string;
|
|
botName?: string;
|
|
}
|
|
|
|
export interface LeaveMeetingMessage {
|
|
type: 'leaveMeeting';
|
|
sessionId: string;
|
|
}
|
|
|
|
export type GatewayToBot = PlayAudioMessage | JoinMeetingMessage | LeaveMeetingMessage;
|
|
export type BotToGateway = TranscriptMessage | StatusMessage;
|
|
|
|
// Bot State
|
|
export type BotState =
|
|
| 'idle'
|
|
| 'launching'
|
|
| 'navigating'
|
|
| 'in_lobby'
|
|
| 'in_meeting'
|
|
| 'leaving'
|
|
| 'error'
|
|
| 'disconnected';
|
|
|
|
// Session
|
|
export interface BotSession {
|
|
sessionId: string;
|
|
meetingUrl: string;
|
|
botName: string;
|
|
state: BotState;
|
|
createdAt: Date;
|
|
joinedAt?: Date;
|
|
leftAt?: Date;
|
|
error?: string;
|
|
}
|
|
|
|
// Transcript Entry
|
|
export interface TranscriptEntry {
|
|
speaker: string;
|
|
text: string;
|
|
timestamp: Date;
|
|
isFinal: boolean;
|
|
}
|
|
|
|
// Meeting URL Types
|
|
export interface ParsedMeetingUrl {
|
|
type: 'classic' | 'short';
|
|
originalUrl: string;
|
|
meetingId?: string;
|
|
passcode?: string;
|
|
}
|