-
Notifications
You must be signed in to change notification settings - Fork 0
IPC Contract
Yash Aryan edited this page Aug 8, 2026
·
1 revision
The renderer never imports Node modules. All privileged work goes through window.api, defined by:
-
app/src/types/api.d.ts— TypeScript contract (AnyLmApi) -
app/preload.ts—contextBridgeimplementation -
app/src/main/ipc.ts—ipcMainhandlers
A rename or signature drift fails bun run typecheck if all three stay honest.
// preload
toolsList: () => ipcRenderer.invoke("tools:list"),
// main
ipcMain.handle("tools:list", async () => toolsRegistry.list()),Main webContents.send("chat:chunk", payload)
Preload exposes onChatChunk(cb) wrapping ipcRenderer.on
Renderer registers once and updates UI
Tool confirms and ask-user use the same push + reply pattern.
Inspect api.d.ts for the full list. Groups include:
- Auth / session /
requestpassthroughs - Projects, threads, chats, references
- Chat start/stop + stream listeners
- Tools & skills CRUD + connectors
- Workspace pick/clear
- Settings get/set
- Proxy status
- Ollama status / models / setup
- Artifacts / documents
- Updates
- Governance warnings listeners
-
Never re-introduce
nodeIntegration. - Don’t expose raw
ipcRendererto the renderer. - Validate/normalize arguments in main — preload is not a trust boundary against a compromised renderer, but clean typing still matters.
- Keep channel names stable or bump carefully; no schema registry beyond TypeScript.
- Prefer structured payloads already used in domain types over ad-hoc bags.
- Unit-test pure helpers extracted from
ipc.tswhen possible. -
test/electron-mock.tsstubs Electron forbun test. - Full Electron e2e is minimal — manual smoke for stream/confirm paths.
| Page | Description |
|---|---|
| Home | Overview and navigation |
| Getting-Started | Local setup |
| Architecture | System design |
| Code-Structure | Directory map |
| Features | Feature inventory |
| Contributing | PR workflow |
| How-to-Change | Common change recipes |
| Gotchas | Footguns |
| Chat-Pipeline | Turn lifecycle |
| IPC-Contract | window.api |
| Auth-and-Firebase | Identity + rules |
| RAG-and-Knowledge | Vectors + graph |
| Agents | Multi-agent |
| Proxy-and-Governance | :3227 + policies |
| Configuration | Env + settings |
| Testing | bun test |
| Build-and-Release | Packaging |
| Skills | Build skills |
| Tools | Build tools |
| MCP-and-Extensions | MCP status + options |