6ede33ccdb
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / compute_version (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / verify_digests (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / finalize_release (push) Blocked by required conditions
Obsidian Plugin Lint / lint (push) Waiting to run
73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
export type AgentFilesystemMode = "cloud" | "desktop_local_folder";
|
|
export type ClientPlatform = "web" | "desktop";
|
|
|
|
export interface AgentFilesystemMountSelection {
|
|
mount_id: string;
|
|
root_path: string;
|
|
}
|
|
|
|
export interface AgentFilesystemSelection {
|
|
filesystem_mode: AgentFilesystemMode;
|
|
client_platform: ClientPlatform;
|
|
local_filesystem_mounts?: AgentFilesystemMountSelection[];
|
|
}
|
|
|
|
export interface AgentFilesystemSelectionOptions {
|
|
localFilesystemEnabled: boolean;
|
|
}
|
|
|
|
const DEFAULT_SELECTION: AgentFilesystemSelection = {
|
|
filesystem_mode: "cloud",
|
|
client_platform: "web",
|
|
};
|
|
|
|
export function getClientPlatform(): ClientPlatform {
|
|
if (typeof window === "undefined") return "web";
|
|
return window.electronAPI ? "desktop" : "web";
|
|
}
|
|
|
|
export async function getAgentFilesystemSelection(
|
|
workspaceId?: number | null,
|
|
options?: AgentFilesystemSelectionOptions
|
|
): Promise<AgentFilesystemSelection> {
|
|
const platform = getClientPlatform();
|
|
if (
|
|
platform !== "desktop" ||
|
|
!options?.localFilesystemEnabled ||
|
|
!window.electronAPI?.getAgentFilesystemSettings
|
|
) {
|
|
return { ...DEFAULT_SELECTION, client_platform: platform };
|
|
}
|
|
try {
|
|
const settings = await window.electronAPI.getAgentFilesystemSettings(workspaceId);
|
|
if (settings.mode === "desktop_local_folder") {
|
|
const mounts = await window.electronAPI.getAgentFilesystemMounts?.(workspaceId);
|
|
const localFilesystemMounts =
|
|
mounts?.map((entry) => ({
|
|
mount_id: entry.mount,
|
|
root_path: entry.rootPath,
|
|
})) ?? [];
|
|
if (localFilesystemMounts.length === 0) {
|
|
return {
|
|
filesystem_mode: "cloud",
|
|
client_platform: "desktop",
|
|
};
|
|
}
|
|
return {
|
|
filesystem_mode: "desktop_local_folder",
|
|
client_platform: "desktop",
|
|
local_filesystem_mounts: localFilesystemMounts,
|
|
};
|
|
}
|
|
return {
|
|
filesystem_mode: "cloud",
|
|
client_platform: "desktop",
|
|
};
|
|
} catch {
|
|
return {
|
|
filesystem_mode: "cloud",
|
|
client_platform: "desktop",
|
|
};
|
|
}
|
|
}
|