feat(desktop): expose agent filesystem IPC APIs

This commit is contained in:
Anish Sarkar 2026-04-23 15:45:59 +05:30
parent 1eadecee23
commit 5c3a327a0c
3 changed files with 31 additions and 0 deletions

View file

@ -51,4 +51,8 @@ export const IPC_CHANNELS = {
ANALYTICS_RESET: 'analytics:reset',
ANALYTICS_CAPTURE: 'analytics:capture',
ANALYTICS_GET_CONTEXT: 'analytics:get-context',
// Agent filesystem mode
AGENT_FILESYSTEM_GET_SETTINGS: 'agent-filesystem:get-settings',
AGENT_FILESYSTEM_SET_SETTINGS: 'agent-filesystem:set-settings',
AGENT_FILESYSTEM_PICK_ROOT: 'agent-filesystem:pick-root',
} as const;

View file

@ -36,6 +36,11 @@ import {
resetUser as analyticsReset,
trackEvent,
} from '../modules/analytics';
import {
getAgentFilesystemSettings,
pickAgentFilesystemRoot,
setAgentFilesystemSettings,
} from '../modules/agent-filesystem';
let authTokens: { bearer: string; refresh: string } | null = null;
@ -191,4 +196,18 @@ export function registerIpcHandlers(): void {
platform: process.platform,
};
});
ipcMain.handle(IPC_CHANNELS.AGENT_FILESYSTEM_GET_SETTINGS, () =>
getAgentFilesystemSettings()
);
ipcMain.handle(
IPC_CHANNELS.AGENT_FILESYSTEM_SET_SETTINGS,
(_event, settings: { mode?: 'cloud' | 'desktop_local_folder'; localRootPath?: string | null }) =>
setAgentFilesystemSettings(settings)
);
ipcMain.handle(IPC_CHANNELS.AGENT_FILESYSTEM_PICK_ROOT, () =>
pickAgentFilesystemRoot()
);
}

View file

@ -101,4 +101,12 @@ contextBridge.exposeInMainWorld('electronAPI', {
analyticsCapture: (event: string, properties?: Record<string, unknown>) =>
ipcRenderer.invoke(IPC_CHANNELS.ANALYTICS_CAPTURE, { event, properties }),
getAnalyticsContext: () => ipcRenderer.invoke(IPC_CHANNELS.ANALYTICS_GET_CONTEXT),
// Agent filesystem mode
getAgentFilesystemSettings: () =>
ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_GET_SETTINGS),
setAgentFilesystemSettings: (settings: {
mode?: "cloud" | "desktop_local_folder";
localRootPath?: string | null;
}) => ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_SET_SETTINGS, settings),
pickAgentFilesystemRoot: () => ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_PICK_ROOT),
});