mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 21:02:40 +02:00
feat(filesystem): add getAgentFilesystemMounts API and integrate with LocalFilesystemBrowser for improved mount management
This commit is contained in:
parent
ce71897286
commit
a7a758f26e
6 changed files with 77 additions and 5 deletions
|
|
@ -55,6 +55,7 @@ export const IPC_CHANNELS = {
|
|||
ANALYTICS_GET_CONTEXT: 'analytics:get-context',
|
||||
// Agent filesystem mode
|
||||
AGENT_FILESYSTEM_GET_SETTINGS: 'agent-filesystem:get-settings',
|
||||
AGENT_FILESYSTEM_GET_MOUNTS: 'agent-filesystem:get-mounts',
|
||||
AGENT_FILESYSTEM_SET_SETTINGS: 'agent-filesystem:set-settings',
|
||||
AGENT_FILESYSTEM_PICK_ROOT: 'agent-filesystem:pick-root',
|
||||
} as const;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import {
|
|||
import {
|
||||
readAgentLocalFileText,
|
||||
writeAgentLocalFileText,
|
||||
getAgentFilesystemMounts,
|
||||
getAgentFilesystemSettings,
|
||||
pickAgentFilesystemRoot,
|
||||
setAgentFilesystemSettings,
|
||||
|
|
@ -226,6 +227,10 @@ export function registerIpcHandlers(): void {
|
|||
getAgentFilesystemSettings()
|
||||
);
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.AGENT_FILESYSTEM_GET_MOUNTS, () =>
|
||||
getAgentFilesystemMounts()
|
||||
);
|
||||
|
||||
ipcMain.handle(
|
||||
IPC_CHANNELS.AGENT_FILESYSTEM_SET_SETTINGS,
|
||||
(_event, settings: { mode?: 'cloud' | 'desktop_local_folder'; localRootPaths?: string[] | null }) =>
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ function toVirtualPath(rootPath: string, absolutePath: string): string {
|
|||
return `/${rel.replace(/\\/g, "/")}`;
|
||||
}
|
||||
|
||||
type LocalRootMount = {
|
||||
export type LocalRootMount = {
|
||||
mount: string;
|
||||
rootPath: string;
|
||||
};
|
||||
|
|
@ -145,6 +145,11 @@ function buildRootMounts(rootPaths: string[]): LocalRootMount[] {
|
|||
return mounts;
|
||||
}
|
||||
|
||||
export async function getAgentFilesystemMounts(): Promise<LocalRootMount[]> {
|
||||
const rootPaths = await resolveCurrentRootPaths();
|
||||
return buildRootMounts(rootPaths);
|
||||
}
|
||||
|
||||
function parseMountedVirtualPath(virtualPath: string): {
|
||||
mount: string;
|
||||
subPath: string;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
// Agent filesystem mode
|
||||
getAgentFilesystemSettings: () =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_GET_SETTINGS),
|
||||
getAgentFilesystemMounts: () =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.AGENT_FILESYSTEM_GET_MOUNTS),
|
||||
setAgentFilesystemSettings: (settings: {
|
||||
mode?: "cloud" | "desktop_local_folder";
|
||||
localRootPaths?: string[] | null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue