/** * Bot Configuration Types * * TypeScript type definitions for bot configuration and management. * Used for spawning and managing screenshare and tool forwarder bots. * * @module @buzztrail/shared/types/bot */ /** * Bot type identifier */ export type BotType = 'screenshare' | 'tavus-forwarder'; /** * Bot status values */ export type BotStatus = | 'spawning' | 'running' | 'stopping' | 'stopped' | 'error'; /** * Configuration for spawning a bot */ export interface BotSpawnConfig { /** Daily.co room URL to join */ roomUrl: string; /** Slidev deck URL to present (for screenshare bots) */ deckUrl?: string; /** Session ID to associate bot with */ sessionId: string; /** Optional Daily.co meeting token for authentication */ meetingToken?: string; /** Bot type */ botType?: BotType; } /** * Daily.co room configuration */ export interface RoomConfig { /** Daily.co room URL */ url: string; /** Room name/identifier */ name?: string; /** Meeting token for authentication */ token?: string; /** Room properties (privacy settings, etc.) */ properties?: { /** Enable screenshare */ enable_screenshare?: boolean; /** Enable chat */ enable_chat?: boolean; /** Maximum participants */ max_participants?: number; /** Room expiration time */ exp?: number; }; } /** * Screenshare bot specific configuration */ export interface ScreenshareBotConfig { /** Daily.co room configuration */ room: RoomConfig; /** Slidev deck URL to present */ deckUrl: string; /** Session ID */ sessionId: string; /** Frames per second for screenshare (default: 10) */ fps?: number; /** Video resolution */ resolution?: { width: number; height: number; }; /** Browser configuration for rendering */ browser?: { /** Headless mode (default: true) */ headless?: boolean; /** Viewport size */ viewport?: { width: number; height: number; }; }; } /** * Tavus tool forwarder bot configuration */ export interface TavusToolForwarderBotConfig { /** Daily.co room configuration */ room: RoomConfig; /** Session ID */ sessionId: string; /** Webhook URL for tool call responses */ webhookUrl?: string; /** Tool definitions to forward */ tools?: ToolDefinition[]; } /** * Tool definition for Tavus conversation */ export interface ToolDefinition { /** Tool name/identifier */ name: string; /** Tool description */ description: string; /** Input schema (JSON Schema) */ inputSchema?: Record; /** Whether tool requires confirmation */ requiresConfirmation?: boolean; } /** * Active bot instance metadata */ export interface ActiveBot { /** Unique bot identifier */ botId: string; /** Bot type */ botType: BotType; /** Session ID */ sessionId: string; /** Daily.co room URL */ roomUrl: string; /** Deck URL (for screenshare bots) */ deckUrl?: string; /** Process ID */ pid?: number; /** Current status */ status: BotStatus; /** When bot was spawned */ spawnedAt: Date; /** When bot was stopped */ stoppedAt?: Date; /** Error message if failed */ error?: string; /** Log file path */ logFilePath?: string; } /** * Bot spawn result */ export interface BotSpawnResult { /** Bot identifier */ botId: string; /** Initial status */ status: BotStatus; /** Process ID */ pid?: number; /** Estimated time to join room */ estimatedJoinTime: string; /** Log file path */ logFilePath?: string; } /** * Bot lifecycle event types */ export type BotLifecycleEvent = | 'bot-spawned' | 'bot-joined' | 'bot-exited' | 'bot-error' | 'bot-killed'; /** * Bot lifecycle event payload */ export interface BotLifecycleEventPayload { /** Event type */ event: BotLifecycleEvent; /** Bot identifier */ botId: string; /** Session ID */ sessionId: string; /** Additional event data */ data?: Record; /** Timestamp */ timestamp: string; } /** * Bot manager interface */ export interface BotManager { /** * Spawn a new bot */ spawnBot(config: BotSpawnConfig): Promise; /** * Kill a bot by ID */ killBot(botId: string): Promise; /** * Get bot status */ getBotStatus(botId: string): ActiveBot | null; /** * Get all active bots */ getAllBotsStatus(): { activeCount: number; bots: ActiveBot[]; }; /** * Find bot by session ID */ findBotBySessionId(sessionId: string): string | null; /** * Shutdown all bots */ shutdown(): void; }