// Secure bridge between the sandboxed renderer and the main process.
const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('agent', {
  onConfig: (cb) => ipcRenderer.on('config', (_e, cfg) => cb(cfg)),
  injectInput: (evt) => ipcRenderer.send('inject-input', evt),
  sessionEnded: () => ipcRenderer.send('session-ended'),
  getPrimarySize: () => ipcRenderer.invoke('get-primary-size'),
});
