import { RealtimeItem, OutputGuardrailTripwireTriggered, TransportEvent, } from '@openai/agents/realtime'; import { History } from '@/components/History'; import { Button } from '@/components/ui/Button'; export type AppProps = { title?: string; isConnected: boolean; isMuted: boolean; toggleMute: () => void; connect: () => void; history?: RealtimeItem[]; outputGuardrailResult?: OutputGuardrailTripwireTriggered | null; events: TransportEvent[]; }; export function App({ title = 'Realtime Agent Demo', isConnected, isMuted, toggleMute, connect, history, outputGuardrailResult, events, }: AppProps) { return (

{title}

{isConnected && ( )}
{history ? ( ) : (
No history available
)}
{outputGuardrailResult && (
Guardrail:{' '} {outputGuardrailResult?.message || JSON.stringify(outputGuardrailResult)}
)}
{events.map((event, index) => (
{event.type}
{JSON.stringify(event, null, 2)}
))}
); }