32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { contextBridge, ipcRenderer } from "electron";
|
|
|
|
const api = {
|
|
state: () => ipcRenderer.invoke("state:get"),
|
|
providers: {
|
|
save: (provider: unknown) => ipcRenderer.invoke("providers:save", provider),
|
|
remove: (id: string) => ipcRenderer.invoke("providers:remove", id),
|
|
probe: (id: string) => ipcRenderer.invoke("providers:probe", id)
|
|
},
|
|
brain: {
|
|
add: (input: unknown) => ipcRenderer.invoke("brain:add", input),
|
|
update: (id: string, patch: unknown) => ipcRenderer.invoke("brain:update", id, patch),
|
|
remove: (id: string) => ipcRenderer.invoke("brain:remove", id)
|
|
},
|
|
workspace: {
|
|
open: () => ipcRenderer.invoke("workspace:open"),
|
|
list: (id: string) => ipcRenderer.invoke("workspace:list", id),
|
|
read: (id: string, relativePath: string) => ipcRenderer.invoke("workspace:read", id, relativePath)
|
|
},
|
|
agent: {
|
|
run: (request: unknown) => ipcRenderer.invoke("agent:run", request)
|
|
},
|
|
web: {
|
|
saveSettings: (settings: unknown) => ipcRenderer.invoke("web:settings", settings),
|
|
createPairing: () => ipcRenderer.invoke("web:pairing:create")
|
|
}
|
|
};
|
|
|
|
contextBridge.exposeInMainWorld("coworker", api);
|
|
|
|
export type CoworkerApi = typeof api;
|