Initial Coworker app scaffold
This commit is contained in:
31
apps/desktop/electron/preload.ts
Normal file
31
apps/desktop/electron/preload.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user