const { contextBridge, ipcRenderer } = require("electron"); contextBridge.exposeInMainWorld("deviceSimulator", { getRuntimeDefaults: () => ipcRenderer.invoke("sim:get-runtime-defaults"), configure: (input) => ipcRenderer.invoke("sim:configure", input), probe: () => ipcRenderer.invoke("sim:probe"), probeRTCNetwork: () => ipcRenderer.invoke("sim:probe-rtc-network"), probeHardwareNetwork: () => ipcRenderer.invoke("sim:probe-hardware-network"), getHardwareRuntimeDefaults: () => ipcRenderer.invoke("sim:get-hardware-runtime-defaults"), configureHardware: (input) => ipcRenderer.invoke("sim:configure-hardware", input), getAutomationAudio: () => ipcRenderer.invoke("sim:get-automation-audio"), createConversation: () => ipcRenderer.invoke("sim:create-conversation"), createHardwareAgentSession: () => ipcRenderer.invoke("sim:create-hardware-agent-session"), connectHardwareAgent: (input) => ipcRenderer.invoke("sim:connect-hardware-agent", input), sendHardwareAgentAudio: (bytes) => ipcRenderer.send("sim:hardware-agent-audio", bytes), sendHardwareAgentText: (input) => ipcRenderer.invoke("sim:hardware-agent-text", input), closeHardwareAgent: (input) => ipcRenderer.invoke("sim:close-hardware-agent", input), onHardwareProviderEvent: (callback) => { const listener = (_event, value) => callback(value); ipcRenderer.on("sim:hardware-provider-event", listener); return () => ipcRenderer.removeListener("sim:hardware-provider-event", listener); }, saveHardwareReport: (report) => ipcRenderer.invoke("sim:save-hardware-report", report), hardwareAgentEvent: (input) => ipcRenderer.invoke("sim:hardware-agent-event", input), activateConversation: (input) => ipcRenderer.invoke("sim:activate-conversation", input), getConversation: (conversationID) => ipcRenderer.invoke("sim:get-conversation", conversationID), heartbeat: (input) => ipcRenderer.invoke("sim:heartbeat", input), submitTranscriptBatch: (input) => ipcRenderer.invoke("sim:submit-transcript-batch", input), stopConversation: (input) => ipcRenderer.invoke("sim:stop-conversation", input), uploadConversationRecording: (input) => ipcRenderer.invoke("sim:upload-conversation-recording", input), });