[GH-ISSUE #18] M001/S01/T02: Create IPC handler and preload bridge #18

Open
opened 2026-06-04 14:29:26 -04:00 by yindo · 0 comments
Owner

Originally created by @BillyOutlast on GitHub (May 16, 2026).
Original GitHub issue: https://github.com/Heretek-AI/GDevelop-BYOK/issues/18

T02: Create IPC handler and preload bridge

The proxy modules (T01) need to be wired into Electron's IPC system. The IPC handler lives in the main process; the preload bridge exposes it to the renderer. (1) Create src/ipc/byokHandler.js — export registerByokIpcHandlers(ipcMain) which registers a single ipcMain.handle('byok-ai-request', handler). The handler reads payload { mode, messages, userRequest, projectContext, aiConfiguration } from the renderer. Mode routing: 'chat' → direct request-response returning { content, usage }; 'agent' | 'orchestrator' → fire-and-forget via requestStore, returns { requestId }. Uses callLLM from T01, buildSystemPrompt to assemble system message + user messages. Integrates ByokError. Logs entry/exit/failure to console. (2) Create src/preload/byokBridge.js — uses contextBridge.exposeInMainWorld('byokAiRequest', ...) wrapping ipcRenderer.invoke('byok-ai-request', payload). Exposes byokAiRequest(payload) and byokAiRequestStatus(requestId) (polls requestStore). (3) Write unit tests using node:test that exercise the handler's mode routing with mocked ipcMain and proxy modules.

Files

  • src/ipc/byokHandler.js
  • src/preload/byokBridge.js
  • test/unit/ipc.test.js

Verification

  • node --test test/unit/proxy.test.js && node --test test/unit/ipc.test.js
Originally created by @BillyOutlast on GitHub (May 16, 2026). Original GitHub issue: https://github.com/Heretek-AI/GDevelop-BYOK/issues/18 ## T02: Create IPC handler and preload bridge The proxy modules (T01) need to be wired into Electron's IPC system. The IPC handler lives in the main process; the preload bridge exposes it to the renderer. (1) Create src/ipc/byokHandler.js — export registerByokIpcHandlers(ipcMain) which registers a single ipcMain.handle('byok-ai-request', handler). The handler reads payload { mode, messages, userRequest, projectContext, aiConfiguration } from the renderer. Mode routing: 'chat' → direct request-response returning { content, usage }; 'agent' | 'orchestrator' → fire-and-forget via requestStore, returns { requestId }. Uses callLLM from T01, buildSystemPrompt to assemble system message + user messages. Integrates ByokError. Logs entry/exit/failure to console. (2) Create src/preload/byokBridge.js — uses contextBridge.exposeInMainWorld('byokAiRequest', ...) wrapping ipcRenderer.invoke('byok-ai-request', payload). Exposes byokAiRequest(payload) and byokAiRequestStatus(requestId) (polls requestStore). (3) Write unit tests using node:test that exercise the handler's mode routing with mocked ipcMain and proxy modules. ### Files - `src/ipc/byokHandler.js` - `src/preload/byokBridge.js` - `test/unit/ipc.test.js` ### Verification - [ ] node --test test/unit/proxy.test.js && node --test test/unit/ipc.test.js
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Heretek-AI/GDevelop-BYOK#18