All renderer↔main communication in Open Science flows throughDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/aipoch/open-science/llms.txt
Use this file to discover all available pages before exploring further.
window.api — a typed object exposed by the Electron preload script via contextBridge.exposeInMainWorld('api', api). Never import from src/main/ in renderer code; every capability you need is available through window.api and the corresponding types in src/shared/.
Namespace overview
| Namespace | Description |
|---|---|
window.api.acp | Agent runtime: connect, sessions, prompts, permissions, events |
window.api.artifacts | Artifact storage: finalize runs, open files, read previews |
window.api.notebook | Python kernel: state, cells, execution, lifecycle, events |
window.api.projects | Project CRUD (SQLite-backed) |
window.api.preview | Per-project preview panel state (SQLite-backed) |
window.api.uploads | File attachment staging and finalization |
window.api.sessions | Chat session persistence (disk-based) |
window.api.saveBlobFile | Save a blob to disk via the system file picker |
window.api.getRuntimeVersions | Get Electron, Chrome, and Node version strings |
Top-level methods
saveBlobFile(request)
Saves binary or text blob data to a user-chosen location via the OS file-save dialog. The request parameter is SaveBlobFileRequest and the return value is Promise<SaveBlobFileResult>.
getRuntimeVersions()
Returns an object with the running version strings for the three Electron runtime layers:
Event listener pattern
Methods prefixed withon (e.g., onState, onEvent, onPermissionRequest) register an IPC listener and return an unsubscribe function. Always call the unsubscribe function in your cleanup effect to prevent memory leaks and duplicate event delivery:
IPC error handling
Allinvoke-based methods return Promises. Wrap them in try/catch to handle main-process errors gracefully:
message property is preserved, but custom error subclasses are not.
Type imports
Shared types live insrc/shared/ and can be imported directly in renderer code without going through the preload. Import only types — never runtime values — from shared modules:
window.api is only available inside the Electron renderer process. It is not defined in Node.js test environments or in the main process. If you need to call a function in tests, mock window.api directly or use the handler factories exported from each src/main/*/ipc.ts module.IPC channel reference
The following table maps eachwindow.api method to its underlying IPC channel for debugging with Electron DevTools or ipcMain traces:
| Method | IPC Channel |
|---|---|
acp.getState() | acp:get-state |
acp.connect() | acp:connect |
acp.disconnect() | acp:disconnect |
acp.createSession() | acp:create-session |
acp.resumeSession() | acp:resume-session |
acp.sendPrompt() | acp:send-prompt |
acp.cancel() | acp:cancel |
acp.deleteSession() | acp:delete-session |
acp.respondToPermission() | acp:respond-permission |
acp.onState() | acp:state (push) |
acp.onEvent() | acp:event (push) |
acp.onPermissionRequest() | acp:permission-request (push) |
artifacts.finalizeRunArtifacts() | artifacts:finalize-run |
artifacts.openFile() | artifacts:open-file |
artifacts.readPreview() | artifacts:read-preview |
notebook.state() | notebook:state |
notebook.beginCodeCell() | notebook:begin-code-cell |
notebook.appendCodeCell() | notebook:append-code-cell |
notebook.finishCodeCell() | notebook:finish-code-cell |
notebook.runCell() | notebook:run-cell |
notebook.execute() | notebook:execute |
notebook.restart() | notebook:restart |
notebook.shutdown() | notebook:shutdown |
notebook.onAvailable() | notebook:available (push) |
notebook.onChanged() | notebook:changed (push) |
projects.list() | projects:list |
projects.get() | projects:get |
projects.create() | projects:create |
projects.update() | projects:update |
projects.delete() | projects:delete |
preview.load() | preview:load |
preview.save() | preview:save |
preview.delete() | preview:delete |
uploads.stageFiles() | uploads:stage-files |
uploads.deleteUpload() | uploads:delete |
uploads.finalizeSession() | uploads:finalize-session |
uploads.readPreview() | uploads:read-preview |
sessions.loadAll() | sessions:load-all |
sessions.saveSession() | sessions:save-session |
sessions.deleteSession() | sessions:delete-session |
sessions.deleteProjectSessions() | sessions:delete-project-sessions |
sessions.saveManifest() | sessions:save-manifest |
saveBlobFile() | file:save-blob |