Something went wrong. Try again.
A mental bridge between a hacker and their LLM(s) of choice.
Something went wrong. Try again.
123456789101112131415161718192021222324252627// Static preload script (not compiled by shadow-cljs). Runs in an isolated// context with access to Node and the renderer's `window`. Exposes a// minimal, frozen bridge for the sandboxed renderer to talk to main.//// Named `window.noidBridge`, NOT `window.noid`: in the dev (unoptimized)// renderer build, `window.noid` is the ClojureScript namespace root// (`noid.graph`, `noid.ui.*`), which the e2e driver reads directly. A// contextBridge-exposed object is frozen, so it can't also host those// namespaces without breaking them.const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('noidBridge', { invoke: (channel, edn) => channel.startsWith('noid/') ? ipcRenderer.invoke(channel, edn) : Promise.reject(new Error('bad channel ' + channel)), onEvent: (fn) => { ipcRenderer.on('noid/fs-event', (_event, edn) => fn(edn)); }, onOpenRequest: (fn) => { ipcRenderer.on('noid/open-request', (_event, edn) => fn(edn)); }, onAgentRequest: (fn) => { ipcRenderer.on('noid/agent-request', (_event, edn) => fn(edn)); }});